sprintify-ui 0.7.4 → 0.7.5
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/dist/sprintify-ui.es.js +4401 -4343
- package/dist/style.css +1 -1
- package/dist/types/components/BaseAddressForm.vue.d.ts +2 -2
- package/dist/types/components/BaseAutocomplete.vue.d.ts +3 -3
- package/dist/types/components/BaseAutocompleteDrawer.vue.d.ts +3 -3
- package/dist/types/components/BaseAutocompleteFetch.vue.d.ts +3 -3
- package/dist/types/components/BaseBadge.vue.d.ts +3 -3
- package/dist/types/components/BaseBelongsTo.vue.d.ts +3 -3
- package/dist/types/components/BaseBelongsToFetch.vue.d.ts +3 -3
- package/dist/types/components/BaseButton.vue.d.ts +6 -0
- package/dist/types/components/BaseButtonGroup.vue.d.ts +3 -3
- package/dist/types/components/BaseCardRow.vue.d.ts +3 -3
- package/dist/types/components/BaseColor.vue.d.ts +3 -3
- package/dist/types/components/BaseContainer.vue.d.ts +47 -30
- package/dist/types/components/BaseDataIterator.vue.d.ts +3 -3
- package/dist/types/components/BaseDataIteratorSectionColumns.vue.d.ts +12 -12
- package/dist/types/components/BaseDataTable.vue.d.ts +3 -3
- package/dist/types/components/BaseDataTableRowAction.vue.d.ts +2 -2
- package/dist/types/components/BaseDataTableTemplate.vue.d.ts +3 -3
- package/dist/types/components/BaseDatePicker.vue.d.ts +2 -2
- package/dist/types/components/BaseDateSelect.vue.d.ts +3 -3
- package/dist/types/components/BaseField.vue.d.ts +3 -3
- package/dist/types/components/BaseInput.vue.d.ts +3 -3
- package/dist/types/components/BaseInputError.vue.d.ts +3 -3
- package/dist/types/components/BaseInputLabel.vue.d.ts +3 -3
- package/dist/types/components/BaseJsonReader.vue.d.ts +2 -2
- package/dist/types/components/BaseMenu.vue.d.ts +1 -1
- package/dist/types/components/BasePassword.vue.d.ts +3 -3
- package/dist/types/components/BaseRichText.vue.d.ts +3 -3
- package/dist/types/components/BaseSelect.vue.d.ts +3 -3
- package/dist/types/components/BaseSwitch.vue.d.ts +3 -3
- package/dist/types/components/BaseTableColumn.vue.d.ts +1 -1
- package/dist/types/components/BaseTagAutocomplete.vue.d.ts +3 -3
- package/dist/types/components/BaseTextarea.vue.d.ts +3 -3
- package/dist/types/components/BaseTextareaAutoresize.vue.d.ts +3 -3
- package/dist/types/components/BaseTimePicker.vue.d.ts +3 -3
- package/dist/types/composables/field.d.ts +1 -1
- package/dist/types/composables/inputSize.d.ts +1 -1
- package/dist/types/utils/sizeBehaviors.d.ts +4 -0
- package/dist/types/utils/sizes.d.ts +15 -0
- package/package.json +1 -1
- package/src/assets/base-rich-text.css +101 -0
- package/src/components/BaseAddressForm.stories.js +2 -1
- package/src/components/BaseAddressForm.vue +2 -0
- package/src/components/BaseAutocomplete.stories.js +1 -3
- package/src/components/BaseAutocompleteFetch.stories.js +1 -3
- package/src/components/BaseBadge.stories.js +11 -4
- package/src/components/BaseBadge.vue +7 -4
- package/src/components/BaseBelongsTo.stories.js +1 -3
- package/src/components/BaseBelongsToFetch.stories.js +1 -4
- package/src/components/BaseButton.stories.js +1 -8
- package/src/components/BaseButton.vue +29 -21
- package/src/components/BaseButtonGroup.stories.js +1 -3
- package/src/components/BaseButtonGroup.vue +2 -0
- package/src/components/BaseColor.stories.js +1 -3
- package/src/components/BaseContainer.vue +55 -41
- package/src/components/BaseDataIterator.stories.js +1 -2
- package/src/components/BaseDataIteratorSectionButton.vue +1 -1
- package/src/components/BaseDatePicker.stories.js +1 -4
- package/src/components/BaseDatePicker.vue +4 -0
- package/src/components/BaseDateSelect.stories.js +1 -4
- package/src/components/BaseDateSelect.vue +2 -0
- package/src/components/BaseHasMany.stories.js +1 -3
- package/src/components/BaseInput.stories.js +1 -1
- package/src/components/BaseInput.vue +6 -0
- package/src/components/BaseInputError.vue +2 -0
- package/src/components/BaseInputLabel.vue +2 -0
- package/src/components/BaseJsonReader.stories.js +1 -2
- package/src/components/BaseJsonReaderItem.vue +8 -0
- package/src/components/BasePassword.stories.js +1 -3
- package/src/components/BaseRichText.stories.js +1 -2
- package/src/components/BaseRichText.vue +4 -1
- package/src/components/BaseSelect.stories.js +1 -2
- package/src/components/BaseSelect.vue +2 -0
- package/src/components/BaseShortcut.stories.js +2 -4
- package/src/components/BaseSwitch.stories.js +1 -3
- package/src/components/BaseTagAutocomplete.stories.js +1 -3
- package/src/components/BaseTagAutocomplete.vue +12 -0
- package/src/components/BaseTagAutocompleteFetch.stories.js +1 -3
- package/src/components/BaseTextarea.stories.js +1 -4
- package/src/components/BaseTextarea.vue +2 -0
- package/src/components/BaseTextareaAutoresize.stories.js +1 -4
- package/src/components/BaseTextareaAutoresize.vue +6 -4
- package/src/components/BaseTimePicker.stories.js +1 -4
- package/src/components/BaseTimePicker.vue +22 -18
- package/src/stories/PageInputSizes.vue +16 -18
- package/src/utils/sizeBehaviors.ts +4 -0
- package/src/utils/sizes.ts +18 -3
|
@@ -64,7 +64,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
64
64
|
};
|
|
65
65
|
size: {
|
|
66
66
|
default: undefined;
|
|
67
|
-
type: PropType<"xs" | "sm" | "md">;
|
|
67
|
+
type: PropType<"xs" | "sm" | "md" | "lg" | "xl">;
|
|
68
68
|
};
|
|
69
69
|
dropdownShow: {
|
|
70
70
|
default: string;
|
|
@@ -153,7 +153,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
153
153
|
};
|
|
154
154
|
size: {
|
|
155
155
|
default: undefined;
|
|
156
|
-
type: PropType<"xs" | "sm" | "md">;
|
|
156
|
+
type: PropType<"xs" | "sm" | "md" | "lg" | "xl">;
|
|
157
157
|
};
|
|
158
158
|
dropdownShow: {
|
|
159
159
|
default: string;
|
|
@@ -180,7 +180,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
180
180
|
}, {
|
|
181
181
|
filter: (option: NormalizedOption) => boolean;
|
|
182
182
|
required: boolean;
|
|
183
|
-
size: "xs" | "sm" | "md";
|
|
183
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
184
184
|
name: string;
|
|
185
185
|
placeholder: string;
|
|
186
186
|
loading: boolean;
|
|
@@ -12,7 +12,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
12
12
|
};
|
|
13
13
|
size: {
|
|
14
14
|
default: undefined;
|
|
15
|
-
type: PropType<"xs" | "sm" | "md">;
|
|
15
|
+
type: PropType<"xs" | "sm" | "md" | "lg" | "xl">;
|
|
16
16
|
};
|
|
17
17
|
class: {
|
|
18
18
|
default: string;
|
|
@@ -68,7 +68,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
68
68
|
};
|
|
69
69
|
size: {
|
|
70
70
|
default: undefined;
|
|
71
|
-
type: PropType<"xs" | "sm" | "md">;
|
|
71
|
+
type: PropType<"xs" | "sm" | "md" | "lg" | "xl">;
|
|
72
72
|
};
|
|
73
73
|
class: {
|
|
74
74
|
default: string;
|
|
@@ -115,7 +115,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
115
115
|
type: string;
|
|
116
116
|
required: boolean;
|
|
117
117
|
modelValue: string | null | undefined;
|
|
118
|
-
size: "xs" | "sm" | "md";
|
|
118
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
119
119
|
name: string;
|
|
120
120
|
placeholder: string;
|
|
121
121
|
disabled: boolean;
|
|
@@ -20,7 +20,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
20
20
|
};
|
|
21
21
|
size: {
|
|
22
22
|
default: undefined;
|
|
23
|
-
type: PropType<"xs" | "sm" | "md">;
|
|
23
|
+
type: PropType<"xs" | "sm" | "md" | "lg" | "xl">;
|
|
24
24
|
};
|
|
25
25
|
maxHeight: {
|
|
26
26
|
default: number;
|
|
@@ -77,7 +77,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
77
77
|
};
|
|
78
78
|
size: {
|
|
79
79
|
default: undefined;
|
|
80
|
-
type: PropType<"xs" | "sm" | "md">;
|
|
80
|
+
type: PropType<"xs" | "sm" | "md" | "lg" | "xl">;
|
|
81
81
|
};
|
|
82
82
|
maxHeight: {
|
|
83
83
|
default: number;
|
|
@@ -115,7 +115,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
115
115
|
}, {
|
|
116
116
|
required: boolean;
|
|
117
117
|
modelValue: string | null;
|
|
118
|
-
size: "xs" | "sm" | "md";
|
|
118
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
119
119
|
name: string;
|
|
120
120
|
placeholder: string;
|
|
121
121
|
disabled: boolean;
|
|
@@ -6,7 +6,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
6
6
|
};
|
|
7
7
|
size: {
|
|
8
8
|
default: undefined;
|
|
9
|
-
type: PropType<"xs" | "sm" | "md">;
|
|
9
|
+
type: PropType<"xs" | "sm" | "md" | "lg" | "xl">;
|
|
10
10
|
};
|
|
11
11
|
class: {
|
|
12
12
|
default: string;
|
|
@@ -57,7 +57,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
57
57
|
};
|
|
58
58
|
size: {
|
|
59
59
|
default: undefined;
|
|
60
|
-
type: PropType<"xs" | "sm" | "md">;
|
|
60
|
+
type: PropType<"xs" | "sm" | "md" | "lg" | "xl">;
|
|
61
61
|
};
|
|
62
62
|
class: {
|
|
63
63
|
default: string;
|
|
@@ -105,7 +105,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
105
105
|
class: string | string[];
|
|
106
106
|
required: boolean;
|
|
107
107
|
modelValue: string | null | undefined;
|
|
108
|
-
size: "xs" | "sm" | "md";
|
|
108
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
109
109
|
name: string;
|
|
110
110
|
placeholder: string;
|
|
111
111
|
disabled: boolean;
|
|
@@ -14,7 +14,7 @@ export declare function useField(config: Config): {
|
|
|
14
14
|
nameInternal: import("vue").ComputedRef<string>;
|
|
15
15
|
hasErrorInternal: import("vue").ComputedRef<boolean>;
|
|
16
16
|
errorMessageInternal: import("vue").ComputedRef<string | null | undefined>;
|
|
17
|
-
sizeInternal: import("vue").ComputedRef<"xs" | "sm" | "md">;
|
|
17
|
+
sizeInternal: import("vue").ComputedRef<"xs" | "sm" | "md" | "lg" | "xl">;
|
|
18
18
|
emitUpdate: (value: any) => void;
|
|
19
19
|
enableForm: () => void;
|
|
20
20
|
disableForm: () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Size } from "@/utils/sizes";
|
|
2
2
|
import { MaybeRef } from "vue";
|
|
3
3
|
declare function useInputSize(size: MaybeRef<Size | '' | undefined | null>): {
|
|
4
|
-
size: import("vue").ComputedRef<"xs" | "sm" | "md">;
|
|
4
|
+
size: import("vue").ComputedRef<"xs" | "sm" | "md" | "lg" | "xl">;
|
|
5
5
|
};
|
|
6
6
|
export { useInputSize };
|
|
@@ -3,16 +3,31 @@ declare const sizes: {
|
|
|
3
3
|
fontSize: string;
|
|
4
4
|
height: string;
|
|
5
5
|
iconSize: string;
|
|
6
|
+
buttonClass: string;
|
|
6
7
|
};
|
|
7
8
|
sm: {
|
|
8
9
|
fontSize: string;
|
|
9
10
|
height: string;
|
|
10
11
|
iconSize: string;
|
|
12
|
+
buttonClass: string;
|
|
11
13
|
};
|
|
12
14
|
md: {
|
|
13
15
|
fontSize: string;
|
|
14
16
|
height: string;
|
|
15
17
|
iconSize: string;
|
|
18
|
+
buttonClass: string;
|
|
19
|
+
};
|
|
20
|
+
lg: {
|
|
21
|
+
fontSize: string;
|
|
22
|
+
height: string;
|
|
23
|
+
iconSize: string;
|
|
24
|
+
buttonClass: string;
|
|
25
|
+
};
|
|
26
|
+
xl: {
|
|
27
|
+
fontSize: string;
|
|
28
|
+
height: string;
|
|
29
|
+
iconSize: string;
|
|
30
|
+
buttonClass: string;
|
|
16
31
|
};
|
|
17
32
|
};
|
|
18
33
|
type Size = keyof typeof sizes;
|
package/package.json
CHANGED
|
@@ -217,4 +217,105 @@ body {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
+
|
|
221
|
+
/* Size: md */
|
|
222
|
+
.base-rich-text-md {
|
|
223
|
+
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* Size: lg */
|
|
227
|
+
.base-rich-text-lg {
|
|
228
|
+
.ql-editor {
|
|
229
|
+
|
|
230
|
+
@apply p-5;
|
|
231
|
+
|
|
232
|
+
&.ql-blank::before {
|
|
233
|
+
@apply text-lg left-5;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
h1 {
|
|
238
|
+
@apply text-5xl;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
h2 {
|
|
242
|
+
@apply text-4xl;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
h3 {
|
|
246
|
+
@apply text-3xl;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
h4 {
|
|
250
|
+
@apply text-2xl;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
p {
|
|
254
|
+
@apply text-lg;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
ol,
|
|
258
|
+
ul {
|
|
259
|
+
li {
|
|
260
|
+
@apply text-lg;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
blockquote {
|
|
265
|
+
@apply text-lg;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
pre, .ql-syntax {
|
|
269
|
+
@apply text-lg;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* Size: xl */
|
|
275
|
+
.base-rich-text-xl {
|
|
276
|
+
.ql-editor {
|
|
277
|
+
|
|
278
|
+
@apply p-6;
|
|
279
|
+
|
|
280
|
+
&.ql-blank::before {
|
|
281
|
+
@apply text-xl left-6;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
h1 {
|
|
286
|
+
@apply text-6xl;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
h2 {
|
|
290
|
+
@apply text-5xl;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
h3 {
|
|
294
|
+
@apply text-2xl;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
h4 {
|
|
298
|
+
@apply text-xl;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
p {
|
|
302
|
+
@apply text-xl;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
ol,
|
|
306
|
+
ul {
|
|
307
|
+
li {
|
|
308
|
+
@apply text-xl;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
blockquote {
|
|
313
|
+
@apply text-xl;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
pre, .ql-syntax {
|
|
317
|
+
@apply text-xl;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
220
321
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import BaseAddressForm from './BaseAddressForm.vue';
|
|
2
2
|
import ShowValue from '../../.storybook/components/ShowValue.vue';
|
|
3
|
+
import { sizes } from '../../.storybook/utils';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
title: 'Form/BaseAddressForm',
|
|
@@ -7,7 +8,7 @@ export default {
|
|
|
7
8
|
argTypes: {
|
|
8
9
|
size: {
|
|
9
10
|
control: { type: 'select' },
|
|
10
|
-
options:
|
|
11
|
+
options: sizes,
|
|
11
12
|
},
|
|
12
13
|
},
|
|
13
14
|
args: {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { createFieldStory, options } from '../../.storybook/utils';
|
|
1
|
+
import { createFieldStory, options, sizes } from '../../.storybook/utils';
|
|
2
2
|
import BaseAutocomplete from './BaseAutocomplete.vue';
|
|
3
3
|
import ShowValue from '@/../.storybook/components/ShowValue.vue';
|
|
4
4
|
import { computed } from 'vue';
|
|
5
5
|
|
|
6
|
-
const sizes = ['xs', 'sm', 'md'];
|
|
7
|
-
|
|
8
6
|
export default {
|
|
9
7
|
title: 'Form/BaseAutocomplete',
|
|
10
8
|
component: BaseAutocomplete,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import BaseAutocompleteFetch from './BaseAutocompleteFetch.vue';
|
|
2
2
|
import ShowValue from '@/../.storybook/components/ShowValue.vue';
|
|
3
3
|
import { options } from '@/../.storybook/utils';
|
|
4
|
-
import { createFieldStory } from '../../.storybook/utils';
|
|
5
|
-
|
|
6
|
-
const sizes = ['xs', 'sm', 'md'];
|
|
4
|
+
import { createFieldStory, sizes } from '../../.storybook/utils';
|
|
7
5
|
|
|
8
6
|
export default {
|
|
9
7
|
title: 'Form/BaseAutocompleteFetch',
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { sizes } from '../../.storybook/utils';
|
|
1
2
|
import BaseBadge from './BaseBadge.vue';
|
|
2
3
|
|
|
3
4
|
import { palette } from '@/utils/colors';
|
|
4
5
|
|
|
5
6
|
const colors = [...Object.keys(palette), '#ff0000', '#dbeafe'];
|
|
6
7
|
|
|
7
|
-
const sizes = ['sm', 'md', 'lg'];
|
|
8
|
-
|
|
9
8
|
export default {
|
|
10
9
|
title: 'Components/BaseBadge',
|
|
11
10
|
component: BaseBadge,
|
|
@@ -52,7 +51,7 @@ export const Colors = (args) => ({
|
|
|
52
51
|
template: `
|
|
53
52
|
<div v-for="color in colors" :key="color" class="mb-1">
|
|
54
53
|
<p class="text-xs text-slate-600 leading-tight">{{ color }}</p>
|
|
55
|
-
<BaseBadge v-bind="args" :color="color"
|
|
54
|
+
<BaseBadge v-bind="args" :color="color">
|
|
56
55
|
Administrator
|
|
57
56
|
</BaseBadge>
|
|
58
57
|
</div>
|
|
@@ -61,6 +60,7 @@ export const Colors = (args) => ({
|
|
|
61
60
|
|
|
62
61
|
Colors.args = {
|
|
63
62
|
contrast: 'high',
|
|
63
|
+
icon: 'heroicons:beaker-20-solid',
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
export const Contrast = (args) => ({
|
|
@@ -71,7 +71,7 @@ export const Contrast = (args) => ({
|
|
|
71
71
|
template: `
|
|
72
72
|
<div v-for="color in colors" :key="color" class="mb-1">
|
|
73
73
|
<p class="text-xs text-slate-600 leading-tight">{{ color }}</p>
|
|
74
|
-
<BaseBadge v-bind="args" :color="color"
|
|
74
|
+
<BaseBadge v-bind="args" :color="color">
|
|
75
75
|
Administrator
|
|
76
76
|
</BaseBadge>
|
|
77
77
|
</div>
|
|
@@ -80,6 +80,7 @@ export const Contrast = (args) => ({
|
|
|
80
80
|
|
|
81
81
|
Contrast.args = {
|
|
82
82
|
contrast: 'low',
|
|
83
|
+
icon: 'heroicons:beaker-20-solid',
|
|
83
84
|
};
|
|
84
85
|
|
|
85
86
|
export const Sizes = (args) => ({
|
|
@@ -97,6 +98,12 @@ export const Sizes = (args) => ({
|
|
|
97
98
|
`,
|
|
98
99
|
});
|
|
99
100
|
|
|
101
|
+
Sizes.args = {
|
|
102
|
+
contrast: 'high',
|
|
103
|
+
icon: 'heroicons:beaker-20-solid',
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
|
|
100
107
|
export const Wrap = (args) => ({
|
|
101
108
|
components: { BaseBadge },
|
|
102
109
|
setup() {
|
|
@@ -15,11 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
<script lang="ts" setup>
|
|
17
17
|
import { getColorConfig } from '@/utils/colors';
|
|
18
|
+
import { Size, sizes } from '@/utils/sizes';
|
|
18
19
|
import { Icon as BaseIcon } from '@iconify/vue';
|
|
19
20
|
import { twMerge } from 'tailwind-merge';
|
|
20
21
|
|
|
21
|
-
const sizes = ['sm', 'md', 'lg'];
|
|
22
|
-
|
|
23
22
|
defineOptions({
|
|
24
23
|
inheritAttrs: false,
|
|
25
24
|
});
|
|
@@ -29,7 +28,7 @@ const props = withDefaults(
|
|
|
29
28
|
class?: string | string[];
|
|
30
29
|
contrast?: 'low' | 'high';
|
|
31
30
|
color?: string;
|
|
32
|
-
size?:
|
|
31
|
+
size?: Size;
|
|
33
32
|
icon?: string;
|
|
34
33
|
wrap?: boolean;
|
|
35
34
|
bordered?: boolean;
|
|
@@ -61,7 +60,7 @@ const colorStyle = computed((): Record<string, string> => {
|
|
|
61
60
|
});
|
|
62
61
|
|
|
63
62
|
const sizeInternal = computed(() => {
|
|
64
|
-
if (!sizes.includes(props.size)) {
|
|
63
|
+
if (!Object.keys(sizes).includes(props.size)) {
|
|
65
64
|
return 'md';
|
|
66
65
|
}
|
|
67
66
|
|
|
@@ -71,9 +70,11 @@ const sizeInternal = computed(() => {
|
|
|
71
70
|
const classes = computed(() => {
|
|
72
71
|
const base = 'inline-flex items-center rounded leading-tight';
|
|
73
72
|
const size = {
|
|
73
|
+
xs: 'px-1 py-px text-[9px]',
|
|
74
74
|
sm: 'px-1.5 py-px text-[10px]',
|
|
75
75
|
md: 'px-1.5 py-0.5 text-xs',
|
|
76
76
|
lg: 'px-1.5 py-0.5 text-sm',
|
|
77
|
+
xl: 'px-2.5 py-1.5 text-sm',
|
|
77
78
|
}[sizeInternal.value];
|
|
78
79
|
|
|
79
80
|
const wrap = props.wrap ? '' : 'whitespace-nowrap';
|
|
@@ -84,9 +85,11 @@ const classes = computed(() => {
|
|
|
84
85
|
const iconSizeClasses = computed(() => {
|
|
85
86
|
|
|
86
87
|
const size = {
|
|
88
|
+
xs: 'h-2 w-2 mr-1',
|
|
87
89
|
sm: 'h-2.5 w-2.5 mr-1',
|
|
88
90
|
md: 'h-3 w-3 mr-1',
|
|
89
91
|
lg: 'h-4 w-4 mr-1',
|
|
92
|
+
xl: 'h-5 w-5 mr-1.5',
|
|
90
93
|
}[sizeInternal.value];
|
|
91
94
|
|
|
92
95
|
return size;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import BaseBelongsTo from './BaseBelongsTo.vue';
|
|
2
2
|
import ShowValue from '@/../.storybook/components/ShowValue.vue';
|
|
3
3
|
import { options } from '@/../.storybook/utils';
|
|
4
|
-
import { createFieldStory } from '../../.storybook/utils';
|
|
5
|
-
|
|
6
|
-
const sizes = ['xs', 'sm', 'md'];
|
|
4
|
+
import { createFieldStory, sizes } from '../../.storybook/utils';
|
|
7
5
|
|
|
8
6
|
export default {
|
|
9
7
|
title: 'Form/BaseBelongsTo',
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import BaseBelongsToFetch from './BaseBelongsToFetch.vue';
|
|
2
2
|
import ShowValue from '@/../.storybook/components/ShowValue.vue';
|
|
3
|
-
import {
|
|
4
|
-
import { createFieldStory } from '../../.storybook/utils';
|
|
5
|
-
|
|
6
|
-
const sizes = ['xs', 'sm', 'base'];
|
|
3
|
+
import { createFieldStory, sizes } from '../../.storybook/utils';
|
|
7
4
|
|
|
8
5
|
export default {
|
|
9
6
|
title: 'Form/BaseBelongsToFetch',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sizes } from '../../.storybook/utils';
|
|
1
2
|
import BaseButton from './BaseButton.vue';
|
|
2
3
|
|
|
3
4
|
const colors = [
|
|
@@ -24,14 +25,6 @@ const colors = [
|
|
|
24
25
|
'slate-200-outline',
|
|
25
26
|
];
|
|
26
27
|
|
|
27
|
-
const sizes = [
|
|
28
|
-
'xs',
|
|
29
|
-
'sm',
|
|
30
|
-
'md',
|
|
31
|
-
'lg',
|
|
32
|
-
'xl',
|
|
33
|
-
];
|
|
34
|
-
|
|
35
28
|
export default {
|
|
36
29
|
title: 'Components/BaseButton',
|
|
37
30
|
component: BaseButton,
|
|
@@ -50,6 +50,9 @@ import { RouteLocationRaw } from 'vue-router';
|
|
|
50
50
|
import { BaseIcon } from '.';
|
|
51
51
|
import { getColorConfig } from '@/utils/colors';
|
|
52
52
|
import { isSlotEmpty } from '@/utils/slots';
|
|
53
|
+
import { Size, sizes } from '@/utils/sizes';
|
|
54
|
+
import { SizeBehavior } from '@/utils/sizeBehaviors';
|
|
55
|
+
import { useInputSize } from '@/composables/inputSize';
|
|
53
56
|
|
|
54
57
|
defineOptions({
|
|
55
58
|
inheritAttrs: false,
|
|
@@ -57,14 +60,6 @@ defineOptions({
|
|
|
57
60
|
|
|
58
61
|
const slots = useSlots();
|
|
59
62
|
|
|
60
|
-
const sizes = {
|
|
61
|
-
'xs': 'btn-xs',
|
|
62
|
-
'sm': 'btn-sm',
|
|
63
|
-
'md': 'btn-md',
|
|
64
|
-
'lg': 'btn-lg',
|
|
65
|
-
'xl': 'btn-xl',
|
|
66
|
-
};
|
|
67
|
-
|
|
68
63
|
const colors = {
|
|
69
64
|
'': '',
|
|
70
65
|
'primary': 'btn-primary',
|
|
@@ -95,7 +90,8 @@ const props = withDefaults(defineProps<{
|
|
|
95
90
|
href?: string;
|
|
96
91
|
type?: 'button' | 'submit' | 'reset';
|
|
97
92
|
iconPosition?: 'start' | 'end';
|
|
98
|
-
size?:
|
|
93
|
+
size?: Size;
|
|
94
|
+
sizeBehavior?: SizeBehavior;
|
|
99
95
|
color?: keyof typeof colors | string;
|
|
100
96
|
to?: RouteLocationRaw;
|
|
101
97
|
}>(), {
|
|
@@ -108,12 +104,24 @@ const props = withDefaults(defineProps<{
|
|
|
108
104
|
type: 'submit',
|
|
109
105
|
iconPosition: 'start',
|
|
110
106
|
size: 'md',
|
|
107
|
+
sizeBehavior: SizeBehavior.default,
|
|
111
108
|
color: '',
|
|
112
109
|
to: undefined,
|
|
113
110
|
});
|
|
114
111
|
|
|
115
112
|
defineEmits(['click']);
|
|
116
113
|
|
|
114
|
+
const sizeInternal = computed(() => {
|
|
115
|
+
|
|
116
|
+
if (props.sizeBehavior == SizeBehavior.default) {
|
|
117
|
+
return props.size;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const inputSize = useInputSize(props.size);
|
|
121
|
+
|
|
122
|
+
return inputSize.size.value;
|
|
123
|
+
});
|
|
124
|
+
|
|
117
125
|
const iconOnly = computed(() => {
|
|
118
126
|
return props.icon && isSlotEmpty(slots.default);
|
|
119
127
|
});
|
|
@@ -131,8 +139,8 @@ const classes = computed(() => {
|
|
|
131
139
|
|
|
132
140
|
}
|
|
133
141
|
|
|
134
|
-
if (
|
|
135
|
-
classes.push(sizes[
|
|
142
|
+
if (sizeInternal.value) {
|
|
143
|
+
classes.push(sizes[sizeInternal.value]?.buttonClass);
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
if (iconOnly.value) {
|
|
@@ -166,15 +174,15 @@ const containerClass = computed(() => {
|
|
|
166
174
|
}
|
|
167
175
|
|
|
168
176
|
if (props.icon) {
|
|
169
|
-
if (
|
|
177
|
+
if (sizeInternal.value == 'xs') {
|
|
170
178
|
classes.push('gap-0.5');
|
|
171
|
-
} else if (
|
|
179
|
+
} else if (sizeInternal.value == 'sm') {
|
|
172
180
|
classes.push('gap-0.5');
|
|
173
|
-
} else if (
|
|
181
|
+
} else if (sizeInternal.value == 'md') {
|
|
174
182
|
classes.push('gap-1');
|
|
175
|
-
} else if (
|
|
183
|
+
} else if (sizeInternal.value == 'lg') {
|
|
176
184
|
classes.push('gap-1');
|
|
177
|
-
} else if (
|
|
185
|
+
} else if (sizeInternal.value == 'xl') {
|
|
178
186
|
classes.push('gap-1');
|
|
179
187
|
}
|
|
180
188
|
}
|
|
@@ -193,15 +201,15 @@ const iconClass = computed(() => {
|
|
|
193
201
|
}
|
|
194
202
|
}
|
|
195
203
|
|
|
196
|
-
if (
|
|
204
|
+
if (sizeInternal.value === 'xs') {
|
|
197
205
|
classes.push('h-3 w-3');
|
|
198
|
-
} else if (
|
|
206
|
+
} else if (sizeInternal.value === 'sm') {
|
|
199
207
|
classes.push('h-3.5 w-3.5');
|
|
200
|
-
} else if (
|
|
208
|
+
} else if (sizeInternal.value === 'md') {
|
|
201
209
|
classes.push('h-4 w-4');
|
|
202
|
-
} else if (
|
|
210
|
+
} else if (sizeInternal.value === 'lg') {
|
|
203
211
|
classes.push('h-5 w-5');
|
|
204
|
-
} else if (
|
|
212
|
+
} else if (sizeInternal.value === 'xl') {
|
|
205
213
|
classes.push('h-6 w-6');
|
|
206
214
|
}
|
|
207
215
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { createFieldStory, options } from '../../.storybook/utils';
|
|
1
|
+
import { createFieldStory, options, sizes } from '../../.storybook/utils';
|
|
2
2
|
import BaseButtonGroup from './BaseButtonGroup.vue';
|
|
3
3
|
import ShowValue from '../../.storybook/components/ShowValue.vue';
|
|
4
4
|
|
|
5
|
-
const sizes = ['xs', 'sm', 'md'];
|
|
6
|
-
|
|
7
5
|
export default {
|
|
8
6
|
title: 'Form/BaseButtonGroup',
|
|
9
7
|
component: BaseButtonGroup,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { createFieldStory } from '../../.storybook/utils';
|
|
1
|
+
import { createFieldStory, sizes } from '../../.storybook/utils';
|
|
2
2
|
import BaseColor from './BaseColor.vue';
|
|
3
3
|
import ShowValue from '../../.storybook/components/ShowValue.vue';
|
|
4
4
|
|
|
5
|
-
const sizes = ['xs', 'sm', 'md'];
|
|
6
|
-
|
|
7
5
|
export default {
|
|
8
6
|
title: 'Form/BaseColor',
|
|
9
7
|
component: BaseColor,
|