vueless 0.0.245 → 0.0.247

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.245",
3
+ "version": "0.0.247",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -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 UButton from "../ui.button";
4
4
  import UIcon from "../ui.image-icon";
@@ -29,50 +29,28 @@ const DefaultTemplate = (args) => ({
29
29
  },
30
30
  template: `
31
31
  <UButton v-bind="args">
32
- ${args.slotTemplate || allSlotsFragment}
32
+ ${args.slotTemplate || getSlotsFragment()}
33
33
  </UButton>
34
34
  `,
35
35
  });
36
36
 
37
- const VariantsTemplate = (args, { argTypes } = {}) => ({
38
- components: { UButton, URow },
37
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
38
+ components: { UButton, URow, UCol },
39
39
  setup() {
40
- return {
41
- args,
42
- variants: argTypes.variant.options,
43
- };
40
+ return { args, options: argTypes[args.enum].options };
44
41
  },
45
42
  template: `
46
- <URow>
47
- <UButton
48
- v-for="(variant, index) in variants"
49
- v-bind="args"
50
- :variant="variant"
51
- :label="variant"
52
- :key="index"
53
- />
54
- </URow>
55
- `,
56
- });
57
-
58
- const SizesTemplate = (args, { argTypes } = {}) => ({
59
- components: { UButton, URow },
60
- setup() {
61
- return {
62
- args,
63
- sizes: argTypes.size.options,
64
- };
65
- },
66
- template: `
67
- <URow>
68
- <UButton
69
- v-for="(size, index) in sizes"
70
- v-bind="args"
71
- :size="size"
72
- :label="size"
73
- :key="index"
74
- />
75
- </URow>
43
+ <UCol>
44
+ <URow>
45
+ <UButton
46
+ v-for="(option, index) in options"
47
+ v-bind="args"
48
+ :[args.enum]="option"
49
+ :label="option"
50
+ :key="index"
51
+ />
52
+ </URow>
53
+ </UCol>
76
54
  `,
77
55
  });
78
56
 
