vueless 0.0.253 → 0.0.255

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/package.json +1 -1
  2. package/ui.button/index.stories.js +1 -1
  3. package/ui.button-link/index.stories.js +1 -1
  4. package/ui.button-toggle/index.stories.js +2 -2
  5. package/ui.button-toggle-item/index.stories.js +6 -2
  6. package/ui.container-card/index.stories.js +1 -1
  7. package/ui.dropdown-button/index.stories.js +3 -6
  8. package/ui.form-calendar/index.stories.js +4 -4
  9. package/ui.form-checkbox/index.stories.js +13 -26
  10. package/ui.form-checkbox-group/index.stories.js +28 -74
  11. package/ui.form-checkbox-multi-state/index.stories.js +17 -13
  12. package/ui.form-color-picker/index.stories.js +17 -13
  13. package/ui.form-date-picker/configs/default.config.js +1 -0
  14. package/ui.form-date-picker/index.stories.js +37 -51
  15. package/ui.form-date-picker-range/index.stories.js +23 -32
  16. package/ui.form-input/index.stories.js +1 -1
  17. package/ui.form-input-file/index.stories.js +1 -1
  18. package/ui.form-input-money/index.stories.js +1 -1
  19. package/ui.form-input-number/index.stories.js +3 -3
  20. package/ui.form-input-search/index.stories.js +1 -1
  21. package/ui.form-label/index.stories.js +28 -51
  22. package/ui.form-radio/index.stories.js +5 -17
  23. package/ui.form-radio-group/index.stories.js +45 -96
  24. package/ui.form-select/index.stories.js +62 -159
  25. package/ui.form-switch/index.stories.js +17 -33
  26. package/ui.form-textarea/index.stories.js +1 -3
  27. package/ui.image-icon/index.stories.js +1 -1
  28. package/ui.navigation-progress/index.stories.js +1 -1
  29. package/ui.navigation-tabs/index.stories.js +3 -3
  30. package/ui.text-badge/index.stories.js +2 -2
  31. package/ui.text-block/index.stories.js +2 -2
  32. package/ui.text-empty/index.stories.js +1 -1
  33. package/web-types.json +1 -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 UDatePicker from "../ui.form-date-picker";
4
4
  import UIcon from "../ui.image-icon";
