vueless 0.0.246 → 0.0.248

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.246",
3
+ "version": "0.0.248",
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 UDataList from "../ui.data-list";
4
4
  import UIcon from "../ui.image-icon";
@@ -42,39 +42,21 @@ export default {
42
42
  };
43
43
 
44
44
  const DefaultTemplate = (args) => ({
45
- components: { UDataList },
45
+ components: { UDataList, UIcon, URow },
46
46
  setup() {
47
- const slots = getSlotNames(UDataList.name);
48
-
49
- return { args, slots };
50
- },
51
- template: `
52
- <UDataList v-bind="args" @dragSort="onDragSort">
53
- ${allSlotsFragment}
54
- </UDataList>
55
- `,
56
- methods: {
57
- onDragSort(value) {
47
+ function onDragSort(value) {
58
48
  this.list = value;
59
- },
60
- },
61
- });
49
+ }
62
50
 
63
- const SlotTemplate = (args) => ({
64
- components: { UDataList, UIcon, URow },
65
- setup() {
66
- return { args };
51
+ const slots = getSlotNames(UDataList.name);
52
+
53
+ return { args, slots, onDragSort };
67
54
  },
68
55
  template: `
69
56
  <UDataList v-bind="args" @dragSort="onDragSort">
70
- ${args.slotTemplate}
57
+ ${args.slotTemplate || getSlotsFragment()}
71
58
  </UDataList>
72
59
  `,
73
- methods: {
74
- onDragSort(value) {
75
- this.list = value;
76
- },
77
- },
78
60
  });
79
61
 
80
62
  export const Default = DefaultTemplate.bind({});
