vueless 1.4.7-beta.0 → 1.4.7-beta.2

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 (38) hide show
  1. package/icons/storybook/cloud_sync.svg +1 -0
  2. package/icons/storybook/date_range.svg +1 -0
  3. package/icons/storybook/event.svg +1 -0
  4. package/icons/storybook/folder.svg +1 -0
  5. package/icons/storybook/format_quote.svg +1 -0
  6. package/icons/storybook/local_shipping.svg +1 -0
  7. package/icons/storybook/location_city.svg +1 -0
  8. package/icons/storybook/mark_email_unread.svg +1 -0
  9. package/icons/storybook/notifications.svg +1 -0
  10. package/icons/storybook/shield.svg +1 -0
  11. package/icons/storybook/workspace_premium.svg +1 -0
  12. package/package.json +1 -1
  13. package/ui.container-col/config.ts +4 -2
  14. package/ui.container-col/tests/UCol.test.ts +24 -16
  15. package/ui.container-row/config.ts +4 -2
  16. package/ui.container-row/tests/URow.test.ts +24 -16
  17. package/ui.form-checkbox/UCheckbox.vue +0 -5
  18. package/ui.form-checkbox/storybook/stories.ts +56 -18
  19. package/ui.form-checkbox/tests/UCheckbox.test.ts +0 -17
  20. package/ui.form-checkbox-group/storybook/stories.ts +61 -0
  21. package/ui.form-date-picker/storybook/stories.ts +85 -37
  22. package/ui.form-date-picker-range/storybook/stories.ts +97 -38
  23. package/ui.form-input/storybook/stories.ts +75 -37
  24. package/ui.form-input-file/storybook/stories.ts +44 -5
  25. package/ui.form-input-number/storybook/stories.ts +66 -28
  26. package/ui.form-input-password/storybook/stories.ts +94 -50
  27. package/ui.form-input-search/storybook/stories.ts +40 -4
  28. package/ui.form-label/ULabel.vue +0 -6
  29. package/ui.form-label/storybook/stories.ts +46 -24
  30. package/ui.form-label/tests/ULabel.test.ts +0 -12
  31. package/ui.form-radio/URadio.vue +0 -5
  32. package/ui.form-radio/storybook/stories.ts +65 -25
  33. package/ui.form-radio/tests/URadio.test.ts +0 -17
  34. package/ui.form-radio-group/storybook/stories.ts +67 -0
  35. package/ui.form-select/storybook/stories.ts +99 -44
  36. package/ui.form-switch/storybook/stories.ts +35 -11
  37. package/ui.form-textarea/storybook/stories.ts +61 -20
  38. package/ui.text-files/storybook/stories.ts +30 -13
@@ -334,54 +334,109 @@ export const IconProps: StoryFn<USelectArgs> = (args) => ({
334
334
  });
335
335
 