@@ -13,6 +13,7 @@ export default {
13
13
  component: UDatePicker,
14
14
  args: {
15
15
  label: "Label",
16
+ modelValue: null,
16
17
  },
17
18
  argTypes: {
18
19
  ...getArgTypes(UDatePicker.name),
@@ -27,46 +28,40 @@ export default {
27
28
  };
28
29
 
29
30
  const DefaultTemplate = (args) => ({
30
- components: { UDatePicker },
31
+ components: { UDatePicker, UIcon },
31
32
  setup() {
32
33
  const slots = getSlotNames(UDatePicker.name);
33
34
 
34
35
  return { args, slots };
35
36
  },
36
- data() {
37
- return {
38
- value: this.args.value,
39
- };
40
- },
41
37
  template: `
42
- <UDatePicker v-bind="args" v-model="value">
43
- ${allSlotsFragment}
38
+ <UDatePicker v-bind="args" v-model="args.modelValue">
39
+ ${args.slotTemplate || getSlotsFragment()}
44
40
  </UDatePicker>
45
41
 
46
42
  <div class="mt-4">
47
- {{ value }}
43
+ {{ args.modelValue }}
48
44
  </div>
49
45
  `,
50
46
  });
51
47
 
52
- const SizesTemplate = (args, { argTypes } = {}) => ({
48
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
53
49
  components: { UDatePicker, URow },
54
50
  setup() {
55
51
  return {
56
52
  args,
57
- sizes: argTypes.size.options,
53
+ options: argTypes[args.enum].options,
58
54
  };
59
55
  },
60
56
  template: `
61
57
  <URow>
62
58
  <UDatePicker
63
- v-for="(size, index) in sizes"
64
- :size="size"
65
- :label="size"
66
- v-bind="args"
59
+ v-for="(option, index) in options"
67
60
  :key="index"
68
- >
69
- </UDatePicker>
61
+ v-bind="args"
62
+ :[args.enum]="option"
63
+ :label="option"
64
+ />
70
65
  </URow>
71
66
  `,
72
67
  });
@@ -83,50 +78,44 @@ const OpenDirectionTemplate = (args) => ({
83
78
  <UDatePicker
84
79
  class="w-full"
85
80
  open-direction-y="top"
81
+ open-direction-x="left"
86
82
  v-bind="args"
87
- v-model="args.value"
83
+ v-model="args.modelValue"
84
+ label="Top Left"
88
85
  />
89
86
  <UDatePicker
90
87
  class="w-full"
91
- open-direction-y="bottom"
88
+ open-direction-y="top"
92
89
  open-direction-x="right"
93
90
  v-bind="args"
94
- v-model="args.value"
91
+ v-model="args.modelValue"
92
+ label="Top Right"
95
93
  />
96
94
  <UDatePicker
97
95
  class="w-full"
98
96
  open-direction-y="bottom"
97
+ open-direction-x="left"
99
98
  v-bind="args"
100
- v-model="args.value"
99
+ v-model="args.modelValue"
100
+ label="Bottom Left"
101
101
  />
102
102
  <UDatePicker
103
103
  class="w-full"
104
104
  open-direction-y="bottom"
105
- open-direction-x="left"
105
+ open-direction-x="right"
106
106
  v-bind="args"
107
- v-model="args.value"
107
+ v-model="args.modelValue"
108
+ label="Bottom Right"
108
109
  />
109
110
  </URow>
110
111
  `,
111
112
  });
112
113
 
113
- const SlotTemplate = (args) => ({
114
- components: { UDatePicker, UIcon },
115
- setup() {
116
- return { args };
117
- },
118
- template: `
119
- <UDatePicker v-bind="args">
120
- ${args.slotTemplate}
121
- </UDatePicker>
122
- `,
123
- });
124
-
125
114
  export const Default = DefaultTemplate.bind({});
126
- Default.args = { value: new Date() };
115
+ Default.args = { modelValue: new Date() };
127
116
 
128
- export const sizes = SizesTemplate.bind({});
129
- sizes.args = { label: "" };
117
+ export const sizes = EnumVariantTemplate.bind({});
118
+ sizes.args = { enum: "size", label: "" };
130
119
 
131
120
  export const openDirection = OpenDirectionTemplate.bind({});
132
121
  openDirection.args = {};
@@ -144,44 +133,41 @@ export const placeholder = DefaultTemplate.bind({});
144
133
  placeholder.args = { placeholder: "some placeholder" };
145
134
 
146
135
  export const DateFormat = DefaultTemplate.bind({});
147
- DateFormat.args = { dateFormat: "d.m.Y", userFormat: "d.m.Y", value: "28.06.2024" };
136
+ DateFormat.args = { dateFormat: "d.m.Y", userFormat: "d.m.Y", modelValue: "28.06.2024" };
148
137
 
149
138
  export const Timepicker = DefaultTemplate.bind({});
150
- Timepicker.args = { timepicker: true, value: new Date(2024, 2, 14, 12, 24, 14) };
139
+ Timepicker.args = { timepicker: true, modelValue: new Date(2024, 2, 14, 12, 24, 14) };
151
140
 
152
141
  export const MinMax = DefaultTemplate.bind({});
153
142
  MinMax.args = {
154
143
  minDate: new Date(2022, 2, 22),
155
144
  maxDate: new Date(2022, 2, 26),
156
- value: new Date(2022, 2, 24),
145
+ modelValue: new Date(2022, 2, 24),
157
146
  };
158
147
 
159
- export const slotIcon = SlotTemplate.bind({});
148
+ export const slotIcon = DefaultTemplate.bind({});
160
149
  slotIcon.args = {
161
150
  slotTemplate: `
162
151
  <template #right-icon>
163
- <UIcon
164
- name="star"
165
- color="black"
166
- />
152
+ <UIcon name="star" color="black" />
167
153
  </template>
168
154
  `,
169
155
  };
170
156
 
171
- export const slotRight = SlotTemplate.bind({});
157
+ export const slotRight = DefaultTemplate.bind({});
172
158
  slotRight.args = {
173
159
  slotTemplate: `
174
160
  <template #right>
175
- 🤘🤘🤘
161
+ 🤘🤘🤘
176
162
  </template>
177
163
  `,
178
164
  };
179
165
 
180
- export const slotLeft = SlotTemplate.bind({});
166
+ export const slotLeft = DefaultTemplate.bind({});
181
167
  slotRight.args = {
182
168
  slotTemplate: `
183
169
  <template #left>
184
- 🤘🤘🤘
170
+ 🤘🤘🤘
185
171
  </template>
186
172
  `,
187
173
  };
@@ -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 UDatePickerRange from "../ui.form-date-picker-range";
4
4
  import URow from "../ui.container-row";
@@ -44,7 +44,7 @@ const DefaultTemplate = (args) => ({
44
44
  },
45
45
  template: `
46
46
  <UDatePickerRange v-bind="args" v-model="value">
47
- ${allSlotsFragment}
47
+ ${args.slotTemplate || getSlotsFragment()}
48
48
  </UDatePickerRange>
49
49
 
50
50
  <div class="mt-4">
@@ -53,74 +53,65 @@ const DefaultTemplate = (args) => ({
53
53
  `,
54
54
  });
55
55
 
56
- const SlotTemplate = (args) => ({
57
- components: { UDatePickerRange },
58
- setup() {
59
- return { args };
60
- },
61
- template: `
62
- <UDatePickerRange v-bind="args" v-model="args.value">
63
- ${args.slotTemplate}
64
- </UDatePickerRange>
65
- `,
66
- });
67
-
68
- const VariantsTemplate = (args, { argTypes } = {}) => ({
56
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
69
57
  components: { UDatePickerRange, URow },
70
58
  setup() {
71
59
  return {
72
60
  args,
73
- variants: argTypes.variant.options,
61
+ options: argTypes[args.enum].options,
74
62
  };
75
63
  },
76
64
  template: `
77
65
  <URow>
78
66
  <UDatePickerRange
79
- v-for="(variant, index) in variants"
80
- :variant="variant"
67
+ v-for="(option, index) in options"
68
+ :key="index"
81
69
  v-bind="args"
82
70
  v-model="args.value"
83
- :key="index"
71
+ :[args.enum]="option"
84
72
  />
85
73
  </URow>
86
74
  `,
87
75
  });
88
76
 
89
- const OpenDirectionTemplate = (args, { argTypes } = {}) => ({
77
+ const OpenDirectionTemplate = (args) => ({
90
78
  components: { UDatePickerRange, URow },
91
79
  setup() {
92
- return {
93
- args,
94
- directions: argTypes.openDirection.options,
95
- };
80
+ return { args };
96
81
  },
97
82
  template: `
98
83
  <URow class="!flex-col">
99
84
  <UDatePickerRange
100
85
  class="w-full"
101
86
  open-direction-y="top"
87
+ open-direction-x="left"
102
88
  v-bind="args"
103
89
  v-model="args.value"
90
+ label="Top Left"
104
91
  />
105
92
  <UDatePickerRange
106
93
  class="w-full"
107
- open-direction-y="bottom"
94
+ open-direction-y="top"
108
95
  open-direction-x="right"
109
96
  v-bind="args"
110
97
  v-model="args.value"
98
+ label="Top Right"
111
99
  />
112
100
  <UDatePickerRange
113
101
  class="w-full"
114
102
  open-direction-y="bottom"
103
+ open-direction-x="left"
115
104
  v-bind="args"
116
105
  v-model="args.value"
106
+ label="Bottom Left"
117
107
  />
118
108
  <UDatePickerRange
119
109
  class="w-full"
120
110
  open-direction-y="bottom"
121
- open-direction-x="left"
111
+ open-direction-x="right"
122
112
  v-bind="args"
123
113
  v-model="args.value"
114
+ label="Bottom Right"
124
115
  />
125
116
  </URow>
126
117
  `,
@@ -129,14 +120,14 @@ const OpenDirectionTemplate = (args, { argTypes } = {}) => ({
129
120
  export const Default = DefaultTemplate.bind({});
130
121
  Default.args = {};
131
122
 
132
- export const variants = VariantsTemplate.bind({});
133
- variants.args = {};
123
+ export const variants = EnumVariantTemplate.bind({});
124
+ variants.args = { enum: "variant" };
134
125
 
135
126
  export const openDirection = OpenDirectionTemplate.bind({});
136
127
  openDirection.args = {};
137
128
 
138
- export const disabled = VariantsTemplate.bind({});
139
- disabled.args = { disabled: true };
129
+ export const disabled = EnumVariantTemplate.bind({});
130
+ disabled.args = { enum: "variant", disabled: true };
140
131
 
141
132
  export const label = DefaultTemplate.bind({});
142
133
  label.args = { variant: "input", label: "some label" };
@@ -174,7 +165,7 @@ customRangeButton.args = {
174
165
  value: { from: null, to: null },
175
166
  };
176
167
 
177
- export const slotLeft = SlotTemplate.bind({});
168
+ export const slotLeft = DefaultTemplate.bind({});
178
169
  slotLeft.args = {
179
170
  variant: "input",
180
171
  slotTemplate: `
@@ -184,7 +175,7 @@ slotLeft.args = {
184
175
  `,
185
176
  };
186
177
 
187
- export const slotRight = SlotTemplate.bind({});
178
+ export const slotRight = DefaultTemplate.bind({});
188
179
  slotRight.args = {
189
180
  variant: "input",
190
181
  slotTemplate: `
@@ -47,10 +47,10 @@ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
47
47
  <UCol>
48
48
  <UInput
49
49
  v-for="(option, index) in options"
50
+ :key="index"
50
51
  v-bind="args"
51
52
  :[args.enum]="option"
52
53
  :label="option"
53
- :key="index"
54
54
  />
55
55
  </UCol>
56
56
  `,
@@ -54,8 +54,8 @@ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
54
54
  <UCol gap="xl">
55
55
  <div v-for="(option, index) in options" :key="index">
56
56
  <UInputFile
57
- :[args.enum]="option"
58
57
  v-bind="args"
58
+ :[args.enum]="option"
59
59
  :label="option"
60
60
  />
61
61
  </div>
@@ -48,10 +48,10 @@ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
48
48
  <UCol>
49
49
  <UInputMoney
50
50
  v-for="(option, index) in options"
51
+ :key="index"
51
52
  v-bind="args"
52
53
  :[args.enum]="option"
53
54
  :label="option"
54
- :key="index"
55
55
  />
56
56
  </UCol>
57
57
  `,
@@ -29,7 +29,7 @@ const DefaultTemplate = (args) => ({
29
29
  };
30
30
  },
31
31
  template: `
32
- <UInputNumber v-model="count" v-bind="args">
32
+ <UInputNumber v-bind="args" v-model="count">
33
33
  ${args.slotTemplate || getSlotsFragment()}
34
34
  </UInputNumber>
35
35
  `,
@@ -56,11 +56,11 @@ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
56
56
  <UCol gap="xl">
57
57
  <UInputNumber
58
58
  v-for="(option, index) in options"
59
+ :key="index"
59
60
  v-bind="args"
61
+ v-model="sizeValues[index].count"
60
62
  :[args.enum]="option"
61
- :key="index"
62
63
  :label="sizeValues[index].label"
63
- v-model="sizeValues[index].count"
64
64
  />
65
65
  </UCol>
66
66
  `,
@@ -42,10 +42,10 @@ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
42
42
  <URow>
43
43
  <UInputSearch
44
44
  v-for="(option, index) in options"
45
+ :key="index"
45
46
  v-bind="args"
46
47
  v-model="args.modelValue"
47
48
  :[args.enum]="option"
48
- :key="index"
49
49
  >
50
50
  </UInputSearch>
51
51
  </URow>
@@ -1,10 +1,9 @@
1
1
  import ULabel from "../ui.form-label";
2
- import URow from "../ui.container-row";
3
2
  import UCol from "../ui.container-col";
4
3
  import UText from "../ui.text-block";
5
4
  import UIcon from "../ui.image-icon";
6
5
 
7
- import { getArgTypes } from "../service.storybook";
6
+ import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
8
7
 
9
8
  /**
10
9
  * The `ULabel` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.form-label)
@@ -22,73 +21,51 @@ export default {
22
21
  },
23
22
  };
24
23
 
25
- const message = "This is plain text";
24
+ const defaultTemplate = "This is plain text";
26
25
 
27
26
  const DefaultTemplate = (args) => ({
28
- components: { ULabel, UText },
29
- setup() {
30
- return { args };
31
- },
32
- template: `
33
- <ULabel v-bind="args">
34
- <UText v-bind="args">${message}</UText>
35
- </ULabel>
36
- `,
37
- });
38
-
39
- const SlotTemplate = (args) => ({
40
27
  components: { ULabel, UText, UIcon },
41
28
  setup() {
42
- return { args };
29
+ const slots = getSlotNames(ULabel.name);
30
+
31
+ return { args, slots };
43
32
  },
44
33
  template: `
45
34
  <ULabel v-bind="args">
46
- <UText v-bind="args">${message}</UText>
47
- ${args.slotTemplate}
35
+ <UText v-bind="args">${getSlotsFragment(defaultTemplate)}</UText>
36
+ ${args.slotTemplate ? args.slotTemplate : ""}
48
37
  </ULabel>
49
38
  `,
50
39
  });
51
40
 
52
- const SizesTemplate = (args, { argTypes } = {}) => ({
53
- components: { ULabel, URow, UText },
54
- setup() {
55
- return {
56
- args,
57
- sizes: argTypes.size.options,
58
- };
59
- },
60
- template: `
61
- <URow>
62
- <ULabel
63
- v-for="(size, index) in sizes"
64
- v-bind="args"
65
- :size="size"
66
- :key="index"
67
- >
68
- <UText :size="size">This is <b>"{{ size }}"</b> size.</UText>
69
- </ULabel>
70
- </URow>
71
- `,
72
- });
73
-
74
- const LabelPlacementTemplate = (args, { argTypes } = {}) => ({
41
+ const EnumVariantTemplate = (args, { argTypes } = {}) => ({
75
42
  components: { ULabel, UCol, UText },
76
43
  setup() {
44
+ function getText(value, name) {
45
+ return name === "size" ? `This is ${value} size.` : `This is ${value} label placement.`;
46
+ }
47
+
48
+ const { name, options } = argTypes[args.enum];
49
+ const prefixedOptions = options.map((option) => getText(option, name));
50
+
77
51
  return {
78
52
  args,
79
- placements: argTypes.align.options,
53
+ options: argTypes[args.enum].options,
54
+ prefixedOptions,
80
55
  };
81
56
  },
82
57
  template: `
83
58
  <UCol>
84
59
  <ULabel
85
- v-for="(align, index) in placements"
86
- v-bind="args"
87
- :align="align"
60
+ v-for="(option, index) in options"
88
61
  :key="index"
62
+ v-bind="args"
63
+ :[args.enum]="option"
89
64
  class="border border-gray-200 rounded p-4"
90
65
  >
91
- <UText>This is <b>"{{ align }}"</b> label placement.</UText>
66
+ <UText :[args.enum]="option">
67
+ {{ prefixedOptions[index] }}
68
+ </UText>
92
69
  </ULabel>
93
70
  </UCol>
94
71
  `,
@@ -97,11 +74,11 @@ const LabelPlacementTemplate = (args, { argTypes } = {}) => ({
97
74
  export const Default = DefaultTemplate.bind({});
98
75
  Default.args = {};
99
76
 
100
- export const Sizes = SizesTemplate.bind({});
101
- Sizes.args = {};
77
+ export const Sizes = EnumVariantTemplate.bind({});
78
+ Sizes.args = { enum: "size" };
102
79
 
103
- export const LabelPlacement = LabelPlacementTemplate.bind({});
104
- LabelPlacement.args = {};
80
+ export const LabelPlacement = EnumVariantTemplate.bind({});
81
+ LabelPlacement.args = { enum: "align" };
105
82
 
106
83
  export const Error = DefaultTemplate.bind({});
107
84
  Error.args = { error: "Error description" };
@@ -109,7 +86,7 @@ Error.args = { error: "Error description" };
109
86
  export const Disabled = DefaultTemplate.bind({});
110
87
  Disabled.args = { disabled: true };
111
88
 
112
- export const slotFooter = SlotTemplate.bind({});
89
+ export const slotFooter = DefaultTemplate.bind({});
113
90
  slotFooter.args = {
114
91
  slotTemplate: `
115
92
  <template #footer>
@@ -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 URadio from "../ui.form-radio";
4
4
  import UBadge from "../ui.text-badge";
@@ -22,7 +22,7 @@ export default {
22
22
  };
23
23
 
24
24
  const DefaultTemplate = (args) => ({
25
- components: { URadio },
25
+ components: { URadio, UBadge },
26
26
  setup() {
27
27
  const slots = getSlotNames(URadio.name);
28
28
 
@@ -30,19 +30,7 @@ const DefaultTemplate = (args) => ({
30
30
  },
31
31
  template: `
32
32
  <URadio v-bind="args">
33
- ${allSlotsFragment}
34
- </URadio>
35
- `,
36
- });
37
-
38
- const SlotTemplate = (args) => ({
39
- components: { URadio, UBadge },
40
- setup() {
41
- return { args };
42
- },
43
- template: `
44
- <URadio v-bind="args">
45
- ${args.slotTemplate}
33
+ ${args.slotTemplate || getSlotsFragment()}
46
34
  </URadio>
47
35
  `,
48
36
  });
@@ -59,14 +47,14 @@ description.args = { name: "radio3", description: "description" };
59
47
  export const checked = DefaultTemplate.bind({});
60
48
  checked.args = { checked: true, name: "radio4" };
61
49
 
62
- export const slotFooter = SlotTemplate.bind({});
50
+ export const slotFooter = DefaultTemplate.bind({});
63
51
  slotFooter.args = {
64
52
  name: "radio5",
65
53
  label: "radio",
66
54
  value: "radio",
67
55
  slotTemplate: `
68
56
  <template #footer>
69
- <UBadge label="favourite" color="green" size="sm" />
57
+ <UBadge label="favourite" color="green" size="sm" />
70
58
  </template>
71
59
  `,
72
60
  };