vueless 0.0.254 → 0.0.256

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 (34) hide show
  1. package/composable.ui/index.js +21 -4
  2. package/package.json +1 -1
  3. package/ui.button/composables/attrs.composable.js +11 -14
  4. package/ui.button/index.stories.js +1 -1
  5. package/ui.button-link/composables/attrs.composable.js +8 -11
  6. package/ui.button-link/index.stories.js +1 -1
  7. package/ui.button-toggle/composables/attrs.composable.js +5 -5
  8. package/ui.button-toggle/index.stories.js +2 -2
  9. package/ui.button-toggle-item/composables/attrs.composable.js +5 -5
  10. package/ui.button-toggle-item/index.stories.js +6 -2
  11. package/ui.container-card/index.stories.js +1 -1
  12. package/ui.dropdown-button/index.stories.js +3 -6
  13. package/ui.form-checkbox/index.stories.js +13 -26
  14. package/ui.form-checkbox-group/index.stories.js +28 -74
  15. package/ui.form-checkbox-multi-state/index.stories.js +17 -13
  16. package/ui.form-color-picker/index.stories.js +3 -3
  17. package/ui.form-date-picker/index.stories.js +11 -15
  18. package/ui.form-input/index.stories.js +1 -1
  19. package/ui.form-input-file/index.stories.js +1 -1
  20. package/ui.form-input-money/index.stories.js +1 -1
  21. package/ui.form-input-number/index.stories.js +3 -3
  22. package/ui.form-input-search/index.stories.js +1 -1
  23. package/ui.form-label/index.stories.js +28 -51
  24. package/ui.form-radio-group/index.stories.js +6 -14
  25. package/ui.form-select/index.stories.js +62 -159
  26. package/ui.form-switch/index.stories.js +17 -33
  27. package/ui.form-textarea/index.stories.js +1 -3
  28. package/ui.image-icon/index.stories.js +1 -1
  29. package/ui.navigation-progress/index.stories.js +1 -1
  30. package/ui.navigation-tabs/index.stories.js +3 -3
  31. package/ui.text-badge/index.stories.js +2 -2
  32. package/ui.text-block/index.stories.js +2 -2
  33. package/ui.text-empty/index.stories.js +1 -1
  34. package/web-types.json +1 -1
@@ -20,7 +20,7 @@ import {
20
20
  } from "../service.ui";
21
21
 
22
22
  import { cloneDeep } from "../service.helper";
23
- import { STRATEGY_TYPE, SYSTEM_CONFIG_KEY } from "../constants";
23
+ import { STRATEGY_TYPE, CVA_CONFIG_KEY, SYSTEM_CONFIG_KEY } from "../constants";
24
24
 
