vueless 0.0.825-beta.113 → 0.0.825-beta.115
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/bin/constants.js +1 -0
- package/constants.js +1 -0
- package/package.json +1 -1
- package/tailwind.css +4 -0
- package/types.ts +5 -0
- package/ui.button/config.ts +5 -5
- package/ui.button-link/config.ts +1 -1
- package/ui.button-link/storybook/stories.ts +3 -3
- package/ui.container-modal/UModal.vue +0 -2
- package/ui.form-checkbox/config.ts +2 -2
- package/ui.form-color-picker/storybook/stories.ts +1 -1
- package/ui.form-listbox/config.ts +1 -1
- package/ui.form-radio/config.ts +1 -1
- package/ui.form-switch/USwitch.vue +1 -1
- package/ui.form-switch/config.ts +7 -7
- package/ui.image-icon/config.ts +1 -1
- package/ui.text-empty/config.ts +1 -1
- package/utils/theme.ts +24 -7
package/bin/constants.js
CHANGED
package/constants.js
CHANGED
|
@@ -33,6 +33,7 @@ export const OUTLINE_INCREMENT = 1; /* pixels */
|
|
|
33
33
|
export const DEFAULT_ROUNDING = 8; /* pixels */
|
|
34
34
|
export const ROUNDING_DECREMENT = 4; /* pixels */
|
|
35
35
|
export const ROUNDING_INCREMENT = 6; /* pixels */
|
|
36
|
+
export const DEFAULT_DISABLED_OPACITY = 50; /* presents */
|
|
36
37
|
|
|
37
38
|
/* Vueless supported color shades */
|
|
38
39
|
export const PRIMARY_COLORS = [
|
package/package.json
CHANGED
package/tailwind.css
CHANGED
package/types.ts
CHANGED
package/ui.button/config.ts
CHANGED
|
@@ -20,31 +20,31 @@ export default /*tw*/ {
|
|
|
20
20
|
text-inverted bg-{color}
|
|
21
21
|
hover:bg-{color}-lifted
|
|
22
22
|
active:bg-{color}-accented
|
|
23
|
-
disabled:!bg-{color}/
|
|
23
|
+
disabled:!text-inverted/(--vl-disabled-opacity) disabled:!bg-{color}/(--vl-disabled-opacity)
|
|
24
24
|
`,
|
|
25
25
|
outlined: `
|
|
26
26
|
text-{color} border-{color}
|
|
27
27
|
hover:text-{color}-lifted hover:border-{color}-lifted hover:bg-{color}-lifted/10
|
|
28
28
|
active:text-{color}-accented active:border-{color}-accented active:bg-{color}-accented/15
|
|
29
|
-
disabled:!text-{color}/
|
|
29
|
+
disabled:!text-{color}/(--vl-disabled-opacity) disabled:!bg-{color}/5 disabled:!border-{color}/(--vl-disabled-opacity)
|
|
30
30
|
`,
|
|
31
31
|
subtle: `
|
|
32
32
|
text-{color} bg-{color}/5 border-{color}/15
|
|
33
33
|
hover:text-{color}-lifted hover:bg-{color}-lifted/10
|
|
34
34
|
active:text-{color}-accented active:bg-{color}-accented/15
|
|
35
|
-
disabled:!text-{color}/
|
|
35
|
+
disabled:!text-{color}/(--vl-disabled-opacity) disabled:!bg-{color}/5 disabled:!border-{color}/10
|
|
36
36
|
`,
|
|
37
37
|
soft: `
|
|
38
38
|
text-{color} bg-{color}/5
|
|
39
39
|
hover:text-{color}-lifted hover:bg-{color}-lifted/10
|
|
40
40
|
active:text-{color}-accented active:bg-{color}-accented/15
|
|
41
|
-
disabled:!text-{color}/
|
|
41
|
+
disabled:!text-{color}/(--vl-disabled-opacity) disabled:!bg-{color}/5
|
|
42
42
|
`,
|
|
43
43
|
ghost: `
|
|
44
44
|
text-{color}
|
|
45
45
|
hover:text-{color}-lifted hover:bg-{color}-lifted/10
|
|
46
46
|
active:text-{color}-accented active:bg-{color}-accented/15
|
|
47
|
-
disabled:!text-{color}/
|
|
47
|
+
disabled:!text-{color}/(--vl-disabled-opacity) disabled:!bg-transparent
|
|
48
48
|
`,
|
|
49
49
|
},
|
|
50
50
|
round: {
|
package/ui.button-link/config.ts
CHANGED
|
@@ -29,7 +29,7 @@ export default /*tw*/ {
|
|
|
29
29
|
true: "decoration-dotted hover:decoration-dotted",
|
|
30
30
|
},
|
|
31
31
|
disabled: {
|
|
32
|
-
true: "!text-{color}/
|
|
32
|
+
true: "!text-{color}/(--vl-disabled-opacity) !no-underline cursor-not-allowed",
|
|
33
33
|
},
|
|
34
34
|
block: {
|
|
35
35
|
true: "w-full",
|
|
@@ -24,7 +24,7 @@ export default {
|
|
|
24
24
|
title: "Buttons & Links / Link",
|
|
25
25
|
component: ULink,
|
|
26
26
|
args: {
|
|
27
|
-
label: "
|
|
27
|
+
label: "View in GitHub",
|
|
28
28
|
},
|
|
29
29
|
argTypes: {
|
|
30
30
|
...getArgTypes(ULink.__name),
|
|
@@ -64,7 +64,7 @@ export const Default = DefaultTemplate.bind({});
|
|
|
64
64
|
Default.args = {};
|
|
65
65
|
|
|
66
66
|
export const Sizes = EnumVariantTemplate.bind({});
|
|
67
|
-
Sizes.args = { enum: "size"
|
|
67
|
+
Sizes.args = { enum: "size" };
|
|
68
68
|
|
|
69
69
|
export const Colors = EnumVariantTemplate.bind({});
|
|
70
70
|
Colors.args = { enum: "color", label: "{enumValue}" };
|
|
@@ -145,7 +145,7 @@ export const DefaultSlot = DefaultTemplate.bind({});
|
|
|
145
145
|
DefaultSlot.args = {
|
|
146
146
|
slotTemplate: `
|
|
147
147
|
<template #default>
|
|
148
|
-
<UButton label="
|
|
148
|
+
<UButton label="View on GitHub" />
|
|
149
149
|
</template>
|
|
150
150
|
`,
|
|
151
151
|
};
|
|
@@ -10,7 +10,7 @@ export default /*tw*/ {
|
|
|
10
10
|
focus:ring-0 focus:ring-offset-0
|
|
11
11
|
focus-visible:outline-{color} focus-visible:outline-medium focus-visible:outline-offset-2 focus-visible:transition
|
|
12
12
|
disabled:border-default disabled:bg-lifted disabled:cursor-not-allowed
|
|
13
|
-
disabled:checked:bg-{color}/
|
|
13
|
+
disabled:checked:bg-{color}/(--vl-disabled-opacity) disabled:checked:border-transparent
|
|
14
14
|
`,
|
|
15
15
|
variants: {
|
|
16
16
|
size: {
|
|
@@ -35,7 +35,7 @@ export default /*tw*/ {
|
|
|
35
35
|
lg: "size-6",
|
|
36
36
|
},
|
|
37
37
|
disabled: {
|
|
38
|
-
true: "!bg-{color}/
|
|
38
|
+
true: "!bg-{color}/(--vl-disabled-opacity) cursor-not-allowed",
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
},
|
|
@@ -9,7 +9,7 @@ export default /*tw*/ {
|
|
|
9
9
|
listItem: "group/item block mb-px last:mb-0",
|
|
10
10
|
option: {
|
|
11
11
|
base: `
|
|
12
|
-
rounded-small px-2 py-2 flex items-center align-middle whitespace-nowrap cursor-pointer
|
|
12
|
+
rounded-small px-2 py-2 flex gap-2 items-center align-middle whitespace-nowrap cursor-pointer
|
|
13
13
|
font-normal !leading-snug
|
|
14
14
|
hover:bg-{color}/5 active:bg-{color}/10
|
|
15
15
|
overflow-hidden text-ellipsis text-default
|
package/ui.form-radio/config.ts
CHANGED
|
@@ -11,7 +11,7 @@ export default /*tw*/ {
|
|
|
11
11
|
focus:ring-0 focus:ring-offset-0
|
|
12
12
|
focus-visible:outline-{color} focus-visible:outline-medium focus-visible:outline-offset-2 focus-visible:transition
|
|
13
13
|
disabled:border-default disabled:bg-lifted disabled:cursor-not-allowed
|
|
14
|
-
disabled:checked:bg-{color}/
|
|
14
|
+
disabled:checked:bg-{color}/(--vl-disabled-opacity) disabled:checked:border-transparent
|
|
15
15
|
|
|
16
16
|
`,
|
|
17
17
|
variants: {
|
package/ui.form-switch/config.ts
CHANGED
|
@@ -17,7 +17,7 @@ export default /*tw*/ {
|
|
|
17
17
|
},
|
|
18
18
|
checked: {
|
|
19
19
|
true: "bg-{color} hover:bg-{color}-lifted active:bg-{color}-accented",
|
|
20
|
-
false: "bg-
|
|
20
|
+
false: "bg-accented",
|
|
21
21
|
},
|
|
22
22
|
disabled: {
|
|
23
23
|
true: "pointer-events-none",
|
|
@@ -27,8 +27,8 @@ export default /*tw*/ {
|
|
|
27
27
|
{ toggleLabel: true, size: "sm", class: "w-10" },
|
|
28
28
|
{ toggleLabel: true, size: "md", class: "w-12" },
|
|
29
29
|
{ toggleLabel: true, size: "lg", class: "w-14" },
|
|
30
|
-
{ disabled: true, checked: false, class: "bg-
|
|
31
|
-
{ disabled: true, checked: true, class: "bg-{color}/
|
|
30
|
+
{ disabled: true, checked: false, class: "bg-accented/(--vl-disabled-opacity)" },
|
|
31
|
+
{ disabled: true, checked: true, class: "bg-{color}/(--vl-disabled-opacity)" },
|
|
32
32
|
],
|
|
33
33
|
},
|
|
34
34
|
input: "sr-only",
|
|
@@ -51,9 +51,9 @@ export default /*tw*/ {
|
|
|
51
51
|
base: "{UIcon}",
|
|
52
52
|
defaults: {
|
|
53
53
|
size: {
|
|
54
|
-
sm: "
|
|
55
|
-
md: "
|
|
56
|
-
lg: "
|
|
54
|
+
sm: "3xs",
|
|
55
|
+
md: "2xs",
|
|
56
|
+
lg: "xs",
|
|
57
57
|
},
|
|
58
58
|
},
|
|
59
59
|
},
|
|
@@ -70,7 +70,7 @@ export default /*tw*/ {
|
|
|
70
70
|
{
|
|
71
71
|
toggleLabel: false,
|
|
72
72
|
checked: false,
|
|
73
|
-
class: "bg-
|
|
73
|
+
class: "bg-accented",
|
|
74
74
|
},
|
|
75
75
|
],
|
|
76
76
|
},
|
package/ui.image-icon/config.ts
CHANGED
package/ui.text-empty/config.ts
CHANGED
package/utils/theme.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
DEFAULT_TEXT,
|
|
32
32
|
TEXT_INCREMENT,
|
|
33
33
|
TEXT_DECREMENT,
|
|
34
|
+
DEFAULT_DISABLED_OPACITY,
|
|
34
35
|
} from "../constants.js";
|
|
35
36
|
import type { Config, NeutralColors, PrimaryColors, VuelessCssVariables } from "../types.ts";
|
|
36
37
|
import { ColorMode } from "../types.ts";
|
|
@@ -48,6 +49,7 @@ declare interface RootCSSVariableOptions {
|
|
|
48
49
|
textSm: number;
|
|
49
50
|
text: number;
|
|
50
51
|
textLg: number;
|
|
52
|
+
disabledOpacity: number;
|
|
51
53
|
lightTheme: Partial<VuelessCssVariables>;
|
|
52
54
|
darkTheme: Partial<VuelessCssVariables>;
|
|
53
55
|
}
|
|
@@ -148,6 +150,10 @@ export function setTheme(config: Config = {}, isCachedAutoMode?: boolean) {
|
|
|
148
150
|
// eslint-disable-next-line vue/max-len, prettier/prettier
|
|
149
151
|
setColorMode((config.colorMode || cachedColorMode || vuelessConfig.colorMode || ColorMode.Light) as ColorMode, isCachedAutoMode);
|
|
150
152
|
|
|
153
|
+
const disabledOpacity = getDisabledOpacity(
|
|
154
|
+
config.disabledOpacity ?? vuelessConfig.disabledOpacity,
|
|
155
|
+
);
|
|
156
|
+
|
|
151
157
|
const { roundingSm, rounding, roundingLg } = getRoundings(
|
|
152
158
|
config.roundingSm ?? vuelessConfig.roundingSm,
|
|
153
159
|
config.rounding ?? cachedRounding ?? vuelessConfig.rounding,
|
|
@@ -246,6 +252,7 @@ export function setTheme(config: Config = {}, isCachedAutoMode?: boolean) {
|
|
|
246
252
|
textSm,
|
|
247
253
|
text,
|
|
248
254
|
textLg,
|
|
255
|
+
disabledOpacity,
|
|
249
256
|
lightTheme,
|
|
250
257
|
darkTheme,
|
|
251
258
|
});
|
|
@@ -317,6 +324,14 @@ function getRoundings(sm?: string | number, md?: string | number, lg?: string |
|
|
|
317
324
|
};
|
|
318
325
|
}
|
|
319
326
|
|
|
327
|
+
/**
|
|
328
|
+
* Retrieve disabled opacity value.
|
|
329
|
+
* @return number - opacity value.
|
|
330
|
+
*/
|
|
331
|
+
function getDisabledOpacity(opacity?: number) {
|
|
332
|
+
return Math.max(0, opacity ?? DEFAULT_DISABLED_OPACITY);
|
|
333
|
+
}
|
|
334
|
+
|
|
320
335
|
/**
|
|
321
336
|
* Generate and apply Vueless CSS variables.
|
|
322
337
|
* @return string - Vueless CSS variables string.
|
|
@@ -335,6 +350,7 @@ function setRootCSSVariables(options: RootCSSVariableOptions) {
|
|
|
335
350
|
textSm,
|
|
336
351
|
text,
|
|
337
352
|
textLg,
|
|
353
|
+
disabledOpacity,
|
|
338
354
|
lightTheme,
|
|
339
355
|
darkTheme,
|
|
340
356
|
} = options;
|
|
@@ -342,16 +358,17 @@ function setRootCSSVariables(options: RootCSSVariableOptions) {
|
|
|
342
358
|
let darkVariables: Partial<VuelessCssVariables> = {};
|
|
343
359
|
|
|
344
360
|
let variables: Partial<VuelessCssVariables> = {
|
|
345
|
-
"--vl-rounding-sm": `${
|
|
346
|
-
"--vl-rounding-md": `${
|
|
347
|
-
"--vl-rounding-lg": `${
|
|
361
|
+
"--vl-rounding-sm": `${roundingSm / PX_IN_REM}rem`,
|
|
362
|
+
"--vl-rounding-md": `${rounding / PX_IN_REM}rem`,
|
|
363
|
+
"--vl-rounding-lg": `${roundingLg / PX_IN_REM}rem`,
|
|
348
364
|
"--vl-outline-sm": `${outlineSm}px`,
|
|
349
365
|
"--vl-outline-md": `${outline}px`,
|
|
350
366
|
"--vl-outline-lg": `${outlineLg}px`,
|
|
351
|
-
"--vl-text-xs": `${
|
|
352
|
-
"--vl-text-sm": `${
|
|
353
|
-
"--vl-text-md": `${
|
|
354
|
-
"--vl-text-lg": `${
|
|
367
|
+
"--vl-text-xs": `${textXs / PX_IN_REM}rem`,
|
|
368
|
+
"--vl-text-sm": `${textSm / PX_IN_REM}rem`,
|
|
369
|
+
"--vl-text-md": `${text / PX_IN_REM}rem`,
|
|
370
|
+
"--vl-text-lg": `${textLg / PX_IN_REM}rem`,
|
|
371
|
+
"--vl-disabled-opacity": `${disabledOpacity}%`,
|
|
355
372
|
};
|
|
356
373
|
|
|
357
374
|
for (const shade of COLOR_SHADES) {
|