vueless 0.0.813 → 0.0.814

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.813",
3
+ "version": "0.0.814",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -4,13 +4,16 @@ import UBreadcrumbs from "../../ui.navigation-breadcrumbs/UBreadcrumbs.vue";
4
4
  import UCol from "../../ui.container-col/UCol.vue";
5
5
  import UBadge from "../../ui.text-badge/UBadge.vue";
6
6
  import UButton from "../../ui.button/UButton.vue";
7
+ import URow from "../../ui.container-row/URow.vue";
8
+ import UIcon from "../../ui.image-icon/UIcon.vue";
9
+ import ULabel from "../../ui.form-label/ULabel.vue";
7
10
 
8
11
  import type { Meta, StoryFn } from "@storybook/vue3";
9
12
  import type { Props } from "../types.ts";
10
13
 
11
14
  interface UBreadcrumbsArgs extends Props {
12
15
  slotTemplate?: string;
13
- enum: "size";
16
+ enum: "size" | "color";
14
17
  }
15
18
 
16
19
  interface UBreadcrumbsArgs extends Props {
@@ -35,7 +38,7 @@ export default {
35
38
  } as Meta;
36
39
 
37
40
  const DefaultTemplate: StoryFn<UBreadcrumbsArgs> = (args: UBreadcrumbsArgs) => ({
38
- components: { UBreadcrumbs },
41
+ components: { UBreadcrumbs, UButton, UBadge, UIcon },
39
42
  setup() {
40
43
  const slots = getSlotNames(UBreadcrumbs.__name);
41
44
 
@@ -49,7 +52,7 @@ const DefaultTemplate: StoryFn<UBreadcrumbsArgs> = (args: UBreadcrumbsArgs) => (
49
52
  });
50
53
 
51
54
  const EnumVariantTemplate: StoryFn<UBreadcrumbsArgs> = (args: UBreadcrumbsArgs, { argTypes }) => ({
52
- components: { UBreadcrumbs, UCol },
55
+ components: { UBreadcrumbs, UCol, URow, ULabel },
53
56
  setup() {
54
57
  return {
55
58
  args,
@@ -58,12 +61,11 @@ const EnumVariantTemplate: StoryFn<UBreadcrumbsArgs> = (args: UBreadcrumbsArgs,
58
61
  },
59
62
  template: `
60
63
  <UCol>
61
- <UBreadcrumbs
62
- v-for="(option, index) in options"
63
- :key="index"
64
- v-bind="args"
65
- :[args.enum]="option"
66
- />
64
+ <URow v-for="(option, index) in options" :key="index" align="center">
65
+ <ULabel :label="option">
66
+ <UBreadcrumbs v-bind="args" :[args.enum]="option" />
67
+ </ULabel>
68
+ </URow>
67
69
  </UCol>
68
70
  `,
69
71
  });
@@ -74,16 +76,31 @@ Default.args = {};
74
76
  export const Sizes = EnumVariantTemplate.bind({});
75
77
  Sizes.args = { enum: "size" };
76
78
 
77
- export const Styles = DefaultTemplate.bind({});
78
- Styles.args = { color: "green", dashed: true };
79
- Styles.parameters = {
80
- docs: {
81
- description: {
82
- story:
83
- "For a full list of ULink's supported colors, underlined/dashed styles, etc., see the [ULink Documentation](https://ui.vueless.com/?path=/docs/1060--docs).",
84
- },
79
+ export const Colors = EnumVariantTemplate.bind({});
80
+ Colors.args = { enum: "color" };
81
+
82
+ export const UnderlineVariants: StoryFn<UBreadcrumbsArgs> = (args: UBreadcrumbsArgs) => ({
83
+ components: { UBreadcrumbs },
84
+ setup() {
85
+ const variants = [
86
+ { name: "Default", props: {} },
87
+ { name: "Dashed", props: { dashed: true } },
88
+ { name: "Underlined", props: { underlined: true } },
89
+ { name: "No underline", props: { underlined: false } },
90
+ ];
91
+
92
+ return {
93
+ args,
94
+ variants,
95
+ };
85
96
  },
86
- };
97
+ template: `
98
+ <div v-for="variant in variants" :key="variant.name" class="mb-8">
99
+ <div class="text-sm font-medium mb-2">{{ variant.name }}</div>
100
+ <UBreadcrumbs v-bind="variant.props" :links="args.links" />
101
+ </div>
102
+ `,
103
+ });
87
104
 
88
105
  export const LinkStates = DefaultTemplate.bind({});
89
106
  LinkStates.args = {
@@ -102,7 +119,7 @@ LinkStates.parameters = {
102
119
  description: {
103
120
  story:
104
121
  // eslint-disable-next-line vue/max-len
105
- "A breadcrumb is automatically disabled, if: <br /> - it does not have both `route` and `href` properties; <br /> - it has `disabled` property set to `true.",
122
+ "A breadcrumb is automatically disabled, if: <br /> - it does not have both `route` and `href` properties; <br /> - it has `disabled` property set to `true`.",
106
123
  },
107
124
  },
108
125
  };
@@ -124,33 +141,34 @@ LinkIcon.parameters = {
124
141
  },
125
142
  };
126
143
 
127
- export const Slots: StoryFn<UBreadcrumbsArgs> = (args) => ({
128
- components: { UBreadcrumbs, UBadge, UButton },
129
- setup() {
130
- return { args };
131
- },
132
- template: `
133
- <UBreadcrumbs v-bind="args">
134
- <template #icon="{ index }">
135
- <UBadge
136
- v-if="index === 1"
137
- label="Info"
138
- color="green"
139
- size="sm"
140
- />
141
- </template>
142
- </UBreadcrumbs>
144
+ export const SlotIcon = DefaultTemplate.bind({});
145
+ SlotIcon.args = {
146
+ slotTemplate: `
147
+ <template #icon="{ index }">
148
+ <UBadge
149
+ v-if="index === 1"
150
+ label="Info"
151
+ color="green"
152
+ size="sm"
153
+ />
154
+ </template>
155
+ `,
156
+ };
143
157
 
144
- <UBreadcrumbs v-bind="args">
145
- <template #label="{ label, index }">
146
- <UButton v-if="index === 0" :label="label" size="2xs" />
147
- </template>
148
- </UBreadcrumbs>
158
+ export const SlotLabel = DefaultTemplate.bind({});
159
+ SlotLabel.args = {
160
+ slotTemplate: `
161
+ <template #label="{ label, index }">
162
+ <UButton v-if="index === 0" :label="label" size="2xs" />
163
+ </template>
164
+ `,
165
+ };
149
166
 
150
- <UBreadcrumbs v-bind="args">
151
- <template #divider="{ index }">
152
- <span>/</span>
153
- </template>
154
- </UBreadcrumbs>
167
+ export const SlotDivider = DefaultTemplate.bind({});
168
+ SlotDivider.args = {
169
+ slotTemplate: `
170
+ <template #divider="{ index }">
171
+ <UIcon v-if="index === 1" name="double_arrow" size="xs" />
172
+ </template>
155
173
  `,
156
- });
174
+ };
@@ -133,8 +133,11 @@ const {
133
133
  :data-test="getDataTest('first')"
134
134
  @click="goToFirstPage"
135
135
  >
136
- <!-- @slot Use it to add something instead of the "first" label. -->
137
- <slot name="first">
136
+ <!--
137
+ @slot Use it to add something instead of the "first" label.
138
+ @binding {string} icon-name
139
+ -->
140
+ <slot name="first" :icon-name="config.defaults.firstIcon">
138
141
  <UIcon
139
142
  v-if="!firstLabel"
140
143
  internal
@@ -154,8 +157,11 @@ const {
154
157
  :data-test="getDataTest('prev')"
155
158
  @click="goToPrevPage"
156
159
  >
157
- <!-- @slot Use it to add something instead of the "prev" label. -->
158
- <slot name="prev">
160
+ <!--
161
+ @slot Use it to add something instead of the "prev" label.
162
+ @binding {string} icon-name
163
+ -->
164
+ <slot name="prev" :icon-name="config.defaults.prevIcon">
159
165
  <UIcon
160
166
  v-if="!prevLabel"
161
167
  internal
@@ -208,7 +214,10 @@ const {
208
214
  :data-test="getDataTest('next')"
209
215
  @click="goToNextPage"
210
216
  >
211
- <!-- @slot Use it to add something instead of the "next" label. -->
217
+ <!--
218
+ @slot Use it to add something instead of the "next" label.
219
+ @binding {string} icon-name
220
+ -->
212
221
  <slot name="next">
213
222
  <UIcon
214
223
  v-if="!nextLabel"
@@ -230,7 +239,10 @@ const {
230
239
  :data-test="getDataTest('last')"
231
240
  @click="goToLastPage"
232
241
  >
233
- <!-- @slot Use it to add something instead of the "last" label. -->
242
+ <!--
243
+ @slot Use it to add something instead of the "last" label.
244
+ @binding {string} icon-name
245
+ -->
234
246
  <slot name="last">
235
247
  <UIcon
236
248
  v-if="!lastLabel"
@@ -40,8 +40,8 @@ export default /*tw*/ {
40
40
  perPage: 20,
41
41
  disabled: false,
42
42
  ellipsis: true,
43
- showFirst: false,
44
- showLast: false,
43
+ showFirst: true,
44
+ showLast: true,
45
45
  /* icons */
46
46
  firstIcon: "first_page",
47
47
  lastIcon: "last_page",
@@ -6,12 +6,18 @@ import {
6
6
  } from "../../utils/storybook.ts";
7
7
 
8
8
  import UPagination from "../../ui.navigation-pagination/UPagination.vue";
9
+ import UCol from "../../ui.container-col/UCol.vue";
10
+ import URow from "../../ui.container-row/URow.vue";
11
+ import UBadge from "../../ui.text-badge/UBadge.vue";
12
+ import UIcon from "../../ui.image-icon/UIcon.vue";
13
+ import ULabel from "../../ui.form-label/ULabel.vue";
9
14
 
10
15
  import type { Meta, StoryFn } from "@storybook/vue3";
11
16
  import type { Props } from "../types.ts";
12
17
 
13
18
  interface UPaginationArgs extends Props {
14
19
  slotTemplate?: string;
20
+ enum: "variant" | "size";
15
21
  }
16
22
 
17
23
  export default {
@@ -44,23 +50,60 @@ const DefaultTemplate: StoryFn<UPaginationArgs> = (args: UPaginationArgs) => ({
44
50
  `,
45
51
  });
46
52
 
53
+ const EnumVariantTemplate: StoryFn<UPaginationArgs> = (args: UPaginationArgs, { argTypes }) => ({
54
+ components: { UPagination, UCol, URow, ULabel },
55
+ setup() {
56
+ return {
57
+ args,
58
+ options: argTypes?.[args.enum]?.options,
59
+ };
60
+ },
61
+ template: `
62
+ <UCol>
63
+ <URow
64
+ v-for="(option, index) in options"
65
+ :key="index"
66
+ align="center"
67
+ >
68
+ <ULabel :label="option">
69
+ <UPagination v-bind="args" :[args.enum]="option" />
70
+ </ULabel>
71
+ </URow>
72
+ </UCol>
73
+ `,
74
+ });
75
+
47
76
  export const Default = DefaultTemplate.bind({});
48
77
  Default.args = {};
49
78
 
50
- export const PerPage1 = DefaultTemplate.bind({});
51
- PerPage1.args = { perPage: 1 };
79
+ export const Disabled = DefaultTemplate.bind({});
80
+ Disabled.args = { disabled: true };
52
81
 
53
- export const Limit = DefaultTemplate.bind({});
54
- Limit.args = { limit: 3 };
82
+ export const PerPage = DefaultTemplate.bind({});
83
+ PerPage.args = { perPage: 100 };
84
+ PerPage.parameters = {
85
+ docs: {
86
+ description: {
87
+ story: "Use `perPage` prop to control number of items shown per page.",
88
+ },
89
+ },
90
+ };
55
91
 
56
- export const HideEllipsis = DefaultTemplate.bind({});
57
- HideEllipsis.args = { ellipsis: false };
92
+ export const Limit = DefaultTemplate.bind({});
93
+ Limit.args = { limit: 11 };
94
+ Limit.parameters = {
95
+ docs: {
96
+ description: {
97
+ story: "`limit` prop controls the limit of visible pages.",
98
+ },
99
+ },
100
+ };
58
101
 
59
- export const Disabled = DefaultTemplate.bind({});
60
- Disabled.args = { disabled: true };
102
+ export const Variant = EnumVariantTemplate.bind({});
103
+ Variant.args = { enum: "variant" };
61
104
 
62
- export const HideNavButtons = DefaultTemplate.bind({});
63
- HideNavButtons.args = { showLast: false, showFirst: false };
105
+ export const Size = EnumVariantTemplate.bind({});
106
+ Size.args = { enum: "size" };
64
107
 
65
108
  export const SetCustomNavigationLabel = DefaultTemplate.bind({});
66
109
  SetCustomNavigationLabel.args = {
@@ -69,3 +112,76 @@ SetCustomNavigationLabel.args = {
69
112
  lastLabel: "⏩",
70
113
  firstLabel: "⏪",
71
114
  };
115
+ SetCustomNavigationLabel.parameters = {
116
+ docs: {
117
+ description: {
118
+ story:
119
+ // eslint-disable-next-line vue/max-len
120
+ "Feel free to customize each navigation button via the respective prop (`firstLabel`, `prevLabel`, `nextLabel`, `lastLabel`).",
121
+ },
122
+ },
123
+ };
124
+
125
+ export const HideEllipsis = DefaultTemplate.bind({});
126
+ HideEllipsis.args = { ellipsis: false };
127
+ HideEllipsis.parameters = {
128
+ docs: {
129
+ description: {
130
+ story: "You can hide ellipsis by setting `ellipsis` prop to `false`.",
131
+ },
132
+ },
133
+ };
134
+
135
+ export const HideNavButtons = DefaultTemplate.bind({});
136
+ HideNavButtons.args = { showLast: false, showFirst: false };
137
+ HideNavButtons.parameters = {
138
+ docs: {
139
+ description: {
140
+ story:
141
+ "If you need to hide first / last navigation buttons - set `showFirst` / `showLast` props to `false`.",
142
+ },
143
+ },
144
+ };
145
+
146
+ export const Slots: StoryFn<UPaginationArgs> = (args) => ({
147
+ components: { UPagination, UBadge, UCol, URow, UIcon },
148
+ setup() {
149
+ return { args };
150
+ },
151
+ template: `
152
+ <UCol>
153
+ <UPagination v-bind="args" v-model="args.modelValue">
154
+ <template #first>
155
+ <UBadge label="Slot First" size="sm" />
156
+ </template>
157
+ </UPagination>
158
+
159
+ <UPagination v-bind="args" v-model="args.modelValue">
160
+ <template #prev>
161
+ <UBadge label="Slot Prev" size="sm" />
162
+ </template>
163
+ </UPagination>
164
+
165
+ <URow align="center">
166
+ <UPagination v-bind="args" v-model="args.modelValue">
167
+ <template #ellipsis>
168
+ <UIcon name="more_horiz" size="sm" />
169
+ </template>
170
+ </UPagination>
171
+ <span class="text-sm">Slot Ellipsis</span>
172
+ </URow>
173
+
174
+ <UPagination v-bind="args" v-model="args.modelValue">
175
+ <template #next>
176
+ <UBadge label="Slot Next" size="sm" />
177
+ </template>
178
+ </UPagination>
179
+
180
+ <UPagination v-bind="args" v-model="args.modelValue">
181
+ <template #last>
182
+ <UBadge label="Slot Last" size="sm" />
183
+ </template>
184
+ </UPagination>
185
+ </UCol>
186
+ `,
187
+ });
@@ -86,7 +86,6 @@ const {
86
86
  <template v-for="(step, index) in max" :key="index">
87
87
  <!--
88
88
  @slot Use it to add something instead of the progress step label.
89
- @binding {string} name
90
89
  @binding {number} step
91
90
  @binding {number} value
92
91
  @binding {number} max
@@ -9,6 +9,7 @@ import UProgress from "../../ui.navigation-progress/UProgress.vue";
9
9
  import UCol from "../../ui.container-col/UCol.vue";
10
10
  import UButton from "../../ui.button/UButton.vue";
11
11
  import UIcon from "../../ui.image-icon/UIcon.vue";
12
+ import UBadge from "../../ui.text-badge/UBadge.vue";
12
13
 
13
14
  import type { Meta, StoryFn } from "@storybook/vue3";
14
15
  import type { UProgressProps } from "../types.ts";
@@ -35,11 +36,11 @@ export default {
35
36
  } as Meta;
36
37
 
37
38
  const DefaultTemplate: StoryFn<UProgressArgs> = (args: UProgressArgs) => ({
38
- components: { UCol, UProgress, UButton, UIcon },
39
+ components: { UCol, UProgress, UButton, UIcon, UBadge },
39
40
  setup() {
40
41
  const slots = getSlotNames(UProgress.__name);
41
42
 
42
- args.value = args.max ? 1 : 10;
43
+ args.value = args.max ? 0 : 10;
43
44
  args.iterator = args.max ? 1 : 10;
44
45
 
45
46
  function updateProgress() {
@@ -53,7 +54,7 @@ const DefaultTemplate: StoryFn<UProgressArgs> = (args: UProgressArgs) => ({
53
54
  template: `
54
55
  <UCol>
55
56
  <UProgress v-bind="args">${args.slotTemplate || getSlotsFragment("")}</UProgress>
56
- <UButton label="Next " size="sm" variant="thirdary" filled @click="updateProgress" />
57
+ <UButton label="Next Step" size="sm" variant="thirdary" filled @click="updateProgress" />
57
58
  </UCol>
58
59
  `,
59
60
  });
@@ -77,8 +78,13 @@ const EnumVariantTemplate: StoryFn<UProgressArgs> = (args: UProgressArgs, { argT
77
78
  v-bind="args"
78
79
  :[args.enum]="option"
79
80
  :value="args.progress"
80
- />
81
- <UButton label="Next →" size="sm" variant="thirdary" filled @click="updateProgress" />
81
+ indicator
82
+ >
83
+ <template #indicator>
84
+ {{ option }}
85
+ </template>
86
+ </UProgress>
87
+ <UButton label="Next Step" size="sm" variant="thirdary" filled @click="updateProgress" />
82
88
  </UCol>
83
89
  `,
84
90
  });
@@ -86,46 +92,71 @@ const EnumVariantTemplate: StoryFn<UProgressArgs> = (args: UProgressArgs, { argT
86
92
  export const Default = DefaultTemplate.bind({});
87
93
  Default.args = {};
88
94
 
95
+ export const Max = DefaultTemplate.bind({});
96
+ Max.args = { max: ["Step 0", "Step 1", "Step 2"] };
97
+ Max.parameters = {
98
+ docs: {
99
+ description: {
100
+ story: "Control Progress max amount of steps using the `max` prop.",
101
+ },
102
+ },
103
+ };
104
+
89
105
  export const VariantStepper = DefaultTemplate.bind({});
90
- VariantStepper.args = { variant: "stepper", max: ["Step 0", "Step 1", "Step 2"] };
106
+ VariantStepper.args = {
107
+ variant: "stepper",
108
+ max: ["Introduction", "Personal Information", "Shipment Address"],
109
+ };
91
110
 
92
111
  export const Indicator = DefaultTemplate.bind({});
93
112
  Indicator.args = { indicator: true };
113
+ Indicator.parameters = {
114
+ docs: {
115
+ description: {
116
+ story: "This prop controls Progress indicator visibility.",
117
+ },
118
+ },
119
+ };
94
120
 
95
- export const Steps = DefaultTemplate.bind({});
96
- Steps.args = { max: ["Step 0", "Step 1", "Step 2"] };
121
+ export const Sizes = EnumVariantTemplate.bind({});
122
+ Sizes.args = { enum: "size" };
97
123
 
98
124
  export const Colors = EnumVariantTemplate.bind({});
99
125
  Colors.args = { enum: "color" };
100
126
 
101
- export const Sizes = EnumVariantTemplate.bind({});
102
- Sizes.args = { enum: "size" };
103
-
104
- export const IndicatorSlot = DefaultTemplate.bind({});
105
- IndicatorSlot.args = {
127
+ export const SlotIndicator = DefaultTemplate.bind({});
128
+ SlotIndicator.args = {
106
129
  indicator: true,
107
130
  slotTemplate: `
108
- <template #indicator>
109
- <UIcon
110
- name="star"
111
- color="black"
112
- />
131
+ <template #indicator="{ percent }">
132
+ <UBadge :label="'Current percent is: ' + percent" />
113
133
  </template>
114
134
  `,
115
135
  };
116
136
 
117
- export const StepSlot = DefaultTemplate.bind({});
118
- StepSlot.args = {
119
- max: ["Step 0", "Step 1", "Step 2"],
137
+ export const SlotStep = DefaultTemplate.bind({});
138
+ SlotStep.args = {
139
+ max: ["Order Placed", "Processing", "Shipped", "Delivered"],
120
140
  slotTemplate: `
121
- <template #step-0>
122
- 💻
141
+ <template #step-0="{ step, value, max }">
142
+ <div class="flex items-center gap-2">
143
+ 📦 <span>Step: {{ step }} ({{ value + 1 }} / {{ max.length }})</span>
144
+ </div>
123
145
  </template>
124
- <template #step-1>
125
- 🧇
146
+ <template #step-1="{ step, value, max }">
147
+ <div class="flex items-center gap-2">
148
+ ⚙️ <span>Step: {{ step }} ({{ value + 1 }} / {{ max.length }})</span>
149
+ </div>
126
150
  </template>
127
- <template #step-2>
128
- 😴
151
+ <template #step-2="{ step, value, max }">
152
+ <div class="flex items-center gap-2">
153
+ 🚚 <span>Step: {{ step }} ({{ value + 1 }} / {{ max.length }})</span>
154
+ </div>
129
155
  </template>
130
- `,
156
+ <template #step-3="{ step, value, max }">
157
+ <div class="flex items-center gap-2">
158
+ 🏠 <span>Step: {{ step }} ({{ value + 1 }} / {{ max.length }})</span>
159
+ </div>
160
+ </template>
161
+ `,
131
162
  };
@@ -86,7 +86,7 @@ const { getDataTest, tabButtonAttrs, tabButtonActiveAttrs } = useUI<Config>(
86
86
  @binding {boolean} active
87
87
  @binding {string} icon-name
88
88
  -->
89
- <slot :label="label" :active="isActive" :icon-name="iconName" />
89
+ <slot name="label" :label="label" :active="isActive" :icon-name="iconName" />
90
90
  </template>
91
91
 
92
92
  <template #right="{ iconName }">
@@ -7,6 +7,8 @@ import {
7
7
 
8
8
  import UTab from "../../ui.navigation-tab/UTab.vue";
9
9
  import UIcon from "../../ui.image-icon/UIcon.vue";
10
+ import URow from "../../ui.container-row/URow.vue";
11
+ import UBadge from "../../ui.text-badge/UBadge.vue";
10
12
 
11
13
  import type { Meta, StoryFn } from "@storybook/vue3";
12
14
  import type { Props } from "../types.ts";
@@ -52,13 +54,55 @@ Default.args = {};
52
54
  export const Disabled = DefaultTemplate.bind({});
53
55
  Disabled.args = { disabled: true };
54
56
 
55
- export const SlotDefault = DefaultTemplate.bind({});
56
- SlotDefault.args = {
57
- slotTemplate: `
58
- <template #default>
59
- <div class="flex items-center">
60
- <UIcon name="star" size="sm" color="inherit" />
61
- </div>
62
- </template>
57
+ export const IconProps: StoryFn<UTabArgs> = (args) => ({
58
+ components: { UTab, URow },
59
+ setup() {
60
+ return { args };
61
+ },
62
+ template: `
63
+ <URow no-mobile>
64
+ <UTab
65
+ v-bind="args"
66
+ label="Inbox"
67
+ left-icon="inbox"
68
+ />
69
+ <UTab
70
+ v-bind="args"
71
+ icon="inbox_customize"
72
+ />
73
+ <UTab
74
+ v-bind="args"
75
+ label="Spam"
76
+ right-icon="error"
77
+ />
78
+ </URow>
79
+ `,
80
+ });
81
+
82
+ export const Slots: StoryFn<UTabArgs> = (args) => ({
83
+ components: { UTab, URow, UBadge },
84
+ setup() {
85
+ return { args };
86
+ },
87
+ template: `
88
+ <URow no-mobile>
89
+ <UTab v-bind="args" label="What's new?">
90
+ <template #left>
91
+ <UBadge label="Info" size="sm" />
92
+ </template>
93
+ </UTab>
94
+
95
+ <UTab v-bind="args" label="Inbox">
96
+ <template #label="{ label }">
97
+ <UBadge :label="label" size="sm" />
98
+ </template>
99
+ </UTab>
100
+
101
+ <UTab v-bind="args" >
102
+ <template #right>
103
+ <UBadge label="New!" size="sm" />
104
+ </template>
105
+ </UTab>
106
+ </URow>
63
107
  `,
64
- };
108
+ });
@@ -42,6 +42,7 @@ export default /*tw*/ {
42
42
  size: "md",
43
43
  block: false,
44
44
  square: false,
45
+ scrollable: false,
45
46
  /* icons */
46
47
  nextIcon: "chevron_right",
47
48
  prevIcon: "chevron_left",
@@ -6,6 +6,8 @@ import {
6
6
  } from "../../utils/storybook.ts";
7
7
 
8
8
  import UTabs from "../../ui.navigation-tabs/UTabs.vue";
9
+ import URow from "../../ui.container-row/URow.vue";
10
+ import ULabel from "../../ui.form-label/ULabel.vue";
9
11
 
10
12
  import type { Meta, StoryFn } from "@storybook/vue3";
11
13
  import type { Props } from "../types.ts";
@@ -22,9 +24,9 @@ export default {
22
24
  args: {
23
25
  modelValue: "1",
24
26
  options: [
25
- { label: "Tab 1", value: "1" },
26
- { label: "Tab 2", value: "2" },
27
- { label: "Tab 3", value: "3" },
27
+ { label: "Dashboard", value: "1" },
28
+ { label: "Orders", value: "2" },
29
+ { label: "Settings", value: "3" },
28
30
  ],
29
31
  },
30
32
  argTypes: {
@@ -59,7 +61,7 @@ const DefaultTemplate: StoryFn<UTabsArgs> = (args: UTabsArgs) => ({
59
61
  });
60
62
 
61
63
  const EnumVariantTemplate: StoryFn<UTabsArgs> = (args: UTabsArgs, { argTypes }) => ({
62
- components: { UTabs },
64
+ components: { UTabs, URow, ULabel },
63
65
  setup() {
64
66
  return {
65
67
  args,
@@ -67,15 +69,20 @@ const EnumVariantTemplate: StoryFn<UTabsArgs> = (args: UTabsArgs, { argTypes })
67
69
  };
68
70
  },
69
71
  template: `
70
- <div class="space-y-16">
71
- <UTabs
72
- v-for="(option, index) in options"
73
- :key="index"
74
- v-bind="args"
75
- v-model="args.modelValue"
76
- :[args.enum]="option"
77
- />
78
- </div>
72
+
73
+ <URow
74
+ v-for="(option, index) in options"
75
+ :key="index"
76
+ align="center"
77
+ >
78
+ <ULabel :label="option">
79
+ <UTabs
80
+ v-bind="args"
81
+ v-model="args.modelValue"
82
+ :[args.enum]="option"
83
+ />
84
+ </ULabel>
85
+ </URow>
79
86
  `,
80
87
  });
81
88
 
@@ -85,17 +92,53 @@ Default.args = {};
85
92
  export const Sizes = EnumVariantTemplate.bind({});
86
93
  Sizes.args = { enum: "size" };
87
94
 
88
- export const DisabledTab = DefaultTemplate.bind({});
89
- DisabledTab.args = {
90
- options: [
91
- { label: "Tab 1", value: 1 },
92
- { label: "Tab 2", value: 2, disabled: true },
93
- { label: "Tab 3", value: 3 },
94
- ],
95
- };
96
-
97
95
  export const Scrollable = DefaultTemplate.bind({});
98
96
  Scrollable.args = {
99
97
  options: getOptionsArray(),
100
98
  scrollable: true,
101
99
  };
100
+
101
+ export const Block = DefaultTemplate.bind({});
102
+ Block.args = { block: true };
103
+
104
+ export const Square = DefaultTemplate.bind({});
105
+ Square.args = { square: true };
106
+ Square.parameters = {
107
+ docs: {
108
+ description: {
109
+ story: "Set the same paddings for the tabs.",
110
+ },
111
+ },
112
+ };
113
+
114
+ export const Slots: StoryFn<UTabsArgs> = (args) => ({
115
+ components: { UTabs },
116
+ setup() {
117
+ args.config = { next: "flex items-center", prev: "flex items-center" };
118
+
119
+ return { args, getOptionsArray };
120
+ },
121
+ template: `
122
+ <UTabs
123
+ v-bind="args"
124
+ :options="getOptionsArray()"
125
+ scrollable
126
+ >
127
+ <template #prev>
128
+ <span class="cursor-pointer">◀️</span>
129
+ </template>
130
+ <template #next>
131
+ <span class="cursor-pointer">▶️</span>
132
+ </template>
133
+ </UTabs>
134
+ `,
135
+ });
136
+ Slots.parameters = {
137
+ docs: {
138
+ description: {
139
+ story:
140
+ // eslint-disable-next-line vue/max-len
141
+ "When the `scrollable` prop is set to `true`, you can replace the default `prev` and `next` slot icons with custom content.",
142
+ },
143
+ },
144
+ };