@@ -104,17 +82,17 @@ const ColorTemplate = (args, { argTypes } = {}) => ({
104
82
  export const Default = DefaultTemplate.bind({});
105
83
  Default.args = {};
106
84
 
107
- export const variants = VariantsTemplate.bind({});
108
- variants.args = {};
85
+ export const variants = EnumVariantTemplate.bind({});
86
+ variants.args = { enum: "variant" };
109
87
 
110
- export const sizes = SizesTemplate.bind({});
111
- sizes.args = {};
88
+ export const sizes = EnumVariantTemplate.bind({});
89
+ sizes.args = { enum: "size" };
112
90
 
113
- export const pilled = VariantsTemplate.bind({});
114
- pilled.args = { pill: true };
91
+ export const pilled = EnumVariantTemplate.bind({});
92
+ pilled.args = { enum: "variant", pill: true };
115
93
 
116
- export const disabled = VariantsTemplate.bind({});
117
- disabled.args = { disabled: true };
94
+ export const disabled = EnumVariantTemplate.bind({});
95
+ disabled.args = { enum: "variant", disabled: true };
118
96
 
119
97
  export const noRing = DefaultTemplate.bind({});
120
98
  noRing.args = { noRing: true };
@@ -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 ULink from "../ui.button-link";
4
4
  import UButton from "../ui.button";
@@ -21,7 +21,7 @@ export default {
21
21
  };
22
22
 
23
23
  const DefaultTemplate = (args) => ({
24
- components: { ULink },
24
+ components: { ULink, UButton },
25
25
  setup() {
26
26
  const slots = getSlotNames(ULink.name);
27
27
 
@@ -29,108 +29,56 @@ const DefaultTemplate = (args) => ({
29
29
  },
30
30
  template: `
31
31
  <ULink v-bind="args">
32
- ${allSlotsFragment}
32
+ ${args.slotTemplate || getSlotsFragment()}
33
33
  </ULink>
34
34
  `,
35
35
  });
36
36
 
37
- const ColorsTemplate = (args, { argTypes } = {}) => ({
37
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
38
38
  components: { ULink, URow },
39
39
  setup() {
40
- return {
41
- args,
42
- colors: argTypes.color.options,
43
- };
44
- },
45
- template: `
46
- <URow>
47
- <ULink
48
- v-for="(color, index) in colors"
49
- v-bind="args"
50
- :color="color"
51
- :label="color"
52
- :key="index"
53
- />
54
- </URow>
55
- `,
56
- });
40
+ function getText(value) {
41
+ return `Link ${value}`;
42
+ }
57
43
 
58
- const TypesTemplate = (args, { argTypes } = {}) => ({
59
- components: { ULink, URow },
60
- setup() {
61
- return {
62
- args,
63
- types: argTypes.type.options,
64
- };
65
- },
66
- template: `
67
- <URow>
68
- <ULink
69
- v-for="(type, index) in types"
70
- v-bind="args"
71
- :label="type"
72
- :type="type"
73
- :key="index"
74
- />
75
- </URow>
76
- `,
77
- });
44
+ let prefixedOptions = argTypes[args.enum].options;
78
45
 
79
- const SizesTemplate = (args, { argTypes } = {}) => ({
80
- components: { ULink, URow },
81
- setup() {
82
- return {
83
- args,
84
- sizes: argTypes.size.options,
85
- };
46
+ if (argTypes[args.enum].name === "size") {
47
+ prefixedOptions = prefixedOptions.map((option) => getText(option));
48
+ }
49
+
50
+ return { args, options: argTypes[args.enum].options, prefixedOptions };
86
51
  },
87
52
  template: `
88
53
  <URow>
89
54
  <ULink
90
- v-for="(size, index) in sizes"
55
+ v-for="(option, index) in options"
91
56
  v-bind="args"
92
- :size="size"
93
- :label="getText(size)"
57
+ :[args.enum]="option"
58
+ :label="prefixedOptions[index]"
94
59
  :key="index"
95
60
  />
96
61
  </URow>
97
62
  `,
98
- methods: {
99
- getText(value) {
100
- return `Link ${value}`;
101
- },
102
- },
103
- });
104
-
105
- const SlotTemplate = (args) => ({
106
- components: { UButton, ULink },
107
- setup() {
108
- return { args };
109
- },
110
- template: `
111
- <ULink>
112
- ${args.slotTemplate}
113
- </ULink>
114
- `,
115
63
  });
116
64
 
117
65
  export const Default = DefaultTemplate.bind({});
118
66
  Default.args = {};
119
67
 
120
- export const sizes = SizesTemplate.bind({});
121
- sizes.args = {};
68
+ export const sizes = EnumVariantTemplate.bind({});
69
+ sizes.args = { enum: "size" };
122
70
 
123
- export const colors = ColorsTemplate.bind({});
124
- colors.args = {};
71
+ export const colors = EnumVariantTemplate.bind({});
72
+ colors.args = { enum: "color" };
125
73
 
126
- export const types = TypesTemplate.bind({});
127
- types.args = {};
74
+ export const types = EnumVariantTemplate.bind({});
75
+ types.args = { enum: "type" };
128
76
 
129
- export const underlined = ColorsTemplate.bind({});
130
- underlined.args = { underlined: true, dashed: false };
77
+ export const underlined = EnumVariantTemplate.bind({});
78
+ underlined.args = { enum: "color", underlined: true, dashed: false };
131
79
 
132
- export const dashed = ColorsTemplate.bind({});
133
- dashed.args = { dashed: true };
80
+ export const dashed = EnumVariantTemplate.bind({});
81
+ dashed.args = { enum: "color", dashed: true };
134
82
 
135
83
  export const url = DefaultTemplate.bind({});
136
84
  url.args = { url: "https://storybook.js.org/docs/react/get-started/introduction" };
@@ -150,7 +98,7 @@ disabled.args = { disabled: true };
150
98
  export const noRing = DefaultTemplate.bind({});
151
99
  noRing.args = { noRing: true };
152
100
 
153
- export const slotDefault = SlotTemplate.bind({});
101
+ export const slotDefault = DefaultTemplate.bind({});
154
102
  slotDefault.args = {
155
103
  slotTemplate: `
156
104
  <template #default>
@@ -1,5 +1,5 @@
1
1
  import { ref } from "vue";
2
- import { getArgTypes } from "../service.storybook";
2
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
3
3
 
4
4
  import UToggle from "../ui.button-toggle";
5
5
  import UIcon from "../ui.image-icon";
@@ -27,76 +27,26 @@ export default {
27
27
  };
28
28
 
29
29
  const DefaultTemplate = (args) => ({
30
- components: { UToggle },
31
- data() {
32
- return {
33
- value: "",
34
- };
35
- },
30
+ components: { UToggle, UIcon, UToggleItem },
36
31
  setup() {
37
- return { args, OPTIONS };
38
- },
39
- template: `
40
- <UToggle
41
- v-model="value"
42
- v-bind="args"
43
- :options="OPTIONS"
44
- />
45
- `,
46
- });
32
+ const value = ref("");
47
33
 
48
- const multipleTemplate = (args) => ({
49
- components: { UToggle },
50
- data() {
51
- return {
52
- value: [],
53
- };
54
- },
55
- setup() {
56
- return { args, OPTIONS };
34
+ const slots = getSlotNames(UToggle.name);
35
+
36
+ return { args, slots, value, OPTIONS };
57
37
  },
58
38
  template: `
59
39
  <UToggle
60
40
  v-model="value"
61
41
  v-bind="args"
62
- multiple
63
42
  :options="OPTIONS"
64
- name="multipleTemplate"
65
- />
66
- `,
67
- });
68
-
69
- const SizesTemplate = (args, { argTypes } = {}) => ({
70
- components: { UToggle, URow },
71
- setup() {
72
- const value = ref("");
73
-
74
- return {
75
- args,
76
- value,
77
- sizes: argTypes.size.options,
78
- };
79
- },
80
- template: `
81
- <URow>
82
- <UToggle
83
- v-for="(size, index) in sizes"
84
- :key="index"
85
- name="sizeTemplate"
86
- v-model="value"
87
- v-bind="args"
88
- :size="size"
89
- :label="size"
90
- :options="[
91
- { value: size + 1, label: size },
92
- { value: size + 2, label: size },
93
- ]"
94
- />
95
- </URow>
43
+ >
44
+ ${args.slotTemplate || getSlotsFragment()}
45
+ </UToggle>
96
46
  `,
97
47
  });
98
48
 
99
- const VariantsTemplate = (args, { argTypes } = {}) => ({
49
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
100
50
  components: { UToggle, URow },
101
51
  setup() {
102
52
  const value = ref("");
@@ -104,45 +54,27 @@ const VariantsTemplate = (args, { argTypes } = {}) => ({
104
54
  return {
105
55
  args,
106
56
  value,
107
- variants: argTypes.variant.options,
57
+ options: argTypes[args.enum].options,
108
58
  };
109
59
  },
110
60
  template: `
111
61
  <URow>
112
62
  <UToggle
113
- v-for="(variant, index) in variants"
63
+ v-for="(option, index) in options"
114
64
  :key="index"
115
- name="sizeTemplate"
116
65
  v-model="value"
117
66
  v-bind="args"
118
- :variant="variant"
119
- :label="variant"
67
+ :[args.enum]="option"
68
+ :label="option"
120
69
  :options="[
121
- { value: variant + 1, label: variant },
122
- { value: variant + 2, label: variant },
70
+ { value: option + 1, label: option },
71
+ { value: option + 2, label: option },
123
72
  ]"
124
73
  />
125
74
  </URow>
126
75
  `,
127
76
  });
128
77
 
129
- const SlotTemplate = (args) => ({
130
- components: { UToggle, UIcon, UToggleItem },
131
- setup() {
132
- const selected = ref("");
133
-
134
- return {
135
- args,
136
- selected,
137
- };
138
- },
139
- template: `
140
- <UToggle v-bind="args" name="slotTemplate" v-model="selected">
141
- ${args.slotTemplate}
142
- </UToggle>
143
- `,
144
- });
145
-
146
78
  export const Default = DefaultTemplate.bind({});
147
79
  Default.args = {
148
80
  name: "Default",
@@ -161,19 +93,22 @@ label.args = {
161
93
  description: "description",
162
94
  };
163
95
 
164
- export const sizes = SizesTemplate.bind({});
96
+ export const sizes = EnumVariantTemplate.bind({});
165
97
  sizes.args = {
166
- name: "sizes",
98
+ name: "sizeTemplate",
99
+ enum: "size",
167
100
  };
168
101
 
169
- export const variants = VariantsTemplate.bind({});
102
+ export const variants = EnumVariantTemplate.bind({});
170
103
  variants.args = {
171
- name: "variants",
104
+ name: "sizeTemplate",
105
+ enum: "variant",
172
106
  };
173
107
 
174
- export const multiple = multipleTemplate.bind({});
108
+ export const multiple = DefaultTemplate.bind({});
175
109
  multiple.args = {
176
- name: "multiple",
110
+ name: "multipleTemplate",
111
+ multiple: true,
177
112
  };
178
113
 
179
114
  export const block = DefaultTemplate.bind({});
@@ -195,7 +130,7 @@ pill.args = {
195
130
  separated: true,
196
131
  };
197
132
 
198
- export const square = SlotTemplate.bind({});
133
+ export const square = DefaultTemplate.bind({});
199
134
  square.args = {
200
135
  name: "square",
201
136
  variant: "secondary",
@@ -217,7 +152,7 @@ square.args = {
217
152
  `,
218
153
  };
219
154
 
220
- export const slotDefault = SlotTemplate.bind({});
155
+ export const slotDefault = DefaultTemplate.bind({});
221
156
  slotDefault.args = {
222
157
  name: "slotDefault",
223
158
  slotTemplate: `
@@ -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 UToggleItem from "../ui.button-toggle-item";
4
4
  import UIcon from "../ui.image-icon";
@@ -21,27 +21,15 @@ export default {
21
21
  };
22
22
 
23
23
  const DefaultTemplate = (args) => ({
24
- components: { UToggleItem },
24
+ components: { UToggleItem, UIcon },
25
25
  setup() {
26
26
  const slots = getSlotNames(UToggleItem.name);
27
27
 
28
28
  return { args, slots };
29
29
  },
30
30
  template: `
31
- <UToggleItem v-bind="args" name="toggle">
32
- ${allSlotsFragment}
33
- </UToggleItem>
34
- `,
35
- });
36
-
37
- const SlotTemplate = (args) => ({
38
- components: { UToggleItem, UIcon },
39
- setup() {
40
- return { args };
41
- },
42
- template: `
43
- <UToggleItem v-bind="args" >
44
- ${args.slotTemplate}
31
+ <UToggleItem v-bind="args" name="toggle" v-model="args.modelValue">
32
+ ${args.slotTemplate || getSlotsFragment()}
45
33
  </UToggleItem>
46
34
  `,
47
35
  });
@@ -52,7 +40,7 @@ Default.args = {};
52
40
  export const disabled = DefaultTemplate.bind({});
53
41
  disabled.args = { disabled: true };
54
42
 
55
- export const slotLeft = SlotTemplate.bind({});
43
+ export const slotLeft = DefaultTemplate.bind({});
56
44
  slotLeft.args = {
57
45
  slotTemplate: `
58
46
  <template #left>
@@ -64,14 +52,14 @@ slotLeft.args = {
64
52
  `,
65
53
  };
66
54
 
67
- export const slotRight = SlotTemplate.bind({});
55
+ export const slotRight = DefaultTemplate.bind({});
68
56
  slotRight.args = {
69
57
  slotTemplate: `
70
58
  <template #right>
71
59
  <UIcon
72
60
  name="star"
73
61
  color="green"
74
- />
62
+ />
75
63
  </template>
76
64
  `,
77
65
  };
@@ -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 UDropdownBadge from "../ui.dropdown-badge";
4
4
  import UDropdownItem from "../ui.dropdown-item";
@@ -32,7 +32,7 @@ export default {
32
32
  };
33
33
 
34
34
  const DefaultTemplate = (args) => ({
35
- components: { UDropdownBadge },
35
+ components: { UDropdownBadge, UDropdownItem },
36
36
  setup() {
37
37
  const slots = getSlotNames(UDropdownBadge.name);
38
38
 
@@ -42,61 +42,26 @@ const DefaultTemplate = (args) => ({
42
42
  <UDropdownBadge
43
43
  v-bind="args"
44
44
  >
45
- ${allSlotsFragment}
46
- </UDropdownBadge>
47
- `,
48
- });
49
-
50
- const SlotTemplate = (args) => ({
51
- components: { UDropdownBadge, UDropdownItem },
52
- setup() {
53
- return { args };
54
- },
55
- template: `
56
- <UDropdownBadge
57
- v-bind="args"
58
- >
59
- ${args.slotTemplate}
45
+ ${args.slotTemplate || getSlotsFragment()}
60
46
  </UDropdownBadge>
61
47
  `,
62
48
  });
63
49
 
64
- const SizesTemplate = (args, { argTypes } = {}) => ({
65
- components: { UDropdownBadge, URow },
66
- setup() {
67
- return {
68
- args,
69
- sizes: argTypes.size.options,
70
- };
71
- },
72
- template: `
73
- <URow>
74
- <UDropdownBadge
75
- v-for="(size, index) in sizes"
76
- v-bind="args"
77
- :size="size"
78
- :label="size"
79
- :key="index"
80
- />
81
- </URow>
82
- `,
83
- });
84
-
85
- const ColorsTemplate = (args, { argTypes } = {}) => ({
50
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
86
51
  components: { UDropdownBadge, URow },
87
52
  setup() {
88
53
  return {
89
54
  args,
90
- colors: argTypes.color.options,
55
+ options: argTypes[args.enum].options,
91
56
  };
92
57
  },
93
58
  template: `
94
59
  <URow>
95
60
  <UDropdownBadge
96
- v-for="(color, index) in colors"
97
- :color="color"
98
- :label="color"
61
+ v-for="(option, index) in options"
99
62
  v-bind="args"
63
+ :[args.enum]="option"
64
+ :label="option"
100
65
  :key="index"
101
66
  />
102
67
  </URow>
@@ -106,16 +71,16 @@ const ColorsTemplate = (args, { argTypes } = {}) => ({
106
71
  export const Default = DefaultTemplate.bind({});
107
72
  Default.args = {};
108
73
 
109
- export const sizes = SizesTemplate.bind({});
110
- sizes.args = {};
74
+ export const sizes = EnumVariantTemplate.bind({});
75
+ sizes.args = { enum: "size" };
111
76
 
112
- export const colors = ColorsTemplate.bind({});
113
- colors.args = {};
77
+ export const colors = EnumVariantTemplate.bind({});
78
+ colors.args = { enum: "color" };
114
79
 
115
80
  export const withoutDropdownIcon = DefaultTemplate.bind({});
116
81
  withoutDropdownIcon.args = { noIcon: true };
117
82
 
118
- export const dropdownListSlot = SlotTemplate.bind({});
83
+ export const dropdownListSlot = DefaultTemplate.bind({});
119
84
  dropdownListSlot.args = {
120
85
  slotTemplate: `
121
86
  <template #default>
@@ -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 UDropdownButton from "../ui.dropdown-button";
4
4
  import UDropdownItem from "../ui.dropdown-item";
@@ -33,7 +33,7 @@ export default {
33
33
  };
34
34
 
35
35
  const DefaultTemplate = (args) => ({
36
- components: { UDropdownButton },
36
+ components: { UDropdownButton, UDropdownItem },
37
37
  setup() {
38
38
  const slots = getSlotNames(UDropdownButton.name);
39
39
 
@@ -42,62 +42,28 @@ const DefaultTemplate = (args) => ({
42
42
  template: `
43
43
  <UDropdownButton
44
44
  v-bind="args"
45
+ v-model="args.modelValue"
45
46
  >
46
- ${allSlotsFragment}
47
+ ${args.slotTemplate || getSlotsFragment()}
47
48
  </UDropdownButton>
48
49
  `,
49
50
  });
50
51
 
51
- const SlotTemplate = (args) => ({
52
- components: { UDropdownButton, UDropdownItem },
53
- setup() {
54
- return { args };
55
- },
56
- template: `
57
- <UDropdownButton
58
- v-bind="args"
59
- >
60
- ${args.slotTemplate}
61
- </UDropdownButton>
62
- `,
63
- });
64
-
65
- const VariantsTemplate = (args, { argTypes } = {}) => ({
66
- components: { UDropdownButton, URow },
67
- setup() {
68
- return {
69
- args,
70
- variants: argTypes.variant.options,
71
- };
72
- },
73
- template: `
74
- <URow>
75
- <UDropdownButton
76
- v-for="(variant, index) in variants"
77
- v-bind="args"
78
- :variant="variant"
79
- :label="variant"
80
- :key="index"
81
- />
82
- </URow>
83
- `,
84
- });
85
-
86
- const SizesTemplate = (args, { argTypes } = {}) => ({
52
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
87
53
  components: { UDropdownButton, URow },
88
54
  setup() {
89
55
  return {
90
56
  args,
91
- sizes: argTypes.size.options,
57
+ options: argTypes[args.enum].options,
92
58
  };
93
59
  },
94
60
  template: `
95
61
  <URow>
96
62
  <UDropdownButton
97
- v-for="(size, index) in sizes"
63
+ v-for="(option, index) in options"
98
64
  v-bind="args"
99
- :size="size"
100
- :label="size"
65
+ :[args.enum]="option"
66
+ :label="option"
101
67
  :key="index"
102
68
  />
103
69
  </URow>
@@ -135,19 +101,19 @@ Default.args = {};
135
101
  export const Filled = DefaultTemplate.bind({});
136
102
  Filled.args = { variant: "thirdary", filled: true };
137
103
 
138
- export const Variants = VariantsTemplate.bind({});
139
- Variants.args = { text: "" };
104
+ export const Variants = EnumVariantTemplate.bind({});
105
+ Variants.args = { enum: "variant", text: "" };
140
106
 
141
- export const Sizes = SizesTemplate.bind({});
142
- Sizes.args = { text: "" };
107
+ export const Sizes = EnumVariantTemplate.bind({});
108
+ Sizes.args = { enum: "size", text: "" };
143
109
 
144
110
  export const VariantColors = VariantColorsTemplate.bind({});
145
111
  VariantColors.args = { text: "" };
146
112
 
147
- export const WithoutDropdownIcon = VariantsTemplate.bind({});
148
- WithoutDropdownIcon.args = { noIcon: true };
113
+ export const WithoutDropdownIcon = EnumVariantTemplate.bind({});
114
+ WithoutDropdownIcon.args = { enum: "variant", noIcon: true };
149
115
 
150
- export const dropdownListSlot = SlotTemplate.bind({});
116
+ export const dropdownListSlot = DefaultTemplate.bind({});
151
117
  dropdownListSlot.args = {
152
118
  slotTemplate: `
153
119
  <template #default>
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UDropdownItem from "../ui.dropdown-item";
4
4
 
@@ -20,12 +20,14 @@ export default {
20
20
  const DefaultTemplate = (args) => ({
21
21
  components: { UDropdownItem },
22
22
  setup() {
23
- return { args };
23
+ const slots = getSlotNames(UDropdownItem.name);
24
+
25
+ return { args, slots };
24
26
  },
25
27
  template: `
26
- <UDropdownItem
27
- v-bind="args"
28
- />
28
+ <UDropdownItem v-bind="args">
29
+ ${args.slotTemplate || getSlotsFragment()}
30
+ </UDropdownItem>
29
31
  `,
30
32
  });
31
33
 
@@ -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 UDropdownLink from "../ui.dropdown-link";
4
4
  import UDropdownItem from "../ui.dropdown-item";
@@ -32,91 +32,60 @@ export default {
32
32
  };
33
33
 
34
34
  const DefaultTemplate = (args) => ({
35
- components: { UDropdownLink },
35
+ components: { UDropdownLink, UDropdownItem },
36
36
  setup() {
37
37
  const slots = getSlotNames(UDropdownLink.name);
38
38
 
39
39
  return { args, slots };
40
40
  },
41
41
  template: `
42
- <UDropdownLink
43
- v-bind="args"
44
- >
45
- ${allSlotsFragment}
46
- </UDropdownLink>
47
- `,
48
- });
49
-
50
- const SlotTemplate = (args) => ({
51
- components: { UDropdownLink, UDropdownItem },
52
- setup() {
53
- return { args };
54
- },
55
- template: `
56
- <UDropdownLink
57
- v-bind="args"
58
- >
59
- ${args.slotTemplate}
42
+ <UDropdownLink v-bind="args">
43
+ ${args.slotTemplate || getSlotsFragment()}
60
44
  </UDropdownLink>
61
45
  `,
62
46
  });
63
47
 
64
- const SizesTemplate = (args, { argTypes } = {}) => ({
48
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
65
49
  components: { UDropdownLink, URow },
66
50
  setup() {
67
- return {
68
- args,
69
- sizes: argTypes.size.options,
70
- };
51
+ function getText(value) {
52
+ return `Dropdown ${value}`;
53
+ }
54
+
55
+ let prefixedOptions = argTypes[args.enum].options;
56
+
57
+ if (argTypes[args.enum].name === "size") {
58
+ prefixedOptions = prefixedOptions.map((option) => getText(option));
59
+ }
60
+
61
+ return { args, options: argTypes[args.enum].options, prefixedOptions };
71
62
  },
72
63
  template: `
73
64
  <URow>
74
65
  <UDropdownLink
75
- v-for="(size, index) in sizes"
66
+ v-for="(option, index) in options"
76
67
  v-bind="args"
77
- :size="size"
68
+ :[args.enum]="option"
69
+ :label="prefixedOptions[index]"
78
70
  :key="index"
79
71
  />
80
72
  </URow>
81
73
  `,
82
74
  });
83
75
 
84
- const ColorsTemplate = (args, { argTypes } = {}) => ({
85
- components: { UDropdownLink, URow },
86
- setup() {
87
- return {
88
- args,
89
- colors: argTypes.color.options,
90
- };
91
- },
92
- template: `
93
- <div>
94
- <URow>
95
- <UDropdownLink
96
- v-for="(color, id) in colors"
97
- v-bind="args"
98
- :color="color"
99
- :label="color"
100
- :key="id"
101
- />
102
- </URow>
103
- </div>
104
- `,
105
- });
106
-
107
76
  export const Default = DefaultTemplate.bind({});
108
77
  Default.args = {};
109
78
 
110
- export const sizes = SizesTemplate.bind({});
111
- sizes.args = {};
79
+ export const sizes = EnumVariantTemplate.bind({});
80
+ sizes.args = { enum: "size" };
112
81
 
113
- export const colors = ColorsTemplate.bind({});
114
- colors.args = {};
82
+ export const colors = EnumVariantTemplate.bind({});
83
+ colors.args = { enum: "color" };
115
84
 
116
85
  export const WithoutDropdownIcon = DefaultTemplate.bind({});
117
86
  WithoutDropdownIcon.args = { noIcon: true };
118
87
 
119
- export const dropdownListSlot = SlotTemplate.bind({});
88
+ export const dropdownListSlot = DefaultTemplate.bind({});
120
89
  dropdownListSlot.args = {
121
90
  slotTemplate: `
122
91
  <template #default>
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UDropdownList from "../ui.dropdown-list";
4
4
  import URow from "../ui.container-row";
@@ -32,29 +32,33 @@ export default {
32
32
  const DefaultTemplate = (args) => ({
33
33
  components: { UDropdownList },
34
34
  setup() {
35
- return { args };
35
+ const slots = getSlotNames(UDropdownList.name);
36
+
37
+ return { args, slots };
36
38
  },
37
39
  template: `
38
- <UDropdownList v-bind="args" class="mx-4 w-[24rem]"/>
40
+ <UDropdownList v-bind="args" class="mx-4 w-[24rem]">
41
+ ${args.slotTemplate || getSlotsFragment()}
42
+ </UDropdownList>
39
43
  `,
40
44
  });
41
45
 
42
- const SizesTemplate = (args, { argTypes } = {}) => ({
46
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
43
47
  components: { UDropdownList, URow },
44
48
  setup() {
45
49
  return {
46
50
  args,
47
- sizes: argTypes.size.options,
51
+ options: argTypes[args.enum].options,
48
52
  };
49
53
  },
50
54
  template: `
51
55
  <div class="flex flex-col gap-6">
52
56
  <URow>
53
57
  <UDropdownList
54
- v-for="(size, index) in sizes"
58
+ v-for="(option, index) in options"
55
59
  :key="index"
56
60
  v-bind="args"
57
- :size="size"
61
+ :[args.enum]="option"
58
62
  />
59
63
  </URow>
60
64
  </div>
@@ -64,8 +68,8 @@ const SizesTemplate = (args, { argTypes } = {}) => ({
64
68
  export const Default = DefaultTemplate.bind({});
65
69
  Default.args = {};
66
70
 
67
- export const sizes = SizesTemplate.bind({});
68
- sizes.args = {};
71
+ export const sizes = EnumVariantTemplate.bind({});
72
+ sizes.args = { enum: "size" };
69
73
 
70
74
  export const maxHeight = DefaultTemplate.bind({});
71
75
  maxHeight.args = { maxHeight: 80 };
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.245",
4
+ "version": "0.0.247",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",