@@ -90,7 +72,7 @@ emptyState.args = {
90
72
  export const nesting = DefaultTemplate.bind({});
91
73
  nesting.args = { nesting: true };
92
74
 
93
- export const slotLabel = SlotTemplate.bind({});
75
+ export const slotLabel = DefaultTemplate.bind({});
94
76
  slotLabel.args = {
95
77
  slotTemplate: `
96
78
  <template #label="{ item }">
@@ -102,7 +84,7 @@ slotLabel.args = {
102
84
  `,
103
85
  };
104
86
 
105
- export const slotActions = SlotTemplate.bind({});
87
+ export const slotActions = DefaultTemplate.bind({});
106
88
  slotActions.args = {
107
89
  slotTemplate: `
108
90
  <template #actions>
@@ -1,4 +1,4 @@
1
- import { getArgTypes, getSlotNames } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
  import { getRandomId } from "../service.ui";
3
3
 
4
4
  import UTable from "../ui.data-table";
@@ -157,7 +157,7 @@ function getRow() {
157
157
  }
158
158
 
159
159
  const DefaultTemplate = (args) => ({
160
- components: { UTable },
160
+ components: { UTable, UButton, ULink, UMoney, UBadge, URow },
161
161
  setup() {
162
162
  const slots = getSlotNames(UTable.name);
163
163
 
@@ -168,6 +168,7 @@ const DefaultTemplate = (args) => ({
168
168
  v-bind="args"
169
169
  :rows="itemsData"
170
170
  >
171
+ ${args.slotTemplate || getSlotsFragment()}
171
172
  </UTable>
172
173
  `,
173
174
  computed: {
@@ -195,32 +196,6 @@ const EmptyTemplate = (args) => ({
195
196
  `,
196
197
  });
197
198
 
198
- const SlotTemplate = (args) => ({
199
- components: { UTable, UButton, ULink, UMoney, UBadge, URow },
200
- setup() {
201
- return { args };
202
- },
203
- template: `
204
- <UTable
205
- v-bind="args"
206
- :rows="itemsData"
207
- >
208
- ${args.slotTemplate}
209
- </UTable>
210
- `,
211
- computed: {
212
- itemsData() {
213
- let rows = [];
214
-
215
- for (let i = 0; i < args.numberOfRows; i++) {
216
- rows.push(args.row());
217
- }
218
-
219
- return rows;
220
- },
221
- },
222
- });
223
-
224
199
  export const Default = DefaultTemplate.bind({});
225
200
  Default.args = {};
226
201
 
@@ -247,7 +222,7 @@ stickyHeader.args = {
247
222
  stickyHeader: true,
248
223
  };
249
224
 
250
- export const stickyFooter = SlotTemplate.bind({});
225
+ export const stickyFooter = DefaultTemplate.bind({});
251
226
  stickyFooter.parameters = STICKY_PARAMETERS;
252
227
  stickyFooter.args = {
253
228
  numberOfRows: 50,
@@ -281,7 +256,7 @@ DateDividerCustomLabel.args = {
281
256
  ],
282
257
  };
283
258
 
284
- export const slotDefault = SlotTemplate.bind({});
259
+ export const slotDefault = DefaultTemplate.bind({});
285
260
  slotDefault.args = {
286
261
  slotTemplate: `
287
262
  <template #cell-key_3="{value}">
@@ -290,7 +265,7 @@ slotDefault.args = {
290
265
  `,
291
266
  };
292
267
 
293
- export const slotHeaderActions = SlotTemplate.bind({});
268
+ export const slotHeaderActions = DefaultTemplate.bind({});
294
269
  slotHeaderActions.args = {
295
270
  numberOfRows: 50,
296
271
  stickyHeader: true,
@@ -316,7 +291,7 @@ slotHeaderActions.args = {
316
291
  `,
317
292
  };
318
293
 
319
- export const slotBeforeFirstRow = SlotTemplate.bind({});
294
+ export const slotBeforeFirstRow = DefaultTemplate.bind({});
320
295
  slotBeforeFirstRow.args = {
321
296
  slotTemplate: `
322
297
  <template #before-first-row>
@@ -330,7 +305,7 @@ slotBeforeFirstRow.args = {
330
305
  `,
331
306
  };
332
307
 
333
- export const slotAfterLastRow = SlotTemplate.bind({});
308
+ export const slotAfterLastRow = DefaultTemplate.bind({});
334
309
  slotAfterLastRow.args = {
335
310
  slotTemplate: `
336
311
  <template #after-last-row>
@@ -344,7 +319,7 @@ slotAfterLastRow.args = {
344
319
  `,
345
320
  };
346
321
 
347
- export const slotFooter = SlotTemplate.bind({});
322
+ export const slotFooter = DefaultTemplate.bind({});
348
323
  slotFooter.args = {
349
324
  slotTemplate: `
350
325
  <template #footer>
@@ -360,7 +335,7 @@ slotFooter.args = {
360
335
  `,
361
336
  };
362
337
 
363
- export const cellSlots = SlotTemplate.bind({});
338
+ export const cellSlots = DefaultTemplate.bind({});
364
339
  cellSlots.args = {
365
340
  columns: [
366
341
  { key: "link", label: "link" },
@@ -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 };
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UAvatar from "../ui.image-avatar";
4
4
  import URow from "../ui.container-row";
@@ -19,94 +19,43 @@ export default {
19
19
  const DefaultTemplate = (args) => ({
20
20
  components: { UAvatar },
21
21
  setup() {
22
- return { args };
23
- },
24
- template: `
25
- <UAvatar v-bind="args" />
26
- `,
27
- });
22
+ const slots = getSlotNames(UAvatar.name);
28
23
 
29
- const SizesTemplate = (args, { argTypes } = {}) => ({
30
- components: { UCol, URow, UAvatar },
31
- setup() {
32
- return {
33
- args,
34
- sizes: argTypes.size.options,
35
- };
24
+ return { args, slots };
36
25
  },
37
26
  template: `
38
- <UCol gap="xl">
39
- <URow>
40
- <UAvatar
41
- v-for="(size, index) in sizes"
42
- :key="index"
43
- v-bind="args"
44
- :size="size"
45
- :label="size"
46
- />
47
- </URow>
48
- <URow>
49
- <UAvatar
50
- v-for="(size, index) in sizes"
51
- :key="index"
52
- v-bind="args"
53
- :size="size"
54
- :label="''"
55
- />
56
- </URow>
57
- </UCol>
27
+ <UAvatar v-bind="args">
28
+ ${args.slotTemplate || getSlotsFragment()}
29
+ </UAvatar>
58
30
  `,
59
31
  });
60
32
 
61
- const ColorsTemplate = (args, { argTypes } = {}) => ({
33
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
62
34
  components: { UCol, URow, UAvatar },
63
35
  setup() {
64
36
  return {
65
37
  args,
66
- colors: argTypes.color.options,
38
+ options: argTypes[args.enum].options,
67
39
  };
68
40
  },
69
41
  template: `
70
42
  <UCol gap="xl">
71
43
  <URow>
72
44
  <UAvatar
73
- v-for="(color, index) in colors"
74
- v-bind="args"
75
- :color="color"
76
- :key="index"
77
- :label="color"
78
- />
79
- </URow>
80
- <URow>
81
- <UAvatar
82
- v-for="(color, index) in colors"
45
+ v-for="(option, index) in options"
83
46
  :key="index"
84
47
  v-bind="args"
85
- :color="color"
86
- :label="''"
48
+ :[args.enum]="option"
49
+ :label="option"
87
50
  />
88
51
  </URow>
89
- </UCol>
90
- `,
91
- });
92
-
93
- const RoundedTemplate = (args, { argTypes } = {}) => ({
94
- components: { UCol, UAvatar, URow },
95
- setup() {
96
- return {
97
- args,
98
- roundedValues: argTypes.rounded.options,
99
- };
100
- },
101
- template: `
102
- <UCol>
103
52
  <URow>
104
53
  <UAvatar
105
- v-for="(rounded, index) in roundedValues"
54
+ v-for="(option, index) in options"
106
55
  :key="index"
107
56
  v-bind="args"
108
- :rounded="rounded"
109
- :label="rounded"
57
+ :[args.enum]="option"
58
+ :label="''"
110
59
  />
111
60
  </URow>
112
61
  </UCol>
@@ -128,23 +77,23 @@ label.args = { label: "Name Surname", size: "3xl" };
128
77
  /**
129
78
  * Hold cursor above an avatar to see value.
130
79
  */
131
- export const sizes = SizesTemplate.bind({});
132
- sizes.args = {};
80
+ export const sizes = EnumVariantTemplate.bind({});
81
+ sizes.args = { enum: "size" };
133
82
 
134
83
  /**
135
84
  * Hold cursor above an avatar to see value.
136
85
  */
137
- export const rounded = RoundedTemplate.bind({});
138
- rounded.args = { label: "John Doe", color: "orange" };
86
+ export const rounded = EnumVariantTemplate.bind({});
87
+ rounded.args = { enum: "rounded", label: "John Doe", color: "orange" };
139
88
 
140
89
  /**
141
90
  * Hold cursor above an avatar to see value.
142
91
  */
143
- export const colors = ColorsTemplate.bind({});
144
- colors.args = {};
92
+ export const colors = EnumVariantTemplate.bind({});
93
+ colors.args = { enum: "color" };
145
94
 
146
95
  /**
147
96
  * Hold cursor above an avatar to see value.
148
97
  */
149
- export const bordered = ColorsTemplate.bind({});
150
- bordered.args = { bordered: true };
98
+ export const bordered = EnumVariantTemplate.bind({});
99
+ bordered.args = { enum: "color", bordered: true };
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UIcon from "../ui.image-icon";
4
4
  import URow from "../ui.container-row";
@@ -21,70 +21,31 @@ export default {
21
21
  const DefaultTemplate = (args) => ({
22
22
  components: { UIcon },
23
23
  setup() {
24
- return { args };
25
- },
26
- template: `
27
- <UIcon v-bind="args"/>
28
- `,
29
- });
24
+ const slots = getSlotNames(UIcon.name);
30
25
 
31
- const ColorsTemplate = (args, { argTypes } = {}) => ({
32
- components: { UIcon, URow },
33
- setup() {
34
- return {
35
- args,
36
- colors: argTypes.color.options,
37
- };
26
+ return { args, slots };
38
27
  },
39
28
  template: `
40
- <URow>
41
- <UIcon
42
- v-for="(color, index) in colors"
43
- v-bind="args"
44
- :color="color"
45
- name="close"
46
- :key="index"
47
- />
48
- </URow>
49
- `,
50
- });
51
-
52
- const SizesTemplate = (args, { argTypes } = {}) => ({
53
- components: { UIcon, URow },
54
- setup() {
55
- return {
56
- args,
57
- sizes: argTypes.size.options,
58
- };
59
- },
60
- template: `
61
- <URow>
62
- <UIcon
63
- v-for="(size, index) in sizes"
64
- v-bind="args"
65
- :size="size"
66
- name="close"
67
- :key="index"
68
- />
69
- </URow>
29
+ <UIcon v-bind="args">
30
+ ${args.slotTemplate || getSlotsFragment()}
31
+ </UIcon>
70
32
  `,
71
33
  });
72
34
 
73
- const VariantsTemplate = (args, { argTypes } = {}) => ({
35
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
74
36
  components: { UIcon, URow },
75
37
  setup() {
76
38
  return {
77
39
  args,
78
- variants: argTypes.variant.options,
40
+ options: argTypes[args.enum].options,
79
41
  };
80
42
  },
81
43
  template: `
82
44
  <URow>
83
45
  <UIcon
84
- v-for="(variant, index) in variants"
85
- :variant="variant"
86
- name="close"
46
+ v-for="(option, index) in options"
87
47
  v-bind="args"
48
+ :[args.enum]="option"
88
49
  :key="index"
89
50
  />
90
51
  </URow>
@@ -94,14 +55,14 @@ const VariantsTemplate = (args, { argTypes } = {}) => ({
94
55
  export const Default = DefaultTemplate.bind({});
95
56
  Default.args = {};
96
57
 
97
- export const colors = ColorsTemplate.bind({});
98
- colors.args = {};
58
+ export const colors = EnumVariantTemplate.bind({});
59
+ colors.args = { enum: "color" };
99
60
 
100
- export const sizes = SizesTemplate.bind({});
101
- sizes.args = {};
61
+ export const sizes = EnumVariantTemplate.bind({});
62
+ sizes.args = { enum: "size" };
102
63
 
103
- export const variants = VariantsTemplate.bind({});
104
- variants.args = { color: "red" };
64
+ export const variants = EnumVariantTemplate.bind({});
65
+ variants.args = { enum: "variant", color: "red" };
105
66
 
106
67
  export const tooltip = DefaultTemplate.bind({});
107
68
  tooltip.args = { tooltip: "Some text" };
@@ -109,5 +70,5 @@ tooltip.args = { tooltip: "Some text" };
109
70
  export const interactive = DefaultTemplate.bind({});
110
71
  interactive.args = { interactive: true };
111
72
 
112
- export const pill = ColorsTemplate.bind({});
113
- pill.args = { pill: true };
73
+ export const pill = EnumVariantTemplate.bind({});
74
+ pill.args = { enum: "color", pill: true };
@@ -1,8 +1,9 @@
1
1
  import ULoader from "../ui.loader";
2
2
  import URow from "../ui.container-row";
3
3
  import UButton from "../ui.button";
4
+ import { ref } from "vue";
4
5
 
5
- import { getArgTypes } from "../service.storybook";
6
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
6
7
 
7
8
  /**
8
9
  * The `ULoader` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.loader)
@@ -22,48 +23,32 @@ export default {
22
23
  const DefaultTemplate = (args) => ({
23
24
  components: { ULoader },
24
25
  setup() {
25
- return { args };
26
- },
27
- template: `
28
- <ULoader v-bind="args" />
29
- `,
30
- });
26
+ const slots = getSlotNames(ULoader.name);
31
27
 
32
- const ColorsTemplate = (args, { argTypes } = {}) => ({
33
- components: { ULoader, URow },
34
- setup() {
35
- return {
36
- args,
37
- colors: argTypes.color.options,
38
- };
28
+ return { args, slots };
39
29
  },
40
30
  template: `
41
- <URow class="flex-wrap">
42
- <ULoader
43
- v-for="(color, index) in colors"
44
- :key="index"
45
- v-bind="args"
46
- :color="color"
47
- />
48
- </URow>
31
+ <ULoader v-bind="args">
32
+ ${args.slotTemplate || getSlotsFragment()}
33
+ </ULoader>
49
34
  `,
50
35
  });
51
36
 
52
- const SizesTemplate = (args, { argTypes } = {}) => ({
37
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
53
38
  components: { ULoader, URow },
54
39
  setup() {
55
40
  return {
56
41
  args,
57
- sizes: argTypes.size.options,
42
+ options: argTypes[args.enum].options,
58
43
  };
59
44
  },
60
45
  template: `
61
- <URow>
46
+ <URow class="flex-wrap">
62
47
  <ULoader
63
- v-for="(size, index) in sizes"
48
+ v-for="(option, index) in options"
64
49
  :key="index"
65
50
  v-bind="args"
66
- :size="size"
51
+ :[args.enum]="option"
67
52
  />
68
53
  </URow>
69
54
  `,
@@ -72,17 +57,13 @@ const SizesTemplate = (args, { argTypes } = {}) => ({
72
57
  const LoadingTemplate = (args) => ({
73
58
  components: { ULoader, UButton, URow },
74
59
  setup() {
75
- return { args };
76
- },
77
- data() {
78
- return {
79
- isLoading: false,
80
- };
81
- },
82
- methods: {
83
- toggleLoader() {
84
- this.isLoading = !this.isLoading;
85
- },
60
+ function toggleLoader() {
61
+ isLoading.value = !isLoading.value;
62
+ }
63
+
64
+ const isLoading = ref(false);
65
+
66
+ return { args, isLoading, toggleLoader };
86
67
  },
87
68
  template: `
88
69
  <URow>
@@ -95,11 +76,11 @@ const LoadingTemplate = (args) => ({
95
76
  export const Default = DefaultTemplate.bind({});
96
77
  Default.args = {};
97
78
 
98
- export const sizes = SizesTemplate.bind({});
99
- sizes.args = {};
79
+ export const sizes = EnumVariantTemplate.bind({});
80
+ sizes.args = { enum: "size" };
100
81
 
101
- export const colors = ColorsTemplate.bind({});
102
- colors.args = {};
82
+ export const colors = EnumVariantTemplate.bind({});
83
+ colors.args = { enum: "color" };
103
84
 
104
85
  export const loading = LoadingTemplate.bind({});
105
86
  loading.args = {};
@@ -4,7 +4,7 @@ import UCol from "../ui.container-col";
4
4
 
5
5
  import { useLoaderRendering } from "./composables/useLoaderRendering";
6
6
 
7
- import { getArgTypes } from "../service.storybook";
7
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
8
8
 
9
9
  /**
10
10
  * The `ULoaderRendering` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.loader-rendering)
@@ -28,10 +28,14 @@ export default {
28
28
  const DefaultTemplate = (args) => ({
29
29
  components: { ULoaderRendering },
30
30
  setup() {
31
- return { args };
31
+ const slots = getSlotNames(ULoaderRendering.name);
32
+
33
+ return { args, slots };
32
34
  },
33
35
  template: `
34
- <ULoaderRendering v-bind="args" class="w-full h-full" />
36
+ <ULoaderRendering v-bind="args" class="w-full h-full">
37
+ ${args.slotTemplate || getSlotsFragment()}
38
+ </ULoaderRendering>
35
39
  `,
36
40
  });
37
41
 
@@ -40,12 +44,11 @@ const LoadingTemplate = (args) => ({
40
44
  setup() {
41
45
  const { loaderRenderingOn, loaderRenderingOff, isLoading } = useLoaderRendering();
42
46
 
43
- return { args, loaderRenderingOn, loaderRenderingOff, isLoading };
44
- },
45
- methods: {
46
- toggleLoading() {
47
- this.isLoading ? this.loaderRenderingOff() : this.loaderRenderingOn();
48
- },
47
+ function toggleLoading() {
48
+ isLoading.value ? loaderRenderingOff() : loaderRenderingOn();
49
+ }
50
+
51
+ return { args, loaderRenderingOn, loaderRenderingOff, isLoading, toggleLoading };
49
52
  },
50
53
  template: `
51
54
  <UCol align="center" class="pb-4">
@@ -7,7 +7,7 @@ import UBadge from "../ui.text-badge";
7
7
  import { useLoaderTop } from "./composables/useLoaderTop";
8
8
  import { loaderTopOff, loaderTopOn } from "./services/loaderTop.service";
9
9
 
10
- import { getArgTypes } from "../service.storybook";
10
+ import { getArgTypes, getSlotNames } from "../service.storybook";
11
11
 
12
12
  /**
13
13
  * The `ULoaderTop` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.loader-top)
@@ -26,7 +26,9 @@ const DefaultTemplate = (args) => ({
26
26
  setup() {
27
27
  const { loaderTopOn, loaderTopOff } = useLoaderTop();
28
28
 
29
- return { args, loaderTopOn, loaderTopOff };
29
+ const slots = getSlotNames(ULoaderTop.name);
30
+
31
+ return { args, slots, loaderTopOn, loaderTopOff };
30
32
  },
31
33
  template: `
32
34
  <ULoaderTop color="blue" v-bind="args" resources="https://api.publicapis.org/entries"/>
@@ -38,14 +40,14 @@ const DefaultTemplate = (args) => ({
38
40
  `,
39
41
  });
40
42
 
41
- const ColorsTemplate = (args, { argTypes } = {}) => ({
43
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
42
44
  components: { ULoaderTop, UButton, UCol, URow, UBadge },
43
45
  setup() {
44
46
  return {
45
47
  args,
46
48
  loaderTopOff,
47
49
  loaderTopOn,
48
- colors: argTypes.color.options,
50
+ options: argTypes[args.enum].options,
49
51
  };
50
52
  },
51
53
  template: `
@@ -55,12 +57,19 @@ const ColorsTemplate = (args, { argTypes } = {}) => ({
55
57
  <UButton label="Off" size="sm" @click="loaderTopOff('https://api.publicapis.org/images')" />
56
58
  </URow>
57
59
 
58
- <URow align="center" v-for="(color, index) in colors" :key="index">
59
- <UBadge :label="color" :color="color" />
60
+ <URow
61
+ align="center"
62
+ v-for="(option, index) in options"
63
+ :key="index"
64
+ >
65
+ <UBadge
66
+ :label="option"
67
+ :[args.enum]="option"
68
+ />
60
69
  <ULoaderTop
61
70
  resources="https://api.publicapis.org/images"
62
71
  class="static"
63
- :color="color"
72
+ :[args.enum]="option"
64
73
  v-bind="args"
65
74
  />
66
75
  </URow>
@@ -72,5 +81,5 @@ const ColorsTemplate = (args, { argTypes } = {}) => ({
72
81
  export const Default = DefaultTemplate.bind({});
73
82
  Default.args = {};
74
83
 
75
- export const Color = ColorsTemplate.bind({});
76
- Color.args = {};
84
+ export const Color = EnumVariantTemplate.bind({});
85
+ Color.args = { enum: "color" };
@@ -3,7 +3,7 @@ import URow from "../ui.container-row";
3
3
  import UCol from "../ui.container-col";
4
4
  import UBadge from "../ui.text-badge";
5
5
 
6
- import { getArgTypes } from "../service.storybook";
6
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
7
7
 
8
8
  /**
9
9
  * The `UDot` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.other-dot)
@@ -20,44 +20,35 @@ export default {
20
20
  const DefaultTemplate = (args) => ({
21
21
  components: { UDot },
22
22
  setup() {
23
- return { args };
24
- },
25
- template: `
26
- <UDot v-bind="args" />
27
- `,
28
- });
23
+ const slots = getSlotNames(UDot.name);
29
24
 
30
- const ColorsTemplate = (args, { argTypes } = {}) => ({
31
- components: { UCol, URow, UDot, UBadge },
32
- setup() {
33
- return {
34
- args,
35
- colors: argTypes.color.options,
36
- };
25
+ return { args, slots };
37
26
  },
38
27
  template: `
39
- <UCol>
40
- <URow v-for="(color, index) in colors" :key="index" gap="none" align="center">
41
- <UDot v-bind="args" :color="color"/>
42
- <UBadge :label="color" :color="color" variant="thirdary" />
43
- </URow>
44
- </UCol>
28
+ <UDot v-bind="args">
29
+ ${args.slotTemplate || getSlotsFragment()}
30
+ </UDot>
45
31
  `,
46
32
  });
47
33
 
48
- const SizesTemplate = (args, { argTypes } = {}) => ({
34
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
49
35
  components: { UCol, URow, UDot, UBadge },
50
36
  setup() {
51
37
  return {
52
38
  args,
53
- sizes: argTypes.size.options,
39
+ options: argTypes[args.enum].options,
54
40
  };
55
41
  },
56
42
  template: `
57
43
  <UCol>
58
- <URow v-for="(size, index) in sizes" :key="index" gap="none" align="center">
59
- <UDot v-bind="args" :size="size"/>
60
- <UBadge :label="size" variant="thirdary" />
44
+ <URow
45
+ v-for="(color, index) in colors"
46
+ :key="index"
47
+ gap="none"
48
+ align="center"
49
+ >
50
+ <UDot v-bind="args" :[args.enum]="option"/>
51
+ <UBadge :label="option" :[args.enum]="option" variant="thirdary" />
61
52
  </URow>
62
53
  </UCol>
63
54
  `,
@@ -66,8 +57,8 @@ const SizesTemplate = (args, { argTypes } = {}) => ({
66
57
  export const Default = DefaultTemplate.bind({});
67
58
  Default.args = {};
68
59
 
69
- export const Colors = ColorsTemplate.bind({});
70
- Colors.args = {};
60
+ export const Colors = EnumVariantTemplate.bind({});
61
+ Colors.args = { enum: "color" };
71
62
 
72
- export const Sizes = SizesTemplate.bind({});
73
- Sizes.args = {};
63
+ export const Sizes = EnumVariantTemplate.bind({});
64
+ Sizes.args = { enum: "size" };
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.246",
4
+ "version": "0.0.248",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",