vueless 0.0.801 → 0.0.802

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.
@@ -9,6 +9,9 @@ import UGroup from "../../ui.container-group/UGroup.vue";
9
9
  import UCol from "../../ui.container-col/UCol.vue";
10
10
  import UInput from "../../ui.form-input/UInput.vue";
11
11
  import UButton from "../../ui.button/UButton.vue";
12
+ import UIcon from "../../ui.image-icon/UIcon.vue";
13
+ import UBadge from "../../ui.text-badge/UBadge.vue";
14
+ import URow from "../../ui.container-row/URow.vue";
12
15
 
13
16
  import type { Meta, StoryFn } from "@storybook/vue3";
14
17
  import type { Props } from "../types.ts";
@@ -22,7 +25,7 @@ export default {
22
25
  title: "Containers / Group",
23
26
  component: UGroup,
24
27
  args: {
25
- title: "Form group",
28
+ title: "User info",
26
29
  },
27
30
  argTypes: {
28
31
  ...getArgTypes(UGroup.__name),
@@ -30,18 +33,15 @@ export default {
30
33
  parameters: {
31
34
  docs: {
32
35
  ...getDocsDescription(UGroup.__name),
33
- story: {
34
- iframeHeight: 360,
35
- },
36
36
  },
37
37
  },
38
38
  } as Meta;
39
39
 
40
40
  const defaultTemplate = `
41
41
  <UCol>
42
- <UInput placeholder="Vasyl" label="Name" />
43
- <UInput placeholder="Vasylenko" label="Surname" />
44
- <UInput placeholder="Kyiv" label="Town" />
42
+ <UInput placeholder="Vasyl" label="First Name" />
43
+ <UInput placeholder="Vasylenko" label="Last Name" />
44
+ <UInput placeholder="Kyiv" label="City" />
45
45
  </UCol>
46
46
  `;
47
47
 
@@ -60,54 +60,65 @@ const DefaultTemplate: StoryFn<UGroupArgs> = (args: UGroupArgs) => ({
60
60
  });
61
61
 
62
62
  export const Default = DefaultTemplate.bind({});
63
- Default.args = { title: "Some title" };
63
+ Default.args = {};
64
64
 
65
65
  export const Upperlined = DefaultTemplate.bind({});
66
- Upperlined.args = { upperlined: false, underlined: true };
67
-
68
- export const Underlined = DefaultTemplate.bind({});
69
- Underlined.args = { upperlined: true, underlined: false };
70
-
71
- export const NestedGroups = DefaultTemplate.bind({});
72
- NestedGroups.args = {
73
- title: "",
74
- slotTemplate: `
75
- <UGroup :upperlined="n !== 1" :title="'Group '+n" v-for="n in 3">
76
- <UCol>
77
- <UInput placeholder="input" label="Label" />
78
- <UInput placeholder="input" label="Label" />
79
- </UCol>
80
- </UGroup>
81
- `,
82
- };
83
-
84
- export const SlotDefault = DefaultTemplate.bind({});
85
- SlotDefault.args = {
86
- slotTemplate: `
87
- <UInput placeholder="placeholder" label="Label" />
88
- `,
89
- };
90
- SlotDefault.parameters = {
66
+ Upperlined.args = { upperlined: true };
67
+ Upperlined.parameters = {
91
68
  docs: {
92
- story: {
93
- iframeHeight: 240,
69
+ description: {
70
+ story: "Show line above the header.",
94
71
  },
95
72
  },
96
73
  };
97
74
 
98
- export const SlotRight = DefaultTemplate.bind({});
99
- SlotRight.args = {
100
- slotTemplate: `
101
- <template #right>
102
- <UButton size="sm" label="Edit"/>
103
- </template>
104
- ${defaultTemplate}
105
- `,
106
- };
107
- SlotRight.parameters = {
75
+ export const Underlined = DefaultTemplate.bind({});
76
+ Underlined.args = { underlined: true };
77
+ Underlined.parameters = {
108
78
  docs: {
109
- story: {
110
- iframeHeight: 200,
79
+ description: {
80
+ story: "Show line under the header.",
111
81
  },
112
82
  },
113
83
  };
84
+
85
+ export const Slots: StoryFn<UGroupArgs> = (args) => ({
86
+ components: { UGroup, UIcon, UBadge, UButton, URow, UInput, UCol },
87
+ setup() {
88
+ args.config = { wrapper: "mb-8" };
89
+
90
+ return { args };
91
+ },
92
+ template: `
93
+ <UGroup v-bind="args" title="Before Title Slot">
94
+ <template #before-title>
95
+ <UIcon name="account_circle" />
96
+ </template>
97
+ ${defaultTemplate}
98
+ </UGroup>
99
+
100
+ <UGroup v-bind="args">
101
+ <template #title>
102
+ <UBadge label="Title Slot" size="lg" />
103
+ </template>
104
+ ${defaultTemplate}
105
+ </UGroup>
106
+
107
+ <UGroup v-bind="args" title="After Title Slot">
108
+ <template #after-title>
109
+ <UIcon name="verified" />
110
+ </template>
111
+ ${defaultTemplate}
112
+ </UGroup>
113
+
114
+ <UGroup v-bind="args" title="Actions Slot">
115
+ <template #actions>
116
+ <URow class="max-w-fit">
117
+ <UButton size="sm" variant="secondary" label="Clear" />
118
+ <UButton size="sm" label="Submit" />
119
+ </URow>
120
+ </template>
121
+ ${defaultTemplate}
122
+ </UGroup>
123
+ `,
124
+ });
@@ -10,6 +10,7 @@ import type { Props } from "../types.ts";
10
10
 
11
11
  interface UGroupsArgs extends Props {
12
12
  slotTemplate?: string;
13
+ enum: "gap";
13
14
  }
14
15
 
15
16
  export default {
@@ -23,9 +24,6 @@ export default {
23
24
  parameters: {
24
25
  docs: {
25
26
  ...getDocsDescription(UGroups.__name),
26
- story: {
27
- iframeHeight: 360,
28
- },
29
27
  },
30
28
  },
31
29
  } as Meta;
@@ -44,14 +42,49 @@ const DefaultTemplate: StoryFn<UGroupsArgs> = (args: UGroupsArgs) => ({
44
42
  `,
45
43
  });
46
44
 
45
+ const EnumVariantTemplate: StoryFn<UGroupsArgs> = (args: UGroupsArgs, { argTypes }) => ({
46
+ components: { UGroups, UGroup, UCol, UInput },
47
+ setup() {
48
+ return {
49
+ args,
50
+ options: argTypes?.[args.enum]?.options,
51
+ };
52
+ },
53
+ template: `
54
+ <div>
55
+ <UGroups
56
+ v-for="(option, index) in options"
57
+ :key="option"
58
+ :[args.enum]="option"
59
+ class="mb-8"
60
+ >
61
+ <UGroup :title="option" :upperlined="index !== 0">
62
+ <UCol>
63
+ <UInput placeholder="Enter full name" label="Full Name" />
64
+ <UInput placeholder="Enter email address" label="Email Address" />
65
+ </UCol>
66
+ </UGroup>
67
+ <UGroup title="'Additional Group'">
68
+ <UCol>
69
+ <UInput placeholder="Enter phone number" label="Phone Number" />
70
+ </UCol>
71
+ </UGroup>
72
+ </UGroups>
73
+ </div>
74
+ `,
75
+ });
76
+
47
77
  export const Default = DefaultTemplate.bind({});
48
78
  Default.args = {
49
79
  slotTemplate: `
50
- <UGroup :upperlined="n !== 1" :title="'Group '+n" v-for="n in 3">
80
+ <UGroup :upperlined="n !== 1" :title="'User Group '+n" v-for="n in 3">
51
81
  <UCol>
52
- <UInput placeholder="input" label="Label" />
53
- <UInput placeholder="input" label="Label" />
82
+ <UInput placeholder="Enter full name" label="Full Name" />
83
+ <UInput placeholder="Enter email address" label="Email Address" />
54
84
  </UCol>
55
85
  </UGroup>
56
86
  `,
57
87
  };
88
+
89
+ export const Gap = EnumVariantTemplate.bind({});
90
+ Gap.args = { enum: "gap" };
@@ -55,10 +55,10 @@ const isShownArrowButton = computed(() => {
55
55
  const isExistHeader = computed(() => {
56
56
  return (
57
57
  props.title ||
58
- hasSlotContent(slots["header-left"]) ||
59
58
  hasSlotContent(slots["before-title"]) ||
59
+ hasSlotContent(slots["title"]) ||
60
60
  hasSlotContent(slots["after-title"]) ||
61
- hasSlotContent(slots["header-right"])
61
+ hasSlotContent(slots["actions"])
62
62
  );
63
63
  });
64
64
 
@@ -126,7 +126,6 @@ const {
126
126
  headerLeftAttrs,
127
127
  headerLeftFallbackAttrs,
128
128
  descriptionAttrs,
129
- headerRightAttrs,
130
129
  bodyAttrs,
131
130
  footerLeftAttrs,
132
131
  footerAttrs,
@@ -153,11 +152,10 @@ const {
153
152
  <div v-bind="modalAttrs">
154
153
  <div v-if="isExistHeader" v-bind="headerAttrs">
155
154
  <div v-bind="headerLeftAttrs">
155
+ <!-- @slot Use it to add something before the header title. -->
156
+ <slot name="before-title" />
156
157
  <!-- @slot Use it to add something to the left side of the header. -->
157
- <slot name="header-left">
158
- <!-- @slot Use it to add something before the header title. -->
159
- <slot name="before-title" />
160
-
158
+ <slot name="title">
161
159
  <div v-bind="headerLeftFallbackAttrs">
162
160
  <div v-if="isShownArrowButton" v-bind="backLinkWrapperAttrs">
163
161
  <UIcon
@@ -181,23 +179,18 @@ const {
181
179
  <UHeader :label="title" size="sm" v-bind="titleAttrs" />
182
180
  <div v-if="description" v-bind="descriptionAttrs" v-text="description" />
183
181
  </div>
184
-
185
- <!-- @slot Use it to add something after the header title. -->
186
- <slot name="after-title" />
187
182
  </slot>
188
- </div>
189
-
190
- <div v-bind="headerRightAttrs">
191
- <!-- @slot Use it to add something to the right side of the header. -->
192
- <slot name="header-right" />
183
+ <!-- @slot Use it to add something after the header title. -->
184
+ <slot name="after-title" />
193
185
  </div>
194
186
 
195
187
  <div v-if="closeOnCross" v-bind="closeIconAttrs">
196
188
  <!--
197
189
  @slot Use it to add something instead of the close button.
198
190
  @binding {string} icon-name
191
+ @binding {function} close
199
192
  -->
200
- <slot name="close-button" :icon-name="config.defaults.closeIcon">
193
+ <slot name="actions" :icon-name="config.defaults.closeIcon" :close="closeModal">
201
194
  <UIcon
202
195
  internal
203
196
  interactive
@@ -26,7 +26,6 @@ export default /*tw*/ {
26
26
  backLinkIcon: "{UIcon}",
27
27
  title: "{UHeader}",
28
28
  description: "mt-1.5 text-sm font-normal text-gray-500",
29
- headerRight: "",
30
29
  closeIcon: "{UIcon}",
31
30
  body: "space-y-4 px-4 md:px-8 text-sm",
32
31
  modalDivider: "{UDivider} pt-8",
@@ -1,3 +1,4 @@
1
+ import { ref } from "vue";
1
2
  import {
2
3
  getArgTypes,
3
4
  getSlotNames,
@@ -12,6 +13,8 @@ import UHeader from "../../ui.text-header/UHeader.vue";
12
13
  import UInput from "../../ui.form-input/UInput.vue";
13
14
  import UTextarea from "../../ui.form-textarea/UTextarea.vue";
14
15
  import URow from "../../ui.container-row/URow.vue";
16
+ import UBadge from "../../ui.text-badge/UBadge.vue";
17
+ import UCol from "../../ui.container-col/UCol.vue";
15
18
 
16
19
  import type { Meta, StoryFn } from "@storybook/vue3";
17
20
  import type { Props } from "../types.ts";
@@ -26,7 +29,7 @@ export default {
26
29
  title: "Containers / Modal",
27
30
  component: UModal,
28
31
  args: {
29
- title: "Modal title",
32
+ title: "Subscription Upgrade",
30
33
  modelValue: false,
31
34
  },
32
35
  argTypes: {
@@ -44,11 +47,11 @@ export default {
44
47
 
45
48
  const defaultTemplate = `
46
49
  <URow>
47
- <UInput label="Name" />
48
- <UInput label="Lastname" />
50
+ <UInput label="Full Name" placeholder="John Doe" />
51
+ <UInput label="Email Address" type="email" placeholder="john.doe@example.com" />
49
52
  </URow>
50
53
 
51
- <UTextarea class="mb-7" label="Comments" rows="3" />
54
+ <UTextarea class="mb-7" label="Message" placeholder="Enter your message here..." rows="4" />
52
55
  `;
53
56
 
54
57
  const DefaultTemplate: StoryFn<UModalArgs> = (args: UModalArgs) => ({
@@ -68,7 +71,7 @@ const DefaultTemplate: StoryFn<UModalArgs> = (args: UModalArgs) => ({
68
71
  ${args.slotTemplate || getSlotsFragment(defaultTemplate)}
69
72
  </UModal>
70
73
 
71
- <UButton label="show modal" @click="onClick"/>
74
+ <UButton label="Show modal" @click="onClick"/>
72
75
  </div>
73
76
  `,
74
77
  });
@@ -110,95 +113,177 @@ const EnumVariantTemplate: StoryFn<UModalArgs> = (args: UModalArgs, { argTypes }
110
113
  export const Default = DefaultTemplate.bind({});
111
114
  Default.args = {};
112
115
 
116
+ export const Description = DefaultTemplate.bind({});
117
+ Description.args = {
118
+ description: "Upgrade your subscription to unlock premium features and benefits.",
119
+ };
120
+
121
+ export const Inner: StoryFn<UModalArgs> = (args: UModalArgs) => ({
122
+ components: { UModal, UButton },
123
+ setup() {
124
+ const showMainModal = ref(false);
125
+ const showInnerModal = ref(false);
126
+
127
+ function openMainModal() {
128
+ showMainModal.value = true;
129
+ }
130
+
131
+ function openInnerModal() {
132
+ showInnerModal.value = true;
133
+ }
134
+
135
+ return { args, showMainModal, showInnerModal, openMainModal, openInnerModal };
136
+ },
137
+ template: `
138
+ <div>
139
+ <UModal v-bind="args" v-model="showMainModal">
140
+ <p>
141
+ Are you sure you want to cancel your subscription?
142
+ This action will remove access to premium features and cannot be undone.
143
+ </p>
144
+ <UButton label="View Plan Details" @click="openInnerModal"/>
145
+
146
+ <UModal
147
+ v-model="showInnerModal"
148
+ title="Current Plan Details"
149
+ description="
150
+ Your current plan includes unlimited access to premium content,
151
+ priority support, and exclusive features.
152
+ "
153
+ inner
154
+ >
155
+ <p>Consider downgrading instead of canceling</p>
156
+ </UModal>
157
+
158
+ <template #footer-right>
159
+ <UButton label="Cancel" variant="secondary" @click="showMainModal = false" />
160
+ <UButton label="Confirm" @click="showMainModal = false" />
161
+ </template>
162
+ </UModal>
163
+
164
+ <UButton label="Manage Subscription" @click="openMainModal"/>
165
+ </div>
166
+ `,
167
+ });
168
+ Inner.parameters = {
169
+ docs: {
170
+ description: {
171
+ story: "Add extra top margin for modal inside another modal.",
172
+ },
173
+ },
174
+ };
175
+
176
+ export const Divider = DefaultTemplate.bind({});
177
+ Divider.args = {
178
+ divider: true,
179
+ slotTemplate: `
180
+ ${defaultTemplate}
181
+ <template #footer-left>
182
+ <UButton label="Back" />
183
+ </template>`,
184
+ };
185
+ Divider.parameters = {
186
+ docs: {
187
+ description: {
188
+ story: "Show divider between content and footer.",
189
+ },
190
+ },
191
+ };
192
+
113
193
  export const Sizes = EnumVariantTemplate.bind({});
114
194
  Sizes.args = { enum: "size" };
115
195
 
116
196
  export const BackLink = DefaultTemplate.bind({});
117
197
  BackLink.args = {
118
- backLabel: "back",
198
+ backLabel: "Back",
119
199
  backTo: {
120
200
  path: "/",
121
201
  },
122
202
  };
123
-
124
- export const SlotDefault = DefaultTemplate.bind({});
125
- SlotDefault.args = {
126
- slotTemplate: `
127
- <template #default>
128
- Some text
129
- </template>
130
- `,
203
+ BackLink.parameters = {
204
+ docs: {
205
+ description: {
206
+ story:
207
+ "Use `backTo` and `backLabel` props to add a route object and a label to the back link.",
208
+ },
209
+ },
131
210
  };
132
211
 
133
- export const SlotBeforeTitle = DefaultTemplate.bind({});
134
- SlotBeforeTitle.args = {
135
- slotTemplate: `
136
- <template #before-title>
137
- <UIcon name="star" color="gray" />
138
- </template>
139
- ${defaultTemplate}
140
- `,
141
- };
212
+ export const Slots: StoryFn<UModalArgs> = (args) => ({
213
+ components: { UModal, UIcon, UButton, UCol, UBadge, UInput, UTextarea, URow },
214
+ setup() {
215
+ const modalStates = ref({
216
+ beforeTitle: false,
217
+ title: false,
218
+ afterTitle: false,
219
+ actions: false,
220
+ footerLeft: false,
221
+ footerRight: false,
222
+ });
142
223
 
143
- export const SlotAfterTitle = DefaultTemplate.bind({});
144
- SlotAfterTitle.args = {
145
- slotTemplate: `
146
- <template #after-title>
147
- <UIcon name="star" color="gray" />
148
- </template>
149
- ${defaultTemplate}
150
- `,
151
- };
224
+ return { args, modalStates };
225
+ },
226
+ template: `
227
+ <UCol gap="lg">
228
+ <div>
229
+ <UModal v-bind="args" v-model="modalStates.beforeTitle">
230
+ <template #before-title>
231
+ <UIcon name="account_circle" size="sm" />
232
+ </template>
233
+ ${defaultTemplate}
234
+ </UModal>
235
+ <UButton label="Show before-title slot modal" @click="modalStates.beforeTitle = true"/>
236
+ </div>
152
237
 
153
- export const SlotHeaderLeft = DefaultTemplate.bind({});
154
- SlotHeaderLeft.args = {
155
- slotTemplate: `
156
- <template #header-left>
157
- <UHeader size="lg" label="Large title" />
158
- </template>
159
- ${defaultTemplate}
160
- `,
161
- };
238
+ <div>
239
+ <UModal v-bind="args" v-model="modalStates.title">
240
+ <template #title>
241
+ <UBadge label="Subscription Upgrade" size="lg" />
242
+ </template>
243
+ ${defaultTemplate}
244
+ </UModal>
245
+ <UButton label="Show title slot modal" @click="modalStates.title = true"/>
246
+ </div>
162
247
 
163
- export const SlotHeaderRight = DefaultTemplate.bind({});
164
- SlotHeaderRight.args = {
165
- slotTemplate: `
166
- <template #header-right>
167
- <UIcon
168
- name="archive"
169
- color="red"
170
- />
171
- </template>
172
- ${defaultTemplate}
173
- `,
174
- };
248
+ <div>
249
+ <UModal v-bind="args" v-model="modalStates.afterTitle">
250
+ <template #after-title>
251
+ <UIcon name="verified" size="sm" />
252
+ </template>
253
+ ${defaultTemplate}
254
+ </UModal>
255
+ <UButton label="Show after-title slot modal" @click="modalStates.afterTitle = true"/>
256
+ </div>
175
257
 
176
- export const SlotCloseButton = DefaultTemplate.bind({});
177
- SlotCloseButton.args = {
178
- slotTemplate: `
179
- <template #close-button>
180
- <UButton size="sm" color="grayscale" label="Close" />
181
- </template>
182
- ${defaultTemplate}
183
- `,
184
- };
258
+ <div>
259
+ <UModal v-bind="args" v-model="modalStates.actions">
260
+ <template #actions="{ close }">
261
+ <UButton size="sm" color="grayscale" label="Close" @click="close" />
262
+ </template>
263
+ ${defaultTemplate}
264
+ </UModal>
265
+ <UButton label="Show actions slot modal" @click="modalStates.actions = true"/>
266
+ </div>
185
267
 
186
- export const SlotFooterLeft = DefaultTemplate.bind({});
187
- SlotFooterLeft.args = {
188
- slotTemplate: `
189
- ${defaultTemplate}
190
- <template #footer-left>
191
- <UButton label="Submit" />
192
- </template>
193
- `,
194
- };
268
+ <div>
269
+ <UModal v-bind="args" v-model="modalStates.footerLeft">
270
+ ${defaultTemplate}
271
+ <template #footer-left>
272
+ <UButton label="Back" />
273
+ </template>
274
+ </UModal>
275
+ <UButton label="Show footer-left modal" @click="modalStates.footerLeft = true"/>
276
+ </div>
195
277
 
196
- export const SlotFooterRight = DefaultTemplate.bind({});
197
- SlotFooterRight.args = {
198
- slotTemplate: `
199
- ${defaultTemplate}
200
- <template #footer-right>
201
- <UButton label="Back" />
202
- </template>
278
+ <div>
279
+ <UModal v-bind="args" v-model="modalStates.footerRight">
280
+ ${defaultTemplate}
281
+ <template #footer-right>
282
+ <UButton label="Submit" />
283
+ </template>
284
+ </UModal>
285
+ <UButton label="Show footer-right modal" @click="modalStates.footerRight = true"/>
286
+ </div>
287
+ </UCol>
203
288
  `,
204
- };
289
+ });
@@ -58,7 +58,7 @@ export interface Props {
58
58
  inner?: boolean;
59
59
 
60
60
  /**
61
- * Show divider between content end footer.
61
+ * Show divider between content and footer.
62
62
  */
63
63
  divider?: boolean;
64
64
 
@@ -97,32 +97,28 @@ const {
97
97
  v-bind="confirmModalAttrs"
98
98
  :data-test="getDataTest()"
99
99
  >
100
- <template #header-left>
101
- <!-- @slot Use it to add something to the left side of the header. -->
102
- <slot name="header-left" />
103
- </template>
104
-
105
100
  <template #before-title>
106
101
  <!-- @slot Use it to add something before the header title. -->
107
102
  <slot name="before-title" />
108
103
  </template>
109
104
 
105
+ <template #title>
106
+ <!-- @slot Use it to add something to the left side of the header. -->
107
+ <slot name="title" />
108
+ </template>
109
+
110
110
  <template #after-title>
111
111
  <!-- @slot Use it to add something after the header title. -->
112
112
  <slot name="after-title" />
113
113
  </template>
114
114
 
115
- <template #header-right>
116
- <!-- @slot Use it to add something to the right side of the header. -->
117
- <slot name="header-right" />
118
- </template>
119
-
120
- <template #close-button="{ iconName }">
115
+ <template #actions="{ iconName, close }">
121
116
  <!--
122
117
  @slot Use it to add something instead of the close button.
123
118
  @binding {string} icon-name
119
+ @binding {function} close
124
120
  -->
125
- <slot name="close-button" :icon-name="iconName" />
121
+ <slot name="actions" :icon-name="iconName" :close="close" />
126
122
  </template>
127
123
 
128
124
  <!-- @slot Use it to add something into the modal body. -->