vueless 0.0.241 → 0.0.243

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.241",
3
+ "version": "0.0.243",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UCard from "../ui.container-card";
4
4
  import URow from "../ui.container-row";
@@ -16,90 +16,77 @@ export default {
16
16
  component: UCard,
17
17
  args: {
18
18
  title: "Title",
19
- slotDefaultTemplate: `
20
- <template #default>
21
- <p>
22
- Lorem ipsum dolor sit amet, consectetur adipiscing elit,
23
- sed do eiusmod tempor incididunt ut labore et dolore magna
24
- aliqua. Ut enim ad minim veniam, quis nostrud exercitation
25
- ullamco laboris nisi ut aliquip ex ea commodo consequat.
26
- Duis aute irure dolor in reprehenderit in voluptate velit
27
- esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
28
- occaecat cupidatat non proident, sunt in culpa qui officia
29
- deserunt mollit anim id est laborum.
30
- </p>
31
- </template>
32
- `,
33
19
  },
34
20
  argTypes: {
35
21
  ...getArgTypes(UCard.name),
36
22
  },
37
23
  };
38
24
 
25
+ const defaultTemplate = `
26
+ <p>
27
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit,
28
+ sed do eiusmod tempor incididunt ut labore et dolore magna
29
+ aliqua. Ut enim ad minim veniam, quis nostrud exercitation
30
+ ullamco laboris nisi ut aliquip ex ea commodo consequat.
31
+ Duis aute irure dolor in reprehenderit in voluptate velit
32
+ esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
33
+ occaecat cupidatat non proident, sunt in culpa qui officia
34
+ deserunt mollit anim id est laborum.
35
+ </p>
36
+ `;
37
+
39
38
  const DefaultTemplate = (args) => ({
40
39
  components: { UCard, UButton, UInput, UIcon, UHeader },
41
40
  setup() {
42
- return { args };
41
+ const slots = getSlotNames(UCard.name);
42
+
43
+ return { args, slots };
43
44
  },
44
45
  template: `
45
46
  <UCard v-bind="args">
46
- ${args.slotDefaultTemplate}
47
- ${args.slotTemplate || ""}
47
+ ${args.slotTemplate || getSlotsFragment(defaultTemplate)}
48
48
  </UCard>
49
49
  `,
50
50
  });
51
51
 
52
- const PaddingTemplate = (args, { argTypes } = {}) => ({
52
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
53
53
  components: { UCard, URow },
54
54
  setup() {
55
55
  return {
56
56
  args,
57
- paddings: argTypes.padding.options,
57
+ options: argTypes[args.enum].options,
58
58
  };
59
59
  },
60
60
  template: `
61
61
  <URow>
62
- <UCard v-for="(padding, index) in paddings" v-bind="args" :padding="padding" :key="index">
63
- ${args.slotDefaultTemplate}
62
+ <UCard
63
+ v-for="(option, index) in options"
64
+ v-bind="args"
65
+ :[args.enum]="option"
66
+ :key="index"
67
+ >
68
+ ${defaultTemplate}
64
69
  </UCard>
65
70
  </URow>
66
71
  `,
67
72
  });
68
73
 
69
74
  export const Default = DefaultTemplate.bind({});
70
- Default.args = {
71
- slotTemplate: `
72
- <template #default>
73
- <p>
74
- Lorem ipsum dolor sit amet, consectetur adipiscing elit,
75
- sed do eiusmod tempor incididunt ut labore et dolore magna
76
- aliqua. Ut enim ad minim veniam, quis nostrud exercitation
77
- ullamco laboris nisi ut aliquip ex ea commodo consequat.
78
- Duis aute irure dolor in reprehenderit in voluptate velit
79
- esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
80
- occaecat cupidatat non proident, sunt in culpa qui officia
81
- deserunt mollit anim id est laborum.
82
- </p>
83
- </template>
84
- `,
85
- };
75
+ Default.args = {};
86
76
 
87
77
  export const description = DefaultTemplate.bind({});
88
78
  description.args = { description: "Card description" };
89
79
 
90
- export const padding = PaddingTemplate.bind({});
91
- padding.args = {};
80
+ export const padding = EnumVariantTemplate.bind({});
81
+ padding.args = { enum: "padding" };
92
82
 
93
83
  export const slotHeaderLeftBefore = DefaultTemplate.bind({});
94
84
  slotHeaderLeftBefore.args = {
95
85
  slotTemplate: `
96
86
  <template #header-left-before>
97
- <UIcon
98
- name="star"
99
- size="sm"
100
- pill
101
- />
87
+ <UIcon name="star" size="sm" pill />
102
88
  </template>
89
+ ${defaultTemplate}
103
90
  `,
104
91
  };