336
336
  export const Slots: StoryFn<USelectArgs> = (args) => ({
337
- components: { USelect, URow, UIcon, UText },
338
- setup: () => ({ args, leftSlotModel: ref("paypal"), rightSlotModel: ref("bank") }),
337
+ components: { USelect, URow, UCol, UIcon, UText, ULink },
338
+ setup: () => ({
339
+ args,
340
+ leftSlotModel: ref("paypal"),
341
+ rightSlotModel: ref("bank"),
342
+ descriptionSlotModel: ref(null),
343
+ errorSlotModel: ref(null),
344
+ }),
339
345
  template: `
340
- <URow>
341
- <USelect
342
- v-model="leftSlotModel"
343
- label="Select Payment Method"
344
- :options="[
345
- { label: 'Visa', value: 'visa', icon: 'credit_card', details: '•••• 4242' },
346
- { label: 'PayPal', value: 'paypal', icon: 'payments', details: 'user@example.com' },
347
- { label: 'Bank Transfer', value: 'bank', icon: 'account_balance', details: 'Acct **** 1234' },
348
- { label: 'Apple Pay', value: 'apple', icon: 'phone_iphone', details: 'iPhone 15' },
349
- ]"
350
- >
351
- <template #left="{ options }">
352
- <UIcon
353
- v-if="leftSlotModel"
354
- :name="options?.icon"
355
- color="primary"
356
- size="sm"
357
- />
358
- </template>
359
- </USelect>
346
+ <UCol gap="3xl">
347
+ <URow block>
348
+ <USelect
349
+ v-model="leftSlotModel"
350
+ label="Select Payment Method"
351
+ :options="[
352
+ { label: 'Visa', value: 'visa', icon: 'credit_card', details: '•••• 4242' },
353
+ { label: 'PayPal', value: 'paypal', icon: 'payments', details: 'user@example.com' },
354
+ { label: 'Bank Transfer', value: 'bank', icon: 'account_balance', details: 'Acct **** 1234' },
355
+ { label: 'Apple Pay', value: 'apple', icon: 'phone_iphone', details: 'iPhone 15' },
356
+ ]"
357
+ >
358
+ <template #left="{ options }">
359
+ <UIcon
360
+ v-if="leftSlotModel"
361
+ :name="options?.icon"
362
+ color="primary"
363
+ size="sm"
364
+ />
365
+ </template>
366
+ </USelect>
367
+
368
+ <USelect
369
+ v-model="rightSlotModel"
370
+ label="Select Payment Method"
371
+ :options="[
372
+ { label: 'Visa', value: 'visa', icon: 'credit_card', details: '•••• 4242' },
373
+ { label: 'PayPal', value: 'paypal', icon: 'payments', details: 'user@example.com' },
374
+ { label: 'Bank Transfer', value: 'bank', icon: 'account_balance', details: 'Acct **** 1234' },
375
+ { label: 'Apple Pay', value: 'apple', icon: 'phone_iphone', details: 'iPhone 15' },
376
+ ]"
377
+ >
378
+ <template #right="{ options }">
379
+ <UText
380
+ v-if="rightSlotModel"
381
+ size="sm"
382
+ variant="lifted"
383
+ class="text-nowrap"
384
+ >
385
+ {{ options?.details }}
386
+ </UText>
387
+ </template>
388
+ </USelect>
389
+ </URow>
360
390
 
361
- <USelect
362
- v-model="rightSlotModel"
363
- label="Select Payment Method"
364
- :options="[
365
- { label: 'Visa', value: 'visa', icon: 'credit_card', details: '•••• 4242' },
366
- { label: 'PayPal', value: 'paypal', icon: 'payments', details: 'user@example.com' },
367
- { label: 'Bank Transfer', value: 'bank', icon: 'account_balance', details: 'Acct **** 1234' },
368
- { label: 'Apple Pay', value: 'apple', icon: 'phone_iphone', details: 'iPhone 15' },
369
- ]"
370
- >
371
- <template #right="{ options }">
372
- <UText
373
- v-if="rightSlotModel"
374
- size="sm"
375
- variant="lifted"
376
- class="text-nowrap"
377
- >
378
- {{ options?.details }}
379
- </UText>
380
- </template>
381
- </USelect>
382
- </URow>
391
+ <URow block>
392
+ <USelect
393
+ v-bind="args"
394
+ v-model="descriptionSlotModel"
395
+ label="City"
396
+ :options="args.options"
397
+ >
398
+ <template #description>
399
+ <URow align="center" gap="2xs" class="text-neutral">
400
+ <UIcon name="location_city" size="xs" color="primary" />
401
+ <UText size="sm">
402
+ Only cities we ship to.
403
+ <ULink label="Shipping zones" underlined size="sm" />.
404
+ </UText>
405
+ </URow>
406
+ </template>
407
+ </USelect>
408
+
409
+ <USelect
410
+ v-bind="args"
411
+ v-model="errorSlotModel"
412
+ label="City"
413
+ :options="args.options"
414
+ :error="true"
415
+ >
416
+ <template #error>
417
+ <URow align="center" gap="2xs">
418
+ <UIcon name="error" size="xs" color="error" />
419
+ <UText size="sm" color="error">
420
+ <ul>
421
+ <li>Please select an option from the list</li>
422
+ <li>The current value is not available anymore</li>
423
+ <li>Pick a valid choice to continue</li>
424
+ </ul>
425
+ </UText>
426
+ </URow>
427
+ </template>
428
+ </USelect>
429
+ </URow>
430
+ </UCol>
383
431
  `,
384
432
  });
433
+ Slots.parameters = {
434
+ docs: {
435
+ story: {
436
+ height: "400px",
437
+ },
438
+ },
439
+ };
385
440
 
