vueless 0.0.647 → 0.0.649
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/preset-tailwind.js +6 -4
- package/types.ts +8 -1
- package/ui.button-toggle/UToggle.vue +8 -0
- package/ui.data-table/config.ts +4 -1
- package/ui.form-checkbox/UCheckbox.vue +8 -0
- package/ui.form-checkbox-group/UCheckboxGroup.vue +8 -0
- package/ui.form-color-picker/UColorPicker.vue +8 -0
- package/ui.form-input/UInput.vue +8 -0
- package/ui.form-input-file/UInputFile.vue +8 -0
- package/ui.form-input-number/UInputNumber.vue +8 -0
- package/ui.form-input-rating/UInputRating.vue +8 -0
- package/ui.form-label/ULabel.vue +18 -15
- package/ui.form-label/storybook/stories.ts +13 -2
- package/ui.form-radio/URadio.vue +8 -0
- package/ui.form-radio-group/URadioGroup.vue +8 -0
- package/ui.form-select/USelect.vue +8 -0
- package/ui.form-switch/USwitch.vue +8 -0
- package/ui.form-textarea/UTextarea.vue +8 -0
- package/ui.text-files/UFiles.vue +8 -0
- package/utils/storybook.ts +10 -2
- package/utils/theme.ts +6 -1
package/package.json
CHANGED
package/preset-tailwind.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The file has `.js` extension because it is a node script.
|
|
3
3
|
* Please do not change the extension if you do not fully understand the consequences.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
import { merge } from "lodash-es";
|
|
6
6
|
import forms from "@tailwindcss/forms";
|
|
7
7
|
import colors from "tailwindcss/colors.js";
|
|
8
8
|
import {
|
|
@@ -62,7 +62,7 @@ export const vuelessContentNuxt = [
|
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* Vueless tailwind static config.
|
|
65
|
-
* Exported to use in `@vueless/
|
|
65
|
+
* Exported to use in `@vueless/nuxt`.
|
|
66
66
|
*/
|
|
67
67
|
const safelist = getSafelist();
|
|
68
68
|
const brandColors = getPalette(BRAND_COLOR);
|
|
@@ -100,7 +100,7 @@ export const vuelessTailwindConfig = {
|
|
|
100
100
|
dynamic: "var(--vl-ring-offset)",
|
|
101
101
|
},
|
|
102
102
|
ringOffsetColor: {
|
|
103
|
-
|
|
103
|
+
dynamic: twColorWithOpacity("--vl-ring-offset-color"),
|
|
104
104
|
},
|
|
105
105
|
},
|
|
106
106
|
configViewer: {
|
|
@@ -126,7 +126,9 @@ export const vuelessTailwindConfig = {
|
|
|
126
126
|
*/
|
|
127
127
|
export function vuelessPreset() {
|
|
128
128
|
return {
|
|
129
|
-
|
|
129
|
+
theme: merge({}, globalSettings.tailwindTheme || {}, vuelessTailwindConfig.theme),
|
|
130
|
+
darkMode: vuelessTailwindConfig.darkMode,
|
|
131
|
+
content: vuelessTailwindConfig.content,
|
|
130
132
|
plugins: [forms],
|
|
131
133
|
safelist,
|
|
132
134
|
};
|
package/types.ts
CHANGED
|
@@ -56,8 +56,9 @@ import UInputMoneyConfig from "./ui.form-input-money/config.ts";
|
|
|
56
56
|
import UDataListConfig from "./ui.data-list/config.ts";
|
|
57
57
|
import USelectConfig from "./ui.form-select/config.ts";
|
|
58
58
|
|
|
59
|
-
import type { ComputedRef, Ref, ComponentInternalInstance } from "vue";
|
|
60
59
|
import type { Props } from "tippy.js";
|
|
60
|
+
import type { Config as TailwindConfig } from "tailwindcss";
|
|
61
|
+
import type { ComputedRef, Ref, ComponentInternalInstance } from "vue";
|
|
61
62
|
import type { LocaleOptions } from "./adatper.locale/vueless.ts";
|
|
62
63
|
|
|
63
64
|
export enum ColorMode {
|
|
@@ -137,6 +138,12 @@ export interface Config extends ThemeConfig {
|
|
|
137
138
|
*/
|
|
138
139
|
directive?: Partial<Directives>;
|
|
139
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Tailwind CSS theme config.
|
|
143
|
+
* https://tailwindcss.com/docs/theme
|
|
144
|
+
*/
|
|
145
|
+
tailwindTheme?: TailwindConfig["theme"];
|
|
146
|
+
|
|
140
147
|
/**
|
|
141
148
|
* Tailwind-merge config extension for custom classes.
|
|
142
149
|
* All lists of rules available here:
|
|
@@ -86,6 +86,14 @@ const { toggleLabelAttrs, itemsAttrs, itemAttrs } = useUI<Config>(defaultConfig)
|
|
|
86
86
|
v-bind="toggleLabelAttrs"
|
|
87
87
|
:data-test="dataTest"
|
|
88
88
|
>
|
|
89
|
+
<template #label>
|
|
90
|
+
<!--
|
|
91
|
+
@slot Use this to add custom content instead of the label.
|
|
92
|
+
@binding {string} label
|
|
93
|
+
-->
|
|
94
|
+
<slot name="label" :label="label" />
|
|
95
|
+
</template>
|
|
96
|
+
|
|
89
97
|
<div v-bind="itemsAttrs">
|
|
90
98
|
<!-- @slot Use it to add UToggleItem directly. -->
|
|
91
99
|
<slot>
|
package/ui.data-table/config.ts
CHANGED
|
@@ -74,7 +74,10 @@ export default /*tw*/ {
|
|
|
74
74
|
container: "bg-gray-200",
|
|
75
75
|
},
|
|
76
76
|
bodyCheckbox: "{UCheckbox}",
|
|
77
|
-
bodyDateDivider:
|
|
77
|
+
bodyDateDivider: {
|
|
78
|
+
base: "{UDivider}",
|
|
79
|
+
label: "py-0",
|
|
80
|
+
},
|
|
78
81
|
bodyEmptyState: "{UEmpty} my-8",
|
|
79
82
|
footer: {
|
|
80
83
|
base: "group/footer border-t border-solid border-gray-200",
|
|
@@ -136,6 +136,14 @@ const { config, checkboxAttrs, iconWrapperAttrs, checkboxLabelAttrs, checkedIcon
|
|
|
136
136
|
v-bind="checkboxLabelAttrs"
|
|
137
137
|
:data-test="`${dataTest}-label`"
|
|
138
138
|
>
|
|
139
|
+
<template #label>
|
|
140
|
+
<!--
|
|
141
|
+
@slot Use this to add custom content instead of the label.
|
|
142
|
+
@binding {string} label
|
|
143
|
+
-->
|
|
144
|
+
<slot name="label" :label="label" />
|
|
145
|
+
</template>
|
|
146
|
+
|
|
139
147
|
<input
|
|
140
148
|
:id="elementId"
|
|
141
149
|
type="checkbox"
|
|
@@ -77,6 +77,14 @@ const { groupLabelAttrs, groupCheckboxAttrs, listAttrs } = useUI<Config>(default
|
|
|
77
77
|
v-bind="groupLabelAttrs"
|
|
78
78
|
:data-test="dataTest"
|
|
79
79
|
>
|
|
80
|
+
<template #label>
|
|
81
|
+
<!--
|
|
82
|
+
@slot Use this to add custom content instead of the label.
|
|
83
|
+
@binding {string} label
|
|
84
|
+
-->
|
|
85
|
+
<slot name="label" :label="label" />
|
|
86
|
+
</template>
|
|
87
|
+
|
|
80
88
|
<div v-bind="listAttrs">
|
|
81
89
|
<!-- @slot Use it to add URadio directly. -->
|
|
82
90
|
<slot>
|
|
@@ -69,6 +69,14 @@ const {
|
|
|
69
69
|
v-bind="colorPickerLabelAttrs"
|
|
70
70
|
:data-test="dataTest"
|
|
71
71
|
>
|
|
72
|
+
<template #label>
|
|
73
|
+
<!--
|
|
74
|
+
@slot Use this to add custom content instead of the label.
|
|
75
|
+
@binding {string} label
|
|
76
|
+
-->
|
|
77
|
+
<slot name="label" :label="label" />
|
|
78
|
+
</template>
|
|
79
|
+
|
|
72
80
|
<div v-bind="listAttrs">
|
|
73
81
|
<div v-bind="unselectedAttrs">
|
|
74
82
|
<URadio
|
package/ui.form-input/UInput.vue
CHANGED
|
@@ -266,6 +266,14 @@ const {
|
|
|
266
266
|
interactive
|
|
267
267
|
v-bind="inputLabelAttrs"
|
|
268
268
|
>
|
|
269
|
+
<template #label>
|
|
270
|
+
<!--
|
|
271
|
+
@slot Use this to add custom content instead of the label.
|
|
272
|
+
@binding {string} label
|
|
273
|
+
-->
|
|
274
|
+
<slot name="label" :label="label" />
|
|
275
|
+
</template>
|
|
276
|
+
|
|
269
277
|
<label :for="elementId" v-bind="wrapperAttrs">
|
|
270
278
|
<span
|
|
271
279
|
v-if="hasSlotContent($slots['left']) || leftIcon"
|
|
@@ -274,6 +274,14 @@ const {
|
|
|
274
274
|
interactive
|
|
275
275
|
v-bind="inputLabelAttrs"
|
|
276
276
|
>
|
|
277
|
+
<template #label>
|
|
278
|
+
<!--
|
|
279
|
+
@slot Use this to add custom content instead of the label.
|
|
280
|
+
@binding {string} label
|
|
281
|
+
-->
|
|
282
|
+
<slot name="label" :label="label" />
|
|
283
|
+
</template>
|
|
284
|
+
|
|
277
285
|
<div ref="dropZoneRef" :ondrop="onDrop" v-bind="dropzoneAttrs">
|
|
278
286
|
<UText v-if="hasSlotContent($slots['top'])" :size="size" v-bind="descriptionTopAttrs">
|
|
279
287
|
<!-- @slot Use it to add something above the component content. -->
|
|
@@ -76,6 +76,14 @@ const {
|
|
|
76
76
|
v-bind="labelAttrs"
|
|
77
77
|
:data-test="dataTest"
|
|
78
78
|
>
|
|
79
|
+
<template #label>
|
|
80
|
+
<!--
|
|
81
|
+
@slot Use this to add custom content instead of the label.
|
|
82
|
+
@binding {string} label
|
|
83
|
+
-->
|
|
84
|
+
<slot name="label" :label="label" />
|
|
85
|
+
</template>
|
|
86
|
+
|
|
79
87
|
<UButton
|
|
80
88
|
variant="thirdary"
|
|
81
89
|
size="sm"
|
|
@@ -74,6 +74,14 @@ const { config, inputLabelAttrs, containerAttrs, counterAttrs, totalAttrs, stars
|
|
|
74
74
|
v-bind="inputLabelAttrs"
|
|
75
75
|
:data-test="dataTest"
|
|
76
76
|
>
|
|
77
|
+
<template #label>
|
|
78
|
+
<!--
|
|
79
|
+
@slot Use this to add custom content instead of the label.
|
|
80
|
+
@binding {string} label
|
|
81
|
+
-->
|
|
82
|
+
<slot name="label" :label="label" />
|
|
83
|
+
</template>
|
|
84
|
+
|
|
77
85
|
<div v-bind="containerAttrs">
|
|
78
86
|
<div v-if="counter || hasSlotContent($slots['counter'])" v-bind="counterAttrs">
|
|
79
87
|
<!--
|
package/ui.form-label/ULabel.vue
CHANGED
|
@@ -88,13 +88,15 @@ const { wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useUI<Confi
|
|
|
88
88
|
|
|
89
89
|
<!-- `v-bind` isn't assigned, because the div is system -->
|
|
90
90
|
<div v-if="label || error || description">
|
|
91
|
-
<label
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
<label v-if="label" :for="props.for" v-bind="labelAttrs" :data-test="`${dataTest}-label`">
|
|
92
|
+
<!--
|
|
93
|
+
@slot Use this to add custom content instead of the label.
|
|
94
|
+
@binding {string} label
|
|
95
|
+
-->
|
|
96
|
+
<slot name="label" :label="label">
|
|
97
|
+
{{ label }}
|
|
98
|
+
</slot>
|
|
99
|
+
</label>
|
|
98
100
|
|
|
99
101
|
<div v-if="error" v-bind="descriptionAttrs" :data-test="`${dataTest}-error`" v-text="error" />
|
|
100
102
|
|
|
@@ -111,14 +113,15 @@ const { wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs } = useUI<Confi
|
|
|
111
113
|
</div>
|
|
112
114
|
|
|
113
115
|
<div v-else v-bind="wrapperAttrs">
|
|
114
|
-
<label
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
:
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
<label v-if="label" :for="props.for" v-bind="labelAttrs" :data-test="`${dataTest}-label`">
|
|
117
|
+
<!--
|
|
118
|
+
@slot Use this to add custom content instead of the label.
|
|
119
|
+
@binding {string} label
|
|
120
|
+
-->
|
|
121
|
+
<slot name="label" :label="label">
|
|
122
|
+
{{ label }}
|
|
123
|
+
</slot>
|
|
124
|
+
</label>
|
|
122
125
|
|
|
123
126
|
<div v-bind="contentAttrs">
|
|
124
127
|
<!-- @slot Use it to add label content. -->
|
|
@@ -9,6 +9,7 @@ import ULabel from "../../ui.form-label/ULabel.vue";
|
|
|
9
9
|
import UCol from "../../ui.container-col/UCol.vue";
|
|
10
10
|
import UText from "../../ui.text-block/UText.vue";
|
|
11
11
|
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
12
|
+
import UBadge from "../../ui.text-badge/UBadge.vue";
|
|
12
13
|
|
|
13
14
|
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
14
15
|
import type { Props } from "../types.ts";
|
|
@@ -39,7 +40,7 @@ export default {
|
|
|
39
40
|
const defaultTemplate = "This is plain text";
|
|
40
41
|
|
|
41
42
|
const DefaultTemplate: StoryFn<ULabelArgs> = (args: ULabelArgs) => ({
|
|
42
|
-
components: { ULabel, UText, UIcon },
|
|
43
|
+
components: { ULabel, UText, UIcon, UBadge },
|
|
43
44
|
setup() {
|
|
44
45
|
const slots = getSlotNames(ULabel.__name);
|
|
45
46
|
|
|
@@ -108,10 +109,20 @@ Error.args = { error: "Error description" };
|
|
|
108
109
|
export const Disabled = DefaultTemplate.bind({});
|
|
109
110
|
Disabled.args = { disabled: true };
|
|
110
111
|
|
|
112
|
+
export const SlotLabel = DefaultTemplate.bind({});
|
|
113
|
+
SlotLabel.args = {
|
|
114
|
+
label: "Custom badge label",
|
|
115
|
+
slotTemplate: `
|
|
116
|
+
<template #label="{ label }">
|
|
117
|
+
<UBadge :label="label" color="green" />
|
|
118
|
+
</template>
|
|
119
|
+
`,
|
|
120
|
+
};
|
|
121
|
+
|
|
111
122
|
export const SlotFooter = DefaultTemplate.bind({});
|
|
112
123
|
SlotFooter.args = {
|
|
113
124
|
slotTemplate: `
|
|
114
|
-
<template #
|
|
125
|
+
<template #bottom>
|
|
115
126
|
<UIcon name="star" color="green" />
|
|
116
127
|
</template>
|
|
117
128
|
`,
|
package/ui.form-radio/URadio.vue
CHANGED
|
@@ -107,6 +107,14 @@ const { radioAttrs, radioLabelAttrs } = useUI<Config>(defaultConfig, mutatedProp
|
|
|
107
107
|
v-bind="radioLabelAttrs"
|
|
108
108
|
:data-test="`${dataTest}-label`"
|
|
109
109
|
>
|
|
110
|
+
<template #label>
|
|
111
|
+
<!--
|
|
112
|
+
@slot Use this to add custom content instead of the label.
|
|
113
|
+
@binding {string} label
|
|
114
|
+
-->
|
|
115
|
+
<slot name="label" :label="label" />
|
|
116
|
+
</template>
|
|
117
|
+
|
|
110
118
|
<input
|
|
111
119
|
:id="elementId"
|
|
112
120
|
type="radio"
|
|
@@ -60,6 +60,14 @@ const { groupLabelAttrs, listAttrs, groupRadioAttrs } = useUI<Config>(defaultCon
|
|
|
60
60
|
v-bind="groupLabelAttrs"
|
|
61
61
|
:data-test="dataTest"
|
|
62
62
|
>
|
|
63
|
+
<template #label>
|
|
64
|
+
<!--
|
|
65
|
+
@slot Use this to add custom content instead of the label.
|
|
66
|
+
@binding {string} label
|
|
67
|
+
-->
|
|
68
|
+
<slot name="label" :label="label" />
|
|
69
|
+
</template>
|
|
70
|
+
|
|
63
71
|
<div v-bind="listAttrs">
|
|
64
72
|
<!-- @slot Use it to add URadio directly. -->
|
|
65
73
|
<slot>
|
|
@@ -456,6 +456,14 @@ const {
|
|
|
456
456
|
:data-test="dataTest"
|
|
457
457
|
:tabindex="-1"
|
|
458
458
|
>
|
|
459
|
+
<template #label>
|
|
460
|
+
<!--
|
|
461
|
+
@slot Use this to add custom content instead of the label.
|
|
462
|
+
@binding {string} label
|
|
463
|
+
-->
|
|
464
|
+
<slot name="label" :label="label" />
|
|
465
|
+
</template>
|
|
466
|
+
|
|
459
467
|
<div
|
|
460
468
|
ref="wrapperRef"
|
|
461
469
|
:tabindex="searchable || disabled ? -1 : 0"
|
|
@@ -100,6 +100,14 @@ const {
|
|
|
100
100
|
:data-test="dataTest"
|
|
101
101
|
@click="onClickToggle"
|
|
102
102
|
>
|
|
103
|
+
<template #label>
|
|
104
|
+
<!--
|
|
105
|
+
@slot Use this to add custom content instead of the label.
|
|
106
|
+
@binding {string} label
|
|
107
|
+
-->
|
|
108
|
+
<slot name="label" :label="label" />
|
|
109
|
+
</template>
|
|
110
|
+
|
|
103
111
|
<label :for="elementId" v-bind="wrapperAttrs">
|
|
104
112
|
<input
|
|
105
113
|
:id="elementId"
|
|
@@ -207,6 +207,14 @@ const { textareaAttrs, textareaLabelAttrs, wrapperAttrs, leftSlotAttrs, rightSlo
|
|
|
207
207
|
v-bind="textareaLabelAttrs"
|
|
208
208
|
:data-test="dataTest"
|
|
209
209
|
>
|
|
210
|
+
<template #label>
|
|
211
|
+
<!--
|
|
212
|
+
@slot Use this to add custom content instead of the label.
|
|
213
|
+
@binding {string} label
|
|
214
|
+
-->
|
|
215
|
+
<slot name="label" :label="label" />
|
|
216
|
+
</template>
|
|
217
|
+
|
|
210
218
|
<label ref="wrapperRef" :for="elementId" v-bind="wrapperAttrs">
|
|
211
219
|
<div
|
|
212
220
|
v-if="hasSlotContent($slots['left'])"
|
package/ui.text-files/UFiles.vue
CHANGED
|
@@ -62,6 +62,14 @@ const { filesLabelAttrs, itemsAttrs, itemAttrs } = useUI<Config>(defaultConfig);
|
|
|
62
62
|
:align="labelAlign"
|
|
63
63
|
v-bind="filesLabelAttrs"
|
|
64
64
|
>
|
|
65
|
+
<template #label>
|
|
66
|
+
<!--
|
|
67
|
+
@slot Use this to add custom content instead of the label.
|
|
68
|
+
@binding {string} label
|
|
69
|
+
-->
|
|
70
|
+
<slot name="label" :label="label" />
|
|
71
|
+
</template>
|
|
72
|
+
|
|
65
73
|
<div v-bind="itemsAttrs">
|
|
66
74
|
<!-- @slot Use it to add UFile. -->
|
|
67
75
|
<slot>
|
package/utils/storybook.ts
CHANGED
|
@@ -65,11 +65,19 @@ export function getSlotNames(componentName: string | undefined) {
|
|
|
65
65
|
* Create story param config to show component description with a link on GitHub.
|
|
66
66
|
*/
|
|
67
67
|
export function getDocsDescription(componentName: string | undefined) {
|
|
68
|
-
if (!componentName)
|
|
68
|
+
if (!componentName) {
|
|
69
|
+
return {};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let viewOnGitHub = "";
|
|
73
|
+
|
|
74
|
+
if (COMPONENTS[componentName as ComponentNames]) {
|
|
75
|
+
viewOnGitHub = `| [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/${COMPONENTS[componentName as ComponentNames]})`;
|
|
76
|
+
}
|
|
69
77
|
|
|
70
78
|
return {
|
|
71
79
|
description: {
|
|
72
|
-
component: `The \`${componentName}\` component.
|
|
80
|
+
component: `The \`${componentName}\` component. ${viewOnGitHub}`,
|
|
73
81
|
},
|
|
74
82
|
};
|
|
75
83
|
}
|
package/utils/theme.ts
CHANGED
|
@@ -151,7 +151,12 @@ export function setTheme(config: Config = {}) {
|
|
|
151
151
|
brand = gray;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
const colors: DefaultColors = merge(
|
|
154
|
+
const colors: DefaultColors = merge(
|
|
155
|
+
{},
|
|
156
|
+
tailwindColors,
|
|
157
|
+
tailwindConfig?.theme?.extend?.colors || {},
|
|
158
|
+
vuelessConfig?.tailwindTheme?.extend?.colors || {},
|
|
159
|
+
);
|
|
155
160
|
|
|
156
161
|
const variables: Partial<VuelessCssVariables> = {
|
|
157
162
|
"--vl-rounding-sm": `${Number(roundingSm) / PX_IN_REM}rem`,
|