105
92
 
@@ -109,6 +96,7 @@ slotHeaderLeft.args = {
109
96
  <template #header-left>
110
97
  <UHeader size="lg" label="Large title" />
111
98
  </template>
99
+ ${defaultTemplate}
112
100
  `,
113
101
  };
114
102
 
@@ -116,12 +104,9 @@ export const slotHeaderLeftAfter = DefaultTemplate.bind({});
116
104
  slotHeaderLeftAfter.args = {
117
105
  slotTemplate: `
118
106
  <template #header-left-after>
119
- <UIcon
120
- name="star"
121
- size="sm"
122
- pill
123
- />
107
+ <UIcon name="star" size="sm" pill />
124
108
  </template>
109
+ ${defaultTemplate}
125
110
  `,
126
111
  };
127
112
 
@@ -131,12 +116,14 @@ slotHeaderRight.args = {
131
116
  <template #header-right>
132
117
  <UButton size="sm" color="gray" label="Read more" />
133
118
  </template>
119
+ ${defaultTemplate}
134
120
  `,
135
121
  };
136
122
 
137
123
  export const slotFooterLeft = DefaultTemplate.bind({});
138
124
  slotFooterLeft.args = {
139
125
  slotTemplate: `
126
+ ${defaultTemplate}
140
127
  <template #footer-left>
141
128
  <UButton label="Read more" />
142
129
  </template>
@@ -146,6 +133,7 @@ slotFooterLeft.args = {
146
133
  export const slotFooterRight = DefaultTemplate.bind({});
147
134
  slotFooterRight.args = {
148
135
  slotTemplate: `
136
+ ${defaultTemplate}
149
137
  <template #footer-right>
150
138
  <UButton label="Read more" />
151
139
  </template>
@@ -1,11 +1,11 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UCol from "../ui.container-col";
4
4
  import UInput from "../ui.form-input";
5
5
  import UButton from "../ui.button";
6
6
 
7
7
  /**
8
- * The `UGroup` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.container-group)
8
+ * The `UCol` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.container-col)
9
9
  */
10
10
  export default {
11
11
  id: "5015",
@@ -24,22 +24,22 @@ export default {
24
24
  },
25
25
  };
26
26
 
27
- const defaultSlotTemplate = `
28
- <template #default>
29
- <UInput placeholder="Vasyl" label="Name" />
30
- <UInput placeholder="Vasylenko" label="Surname" />
31
- <UInput placeholder="Kyiv" label="Town" />
32
- </template>
27
+ const defaultTemplate = `
28
+ <UInput placeholder="Vasyl" label="Name" />
29
+ <UInput placeholder="Vasylenko" label="Surname" />
30
+ <UInput placeholder="Kyiv" label="Town" />
33
31
  `;
34
32
 
35
33
  const DefaultTemplate = (args) => ({
36
34
  components: { UCol, UInput, UButton },
37
35
  setup() {
38
- return { args };
36
+ const slots = getSlotNames(UCol.name);
37
+
38
+ return { args, slots };
39
39
  },
40
40
  template: `
41
41
  <UCol v-bind="args">
42
- ${args.slotTemplate || defaultSlotTemplate}
42
+ ${args.slotTemplate || getSlotsFragment(defaultTemplate)}
43
43
  </UCol>
44
44
  `,
45
45
  });
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
  import URow from "../ui.container-row";
3
3
 
4
4
  import UDivider from "../ui.container-divider";
@@ -18,52 +18,32 @@ export default {
18
18
  const DefaultTemplate = (args) => ({
19
19
  components: { UDivider },
20
20
  setup() {
21
- return { args };
22
- },
23
- template: `
24
- <UDivider v-bind="args" />
25
- `,
26
- });
21
+ const slots = getSlotNames(UDivider.name);
27
22
 
28
- const SizesTemplate = (args, { argTypes } = {}) => ({
29
- components: { UDivider, URow },
30
- setup() {
31
- return {
32
- args,
33
- sizes: argTypes.size.options,
34
- };
23
+ return { args, slots };
35
24
  },
36
25
  template: `
37
- <URow>
38
- <UDivider
39
- class="w-1/4"
40
- v-for="(size, index) in sizes"
41
- v-bind="args"
42
- :size="size"
43
- :key="index"
44
- />
45
- </URow>
26
+ <UDivider v-bind="args">
27
+ ${args.slotTemplate || getSlotsFragment()}
28
+ </UDivider>
46
29
  `,
47
- created() {
48
- this.mxArgTypes = argTypes;
49
- },
50
30
  });
51
31
 
52
- const VariantTemplate = (args, { argTypes } = {}) => ({
32
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
53
33
  components: { UDivider, URow },
54
34
  setup() {
55
35
  return {
56
36
  args,
57
- variants: argTypes.variant.options,
37
+ options: argTypes[args.enum].options,
58
38
  };
59
39
  },
60
40
  template: `
61
41
  <URow>
62
42
  <UDivider
63
- class="w-1/3"
64
- v-for="(variant, index) in variants"
43
+ class="w-1/4"
44
+ v-for="(option, index) in options"
65
45
  v-bind="args"
66
- :variant="variant"
46
+ :[args.enum]="option"
67
47
  :key="index"
68
48
  />
69
49
  </URow>
@@ -73,11 +53,11 @@ const VariantTemplate = (args, { argTypes } = {}) => ({
73
53
  export const Default = DefaultTemplate.bind({});
74
54
  Default.args = {};
75
55
 
76
- export const sizes = SizesTemplate.bind({});
77
- sizes.args = {};
56
+ export const sizes = EnumVariantTemplate.bind({});
57
+ sizes.args = { enum: "size" };
78
58
 
79
- export const variants = VariantTemplate.bind({});
80
- variants.args = {};
59
+ export const variants = EnumVariantTemplate.bind({});
60
+ variants.args = { enum: "variant" };
81
61
 
82
62
  export const dashed = DefaultTemplate.bind({});
83
63
  dashed.args = { dashed: true };
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UGroup from "../ui.container-group";
4
4
  import UCol from "../ui.container-col";
@@ -27,24 +27,24 @@ export default {
27
27
  },
28
28
  };
29
29
 
30
- const defaultSlotTemplate = `
31
- <template #default>
32
- <UCol>
33
- <UInput placeholder="Vasyl" label="Name" />
34
- <UInput placeholder="Vasylenko" label="Surname" />
35
- <UInput placeholder="Kyiv" label="Town" />
36
- </UCol>
37
- </template>
30
+ const defaultTemplate = `
31
+ <UCol>
32
+ <UInput placeholder="Vasyl" label="Name" />
33
+ <UInput placeholder="Vasylenko" label="Surname" />
34
+ <UInput placeholder="Kyiv" label="Town" />
35
+ </UCol>
38
36
  `;
39
37
 
40
38
  const DefaultTemplate = (args) => ({
41
39
  components: { UGroup, UCol, UInput, UButton },
42
40
  setup() {
43
- return { args };
41
+ const slots = getSlotNames(UGroup.name);
42
+
43
+ return { args, slots };
44
44
  },
45
45
  template: `
46
46
  <UGroup v-bind="args">
47
- ${args.slotTemplate || defaultSlotTemplate}
47
+ ${args.slotTemplate || getSlotsFragment(defaultTemplate)}
48
48
  </UGroup>
49
49
  `,
50
50
  });
@@ -79,6 +79,7 @@ slotDefault.parameters = {
79
79
  export const slotRight = DefaultTemplate.bind({});
80
80
  slotRight.args = {
81
81
  slotTemplate: `
82
+ ${defaultTemplate}
82
83
  <template #right>
83
84
  <UButton size="sm" label="Edit"/>
84
85
  </template>
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UGroups from "../ui.container-groups";
4
4
  import UGroup from "../ui.container-group";
@@ -12,6 +12,7 @@ export default {
12
12
  id: "5040",
13
13
  title: "Containers / Groups",
14
14
  component: UGroups,
15
+ args: {},
15
16
  argTypes: {
16
17
  ...getArgTypes(UGroups.name),
17
18
  },
@@ -24,25 +25,25 @@ export default {
24
25
  },
25
26
  };
26
27
 
27
- const defaultSlotTemplate = `
28
- <template #default>
29
- <UGroup :upperlined="n !== 1" :title="'Group '+n" v-for="n in 3">
30
- <UCol>
31
- <UInput placeholder="input" label="Label" />
32
- <UInput placeholder="input" label="Label" />
33
- </UCol>
34
- </UGroup>
35
- </template>
28
+ const defaultTemplate = `
29
+ <UGroup :upperlined="n !== 1" :title="'Group '+n" v-for="n in 3">
30
+ <UCol>
31
+ <UInput placeholder="input" label="Label" />
32
+ <UInput placeholder="input" label="Label" />
33
+ </UCol>
34
+ </UGroup>
36
35
  `;
37
36
 
38
37
  const DefaultTemplate = (args) => ({
39
38
  components: { UGroups, UGroup, UCol, UInput },
40
39
  setup() {
41
- return { args };
40
+ const slots = getSlotNames(UGroups.name);
41
+
42
+ return { args, slots };
42
43
  },
43
44
  template: `
44
45
  <UGroups v-bind="args">
45
- ${args.slotTemplate || defaultSlotTemplate}
46
+ ${args.slotTemplate || getSlotsFragment(defaultTemplate)}
46
47
  </UGroups>
47
48
  `,
48
49
  });
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UModal from "../ui.container-modal";
4
4
  import UButton from "../ui.button";
@@ -17,17 +17,7 @@ export default {
17
17
  component: UModal,
18
18
  args: {
19
19
  title: "Modal title",
20
- value: false,
21
- slotDefaultTemplate: `
22
- <template #default>
23
- <URow>
24
- <UInput label="Name" />
25
- <UInput label="Lastname" />
26
- </URow>
27
-
28
- <UTextarea class="mb-7" label="Comments" rows="3" />
29
- </template>
30
- `,
20
+ modelValue: false,
31
21
  },
32
22
  argTypes: {
33
23
  ...getArgTypes(UModal.name),
@@ -41,64 +31,74 @@ export default {
41
31
  },
42
32
  };
43
33
 
34
+ const defaultTemplate = `
35
+ <URow>
36
+ <UInput label="Name" />
37
+ <UInput label="Lastname" />
38
+ </URow>
39
+
40
+ <UTextarea class="mb-7" label="Comments" rows="3" />
41
+ `;
42
+
44
43
  const DefaultTemplate = (args) => ({
45
44
  components: { UModal, URow, UButton, UIcon, UHeader, UInput, UTextarea },
46
45
  setup() {
47
- return { args };
46
+ function onClick() {
47
+ args.modelValue = true;
48
+ }
49
+
50
+ const slots = getSlotNames(UModal.name);
51
+
52
+ return { args, slots, onClick };
48
53
  },
49
54
  template: `
50
55
  <div>
51
- <UModal v-bind="args" v-model="args.value">
52
- ${args.slotDefaultTemplate}
53
- ${args.slotTemplate || ""}
56
+ <UModal v-bind="args" v-model="args.modelValue">
57
+ ${args.slotTemplate || getSlotsFragment(defaultTemplate)}
54
58
  </UModal>
55
59
 
56
60
  <UButton label="show modal" @click="onClick"/>
57
61
  </div>
58
62
  `,
59
- methods: {
60
- onClick() {
61
- args.value = true;
62
- },
63
- },
64
63
  });
65
64
 
66
- const SizesTemplate = (args, { argTypes } = {}) => ({
65
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
67
66
  components: { UModal, UButton, URow, UInput, UTextarea },
68
67
  setup() {
68
+ function onClick(value) {
69
+ args.width = value;
70
+ args.modelValue = true;
71
+ }
72
+
69
73
  return {
70
74
  args,
71
- sizes: argTypes.width.options,
75
+ options: argTypes[args.enum].options,
76
+ onClick,
72
77
  };
73
78
  },
74
79
  template: `
75
80
  <div>
76
- <UModal v-bind="args" v-model="args.value">
77
- ${args.slotDefaultTemplate}
78
- ${args.slotTemplate || ""}
81
+ <UModal v-bind="args" v-model="args.modelValue">
82
+ ${defaultTemplate}
79
83
  </UModal>
80
84
 
81
85
  <URow>
82
86
  <UButton
83
- v-for="(size, index) in sizes"
84
- :key="index" :label="size" @click="onClick(size)"
87
+ v-for="(option, index) in options"
88
+ :key="index"
89
+ :label="option"
90
+ @click="onClick(option)"
85
91
  />
86
92
  </URow>
87
93
  </div>
88
94
  `,
89
- methods: {
90
- onClick(value) {
91
- args.width = value;
92
- args.value = true;
93
- },
94
- },
95
95
  });
96
96
 
97
97
  export const Default = DefaultTemplate.bind({});
98
98
  Default.args = {};
99
99
 
100
- export const sizes = SizesTemplate.bind({});
101
- sizes.args = { text: "" };
100
+ export const sizes = EnumVariantTemplate.bind({});
101
+ sizes.args = { enum: "width", text: "" };
102
102
 
103
103
  export const backRoute = DefaultTemplate.bind({});
104
104
  backRoute.args = { backRoute: { title: "route title" } };
@@ -121,6 +121,7 @@ slotHeaderLeftBefore.args = {
121
121
  color="gray"
122
122
  />
123
123
  </template>
124
+ ${defaultTemplate}
124
125
  `,
125
126
  };
126
127
 
@@ -130,6 +131,7 @@ slotHeaderLeft.args = {
130
131
  <template #header-left>
131
132
  <UHeader size="lg" label="Large title" />
132
133
  </template>
134
+ ${defaultTemplate}
133
135
  `,
134
136
  };
135
137
 
@@ -142,6 +144,7 @@ slotHeaderLeftAfter.args = {
142
144
  color="gray"
143
145
  />
144
146
  </template>
147
+ ${defaultTemplate}
145
148
  `,
146
149
  };
147
150
 
@@ -149,14 +152,16 @@ export const slotHeaderRight = DefaultTemplate.bind({});
149
152
  slotHeaderRight.args = {
150
153
  slotTemplate: `
151
154
  <template #header-right>
152
- <UButton size="sm" color="gray" label="some button" />
155
+ <UButton size="sm" color="gray" label="some button" />
153
156
  </template>
157
+ ${defaultTemplate}
154
158
  `,
155
159
  };
156
160
 
157
161
  export const slotFooterLeft = DefaultTemplate.bind({});
158
162
  slotFooterLeft.args = {
159
163
  slotTemplate: `
164
+ ${defaultTemplate}
160
165
  <template #footer-left>
161
166
  <UButton label="Submit" />
162
167
  </template>
@@ -166,6 +171,7 @@ slotFooterLeft.args = {
166
171
  export const slotFooterRight = DefaultTemplate.bind({});
167
172
  slotFooterRight.args = {
168
173
  slotTemplate: `
174
+ ${defaultTemplate}
169
175
  <template #footer-right>
170
176
  <UButton label="Back" />
171
177
  </template>
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UModalConfirm from "../ui.container-modal-confirm";
4
4
  import UButton from "../ui.button";
@@ -16,11 +16,7 @@ export default {
16
16
  args: {
17
17
  title: "Modal Confirm title",
18
18
  confirmLabel: "Confirm",
19
- slotTemplate: `
20
- <template #default>
21
- Confirm the action?
22
- </template>
23
- `,
19
+ modelValue: false,
24
20
  },
25
21
  argTypes: {
26
22
  ...getArgTypes(UModalConfirm.name),
@@ -34,106 +30,61 @@ export default {
34
30
  },
35
31
  };
36
32
 
33
+ const defaultTemplate = "Confirm the action?";
34
+
37
35
  const DefaultTemplate = (args) => ({
38
- components: { UModalConfirm, UButton },
36
+ components: { UModalConfirm, UButton, UHeader, UIcon },
39
37
  setup() {
40
- return { args };
41
- },
42
- template: `
43
- <div>
44
- <UModalConfirm v-bind="args" v-model="args.value">
45
- ${args.slotTemplate}
46
- </UModalConfirm>
38
+ function onClick() {
39
+ args.modelValue = true;
40
+ }
47
41
 
48
- <UButton label="show modal" @click="onClick"/>
49
- </div>
50
- `,
51
- methods: {
52
- onClick() {
53
- args.value = true;
54
- },
55
- },
56
- });
42
+ const slots = getSlotNames(UModalConfirm.name);
57
43
 
58
- const SlotTemplate = (args) => ({
59
- components: { UModalConfirm, UButton, UHeader, UIcon },
60
- setup() {
61
- return { args };
44
+ return { args, slots, onClick };
62
45
  },
63
46
  template: `
64
47
  <div>
65
- <UModalConfirm v-bind="args" v-model="args.value">
66
- ${args.slotTemplate}
48
+ <UModalConfirm v-bind="args" v-model="args.modelValue">
49
+ ${args.slotTemplate || getSlotsFragment(defaultTemplate)}
67
50
  </UModalConfirm>
68
51
 
69
52
  <UButton label="show modal" @click="onClick"/>
70
53
  </div>
71
54
  `,
72
- methods: {
73
- onClick() {
74
- args.value = true;
75
- },
76
- },
77
55
  });
78
56
 
79
- const SizesTemplate = (args, { argTypes } = {}) => ({
57
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
80
58
  components: { UModalConfirm, UButton, URow },
81
59
  setup() {
82
- return {
83
- args,
84
- sizes: argTypes.width.options,
85
- };
86
- },
87
- template: `
88
- <div>
89
- <UModalConfirm v-bind="args" v-model="args.value">
90
- ${args.slotTemplate}
91
- </UModalConfirm>
60
+ function onClick(value) {
61
+ argTypes[args.enum].name === "color" ? (args.color = value) : (args.width = value);
92
62
 
93
- <URow>
94
- <UButton
95
- v-for="(size, index) in sizes"
96
- :key="index" :label="size" @click="onClick(size)"
97
- />
98
- </URow>
99
- </div>
100
- `,
101
- methods: {
102
- onClick(value) {
103
- args.width = value;
104
- args.value = true;
105
- },
106
- },
107
- });
63
+ args.modelValue = true;
64
+ }
108
65
 
109
- const ColorTemplate = (args, { argTypes } = {}) => ({
110
- components: { UModalConfirm, UButton, URow },
111
- setup() {
112
66
  return {
113
67
  args,
114
- colors: argTypes.color.options,
68
+ onClick,
69
+ options: argTypes[args.enum].options,
115
70
  };
116
71
  },
117
72
  template: `
118
73
  <div>
119
- <UModalConfirm v-bind="args" v-model="args.value">
120
- ${args.slotTemplate}
74
+ <UModalConfirm v-bind="args" v-model="args.modelValue">
75
+ ${defaultTemplate}
121
76
  </UModalConfirm>
122
77
 
123
78
  <URow>
124
79
  <UButton
125
- v-for="(color, index) in colors"
126
- :key="index" :label="color" @click="onClick(color)"
80
+ v-for="(option, index) in options"
81
+ :key="index"
82
+ :label="option"
83
+ @click="onClick(option)"
127
84
  />
128
85
  </URow>
129
86
  </div>
130
87
  `,
131
- methods: {
132
- onClick(value) {
133
- args.color = value;
134
- args.value = true;
135
- },
136
- },
137
88
  });
138
89
 
139
90
  export const Default = DefaultTemplate.bind({});
@@ -145,13 +96,13 @@ withoutCancelButton.args = { cancelButton: false };
145
96
  export const disableAcceptButton = DefaultTemplate.bind({});
146
97
  disableAcceptButton.args = { confirmDisabled: true };
147
98
 
148
- export const sizes = SizesTemplate.bind({});
149
- sizes.args = { text: "" };
99
+ export const sizes = EnumVariantTemplate.bind({});
100
+ sizes.args = { enum: "width", text: "" };
150
101
 
151
- export const color = ColorTemplate.bind({});
152
- sizes.args = { text: "" };
102
+ export const color = EnumVariantTemplate.bind({});
103
+ color.args = { enum: "color", text: "" };
153
104
 
154
- export const slotHeaderLeftBefore = SlotTemplate.bind({});
105
+ export const slotHeaderLeftBefore = DefaultTemplate.bind({});
155
106
  slotHeaderLeftBefore.args = {
156
107
  slotTemplate: `
157
108
  <template #header-left-before>
@@ -160,19 +111,21 @@ slotHeaderLeftBefore.args = {
160
111
  color="gray"
161
112
  />
162
113
  </template>
114
+ ${defaultTemplate}
163
115
  `,
164
116
  };
165
117
 
166
- export const slotHeaderLeft = SlotTemplate.bind({});
118
+ export const slotHeaderLeft = DefaultTemplate.bind({});
167
119
  slotHeaderLeft.args = {
168
120
  slotTemplate: `
169
121
  <template #header-left>
170
122
  <UHeader size="lg" label="Large title" />
171
123
  </template>
124
+ ${defaultTemplate}
172
125
  `,
173
126
  };
174
127
 
175
- export const slotHeaderLeftAfter = SlotTemplate.bind({});
128
+ export const slotHeaderLeftAfter = DefaultTemplate.bind({});
176
129
  slotHeaderLeftAfter.args = {
177
130
  slotTemplate: `
178
131
  <template #header-left-after>
@@ -181,19 +134,21 @@ slotHeaderLeftAfter.args = {
181
134
  color="gray"
182
135
  />
183
136
  </template>
137
+ ${defaultTemplate}
184
138
  `,
185
139
  };
186
140
 
187
- export const slotHeaderRight = SlotTemplate.bind({});
141
+ export const slotHeaderRight = DefaultTemplate.bind({});
188
142
  slotHeaderRight.args = {
189
143
  slotTemplate: `
190
144
  <template #header-right>
191
- <UButton label="I'm in the right slot" size="sm" color="gray" />
145
+ <UButton label="I'm in the right slot" size="sm" color="gray" />
192
146
  </template>
147
+ ${defaultTemplate}
193
148
  `,
194
149
  };
195
150
 
196
- export const slotDefault = SlotTemplate.bind({});
151
+ export const slotDefault = DefaultTemplate.bind({});
197
152
  slotDefault.args = {
198
153
  slotTemplate: `
199
154
  <template #default>
@@ -202,11 +157,12 @@ slotDefault.args = {
202
157
  `,
203
158
  };
204
159
 
205
- export const slotFooterRight = SlotTemplate.bind({});
160
+ export const slotFooterRight = DefaultTemplate.bind({});
206
161
  slotFooterRight.args = {
207
162
  slotTemplate: `
163
+ ${defaultTemplate}
208
164
  <template #footer-right>
209
- <UButton label="I'm in the right slot" size="sm" color="gray" />
165
+ <UButton label="I'm in the right slot" size="sm" color="gray" />
210
166
  </template>
211
167
  `,
212
168
  };
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UPage from "../ui.container-page";
4
4
  import UCard from "../ui.container-card";
@@ -19,23 +19,22 @@ export default {
19
19
  args: {
20
20
  title: "Title",
21
21
  gray: true,
22
- slotDefaultTemplate: `
23
- <template #default>
24
- <UCard title="Card title">
25
- <URow>
26
- <UInput label="Name" />
27
- <UInput label="Lastname" />
28
- </URow>
29
- <UTextarea class="mb-7 mt-4" label="Comments" rows="3" />
30
- </UCard>
31
- </template>
32
- `,
33
22
  },
34
23
  argTypes: {
35
24
  ...getArgTypes(UPage.name),
36
25
  },
37
26
  };
38
27
 
28
+ const defaultTemplate = `
29
+ <UCard title="Card title">
30
+ <URow>
31
+ <UInput label="Name" />
32
+ <UInput label="Lastname" />
33
+ </URow>
34
+ <UTextarea class="mb-7 mt-4" label="Comments" rows="3" />
35
+ </UCard>
36
+ `;
37
+
39
38
  const DefaultTemplate = (args) => ({
40
39
  components: {
41
40
  UPage,
@@ -48,12 +47,13 @@ const DefaultTemplate = (args) => ({
48
47
  UHeader,
49
48
  },
50
49
  setup() {
51
- return { args };
50
+ const slots = getSlotNames(UPage.name);
51
+
52
+ return { args, slots };
52
53
  },
53
54
  template: `
54
55
  <UPage v-bind="args">
55
- ${args.slotDefaultTemplate}
56
- ${args.slotTemplate || ""}
56
+ ${args.slotTemplate || getSlotsFragment(defaultTemplate)}
57
57
  </UPage>
58
58
  `,
59
59
  });
@@ -96,8 +96,9 @@ slotHeaderLeftBefore.args = {
96
96
  <UIcon
97
97
  name="close"
98
98
  color="gray"
99
- />
99
+ />
100
100
  </template>
101
+ ${defaultTemplate}
101
102
  `,
102
103
  };
103
104
 
@@ -107,6 +108,7 @@ slotHeaderLeft.args = {
107
108
  <template #header-left>
108
109
  <UHeader size="lg" label="Large title" />
109
110
  </template>
111
+ ${defaultTemplate}
110
112
  `,
111
113
  };
112
114
 
@@ -117,8 +119,9 @@ slotHeaderLeftAfter.args = {
117
119
  <UIcon
118
120
  name="close"
119
121
  color="gray"
120
- />
122
+ />
121
123
  </template>
124
+ ${defaultTemplate}
122
125
  `,
123
126
  };
124
127
 
@@ -126,14 +129,16 @@ export const slotHeaderRight = DefaultTemplate.bind({});
126
129
  slotHeaderRight.args = {
127
130
  slotTemplate: `
128
131
  <template #header-right>
129
- <UButton size="sm" color="gray" label="button" />
132
+ <UButton size="sm" color="gray" label="button" />
130
133
  </template>
134
+ ${defaultTemplate}
131
135
  `,
132
136
  };
133
137
 
134
138
  export const slotFooterLeft = DefaultTemplate.bind({});
135
139
  slotFooterLeft.args = {
136
140
  slotTemplate: `
141
+ ${defaultTemplate}
137
142
  <template #footer-left>
138
143
  <UButton label="button" />
139
144
  </template>
@@ -143,8 +148,9 @@ slotFooterLeft.args = {
143
148
  export const slotFooterRight = DefaultTemplate.bind({});
144
149
  slotFooterRight.args = {
145
150
  slotTemplate: `
151
+ ${defaultTemplate}
146
152
  <template #footer-right>
147
- <UButton label="button" />
153
+ <UButton label="button" />
148
154
  </template>
149
155
  `,
150
156
  };
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import URow from "../ui.container-row";
4
4
  import UInput from "../ui.form-input";
@@ -17,56 +17,52 @@ export default {
17
17
  },
18
18
  };
19
19
 
20
- const defaultSlotTemplate = `
21
- <template #default>
22
- <UInput label="Name" />
23
- <UButton label="Submit" size="xs" block />
24
- </template>
20
+ const defaultTemplate = `
21
+ <UInput label="Name" />
22
+ <UButton label="Submit" size="xs" block />
25
23
  `;
26
24
 
27
25
  const DefaultTemplate = (args) => ({
28
26
  components: { URow, UInput, UButton },
29
27
  setup() {
30
- return { args };
28
+ const slots = getSlotNames(URow.name);
29
+
30
+ return { args, slots };
31
31
  },
32
32
  template: `
33
33
  <URow v-bind="args" class="flex">
34
- ${args.slotTemplate || defaultSlotTemplate}
34
+ ${args.slotTemplate || getSlotsFragment(defaultTemplate)}
35
35
  </URow>
36
36
  `,
37
37
  });
38
38
 
39
- const GapTemplate = (args, { argTypes } = {}) => ({
40
- components: { UCol, URow, UInput },
41
- setup() {
42
- return {
43
- args,
44
- gaps: argTypes.gap.options,
45
- };
46
- },
47
- template: `
48
- <UCol gap="xl">
49
- <URow v-for="(gap, index) in gaps" :key="index" v-bind="args" :gap="gap" align="center">
50
- <UInput :label="gap" />
51
- <UInput :label="gap" />
52
- </URow>
53
- </UCol>
54
- `,
55
- });
56
-
57
- const AlignTemplate = (args, { argTypes } = {}) => ({
39
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
58
40
  components: { UCol, URow, UInput, UButton },
59
41
  setup() {
42
+ const isGapEnum = argTypes[args.enum].name === "gap";
43
+
60
44
  return {
61
45
  args,
62
- aligns: argTypes.align.options,
46
+ options: argTypes[args.enum].options,
47
+ isGapEnum,
63
48
  };
64
49
  },
65
50
  template: `
66
51
  <UCol gap="xl">
67
- <URow v-for="(align, index) in aligns" :key="index" v-bind="args" :align="align">
68
- <UButton :label="align" size="xs" block />
69
- <UInput label="Name" />
52
+ <URow
53
+ v-for="(option, index) in options"
54
+ v-bind="args"
55
+ :[args.enum]="option"
56
+ :key="index"
57
+ >
58
+ <template v-if="isGapEnum">
59
+ <UInput :label="option" />
60
+ <UInput :label="option" />
61
+ </template>
62
+ <template v-else>
63
+ <UButton :label="option" size="xs" block />
64
+ <UInput label="Name" />
65
+ </template>
70
66
  </URow>
71
67
  </UCol>
72
68
  `,
@@ -75,11 +71,11 @@ const AlignTemplate = (args, { argTypes } = {}) => ({
75
71
  export const Default = DefaultTemplate.bind({});
76
72
  Default.args = {};
77
73
 
78
- export const Gap = GapTemplate.bind({});
79
- Gap.args = {};
74
+ export const Gap = EnumVariantTemplate.bind({});
75
+ Gap.args = { enum: "gap" };
80
76
 
81
- export const Align = AlignTemplate.bind({});
82
- Align.args = {};
77
+ export const Align = EnumVariantTemplate.bind({});
78
+ Align.args = { enum: "align" };
83
79
 
84
80
  export const noMobile = DefaultTemplate.bind({});
85
81
  noMobile.args = {
@@ -619,7 +619,7 @@ const isVariant = computed(() => ({
619
619
 
620
620
  const clickOutsideOptions = computed(() => {
621
621
  if (isVariant.value.input) {
622
- return { ignore: [inputRef.value.input] };
622
+ return { ignore: [inputRef.value.inputRef] };
623
623
  }
624
624
 
625
625
  return {
@@ -234,7 +234,7 @@ const localLabel = computed(() => {
234
234
  });
235
235
 
236
236
  const input = computed(() => {
237
- return moneyInputRef.value.input;
237
+ return moneyInputRef.value.inputRef;
238
238
  });
239
239
 
240
240
  watch(
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.241",
4
+ "version": "0.0.243",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",