vueless 0.0.251 → 0.0.253

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.251",
3
+ "version": "0.0.253",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -10,12 +10,12 @@ export default /*tw*/ {
10
10
  `,
11
11
  variants: {
12
12
  size: {
13
- "2xs": "px-2 py-1 text-xs leading-tight gap-0.5",
14
- xs: "px-3 py-1.5 text-xs leading-tight gap-0.5",
15
- sm: "px-4 py-2 text-sm leading-tight gap-1",
16
- md: "px-5 py-3 text-sm leading-tight gap-1",
17
- lg: "px-6 py-3.5 text-base leading-tight gap-1.5",
18
- xl: "px-7 py-4 text-base leading-tight gap-1.5",
13
+ "2xs": "px-2 py-1 text-xs gap-0.5",
14
+ xs: "px-3 py-1.5 text-xs gap-1",
15
+ sm: "px-4 py-2 text-sm gap-1.5",
16
+ md: "px-5 py-3 text-sm gap-1.5",
17
+ lg: "px-6 py-3.5 text-base gap-1.5",
18
+ xl: "px-7 py-4 text-base gap-2",
19
19
  },
20
20
  variant: {
21
21
  primary: `
@@ -134,11 +134,11 @@ export default /*tw*/ {
134
134
  },
135
135
  { filled: true, variant: "thirdary", color: "white", class: "bg-gray-50" },
136
136
  { iconLeft: true, size: "2xs", class: "pl-1" },
137
- { iconLeft: true, size: "xs", class: "pl-1.5" },
138
- { iconLeft: true, size: "sm", class: "pl-2" },
137
+ { iconLeft: true, size: "xs", class: "pl-2" },
138
+ { iconLeft: true, size: "sm", class: "pl-3" },
139
139
  { iconLeft: true, size: "md", class: "pl-4" },
140
- { iconLeft: true, size: "lg", class: "pl-3.5" },
141
- { iconLeft: true, size: "xl", class: "pl-4" },
140
+ { iconLeft: true, size: "lg", class: "pl-5" },
141
+ { iconLeft: true, size: "xl", class: "pl-6" },
142
142
  { iconRight: true, size: "2xs", class: "pr-1" },
143
143
  { iconRight: true, size: "xs", class: "pr-2" },
144
144
  { iconRight: true, size: "sm", class: "pr-3" },
@@ -154,6 +154,8 @@ export default /*tw*/ {
154
154
  ],
155
155
  },
156
156
  text: "whitespace-nowrap focus-visible:outline-none",
157
+ iconLeft: "{UIcon}",
158
+ iconRight: "{UIcon}",
157
159
  defaultVariants: {
158
160
  color: "brand",
159
161
  variant: "primary",
@@ -33,6 +33,7 @@
33
33
  :size="iconSize"
34
34
  :color="componentColor"
35
35
  internal
36
+ v-bind="iconLeftAttrs"
36
37
  />
37
38
  </slot>
38
39
  </div>
@@ -71,6 +72,7 @@
71
72
  :size="iconSize"
72
73
  :color="componentColor"
73
74
  internal
75
+ v-bind="iconRightAttrs"
74
76
  />
75
77
  </slot>
76
78
  </div>
@@ -234,7 +236,8 @@ const props = defineProps({
234
236
  },
235
237
  });
236
238
 
237
- const { buttonAttrs, loaderAttrs, textAttrs, hasSlotContent } = useAttrs(props);
239
+ const { buttonAttrs, loaderAttrs, textAttrs, iconLeftAttrs, iconRightAttrs, hasSlotContent } =
240
+ useAttrs(props);
238
241
 
239
242
  const buttonRef = ref(null);
240
243
 
