vueless 0.0.628 → 0.0.630
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/constants.js +17 -15
- package/package.json +4 -5
- package/plugin-vite.js +5 -0
- package/preset-tailwind.js +6 -0
- package/types.ts +12 -0
- package/ui.button-link/config.ts +6 -0
- package/ui.button-toggle-item/config.ts +1 -0
- package/ui.container-card/config.ts +1 -1
- package/ui.form-checkbox/config.ts +2 -2
- package/ui.form-date-picker/UDatePicker.vue +8 -14
- package/ui.form-date-picker/storybook/stories.ts +0 -24
- package/ui.form-date-picker-range/UDatePickerRange.vue +9 -16
- package/ui.form-date-picker-range/storybook/stories.ts +0 -26
- package/ui.form-input/UInput.vue +21 -23
- package/ui.form-input/config.ts +3 -2
- package/ui.form-input/storybook/stories.ts +2 -27
- package/ui.form-input-money/UInputMoney.vue +10 -14
- package/ui.form-input-money/storybook/stories.ts +0 -24
- package/ui.form-input-search/UInputSearch.vue +16 -18
- package/ui.form-input-search/config.ts +4 -0
- package/ui.form-input-search/storybook/stories.ts +2 -26
- package/ui.form-label/config.ts +6 -11
- package/ui.form-select/USelect.vue +10 -22
- package/ui.form-select/config.ts +3 -3
- package/ui.form-select/storybook/stories.ts +0 -18
- package/utils/node/webTypes.js +12 -0
- package/utils/theme.ts +6 -0
- package/web-types.json +0 -11868
package/constants.js
CHANGED
|
@@ -21,7 +21,9 @@ export const DEFAULT_RING = 4; /* pixels */
|
|
|
21
21
|
export const DEFAULT_RING_OFFSET = 0; /* pixels */
|
|
22
22
|
export const DEFAULT_RING_OFFSET_COLOR_LIGHT = "#ffffff"; // white
|
|
23
23
|
export const DEFAULT_RING_OFFSET_COLOR_DARK = "#111827"; // gray-900
|
|
24
|
+
export const DEFAULT_ROUNDING_SM = 4; /* pixels */
|
|
24
25
|
export const DEFAULT_ROUNDING = 8; /* pixels */
|
|
26
|
+
export const DEFAULT_ROUNDING_LG = 16; /* pixels */
|
|
25
27
|
|
|
26
28
|
/* Vueless supported colors and shades */
|
|
27
29
|
export const COLOR_SHADES = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
@@ -171,21 +173,21 @@ export const TAILWIND_MERGE_EXTENSION = {
|
|
|
171
173
|
"ring-offset-w": [{ "ring-offset": ["dynamic"] }],
|
|
172
174
|
"ring-offset-color": [{ "ring-offset": ["color-dynamic"] }],
|
|
173
175
|
"font-size": [{ text: ["2xs"] }],
|
|
174
|
-
rounded: [{ rounded: ["dynamic", "inherit"] }],
|
|
175
|
-
"rounded-s": [{ "rounded-s": ["dynamic", "inherit"] }],
|
|
176
|
-
"rounded-e": [{ "rounded-e": ["dynamic", "inherit"] }],
|
|
177
|
-
"rounded-t": [{ "rounded-t": ["dynamic", "inherit"] }],
|
|
178
|
-
"rounded-r": [{ "rounded-r": ["dynamic", "inherit"] }],
|
|
179
|
-
"rounded-b": [{ "rounded-b": ["dynamic", "inherit"] }],
|
|
180
|
-
"rounded-l": [{ "rounded-l": ["dynamic", "inherit"] }],
|
|
181
|
-
"rounded-ss": [{ "rounded-ss": ["dynamic", "inherit"] }],
|
|
182
|
-
"rounded-se": [{ "rounded-se": ["dynamic", "inherit"] }],
|
|
183
|
-
"rounded-ee": [{ "rounded-ee": ["dynamic", "inherit"] }],
|
|
184
|
-
"rounded-es": [{ "rounded-es": ["dynamic", "inherit"] }],
|
|
185
|
-
"rounded-tl": [{ "rounded-tl": ["dynamic", "inherit"] }],
|
|
186
|
-
"rounded-tr": [{ "rounded-tr": ["dynamic", "inherit"] }],
|
|
187
|
-
"rounded-br": [{ "rounded-br": ["dynamic", "inherit"] }],
|
|
188
|
-
"rounded-bl": [{ "rounded-bl": ["dynamic", "inherit"] }],
|
|
176
|
+
rounded: [{ rounded: ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
177
|
+
"rounded-s": [{ "rounded-s": ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
178
|
+
"rounded-e": [{ "rounded-e": ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
179
|
+
"rounded-t": [{ "rounded-t": ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
180
|
+
"rounded-r": [{ "rounded-r": ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
181
|
+
"rounded-b": [{ "rounded-b": ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
182
|
+
"rounded-l": [{ "rounded-l": ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
183
|
+
"rounded-ss": [{ "rounded-ss": ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
184
|
+
"rounded-se": [{ "rounded-se": ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
185
|
+
"rounded-ee": [{ "rounded-ee": ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
186
|
+
"rounded-es": [{ "rounded-es": ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
187
|
+
"rounded-tl": [{ "rounded-tl": ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
188
|
+
"rounded-tr": [{ "rounded-tr": ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
189
|
+
"rounded-br": [{ "rounded-br": ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
190
|
+
"rounded-bl": [{ "rounded-bl": ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
|
|
189
191
|
},
|
|
190
192
|
},
|
|
191
193
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.630",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
|
|
6
6
|
"keywords": [
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
|
-
"pre:start": "npx
|
|
30
|
+
"pre:start": "npx node .scripts/icons",
|
|
31
31
|
"dev:docs": "npm run pre:start && storybook dev -p 6006 --docs --no-open",
|
|
32
32
|
"dev": "npm run pre:start && STORYBOOK_FULL=1 storybook dev -p 6006 --no-open",
|
|
33
33
|
"build": "npm run pre:start && storybook build --docs",
|
|
34
34
|
"preview": "vite preview --host --outDir=storybook-static",
|
|
35
35
|
"ts:check": "vue-tsc --build --force",
|
|
36
|
-
"release:prepare": "npm run pre:start && rm -rf dist && mkdir -p dist && cp -r src/. package.json LICENSE README.md
|
|
36
|
+
"release:prepare": "npm run pre:start && rm -rf dist && mkdir -p dist && cp -r src/. package.json LICENSE README.md dist/",
|
|
37
37
|
"release:beta": "release-it --ci --npm.publish --preRelease=beta --increment=prerelease",
|
|
38
38
|
"release:patch": "release-it patch --ci --npm.publish",
|
|
39
39
|
"release:minor": "release-it minor --ci --npm.publish --git.tag --github.release",
|
|
@@ -66,8 +66,7 @@
|
|
|
66
66
|
"@vue/eslint-config-prettier": "^10.0.0",
|
|
67
67
|
"@vue/eslint-config-typescript": "^14.1.1",
|
|
68
68
|
"@vue/tsconfig": "^0.5.1",
|
|
69
|
-
"@vueless/storybook": "^0.0.
|
|
70
|
-
"@vueless/web-types": "^0.0.21",
|
|
69
|
+
"@vueless/storybook": "^0.0.54",
|
|
71
70
|
"autoprefixer": "^10.4.19",
|
|
72
71
|
"cssnano": "^6.1.2",
|
|
73
72
|
"eslint": "^9.12.0",
|
package/plugin-vite.js
CHANGED
|
@@ -11,6 +11,7 @@ import { createTailwindSafelist, clearTailwindSafelist } from "./utils/node/tail
|
|
|
11
11
|
import { getNuxtFiles, getVueFiles } from "./utils/node/helper.js";
|
|
12
12
|
import { componentResolver, directiveResolver } from "./utils/node/vuelessResolver.js";
|
|
13
13
|
import { setCustomPropTypes, removeCustomPropTypes } from "./utils/node/dynamicProps.js";
|
|
14
|
+
import { buildWebTypes } from "./utils/node/webTypes.js";
|
|
14
15
|
|
|
15
16
|
/* Automatically importing Vueless components on demand */
|
|
16
17
|
export const VuelessUnpluginComponents = (options) =>
|
|
@@ -66,6 +67,10 @@ export const Vueless = function (options = {}) {
|
|
|
66
67
|
await createTailwindSafelist({ mode, env, debug, targetFiles });
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
if ((config.command.includes("sb:") && mode === "storybook") || isVuelessEnv) {
|
|
71
|
+
await buildWebTypes();
|
|
72
|
+
}
|
|
73
|
+
|
|
69
74
|
if (config.command === "build") {
|
|
70
75
|
/* remove cached icons */
|
|
71
76
|
await removeIconsCache(mirrorCacheDir, debug);
|
package/preset-tailwind.js
CHANGED
|
@@ -11,7 +11,9 @@ import {
|
|
|
11
11
|
GRAY_COLOR,
|
|
12
12
|
COOL_COLOR,
|
|
13
13
|
DARK_MODE_SELECTOR,
|
|
14
|
+
DEFAULT_ROUNDING_SM,
|
|
14
15
|
DEFAULT_ROUNDING,
|
|
16
|
+
DEFAULT_ROUNDING_LG,
|
|
15
17
|
DEFAULT_RING,
|
|
16
18
|
DEFAULT_RING_OFFSET,
|
|
17
19
|
DEFAULT_RING_OFFSET_COLOR_LIGHT,
|
|
@@ -88,7 +90,9 @@ export const vuelessTailwindConfig = {
|
|
|
88
90
|
},
|
|
89
91
|
borderRadius: {
|
|
90
92
|
inherit: "inherit",
|
|
93
|
+
"dynamic-sm": "var(--vl-rounding-sm)",
|
|
91
94
|
dynamic: "var(--vl-rounding)",
|
|
95
|
+
"dynamic-lg": "var(--vl-rounding-lg)",
|
|
92
96
|
},
|
|
93
97
|
ringWidth: {
|
|
94
98
|
dynamic: "var(--vl-ring)",
|
|
@@ -106,7 +110,9 @@ export const vuelessTailwindConfig = {
|
|
|
106
110
|
"var(--vl-ring)": DEFAULT_RING,
|
|
107
111
|
"var(--vl-ring-offset)": DEFAULT_RING_OFFSET,
|
|
108
112
|
"var(--vl-ring-offset-color)": DEFAULT_RING_OFFSET_COLOR_LIGHT,
|
|
113
|
+
"var(--vl-rounding-sm)": DEFAULT_ROUNDING_SM,
|
|
109
114
|
"var(--vl-rounding)": DEFAULT_ROUNDING,
|
|
115
|
+
"var(--vl-rounding-lg)": DEFAULT_ROUNDING_LG,
|
|
110
116
|
...getReplacementColors(GRAY_COLOR, grayColor),
|
|
111
117
|
...getReplacementColors(BRAND_COLOR, brandColor),
|
|
112
118
|
},
|
package/types.ts
CHANGED
|
@@ -77,11 +77,21 @@ export interface ThemeConfig {
|
|
|
77
77
|
*/
|
|
78
78
|
gray?: GrayColors;
|
|
79
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Default components "sm" size rounding (border-radius).
|
|
82
|
+
*/
|
|
83
|
+
roundingSm?: number;
|
|
84
|
+
|
|
80
85
|
/**
|
|
81
86
|
* Default components rounding (border-radius).
|
|
82
87
|
*/
|
|
83
88
|
rounding?: number;
|
|
84
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Default components "lg" size rounding (border-radius).
|
|
92
|
+
*/
|
|
93
|
+
roundingLg?: number;
|
|
94
|
+
|
|
85
95
|
/**
|
|
86
96
|
* Default components ring width.
|
|
87
97
|
*/
|
|
@@ -324,7 +334,9 @@ export interface VuelessCssVariables {
|
|
|
324
334
|
"--vl-ring": string;
|
|
325
335
|
"--vl-ring-offset": string;
|
|
326
336
|
"--vl-ring-offset-color": string;
|
|
337
|
+
"--vl-rounding-sm": string;
|
|
327
338
|
"--vl-rounding": string;
|
|
339
|
+
"--vl-rounding-lg": string;
|
|
328
340
|
/* Gray CSS variables */
|
|
329
341
|
"--vl-color-gray-50": string;
|
|
330
342
|
"--vl-color-gray-100": string;
|
package/ui.button-link/config.ts
CHANGED
|
@@ -48,6 +48,12 @@ export default /*tw*/ {
|
|
|
48
48
|
false: "no-underline",
|
|
49
49
|
},
|
|
50
50
|
color: {
|
|
51
|
+
gray: `
|
|
52
|
+
text-gray-500 decoration-gray-500
|
|
53
|
+
hover:text-gray-600 hover:decoration-gray-600
|
|
54
|
+
focus:text-gray-600 focus:decoration-gray-600
|
|
55
|
+
active:text-gray-700 active:decoration-gray-700
|
|
56
|
+
`,
|
|
51
57
|
grayscale: `
|
|
52
58
|
text-gray-900 decoration-gray-900
|
|
53
59
|
hover:text-gray-800 hover:decoration-gray-800
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
|
-
wrapper: "p-4 md:p-5 border rounded-dynamic border-gray-200 bg-white space-y-4 w-full",
|
|
2
|
+
wrapper: "p-4 md:p-5 border rounded-dynamic-lg border-gray-200 bg-white space-y-4 w-full",
|
|
3
3
|
header: "flex justify-between",
|
|
4
4
|
headerLeft: "flex items-center gap-2 w-fit",
|
|
5
5
|
headerLeftFallback: "flex flex-col w-fit",
|
|
@@ -2,7 +2,7 @@ export default /*tw*/ {
|
|
|
2
2
|
checkboxLabel: "{ULabel}",
|
|
3
3
|
checkbox: {
|
|
4
4
|
base: `
|
|
5
|
-
border rounded bg-white cursor-pointer transition checked:text-{color}-600
|
|
5
|
+
border rounded-dynamic-sm bg-white cursor-pointer transition checked:text-{color}-600
|
|
6
6
|
border-gray-300 hover:border-gray-400 focus:border-{color}-500 active:border-{color}-800
|
|
7
7
|
focus:ring-{color}-700/15 focus:ring-dynamic focus:ring-offset-dynamic
|
|
8
8
|
disabled:border-gray-300 disabled:bg-gray-100 disabled:cursor-not-allowed
|
|
@@ -23,7 +23,7 @@ export default /*tw*/ {
|
|
|
23
23
|
},
|
|
24
24
|
iconWrapper: {
|
|
25
25
|
base: `
|
|
26
|
-
flex items-center justify-center absolute rounded cursor-pointer transition
|
|
26
|
+
flex items-center justify-center absolute rounded-dynamic-sm cursor-pointer transition
|
|
27
27
|
bg-{color}-600 hover:bg-{color}-700 active:bg-{color}-800
|
|
28
28
|
`,
|
|
29
29
|
variants: {
|
|
@@ -300,33 +300,27 @@ watchEffect(() => {
|
|
|
300
300
|
@keydown.esc="deactivate"
|
|
301
301
|
@keydown="onTextInputKeyDown"
|
|
302
302
|
>
|
|
303
|
-
<template #left>
|
|
304
|
-
<!-- @slot Use it add something before the date. -->
|
|
305
|
-
<slot name="left" />
|
|
306
|
-
</template>
|
|
307
|
-
|
|
308
|
-
<template #left-icon="{ iconName }">
|
|
303
|
+
<template #left="{ iconName }">
|
|
309
304
|
<!--
|
|
310
|
-
@slot Use it add
|
|
305
|
+
@slot Use it add something before the date.
|
|
311
306
|
@binding {string} icon-name
|
|
312
307
|
-->
|
|
313
308
|
<slot name="left-icon" :icon-name="iconName" />
|
|
314
309
|
</template>
|
|
315
310
|
|
|
316
311
|
<template #right-icon="{ iconName }">
|
|
312
|
+
<slot name="left" :icon-name="iconName" />
|
|
313
|
+
</template>
|
|
314
|
+
|
|
315
|
+
<template #right="{ iconName }">
|
|
317
316
|
<!--
|
|
318
|
-
@slot Use it add
|
|
317
|
+
@slot Use it add something after the date.
|
|
319
318
|
@binding {string} icon-name
|
|
320
319
|
-->
|
|
321
|
-
<slot name="right
|
|
320
|
+
<slot name="right" :icon-name="iconName">
|
|
322
321
|
<UIcon :name="iconName" color="gray" v-bind="rightIconAttrs" />
|
|
323
322
|
</slot>
|
|
324
323
|
</template>
|
|
325
|
-
|
|
326
|
-
<template #right>
|
|
327
|
-
<!-- @slot Use it add something after the date. -->
|
|
328
|
-
<slot name="right" />
|
|
329
|
-
</template>
|
|
330
324
|
</UInput>
|
|
331
325
|
|
|
332
326
|
<Transition v-bind="config.datepickerCalendarTransition">
|
|
@@ -178,27 +178,3 @@ export const RightIcon = DefaultTemplate.bind({});
|
|
|
178
178
|
RightIcon.args = {
|
|
179
179
|
rightIcon: "star",
|
|
180
180
|
};
|
|
181
|
-
|
|
182
|
-
export const LeftIconSlot = DefaultTemplate.bind({});
|
|
183
|
-
LeftIconSlot.args = {
|
|
184
|
-
slotTemplate: `
|
|
185
|
-
<template #left-icon>
|
|
186
|
-
<UIcon
|
|
187
|
-
name="archive"
|
|
188
|
-
color="red"
|
|
189
|
-
/>
|
|
190
|
-
</template>
|
|
191
|
-
`,
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
export const RightIconSlot = DefaultTemplate.bind({});
|
|
195
|
-
RightIconSlot.args = {
|
|
196
|
-
slotTemplate: `
|
|
197
|
-
<template #right-icon>
|
|
198
|
-
<UIcon
|
|
199
|
-
name="archive"
|
|
200
|
-
color="red"
|
|
201
|
-
/>
|
|
202
|
-
</template>
|
|
203
|
-
`,
|
|
204
|
-
};
|
|
@@ -600,30 +600,23 @@ watchEffect(() => {
|
|
|
600
600
|
@focus="activate"
|
|
601
601
|
@keydown.esc="deactivate"
|
|
602
602
|
>
|
|
603
|
-
<template #left>
|
|
604
|
-
<!--
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
<!-- @slot Use it to add icon before the date. -->
|
|
610
|
-
<slot name="left-icon" />
|
|
603
|
+
<template #left="{ iconName }">
|
|
604
|
+
<!--
|
|
605
|
+
@slot Use it to add something before the date.
|
|
606
|
+
@binding {string} icon-name
|
|
607
|
+
-->
|
|
608
|
+
<slot name="left" :icon-name="iconName" />
|
|
611
609
|
</template>
|
|
612
610
|
|
|
613
|
-
<template #right
|
|
611
|
+
<template #right="{ iconName }">
|
|
614
612
|
<!--
|
|
615
|
-
@slot Use it add
|
|
613
|
+
@slot Use it to add something after the date.
|
|
616
614
|
@binding {string} icon-name
|
|
617
615
|
-->
|
|
618
|
-
<slot name="right
|
|
616
|
+
<slot name="right" :icon-name="iconName">
|
|
619
617
|
<UIcon :name="iconName" color="gray" v-bind="rightIconAttrs" />
|
|
620
618
|
</slot>
|
|
621
619
|
</template>
|
|
622
|
-
|
|
623
|
-
<template #right>
|
|
624
|
-
<!-- @slot Use it to add something after the date. -->
|
|
625
|
-
<slot name="right" />
|
|
626
|
-
</template>
|
|
627
620
|
</UInput>
|
|
628
621
|
|
|
629
622
|
<div v-if="isVariant.button" v-bind="buttonWrapperAttrs">
|
|
@@ -194,32 +194,6 @@ LeftIcon.args = { leftIcon: "star", variant: "input" };
|
|
|
194
194
|
export const RightIcon = DefaultTemplate.bind({});
|
|
195
195
|
RightIcon.args = { rightIcon: "star", variant: "input" };
|
|
196
196
|
|
|
197
|
-
export const LeftIconSlot = DefaultTemplate.bind({});
|
|
198
|
-
LeftIconSlot.args = {
|
|
199
|
-
variant: "input",
|
|
200
|
-
slotTemplate: `
|
|
201
|
-
<template #left-icon>
|
|
202
|
-
<UIcon
|
|
203
|
-
name="archive"
|
|
204
|
-
color="red"
|
|
205
|
-
/>
|
|
206
|
-
</template>
|
|
207
|
-
`,
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export const RightIconSlot = DefaultTemplate.bind({});
|
|
211
|
-
RightIconSlot.args = {
|
|
212
|
-
variant: "input",
|
|
213
|
-
slotTemplate: `
|
|
214
|
-
<template #right-icon>
|
|
215
|
-
<UIcon
|
|
216
|
-
name="archive"
|
|
217
|
-
color="red"
|
|
218
|
-
/>
|
|
219
|
-
</template>
|
|
220
|
-
`,
|
|
221
|
-
};
|
|
222
|
-
|
|
223
197
|
export const LeftSlot = DefaultTemplate.bind({});
|
|
224
198
|
LeftSlot.args = {
|
|
225
199
|
variant: "input",
|
package/ui.form-input/UInput.vue
CHANGED
|
@@ -203,8 +203,7 @@ useMutationObserver(leftSlotWrapperRef, (mutations) => {
|
|
|
203
203
|
});
|
|
204
204
|
|
|
205
205
|
function setLabelPosition() {
|
|
206
|
-
const shouldAlignLabelOnTop =
|
|
207
|
-
!hasSlotContent(slots["left-icon"]) && !hasSlotContent(slots["left"]) && !props.leftIcon;
|
|
206
|
+
const shouldAlignLabelOnTop = !hasSlotContent(slots["left"]) && !props.leftIcon;
|
|
208
207
|
|
|
209
208
|
if (props.labelAlign === "top" || shouldAlignLabelOnTop) {
|
|
210
209
|
return;
|
|
@@ -245,10 +244,11 @@ const {
|
|
|
245
244
|
wrapperAttrs,
|
|
246
245
|
inputLabelAttrs,
|
|
247
246
|
passwordIconAttrs,
|
|
248
|
-
leftIconWrapperAttrs,
|
|
249
247
|
leftIconAttrs,
|
|
248
|
+
leftSlotAttrs,
|
|
250
249
|
rightIconAttrs,
|
|
251
|
-
|
|
250
|
+
rightSlotAttrs,
|
|
251
|
+
passwordIconWrapperAttrs,
|
|
252
252
|
} = useUI<Config>(defaultConfig, mutatedProps);
|
|
253
253
|
</script>
|
|
254
254
|
|
|
@@ -267,22 +267,17 @@ const {
|
|
|
267
267
|
v-bind="inputLabelAttrs"
|
|
268
268
|
>
|
|
269
269
|
<label :for="elementId" v-bind="wrapperAttrs">
|
|
270
|
-
<span v-if="hasSlotContent($slots['left'])" ref="leftSlotWrapperRef">
|
|
271
|
-
<!-- @slot Use it to add something before the text. -->
|
|
272
|
-
<slot name="left" />
|
|
273
|
-
</span>
|
|
274
|
-
|
|
275
270
|
<span
|
|
276
|
-
v-if="hasSlotContent($slots['left
|
|
271
|
+
v-if="hasSlotContent($slots['left']) || leftIcon"
|
|
272
|
+
v-bind="leftSlotAttrs"
|
|
277
273
|
ref="leftSlotWrapperRef"
|
|
278
|
-
v-bind="leftIconWrapperAttrs"
|
|
279
274
|
>
|
|
280
275
|
<!--
|
|
281
|
-
@slot Use it to add
|
|
276
|
+
@slot Use it to add something before the text.
|
|
282
277
|
@binding {string} icon-name
|
|
283
278
|
-->
|
|
284
|
-
<slot name="left
|
|
285
|
-
<UIcon v-if="leftIcon" :name="leftIcon"
|
|
279
|
+
<slot name="left" :icon-name="leftIcon">
|
|
280
|
+
<UIcon v-if="leftIcon" internal color="inherit" :name="leftIcon" v-bind="leftIconAttrs" />
|
|
286
281
|
</slot>
|
|
287
282
|
</span>
|
|
288
283
|
|
|
@@ -308,7 +303,7 @@ const {
|
|
|
308
303
|
@copy="onCopy"
|
|
309
304
|
/>
|
|
310
305
|
|
|
311
|
-
<label v-if="isTypePassword" v-bind="
|
|
306
|
+
<label v-if="isTypePassword" v-bind="passwordIconWrapperAttrs" :for="elementId">
|
|
312
307
|
<UIcon
|
|
313
308
|
v-if="isTypePassword"
|
|
314
309
|
:name="passwordIcon"
|
|
@@ -321,18 +316,21 @@ const {
|
|
|
321
316
|
/>
|
|
322
317
|
</label>
|
|
323
318
|
|
|
324
|
-
<
|
|
319
|
+
<div v-if="hasSlotContent($slots['right']) || rightIcon" v-bind="rightSlotAttrs">
|
|
325
320
|
<!--
|
|
326
|
-
@slot Use it to add
|
|
321
|
+
@slot Use it to add something after the text.
|
|
327
322
|
@binding {string} icon-name
|
|
328
323
|
-->
|
|
329
|
-
<slot name="right
|
|
330
|
-
<UIcon
|
|
324
|
+
<slot name="right" :icon-name="rightIcon">
|
|
325
|
+
<UIcon
|
|
326
|
+
v-if="rightIcon"
|
|
327
|
+
internal
|
|
328
|
+
color="inherit"
|
|
329
|
+
:name="rightIcon"
|
|
330
|
+
v-bind="rightIconAttrs"
|
|
331
|
+
/>
|
|
331
332
|
</slot>
|
|
332
|
-
</
|
|
333
|
-
|
|
334
|
-
<!-- @slot Use it to add something after the text. -->
|
|
335
|
-
<slot name="right" />
|
|
333
|
+
</div>
|
|
336
334
|
</label>
|
|
337
335
|
</ULabel>
|
|
338
336
|
</template>
|
package/ui.form-input/config.ts
CHANGED
|
@@ -22,8 +22,6 @@ export default /*tw*/ {
|
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
|
-
rightIconWrapper: "flex items-center justify-end whitespace-nowrap pr-2.5 gap-1 rounded-inherit rounded-l-none",
|
|
26
|
-
leftIconWrapper: "flex items-center justify-end whitespace-nowrap pl-2.5 gap-1 rounded-inherit rounded-r-none",
|
|
27
25
|
inputIcon: {
|
|
28
26
|
base: "{UIcon}",
|
|
29
27
|
defaults: {
|
|
@@ -37,6 +35,9 @@ export default /*tw*/ {
|
|
|
37
35
|
leftIcon: "{UIcon} {>inputIcon}",
|
|
38
36
|
rightIcon: "{UIcon} {>inputIcon}",
|
|
39
37
|
passwordIcon: "{UIcon} {>inputIcon}",
|
|
38
|
+
passwordIconWrapper: "flex items-center justify-end whitespace-nowrap pr-2.5 gap-1 rounded-inherit rounded-l-none",
|
|
39
|
+
leftSlot: "pl-3 flex items-center",
|
|
40
|
+
rightSlot: "pr-3 flex items-center",
|
|
40
41
|
input: {
|
|
41
42
|
base: `
|
|
42
43
|
block w-full py-2 px-3 font-normal !leading-none text-gray-900 bg-transparent
|
|
@@ -110,36 +110,11 @@ LeftIcon.args = { leftIcon: "star" };
|
|
|
110
110
|
export const RightIcon = DefaultTemplate.bind({});
|
|
111
111
|
RightIcon.args = { rightIcon: "star" };
|
|
112
112
|
|
|
113
|
-
export const LeftIconSlot = DefaultTemplate.bind({});
|
|
114
|
-
LeftIconSlot.args = {
|
|
115
|
-
slotTemplate: `
|
|
116
|
-
<template #left-icon>
|
|
117
|
-
<UIcon
|
|
118
|
-
name="star"
|
|
119
|
-
color="green"
|
|
120
|
-
/>
|
|
121
|
-
</template>
|
|
122
|
-
`,
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export const RightIconSlot = DefaultTemplate.bind({});
|
|
126
|
-
RightIconSlot.args = {
|
|
127
|
-
slotTemplate: `
|
|
128
|
-
<template #right-icon>
|
|
129
|
-
<UIcon
|
|
130
|
-
interactive
|
|
131
|
-
name="star"
|
|
132
|
-
color="green"
|
|
133
|
-
/>
|
|
134
|
-
</template>
|
|
135
|
-
`,
|
|
136
|
-
};
|
|
137
|
-
|
|
138
113
|
export const LeftSlot = DefaultTemplate.bind({});
|
|
139
114
|
LeftSlot.args = {
|
|
140
115
|
slotTemplate: `
|
|
141
116
|
<template #left>
|
|
142
|
-
<
|
|
117
|
+
<UIcon name="star" />
|
|
143
118
|
</template>
|
|
144
119
|
`,
|
|
145
120
|
};
|
|
@@ -148,7 +123,7 @@ export const RightSlot = DefaultTemplate.bind({});
|
|
|
148
123
|
RightSlot.args = {
|
|
149
124
|
slotTemplate: `
|
|
150
125
|
<template #right>
|
|
151
|
-
<
|
|
126
|
+
<UIcon name="star" />
|
|
152
127
|
</template>
|
|
153
128
|
`,
|
|
154
129
|
};
|
|
@@ -130,23 +130,19 @@ const { moneyInputAttrs } = useUI<Config>(defaultConfig);
|
|
|
130
130
|
@input="onInput"
|
|
131
131
|
>
|
|
132
132
|
<template #left>
|
|
133
|
-
<!--
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
<!-- @slot Use it to add icon before the text. -->
|
|
139
|
-
<slot name="left-icon" />
|
|
140
|
-
</template>
|
|
141
|
-
|
|
142
|
-
<template #right-icon>
|
|
143
|
-
<!-- @slot Use it to add icon after the text. -->
|
|
144
|
-
<slot name="right-icon" />
|
|
133
|
+
<!--
|
|
134
|
+
@slot Use it to add something left.
|
|
135
|
+
@binding {string} icon-name
|
|
136
|
+
-->
|
|
137
|
+
<slot name="left" :icon-name="leftIcon" />
|
|
145
138
|
</template>
|
|
146
139
|
|
|
147
140
|
<template #right>
|
|
148
|
-
<!--
|
|
149
|
-
|
|
141
|
+
<!--
|
|
142
|
+
@slot Use it to add something right.
|
|
143
|
+
@binding {string} icon-name
|
|
144
|
+
-->
|
|
145
|
+
<slot name="right" :icon-name="leftIcon" />
|
|
150
146
|
</template>
|
|
151
147
|
</UInput>
|
|
152
148
|
</template>
|
|
@@ -125,30 +125,6 @@ LeftIcon.args = { leftIcon: "star" };
|
|
|
125
125
|
export const RightIcon = DefaultTemplate.bind({});
|
|
126
126
|
RightIcon.args = { rightIcon: "star" };
|
|
127
127
|
|
|
128
|
-
export const LeftIconSlot = DefaultTemplate.bind({});
|
|
129
|
-
LeftIconSlot.args = {
|
|
130
|
-
slotTemplate: `
|
|
131
|
-
<template #left-icon>
|
|
132
|
-
<UIcon
|
|
133
|
-
name="archive"
|
|
134
|
-
color="red"
|
|
135
|
-
/>
|
|
136
|
-
</template>
|
|
137
|
-
`,
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
export const RightIconSlot = DefaultTemplate.bind({});
|
|
141
|
-
RightIconSlot.args = {
|
|
142
|
-
slotTemplate: `
|
|
143
|
-
<template #right-icon>
|
|
144
|
-
<UIcon
|
|
145
|
-
name="archive"
|
|
146
|
-
color="red"
|
|
147
|
-
/>
|
|
148
|
-
</template>
|
|
149
|
-
`,
|
|
150
|
-
};
|
|
151
|
-
|
|
152
128
|
export const LeftSlot = DefaultTemplate.bind({});
|
|
153
129
|
LeftSlot.args = {
|
|
154
130
|
slotTemplate: `
|
|
@@ -104,9 +104,14 @@ defineExpose({
|
|
|
104
104
|
* Get element / nested component attributes for each config token ✨
|
|
105
105
|
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
106
106
|
*/
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
const {
|
|
108
|
+
config,
|
|
109
|
+
searchInputAttrs,
|
|
110
|
+
searchInputWithButtonAttrs,
|
|
111
|
+
searchIconAttrs,
|
|
112
|
+
clearIconAttrs,
|
|
113
|
+
searchButtonAttrs,
|
|
114
|
+
} = useUI<Config>(defaultConfig);
|
|
110
115
|
</script>
|
|
111
116
|
|
|
112
117
|
<template>
|
|
@@ -124,7 +129,7 @@ const { config, searchInputAttrs, searchIconAttrs, clearIconAttrs, searchButtonA
|
|
|
124
129
|
:placeholder="placeholder"
|
|
125
130
|
inputmode="search"
|
|
126
131
|
:left-icon="leftIcon"
|
|
127
|
-
v-bind="searchInputAttrs"
|
|
132
|
+
v-bind="searchButtonLabel ? searchInputWithButtonAttrs : searchInputAttrs"
|
|
128
133
|
:data-test="dataTest"
|
|
129
134
|
@update:model-value="onUpdateValue"
|
|
130
135
|
@keyup.enter="onKeyupEnter"
|
|
@@ -134,12 +139,7 @@ const { config, searchInputAttrs, searchIconAttrs, clearIconAttrs, searchButtonA
|
|
|
134
139
|
<slot name="left" />
|
|
135
140
|
</template>
|
|
136
141
|
|
|
137
|
-
<template #
|
|
138
|
-
<!-- @slot Use it to add icon before the text. -->
|
|
139
|
-
<slot name="left-icon" />
|
|
140
|
-
</template>
|
|
141
|
-
|
|
142
|
-
<template #right-icon>
|
|
142
|
+
<template #right>
|
|
143
143
|
<UIcon
|
|
144
144
|
v-if="localValue"
|
|
145
145
|
internal
|
|
@@ -151,10 +151,13 @@ const { config, searchInputAttrs, searchIconAttrs, clearIconAttrs, searchButtonA
|
|
|
151
151
|
@click="onClickClear"
|
|
152
152
|
/>
|
|
153
153
|
|
|
154
|
-
<!--
|
|
154
|
+
<!--
|
|
155
|
+
@slot Use it to add something after the text.
|
|
156
|
+
@binding {string} icon-name
|
|
157
|
+
-->
|
|
155
158
|
<slot
|
|
156
|
-
name="right
|
|
157
|
-
:icon-name="config.defaults.searchIcon"
|
|
159
|
+
name="right"
|
|
160
|
+
:icon-name="rightIcon || config.defaults.searchIcon"
|
|
158
161
|
:search-button-label="searchButtonLabel"
|
|
159
162
|
>
|
|
160
163
|
<UIcon
|
|
@@ -166,12 +169,7 @@ const { config, searchInputAttrs, searchIconAttrs, clearIconAttrs, searchButtonA
|
|
|
166
169
|
:data-test="`${dataTest}-search-icon`"
|
|
167
170
|
@click="onClickSearch"
|
|
168
171
|
/>
|
|
169
|
-
</slot>
|
|
170
|
-
</template>
|
|
171
172
|
|
|
172
|
-
<template #right>
|
|
173
|
-
<!-- @slot Use it to add something after the text. -->
|
|
174
|
-
<slot name="right">
|
|
175
173
|
<UButton
|
|
176
174
|
v-if="searchButtonLabel"
|
|
177
175
|
:label="searchButtonLabel"
|