vueless 0.0.678 → 0.0.680
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 +1 -1
- package/ui.button-link/ULink.vue +12 -31
- package/ui.button-link/config.ts +6 -4
- package/ui.button-link/types.ts +29 -19
- package/ui.button-toggle/storybook/stories.ts +0 -1
- package/ui.data-table/UTable.vue +7 -5
- package/ui.dropdown-badge/UDropdownBadge.vue +3 -4
- package/ui.dropdown-badge/config.ts +10 -1
- package/ui.dropdown-button/UDropdownButton.vue +1 -2
- package/ui.dropdown-button/config.ts +5 -5
- package/ui.form-checkbox/storybook/stories.ts +0 -1
- package/ui.form-color-picker/UColorPicker.vue +5 -2
- package/ui.form-input/config.ts +7 -4
- package/ui.form-input/storybook/stories.ts +0 -1
- package/ui.form-input-money/storybook/stories.ts +0 -1
- package/ui.form-input-money/types.ts +1 -1
- package/ui.form-input-number/storybook/stories.ts +0 -1
- package/ui.form-label/config.ts +3 -3
- package/ui.form-select/storybook/stories.ts +0 -1
- package/ui.form-select/types.ts +1 -1
- package/ui.form-textarea/storybook/stories.ts +0 -1
- package/ui.other-theme-color-toggle/UThemeColorToggle.vue +11 -6
- package/ui.other-theme-color-toggle/types.ts +2 -2
- package/ui.text-badge/UBadge.vue +6 -6
- package/utils/storybook.ts +30 -20
package/package.json
CHANGED
package/ui.button-link/ULink.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useSlots } from "vue";
|
|
3
|
-
import { RouterLink
|
|
3
|
+
import { RouterLink } from "vue-router";
|
|
4
4
|
|
|
5
5
|
import useUI from "../composables/useUI.ts";
|
|
6
6
|
import { hasSlotContent } from "../utils/helper.ts";
|
|
@@ -53,31 +53,7 @@ const isPresentRoute = computed(() => {
|
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
const safeTo = computed(() => {
|
|
56
|
-
|
|
57
|
-
return "/";
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return props.to;
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const useLinkOptions = {
|
|
64
|
-
activeClass: props.activeClass,
|
|
65
|
-
ariaCurrentValue: props.ariaCurrentValue,
|
|
66
|
-
exactActiveClass: props.exactActiveClass,
|
|
67
|
-
custom: props.custom,
|
|
68
|
-
replace: props.replace,
|
|
69
|
-
to: safeTo.value,
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const { route, isActive, isExactActive } = useLink(useLinkOptions);
|
|
73
|
-
|
|
74
|
-
const linkActiveClasses = computed(() => [
|
|
75
|
-
isActive.value && props.activeClass,
|
|
76
|
-
isExactActive.value && props.exactActiveClass,
|
|
77
|
-
]);
|
|
78
|
-
|
|
79
|
-
const targetValue = computed(() => {
|
|
80
|
-
return props.targetBlank ? "_blank" : "_self";
|
|
56
|
+
return props.to || "/";
|
|
81
57
|
});
|
|
82
58
|
|
|
83
59
|
const prefixedHref = computed(() => {
|
|
@@ -125,10 +101,15 @@ const { getDataTest, linkAttrs } = useUI<Config>(defaultConfig, mutatedProps);
|
|
|
125
101
|
<template>
|
|
126
102
|
<router-link
|
|
127
103
|
v-if="isPresentRoute"
|
|
128
|
-
:to="
|
|
129
|
-
:
|
|
104
|
+
:to="safeTo"
|
|
105
|
+
:custom="custom"
|
|
106
|
+
:replace="replace"
|
|
107
|
+
:target="target"
|
|
108
|
+
:active-class="activeClass"
|
|
109
|
+
:exact-active-class="exactActiveClass"
|
|
110
|
+
:aria-current-value="ariaCurrentValue"
|
|
111
|
+
:view-transition="viewTransition"
|
|
130
112
|
v-bind="linkAttrs"
|
|
131
|
-
:class="linkActiveClasses"
|
|
132
113
|
:data-test="getDataTest()"
|
|
133
114
|
tabindex="0"
|
|
134
115
|
@blur="onBlur"
|
|
@@ -143,10 +124,10 @@ const { getDataTest, linkAttrs } = useUI<Config>(defaultConfig, mutatedProps);
|
|
|
143
124
|
|
|
144
125
|
<a
|
|
145
126
|
v-else
|
|
127
|
+
:rel="rel"
|
|
146
128
|
:href="prefixedHref"
|
|
147
|
-
:target="
|
|
129
|
+
:target="target"
|
|
148
130
|
v-bind="linkAttrs"
|
|
149
|
-
:class="linkActiveClasses"
|
|
150
131
|
:data-test="getDataTest()"
|
|
151
132
|
tabindex="0"
|
|
152
133
|
@blur="onBlur"
|
package/ui.button-link/config.ts
CHANGED
|
@@ -55,16 +55,18 @@ export default /*tw*/ {
|
|
|
55
55
|
color: "brand",
|
|
56
56
|
type: "link",
|
|
57
57
|
size: "md",
|
|
58
|
-
|
|
58
|
+
target: "_self",
|
|
59
59
|
activeClass: "",
|
|
60
60
|
exactActiveClass: "",
|
|
61
|
+
ariaCurrentValue: "page",
|
|
62
|
+
rel: "noopener noreferrer",
|
|
61
63
|
underlined: undefined,
|
|
62
|
-
block: false,
|
|
63
64
|
ring: false,
|
|
65
|
+
block: false,
|
|
64
66
|
dashed: false,
|
|
65
|
-
disabled: false,
|
|
66
|
-
targetBlank: false,
|
|
67
67
|
custom: false,
|
|
68
68
|
replace: false,
|
|
69
|
+
disabled: false,
|
|
70
|
+
viewTransition: false,
|
|
69
71
|
},
|
|
70
72
|
};
|
package/ui.button-link/types.ts
CHANGED
|
@@ -12,14 +12,14 @@ export interface Props {
|
|
|
12
12
|
label?: string;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Vue-router route object.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
to?: RouteLocationRaw;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Link href url.
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
href?: string;
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Link size.
|
|
@@ -58,34 +58,29 @@ export interface Props {
|
|
|
58
58
|
type?: "phone" | "email" | "link";
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
63
|
-
targetBlank?: boolean;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Pass value to the attribute aria-current when the link is exact active.
|
|
61
|
+
* Apply classes to the link when its route is active or when it matches any parent route.
|
|
67
62
|
*/
|
|
68
|
-
|
|
63
|
+
activeClass?: string;
|
|
69
64
|
|
|
70
65
|
/**
|
|
71
|
-
*
|
|
66
|
+
* Apply classes to the link when its route is active.
|
|
72
67
|
*/
|
|
73
|
-
|
|
68
|
+
exactActiveClass?: string;
|
|
74
69
|
|
|
75
70
|
/**
|
|
76
|
-
*
|
|
71
|
+
* Pass value to the attribute aria-current when the link is exact active.
|
|
77
72
|
*/
|
|
78
|
-
|
|
73
|
+
ariaCurrentValue?: "time" | "location" | "page" | "step" | "date" | "true" | "false";
|
|
79
74
|
|
|
80
75
|
/**
|
|
81
|
-
*
|
|
76
|
+
* Specifies where to open the linked page.
|
|
82
77
|
*/
|
|
83
|
-
|
|
78
|
+
target?: "_blank" | "_self" | "_parent" | "_top" | string;
|
|
84
79
|
|
|
85
80
|
/**
|
|
86
|
-
*
|
|
81
|
+
* A rel attribute value to apply on the external link.
|
|
87
82
|
*/
|
|
88
|
-
|
|
83
|
+
rel?: string;
|
|
89
84
|
|
|
90
85
|
/**
|
|
91
86
|
* Show underline.
|
|
@@ -112,6 +107,21 @@ export interface Props {
|
|
|
112
107
|
*/
|
|
113
108
|
ring?: boolean;
|
|
114
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Whether RouterLink should not wrap its content in a tag.
|
|
112
|
+
*/
|
|
113
|
+
custom?: boolean;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Calls `router.replace` instead of `router.push`.
|
|
117
|
+
*/
|
|
118
|
+
replace?: boolean;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
|
|
122
|
+
*/
|
|
123
|
+
viewTransition?: boolean;
|
|
124
|
+
|
|
115
125
|
/**
|
|
116
126
|
* Component config object.
|
|
117
127
|
*/
|
package/ui.data-table/UTable.vue
CHANGED
|
@@ -141,7 +141,9 @@ const sortedRows: ComputedRef<Row[]> = computed(() => {
|
|
|
141
141
|
|
|
142
142
|
const isFooterSticky = computed(() => {
|
|
143
143
|
return (
|
|
144
|
-
window
|
|
144
|
+
Number(window?.innerHeight) < tableHeight.value &&
|
|
145
|
+
props.stickyFooter &&
|
|
146
|
+
!isShownFooterPosition.value
|
|
145
147
|
);
|
|
146
148
|
});
|
|
147
149
|
|
|
@@ -165,15 +167,15 @@ const isShownActionsHeader = computed(
|
|
|
165
167
|
|
|
166
168
|
const isHeaderSticky = computed(() => {
|
|
167
169
|
const positionForFixHeader =
|
|
168
|
-
Number(headerRowRef.value?.getBoundingClientRect()?.top) + window
|
|
170
|
+
Number(headerRowRef.value?.getBoundingClientRect()?.top) + Number(window?.scrollY) || 0;
|
|
169
171
|
|
|
170
172
|
return positionForFixHeader <= pagePositionY.value && props.stickyHeader;
|
|
171
173
|
});
|
|
172
174
|
|
|
173
175
|
const isShownFooterPosition = computed(() => {
|
|
174
|
-
const pageBottom = pagePositionY.value + window
|
|
176
|
+
const pageBottom = pagePositionY.value + Number(window?.innerHeight);
|
|
175
177
|
const positionForFixFooter =
|
|
176
|
-
Number(footerRowRef.value?.getBoundingClientRect()?.bottom) + window
|
|
178
|
+
Number(footerRowRef.value?.getBoundingClientRect()?.bottom) + Number(window?.scrollY);
|
|
177
179
|
|
|
178
180
|
return pageBottom >= positionForFixFooter;
|
|
179
181
|
});
|
|
@@ -310,7 +312,7 @@ function setHeaderCellWidth() {
|
|
|
310
312
|
}
|
|
311
313
|
|
|
312
314
|
function onScroll() {
|
|
313
|
-
pagePositionY.value = window
|
|
315
|
+
pagePositionY.value = Number(window?.scrollY);
|
|
314
316
|
}
|
|
315
317
|
|
|
316
318
|
function synchronizeTableItemsWithProps() {
|
|
@@ -78,6 +78,7 @@ const { config, wrapperAttrs, dropdownBadgeAttrs, dropdownListAttrs, dropdownIco
|
|
|
78
78
|
:size="size"
|
|
79
79
|
:color="color"
|
|
80
80
|
:variant="variant"
|
|
81
|
+
:round="round"
|
|
81
82
|
v-bind="dropdownBadgeAttrs"
|
|
82
83
|
tabindex="0"
|
|
83
84
|
:data-test="dataTest"
|
|
@@ -102,17 +103,15 @@ const { config, wrapperAttrs, dropdownBadgeAttrs, dropdownListAttrs, dropdownIco
|
|
|
102
103
|
<slot :label="label" :opened="isShownOptions" />
|
|
103
104
|
</template>
|
|
104
105
|
|
|
105
|
-
<template #right
|
|
106
|
+
<template #right>
|
|
106
107
|
<!--
|
|
107
108
|
@slot Use it to add something after the label.
|
|
108
109
|
@binding {boolean} opened
|
|
109
110
|
-->
|
|
110
|
-
<slot name="right" :opened="isShownOptions">
|
|
111
|
+
<slot v-if="!noIcon" name="right" :opened="isShownOptions">
|
|
111
112
|
<UIcon
|
|
112
|
-
v-if="!noIcon"
|
|
113
113
|
internal
|
|
114
114
|
color="inherit"
|
|
115
|
-
:size="iconSize"
|
|
116
115
|
:name="config.defaults.dropdownIcon"
|
|
117
116
|
v-bind="dropdownIconAttrs"
|
|
118
117
|
:data-test="`${dataTest}-dropdown`"
|
|
@@ -9,7 +9,16 @@ export default /*tw*/ {
|
|
|
9
9
|
},
|
|
10
10
|
compoundVariants: [{ opened: true, color: ["grayscale", "white"], class: "ring-gray-700/15" }],
|
|
11
11
|
},
|
|
12
|
-
dropdownIcon:
|
|
12
|
+
dropdownIcon: {
|
|
13
|
+
base: "{UIcon} transition duration-300 group-[]:rotate-180",
|
|
14
|
+
defaults: {
|
|
15
|
+
size: {
|
|
16
|
+
sm: "2xs",
|
|
17
|
+
md: "xs",
|
|
18
|
+
lg: "xs",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
13
22
|
dropdownList: {
|
|
14
23
|
base: "{UDropdownList} w-fit",
|
|
15
24
|
variants: {
|
|
@@ -110,9 +110,8 @@ const { config, dropdownButtonAttrs, dropdownListAttrs, dropdownIconAttrs, wrapp
|
|
|
110
110
|
@slot Use it to add something after the label.
|
|
111
111
|
@binding {boolean} opened
|
|
112
112
|
-->
|
|
113
|
-
<slot name="toggle" :opened="isShownOptions">
|
|
113
|
+
<slot v-if="!noIcon" name="toggle" :opened="isShownOptions">
|
|
114
114
|
<UIcon
|
|
115
|
-
v-if="!noIcon"
|
|
116
115
|
internal
|
|
117
116
|
color="inherit"
|
|
118
117
|
:name="config.defaults.dropdownIcon"
|
|
@@ -13,12 +13,12 @@ export default /*tw*/ {
|
|
|
13
13
|
base: "{UIcon} transition duration-300 group-[]:rotate-180",
|
|
14
14
|
defaults: {
|
|
15
15
|
size: {
|
|
16
|
-
"2xs": "
|
|
17
|
-
xs: "
|
|
16
|
+
"2xs": "2xs",
|
|
17
|
+
xs: "xs",
|
|
18
18
|
sm: "sm",
|
|
19
|
-
md: "
|
|
20
|
-
lg: "
|
|
21
|
-
xl: "
|
|
19
|
+
md: "sm",
|
|
20
|
+
lg: "sm",
|
|
21
|
+
xl: "sm",
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
24
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, useId } from "vue";
|
|
2
|
+
import { ref, computed, useId } from "vue";
|
|
3
3
|
|
|
4
4
|
import { vTooltip } from "../directives";
|
|
5
5
|
import useUI from "../composables/useUI.ts";
|
|
@@ -31,13 +31,16 @@ const emit = defineEmits([
|
|
|
31
31
|
|
|
32
32
|
const elementId = props.id || useId();
|
|
33
33
|
|
|
34
|
+
const localValue = ref("");
|
|
35
|
+
|
|
34
36
|
const selectedItem = computed({
|
|
35
|
-
get: () => props.modelValue,
|
|
37
|
+
get: () => props.modelValue || localValue.value,
|
|
36
38
|
set: (value) => emit("update:modelValue", value),
|
|
37
39
|
});
|
|
38
40
|
|
|
39
41
|
function onClickColor(color: string) {
|
|
40
42
|
selectedItem.value = color;
|
|
43
|
+
localValue.value = color;
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
/**
|
package/ui.form-input/config.ts
CHANGED
|
@@ -2,11 +2,14 @@ export default /*tw*/ {
|
|
|
2
2
|
inputLabel: "{ULabel}",
|
|
3
3
|
wrapper: {
|
|
4
4
|
base: `
|
|
5
|
-
w-full bg-white relative flex border border-gray-300 rounded-dynamic transition
|
|
5
|
+
w-full bg-white relative flex border border-gray-300 rounded-dynamic-sm transition
|
|
6
6
|
hover:border-gray-400 hover:focus-within:border-brand-500 focus-within:border-brand-500
|
|
7
7
|
focus-within:ring-dynamic focus-within:ring-offset-dynamic focus-within:ring-brand-700/15
|
|
8
8
|
`,
|
|
9
9
|
variants: {
|
|
10
|
+
labelAlign: {
|
|
11
|
+
topInside: "rounded-dynamic",
|
|
12
|
+
},
|
|
10
13
|
error: {
|
|
11
14
|
true: `
|
|
12
15
|
border-red-300 bg-red-50
|
|
@@ -53,9 +56,9 @@ export default /*tw*/ {
|
|
|
53
56
|
},
|
|
54
57
|
error: {
|
|
55
58
|
true: `
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
bg-red-50 placeholder:text-red-300 hover:border-red-400 focus:border-red-500 focus:ring-red-700/15
|
|
60
|
+
focus-within:border-red-500 focus-within:ring-red-700/15
|
|
61
|
+
`,
|
|
59
62
|
},
|
|
60
63
|
typePassword: {
|
|
61
64
|
true: "tracking-widest !leading-[1.18] [font-family:text-security-disc,serif] [-webkit-text-security:disc]",
|
package/ui.form-label/config.ts
CHANGED
|
@@ -3,9 +3,9 @@ export default /*tw*/ {
|
|
|
3
3
|
base: "flex w-full",
|
|
4
4
|
variants: {
|
|
5
5
|
align: {
|
|
6
|
-
top: "flex-col gap-2",
|
|
7
6
|
topInside: "flex-col gap-0 relative",
|
|
8
|
-
topWithDesc: "flex-col-reverse
|
|
7
|
+
topWithDesc: "flex-col-reverse gap-2",
|
|
8
|
+
top: "flex-col gap-2",
|
|
9
9
|
right: "flex-row w-fit",
|
|
10
10
|
left: "flex-row-reverse w-fit",
|
|
11
11
|
},
|
|
@@ -68,7 +68,7 @@ export default /*tw*/ {
|
|
|
68
68
|
lg: "text-sm",
|
|
69
69
|
},
|
|
70
70
|
align: {
|
|
71
|
-
top: "
|
|
71
|
+
top: "",
|
|
72
72
|
topInside: "pl-3 mt-1.5",
|
|
73
73
|
topWithDesc: "pt-0.5",
|
|
74
74
|
left: "pt-0.5",
|
package/ui.form-select/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, useId } from "vue";
|
|
2
|
+
import { ref, computed, useId } from "vue";
|
|
3
3
|
|
|
4
4
|
import useUI from "../composables/useUI.ts";
|
|
5
5
|
import { getDefaults } from "../utils/ui.ts";
|
|
@@ -42,8 +42,11 @@ const emit = defineEmits([
|
|
|
42
42
|
|
|
43
43
|
const elementId = props.id || useId();
|
|
44
44
|
|
|
45
|
+
const localBrand = ref("");
|
|
46
|
+
const localGray = ref("");
|
|
47
|
+
|
|
45
48
|
const selectedBrandColor = computed({
|
|
46
|
-
get: () => props.brand || getSelectedBrandColor(),
|
|
49
|
+
get: () => props.brand || localBrand.value || getSelectedBrandColor(),
|
|
47
50
|
set: (brand: string) => {
|
|
48
51
|
const prevBrand = getSelectedBrandColor();
|
|
49
52
|
const isBrandGrayscale = brand === GRAYSCALE_COLOR;
|
|
@@ -55,14 +58,16 @@ const selectedBrandColor = computed({
|
|
|
55
58
|
|
|
56
59
|
setTheme({ brand });
|
|
57
60
|
emit("update:brand", brand);
|
|
61
|
+
localBrand.value = brand;
|
|
58
62
|
},
|
|
59
63
|
});
|
|
60
64
|
|
|
61
65
|
const selectedGrayColor = computed({
|
|
62
|
-
get: () => props.gray || getSelectedGrayColor(),
|
|
63
|
-
set: (
|
|
64
|
-
setTheme({ gray
|
|
65
|
-
emit("update:gray",
|
|
66
|
+
get: () => props.gray || localGray.value || getSelectedGrayColor(),
|
|
67
|
+
set: (gray: string) => {
|
|
68
|
+
setTheme({ gray });
|
|
69
|
+
emit("update:gray", gray);
|
|
70
|
+
localGray.value = gray;
|
|
66
71
|
},
|
|
67
72
|
});
|
|
68
73
|
|
package/ui.text-badge/UBadge.vue
CHANGED
|
@@ -98,9 +98,9 @@ const { badgeAttrs, bodyAttrs, leftIconAttrs, centerIconAttrs, rightIconAttrs }
|
|
|
98
98
|
>
|
|
99
99
|
<div v-bind="bodyAttrs">
|
|
100
100
|
<!--
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
@slot Use it to add icon before the text.
|
|
102
|
+
@binding {string} icon-name
|
|
103
|
+
-->
|
|
104
104
|
<slot name="left" :icon-name="leftIcon">
|
|
105
105
|
<UIcon v-if="leftIcon" internal :name="leftIcon" color="inherit" v-bind="leftIconAttrs" />
|
|
106
106
|
</slot>
|
|
@@ -118,9 +118,9 @@ const { badgeAttrs, bodyAttrs, leftIconAttrs, centerIconAttrs, rightIconAttrs }
|
|
|
118
118
|
</slot>
|
|
119
119
|
|
|
120
120
|
<!--
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
@slot Use it to add icon after the text.
|
|
122
|
+
@binding {string} icon-name
|
|
123
|
+
-->
|
|
124
124
|
<slot name="right" :icon-name="rightIcon">
|
|
125
125
|
<UIcon
|
|
126
126
|
v-if="rightIcon"
|
package/utils/storybook.ts
CHANGED
|
@@ -100,37 +100,36 @@ export function getArgTypes(componentName: string | undefined) {
|
|
|
100
100
|
const type = attribute.value.type;
|
|
101
101
|
|
|
102
102
|
if (attribute.enum) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
table: {
|
|
107
|
-
defaultValue: { summary: attribute.default || "" },
|
|
108
|
-
type: { summary: attribute.enum.join(" | ") },
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
}
|
|
103
|
+
attribute.enum = attribute.enum.map((item) => {
|
|
104
|
+
if (item === "UnknownObject") return "Object";
|
|
105
|
+
if (item === "UnknownArray") return "Array";
|
|
112
106
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
control: "object",
|
|
116
|
-
table: {
|
|
117
|
-
defaultValue: { summary: attribute.default || "" },
|
|
118
|
-
type: { summary: attribute.enum.join(" | ") },
|
|
119
|
-
},
|
|
120
|
-
};
|
|
107
|
+
return item;
|
|
108
|
+
});
|
|
121
109
|
}
|
|
122
110
|
|
|
123
111
|
const nonUnionTypes = [
|
|
112
|
+
"null",
|
|
124
113
|
"string",
|
|
125
114
|
"number",
|
|
126
115
|
"boolean",
|
|
127
116
|
"Date",
|
|
128
|
-
"UnknownObject",
|
|
129
|
-
"UnknownArray",
|
|
130
117
|
"Array",
|
|
118
|
+
"Object",
|
|
119
|
+
"UnknownArray",
|
|
120
|
+
"UnknownObject",
|
|
131
121
|
];
|
|
132
122
|
|
|
133
|
-
if (attribute.enum?.
|
|
123
|
+
if (attribute.enum?.some((value) => !nonUnionTypes.includes(value))) {
|
|
124
|
+
types[attribute.name] = {
|
|
125
|
+
options: attribute.enum,
|
|
126
|
+
control: "select",
|
|
127
|
+
table: {
|
|
128
|
+
defaultValue: { summary: attribute.default || "" },
|
|
129
|
+
type: { summary: attribute.enum.join(" | ") },
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
} else if (attribute.enum?.some((value) => nonUnionTypes.includes(value))) {
|
|
134
133
|
let control = attribute.enum[0];
|
|
135
134
|
|
|
136
135
|
if (control === "string") {
|
|
@@ -145,6 +144,17 @@ export function getArgTypes(componentName: string | undefined) {
|
|
|
145
144
|
control: control as ArgType["control"],
|
|
146
145
|
table: {
|
|
147
146
|
defaultValue: { summary: attribute.default || "" },
|
|
147
|
+
type: { summary: attribute.enum.join(" | ") },
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (attribute.enum?.length === 1) {
|
|
153
|
+
types[attribute.name] = {
|
|
154
|
+
control: "object",
|
|
155
|
+
table: {
|
|
156
|
+
defaultValue: { summary: attribute.default || "" },
|
|
157
|
+
type: { summary: attribute.enum.join(" | ") },
|
|
148
158
|
},
|
|
149
159
|
};
|
|
150
160
|
}
|