srcdev-nuxt-components 9.6.8 → 9.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/.claude/skills/component-compliance-checklist.md +28 -1
  2. package/.claude/skills/component-inline-action-button.md +1 -1
  3. package/.claude/skills/component-local-style-override.md +1 -1
  4. package/.claude/skills/component-naming.md +17 -12
  5. package/.claude/skills/components/container-glow.md +2 -2
  6. package/.claude/skills/components/form-field.md +2 -2
  7. package/.claude/skills/components/form-wrapper.md +1 -1
  8. package/.claude/skills/components/glowing-border.md +1 -1
  9. package/.claude/skills/components/input-description.md +7 -7
  10. package/.claude/skills/components/input-error.md +3 -3
  11. package/.claude/skills/components/input-label.md +7 -8
  12. package/.claude/skills/components/input-number.md +17 -17
  13. package/.claude/skills/components/input-select.md +153 -0
  14. package/.claude/skills/components/input-text.md +220 -0
  15. package/.claude/skills/components/input-textarea.md +147 -0
  16. package/.claude/skills/components/select-menu.md +4 -4
  17. package/.claude/skills/components/toggle-switch.md +143 -0
  18. package/.claude/skills/composable-zod-validation.md +1 -1
  19. package/.claude/skills/css-nesting-conventions.md +22 -1
  20. package/.claude/skills/icon-sets.md +1 -1
  21. package/.claude/skills/icon-sizing.md +1 -1
  22. package/.claude/skills/index.md +5 -5
  23. package/.claude/skills/storybook-add-story.md +1 -1
  24. package/.claude/skills/theming-component-token-pattern.md +8 -8
  25. package/.claude/skills/theming-form-geometry-tokens.md +1 -1
  26. package/.vscode/srcdev-component-input-select.code-snippets +20 -14
  27. package/.vscode/srcdev-component-input-text.code-snippets +46 -40
  28. package/.vscode/srcdev-component-input-textarea.code-snippets +19 -14
  29. package/.vscode/srcdev-component-toggle-switch.code-snippets +19 -29
  30. package/app/assets/styles/setup/04.elements/forms/00.element-defaults.css +2 -2
  31. package/app/assets/styles/setup/04.elements/forms/06.button-geometry.css +1 -1
  32. package/app/components/01.atoms/animations/glowing-border/CONSUMER-STYLING.md +2 -2
  33. package/app/components/01.atoms/animations/glowing-border/stories/GlowingBorder.stories.ts +4 -4
  34. package/app/components/02.molecules/progress-tracker/stories/ProgressTracker.stories.ts +4 -4
  35. package/app/components/05.forms/form-errors/CONSUMER-STYLING.md +1 -1
  36. package/app/components/05.forms/form-field/CONSUMER-STYLING.md +2 -2
  37. package/app/components/05.forms/input-button/stories/InputButton.stories.ts +3 -3
  38. package/app/components/05.forms/input-description/CONSUMER-STYLING.md +6 -6
  39. package/app/components/05.forms/input-label/CONSUMER-STYLING.md +7 -7
  40. package/app/components/05.forms/input-number/CONSUMER-STYLING.md +9 -5
  41. package/app/components/05.forms/input-number/InputNumber.vue +2 -2
  42. package/app/components/05.forms/input-select/CONSUMER-STYLING.md +80 -10
  43. package/app/components/05.forms/input-select/InputSelect.vue +198 -0
  44. package/app/components/05.forms/input-select/InputSelectField.vue +130 -0
  45. package/app/components/05.forms/input-select/stories/InputSelect.stories.ts +184 -0
  46. package/app/components/05.forms/input-select/stories/InputSelectField.stories.ts +187 -0
  47. package/app/components/05.forms/input-select/tests/{InputSelectCore.spec.ts → InputSelect.spec.ts} +75 -12
  48. package/app/components/05.forms/input-select/tests/InputSelectField.spec.ts +121 -0
  49. package/app/components/05.forms/input-text/CONSUMER-STYLING.md +85 -15
  50. package/app/components/05.forms/input-text/{InputPasswordWithLabel.vue → InputPasswordField.vue} +16 -19
  51. package/app/components/05.forms/input-text/{InputTextCore.vue → InputText.vue} +42 -78
  52. package/app/components/05.forms/input-text/{InputTextAsNumberWithLabel.vue → InputTextAsNumberField.vue} +66 -62
  53. package/app/components/05.forms/input-text/InputTextField.vue +168 -0
  54. package/app/components/05.forms/input-text/stories/InputPasswordField.stories.ts +163 -0
  55. package/app/components/05.forms/input-text/stories/InputText.stories.ts +194 -0
  56. package/app/components/05.forms/input-text/stories/InputTextAsNumberField.stories.ts +182 -0
  57. package/app/components/05.forms/input-text/stories/InputTextField.stories.ts +206 -0
  58. package/app/components/05.forms/input-text/tests/{InputPasswordWithLabel.spec.ts → InputPasswordField.spec.ts} +42 -3
  59. package/app/components/05.forms/input-text/tests/InputText.spec.ts +166 -0
  60. package/app/components/05.forms/input-text/tests/InputTextAsNumberField.spec.ts +135 -0
  61. package/app/components/05.forms/input-text/tests/InputTextField.spec.ts +130 -0
  62. package/app/components/05.forms/input-textarea/CONSUMER-STYLING.md +94 -12
  63. package/app/components/05.forms/input-textarea/InputTextarea.vue +165 -0
  64. package/app/components/05.forms/input-textarea/InputTextareaField.vue +159 -0
  65. package/app/components/05.forms/input-textarea/stories/InputTextarea.stories.ts +198 -0
  66. package/app/components/05.forms/input-textarea/stories/InputTextareaField.stories.ts +161 -0
  67. package/app/components/05.forms/input-textarea/tests/InputTextarea.spec.ts +149 -0
  68. package/app/components/05.forms/input-textarea/tests/InputTextareaField.spec.ts +122 -0
  69. package/app/components/05.forms/patterns/stories/ContactForm.stories.ts +13 -13
  70. package/app/components/05.forms/patterns/stories/LoginForm.stories.ts +6 -6
  71. package/app/components/05.forms/patterns/stories/MigratedFieldsForm.stories.ts +30 -32
  72. package/app/components/05.forms/toggle-switch/CONSUMER-STYLING.md +71 -50
  73. package/app/components/05.forms/toggle-switch/{ToggleSwitchCore.vue → ToggleSwitch.vue} +58 -73
  74. package/app/components/05.forms/toggle-switch/{ToggleSwitchWithLabel.vue → ToggleSwitchField.vue} +65 -19
  75. package/app/components/05.forms/toggle-switch/stories/ToggleSwitch.stories.ts +148 -0
  76. package/app/components/05.forms/toggle-switch/stories/ToggleSwitchField.stories.ts +176 -0
  77. package/app/components/05.forms/toggle-switch/tests/ToggleSwitch.spec.ts +145 -0
  78. package/app/components/05.forms/toggle-switch/tests/ToggleSwitchField.spec.ts +155 -0
  79. package/package.json +1 -1
  80. package/.claude/skills/components/input-select-core.md +0 -151
  81. package/.claude/skills/components/input-text-core.md +0 -204
  82. package/.claude/skills/components/input-textarea-core.md +0 -154
  83. package/.claude/skills/components/toggle-switch-core.md +0 -169
  84. package/app/components/05.forms/input-select/InputSelectCore.vue +0 -188
  85. package/app/components/05.forms/input-select/InputSelectWithLabel.vue +0 -118
  86. package/app/components/05.forms/input-select/stories/InputSelectCore.stories.ts +0 -69
  87. package/app/components/05.forms/input-select/stories/InputSelectWithLabel.stories.ts +0 -115
  88. package/app/components/05.forms/input-select/tests/InputSelectWithLabel.spec.ts +0 -87
  89. package/app/components/05.forms/input-text/InputTextWithLabel.vue +0 -154
  90. package/app/components/05.forms/input-text/stories/InputPasswordWithLabel.stories.ts +0 -368
  91. package/app/components/05.forms/input-text/stories/InputTextAsNumberWithLabel.stories.ts +0 -480
  92. package/app/components/05.forms/input-text/stories/InputTextCore.stories.ts +0 -267
  93. package/app/components/05.forms/input-text/stories/InputTextWithLabel.stories.ts +0 -319
  94. package/app/components/05.forms/input-text/tests/InputTextAsNumberWithLabel.spec.ts +0 -75
  95. package/app/components/05.forms/input-text/tests/InputTextCore.spec.ts +0 -60
  96. package/app/components/05.forms/input-text/tests/InputTextWithLabel.spec.ts +0 -71
  97. package/app/components/05.forms/input-textarea/InputTextareaCore.vue +0 -159
  98. package/app/components/05.forms/input-textarea/InputTextareaWithLabel.vue +0 -136
  99. package/app/components/05.forms/input-textarea/stories/InputTextareaCore.stories.ts +0 -247
  100. package/app/components/05.forms/input-textarea/stories/InputTextareaWithLabel.stories.ts +0 -458
  101. package/app/components/05.forms/input-textarea/tests/InputTextareaCore.spec.ts +0 -119
  102. package/app/components/05.forms/input-textarea/tests/InputTextareaWithLabel.spec.ts +0 -93
  103. package/app/components/05.forms/toggle-switch/ToggleSwitchWithLabelInline.vue +0 -81
  104. package/app/components/05.forms/toggle-switch/stories/ToggleSwitchCore.stories.ts +0 -251
  105. package/app/components/05.forms/toggle-switch/stories/ToggleSwitchWithLabel.stories.ts +0 -251
  106. package/app/components/05.forms/toggle-switch/stories/ToggleSwitchWithLabelInline.stories.ts +0 -283
  107. package/app/components/05.forms/toggle-switch/tests/ToggleSwitchCore.spec.ts +0 -101
  108. package/app/components/05.forms/toggle-switch/tests/ToggleSwitchWithLabel.spec.ts +0 -133
  109. package/app/components/05.forms/toggle-switch/tests/ToggleSwitchWithLabelInline.spec.ts +0 -66
