vueless 0.0.286 → 0.0.288
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/composable.ui/index.js +3 -2
- package/constants/index.js +2 -1
- package/directive.tooltip/index.js +1 -0
- package/package.json +3 -3
- package/service.ui/index.js +3 -6
- package/ui.button/configs/default.config.js +15 -18
- package/ui.button/index.stories.js +6 -2
- package/ui.button/index.vue +98 -76
- package/ui.button-link/composables/attrs.composable.js +18 -28
- package/ui.button-link/configs/default.config.js +8 -6
- package/ui.button-link/index.stories.js +20 -1
- package/ui.button-link/index.vue +21 -26
- package/ui.button-toggle/configs/default.config.js +2 -2
- package/ui.button-toggle/index.stories.js +4 -4
- package/ui.button-toggle/index.vue +7 -7
- package/ui.button-toggle-item/configs/default.config.js +2 -2
- package/ui.button-toggle-item/index.vue +4 -4
- package/ui.container-accordion/configs/default.config.js +1 -1
- package/ui.container-accordion/index.vue +3 -3
- package/ui.container-card/configs/default.config.js +1 -1
- package/ui.container-card/index.stories.js +2 -2
- package/ui.container-card/index.vue +3 -3
- package/ui.container-col/configs/default.config.js +1 -1
- package/ui.container-col/index.vue +3 -3
- package/ui.container-divider/configs/default.config.js +1 -1
- package/ui.container-divider/index.vue +3 -3
- package/ui.container-group/configs/default.config.js +1 -1
- package/ui.container-group/index.vue +3 -3
- package/ui.container-modal/configs/default.config.js +1 -1
- package/ui.container-modal/index.vue +5 -5
- package/ui.container-modal-confirm/configs/default.config.js +1 -1
- package/ui.container-modal-confirm/index.vue +5 -5
- package/ui.container-page/configs/default.config.js +2 -2
- package/ui.container-page/index.stories.js +2 -2
- package/ui.container-page/index.vue +25 -14
- package/ui.container-row/configs/default.config.js +1 -1
- package/ui.container-row/index.vue +3 -3
- package/ui.data-list/configs/default.config.js +1 -1
- package/ui.data-list/index.vue +8 -8
- package/ui.data-table/components/TableRow.vue +5 -5
- package/ui.data-table/configs/default.config.js +1 -1
- package/ui.data-table/index.stories.js +1 -1
- package/ui.data-table/index.vue +8 -8
- package/ui.dropdown-badge/configs/default.config.js +1 -1
- package/ui.dropdown-badge/index.vue +5 -5
- package/ui.dropdown-button/configs/default.config.js +2 -2
- package/ui.dropdown-button/index.vue +8 -8
- package/ui.dropdown-item/index.vue +3 -3
- package/ui.dropdown-link/configs/default.config.js +1 -1
- package/ui.dropdown-link/index.vue +5 -5
- package/ui.dropdown-list/configs/default.config.js +1 -1
- package/ui.dropdown-list/index.vue +1 -1
- package/ui.form-calendar/configs/default.config.js +1 -1
- package/ui.form-calendar/index.vue +2 -2
- package/ui.form-checkbox/configs/default.config.js +1 -1
- package/ui.form-checkbox/index.vue +4 -4
- package/ui.form-checkbox-group/configs/default.config.js +1 -1
- package/ui.form-checkbox-group/index.vue +4 -4
- package/ui.form-checkbox-multi-state/configs/default.config.js +1 -1
- package/ui.form-checkbox-multi-state/index.vue +2 -2
- package/ui.form-color-picker/configs/default.config.js +1 -1
- package/ui.form-color-picker/index.vue +3 -3
- package/ui.form-date-picker/configs/default.config.js +1 -1
- package/ui.form-date-picker/index.vue +2 -2
- package/ui.form-date-picker-range/configs/default.config.js +1 -1
- package/ui.form-date-picker-range/index.vue +2 -2
- package/ui.form-input/configs/default.config.js +3 -3
- package/ui.form-input/index.vue +4 -4
- package/ui.form-input-file/configs/default.config.js +2 -2
- package/ui.form-input-file/index.vue +21 -20
- package/ui.form-input-money/configs/default.config.js +1 -1
- package/ui.form-input-money/index.vue +3 -3
- package/ui.form-input-number/configs/default.config.js +1 -1
- package/ui.form-input-number/index.vue +7 -7
- package/ui.form-input-rating/configs/default.config.js +1 -1
- package/ui.form-input-rating/index.vue +4 -4
- package/ui.form-input-search/configs/default.config.js +1 -1
- package/ui.form-input-search/index.vue +6 -6
- package/ui.form-label/configs/default.config.js +1 -1
- package/ui.form-label/index.vue +8 -8
- package/ui.form-radio/configs/default.config.js +1 -1
- package/ui.form-radio/index.vue +4 -4
- package/ui.form-radio-group/configs/default.config.js +1 -1
- package/ui.form-radio-group/index.vue +4 -4
- package/ui.form-select/configs/default.config.js +1 -1
- package/ui.form-select/index.vue +3 -3
- package/ui.form-switch/configs/default.config.js +1 -1
- package/ui.form-switch/index.vue +3 -3
- package/ui.form-textarea/configs/default.config.js +1 -1
- package/ui.form-textarea/index.vue +4 -4
- package/ui.image-avatar/configs/default.config.js +1 -1
- package/ui.image-avatar/index.vue +3 -3
- package/ui.image-icon/configs/default.config.js +4 -48
- package/ui.image-icon/index.stories.js +0 -3
- package/ui.image-icon/index.vue +16 -45
- package/ui.loader/configs/default.config.js +1 -1
- package/ui.loader-rendering/configs/default.config.js +1 -1
- package/ui.loader-top/configs/default.config.js +1 -1
- package/ui.navigation-pagination/configs/default.config.js +1 -1
- package/ui.navigation-pagination/index.vue +7 -7
- package/ui.navigation-progress/components/StepperProgress.vue +1 -1
- package/ui.navigation-progress/configs/default.config.js +1 -1
- package/ui.navigation-progress/index.vue +3 -3
- package/ui.navigation-tab/configs/default.config.js +1 -1
- package/ui.navigation-tab/index.vue +3 -3
- package/ui.navigation-tabs/configs/default.config.js +1 -1
- package/ui.navigation-tabs/index.vue +4 -4
- package/ui.other-dot/configs/default.config.js +1 -1
- package/ui.other-dot/index.vue +3 -3
- package/ui.text-alert/configs/default.config.js +1 -1
- package/ui.text-alert/index.vue +4 -4
- package/ui.text-badge/configs/default.config.js +1 -1
- package/ui.text-badge/index.vue +3 -3
- package/ui.text-block/configs/default.config.js +1 -1
- package/ui.text-block/index.vue +3 -3
- package/ui.text-empty/configs/default.config.js +14 -4
- package/ui.text-empty/index.stories.js +0 -1
- package/ui.text-empty/index.vue +22 -13
- package/ui.text-file/configs/default.config.js +2 -2
- package/ui.text-file/index.vue +3 -3
- package/ui.text-files/configs/default.config.js +1 -1
- package/ui.text-files/index.vue +3 -3
- package/ui.text-header/configs/default.config.js +1 -1
- package/ui.text-header/index.vue +3 -3
- package/ui.text-money/configs/default.config.js +1 -1
- package/ui.text-money/index.vue +3 -3
- package/ui.text-notify/configs/default.config.js +1 -1
- package/ui.text-notify/index.vue +3 -3
- package/web-types.json +169 -150
package/composable.ui/index.js
CHANGED
|
@@ -83,7 +83,7 @@ export default function useUI(defaultConfig = {}, propsConfigGetter = null, topL
|
|
|
83
83
|
|
|
84
84
|
const configAttrs = {
|
|
85
85
|
config: configKeyValue,
|
|
86
|
-
...configKeyValue?.
|
|
86
|
+
...configKeyValue?.defaults,
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
const isTopLevelClassKey = configKey === (topLevelClassKey || firstClassKey);
|
|
@@ -192,6 +192,7 @@ function mergeConfigs({
|
|
|
192
192
|
|
|
193
193
|
const {
|
|
194
194
|
i18n,
|
|
195
|
+
defaults,
|
|
195
196
|
strategy,
|
|
196
197
|
safelist,
|
|
197
198
|
component,
|
|
@@ -217,7 +218,7 @@ function mergeConfigs({
|
|
|
217
218
|
}
|
|
218
219
|
} else if (key === strategy) {
|
|
219
220
|
config[key] = propsConfig[key] || globalConfig[key] || defaultConfig[key];
|
|
220
|
-
} else if (key === defaultVariants) {
|
|
221
|
+
} else if (key === defaults || key === defaultVariants) {
|
|
221
222
|
config[key] = { ...defaultConfig[key], ...globalConfig[key], ...propsConfig[key] };
|
|
222
223
|
} else if (key === compoundVariants) {
|
|
223
224
|
config[key] = mergeCompoundVariants({
|
package/constants/index.js
CHANGED
|
@@ -56,11 +56,12 @@ export const CVA_CONFIG_KEY = {
|
|
|
56
56
|
/* Vueless default config keys */
|
|
57
57
|
export const SYSTEM_CONFIG_KEY = {
|
|
58
58
|
i18n: "i18n",
|
|
59
|
+
defaults: "defaults",
|
|
59
60
|
strategy: "strategy",
|
|
60
61
|
safelist: "safelist",
|
|
61
62
|
component: "component",
|
|
62
|
-
safelistColors: "safelistColors",
|
|
63
63
|
transition: "transition",
|
|
64
|
+
safelistColors: "safelistColors",
|
|
64
65
|
iconName: "iconName",
|
|
65
66
|
...CVA_CONFIG_KEY,
|
|
66
67
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.288",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Vue Styleless Component Framework.",
|
|
6
6
|
"homepage": "https://vueless.com",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"@release-it/bumper": "^6.0.1",
|
|
38
38
|
"@vitejs/plugin-vue": "^5.0.5",
|
|
39
39
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
40
|
-
"@vueless/plugin-vite": "^0.0.
|
|
40
|
+
"@vueless/plugin-vite": "^0.0.54",
|
|
41
41
|
"@vueless/storybook": "^0.0.34",
|
|
42
|
-
"@vueless/web-types": "^0.0.
|
|
42
|
+
"@vueless/web-types": "^0.0.14",
|
|
43
43
|
"autoprefixer": "^10.4.19",
|
|
44
44
|
"cssnano": "^6.1.2",
|
|
45
45
|
"eslint": "^8.55.0",
|
package/service.ui/index.js
CHANGED
|
@@ -132,14 +132,11 @@ function setFavicon(faviconPath) {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
function getDefault(defaultConfig, name) {
|
|
135
|
-
const
|
|
136
|
-
cloneDeep(defaultConfig.defaultVariants),
|
|
137
|
-
globalComponentConfig[name]?.defaultVariants,
|
|
138
|
-
);
|
|
135
|
+
const defaults = merge(cloneDeep(defaultConfig.defaults), globalComponentConfig[name]?.defaults);
|
|
139
136
|
|
|
140
|
-
|
|
137
|
+
defaults.color = getColor(defaults.color);
|
|
141
138
|
|
|
142
|
-
return
|
|
139
|
+
return defaults;
|
|
143
140
|
}
|
|
144
141
|
|
|
145
142
|
function getColor(color) {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
button: {
|
|
3
3
|
base: `
|
|
4
|
-
flex items-center justify-center
|
|
5
|
-
font-medium outline-none
|
|
6
|
-
border border-solid transition
|
|
4
|
+
flex items-center justify-center transition
|
|
5
|
+
border font-medium outline-none whitespace-nowrap
|
|
7
6
|
focus:ring-{color}-700/15 focus:ring-dynamic focus:ring-offset-dynamic
|
|
8
7
|
focus-within:ring-{color}-700/15 focus-within:ring-dynamic focus-within:ring-offset-dynamic
|
|
9
8
|
disabled:ring-0 disabled:ring-offset-0 disabled:cursor-not-allowed cursor-pointer
|
|
@@ -42,22 +41,22 @@ export default /*tw*/ {
|
|
|
42
41
|
disabled:text-gray-400 disabled:bg-transparent
|
|
43
42
|
`,
|
|
44
43
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
round: {
|
|
45
|
+
false: "rounded-dynamic",
|
|
46
|
+
true: "rounded-full",
|
|
47
|
+
},
|
|
48
|
+
noRing: {
|
|
49
|
+
true: "focus:ring-0 focus:ring-offset-0 focus-within:ring-0 focus-within:ring-offset-0",
|
|
48
50
|
},
|
|
49
51
|
loading: {
|
|
50
52
|
true: "pointer-events-none gap-0",
|
|
51
53
|
},
|
|
52
|
-
pill: {
|
|
53
|
-
false: "rounded-dynamic",
|
|
54
|
-
true: "rounded-full",
|
|
55
|
-
},
|
|
56
54
|
block: {
|
|
57
55
|
true: "w-full",
|
|
58
56
|
},
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
color: {
|
|
58
|
+
grayscale: "focus:ring-gray-700/15 focus-within:ring-gray-700/15",
|
|
59
|
+
white: "focus:ring-gray-700/15 focus-within:ring-gray-700/15",
|
|
61
60
|
},
|
|
62
61
|
},
|
|
63
62
|
compoundVariants: [
|
|
@@ -144,15 +143,16 @@ export default /*tw*/ {
|
|
|
144
143
|
{ square: true, size: "xl", class: "p-4" },
|
|
145
144
|
],
|
|
146
145
|
},
|
|
147
|
-
|
|
146
|
+
loader: "{ULoader}",
|
|
148
147
|
leftIcon: "{UIcon}",
|
|
149
148
|
rightIcon: "{UIcon}",
|
|
150
|
-
|
|
149
|
+
centerIcon: "{UIcon}",
|
|
150
|
+
defaults: {
|
|
151
151
|
color: "brand",
|
|
152
152
|
variant: "primary",
|
|
153
153
|
tag: "button",
|
|
154
154
|
size: "md",
|
|
155
|
-
|
|
155
|
+
round: false,
|
|
156
156
|
block: false,
|
|
157
157
|
square: false,
|
|
158
158
|
filled: false,
|
|
@@ -164,15 +164,12 @@ export default /*tw*/ {
|
|
|
164
164
|
{ pattern: `border-(${colors})-600` },
|
|
165
165
|
{ pattern: `border-(${colors})-700`, variants: ["hover", "focus"] },
|
|
166
166
|
{ pattern: `border-(${colors})-800`, variants: ["active"] },
|
|
167
|
-
{ pattern: `border-(${colors})-300`, variants: ["disabled"] },
|
|
168
167
|
{ pattern: `bg-(${colors})-600` },
|
|
169
168
|
{ pattern: `bg-(${colors})-700`, variants: ["hover", "focus"] },
|
|
170
169
|
{ pattern: `bg-(${colors})-800`, variants: ["active"] },
|
|
171
|
-
{ pattern: `bg-(${colors})-300`, variants: ["disabled"] },
|
|
172
170
|
{ pattern: `text-(${colors})-600` },
|
|
173
171
|
{ pattern: `text-(${colors})-700`, variants: ["hover", "focus"] },
|
|
174
172
|
{ pattern: `text-(${colors})-800`, variants: ["active"] },
|
|
175
|
-
{ pattern: `text-(${colors})-300`, variants: ["disabled"] },
|
|
176
173
|
{ pattern: `ring-(${colors})-700`, variants: ["focus", "focus-within"] },
|
|
177
174
|
],
|
|
178
175
|
};
|
|
@@ -88,8 +88,8 @@ variants.args = { enum: "variant" };
|
|
|
88
88
|
export const sizes = EnumVariantTemplate.bind({});
|
|
89
89
|
sizes.args = { enum: "size" };
|
|
90
90
|
|
|
91
|
-
export const
|
|
92
|
-
|
|
91
|
+
export const round = EnumVariantTemplate.bind({});
|
|
92
|
+
round.args = { enum: "variant", round: true };
|
|
93
93
|
|
|
94
94
|
export const disabled = EnumVariantTemplate.bind({});
|
|
95
95
|
disabled.args = { enum: "variant", disabled: true };
|
|
@@ -126,6 +126,7 @@ leftIconSlot.args = {
|
|
|
126
126
|
<UIcon
|
|
127
127
|
name="star"
|
|
128
128
|
color="green"
|
|
129
|
+
size="sm"
|
|
129
130
|
/>
|
|
130
131
|
</template>
|
|
131
132
|
`,
|
|
@@ -138,6 +139,7 @@ rightIconSlot.args = {
|
|
|
138
139
|
<UIcon
|
|
139
140
|
name="star"
|
|
140
141
|
color="green"
|
|
142
|
+
size="sm"
|
|
141
143
|
/>
|
|
142
144
|
</template>
|
|
143
145
|
`,
|
|
@@ -150,6 +152,7 @@ leftSlot.args = {
|
|
|
150
152
|
<UIcon
|
|
151
153
|
name="archive"
|
|
152
154
|
color="red"
|
|
155
|
+
size="sm"
|
|
153
156
|
/>
|
|
154
157
|
</template>
|
|
155
158
|
`,
|
|
@@ -162,6 +165,7 @@ rightSlot.args = {
|
|
|
162
165
|
<UIcon
|
|
163
166
|
name="archive"
|
|
164
167
|
color="red"
|
|
168
|
+
size="sm"
|
|
165
169
|
/>
|
|
166
170
|
</template>
|
|
167
171
|
`,
|
package/ui.button/index.vue
CHANGED
|
@@ -4,78 +4,92 @@
|
|
|
4
4
|
:id="id"
|
|
5
5
|
ref="buttonRef"
|
|
6
6
|
:disabled="disabled"
|
|
7
|
-
:data-cy="dataCy"
|
|
8
7
|
v-bind="buttonAttrs"
|
|
8
|
+
:tabindex="loading && '-1'"
|
|
9
|
+
:data-test="dataTest"
|
|
9
10
|
>
|
|
10
11
|
<template v-if="loading">
|
|
11
12
|
<!-- Label is needed to prevent changing button height -->
|
|
12
|
-
<div
|
|
13
|
+
<div tabindex="-1" class="invisible w-0" v-text="label" />
|
|
13
14
|
<ULoader :loading="loading" :size="loaderSize" :color="componentColor" v-bind="loaderAttrs" />
|
|
14
15
|
</template>
|
|
15
16
|
|
|
16
17
|
<template v-else>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<!-- @slot Use it to add something before the text. -->
|
|
18
|
+
<!--
|
|
19
|
+
@slot Use it to add icon before the label.
|
|
20
|
+
@binding {string} icon-name
|
|
21
|
+
@binding {string} icon-size
|
|
22
|
+
@binding {string} icon-color
|
|
23
|
+
-->
|
|
24
|
+
<slot
|
|
25
|
+
name="left-icon"
|
|
26
|
+
:icon-name="leftIcon"
|
|
27
|
+
:icon-size="iconSize"
|
|
28
|
+
:icon-color="componentColor"
|
|
29
|
+
>
|
|
30
|
+
<UIcon
|
|
31
|
+
v-if="leftIcon"
|
|
32
|
+
internal
|
|
33
|
+
:name="leftIcon"
|
|
34
|
+
:size="iconSize"
|
|
35
|
+
:color="componentColor"
|
|
36
|
+
v-bind="leftIconAttrs"
|
|
37
|
+
/>
|
|
38
|
+
</slot>
|
|
39
|
+
|
|
40
|
+
<!-- @slot Use it to add something before the label. -->
|
|
42
41
|
<slot name="left" />
|
|
43
42
|
|
|
44
|
-
<!--
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
<!--
|
|
44
|
+
@slot Use it to add something instead of the label.
|
|
45
|
+
@binding {string} icon-name
|
|
46
|
+
@binding {string} icon-size
|
|
47
|
+
@binding {string} icon-color
|
|
48
|
+
-->
|
|
49
|
+
<slot
|
|
50
|
+
name="default"
|
|
51
|
+
:label="label"
|
|
52
|
+
:icon-name="icon"
|
|
53
|
+
:icon-size="iconSize"
|
|
54
|
+
:icon-color="componentColor"
|
|
55
|
+
>
|
|
56
|
+
<UIcon
|
|
57
|
+
v-if="icon"
|
|
58
|
+
internal
|
|
59
|
+
:name="icon"
|
|
60
|
+
:size="iconSize"
|
|
61
|
+
:color="componentColor"
|
|
62
|
+
v-bind="centerIconAttrs"
|
|
63
|
+
/>
|
|
64
|
+
<template v-else>
|
|
65
|
+
{{ label }}
|
|
66
|
+
</template>
|
|
67
|
+
</slot>
|
|
68
|
+
|
|
69
|
+
<!-- @slot Use it to add something after the label. -->
|
|
54
70
|
<slot name="right" />
|
|
55
71
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
</slot>
|
|
78
|
-
</div>
|
|
72
|
+
<!--
|
|
73
|
+
@slot Use it to add icon after the label.
|
|
74
|
+
@binding {string} icon-name
|
|
75
|
+
@binding {string} icon-size
|
|
76
|
+
@binding {string} icon-color
|
|
77
|
+
-->
|
|
78
|
+
<slot
|
|
79
|
+
name="right-icon"
|
|
80
|
+
:icon-name="rightIcon"
|
|
81
|
+
:icon-size="iconSize"
|
|
82
|
+
:icon-color="componentColor"
|
|
83
|
+
>
|
|
84
|
+
<UIcon
|
|
85
|
+
v-if="rightIcon"
|
|
86
|
+
internal
|
|
87
|
+
:name="rightIcon"
|
|
88
|
+
:size="iconSize"
|
|
89
|
+
:color="componentColor"
|
|
90
|
+
v-bind="rightIconAttrs"
|
|
91
|
+
/>
|
|
92
|
+
</slot>
|
|
79
93
|
</template>
|
|
80
94
|
</component>
|
|
81
95
|
</template>
|
|
@@ -123,35 +137,43 @@ const props = defineProps({
|
|
|
123
137
|
},
|
|
124
138
|
|
|
125
139
|
/**
|
|
126
|
-
*
|
|
140
|
+
* Button label.
|
|
127
141
|
*/
|
|
128
|
-
|
|
142
|
+
label: {
|
|
129
143
|
type: String,
|
|
130
144
|
default: "",
|
|
131
145
|
},
|
|
132
146
|
|
|
133
147
|
/**
|
|
134
|
-
*
|
|
148
|
+
* Allows changing button html tag.
|
|
135
149
|
*/
|
|
136
|
-
|
|
150
|
+
tag: {
|
|
151
|
+
type: String,
|
|
152
|
+
default: getDefault(defaultConfig, UButton).tag,
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Icon name (appears instead of label).
|
|
157
|
+
*/
|
|
158
|
+
icon: {
|
|
137
159
|
type: String,
|
|
138
160
|
default: "",
|
|
139
161
|
},
|
|
140
162
|
|
|
141
163
|
/**
|
|
142
|
-
*
|
|
164
|
+
* Left side icon name.
|
|
143
165
|
*/
|
|
144
|
-
|
|
166
|
+
leftIcon: {
|
|
145
167
|
type: String,
|
|
146
168
|
default: "",
|
|
147
169
|
},
|
|
148
170
|
|
|
149
171
|
/**
|
|
150
|
-
*
|
|
172
|
+
* Right side icon name.
|
|
151
173
|
*/
|
|
152
|
-
|
|
174
|
+
rightIcon: {
|
|
153
175
|
type: String,
|
|
154
|
-
default:
|
|
176
|
+
default: "",
|
|
155
177
|
},
|
|
156
178
|
|
|
157
179
|
/**
|
|
@@ -181,9 +203,9 @@ const props = defineProps({
|
|
|
181
203
|
/**
|
|
182
204
|
* Set button corners rounded.
|
|
183
205
|
*/
|
|
184
|
-
|
|
206
|
+
round: {
|
|
185
207
|
type: Boolean,
|
|
186
|
-
default: getDefault(defaultConfig, UButton).
|
|
208
|
+
default: getDefault(defaultConfig, UButton).round,
|
|
187
209
|
},
|
|
188
210
|
|
|
189
211
|
/**
|
|
@@ -203,7 +225,7 @@ const props = defineProps({
|
|
|
203
225
|
},
|
|
204
226
|
|
|
205
227
|
/**
|
|
206
|
-
* Remove
|
|
228
|
+
* Remove button ring on focus.
|
|
207
229
|
*/
|
|
208
230
|
noRing: {
|
|
209
231
|
type: Boolean,
|
|
@@ -228,15 +250,15 @@ const props = defineProps({
|
|
|
228
250
|
},
|
|
229
251
|
|
|
230
252
|
/**
|
|
231
|
-
* Data-
|
|
253
|
+
* Data-test attribute for automated testing.
|
|
232
254
|
*/
|
|
233
|
-
|
|
255
|
+
dataTest: {
|
|
234
256
|
type: String,
|
|
235
257
|
default: "",
|
|
236
258
|
},
|
|
237
259
|
});
|
|
238
260
|
|
|
239
|
-
const { buttonAttrs, loaderAttrs,
|
|
261
|
+
const { buttonAttrs, loaderAttrs, leftIconAttrs, rightIconAttrs, centerIconAttrs } =
|
|
240
262
|
useAttrs(props);
|
|
241
263
|
|
|
242
264
|
const buttonRef = ref(null);
|
|
@@ -258,7 +280,7 @@ const loaderSize = computed(() => {
|
|
|
258
280
|
|
|
259
281
|
const iconSize = computed(() => {
|
|
260
282
|
const sizes = {
|
|
261
|
-
"2xs": "
|
|
283
|
+
"2xs": "2xs",
|
|
262
284
|
xs: "xs",
|
|
263
285
|
sm: "sm",
|
|
264
286
|
md: "sm",
|
|
@@ -33,39 +33,29 @@ export default function useAttrs(props, { isActive, isExactActive }) {
|
|
|
33
33
|
if (key === "wrapper") {
|
|
34
34
|
const wrapperAttrs = attrs[`${key}Attrs`];
|
|
35
35
|
|
|
36
|
-
attrs[`${key}Attrs`] = computed(() => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
(hasDefaultSlot || hasLeftSlot || hasRightSlot) && config.value.withSlots,
|
|
46
|
-
isActive.value && props.wrapperActiveClass,
|
|
47
|
-
isExactActive.value && props.wrapperExactActiveClass,
|
|
48
|
-
]),
|
|
49
|
-
};
|
|
50
|
-
});
|
|
36
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
37
|
+
...wrapperAttrs.value,
|
|
38
|
+
class: cx([
|
|
39
|
+
wrapperAttrs.value.class,
|
|
40
|
+
hasSlotContent(slots["default"]) && config.value.withChild,
|
|
41
|
+
isActive.value && props.wrapperActiveClass,
|
|
42
|
+
isExactActive.value && props.wrapperExactActiveClass,
|
|
43
|
+
]),
|
|
44
|
+
}));
|
|
51
45
|
}
|
|
52
46
|
|
|
53
47
|
if (key === "link") {
|
|
54
48
|
const linkAttrs = attrs[`${key}Attrs`];
|
|
55
49
|
|
|
56
|
-
attrs[`${key}Attrs`] = computed(() => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
isExactActive.value && props.exactActiveClass,
|
|
66
|
-
]),
|
|
67
|
-
};
|
|
68
|
-
});
|
|
50
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
51
|
+
...linkAttrs.value,
|
|
52
|
+
class: cx([
|
|
53
|
+
linkAttrs.value.class,
|
|
54
|
+
hasSlotContent(slots["default"]) && config.value.withChild,
|
|
55
|
+
isActive.value && props.activeClass,
|
|
56
|
+
isExactActive.value && props.exactActiveClass,
|
|
57
|
+
]),
|
|
58
|
+
}));
|
|
69
59
|
}
|
|
70
60
|
}
|
|
71
61
|
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
wrapper: {
|
|
3
3
|
base: `
|
|
4
|
-
w-fit inline-flex rounded transition focus-visible:outline-none
|
|
4
|
+
w-fit inline-flex items-center rounded transition focus-visible:outline-none
|
|
5
5
|
focus-within:ring-dynamic focus-within:ring-offset-4 focus-within:ring-{color}-700/15
|
|
6
6
|
`,
|
|
7
7
|
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
sm: "gap-1",
|
|
10
|
+
md: "gap-1.5",
|
|
11
|
+
lg: "gap-1.5",
|
|
12
|
+
},
|
|
8
13
|
color: {
|
|
9
14
|
grayscale: "focus-within:ring-gray-700/15",
|
|
10
15
|
white: "focus-within:ring-white/15",
|
|
@@ -56,11 +61,8 @@ export default /*tw*/ {
|
|
|
56
61
|
},
|
|
57
62
|
},
|
|
58
63
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
leftSlot: "mr-1",
|
|
62
|
-
rightSlot: "ml-1",
|
|
63
|
-
defaultVariants: {
|
|
64
|
+
withChild: "flex items-center no-underline hover:no-underline focus-within:ring-0 focus-within:ring-offset-0",
|
|
65
|
+
defaults: {
|
|
64
66
|
color: "brand",
|
|
65
67
|
type: "link",
|
|
66
68
|
size: "md",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getArgTypes, getSlotNames, getSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import ULink from "../ui.button-link";
|
|
4
|
+
import UIcon from "../ui.image-icon";
|
|
4
5
|
import UButton from "../ui.button";
|
|
5
6
|
import URow from "../ui.container-row";
|
|
6
7
|
|
|
@@ -21,7 +22,7 @@ export default {
|
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
const DefaultTemplate = (args) => ({
|
|
24
|
-
components: { ULink, UButton },
|
|
25
|
+
components: { ULink, UButton, UIcon },
|
|
25
26
|
setup() {
|
|
26
27
|
const slots = getSlotNames(ULink.name);
|
|
27
28
|
|
|
@@ -106,3 +107,21 @@ slotDefault.args = {
|
|
|
106
107
|
</template>
|
|
107
108
|
`,
|
|
108
109
|
};
|
|
110
|
+
|
|
111
|
+
export const slotLeft = DefaultTemplate.bind({});
|
|
112
|
+
slotLeft.args = {
|
|
113
|
+
slotTemplate: `
|
|
114
|
+
<template #left>
|
|
115
|
+
<UIcon name="star" size="xs" />
|
|
116
|
+
</template>
|
|
117
|
+
`,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const slotRight = DefaultTemplate.bind({});
|
|
121
|
+
slotRight.args = {
|
|
122
|
+
slotTemplate: `
|
|
123
|
+
<template #right>
|
|
124
|
+
<UIcon name="star" size="xs" />
|
|
125
|
+
</template>
|
|
126
|
+
`,
|
|
127
|
+
};
|