386
441
  export const ToggleSlots: StoryFn<USelectArgs> = (args) => ({
387
442
  components: { USelect, URow, UIcon },
@@ -15,6 +15,7 @@ import ULink from "../../ui.button-link/ULink.vue";
15
15
 
16
16
  import type { Meta, StoryFn } from "@storybook/vue3-vite";
17
17
  import type { Props } from "../types";
18
+ import { ref } from "vue";
18
19
 
19
20
  interface USwitchArgs extends Props {
20
21
  slotTemplate?: string;
@@ -89,15 +90,38 @@ ToggleIcon.args = { toggleIcon: true };
89
90
  export const Disabled = DefaultTemplate.bind({});
90
91
  Disabled.args = { disabled: true };
91
92
 
92
- export const LabelSlot = DefaultTemplate.bind({});
93
- LabelSlot.args = {
94
- label: "Enable Notifications",
95
- slotTemplate: `
96
- <template #label="{ label }">
97
- <URow gap="2xs" align="center">
98
- <UText>I agree to the <ULink label="Privacy Policy" /></UText>
99
- <UIcon name="contract" size="xs" />
100
- </URow>
101
- </template>
93
+ export const Slots: StoryFn<USwitchArgs> = (args) => ({
94
+ components: { USwitch, UCol, UText, URow, ULink, UIcon },
95
+ setup: () => ({ args, labelSlotValue: ref(false), descriptionSlotValue: ref(false) }),
96
+ template: `
97
+ <UCol gap="3xl">
98
+ <USwitch
99
+ v-bind="args"
100
+ v-model="labelSlotValue"
101
+ label="Enable Notifications"
102
+ >
103
+ <template #label="{ label }">
104
+ <URow gap="2xs" align="center">
105
+ <UText :label="label" />
106
+ <UIcon name="notifications" size="xs" />
107
+ </URow>
108
+ </template>
109
+ </USwitch>
110
+
111
+ <USwitch
112
+ v-model="descriptionSlotValue"
113
+ label="Auto-save drafts"
114
+ >
115
+ <template #description>
116
+ <URow align="center" gap="2xs" class="text-neutral">
117
+ <UIcon name="cloud_sync" size="xs" class="mt-0.5" color="primary" />
118
+ <UText size="sm">
119
+ Drafts sync across devices.
120
+ <ULink label="Learn more" underlined size="sm" />.
121
+ </UText>
122
+ </URow>
123
+ </template>
124
+ </USwitch>
125
+ </UCol>
102
126
  `,
103
- };
127
+ });
@@ -12,9 +12,11 @@ import UCol from "../../ui.container-col/UCol.vue";
12
12
  import URow from "../../ui.container-row/URow.vue";
13
13
  import tooltip from "../../v.tooltip/vTooltip";
14
14
  import UText from "../../ui.text-block/UText.vue";
15
+ import ULink from "../../ui.button-link/ULink.vue";
15
16
 
16
17
  import type { Meta, StoryFn } from "@storybook/vue3-vite";
17
18
  import type { Props } from "../types";
19
+ import { ref } from "vue";
18
20
 
19
21
  interface UTextareaArgs extends Props {
20
22
  slotTemplate?: string;
@@ -138,27 +140,66 @@ NoAutocomplete.parameters = {
138
140
  };
139
141
 
140
142
  export const Slots: StoryFn<UTextareaArgs> = (args) => ({
141
- components: { UTextarea, URow, UIcon, UText },
143
+ components: { UTextarea, URow, UCol, UIcon, UText, ULink },
142
144
  directives: { tooltip },
143
- setup: () => ({ args }),
145
+ setup: () => ({
146
+ args,
147
+ descriptionSlotValue: ref(""),
148
+ errorSlotValue: ref(""),
149
+ }),
144
150
  template: `
145
- <URow>
146
- <UTextarea v-bind="args" v-model="args.modelValue" :max-length="300">
147
- <template #left>
148
- <UText :label="args.modelValue?.length + '/300'" variant="lifted" />
149
- </template>
150
- </UTextarea>
151
-
152
- <UTextarea v-bind="args">
153
- <template #right>
154
- <UIcon
155
- name="send"
156
- color="success"
157
- v-tooltip="'Send message'"
158
- interactive
159
- />
160
- </template>
161
- </UTextarea>
162
- </URow>
151
+ <UCol gap="3xl">
152
+ <URow block>
153
+ <UTextarea v-bind="args" v-model="args.modelValue" :max-length="300">
154
+ <template #left>
155
+ <UText :label="args.modelValue?.length + '/300'" variant="lifted" />
156
+ </template>
157
+ </UTextarea>
158
+
159
+ <UTextarea v-bind="args">
160
+ <template #right>
161
+ <UIcon
162
+ name="send"
163
+ color="success"
164
+ v-tooltip="'Send message'"
165
+ interactive
166
+ />
167
+ </template>
168
+ </UTextarea>
169
+ </URow>
170
+
171
+ <URow block>
172
+ <UTextarea v-model="descriptionSlotValue" label="Feedback">
173
+ <template #description>
174
+ <URow align="center" gap="2xs" class="text-neutral">
175
+ <UIcon name="format_quote" size="xs" class="mt-0.5" color="primary" />
176
+ <UText size="sm">
177
+ Markdown is not supported. See
178
+ <ULink label="content guidelines" underlined size="sm" />.
179
+ </UText>
180
+ </URow>
181
+ </template>
182
+ </UTextarea>
183
+
184
+ <UTextarea
185
+ v-model="errorSlotValue"
186
+ label="Message"
187
+ :error="true"
188
+ >
189
+ <template #error>
190
+ <URow align="center" gap="2xs">
191
+ <UIcon name="error" size="xs" color="error" />
192
+ <UText size="sm" color="error">
193
+ <ul>
194
+ <li>Message is too short (minimum 10 characters)</li>
195
+ <li>Remove disallowed characters from your text</li>
196
+ <li>Try again after fixing the issues above</li>
197
+ </ul>
198
+ </UText>
199
+ </URow>
200
+ </template>
201
+ </UTextarea>
202
+ </URow>
203
+ </UCol>
163
204
  `,
164
205
  });
@@ -8,7 +8,10 @@ import {
8
8
 
9
9
  import UFiles from "../../ui.text-files/UFiles.vue";
10
10
  import URow from "../../ui.container-row/URow.vue";
11
+ import UCol from "../../ui.container-col/UCol.vue";
11
12
  import UIcon from "../../ui.image-icon/UIcon.vue";
13
+ import UText from "../../ui.text-block/UText.vue";
14
+ import ULink from "../../ui.button-link/ULink.vue";
12
15
 
13
16
  import type { Meta, StoryFn } from "@storybook/vue3-vite";
14
17
  import type { Props } from "../types";
@@ -80,25 +83,39 @@ export const Sizes = EnumTemplate.bind({});
80
83
  Sizes.args = { enum: "size" };
81
84
 
82
85
  export const Slots: StoryFn<UFilesArgs> = (args) => ({
83
- components: { UFiles, URow, UIcon },
86
+ components: { UFiles, URow, UCol, UIcon, UText, ULink },
84
87
  setup() {
85
88
  return { args };
86
89
  },
87
90
  template: `
88
- <URow>
89
- <UFiles v-bind="args">
90
- <template #before-file="{ index }">
91
- <UIcon v-if="index === 0" name="info" color="warning" size="xs" />
92
- <UIcon v-if="index === 1" name="check_circle" color="success" size="xs" />
93
- </template>
94
- </UFiles>
91
+ <UCol gap="3xl">
92
+ <URow block>
93
+ <UFiles v-bind="args">
94
+ <template #before-file="{ index }">
95
+ <UIcon v-if="index === 0" name="info" color="warning" size="xs" />
96
+ <UIcon v-if="index === 1" name="check_circle" color="success" size="xs" />
97
+ </template>
98
+ </UFiles>
95
99
 
96
- <UFiles v-bind="args">
97
- <template #after-file="{ index }">
98
- <UIcon v-if="index === 0" name="info" color="warning" size="xs" />
99
- <UIcon v-if="index === 1" name="check_circle" color="success" size="xs" />
100
+ <UFiles v-bind="args">
101
+ <template #after-file="{ index }">
102
+ <UIcon v-if="index === 0" name="info" color="warning" size="xs" />
103
+ <UIcon v-if="index === 1" name="check_circle" color="success" size="xs" />
104
+ </template>
105
+ </UFiles>
106
+ </URow>
107
+
108
+ <UFiles v-bind="args" label="Documents">
109
+ <template #description>
110
+ <URow align="center" gap="2xs" class="text-neutral">
111
+ <UIcon name="folder" size="xs" class="mt-0.5" color="primary" />
112
+ <UText size="sm">
113
+ Files are read-only here.
114
+ <ULink label="Manage in storage" underlined size="sm" />.
115
+ </UText>
116
+ </URow>
100
117
  </template>
101
118
  </UFiles>
102
- </URow>
119
+ </UCol>
103
120
  `,
104
121
  });