vueless 0.0.800 → 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.
@@ -1,3 +1,4 @@
1
+ import { ref } from "vue";
1
2
  import {
2
3
  getArgTypes,
3
4
  getSlotNames,
@@ -6,10 +7,13 @@ import {
6
7
  } from "../../utils/storybook.ts";
7
8
 
8
9
  import UModalConfirm from "../../ui.container-modal-confirm/UModalConfirm.vue";
10
+ import UModal from "../../ui.container-modal/UModal.vue";
9
11
  import UButton from "../../ui.button/UButton.vue";
10
12
  import UHeader from "../../ui.text-header/UHeader.vue";
11
13
  import UIcon from "../../ui.image-icon/UIcon.vue";
12
14
  import URow from "../../ui.container-row/URow.vue";
15
+ import UCol from "../../ui.container-col/UCol.vue";
16
+ import UBadge from "../../ui.text-badge/UBadge.vue";
13
17
 
14
18
  import type { Meta, StoryFn } from "@storybook/vue3";
15
19
  import type { Props } from "../types.ts";
@@ -26,7 +30,7 @@ export default {
26
30
  title: "Containers / Modal Confirm",
27
31
  component: UModalConfirm,
28
32
  args: {
29
- title: "Complete the transfer?",
33
+ title: "Confirm Subscription Upgrade?",
30
34
  confirmLabel: "Confirm",
31
35
  modelValue: false,
32
36
  },
@@ -44,12 +48,11 @@ export default {
44
48
  } as Meta;
45
49
 
46
50
  const defaultTemplate = `
47
- It looks like you going to complete the transaction before the process will finished.
48
- All unsaved data will be lost.
51
+ <p>You are about to complete the subscription upgrade. Any unsaved changes or unfinished processes will be lost.</p>
49
52
  `;
50
53
 
51
54
  const DefaultTemplate: StoryFn<UModalConfirmArgs> = (args: UModalConfirmArgs) => ({
52
- components: { UModalConfirm, UButton, UHeader, UIcon },
55
+ components: { UModalConfirm, UButton, UHeader, UIcon, UModal },
53
56
  setup() {
54
57
  function onClick() {
55
58
  args.modelValue = true;
@@ -65,7 +68,7 @@ const DefaultTemplate: StoryFn<UModalConfirmArgs> = (args: UModalConfirmArgs) =>
65
68
  ${args.slotTemplate || getSlotsFragment(defaultTemplate)}
66
69
  </UModalConfirm>
67
70
 
68
- <UButton label="show modal" @click="onClick"/>
71
+ <UButton label="Show modal" @click="onClick"/>
69
72
  </div>
70
73
  `,
71
74
  });
@@ -111,73 +114,175 @@ const EnumVariantTemplate: StoryFn<UModalConfirmArgs> = (
111
114
  export const Default = DefaultTemplate.bind({});
112
115
  Default.args = {};
113
116
 
114
- export const WithoutCancelButton = DefaultTemplate.bind({});
115
- WithoutCancelButton.args = { cancelHidden: false };
117
+ export const Description = DefaultTemplate.bind({});
118
+ Description.args = {
119
+ description: "Are you sure you want to upgrade? Your new plan will take effect immediately.",
120
+ };
116
121
 
117
- export const DisableAcceptButton = DefaultTemplate.bind({});
118
- DisableAcceptButton.args = { confirmDisabled: true };
122
+ export const ConfirmLabel = DefaultTemplate.bind({});
123
+ ConfirmLabel.args = { confirmLabel: "Upgrade" };
124
+ ConfirmLabel.parameters = {
125
+ docs: {
126
+ description: {
127
+ story: "Set confirm button label.",
128
+ },
129
+ },
130
+ };
119
131
 
120
- export const Sizes = EnumVariantTemplate.bind({});
121
- Sizes.args = { enum: "size" };
132
+ export const Inner: StoryFn<UModalConfirmArgs> = (args: UModalConfirmArgs) => ({
133
+ components: { UModalConfirm, UButton, UModal },
134
+ setup() {
135
+ const showMainModal = ref(false);
136
+ const showInnerModal = ref(false);
122
137
 
123
- export const Color = EnumVariantTemplate.bind({});
124
- Color.args = { enum: "confirmColor" };
138
+ function openMainModal() {
139
+ showMainModal.value = true;
140
+ }
125
141
 
126
- export const SlotBeforeTitle = DefaultTemplate.bind({});
127
- SlotBeforeTitle.args = {
128
- slotTemplate: `
129
- <template #before-title>
130
- <UIcon name="star" color="gray" />
131
- </template>
132
- ${defaultTemplate}
133
- `,
134
- };
142
+ function openInnerModal() {
143
+ showInnerModal.value = true;
144
+ }
135
145
 
136
- export const SlotAfterTitle = DefaultTemplate.bind({});
137
- SlotAfterTitle.args = {
138
- slotTemplate: `
139
- <template #after-title>
140
- <UIcon name="star" color="gray" />
141
- </template>
142
- ${defaultTemplate}
143
- `,
144
- };
146
+ return { args, showMainModal, showInnerModal, openMainModal, openInnerModal };
147
+ },
148
+ template: `
149
+ <div>
150
+ <UModalConfirm v-bind="args" v-model="showMainModal">
151
+ <p>
152
+ Are you sure you want to cancel your subscription?
153
+ This action will remove access to premium features and cannot be undone.
154
+ </p>
155
+ <UButton label="View Plan Details" @click="openInnerModal"/>
145
156
 
146
- export const SlotHeaderLeft = DefaultTemplate.bind({});
147
- SlotHeaderLeft.args = {
148
- slotTemplate: `
149
- <template #header-left>
150
- <UHeader size="lg" label="Large title" />
151
- </template>
152
- ${defaultTemplate}
157
+ <UModal
158
+ v-model="showInnerModal"
159
+ title="Current Plan Details"
160
+ description="
161
+ Your current plan includes unlimited access to premium content,
162
+ priority support, and exclusive features.
163
+ "
164
+ inner
165
+ >
166
+ <p>Consider downgrading instead of canceling</p>
167
+ </UModal>
168
+ </UModalConfirm>
169
+
170
+ <UButton label="Manage Subscription" @click="openMainModal"/>
171
+ </div>
153
172
  `,
173
+ });
174
+ Inner.parameters = {
175
+ docs: {
176
+ description: {
177
+ story: "Add extra top margin for modal inside another modal.",
178
+ },
179
+ },
154
180
  };
155
181
 
156
- export const SlotHeaderRight = DefaultTemplate.bind({});
157
- SlotHeaderRight.args = {
182
+ export const Divider = DefaultTemplate.bind({});
183
+ Divider.args = {
184
+ divider: true,
158
185
  slotTemplate: `
159
- <template #header-right>
160
- <UButton label="I'm in the right slot" size="sm" color="gray" />
161
- </template>
162
186
  ${defaultTemplate}
163
- `,
187
+ <template #footer-left>
188
+ <UButton label="Submit" />
189
+ </template>`,
164
190
  };
165
-
166
- export const SlotDefault = DefaultTemplate.bind({});
167
- SlotDefault.args = {
168
- slotTemplate: `
169
- <template #default>
170
- 🤘🤘🤘
171
- </template>
172
- `,
191
+ Divider.parameters = {
192
+ docs: {
193
+ description: {
194
+ story: "Show divider between content and footer.",
195
+ },
196
+ },
173
197
  };
174
198
 
175
- export const SlotFooterRight = DefaultTemplate.bind({});
176
- SlotFooterRight.args = {
177
- slotTemplate: `
178
- ${defaultTemplate}
179
- <template #footer-right>
180
- <UButton label="I'm in the right slot" size="sm" color="gray" />
181
- </template>
199
+ export const WithoutCancelButton = DefaultTemplate.bind({});
200
+ WithoutCancelButton.args = { cancelHidden: true };
201
+
202
+ export const DisableConfirmButton = DefaultTemplate.bind({});
203
+ DisableConfirmButton.args = { confirmDisabled: true };
204
+
205
+ export const Sizes = EnumVariantTemplate.bind({});
206
+ Sizes.args = { enum: "size" };
207
+
208
+ export const Color = EnumVariantTemplate.bind({});
209
+ Color.args = { enum: "confirmColor" };
210
+
211
+ export const Slots: StoryFn<UModalConfirmArgs> = (args) => ({
212
+ components: { UModalConfirm, UIcon, UButton, UCol, UBadge, URow },
213
+ setup() {
214
+ const modalStates = ref({
215
+ beforeTitle: false,
216
+ title: false,
217
+ afterTitle: false,
218
+ actions: false,
219
+ footerLeft: false,
220
+ footerRight: false,
221
+ });
222
+
223
+ return { args, modalStates };
224
+ },
225
+ template: `
226
+ <UCol gap="lg">
227
+ <div>
228
+ <UModalConfirm v-bind="args" v-model="modalStates.beforeTitle">
229
+ <template #before-title>
230
+ <UIcon name="subscriptions" size="sm" />
231
+ </template>
232
+ ${defaultTemplate}
233
+ </UModalConfirm>
234
+ <UButton label="Show before-title slot modal" @click="modalStates.beforeTitle = true"/>
235
+ </div>
236
+
237
+ <div>
238
+ <UModalConfirm v-bind="args" v-model="modalStates.title">
239
+ <template #title>
240
+ <UBadge label="Confirm Subscription Upgrade?" size="lg" />
241
+ </template>
242
+ ${defaultTemplate}
243
+ </UModalConfirm>
244
+ <UButton label="Show title slot modal" @click="modalStates.title = true"/>
245
+ </div>
246
+
247
+ <div>
248
+ <UModalConfirm v-bind="args" v-model="modalStates.afterTitle">
249
+ <template #after-title>
250
+ <UIcon name="verified" size="sm" />
251
+ </template>
252
+ ${defaultTemplate}
253
+ </UModalConfirm>
254
+ <UButton label="Show after-title slot modal" @click="modalStates.afterTitle = true"/>
255
+ </div>
256
+
257
+ <div>
258
+ <UModalConfirm v-bind="args" v-model="modalStates.actions">
259
+ <template #actions="{ close }">
260
+ <UButton size="sm" color="grayscale" label="Close" @click="close" />
261
+ </template>
262
+ ${defaultTemplate}
263
+ </UModalConfirm>
264
+ <UButton label="Show actions slot modal" @click="modalStates.actions = true"/>
265
+ </div>
266
+
267
+ <div>
268
+ <UModalConfirm v-bind="args" v-model="modalStates.footerLeft">
269
+ ${defaultTemplate}
270
+ <template #footer-left>
271
+ <UButton label="Back" />
272
+ </template>
273
+ </UModalConfirm>
274
+ <UButton label="Show footer-left modal" @click="modalStates.footerLeft = true"/>
275
+ </div>
276
+
277
+ <div>
278
+ <UModalConfirm v-bind="args" v-model="modalStates.footerRight">
279
+ ${defaultTemplate}
280
+ <template #footer-right>
281
+ <UButton label="Submit" />
282
+ </template>
283
+ </UModalConfirm>
284
+ <UButton label="Show footer-right modal" @click="modalStates.footerRight = true"/>
285
+ </div>
286
+ </UCol>
182
287
  `,
183
- };
288
+ });
@@ -87,7 +87,7 @@ export interface Props {
87
87
  inner?: boolean;
88
88
 
89
89
  /**
90
- * Show divider between content end footer.
90
+ * Show divider between content and footer.
91
91
  */
92
92
  divider?: boolean;
93
93
 
@@ -37,10 +37,10 @@ const { isMobileBreakpoint } = useBreakpoint();
37
37
  const isExistHeader = computed(() => {
38
38
  return (
39
39
  props.title ||
40
- hasSlotContent(slots["header-left"]) ||
41
- hasSlotContent(slots["header-right"]) ||
42
40
  hasSlotContent(slots["before-title"]) ||
43
- hasSlotContent(slots["after-title"])
41
+ hasSlotContent(slots["title"]) ||
42
+ hasSlotContent(slots["after-title"]) ||
43
+ hasSlotContent(slots["actions"])
44
44
  );
45
45
  });
46
46
 
@@ -97,16 +97,13 @@ const {
97
97
  <template>
98
98
  <div v-bind="wrapperAttrs" :data-test="getDataTest()">
99
99
  <div v-bind="pageAttrs">
100
- <!-- @slot Use it to add something before the header. -->
101
- <slot name="header-before" />
102
-
103
100
  <div v-if="isExistHeader" v-bind="headerAttrs">
104
101
  <div v-bind="headerLeftAttrs">
105
- <!-- @slot Use it to add something to the left side of the header. -->
106
- <slot name="header-left">
107
- <!-- @slot Use it to add something before the header title. -->
108
- <slot name="before-title" />
102
+ <!-- @slot Use it to add something before the header title. -->
103
+ <slot name="before-title" />
109
104
 
105
+ <!-- @slot Use it to add something to the left side of the header. -->
106
+ <slot name="title">
110
107
  <div v-bind="headerLeftFallbackAttrs">
111
108
  <div v-if="isShownArrowButton" v-bind="backLinkWrapperAttrs">
112
109
  <UIcon
@@ -130,29 +127,22 @@ const {
130
127
  <UHeader :label="title" :size="titleSize" v-bind="titleAttrs" />
131
128
  <div v-if="description" v-bind="descriptionAttrs" v-text="description" />
132
129
  </div>
133
-
134
- <!-- @slot Use it to add something after the header title. -->
135
- <slot name="after-title" />
136
130
  </slot>
131
+ <!-- @slot Use it to add something after the header title. -->
132
+ <slot name="after-title" />
137
133
  </div>
138
134
 
139
135
  <div v-bind="headerRightAttrs">
140
136
  <!-- @slot Use it to add something to the right side of the header. -->
141
- <slot name="header-right" />
137
+ <slot name="actions" />
142
138
  </div>
143
139
  </div>
144
140
 
145
- <!-- @slot Use it to add something after the header. -->
146
- <slot name="header-after" />
147
-
148
141
  <div v-bind="bodyAttrs">
149
142
  <!-- @slot Use it to add main content. -->
150
143
  <slot />
151
144
  </div>
152
145
 
153
- <!-- @slot Use it to add something before the footer. -->
154
- <slot name="footer-before" />
155
-
156
146
  <div v-if="isExistFooter" v-bind="footerAttrs">
157
147
  <div v-bind="footerLeftAttrs">
158
148
  <!-- @slot Use it to add something to the left side of the footer. -->
@@ -164,9 +154,6 @@ const {
164
154
  <slot name="footer-right" />
165
155
  </div>
166
156
  </div>
167
-
168
- <!-- @slot Use it to add something after the footer. -->
169
- <slot name="footer-after" />
170
157
  </div>
171
158
 
172
159
  <div v-if="!isMobileBreakpoint" v-bind="rightRoundingWrapperAttrs">
@@ -8,17 +8,20 @@ import {
8
8
  import UPage from "../../ui.container-page/UPage.vue";
9
9
  import UCard from "../../ui.container-card/UCard.vue";
10
10
  import URow from "../../ui.container-row/URow.vue";
11
+ import UCol from "../../ui.container-col/UCol.vue";
11
12
  import UInput from "../../ui.form-input/UInput.vue";
12
13
  import UTextarea from "../../ui.form-textarea/UTextarea.vue";
13
14
  import UButton from "../../ui.button/UButton.vue";
14
15
  import UIcon from "../../ui.image-icon/UIcon.vue";
15
16
  import UHeader from "../../ui.text-header/UHeader.vue";
17
+ import UBadge from "../../ui.text-badge/UBadge.vue";
16
18
 
17
19
  import type { Meta, StoryFn } from "@storybook/vue3";
18
20
  import type { Props } from "../types.ts";
19
21
 
20
22
  interface UPageArgs extends Props {
21
23
  slotTemplate?: string;
24
+ enum: "size" | "titleSize";
22
25
  }
23
26
 
24
27
  export default {
@@ -26,7 +29,7 @@ export default {
26
29
  title: "Containers / Page",
27
30
  component: UPage,
28
31
  args: {
29
- title: "Title",
32
+ title: "User Profile",
30
33
  gray: true,
31
34
  },
32
35
  argTypes: {
@@ -40,12 +43,13 @@ export default {
40
43
  } as Meta;
41
44
 
42
45
  const defaultTemplate = `
43
- <UCard title="Card title">
46
+ <UCard title="Profile Information">
44
47
  <URow>
45
- <UInput label="Name" />
46
- <UInput label="Lastname" />
48
+ <UInput label="Full Name" placeholder="John Doe" />
49
+ <UInput label="Email Address" type="email" placeholder="john.doe@example.com" />
47
50
  </URow>
48
- <UTextarea class="mb-7 mt-4" label="Comments" rows="3" />
51
+
52
+ <UTextarea class="mb-7 mt-4" label="Message" placeholder="Enter your message here..." rows="4" />
49
53
  </UCard>
50
54
  `;
51
55
 
@@ -72,82 +76,118 @@ const DefaultTemplate: StoryFn<UPageArgs> = (args: UPageArgs) => ({
72
76
  `,
73
77
  });
74
78
 
79
+ const EnumVariantTemplate: StoryFn<UPageArgs> = (args: UPageArgs, { argTypes }) => ({
80
+ components: { UPage, UCard, URow, UInput, UTextarea },
81
+ setup() {
82
+ return {
83
+ args,
84
+ options: argTypes?.[args.enum]?.options,
85
+ };
86
+ },
87
+ template: `
88
+ <URow v-for="(option, index) in options" :key="index">
89
+ <UPage
90
+ v-bind="args"
91
+ :[args.enum]="option"
92
+ :description="option"
93
+ :config="{ wrapper: 'min-h-max', page: 'min-h-max' }"
94
+ >
95
+ ${defaultTemplate}
96
+ </UPage>
97
+ </URow>
98
+ `,
99
+ });
100
+
75
101
  export const Default = DefaultTemplate.bind({});
76
102
  Default.args = {};
77
103
 
78
- export const TitleSizeSm = DefaultTemplate.bind({});
79
- TitleSizeSm.args = { titleSize: "sm" };
80
-
81
104
  export const Description = DefaultTemplate.bind({});
82
- Description.args = { description: "Page description" };
83
-
84
- export const Size = DefaultTemplate.bind({});
85
- Size.args = { size: "sm", title: "size = md" };
105
+ Description.args = {
106
+ description: "Manage your profile details and update your personal information.",
107
+ };
86
108
 
87
109
  export const BackLink = DefaultTemplate.bind({});
88
110
  BackLink.args = {
89
- backLabel: "back",
111
+ backLabel: "Back",
90
112
  backTo: {
91
113
  path: "/",
92
114
  },
93
115
  };
94
-
95
- export const SlotHeaderLeft = DefaultTemplate.bind({});
96
- SlotHeaderLeft.args = {
97
- slotTemplate: `
98
- <template #header-left>
99
- <UHeader size="lg" label="Large title" />
100
- </template>
101
- ${defaultTemplate}
102
- `,
103
- };
104
-
105
- export const SlotBeforeTitle = DefaultTemplate.bind({});
106
- SlotBeforeTitle.args = {
107
- slotTemplate: `
108
- <template #before-title>
109
- <UIcon name="close" color="gray" />
110
- </template>
111
- ${defaultTemplate}
112
- `,
116
+ BackLink.parameters = {
117
+ docs: {
118
+ description: {
119
+ story:
120
+ "Use `backTo` and `backLabel` props to add a route object and a label to the back link.",
121
+ },
122
+ },
113
123
  };
114
124
 
115
- export const SlotAfterTitle = DefaultTemplate.bind({});
116
- SlotAfterTitle.args = {
117
- slotTemplate: `
118
- <template #after-title>
119
- <UIcon name="close" color="gray" />
120
- </template>
121
- ${defaultTemplate}
122
- `,
123
- };
125
+ export const TitleSize = EnumVariantTemplate.bind({});
126
+ TitleSize.args = { enum: "titleSize" };
124
127
 
125
- export const SlotHeaderRight = DefaultTemplate.bind({});
126
- SlotHeaderRight.args = {
127
- slotTemplate: `
128
- <template #header-right>
129
- <UButton size="sm" color="gray" label="button" />
130
- </template>
131
- ${defaultTemplate}
132
- `,
128
+ export const Size = EnumVariantTemplate.bind({});
129
+ Size.args = { enum: "size" };
130
+ Size.parameters = {
131
+ docs: {
132
+ description: {
133
+ story: "Page size (width).",
134
+ },
135
+ },
133
136
  };
134
137
 
135
- export const SlotFooterLeft = DefaultTemplate.bind({});
136
- SlotFooterLeft.args = {
137
- slotTemplate: `
138
- ${defaultTemplate}
139
- <template #footer-left>
140
- <UButton label="button" />
141
- </template>
142
- `,
143
- };
138
+ export const Slots: StoryFn<UPageArgs> = (args) => ({
139
+ components: { UPage, UIcon, URow, UCol, UButton, UBadge, UTextarea, UCard, UInput },
140
+ setup() {
141
+ args.config = { wrapper: "min-h-max", page: "min-h-max" };
144
142
 
145
- export const SlotFooterRight = DefaultTemplate.bind({});
146
- SlotFooterRight.args = {
147
- slotTemplate: `
148
- ${defaultTemplate}
149
- <template #footer-right>
150
- <UButton label="button" />
151
- </template>
143
+ return { args };
144
+ },
145
+ template: `
146
+ <UCol gap="lg">
147
+ <UPage v-bind="args" description="Before Title Slot">
148
+ <template #before-title>
149
+ <UIcon name="account_circle" />
150
+ </template>
151
+ ${defaultTemplate}
152
+ </UPage>
153
+
154
+ <UPage v-bind="args">
155
+ <template #title>
156
+ <UBadge label="Title Slot" size="lg" />
157
+ </template>
158
+ ${defaultTemplate}
159
+ </UPage>
160
+
161
+ <UPage v-bind="args" description="After Title Slot">
162
+ <template #after-title>
163
+ <UIcon name="verified" />
164
+ </template>
165
+ ${defaultTemplate}
166
+ </UPage>
167
+
168
+ <UPage v-bind="args" description="Actions Slot">
169
+ <template #actions>
170
+ <URow class="max-w-fit">
171
+ <UButton size="sm" variant="secondary" label="Clear" />
172
+ <UButton size="sm" label="Submit" />
173
+ </URow>
174
+ </template>
175
+ ${defaultTemplate}
176
+ </UPage>
177
+
178
+ <UPage v-bind="args" description="Footer Left Slot">
179
+ ${defaultTemplate}
180
+ <template #footer-left>
181
+ <UButton size="sm" label="Cancel" />
182
+ </template>
183
+ </UPage>
184
+
185
+ <UPage v-bind="args" description="Footer Right Slot">
186
+ ${defaultTemplate}
187
+ <template #footer-right>
188
+ <UButton size="sm" label="Save Changes" />
189
+ </template>
190
+ </UPage>
191
+ </UCol>
152
192
  `,
153
- };
193
+ });