25
25
  /**
26
26
  Merging component configs in a given sequence (bigger number = bigger priority):
@@ -88,12 +88,15 @@ export default function useUI(defaultConfig = {}, propsConfigGetter = null, topL
88
88
 
89
89
  const isTopLevelClassKey = configKey === (topLevelClassKey || firstClassKey);
90
90
  const attrClass = isTopLevelClassKey && !nestedComponent ? attrs.class : "";
91
- // TODO: Uncomment and add into `cx` when getAttrs as a function will be resolved.
92
- // const classes = toValue(options?.classes) || getBaseClasses(configKeyValue);
93
91
 
92
+ // TODO: remove `getBaseClasses(configKeyValue)` after migration to `setDynamicVars`
94
93
  vuelessAttrs.value = {
95
94
  ...commonAttrs,
96
- class: cx([getBaseClasses(configKeyValue), toValue(options?.classes), attrClass]),
95
+ class: cx([
96
+ getBaseClasses(configKeyValue),
97
+ getBaseClasses(toValue(options?.classes)),
98
+ attrClass,
99
+ ]),
97
100
  ...((isObject && configAttrs) || {}),
98
101
  };
99
102
  }
@@ -106,6 +109,7 @@ export default function useUI(defaultConfig = {}, propsConfigGetter = null, topL
106
109
  getAttrs,
107
110
  getColor,
108
111
  setColor,
112
+ isCVA,
109
113
  isSystemKey,
110
114
  hasSlotContent,
111
115
  };
@@ -404,6 +408,19 @@ function isSystemKey(key) {
404
408
  );
405
409
  }
406
410
 
411
+ /**
412
+ Check is config contains default CVA keys.
413
+ @param { Object | String } config
414
+ @returns { Boolean }
415
+ */
416
+ function isCVA(config) {
417
+ if (typeof config !== "object") return false;
418
+
419
+ return Object.values(CVA_CONFIG_KEY).some((value) =>
420
+ Object.keys(config).some((key) => key === value),
421
+ );
422
+ }
423
+
407
424
  /**
408
425
  Check if slot defined, and have a content.
409
426
  @param slot
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.254",
3
+ "version": "0.0.256",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -5,7 +5,7 @@ import defaultConfig from "../configs/default.config";
5
5
 
6
6
  export default function useAttrs(props) {
7
7
  const slots = useSlots();
8
- const { config, getAttrs, getColor, setColor, hasSlotContent, isSystemKey } = useUI(
8
+ const { config, getAttrs, getColor, setColor, hasSlotContent, isSystemKey, isCVA } = useUI(
9
9
  defaultConfig,
10
10
  () => props.config,
11
11
  );
@@ -15,22 +15,19 @@ export default function useAttrs(props) {
15
15
  if (isSystemKey(key)) continue;
16
16
 
17
17
  const classes = computed(() => {
18
- const value = config.value[key];
18
+ let value = config.value[key];
19
19
 
20
- if (value.variants || value.compoundVariants) {
21
- return setColor(
22
- cva(value)({
23
- ...props,
24
- color: getColor(props.color),
25
- square: props.loading || props.square,
26
- iconLeft: Boolean(props.iconLeft) || hasSlotContent(slots["icon-left"]),
27
- iconRight: Boolean(props.iconRight) || hasSlotContent(slots["icon-right"]),
28
- }),
29
- props.color,
30
- );
20
+ if (isCVA(value)) {
21
+ value = cva(value)({
22
+ ...props,
23
+ color: getColor(props.color),
24
+ square: props.loading || props.square,
25
+ iconLeft: Boolean(props.iconLeft) || hasSlotContent(slots["icon-left"]),
26
+ iconRight: Boolean(props.iconRight) || hasSlotContent(slots["icon-right"]),
27
+ });
31
28
  }
32
29
 
33
- return "";
30
+ return setColor(value, props.color);
34
31
  });
35
32
 
36
33
  attrs[`${key}Attrs`] = getAttrs(key, { classes });
@@ -44,10 +44,10 @@ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
44
44
  <URow>
45
45
  <UButton
46
46
  v-for="(option, index) in options"
47
+ :key="index"
47
48
  v-bind="args"
48
49
  :[args.enum]="option"
49
50
  :label="option"
50
- :key="index"
51
51
  />
52
52
  </URow>
53
53
  </UCol>
@@ -6,7 +6,7 @@ import defaultConfig from "../configs/default.config";
6
6
  export default function useAttrs(props, { isActive, isExactActive }) {
7
7
  const slots = useSlots();
8
8
 
9
- const { config, getAttrs, hasSlotContent, getColor, setColor, isSystemKey } = useUI(
9
+ const { config, getAttrs, hasSlotContent, getColor, setColor, isSystemKey, isCVA } = useUI(
10
10
  defaultConfig,
11
11
  () => props.config,
12
12
  );
@@ -16,19 +16,16 @@ export default function useAttrs(props, { isActive, isExactActive }) {
16
16
  if (isSystemKey(key)) continue;
17
17
 
18
18
  const classes = computed(() => {
19
- const value = config.value[key];
19
+ let value = config.value[key];
20
20
 
21
- if (value.variants || value.compoundVariants) {
22
- return setColor(
23
- cva(value)({
24
- ...props,
25
- color: getColor(props.color),
26
- }),
27
- props.color,
28
- );
21
+ if (isCVA(value)) {
22
+ value = cva(value)({
23
+ ...props,
24
+ color: getColor(props.color),
25
+ });
29
26
  }
30
27
 
31
- return "";
28
+ return setColor(value, props.color);
32
29
  });
33
30
 
34
31
  attrs[`${key}Attrs`] = getAttrs(key, { classes });
@@ -53,10 +53,10 @@ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
53
53
  <URow>
54
54
  <ULink
55
55
  v-for="(option, index) in options"
56
+ :key="index"
56
57
  v-bind="args"
57
58
  :[args.enum]="option"
58
59
  :label="prefixedOptions[index]"
59
- :key="index"
60
60
  />
61
61
  </URow>
62
62
  `,
@@ -4,7 +4,7 @@ import { cva } from "../../service.ui";
4
4
  import defaultConfig from "../configs/default.config";
5
5
 
6
6
  export default function useAttrs(props) {
7
- const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
7
+ const { config, getAttrs, hasSlotContent, isSystemKey, isCVA } = useUI(
8
8
  defaultConfig,
9
9
  () => props.config,
10
10
  );
@@ -14,15 +14,15 @@ export default function useAttrs(props) {
14
14
  if (isSystemKey(key)) continue;
15
15
 
16
16
  const classes = computed(() => {
17
- const value = config.value[key];
17
+ let value = config.value[key];
18
18
 
19
- if (value.variants || value.compoundVariants) {
20
- return cva(value)({
19
+ if (isCVA(value)) {
20
+ value = cva(value)({
21
21
  ...props,
22
22
  });
23
23
  }
24
24
 
25
- return "";
25
+ return value;
26
26
  });
27
27
 
28
28
  attrs[`${key}Attrs`] = getAttrs(key, { classes });
@@ -37,8 +37,8 @@ const DefaultTemplate = (args) => ({
37
37
  },
38
38
  template: `
39
39
  <UToggle
40
- v-model="value"
41
40
  v-bind="args"
41
+ v-model="value"
42
42
  :options="OPTIONS"
43
43
  >
44
44
  ${args.slotTemplate || getSlotsFragment()}
@@ -62,8 +62,8 @@ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
62
62
  <UToggle
63
63
  v-for="(option, index) in options"
64
64
  :key="index"
65
- v-model="value"
66
65
  v-bind="args"
66
+ v-model="value"
67
67
  :[args.enum]="option"
68
68
  :label="option"
69
69
  :options="[
@@ -4,7 +4,7 @@ import { cva } from "../../service.ui";
4
4
  import defaultConfig from "../configs/default.config";
5
5
 
6
6
  export default function useAttrs(props, { isSelected, separated, variant }) {
7
- const { config, getAttrs, isSystemKey, hasSlotContent } = useUI(
7
+ const { config, getAttrs, isSystemKey, hasSlotContent, isCVA } = useUI(
8
8
  defaultConfig,
9
9
  () => props.config,
10
10
  );
@@ -15,10 +15,10 @@ export default function useAttrs(props, { isSelected, separated, variant }) {
15
15
  if (isSystemKey(key)) continue;
16
16
 
17
17
  const classes = computed(() => {
18
- const value = config.value[key];
18
+ let value = config.value[key];
19
19
 
20
- if (value.variants || value.compoundVariants) {
21
- return cva(value)({
20
+ if (isCVA(value)) {
21
+ value = cva(value)({
22
22
  ...props,
23
23
  variant: toValue(variant),
24
24
  separated: toValue(separated),
@@ -26,7 +26,7 @@ export default function useAttrs(props, { isSelected, separated, variant }) {
26
26
  });
27
27
  }
28
28
 
29
- return "";
29
+ return value;
30
30
  });
31
31
 
32
32
  attrs[`${key}Attrs`] = getAttrs(key, { classes });
@@ -28,8 +28,12 @@ const DefaultTemplate = (args) => ({
28
28
  return { args, slots };
29
29
  },
30
30
  template: `
31
- <UToggleItem v-bind="args" name="toggle" v-model="args.modelValue">
32
- ${args.slotTemplate || getSlotsFragment()}
31
+ <UToggleItem
32
+ v-bind="args"
33
+ v-model="args.modelValue"
34
+ name="toggle"
35
+ >
36
+ ${args.slotTemplate || getSlotsFragment()}
33
37
  </UToggleItem>
34
38
  `,
35
39
  });
@@ -61,9 +61,9 @@ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
61
61
  <URow>
62
62
  <UCard
63
63
  v-for="(option, index) in options"
64
+ :key="index"
64
65
  v-bind="args"
65
66
  :[args.enum]="option"
66
- :key="index"
67
67
  >
68
68
  ${defaultTemplate}
69
69
  </UCard>
@@ -40,10 +40,7 @@ const DefaultTemplate = (args) => ({
40
40
  return { args, slots };
41
41
  },
42
42
  template: `
43
- <UDropdownButton
44
- v-bind="args"
45
- v-model="args.modelValue"
46
- >
43
+ <UDropdownButton v-bind="args">
47
44
  ${args.slotTemplate || getSlotsFragment()}
48
45
  </UDropdownButton>
49
46
  `,
@@ -83,12 +80,12 @@ const VariantColorsTemplate = (args, { argTypes } = {}) => ({
83
80
  <UCol>
84
81
  <URow v-for="(variant, index) in variants" :key="index">
85
82
  <UDropdownButton
86
- v-for="(color, idx) in colors"
83
+ v-for="(color, index) in colors"
84
+ :key="index"
87
85
  v-bind="args"
88
86
  :color="color"
89
87
  :variant="variant"
90
88
  :label="color"
91
- :key="idx"
92
89
  />
93
90
  </URow>
94
91
  </UCol>
@@ -1,4 +1,4 @@
1
- import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UCheckbox from "../ui.form-checkbox";
4
4
  import UCheckboxGroup from "../ui.form-checkbox-group";
@@ -14,23 +14,23 @@ export default {
14
14
  component: UCheckbox,
15
15
  args: {
16
16
  label: "Label",
17
- value: {},
18
17
  },
19
18
  argTypes: {
20
19
  ...getArgTypes(UCheckbox.name),
20
+ modelValue: { control: { type: "boolean" } },
21
21
  },
22
22
  };
23
23
 
24
24
  const DefaultTemplate = (args) => ({
25
- components: { UCheckbox },
25
+ components: { UCheckbox, UBadge },
26
26
  setup() {
27
27
  const slots = getSlotNames(UCheckbox.name);
28
28
 
29
29
  return { args, slots };
30
30
  },
31
31
  template: `
32
- <UCheckbox v-bind="args" v-model="args.value">
33
- ${allSlotsFragment}
32
+ <UCheckbox v-bind="args" v-model="args.modelValue">
33
+ ${args.slotTemplate || getSlotsFragment()}
34
34
  </UCheckbox>
35
35
  `,
36
36
  });
@@ -89,48 +89,35 @@ const ValueTypesTemplate = (args) => ({
89
89
  `,
90
90
  });
91
91
 
92
- const SizesTemplate = (args, { argTypes } = {}) => ({
92
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
93
93
  components: { UCheckbox, UCol },
94
94
  setup() {
95
95
  return {
96
96
  args,
97
- sizes: argTypes.size.options,
97
+ options: argTypes[args.enum].options,
98
98
  };
99
99
  },
100
100
  template: `
101
101
  <UCol gap="xl">
102
102
  <UCheckbox
103
- v-for="(size, index) in sizes"
103
+ v-for="(option, index) in options"
104
104
  :key="index"
105
105
  v-bind="args"
106
- v-model="args.value[size]"
107
- :size="size"
108
- :label="size"
106
+ :[args.enum]="option"
107
+ :label="option"
109
108
  />
110
109
  </UCol>
111
110
  `,
112
111
  });
113
112
 
114
- const SlotTemplate = (args) => ({
115
- components: { UCheckbox, UBadge },
116
- setup() {
117
- return { args };
118
- },
119
- template: `
120
- <UCheckbox v-bind="args" v-model="args.value" description="hello">
121
- ${args.slotTemplate}
122
- </UCheckbox>
123
- `,
124
- });
125
-
126
113
  export const Default = DefaultTemplate.bind({});
127
114
  Default.args = {};
128
115
 
129
116
  export const CustomValues = ValueTypesTemplate.bind({});
130
117
  CustomValues.args = {};
131
118
 
132
- export const Sizes = SizesTemplate.bind({});
133
- Sizes.args = {};
119
+ export const Sizes = EnumVariantTemplate.bind({});
120
+ Sizes.args = { enum: "size" };
134
121
 
135
122
  export const Disabled = DefaultTemplate.bind({});
136
123
  Disabled.args = { disabled: true };
@@ -138,7 +125,7 @@ Disabled.args = { disabled: true };
138
125
  export const Description = DefaultTemplate.bind({});
139
126
  Description.args = { description: "Some description" };
140
127
 
141
- export const slotFooter = SlotTemplate.bind({});
128
+ export const slotFooter = DefaultTemplate.bind({});
142
129
  slotFooter.args = {
143
130
  slotTemplate: `
144
131
  <template #footer>
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UCheckboxGroup from "../ui.form-checkbox-group";
4
4
  import UCheckbox from "../ui.form-checkbox";
@@ -29,7 +29,9 @@ export default {
29
29
  const DefaultTemplate = (args) => ({
30
30
  components: { UCheckboxGroup, UCheckbox, UAlert, URow },
31
31
  setup() {
32
- return { args };
32
+ const slots = getSlotNames(UCheckboxGroup.name);
33
+
34
+ return { args, slots };
33
35
  },
34
36
  data() {
35
37
  return {
@@ -39,9 +41,7 @@ const DefaultTemplate = (args) => ({
39
41
  template: `
40
42
  <URow class="!flex-col">
41
43
  <UCheckboxGroup v-bind="args" v-model="value">
42
- <template v-for="(radio, index) in args.options" :key="index">
43
- <UCheckbox v-bind="radio"/>
44
- </template>
44
+ ${args.slotTemplate || getSlotsFragment()}
45
45
  </UCheckboxGroup>
46
46
 
47
47
  <URow>
@@ -53,25 +53,29 @@ const DefaultTemplate = (args) => ({
53
53
  `,
54
54
  });
55
55
 
56
- const OptionsTemplate = (args) => ({
57
- components: { UCheckboxGroup, UCheckbox, UAlert, URow },
56
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
57
+ components: { UCheckboxGroup, URow },
58
58
  setup() {
59
59
  return { args };
60
60
  },
61
61
  data() {
62
62
  return {
63
63
  value: args.value,
64
+ options: argTypes[args.enum].options,
64
65
  };
65
66
  },
66
67
  template: `
67
68
  <URow class="!flex-col">
68
- <UCheckboxGroup v-bind="args" v-model="value" :options="args.options" />
69
-
70
- <URow>
71
- <UAlert color="blue">
72
- <p>Selected value: {{ value }}</p>
73
- </UAlert>
74
- </URow>
69
+ <UCheckboxGroup
70
+ v-for="(option, index) in options"
71
+ :key="option"
72
+ v-bind="args"
73
+ v-model="value"
74
+ :label="option"
75
+ :[args.enum]="option"
76
+ :options="args.options"
77
+ name="option"
78
+ />
75
79
  </URow>
76
80
  `,
77
81
  });
@@ -79,7 +83,11 @@ const OptionsTemplate = (args) => ({
79
83
  export const Default = DefaultTemplate.bind({});
80
84
  Default.args = {
81
85
  name: "Default",
82
- isDefaultStory: true,
86
+ slotTemplate: `
87
+ <template v-for="(radio, index) in args.options" :key="index">
88
+ <UCheckbox v-bind="radio"/>
89
+ </template>
90
+ `,
83
91
  options: [
84
92
  { name: "Default", label: "String", value: "One" },
85
93
  { name: "Default", label: "Boolean", value: false },
@@ -97,7 +105,7 @@ Default.args = {
97
105
  ],
98
106
  };
99
107
 
100
- export const Options = OptionsTemplate.bind({});
108
+ export const Options = DefaultTemplate.bind({});
101
109
  Options.args = {
102
110
  name: "Options",
103
111
  options: [
@@ -109,68 +117,14 @@ Options.args = {
109
117
  ],
110
118
  };
111
119
 
112
- const ColorsTemplate = (args, { argTypes } = {}) => ({
113
- components: { UCheckboxGroup, URow },
114
- setup() {
115
- return { args };
116
- },
117
- data() {
118
- return {
119
- value: args.value,
120
- colors: argTypes.color.options,
121
- };
122
- },
123
- template: `
124
- <URow class="!flex-col">
125
- <UCheckboxGroup
126
- v-bind="args"
127
- v-for="color in colors"
128
- :key="color"
129
- :label="color"
130
- :color="color"
131
- :options="args.options"
132
- name="color"
133
- v-model="value"
134
- />
135
- </URow>
136
- `,
137
- });
138
-
139
- const SizesTemplate = (args, { argTypes } = {}) => ({
140
- components: { UCheckboxGroup, URow },
141
- setup() {
142
- return { args };
143
- },
144
- data() {
145
- return {
146
- value: args.value,
147
- sizes: argTypes.size.options,
148
- };
149
- },
150
- template: `
151
- <URow class="!flex-col">
152
- <UCheckboxGroup
153
- v-bind="args"
154
- v-for="size in sizes"
155
- :key="size"
156
- :label="size"
157
- :size="size"
158
- :options="args.options"
159
- name="size"
160
- v-model="value"
161
- />
162
- </URow>
163
- `,
164
- });
165
-
166
120
  export const disabled = DefaultTemplate.bind({});
167
121
  disabled.args = { name: "Disabled", disabled: true };
168
122
 
169
123
  export const error = DefaultTemplate.bind({});
170
124
  error.args = { name: "Error", error: "some error" };
171
125
 
172
- export const Colors = ColorsTemplate.bind({});
173
- Colors.args = { name: "Colors" };
126
+ export const Colors = EnumVariantTemplate.bind({});
127
+ Colors.args = { enum: "color", name: "Colors" };
174
128
 
175
- export const Sizes = SizesTemplate.bind({});
176
- Sizes.args = { name: "Sizes" };
129
+ export const Sizes = EnumVariantTemplate.bind({});
130
+ Sizes.args = { enum: "size", name: "Sizes" };
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UCheckboxMultiState from "../ui.form-checkbox-multi-state";
4
4
  import URow from "../ui.container-row";
@@ -11,7 +11,6 @@ export default {
11
11
  title: "Form Inputs & Controls / Checkbox Multistate",
12
12
  component: UCheckboxMultiState,
13
13
  args: {
14
- modelValue: false,
15
14
  options: [
16
15
  { value: false, label: "empty", icon: "", description: "checkbox empty" },
17
16
  { value: true, label: "selected", icon: "check", description: "checkbox selected" },
@@ -20,36 +19,41 @@ export default {
20
19
  },
21
20
  argTypes: {
22
21
  ...getArgTypes(UCheckboxMultiState.name),
22
+ modelValue: { control: { type: "boolean" } },
23
23
  },
24
24
  };
25
25
 
26
26
  const DefaultTemplate = (args) => ({
27
27
  components: { UCheckboxMultiState },
28
28
  setup() {
29
- return { args };
29
+ const slots = getSlotNames(UCheckboxMultiState.name);
30
+
31
+ return { args, slots };
30
32
  },
31
33
  template: `
32
- <UCheckboxMultiState v-bind="args" v-model="args.value" />
34
+ <UCheckboxMultiState v-bind="args" v-model="args.modelValue">
35
+ ${args.slotTemplate || getSlotsFragment()}
36
+ </UCheckboxMultiState>
33
37
  `,
34
38
  });
35
39
 
36
- const SizesTemplate = (args, { argTypes } = {}) => ({
40
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
37
41
  components: { UCheckboxMultiState, URow },
38
42
  setup() {
39
43
  return {
40
44
  args,
41
- sizes: argTypes.size.options,
45
+ options: argTypes[args.enum].options,
42
46
  };
43
47
  },
44
48
  template: `
45
49
  <URow>
46
50
  <UCheckboxMultiState
47
- v-for="(size, index) in sizes"
48
- v-bind="args"
49
- :size="size"
50
- v-model="args.value"
51
- :label="size"
51
+ v-for="(option, index) in options"
52
52
  :key="index"
53
+ v-bind="args"
54
+ v-model="args.modelValue"
55
+ :[args.enum]="option"
56
+ :label="option"
53
57
  />
54
58
  </URow>
55
59
  `,
@@ -58,5 +62,5 @@ const SizesTemplate = (args, { argTypes } = {}) => ({
58
62
  export const Default = DefaultTemplate.bind({});
59
63
  Default.args = {};
60
64
 
61
- export const sizes = SizesTemplate.bind({});
62
- sizes.args = {};
65
+ export const sizes = EnumVariantTemplate.bind({});
66
+ sizes.args = { enum: "size" };
@@ -11,7 +11,7 @@ export default {
11
11
  component: UColorPicker,
12
12
  args: {
13
13
  label: "Label",
14
- value: "",
14
+ modelValue: "",
15
15
  },
16
16
  argTypes: {
17
17
  ...getArgTypes(UColorPicker.name),
@@ -26,7 +26,7 @@ const DefaultTemplate = (args) => ({
26
26
  return { args, slots };
27
27
  },
28
28
  template: `
29
- <UColorPicker v-bind="args" v-model="args.value">
29
+ <UColorPicker v-bind="args" v-model="args.modelValue">
30
30
  ${args.slotTemplate || getSlotsFragment()}
31
31
  </UColorPicker>
32
32
  `,
@@ -46,7 +46,7 @@ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
46
46
  v-for="(option, index) in options"
47
47
  :key="index"
48
48
  v-bind="args"
49
- v-model="args.value"
49
+ v-model="args.modelValue"
50
50
  :[args.enum]="option"
51
51
  :name="option"
52
52
  />