@@ -1,81 +0,0 @@
1
- <template>
2
- <div class="toggle-switch-with-label-inline" :class="[elementClasses]" :data-theme="theme">
3
- <InputLabel
4
- :id="toggleSwitchId"
5
- indicator="none"
6
- input-variant="normal"
7
- :style-class-passthrough="['input-switch-label', 'input-text-label', labelWeightClass]"
8
- >
9
- <template #textLabel>{{ label }}</template>
10
- </InputLabel>
11
-
12
- <ToggleSwitchCore :id v-model="modelValue" :name :true-value :false-value :theme :round>
13
- <template v-if="slots.iconOn" #iconOn>
14
- <slot name="iconOn"></slot>
15
- </template>
16
-
17
- <template v-if="slots.iconOff" #iconOff>
18
- <slot name="iconOff"></slot>
19
- </template>
20
- </ToggleSwitchCore>
21
- </div>
22
- </template>
23
-
24
- <script setup lang="ts">
25
- import type { FormUiTheme, LabelWeight } from "~/types/forms/types.forms";
26
-
27
- interface Props {
28
- name: string;
29
- label: string;
30
- labelWeight?: LabelWeight;
31
- trueValue?: string | number | boolean;
32
- falseValue?: string | number | boolean;
33
- styleClassPassthrough?: string | string[];
34
- theme?: FormUiTheme;
35
- round?: boolean;
36
- }
37
-
38
- const props = withDefaults(defineProps<Props>(), {
39
- labelWeight: "normal",
40
- trueValue: true,
41
- falseValue: false,
42
- styleClassPassthrough: () => [],
43
- theme: "default",
44
- round: true,
45
- });
46
-
47
- const slots = useSlots();
48
- const id = useId();
49
-
50
- // Performance-optimized computed property to avoid template string interpolation
51
- const toggleSwitchId = computed(() => `toggle-switch-${id}`);
52
-
53
- // Optimized labelWeight mapping using object lookup for better performance
54
- const labelWeightClassMap: Record<LabelWeight, string> = {
55
- bold: "body-normal-bold",
56
- "semi-bold": "body-normal-semibold",
57
- normal: "body-normal",
58
- };
59
-
60
- const labelWeightClass = computed(() => {
61
- return labelWeightClassMap[props.labelWeight] || "body-normal-semibold";
62
- });
63
-
64
- const modelValue = defineModel<string | number | boolean>({ required: true });
65
- const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
66
- </script>
67
-
68
- <style lang="css">
69
- @layer components {
70
- .toggle-switch-with-label-inline {
71
- display: flex;
72
- align-items: center;
73
- gap: 12px;
74
-
75
- .toggle-switch-label {
76
- display: block;
77
- white-space: nowrap;
78
- }
79
- }
80
- }
81
- </style>
@@ -1,251 +0,0 @@
1
- import type { Meta, StoryFn } from "@nuxtjs/storybook";
2
- import { computed, ref } from "vue";
3
- import StorybookComponent from "../ToggleSwitchCore.vue";
4
- import type { FormUiTheme } from "~/types/forms/types.forms.d";
5
-
6
- interface ToggleSwitchCoreStoryArgs {
7
- id: string;
8
- name: string;
9
- required: boolean;
10
- fieldHasError: boolean;
11
- trueValue: string | number | boolean;
12
- falseValue: string | number | boolean;
13
- styleClassPassthrough: string[];
14
- theme: FormUiTheme;
15
- round: boolean;
16
- ariaDescribedby: string;
17
- useCustomIcons: boolean;
18
- iconOnContent: string;
19
- iconOffContent: string;
20
- symbolSize: string;
21
- }
22
-
23
- export default {
24
- title: "Components/Forms/Toggle Switch/ToggleSwitchCore",
25
- component: StorybookComponent,
26
- argTypes: {
27
- // Basic Configuration
28
- id: {
29
- control: "text",
30
- description: "Unique identifier for the toggle switch",
31
- table: {
32
- category: "Basic",
33
- },
34
- },
35
- name: {
36
- control: "text",
37
- description: "Name attribute for the toggle switch",
38
- table: {
39
- category: "Basic",
40
- },
41
- },
42
- required: {
43
- control: "boolean",
44
- description: "Whether the toggle switch is required",
45
- table: {
46
- category: "Basic",
47
- },
48
- },
49
-
50
- // Values
51
- trueValue: {
52
- control: "text",
53
- description: "Value when toggle is on/checked",
54
- table: {
55
- category: "Values",
56
- },
57
- },
58
- falseValue: {
59
- control: "text",
60
- description: "Value when toggle is off/unchecked",
61
- table: {
62
- category: "Values",
63
- },
64
- },
65
-
66
- // States
67
- fieldHasError: {
68
- control: "boolean",
69
- description: "Whether the field is in error state",
70
- table: {
71
- category: "States",
72
- },
73
- },
74
-
75
- // Styling
76
- theme: {
77
- control: { type: "select" },
78
- options: ["default", "success", "error", "warning"],
79
- description: "Toggle switch theme",
80
- table: {
81
- category: "Styling",
82
- },
83
- },
84
- round: {
85
- control: "boolean",
86
- description: "Whether the toggle switch is rounded",
87
- table: {
88
- category: "Styling",
89
- },
90
- },
91
- styleClassPassthrough: {
92
- control: "object",
93
- description: "Additional CSS classes",
94
- table: {
95
- category: "Styling",
96
- },
97
- },
98
-
99
- // Accessibility
100
- ariaDescribedby: {
101
- control: "text",
102
- description: "aria-describedby attribute",
103
- table: {
104
- category: "Accessibility",
105
- },
106
- },
107
-
108
- // Icons
109
- useCustomIcons: {
110
- control: "boolean",
111
- description: "Use custom icons instead of default",
112
- table: {
113
- category: "Icons",
114
- },
115
- },
116
- iconOnContent: {
117
- control: "text",
118
- description: "Content for the 'on' icon slot",
119
- table: {
120
- category: "Icons",
121
- },
122
- },
123
- iconOffContent: {
124
- control: "text",
125
- description: "Content for the 'off' icon slot",
126
- table: {
127
- category: "Icons",
128
- },
129
- },
130
- symbolSize: {
131
- control: { type: "select" },
132
- options: ["2rem", "2.2rem", "2.4rem", "3rem", "3.6rem"],
133
- description:
134
- "`--input-toggle-symbol-size` — thumb size. Track width has no separate control: it's derived from this token (see ToggleSwitchCore's `--_track-width` comment), so it scales automatically.",
135
- table: {
136
- category: "Styling",
137
- },
138
- },
139
- },
140
- } as Meta<ToggleSwitchCoreStoryArgs>;
141
-
142
- const Template: StoryFn<ToggleSwitchCoreStoryArgs> = (_args, { argTypes }) => ({
143
- components: { StorybookComponent },
144
- props: Object.keys(argTypes),
145
- setup() {
146
- const modelValue = ref(false);
147
- const cssTokenStyle = computed(() => ({
148
- "--input-toggle-symbol-size": _args.symbolSize,
149
- }));
150
- return { args: _args, modelValue, cssTokenStyle };
151
- },
152
- template: `
153
- <StorybookComponent
154
- v-model="modelValue"
155
- :id="args.id"
156
- :name="args.name"
157
- :required="args.required"
158
- :field-has-error="args.fieldHasError"
159
- :true-value="args.trueValue"
160
- :false-value="args.falseValue"
161
- :style-class-passthrough="args.styleClassPassthrough"
162
- :theme="args.theme"
163
- :round="args.round"
164
- :aria-describedby="args.ariaDescribedby"
165
- :style="cssTokenStyle"
166
- >
167
- <template v-if="args.useCustomIcons" #iconOn>
168
- <span v-html="args.iconOnContent"></span>
169
- </template>
170
- <template v-if="args.useCustomIcons" #iconOff>
171
- <span v-html="args.iconOffContent"></span>
172
- </template>
173
- </StorybookComponent>
174
- <div style="margin-top: 1rem; font-size: 0.875rem; color: #666;">
175
- Current value: {{ modelValue }}
176
- </div>
177
- `,
178
- });
179
-
180
- export const Default = Template.bind({});
181
- Default.args = {
182
- id: "toggle-default",
183
- name: "toggleDefault",
184
- required: false,
185
- fieldHasError: false,
186
- trueValue: true,
187
- falseValue: false,
188
- styleClassPassthrough: [],
189
- theme: "default",
190
- round: true,
191
- ariaDescribedby: "",
192
- useCustomIcons: false,
193
- iconOnContent: "✓",
194
- iconOffContent: "✗",
195
- symbolSize: "3rem",
196
- };
197
-
198
- export const WithCustomIcons = Template.bind({});
199
- WithCustomIcons.args = {
200
- ...Default.args,
201
- id: "toggle-custom-icons",
202
- name: "toggleCustomIcons",
203
- useCustomIcons: true,
204
- iconOnContent:
205
- '<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/></svg>',
206
- iconOffContent:
207
- '<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>',
208
- };
209
-
210
- export const ErrorState = Template.bind({});
211
- ErrorState.args = {
212
- ...Default.args,
213
- id: "toggle-error",
214
- name: "toggleError",
215
- fieldHasError: true,
216
- theme: "error",
217
- };
218
-
219
- export const Required = Template.bind({});
220
- Required.args = {
221
- ...Default.args,
222
- id: "toggle-required",
223
- name: "toggleRequired",
224
- required: true,
225
- };
226
-
227
- export const SquareShape = Template.bind({});
228
- SquareShape.args = {
229
- ...Default.args,
230
- id: "toggle-square",
231
- name: "toggleSquare",
232
- round: false,
233
- };
234
-
235
- export const StringValues = Template.bind({});
236
- StringValues.args = {
237
- ...Default.args,
238
- id: "toggle-string-values",
239
- name: "toggleStringValues",
240
- trueValue: "enabled",
241
- falseValue: "disabled",
242
- };
243
-
244
- export const NumericValues = Template.bind({});
245
- NumericValues.args = {
246
- ...Default.args,
247
- id: "toggle-numeric-values",
248
- name: "toggleNumericValues",
249
- trueValue: 1,
250
- falseValue: 0,
251
- };
@@ -1,251 +0,0 @@
1
- import type { Meta, StoryFn } from "@nuxtjs/storybook";
2
- import { ref } from "vue";
3
- import StorybookComponent from "../ToggleSwitchWithLabel.vue";
4
- import type { FormUiTheme } from "~/types/forms/types.forms.d";
5
-
6
- interface ToggleSwitchWithLabelStoryArgs {
7
- name: string;
8
- label: string;
9
- required: boolean;
10
- errorMessage: object | string;
11
- fieldHasError: boolean;
12
- trueValue: string | number | boolean;
13
- falseValue: string | number | boolean;
14
- styleClassPassthrough: string[];
15
- theme: FormUiTheme;
16
- round: boolean;
17
- useDescription: boolean;
18
- descriptionContent: string;
19
- useCustomIcons: boolean;
20
- iconOnContent: string;
21
- iconOffContent: string;
22
- }
23
-
24
- export default {
25
- title: "Components/Forms/Toggle Switch/ToggleSwitchWithLabel",
26
- component: StorybookComponent,
27
- argTypes: {
28
- // Basic Configuration
29
- name: {
30
- control: "text",
31
- description: "Name attribute for the toggle switch",
32
- table: {
33
- category: "Basic",
34
- },
35
- },
36
- label: {
37
- control: "text",
38
- description: "Label text for the toggle switch",
39
- table: {
40
- category: "Basic",
41
- },
42
- },
43
- required: {
44
- control: "boolean",
45
- description: "Whether the toggle switch is required",
46
- table: {
47
- category: "Basic",
48
- },
49
- },
50
-
51
- // Values
52
- trueValue: {
53
- control: "text",
54
- description: "Value when toggle is on/checked",
55
- table: {
56
- category: "Values",
57
- },
58
- },
59
- falseValue: {
60
- control: "text",
61
- description: "Value when toggle is off/unchecked",
62
- table: {
63
- category: "Values",
64
- },
65
- },
66
-
67
- // Error Handling
68
- fieldHasError: {
69
- control: "boolean",
70
- description: "Whether the field is in error state",
71
- table: {
72
- category: "Error Handling",
73
- },
74
- },
75
- errorMessage: {
76
- control: "text",
77
- description: "Error message to display",
78
- table: {
79
- category: "Error Handling",
80
- },
81
- },
82
-
83
- // Styling
84
- theme: {
85
- control: { type: "select" },
86
- options: ["default", "success", "error", "warning"],
87
- description: "Toggle switch theme",
88
- table: {
89
- category: "Styling",
90
- },
91
- },
92
- round: {
93
- control: "boolean",
94
- description: "Whether the toggle switch is rounded",
95
- table: {
96
- category: "Styling",
97
- },
98
- },
99
- styleClassPassthrough: {
100
- control: "object",
101
- description: "Additional CSS classes",
102
- table: {
103
- category: "Styling",
104
- },
105
- },
106
-
107
- // Content Slots
108
- useDescription: {
109
- control: "boolean",
110
- description: "Show description slot content",
111
- table: {
112
- category: "Content",
113
- },
114
- },
115
- descriptionContent: {
116
- control: "text",
117
- description: "Description text content",
118
- table: {
119
- category: "Content",
120
- },
121
- },
122
-
123
- // Icons
124
- useCustomIcons: {
125
- control: "boolean",
126
- description: "Use custom icons instead of default",
127
- table: {
128
- category: "Icons",
129
- },
130
- },
131
- iconOnContent: {
132
- control: "text",
133
- description: "Content for the 'on' icon slot",
134
- table: {
135
- category: "Icons",
136
- },
137
- },
138
- iconOffContent: {
139
- control: "text",
140
- description: "Content for the 'off' icon slot",
141
- table: {
142
- category: "Icons",
143
- },
144
- },
145
- },
146
- } as Meta<ToggleSwitchWithLabelStoryArgs>;
147
-
148
- const Template: StoryFn<ToggleSwitchWithLabelStoryArgs> = (_args, { argTypes }) => ({
149
- components: { StorybookComponent },
150
- props: Object.keys(argTypes),
151
- setup() {
152
- const modelValue = ref(false);
153
- return { args: _args, modelValue };
154
- },
155
- template: `
156
- <StorybookComponent
157
- v-model="modelValue"
158
- :name="args.name"
159
- :label="args.label"
160
- :required="args.required"
161
- :error-message="args.errorMessage"
162
- :field-has-error="args.fieldHasError"
163
- :true-value="args.trueValue"
164
- :false-value="args.falseValue"
165
- :style-class-passthrough="args.styleClassPassthrough"
166
- :theme="args.theme"
167
- :round="args.round"
168
- >
169
- <template v-if="args.useDescription" #descriptionText>{{ args.descriptionContent }}</template>
170
- <template v-if="args.useCustomIcons" #iconOn>
171
- <span v-html="args.iconOnContent"></span>
172
- </template>
173
- <template v-if="args.useCustomIcons" #iconOff>
174
- <span v-html="args.iconOffContent"></span>
175
- </template>
176
- </StorybookComponent>
177
- <div style="margin-top: 1rem; font-size: 0.875rem; color: #666;">
178
- Current value: {{ modelValue }}
179
- </div>
180
- `,
181
- });
182
-
183
- export const Default = Template.bind({});
184
- Default.args = {
185
- name: "toggleWithLabel",
186
- label: "Enable notifications",
187
- required: false,
188
- errorMessage: "",
189
- fieldHasError: false,
190
- trueValue: true,
191
- falseValue: false,
192
- styleClassPassthrough: [],
193
- theme: "default",
194
- round: true,
195
- useDescription: false,
196
- descriptionContent: "Turn this on to receive notifications",
197
- useCustomIcons: false,
198
- iconOnContent: "✓",
199
- iconOffContent: "✗",
200
- };
201
-
202
- export const WithDescription = Template.bind({});
203
- WithDescription.args = {
204
- ...Default.args,
205
- name: "toggleWithDescription",
206
- label: "Enable dark mode",
207
- useDescription: true,
208
- descriptionContent: "Switch between light and dark themes",
209
- };
210
-
211
- export const WithCustomIcons = Template.bind({});
212
- WithCustomIcons.args = {
213
- ...Default.args,
214
- name: "toggleWithCustomIcons",
215
- label: "Enable feature",
216
- useCustomIcons: true,
217
- iconOnContent:
218
- '<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/></svg>',
219
- iconOffContent:
220
- '<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>',
221
- };
222
-
223
- export const ErrorState = Template.bind({});
224
- ErrorState.args = {
225
- ...Default.args,
226
- name: "toggleError",
227
- label: "Accept terms and conditions",
228
- required: true,
229
- fieldHasError: true,
230
- errorMessage: "You must accept the terms and conditions to continue",
231
- theme: "error",
232
- };
233
-
234
- export const Required = Template.bind({});
235
- Required.args = {
236
- ...Default.args,
237
- name: "toggleRequired",
238
- label: "I agree to the privacy policy *",
239
- required: true,
240
- };
241
-
242
- export const StringValues = Template.bind({});
243
- StringValues.args = {
244
- ...Default.args,
245
- name: "toggleStringValues",
246
- label: "Email notifications",
247
- trueValue: "enabled",
248
- falseValue: "disabled",
249
- useDescription: true,
250
- descriptionContent: "Choose whether to receive email notifications",
251
- };