diff --git a/.cursor/rules/Storybook-development-guidelines.mdc b/.cursor/rules/Storybook-development-guidelines.mdc index 31a8593..7792e76 100644 --- a/.cursor/rules/Storybook-development-guidelines.mdc +++ b/.cursor/rules/Storybook-development-guidelines.mdc @@ -132,6 +132,42 @@ alwaysApply: false }; ``` +- **Args-to-Props Consistency**: All story args must be passed to the rendered component via props. Never hardcode props in templates when they should come from args: + - ✅ **Correct**: Use `v-bind="args"` to pass all args as props + ```typescript + template: ` + + ` + ``` + - ❌ **Incorrect**: Hardcoding props that should come from args + ```typescript + template: ` + + ` + ``` + - ✅ **Correct**: When overriding specific props, still use `v-bind="args"` first, then override: + ```typescript + template: ` + + ` + ``` + - **Story Args**: All component props should be controllable through story args. Define props in the story's `args` object rather than hardcoding them in templates: + ```typescript + args: { + label: "Custom Label", + placeholder: "Custom Placeholder", + options: ["Option 1", "Option 2"] + } + ``` + - **Verification**: Ensure that when users modify controls in Storybook, those changes are reflected in the rendered component through the args binding. + ### 4. ArgTypes & Controls Configuration - **ArgTypes Definition**: Define comprehensive argTypes for all props: @@ -413,6 +449,7 @@ Note: Avoid embedding code in this section; Storybook auto-generates usage code. - **Story Creation**: Automatically create comprehensive stories for new components with proper structure, argTypes, and documentation. - **Pattern Consistency**: Follow established patterns from existing stories in the project. +- **Args-to-Props Matching**: Always ensure story args are passed to rendered components via `v-bind="args"`. Never hardcode props in templates that should come from story args. All component props must be controllable through Storybook controls. - **TypeScript Integration**: Ensure proper TypeScript typing for all stories and meta configurations. - **Theme Integration**: Leverage global theme controls and main decorator for consistent theming. - **Documentation Quality**: Include comprehensive component documentation with usage examples. diff --git a/src/elements/Button.vue b/src/elements/Button.vue index 69a13d1..23fb176 100644 --- a/src/elements/Button.vue +++ b/src/elements/Button.vue @@ -24,7 +24,9 @@ computedFocusColor, computedHoverNeutralizeClasses, // Handle disabled styling when in InputGroup - (isInInputGroup && context && context.disabled) || + (isInInputGroup && + context && + (disabled !== undefined ? disabled : context.disabled)) || disabled || cardDisabled ? 'bg-gray-100 text-gray-400 cursor-not-allowed border-gray-200 dark:bg-gray-800 dark:border-gray-700' @@ -51,7 +53,11 @@ props.chip ? 'is-chip' : undefined, ], ]" - :disabled="disabled || cardDisabled || isLoading ? true : undefined" + :disabled=" + isInInputGroup && context + ? (disabled !== undefined ? disabled : context.disabled) || isLoading + : disabled || cardDisabled || isLoading + " @focus="handleFocusEvent" @blur="handleBlurEvent" > diff --git a/src/form/Input.vue b/src/form/Input.vue index 524cc82..9550058 100644 --- a/src/form/Input.vue +++ b/src/form/Input.vue @@ -1,5 +1,5 @@