@@ -255,12 +258,12 @@ const loaderSize = computed(() => {
255
258
 
256
259
  const iconSize = computed(() => {
257
260
  const sizes = {
258
- "2xs": "3xs",
259
- xs: "2xs",
260
- sm: "xs",
261
+ "2xs": "xs",
262
+ xs: "xs",
263
+ sm: "sm",
261
264
  md: "sm",
262
265
  lg: "md",
263
- xl: "lg",
266
+ xl: "md",
264
267
  };
265
268
 
266
269
  return sizes[props.size];
@@ -3,6 +3,8 @@ export default /*tw*/ {
3
3
  inputWrapper: "flex relative w-full",
4
4
  rightIconSlot: "flex items-center justify-end whitespace-nowrap pr-2 gap-1 rounded-dynamic rounded-l-none",
5
5
  leftIconSlot: "flex items-center justify-end whitespace-nowrap pl-2 gap-1 rounded-dynamic rounded-r-none",
6
+ iconLeft: "{UIcon}",
7
+ iconRight: "{UIcon}",
6
8
  passwordIcon: "",
7
9
  passwordVisibleIconName: "visibility-fill",
8
10
  passwordHiddenIconName: "visibility_off-fill",
@@ -1,10 +1,9 @@
1
- import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UInput from "../ui.form-input";
4
4
  import UIcon from "../ui.image-icon";
5
5
  import UButton from "../ui.button";
6
6
  import UCol from "../ui.container-col";
7
- import URow from "../ui.container-row";
8
7
 
9
8
  /**
10
9
  * The `UInput` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.form-input)
@@ -23,7 +22,7 @@ export default {
23
22
  };
24
23
 
25
24
  const DefaultTemplate = (args) => ({
26
- components: { UInput },
25
+ components: { UInput, UIcon, UButton },
27
26
  setup() {
28
27
  const slots = getSlotNames(UInput.name);
29
28
 
@@ -31,81 +30,27 @@ const DefaultTemplate = (args) => ({
31
30
  },
32
31
  template: `
33
32
  <UInput v-bind="args" v-model="args.modelValue">
34
- ${allSlotsFragment}
35
- </UInput>
36
- `,
37
- });
38
-
39
- const SlotTemplate = (args) => ({
40
- components: { UInput, UIcon, UButton },
41
- setup() {
42
- return { args };
43
- },
44
- template: `
45
- <UInput v-bind="args">
46
- ${args.slotTemplate}
33
+ ${args.slotTemplate || getSlotsFragment()}
47
34
  </UInput>
48
35
  `,
49
36
  });
50
37
 
51
- const SizesTemplate = (args, { argTypes } = {}) => ({
52
- components: { UInput, URow },
53
- setup() {
54
- return {
55
- args,
56
- sizes: argTypes.size.options,
57
- };
58
- },
59
- template: `
60
- <URow>
61
- <UInput
62
- v-for="(size, index) in sizes"
63
- v-bind="args"
64
- :size="size"
65
- :key="index"
66
- />
67
- </URow>
68
- `,
69
- });
70
-
71
- const ValidationRuleTemplate = (args, { argTypes } = {}) => ({
72
- components: { UInput, URow },
73
- setup() {
74
- return {
75
- args,
76
- rules: argTypes.validationRule.options,
77
- };
78
- },
79
- template: `
80
- <URow>
81
- <UInput
82
- v-for="(rule, index) in rules"
83
- v-bind="args"
84
- :validationRule="rule"
85
- :key="index"
86
- :description="rule"
87
- />
88
- </URow>
89
- `,
90
- });
91
-
92
- const LabelPlacementTemplate = (args) => ({
38
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
93
39
  components: { UInput, UCol },
94
40
  setup() {
95
41
  return {
96
42
  args,
43
+ options: argTypes[args.enum].options,
97
44
  };
98
45
  },
99
46
  template: `
100
- <UCol gap="xl">
47
+ <UCol>
101
48
  <UInput
49
+ v-for="(option, index) in options"
102
50
  v-bind="args"
103
- label-align="top"
104
- />
105
-
106
- <UInput
107
- v-bind="args"
108
- label-align="topInside"
51
+ :[args.enum]="option"
52
+ :label="option"
53
+ :key="index"
109
54
  />
110
55
  </UCol>
111
56
  `,
@@ -135,14 +80,14 @@ noAutocomplete.args = { noAutocomplete: true };
135
80
  export const typePassword = DefaultTemplate.bind({});
136
81
  typePassword.args = { type: "password" };
137
82
 
138
- export const labelPlacement = LabelPlacementTemplate.bind({});
139
- labelPlacement.args = {};
83
+ export const labelPlacement = EnumVariantTemplate.bind({});
84
+ labelPlacement.args = { enum: "labelAlign" };
140
85
 
141
- export const sizes = SizesTemplate.bind({});
142
- sizes.args = {};
86
+ export const sizes = EnumVariantTemplate.bind({});
87
+ sizes.args = { enum: "size" };
143
88
 
144
- export const validationRules = ValidationRuleTemplate.bind({});
145
- validationRules.args = {};
89
+ export const validationRules = EnumVariantTemplate.bind({});
90
+ validationRules.args = { enum: "validationRule" };
146
91
 
147
92
  export const iconLeft = DefaultTemplate.bind({});
148
93
  iconLeft.args = {
@@ -154,7 +99,7 @@ iconRight.args = {
154
99
  iconRight: "star",
155
100
  };
156
101
 
157
- export const iconLeftSlot = SlotTemplate.bind({});
102
+ export const iconLeftSlot = DefaultTemplate.bind({});
158
103
  iconLeftSlot.args = {
159
104
  slotTemplate: `
160
105
  <template #icon-left>
@@ -166,7 +111,7 @@ iconLeftSlot.args = {
166
111
  `,
167
112
  };
168
113
 
169
- export const iconRightSlot = SlotTemplate.bind({});
114
+ export const iconRightSlot = DefaultTemplate.bind({});
170
115
  iconRightSlot.args = {
171
116
  slotTemplate: `
172
117
  <template #icon-right>
@@ -178,7 +123,7 @@ iconRightSlot.args = {
178
123
  `,
179
124
  };
180
125
 
181
- export const leftSlot = SlotTemplate.bind({});
126
+ export const leftSlot = DefaultTemplate.bind({});
182
127
  leftSlot.args = {
183
128
  slotTemplate: `
184
129
  <template #left>
@@ -187,7 +132,7 @@ leftSlot.args = {
187
132
  `,
188
133
  };
189
134
 
190
- export const rightSlot = SlotTemplate.bind({});
135
+ export const rightSlot = DefaultTemplate.bind({});
191
136
  rightSlot.args = {
192
137
  slotTemplate: `
193
138
  <template #right>
@@ -1,7 +1,7 @@
1
- import { getArgTypes, allSlotsFragment, getSlotNames } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UInputFile from "../ui.form-input-file";
4
- import URow from "../ui.container-row";
4
+ import UCol from "../ui.container-col";
5
5
 
6
6
  /**
7
7
  * The `UInputFile` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.form-input-file)
@@ -37,71 +37,29 @@ const DefaultTemplate = (args) => ({
37
37
  v-model="files"
38
38
  v-model:error="error"
39
39
  >
40
- ${allSlotsFragment}
40
+ ${args.slotTemplate || getSlotsFragment()}
41
41
  </UInputFile>
42
42
  `,
43
43
  });
44
44
 
45
- const SlotTemplate = (args) => ({
46
- components: { UInputFile },
47
- setup() {
48
- return { args };
49
- },
50
- data() {
51
- return {
52
- files: [],
53
- error: args.error || "",
54
- };
55
- },
56
- template: `
57
- <UInputFile
58
- v-bind="args"
59
- v-model="files"
60
- v-model:error="error"
61
- >
62
- ${args.slotTemplate}
63
- </UInputFile>
64
- `,
65
- });
66
-
67
- const LabelAlignTemplate = (args, { argTypes } = {}) => ({
68
- components: { UInputFile, URow },
69
- setup() {
70
- return {
71
- args,
72
- alignOptions: argTypes.labelAlign.options,
73
- };
74
- },
75
- template: `
76
- <URow class="!flex-col" gap="xl">
77
- <div v-for="(align, index) in alignOptions" :key="index">
78
- <UInputFile
79
- :label-align="align"
80
- v-bind="args"
81
- :label="align"
82
- />
83
- </div>
84
- </URow>
85
- `,
86
- });
87
-
88
- const SizesTemplate = (args, { argTypes } = {}) => ({
89
- components: { UInputFile, URow },
45
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
46
+ components: { UInputFile, UCol },
90
47
  setup() {
91
48
  return {
92
49
  args,
93
- sizes: argTypes.size.options,
50
+ options: argTypes[args.enum].options,
94
51
  };
95
52
  },
96
53
  template: `
97
- <URow>
98
- <div v-for="(size, index) in sizes" :key="index">
54
+ <UCol gap="xl">
55
+ <div v-for="(option, index) in options" :key="index">
99
56
  <UInputFile
100
- :size="size"
57
+ :[args.enum]="option"
101
58
  v-bind="args"
59
+ :label="option"
102
60
  />
103
61
  </div>
104
- </URow>
62
+ </UCol>
105
63
  `,
106
64
  });
107
65
 
@@ -117,17 +75,17 @@ allowedFileTypes.args = { allowedFileTypes: ["png", "jpeg"], label: "Allow only
117
75
  export const error = DefaultTemplate.bind({});
118
76
  error.args = { error: "some error" };
119
77
 
120
- export const sizes = SizesTemplate.bind({});
121
- sizes.args = {};
78
+ export const sizes = EnumVariantTemplate.bind({});
79
+ sizes.args = { enum: "size" };
122
80
 
123
- export const labelAlign = LabelAlignTemplate.bind({});
124
- labelAlign.args = {};
81
+ export const labelAlign = EnumVariantTemplate.bind({});
82
+ labelAlign.args = { enum: "labelAlign" };
125
83
 
126
- export const slotLeft = SlotTemplate.bind({});
84
+ export const slotLeft = DefaultTemplate.bind({});
127
85
  slotLeft.args = {
128
86
  slotTemplate: `
129
87
  <template #left>
130
- 🥸
88
+ 🤘
131
89
  </template>
132
90
  `,
133
91
  };
@@ -1,8 +1,7 @@
1
- import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UInputMoney from "../ui.form-input-money";
4
- import URow from "../ui.container-row";
5
- // import UCol from "../ui.container-col";
4
+ import UCol from "../ui.container-col";
6
5
 
7
6
  /**
8
7
  * The `UInputMoney` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.form-input-money)
@@ -32,67 +31,43 @@ const DefaultTemplate = (args) => ({
32
31
  v-bind="args"
33
32
  v-model="args.inputValue"
34
33
  >
35
- ${allSlotsFragment}
34
+ ${args.slotTemplate || getSlotsFragment()}
36
35
  </UInputMoney>
37
36
  `,
38
37
  });
39
38
 
40
- const SizesTemplate = (args, { argTypes } = {}) => ({
41
- components: { UInputMoney, URow },
39
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
40
+ components: { UInputMoney, UCol },
42
41
  setup() {
43
42
  return {
44
43
  args,
45
- sizes: argTypes.size.options,
44
+ options: argTypes[args.enum].options,
46
45
  };
47
46
  },
48
47
  template: `
49
- <URow>
48
+ <UCol>
50
49
  <UInputMoney
51
- v-for="(size, index) in sizes"
50
+ v-for="(option, index) in options"
52
51
  v-bind="args"
53
- :size="size"
52
+ :[args.enum]="option"
53
+ :label="option"
54
54
  :key="index"
55
55
  />
56
- </URow>
56
+ </UCol>
57
57
  `,
58
58
  });
59
59
 
60
- // TODO: Rewrite to labelAlign
61
- // const LabelPlacementTemplate = (args) => ({
62
- // components: { UInputMoney, UCol },
63
- // setup() {
64
- // return {
65
- // args,
66
- // };
67
- // },
68
- // template: `
69
- // <UCol gap="xl">
70
- // <UInputMoney
71
- // v-bind="args"
72
- // :label-outside="true"
73
- // label="top"
74
- // />
75
- //
76
- // <UInputMoney
77
- // v-bind="args"
78
- // :label-outside="false"
79
- // label="topInside"
80
- // />
81
- // </UCol>
82
- // `,
83
- // });
84
-
85
60
  export const Default = DefaultTemplate.bind({});
86
61
  Default.args = {};
87
62
 
88
- export const sizes = SizesTemplate.bind({});
89
- sizes.args = {};
63
+ export const sizes = EnumVariantTemplate.bind({});
64
+ sizes.args = { enum: "size" };
90
65
 
91
66
  export const symbol = DefaultTemplate.bind({});
92
67
  symbol.args = { symbol: "€" };
93
68
 
94
- // export const labelOutside = LabelPlacementTemplate.bind({});
95
- // labelOutside.args = {};
69
+ export const labelAlign = EnumVariantTemplate.bind({});
70
+ labelAlign.args = { enum: "labelAlign" };
96
71
 
97
72
  export const placeholder = DefaultTemplate.bind({});
98
73
  placeholder.args = { placeholder: "Placeholder" };
@@ -1,4 +1,4 @@
1
- import { getArgTypes } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UInputNumber from "../ui.form-input-number";
4
4
  import UCol from "../ui.container-col";
@@ -19,7 +19,9 @@ export default {
19
19
  const DefaultTemplate = (args) => ({
20
20
  components: { UInputNumber },
21
21
  setup() {
22
- return { args };
22
+ const slots = getSlotNames(UInputNumber.name);
23
+
24
+ return { args, slots };
23
25
  },
24
26
  data() {
25
27
  return {
@@ -27,16 +29,18 @@ const DefaultTemplate = (args) => ({
27
29
  };
28
30
  },
29
31
  template: `
30
- <UInputNumber v-model="count" v-bind="args" />
32
+ <UInputNumber v-model="count" v-bind="args">
33
+ ${args.slotTemplate || getSlotsFragment()}
34
+ </UInputNumber>
31
35
  `,
32
36
  });
33
37
 
34
- const SizesTemplate = (args, { argTypes } = {}) => ({
38
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
35
39
  components: { UInputNumber, UCol },
36
40
  setup() {
37
41
  return {
38
42
  args,
39
- sizes: argTypes.size.options,
43
+ options: argTypes[args.enum].options,
40
44
  };
41
45
  },
42
46
  data() {
@@ -51,9 +55,9 @@ const SizesTemplate = (args, { argTypes } = {}) => ({
51
55
  template: `
52
56
  <UCol gap="xl">
53
57
  <UInputNumber
54
- v-for="(size, index) in sizes"
58
+ v-for="(option, index) in options"
55
59
  v-bind="args"
56
- :size="size"
60
+ :[args.enum]="option"
57
61
  :key="index"
58
62
  :label="sizeValues[index].label"
59
63
  v-model="sizeValues[index].count"
@@ -79,8 +83,9 @@ label.args = {
79
83
  label: "Year",
80
84
  };
81
85
 
82
- export const sizes = SizesTemplate.bind({});
86
+ export const sizes = EnumVariantTemplate.bind({});
83
87
  sizes.args = {
88
+ enum: "size",
84
89
  value: 1,
85
90
  step: 1,
86
91
  min: 1,
@@ -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 UInputRating from "../ui.form-input-rating";
4
4
  import URow from "../ui.container-row";
@@ -31,42 +31,27 @@ const DefaultTemplate = (args) => ({
31
31
  v-bind="args"
32
32
  v-model="args.modelValue"
33
33
  >
34
- ${allSlotsFragment}
34
+ ${args.slotTemplate || getSlotsFragment()}
35
35
  </UInputRating>
36
36
  `,
37
37
  });
38
38
 
39
- const SlotTemplate = (args) => ({
40
- components: { UInputRating },
41
- setup() {
42
- return { args };
43
- },
44
- template: `
45
- <UInputRating
46
- v-bind="args"
47
- v-model="args.modelValue"
48
- >
49
- ${args.slotTemplate}
50
- </UInputRating>
51
- `,
52
- });
53
-
54
- const SizesTemplate = (args, { argTypes } = {}) => ({
39
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
55
40
  components: { UInputRating, URow },
56
41
  setup() {
57
42
  return {
58
43
  args,
59
- sizes: argTypes.size.options,
44
+ options: argTypes[args.enum].options,
60
45
  };
61
46
  },
62
47
  template: `
63
48
  <URow gap="2xl">
64
49
  <UInputRating
65
- v-for="(size, index) in sizes"
50
+ v-for="(option, index) in options"
66
51
  :key="index"
67
52
  v-bind="args"
68
53
  v-model="args.modelValue"
69
- :size="size"
54
+ :[args.enum]="option"
70
55
  />
71
56
  </URow>
72
57
  `,
@@ -75,8 +60,8 @@ const SizesTemplate = (args, { argTypes } = {}) => ({
75
60
  export const Default = DefaultTemplate.bind({});
76
61
  Default.args = {};
77
62
 
78
- export const sizes = SizesTemplate.bind({});
79
- sizes.args = {};
63
+ export const sizes = EnumVariantTemplate.bind({});
64
+ sizes.args = { enum: "size" };
80
65
 
81
66
  export const starAmount = DefaultTemplate.bind({});
82
67
  starAmount.args = { value: 4, stars: 7 };
@@ -96,7 +81,7 @@ withCounter.args = { counter: true };
96
81
  export const withTotal = DefaultTemplate.bind({});
97
82
  withTotal.args = { total: 250 };
98
83
 
99
- export const slotCounter = SlotTemplate.bind({});
84
+ export const slotCounter = DefaultTemplate.bind({});
100
85
  slotCounter.args = {
101
86
  slotTemplate: `
102
87
  <template #counter="{counter}">
@@ -105,7 +90,7 @@ slotCounter.args = {
105
90
  `,
106
91
  };
107
92
 
108
- export const slotTotal = SlotTemplate.bind({});
93
+ export const slotTotal = DefaultTemplate.bind({});
109
94
  slotTotal.args = {
110
95
  total: 250,
111
96
  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 UInputSearch from "../ui.form-input-search";
4
4
  import UButton from "../ui.button";
@@ -17,51 +17,34 @@ export default {
17
17
  };
18
18
 
19
19
  const DefaultTemplate = (args) => ({
20
- components: { UInputSearch },
20
+ components: { UInputSearch, UButton },
21
21
  setup() {
22
22
  const slots = getSlotNames(UInputSearch.name);
23
23
 
24
- return {
25
- args,
26
- slots,
27
- };
28
- },
29
- template: `
30
- <UInputSearch v-bind="args" v-model="args.modelValue">
31
- ${allSlotsFragment}
32
- </UInputSearch>
33
- `,
34
- });
35
-
36
- const SlotTemplate = (args) => ({
37
- components: { UInputSearch, UButton },
38
- setup() {
39
- return {
40
- args,
41
- };
24
+ return { args, slots };
42
25
  },
43
26
  template: `
44
27
  <UInputSearch v-bind="args" v-model="args.modelValue">
45
- ${args.slotTemplate || ""}
28
+ ${args.slotTemplate || getSlotsFragment()}
46
29
  </UInputSearch>
47
30
  `,
48
31
  });
49
32
 
50
- const SizesTemplate = (args, { argTypes } = {}) => ({
33
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
51
34
  components: { UInputSearch, URow },
52
35
  setup() {
53
36
  return {
54
37
  args,
55
- sizes: argTypes.size.options,
38
+ options: argTypes[args.enum].options,
56
39
  };
57
40
  },
58
41
  template: `
59
42
  <URow>
60
43
  <UInputSearch
61
- v-for="(size, index) in sizes"
44
+ v-for="(option, index) in options"
62
45
  v-bind="args"
63
46
  v-model="args.modelValue"
64
- :size="size"
47
+ :[args.enum]="option"
65
48
  :key="index"
66
49
  >
67
50
  </UInputSearch>
@@ -75,15 +58,15 @@ Default.args = {};
75
58
  export const searchButton = DefaultTemplate.bind({});
76
59
  searchButton.args = { searchButtonLabel: "Search" };
77
60
 
78
- export const sizes = SizesTemplate.bind({});
79
- sizes.args = {};
61
+ export const sizes = EnumVariantTemplate.bind({});
62
+ sizes.args = { enum: "size" };
80
63
 
81
- export const slotLeft = SlotTemplate.bind({});
64
+ export const slotLeft = DefaultTemplate.bind({});
82
65
  slotLeft.args = {
83
66
  slotTemplate: `
84
67
  <template #left>
85
68
  <UButton
86
- label="filter"
69
+ label="Filter"
87
70
  variant="thirdary"
88
71
  filled
89
72
  no-ring
@@ -64,8 +64,10 @@ export default /*tw*/ {
64
64
  { size: "lg", multiple: true, class: "text-base" },
65
65
  ],
66
66
  },
67
- leftIcon: "pr-3 flex items-center",
68
- rightIcon: "pl-3 flex items-center",
67
+ leftIconWrapper: "pr-3 flex items-center",
68
+ rightIconWrapper: "pl-3 flex items-center",
69
+ iconLeft: "{UIcon}",
70
+ iconRight: "{UIcon}",
69
71
  beforeCaret: "",
70
72
  afterCaret: "mr-3",
71
73
  caret: {
@@ -78,7 +78,7 @@
78
78
  <span
79
79
  v-if="hasSlotContent($slots['icon-left']) || iconLeft"
80
80
  ref="leftSlotWrapperRef"
81
- v-bind="leftIconAttrs"
81
+ v-bind="leftIconWrapperAttrs"
82
82
  >
83
83
  <!--
84
84
  @slot Use it to add icon before option.
@@ -86,7 +86,13 @@
86
86
  @binding {string} icon-size
87
87
  -->
88
88
  <slot name="icon-left" :icon-name="iconLeft" :icon-size="iconSize">
89
- <UIcon v-if="iconLeft" :name="iconLeft" :size="iconSize" internal />
89
+ <UIcon
90
+ v-if="iconLeft"
91
+ :name="iconLeft"
92
+ :size="iconSize"
93
+ internal
94
+ v-bind="iconLeftAttrs"
95
+ />
90
96
  </slot>
91
97
  </span>
92
98
 
@@ -190,14 +196,23 @@
190
196
  <!-- @slot Use it to add something after input. -->
191
197
  <slot name="right" />
192
198
 
193
- <span v-if="hasSlotContent($slots['icon-right']) || iconRight" v-bind="rightIconAttrs">
199
+ <span
200
+ v-if="hasSlotContent($slots['icon-right']) || iconRight"
201
+ v-bind="rightIconWrapperAttrs"
202
+ >
194
203
  <!--
195
204
  @slot Use it to add icon after option.
196
205
  @binding {string} icon-name
197
206
  @binding {string} icon-size
198
207
  -->
199
208
  <slot name="icon-right" :icon-name="iconRight" :icon-size="iconSize">
200
- <UIcon v-if="iconRight" :name="iconRight" :size="iconSize" internal />
209
+ <UIcon
210
+ v-if="iconRight"
211
+ :name="iconRight"
212
+ :size="iconSize"
213
+ internal
214
+ v-bind="iconRightAttrs"
215
+ />
201
216
  </slot>
202
217
  </span>
203
218
  </div>
@@ -565,8 +580,10 @@ const {
565
580
  labelAttrs,
566
581
  wrapperAttrs,
567
582
  innerWrapperAttrs,
568
- leftIconAttrs,
569
- rightIconAttrs,
583
+ leftIconWrapperAttrs,
584
+ rightIconWrapperAttrs,
585
+ iconLeftAttrs,
586
+ iconRightAttrs,
570
587
  beforeCaretAttrs,
571
588
  afterCaretAttrs,
572
589
  toggleAttrs,
@@ -1,8 +1,7 @@
1
- import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
1
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
2
2
 
3
3
  import UTextarea from "../ui.form-textarea";
4
4
  import UIcon from "../ui.image-icon";
5
- import URow from "../ui.container-row";
6
5
  import UCol from "../ui.container-col";
7
6
 
8
7
  /**
@@ -22,7 +21,7 @@ export default {
22
21
  };
23
22
 
24
23
  const DefaultTemplate = (args) => ({
25
- components: { UTextarea },
24
+ components: { UTextarea, UIcon },
26
25
  setup() {
27
26
  const slots = getSlotNames(UTextarea.name);
28
27
 
@@ -32,65 +31,28 @@ const DefaultTemplate = (args) => ({
32
31
  <UTextarea
33
32
  v-bind="args"
34
33
  >
35
- ${allSlotsFragment}
34
+ ${args.slotTemplate || getSlotsFragment()}
36
35
  </UTextarea>
37
36
  `,
38
37
  });
39
38
 
40
- const SlotTemplate = (args) => ({
41
- components: { UTextarea, UIcon },
42
- setup() {
43
- return { args };
44
- },
45
- template: `
46
- <UTextarea
47
- v-bind="args"
48
- >
49
- ${args.slotTemplate}
50
- </UTextarea>
51
- `,
52
- });
53
-
54
- const SizesTemplate = (args, { argTypes } = {}) => ({
55
- components: { UTextarea, URow },
39
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
40
+ components: { UTextarea, UCol },
56
41
  setup() {
57
42
  return {
58
43
  args,
59
- sizes: argTypes.size.options,
44
+ options: argTypes[args.enum].options,
60
45
  };
61
46
  },
62
47
  template: `
63
- <URow>
64
- <div class="w-1/3" v-for="(size, index) in sizes" :key="index">
48
+ <UCol>
49
+ <div class="w-1/3" v-for="(option, index) in options" :key="index">
65
50
  <UTextarea
66
51
  v-bind="args"
67
- :size="size"
52
+ :[args.enum]="option"
53
+ :label="option"
68
54
  />
69
55
  </div>
70
- </URow>
71
- `,
72
- });
73
-
74
- const LabelPlacementTemplate = (args) => ({
75
- components: { UTextarea, UCol },
76
- setup() {
77
- return {
78
- args,
79
- };
80
- },
81
- template: `
82
- <UCol gap="xl">
83
- <UTextarea
84
- v-bind="args"
85
- label-align="top"
86
- label="top"
87
- />
88
-
89
- <UTextarea
90
- v-bind="args"
91
- label-align="topInside"
92
- label="topInside"
93
- />
94
56
  </UCol>
95
57
  `,
96
58
  });
@@ -98,8 +60,8 @@ const LabelPlacementTemplate = (args) => ({
98
60
  export const Default = DefaultTemplate.bind({});
99
61
  Default.args = {};
100
62
 
101
- export const labelPlacement = LabelPlacementTemplate.bind({});
102
- labelPlacement.args = {};
63
+ export const labelPlacement = EnumVariantTemplate.bind({});
64
+ labelPlacement.args = { enum: "labelAlign" };
103
65
 
104
66
  export const placeholder = DefaultTemplate.bind({});
105
67
  placeholder.args = { placeholder: "some placeholder text" };
@@ -122,10 +84,10 @@ readonly.args = { readonly: true, value: "some value for read" };
122
84
  export const noAutocomplete = DefaultTemplate.bind({});
123
85
  noAutocomplete.args = { noAutocomplete: true };
124
86
 
125
- export const sizes = SizesTemplate.bind({});
126
- sizes.args = {};
87
+ export const sizes = EnumVariantTemplate.bind({});
88
+ sizes.args = { enum: "size" };
127
89
 
128
- export const slotLeft = SlotTemplate.bind({});
90
+ export const slotLeft = DefaultTemplate.bind({});
129
91
  slotLeft.args = {
130
92
  slotTemplate: `
131
93
  <template #left>
@@ -137,7 +99,7 @@ slotLeft.args = {
137
99
  `,
138
100
  };
139
101
 
140
- export const slotRight = SlotTemplate.bind({});
102
+ export const slotRight = DefaultTemplate.bind({});
141
103
  slotRight.args = {
142
104
  slotTemplate: `
143
105
  <template #right>
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.251",
4
+ "version": "0.0.253",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",