vueless 0.0.232 → 0.0.234
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 +1 -18
- package/constants/index.js +65 -0
- package/index.js +1 -0
- package/package.json +2 -2
- package/preset.tailwind/index.js +50 -36
- package/service.ui/index.js +181 -67
- package/ui.button/configs/default.config.js +3 -3
- package/ui.button-link/configs/default.config.js +1 -1
- package/ui.button-toggle/configs/default.config.js +4 -2
- package/ui.container-card/configs/default.config.js +1 -7
- package/ui.container-card/index.stories.js +0 -20
- package/ui.container-card/index.vue +0 -9
- package/ui.data-table/configs/default.config.js +1 -1
- package/ui.dropdown-badge/configs/default.config.js +1 -1
- package/ui.dropdown-button/configs/default.config.js +1 -1
- package/ui.dropdown-link/configs/default.config.js +1 -1
- package/ui.dropdown-list/configs/default.config.js +1 -1
- package/ui.dropdown-list/index.stories.js +2 -7
- package/ui.form-calendar/configs/default.config.js +9 -9
- package/ui.form-checkbox/configs/default.config.js +1 -1
- package/ui.form-date-picker/configs/default.config.js +1 -1
- package/ui.form-date-picker-range/configs/default.config.js +12 -8
- package/ui.form-input/configs/default.config.js +8 -10
- package/ui.form-input-file/configs/default.config.js +2 -2
- package/ui.form-input-search/configs/default.config.js +1 -1
- package/ui.form-radio/configs/default.config.js +2 -1
- package/ui.form-select/configs/default.config.js +4 -4
- package/ui.form-switch/configs/default.config.js +1 -1
- package/ui.form-textarea/configs/default.config.js +3 -3
- package/ui.navigation-progress/components/StepperProgress.vue +1 -1
- package/ui.text-alert/configs/default.config.js +1 -1
- package/web-types.json +1 -10
- package/preset.tailwind/constants/index.js +0 -23
package/composable.ui/index.js
CHANGED
|
@@ -20,24 +20,7 @@ import {
|
|
|
20
20
|
} from "../service.ui";
|
|
21
21
|
|
|
22
22
|
import { cloneDeep } from "../service.helper";
|
|
23
|
-
|
|
24
|
-
const STRATEGY_TYPE = {
|
|
25
|
-
merge: "merge",
|
|
26
|
-
replace: "replace",
|
|
27
|
-
overwrite: "overwrite",
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const SYSTEM_CONFIG_KEY = {
|
|
31
|
-
i18n: "i18n",
|
|
32
|
-
strategy: "strategy",
|
|
33
|
-
safelist: "safelist",
|
|
34
|
-
component: "component",
|
|
35
|
-
safelistColors: "safelistColors",
|
|
36
|
-
defaultVariants: "defaultVariants",
|
|
37
|
-
compoundVariants: "compoundVariants",
|
|
38
|
-
iconNameCapitalize: "IconName",
|
|
39
|
-
iconName: "iconName",
|
|
40
|
-
};
|
|
23
|
+
import { STRATEGY_TYPE, SYSTEM_CONFIG_KEY } from "../constants";
|
|
41
24
|
|
|
42
25
|
/**
|
|
43
26
|
Merging component configs in a given sequence (bigger number = bigger priority):
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/* Custom Vueless colors */
|
|
2
|
+
export const BRAND_COLOR = "brand";
|
|
3
|
+
export const GRAY_COLOR = "gray";
|
|
4
|
+
export const COOL_COLOR = "cool";
|
|
5
|
+
export const GRAYSCALE_COLOR = "grayscale";
|
|
6
|
+
|
|
7
|
+
/* Vueless dark mode */
|
|
8
|
+
export const DARK_MODE_SELECTOR = "vl-dark-mode";
|
|
9
|
+
|
|
10
|
+
/* Vueless defaults */
|
|
11
|
+
export const DEFAULT_BRAND_COLOR = GRAYSCALE_COLOR;
|
|
12
|
+
export const DEFAULT_GRAY_COLOR = COOL_COLOR;
|
|
13
|
+
export const DEFAULT_RING = 4; /* pixels */
|
|
14
|
+
export const DEFAULT_RING_OFFSET = 0; /* pixels */
|
|
15
|
+
export const DEFAULT_ROUNDING = 8; /* pixels */
|
|
16
|
+
|
|
17
|
+
/* Vueless supported colors and shades */
|
|
18
|
+
export const COLOR_SHADES = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
19
|
+
export const GRAY_COLORS = ["slate", COOL_COLOR, "zinc", "neutral", "stone"];
|
|
20
|
+
export const BRAND_COLORS = [
|
|
21
|
+
"red",
|
|
22
|
+
"orange",
|
|
23
|
+
"amber",
|
|
24
|
+
"yellow",
|
|
25
|
+
"lime",
|
|
26
|
+
"green",
|
|
27
|
+
"emerald",
|
|
28
|
+
"teal",
|
|
29
|
+
"cyan",
|
|
30
|
+
"sky",
|
|
31
|
+
"blue",
|
|
32
|
+
"indigo",
|
|
33
|
+
"violet",
|
|
34
|
+
"purple",
|
|
35
|
+
"fuchsia",
|
|
36
|
+
"pink",
|
|
37
|
+
"rose",
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
/* Vueless merge class strategy types */
|
|
41
|
+
export const STRATEGY_TYPE = {
|
|
42
|
+
merge: "merge",
|
|
43
|
+
replace: "replace",
|
|
44
|
+
overwrite: "overwrite",
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/* CVA (Class Variance Authority) default config keys */
|
|
48
|
+
export const CVA_CONFIG_KEY = {
|
|
49
|
+
base: "base",
|
|
50
|
+
variants: "variants",
|
|
51
|
+
compoundVariants: "compoundVariants",
|
|
52
|
+
defaultVariants: "defaultVariants",
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/* Vueless default config keys */
|
|
56
|
+
export const SYSTEM_CONFIG_KEY = {
|
|
57
|
+
i18n: "i18n",
|
|
58
|
+
strategy: "strategy",
|
|
59
|
+
safelist: "safelist",
|
|
60
|
+
component: "component",
|
|
61
|
+
safelistColors: "safelistColors",
|
|
62
|
+
iconNameCapitalize: "IconName",
|
|
63
|
+
iconName: "iconName",
|
|
64
|
+
...CVA_CONFIG_KEY,
|
|
65
|
+
};
|
package/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { createLocale, LocaleSymbol } from "./composable.locale";
|
|
|
3
3
|
import { createLoaderRendering, LoaderRenderingSymbol } from "./ui.loader-rendering/composables/useLoaderRendering";
|
|
4
4
|
import { createLoaderTop, LoaderTopSymbol } from "./ui.loader-top/composables/useLoaderTop";
|
|
5
5
|
|
|
6
|
+
export { setTheme } from "./service.ui";
|
|
6
7
|
export { default as createVueI18nAdapter } from "./adatper.locale/vue-i18n";
|
|
7
8
|
export { default as defaultEnLocale } from "./adatper.locale/locales/en";
|
|
8
9
|
export { useLocale } from "./composable.locale";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.234",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Vue Styleless Component Framework.",
|
|
6
6
|
"homepage": "https://vueless.com",
|
|
@@ -37,7 +37,7 @@
|
|
|
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.43",
|
|
41
41
|
"@vueless/storybook": "^0.0.34",
|
|
42
42
|
"@vueless/web-types": "^0.0.13",
|
|
43
43
|
"autoprefixer": "^10.4.19",
|
package/preset.tailwind/index.js
CHANGED
|
@@ -1,41 +1,44 @@
|
|
|
1
1
|
import forms from "@tailwindcss/forms";
|
|
2
|
-
import
|
|
2
|
+
import defaultTheme from "tailwindcss/defaultTheme.js";
|
|
3
|
+
import {
|
|
4
|
+
COLOR_SHADES,
|
|
5
|
+
BRAND_COLOR,
|
|
6
|
+
GRAY_COLOR,
|
|
7
|
+
COOL_COLOR,
|
|
8
|
+
DARK_MODE_SELECTOR,
|
|
9
|
+
} from "../constants/index.js";
|
|
3
10
|
|
|
4
11
|
const safelist = getSafelist();
|
|
12
|
+
const isStrategyOverride = process.env.VUELESS_STRATEGY === "override";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Vueless Tailwind CSS `content` config.
|
|
16
|
+
* Use it to extend project Tailwind CSS `content` config.
|
|
17
|
+
*/
|
|
18
|
+
export const vuelessContent = [
|
|
19
|
+
"./index.html",
|
|
20
|
+
"./src/**/*.{js,ts,jsx,tsx,vue}",
|
|
21
|
+
"./vueless.config.{js,ts}",
|
|
22
|
+
"./node_modules/vueless/**/*.{js,ts,vue}",
|
|
23
|
+
...(isStrategyOverride ? ["!./src/**/ui.*/**/configs/default.config.js"] : []),
|
|
24
|
+
...(isStrategyOverride ? ["!./node_modules/vueless/**/ui.*/**/configs/default.config.js"] : []),
|
|
25
|
+
];
|
|
5
26
|
|
|
6
27
|
/**
|
|
7
28
|
* Generates preset for TailwindCSS base on Vueless config.
|
|
8
29
|
* @returns {Object}
|
|
9
30
|
*/
|
|
10
31
|
export function vuelessPreset() {
|
|
11
|
-
const brandColor = twColorWithOpacity("--color-brand");
|
|
12
|
-
const { brand, gray } = getVuelessConfigColors();
|
|
13
|
-
const colors = getTailwindConfigColors();
|
|
14
|
-
|
|
15
|
-
if (!Object.keys(colors).length) {
|
|
16
|
-
return {};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
let brandPalette = BRAND_COLORS.includes(brand) ? colors[brand] : colors.green;
|
|
20
|
-
let grayPalette = GRAY_COLORS.includes(gray) ? colors[gray] : colors.zinc;
|
|
21
|
-
|
|
22
|
-
if (brand === GRAYSCALE_COLOR) {
|
|
23
|
-
brandPalette = grayPalette;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
32
|
return {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"./src/**/*.{js,ts,jsx,tsx,vue}",
|
|
30
|
-
"./vueless.config.{js,ts}",
|
|
31
|
-
"./node_modules/vueless/**/*.{js,ts,vue}",
|
|
32
|
-
],
|
|
33
|
+
darkMode: DARK_MODE_SELECTOR,
|
|
34
|
+
content: vuelessContent,
|
|
33
35
|
safelist,
|
|
34
36
|
theme: {
|
|
35
37
|
extend: {
|
|
36
38
|
colors: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
[BRAND_COLOR]: getPalette(BRAND_COLOR),
|
|
40
|
+
[GRAY_COLOR]: getPalette(GRAY_COLOR),
|
|
41
|
+
[COOL_COLOR]: { ...defaultTheme.colors[GRAY_COLOR] },
|
|
39
42
|
},
|
|
40
43
|
spacing: {
|
|
41
44
|
"safe-top": "env(safe-area-inset-top)",
|
|
@@ -44,7 +47,16 @@ export function vuelessPreset() {
|
|
|
44
47
|
"safe-right": "env(safe-area-inset-right)",
|
|
45
48
|
},
|
|
46
49
|
fontSize: {
|
|
47
|
-
"2xs": ["0.625rem", "0.875rem"]
|
|
50
|
+
"2xs": ["0.625rem", "0.875rem"] /* 10px / 14px */,
|
|
51
|
+
},
|
|
52
|
+
ringWidth: {
|
|
53
|
+
dynamic: "var(--vl-ring)",
|
|
54
|
+
},
|
|
55
|
+
ringOffsetWidth: {
|
|
56
|
+
dynamic: "var(--vl-ring-offset)",
|
|
57
|
+
},
|
|
58
|
+
borderRadius: {
|
|
59
|
+
dynamic: "var(--vl-rounding)",
|
|
48
60
|
},
|
|
49
61
|
},
|
|
50
62
|
},
|
|
@@ -54,6 +66,7 @@ export function vuelessPreset() {
|
|
|
54
66
|
|
|
55
67
|
/**
|
|
56
68
|
* Transform CSS variable with RGB numbers into CSS color.
|
|
69
|
+
* @param { String } variableName
|
|
57
70
|
* @returns {Function}
|
|
58
71
|
*/
|
|
59
72
|
function twColorWithOpacity(variableName) {
|
|
@@ -65,19 +78,20 @@ function twColorWithOpacity(variableName) {
|
|
|
65
78
|
}
|
|
66
79
|
|
|
67
80
|
/**
|
|
68
|
-
* Convert sting to
|
|
69
|
-
* @
|
|
81
|
+
* Convert sting patterns to RegExp.
|
|
82
|
+
* @param { String } color (gray | brand)
|
|
83
|
+
* @returns { Object } - TailwindCSS color object palette.
|
|
70
84
|
*/
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
}
|
|
85
|
+
function getPalette(color) {
|
|
86
|
+
let palette = {
|
|
87
|
+
DEFAULT: twColorWithOpacity(`--vl-color-${color}-default`),
|
|
88
|
+
};
|
|
74
89
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return JSON.parse(process.env.VUELESS_CONFIG_COLORS || "{}");
|
|
90
|
+
COLOR_SHADES.forEach((shade) => {
|
|
91
|
+
palette[shade] = twColorWithOpacity(`--vl-color-${color}-${shade}`);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return palette;
|
|
81
95
|
}
|
|
82
96
|
|
|
83
97
|
/**
|
package/service.ui/index.js
CHANGED
|
@@ -1,24 +1,70 @@
|
|
|
1
1
|
import { merge } from "lodash-es";
|
|
2
2
|
import { defineConfig } from "cva";
|
|
3
|
-
import {
|
|
3
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
4
4
|
import colors from "tailwindcss/colors";
|
|
5
5
|
|
|
6
6
|
import { cloneDeep } from "../service.helper";
|
|
7
7
|
import {
|
|
8
|
+
GRAY_COLOR,
|
|
9
|
+
COOL_COLOR,
|
|
10
|
+
BRAND_COLOR,
|
|
8
11
|
BRAND_COLORS,
|
|
9
|
-
GRAY_COLORS,
|
|
10
12
|
GRAYSCALE_COLOR,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
DEFAULT_RING,
|
|
14
|
+
DEFAULT_RING_OFFSET,
|
|
15
|
+
DEFAULT_ROUNDING,
|
|
16
|
+
DEFAULT_BRAND_COLOR,
|
|
17
|
+
DEFAULT_GRAY_COLOR,
|
|
18
|
+
DARK_MODE_SELECTOR,
|
|
19
|
+
} from "../constants";
|
|
13
20
|
|
|
14
21
|
/* Load Vueless config from the project root. */
|
|
15
22
|
const [vuelessConfig] = Object.values(
|
|
16
23
|
import.meta.glob("/vueless.config.js", { eager: true, import: "default" }),
|
|
17
24
|
);
|
|
18
25
|
|
|
26
|
+
/*
|
|
27
|
+
Export global config settings for the current library.
|
|
28
|
+
Did as a separate variables for more comfortable usage.
|
|
29
|
+
*/
|
|
30
|
+
export const {
|
|
31
|
+
layout,
|
|
32
|
+
strategy,
|
|
33
|
+
rounding,
|
|
34
|
+
gray,
|
|
35
|
+
brand,
|
|
36
|
+
tailwindMerge: globalTailwindMergeConfig,
|
|
37
|
+
component: globalComponentConfig,
|
|
38
|
+
} = vuelessConfig;
|
|
39
|
+
|
|
19
40
|
export const nestedComponentRegEx = /\{U[^}]*}/g;
|
|
20
41
|
|
|
21
|
-
|
|
42
|
+
//
|
|
43
|
+
/**
|
|
44
|
+
Extend twMerge (tailwind merge) by vueless and user config:
|
|
45
|
+
All list of rules available here:
|
|
46
|
+
https://github.com/dcastil/tailwind-merge/blob/v2.3.0/src/lib/default-config.ts
|
|
47
|
+
*/
|
|
48
|
+
const twMerge = extendTailwindMerge(
|
|
49
|
+
merge(
|
|
50
|
+
{
|
|
51
|
+
extend: {
|
|
52
|
+
theme: {
|
|
53
|
+
spacing: ["safe-top", "safe-bottom", "safe-left", "safe-right"],
|
|
54
|
+
},
|
|
55
|
+
classGroups: {
|
|
56
|
+
"ring-w": [{ ring: ["dynamic"] }],
|
|
57
|
+
"ring-offset-w": [{ "ring-offset": ["dynamic"] }],
|
|
58
|
+
"font-size": [{ text: ["2xs"] }],
|
|
59
|
+
rounded: [{ rounded: ["dynamic"] }],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
globalTailwindMergeConfig,
|
|
64
|
+
),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
/**
|
|
22
68
|
Export cva (class variance authority) methods:
|
|
23
69
|
* extended with tailwind-merge
|
|
24
70
|
* remove all Vueless nested component names ({U...} strings) from class list string.
|
|
@@ -30,7 +76,9 @@ export const {
|
|
|
30
76
|
cx,
|
|
31
77
|
compose,
|
|
32
78
|
} = defineConfig({
|
|
33
|
-
hooks: {
|
|
79
|
+
hooks: {
|
|
80
|
+
onComplete: (classNames) => twMerge(classNames).replace(nestedComponentRegEx, ""),
|
|
81
|
+
},
|
|
34
82
|
});
|
|
35
83
|
|
|
36
84
|
export const cva = ({ base = "", variants = {}, compoundVariants = [], defaultVariants = {} }) =>
|
|
@@ -41,12 +89,6 @@ export const cva = ({ base = "", variants = {}, compoundVariants = [], defaultVa
|
|
|
41
89
|
defaultVariants,
|
|
42
90
|
});
|
|
43
91
|
|
|
44
|
-
/*
|
|
45
|
-
Export global config settings for the current library.
|
|
46
|
-
Did as a separate variables for more comfortable usage.
|
|
47
|
-
*/
|
|
48
|
-
export const { layout, strategy, gray, brand, component: globalComponentConfig } = vuelessConfig;
|
|
49
|
-
|
|
50
92
|
export default class UIService {
|
|
51
93
|
isMac = false;
|
|
52
94
|
isPWA = false;
|
|
@@ -63,12 +105,22 @@ export default class UIService {
|
|
|
63
105
|
const isBrowser = typeof window !== "undefined";
|
|
64
106
|
|
|
65
107
|
this.isMac = isBrowser && this.checkIsMac();
|
|
66
|
-
|
|
67
108
|
this.isPWA = isBrowser && this.checkIsPWA();
|
|
68
109
|
this.isIOS = isBrowser && this.checkIsIOS();
|
|
69
110
|
this.isAndroid = isBrowser && this.checkIsAndroid();
|
|
70
|
-
|
|
71
111
|
this.isMobileApp = this.isPWA || this.isIOS || this.isAndroid;
|
|
112
|
+
|
|
113
|
+
this.initTheme();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
initTheme() {
|
|
117
|
+
const prefersColorSchemeDark = window && window.matchMedia("(prefers-color-scheme: dark)");
|
|
118
|
+
|
|
119
|
+
this.setTheme({ systemDarkMode: prefersColorSchemeDark.matches });
|
|
120
|
+
|
|
121
|
+
prefersColorSchemeDark.addEventListener("change", (event) =>
|
|
122
|
+
this.setTheme({ systemDarkMode: event.matches }),
|
|
123
|
+
);
|
|
72
124
|
}
|
|
73
125
|
|
|
74
126
|
checkIsPWA() {
|
|
@@ -102,62 +154,17 @@ export default class UIService {
|
|
|
102
154
|
return navigator.userAgentData?.platform || navigator.platform || "unknown";
|
|
103
155
|
}
|
|
104
156
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
r = parseInt(color.substring(0, 2), 16);
|
|
112
|
-
g = parseInt(color.substring(2, 4), 16);
|
|
113
|
-
b = parseInt(color.substring(4, 6), 16);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (color.length === 3) {
|
|
117
|
-
r = parseInt(color.substring(0, 1).repeat(2), 16);
|
|
118
|
-
g = parseInt(color.substring(1, 2).repeat(2), 16);
|
|
119
|
-
b = parseInt(color.substring(2, 3).repeat(2), 16);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return color.length === 6 || color.length === 3 ? `${r}, ${g}, ${b}` : "";
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// TODO: This should be rewrote to support all set of brand colors (not only one).
|
|
126
|
-
setBrandColor(brandColor) {
|
|
127
|
-
function getBrandColor(color, grayColor, brandColors) {
|
|
128
|
-
if (color === GRAYSCALE_COLOR) {
|
|
129
|
-
return grayColor;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return brandColors.includes(color) ? colors[color][500] : color;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function getGrayColor(color, grayColors) {
|
|
136
|
-
return grayColors.includes(color) ? colors[color][900] : colors.zinc[900];
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const grayColor = getGrayColor(gray, GRAY_COLORS);
|
|
140
|
-
const localBrandColor = getBrandColor(brandColor, grayColor, BRAND_COLORS);
|
|
141
|
-
const globalBrandColor = getBrandColor(brand, grayColor, BRAND_COLORS);
|
|
142
|
-
|
|
143
|
-
const style = document.createElement("style");
|
|
144
|
-
const rgb = UIService.convertHexInRgb(localBrandColor || globalBrandColor || grayColor);
|
|
145
|
-
|
|
146
|
-
style.innerHTML = `
|
|
147
|
-
:root {
|
|
148
|
-
--color-brand: ${rgb};
|
|
149
|
-
}
|
|
150
|
-
`;
|
|
151
|
-
|
|
152
|
-
document.head.appendChild(style);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
getRandomId(idLength = 15) {
|
|
157
|
+
/**
|
|
158
|
+
Generate random string.
|
|
159
|
+
@param { Number } length
|
|
160
|
+
@returns { String }
|
|
161
|
+
*/
|
|
162
|
+
getRandomId(length = 15) {
|
|
156
163
|
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
157
164
|
const charactersLength = characters.length;
|
|
158
165
|
let id = "";
|
|
159
166
|
|
|
160
|
-
while (id.length <
|
|
167
|
+
while (id.length < length) {
|
|
161
168
|
id += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
162
169
|
}
|
|
163
170
|
|
|
@@ -168,6 +175,11 @@ export default class UIService {
|
|
|
168
175
|
document.title = title ? title + separator + suffix : suffix;
|
|
169
176
|
}
|
|
170
177
|
|
|
178
|
+
/**
|
|
179
|
+
Change favicon in runtime.
|
|
180
|
+
@param { String } faviconPath
|
|
181
|
+
@returns { void }
|
|
182
|
+
*/
|
|
171
183
|
static setFavicon(faviconPath) {
|
|
172
184
|
if (!faviconPath) return;
|
|
173
185
|
|
|
@@ -176,6 +188,7 @@ export default class UIService {
|
|
|
176
188
|
|
|
177
189
|
faviconTag.setAttribute("rel", "shortcut icon");
|
|
178
190
|
faviconTag.setAttribute("href", `${faviconPath}?${Math.random()}`);
|
|
191
|
+
|
|
179
192
|
head.appendChild(faviconTag);
|
|
180
193
|
}
|
|
181
194
|
|
|
@@ -216,15 +229,116 @@ export default class UIService {
|
|
|
216
229
|
setColor(classes, color) {
|
|
217
230
|
return classes?.replaceAll("{color}", color);
|
|
218
231
|
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
Set dark mode
|
|
235
|
+
@param { Object } config
|
|
236
|
+
@returns { Boolean } isDarkMode
|
|
237
|
+
*/
|
|
238
|
+
setDarkMode(config) {
|
|
239
|
+
config?.darkMode === undefined
|
|
240
|
+
? localStorage.removeItem(DARK_MODE_SELECTOR)
|
|
241
|
+
: localStorage.setItem(DARK_MODE_SELECTOR, Number(!!config?.darkMode));
|
|
242
|
+
|
|
243
|
+
const storedDarkMode = localStorage.getItem(DARK_MODE_SELECTOR);
|
|
244
|
+
|
|
245
|
+
let isDarkMode =
|
|
246
|
+
storedDarkMode !== null
|
|
247
|
+
? !!Number(storedDarkMode)
|
|
248
|
+
: !!(config?.darkMode ?? vuelessConfig?.darkMode ?? config?.systemDarkMode);
|
|
249
|
+
|
|
250
|
+
isDarkMode
|
|
251
|
+
? document.documentElement.classList.add(DARK_MODE_SELECTOR)
|
|
252
|
+
: document.documentElement.classList.remove(DARK_MODE_SELECTOR);
|
|
253
|
+
|
|
254
|
+
return isDarkMode;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
Set theme css variables and dark mode.
|
|
259
|
+
@param { Object } config
|
|
260
|
+
@returns { void }
|
|
261
|
+
*/
|
|
262
|
+
setTheme = (config = {}) => {
|
|
263
|
+
const isDarkMode = this.setDarkMode(config);
|
|
264
|
+
const brand = config?.brand || vuelessConfig?.brand || DEFAULT_BRAND_COLOR;
|
|
265
|
+
const gray = config?.gray || vuelessConfig?.gray || DEFAULT_GRAY_COLOR;
|
|
266
|
+
const ring = config?.ring || vuelessConfig?.ring || DEFAULT_RING;
|
|
267
|
+
const ringOffset = config?.ringOffset || vuelessConfig?.ringOffset || DEFAULT_RING_OFFSET;
|
|
268
|
+
const rounding = Number(config?.rounding) || vuelessConfig?.rounding || DEFAULT_ROUNDING;
|
|
269
|
+
|
|
270
|
+
// eslint-disable-next-line prettier/prettier, vue/max-len
|
|
271
|
+
let brandColor = BRAND_COLORS.some((color) => color === brand) || brand === GRAYSCALE_COLOR ? brand : DEFAULT_BRAND_COLOR;
|
|
272
|
+
let grayColor = BRAND_COLORS.some((color) => color === gray) ? gray : DEFAULT_GRAY_COLOR;
|
|
273
|
+
|
|
274
|
+
// set default shade related to the selected mode
|
|
275
|
+
const defaultBrandShade = isDarkMode ? 400 : 600;
|
|
276
|
+
const defaultGrayShade = isDarkMode ? 400 : 600;
|
|
277
|
+
|
|
278
|
+
// handling custom `cool` color
|
|
279
|
+
if (grayColor === COOL_COLOR) {
|
|
280
|
+
grayColor = GRAY_COLOR;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// handling custom `grayscale` color
|
|
284
|
+
if (brandColor === GRAYSCALE_COLOR) {
|
|
285
|
+
brandColor = grayColor;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const variables = {
|
|
289
|
+
"--vl-ring": `${ring}px`,
|
|
290
|
+
"--vl-ring-offset": `${ringOffset}px`,
|
|
291
|
+
"--vl-rounding": `${Number(rounding) / this.PX_IN_REM}rem`,
|
|
292
|
+
"--vl-color-gray-default": UIService.convertHexInRgb(colors[grayColor][defaultBrandShade]),
|
|
293
|
+
"--vl-color-brand-default": UIService.convertHexInRgb(colors[brandColor][defaultGrayShade]),
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
for (const key in colors[grayColor]) {
|
|
297
|
+
variables[`--vl-color-gray-${key}`] = UIService.convertHexInRgb(colors[grayColor][key]);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
for (const key in colors[brandColor]) {
|
|
301
|
+
variables[`--vl-color-brand-${key}`] = UIService.convertHexInRgb(colors[brandColor][key]);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const style = document.createElement("style");
|
|
305
|
+
const stringVariables = Object.entries(variables)
|
|
306
|
+
.map(([key, value]) => `${key}: ${value};`)
|
|
307
|
+
.join(" ");
|
|
308
|
+
|
|
309
|
+
style.innerHTML = `:root {${stringVariables}`;
|
|
310
|
+
|
|
311
|
+
document.head.appendChild(style);
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
static convertHexInRgb(hex) {
|
|
315
|
+
const color = hex.replace(/#/g, "");
|
|
316
|
+
|
|
317
|
+
let r, g, b;
|
|
318
|
+
|
|
319
|
+
if (color.length === 6) {
|
|
320
|
+
r = parseInt(color.substring(0, 2), 16);
|
|
321
|
+
g = parseInt(color.substring(2, 4), 16);
|
|
322
|
+
b = parseInt(color.substring(4, 6), 16);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (color.length === 3) {
|
|
326
|
+
r = parseInt(color.substring(0, 1).repeat(2), 16);
|
|
327
|
+
g = parseInt(color.substring(1, 2).repeat(2), 16);
|
|
328
|
+
b = parseInt(color.substring(2, 3).repeat(2), 16);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return color.length === 6 || color.length === 3 ? `${r}, ${g}, ${b}` : "";
|
|
332
|
+
}
|
|
219
333
|
}
|
|
220
334
|
|
|
221
335
|
export const {
|
|
222
336
|
getRandomId,
|
|
223
337
|
getColor,
|
|
224
338
|
setColor,
|
|
339
|
+
setTheme,
|
|
225
340
|
setTitle,
|
|
226
341
|
setFavicon,
|
|
227
|
-
setBrandColor,
|
|
228
342
|
convertHexInRgb,
|
|
229
343
|
isMac,
|
|
230
344
|
isPWA,
|
|
@@ -4,8 +4,8 @@ export default /*tw*/ {
|
|
|
4
4
|
flex items-center justify-center
|
|
5
5
|
text-base font-medium outline-none
|
|
6
6
|
border border-solid transition
|
|
7
|
-
focus:ring-opacity-20 focus:ring-
|
|
8
|
-
focus-within:ring-opacity-20 focus-within:ring-
|
|
7
|
+
focus:ring-{color}-700 focus:ring-opacity-20 focus:ring-dynamic focus:ring-offset-dynamic
|
|
8
|
+
focus-within:ring-{color}-700 focus-within:ring-opacity-20 focus-within:ring-dynamic focus-within:ring-offset-dynamic
|
|
9
9
|
disabled:ring-0 disabled:cursor-no-drop
|
|
10
10
|
`,
|
|
11
11
|
variants: {
|
|
@@ -46,7 +46,7 @@ export default /*tw*/ {
|
|
|
46
46
|
true: "pointer-events-none gap-0",
|
|
47
47
|
},
|
|
48
48
|
pill: {
|
|
49
|
-
false: "rounded-
|
|
49
|
+
false: "rounded-dynamic",
|
|
50
50
|
true: "rounded-full",
|
|
51
51
|
},
|
|
52
52
|
block: {
|
|
@@ -2,7 +2,7 @@ export default /*tw*/ {
|
|
|
2
2
|
wrapper: {
|
|
3
3
|
base: `
|
|
4
4
|
w-fit inline-flex rounded transition focus-visible:outline-none
|
|
5
|
-
focus-within:ring-
|
|
5
|
+
focus-within:ring-dynamic focus-within:ring-offset-4 focus-within:ring-{color}-500 focus-within:ring-opacity-15
|
|
6
6
|
`,
|
|
7
7
|
variants: {
|
|
8
8
|
color: {
|
|
@@ -22,8 +22,10 @@ export default /*tw*/ {
|
|
|
22
22
|
separated: {
|
|
23
23
|
false: `
|
|
24
24
|
flex-nowrap -space-x-px gap-0
|
|
25
|
-
[&>:first-child]:rounded-
|
|
26
|
-
[&>:
|
|
25
|
+
[&>:first-child]:rounded-dynamic [&>:first-child]:rounded-r-none
|
|
26
|
+
[&>:last-child]:rounded-dynamic [&>:last-child]:rounded-l-none
|
|
27
|
+
[&>:first-child>*>*]:rounded-dynamic [&>:first-child>*>*]:rounded-r-none
|
|
28
|
+
[&>:last-child>*>*]:rounded-dynamic [&>:last-child>*>*]:rounded-l-none
|
|
27
29
|
`,
|
|
28
30
|
},
|
|
29
31
|
},
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
wrapper: {
|
|
3
|
-
base: "border border-gray-200 bg-white space-y-4 md:space-y-6 w-full",
|
|
3
|
+
base: "border rounded-dynamic border-gray-200 bg-white space-y-4 md:space-y-6 w-full",
|
|
4
4
|
variants: {
|
|
5
|
-
rounded: {
|
|
6
|
-
sm: "rounded-lg",
|
|
7
|
-
md: "rounded-2xl",
|
|
8
|
-
lg: "rounded-3xl",
|
|
9
|
-
},
|
|
10
5
|
padding: {
|
|
11
6
|
sm: "p-2 md:p-4",
|
|
12
7
|
md: "p-4 md:p-6",
|
|
@@ -25,7 +20,6 @@ export default /*tw*/ {
|
|
|
25
20
|
footerMobileReverse: "flex flex-col-reverse space-y-reverse",
|
|
26
21
|
defaultVariants: {
|
|
27
22
|
padding: "md",
|
|
28
|
-
rounded: "md",
|
|
29
23
|
mobileFooterReverse: false,
|
|
30
24
|
},
|
|
31
25
|
};
|
|
@@ -66,23 +66,6 @@ const PaddingTemplate = (args, { argTypes } = {}) => ({
|
|
|
66
66
|
`,
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
const RoundedTemplate = (args, { argTypes } = {}) => ({
|
|
70
|
-
components: { UCard, URow },
|
|
71
|
-
setup() {
|
|
72
|
-
return {
|
|
73
|
-
args,
|
|
74
|
-
roundeds: argTypes.rounded.options,
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
template: `
|
|
78
|
-
<URow>
|
|
79
|
-
<UCard v-for="(rounded, index) in roundeds" v-bind="args" :rounded="rounded" :key="index">
|
|
80
|
-
${args.slotDefaultTemplate}
|
|
81
|
-
</UCard>
|
|
82
|
-
</URow>
|
|
83
|
-
`,
|
|
84
|
-
});
|
|
85
|
-
|
|
86
69
|
export const Default = DefaultTemplate.bind({});
|
|
87
70
|
Default.args = {
|
|
88
71
|
slotTemplate: `
|
|
@@ -107,9 +90,6 @@ description.args = { description: "Card description" };
|
|
|
107
90
|
export const padding = PaddingTemplate.bind({});
|
|
108
91
|
padding.args = {};
|
|
109
92
|
|
|
110
|
-
export const rounded = RoundedTemplate.bind({});
|
|
111
|
-
rounded.args = {};
|
|
112
|
-
|
|
113
93
|
export const slotHeaderLeftBefore = DefaultTemplate.bind({});
|
|
114
94
|
slotHeaderLeftBefore.args = {
|
|
115
95
|
slotTemplate: `
|
|
@@ -72,15 +72,6 @@ const props = defineProps({
|
|
|
72
72
|
default: "",
|
|
73
73
|
},
|
|
74
74
|
|
|
75
|
-
/**
|
|
76
|
-
* Card border radius.
|
|
77
|
-
* @values sm, md, lg
|
|
78
|
-
*/
|
|
79
|
-
rounded: {
|
|
80
|
-
type: String,
|
|
81
|
-
default: UIService.get(defaultConfig, UCard).default.rounded,
|
|
82
|
-
},
|
|
83
|
-
|
|
84
75
|
/**
|
|
85
76
|
* Card padding.
|
|
86
77
|
* @values sm, md, lg
|
|
@@ -25,7 +25,7 @@ export default /*tw*/ {
|
|
|
25
25
|
stickyHeaderActions: "absolute rounded-t-lg border-blue-200 bg-blue-50",
|
|
26
26
|
stickyHeaderActionsCheckbox: "{UCheckbox}",
|
|
27
27
|
stickyHeaderActionsCounter: "-ml-2",
|
|
28
|
-
tableWrapper: "border border-gray-200 rounded-
|
|
28
|
+
tableWrapper: "border border-gray-200 rounded-dynamic bg-white",
|
|
29
29
|
table: "min-w-full border-none text-sm w-full table-fixed",
|
|
30
30
|
header: "border-b border-gray-200",
|
|
31
31
|
headerRow: "",
|
|
@@ -21,12 +21,9 @@ export default {
|
|
|
21
21
|
...getArgTypes(UDropdownList.name),
|
|
22
22
|
},
|
|
23
23
|
parameters: {
|
|
24
|
-
backgrounds: {
|
|
25
|
-
default: "white",
|
|
26
|
-
},
|
|
27
24
|
docs: {
|
|
28
25
|
story: {
|
|
29
|
-
|
|
26
|
+
height: "180px",
|
|
30
27
|
},
|
|
31
28
|
},
|
|
32
29
|
},
|
|
@@ -38,9 +35,7 @@ const DefaultTemplate = (args) => ({
|
|
|
38
35
|
return { args };
|
|
39
36
|
},
|
|
40
37
|
template: `
|
|
41
|
-
<UDropdownList
|
|
42
|
-
v-bind="args"
|
|
43
|
-
/>
|
|
38
|
+
<UDropdownList v-bind="args" class="mx-4 w-[24rem]"/>
|
|
44
39
|
`,
|
|
45
40
|
});
|
|
46
41
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
|
-
wrapper: "p-3 pb-4 w-64 border border-brand-300 rounded-
|
|
2
|
+
wrapper: "p-3 pb-4 w-64 border border-brand-300 rounded-dynamic bg-white shadow overflow-hidden focus:outline-none",
|
|
3
3
|
navigation: "mb-2 pb-2 border-b flex items-center justify-between",
|
|
4
4
|
navigationSwitchViewButton: "-ml-3 pl-3 text-sm rounded-l-none",
|
|
5
5
|
dayViewSwitchLabel: "flex gap-1",
|
|
@@ -23,30 +23,30 @@ export default /*tw*/ {
|
|
|
23
23
|
weekDays: "grid grid-cols-7",
|
|
24
24
|
weekDay: "flex size-8 items-center justify-center text-xs uppercase text-brand-500",
|
|
25
25
|
days: "grid grid-cols-7",
|
|
26
|
-
day: "mx-auto size-8 rounded-
|
|
26
|
+
day: "mx-auto size-8 rounded-dynamic text-sm hover:bg-brand-100 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
27
27
|
activeDay: "bg-brand-100 hover:bg-brand-100",
|
|
28
|
-
inRangeFirstDay: "rounded-
|
|
29
|
-
inRangeLastDay: "rounded-
|
|
28
|
+
inRangeFirstDay: "rounded-dynamic rounded-r-none bg-brand-200 text-brand-900 hover:bg-brand-200",
|
|
29
|
+
inRangeLastDay: "rounded-dynamic rounded-l-none bg-brand-200 text-brand-900 hover:bg-brand-200",
|
|
30
30
|
inRangeDay: "bg-brand-100 text-brand-900 hover:!bg-brand-200 rounded-none",
|
|
31
31
|
selectedDay: "bg-brand-900 text-white hover:bg-brand-900",
|
|
32
32
|
currentDay: "hover:bg-brand-100 border-2 border-brand-900",
|
|
33
33
|
anotherMonthDay: "hover:bg-brand-100 text-brand-400",
|
|
34
34
|
monthView: "grid grid-cols-4 items-center justify-center",
|
|
35
|
-
month: "{UButton} mx-auto flex h-12 w-full rounded-
|
|
35
|
+
month: "{UButton} mx-auto flex h-12 w-full rounded-dynamic hover:!bg-brand-900 hover:text-white",
|
|
36
36
|
selectedMonth: "bg-brand-900 hover:bg-brand-900 text-white",
|
|
37
37
|
activeMonth: "bg-brand-100",
|
|
38
38
|
currentMoth: "border-2 border-brand-900",
|
|
39
39
|
yearView: "grid grid-cols-4 items-center justify-center",
|
|
40
|
-
year: "{UButton} mx-auto flex h-12 w-full rounded-
|
|
40
|
+
year: "{UButton} mx-auto flex h-12 w-full rounded-dynamic hover:!bg-brand-900 hover:text-white",
|
|
41
41
|
currentYear: "border-2 border-brand-900",
|
|
42
42
|
selectedYear: "bg-brand-900 hover:bg-brand-900 text-white",
|
|
43
43
|
activeYear: "bg-brand-100",
|
|
44
44
|
timepicker: "mt-2 pl-1 pt-3 text-sm flex items-center justify-between gap-2 border-t border-brand-200",
|
|
45
45
|
timepickerLabel: "w-full",
|
|
46
|
-
timepickerInputWrapper: "flex items-center gap-px rounded-
|
|
46
|
+
timepickerInputWrapper: "flex items-center gap-px rounded-dynamic border border-brand-300",
|
|
47
47
|
timepickerInput: " w-11 border-none px-2.5 py-1.5 text-center text-sm focus:ring-brand-500",
|
|
48
|
-
timepickerLeftInput: "
|
|
49
|
-
timepickerRightInput: " rounded-r-
|
|
48
|
+
timepickerLeftInput: "rounded-l-dynamic",
|
|
49
|
+
timepickerRightInput: " rounded-r-dynamic",
|
|
50
50
|
timepickerSubmitButton: "py-2 focus:ring-0 border-0",
|
|
51
51
|
i18n: {
|
|
52
52
|
weekdays: {
|
|
@@ -20,7 +20,7 @@ export default /*tw*/ {
|
|
|
20
20
|
base: `
|
|
21
21
|
border border-solid rounded border-gray-300 bg-white hover:transition
|
|
22
22
|
hover:border-gray-400
|
|
23
|
-
focus:border-{color}-500 focus:ring-
|
|
23
|
+
focus:border-{color}-500 focus:ring-dynamic focus:ring-opacity-20 focus-within:ring-offset-dynamic focus:ring-{color}-500
|
|
24
24
|
active:border-{color}-500 active:bg-{color}-500
|
|
25
25
|
checked:border-{color}-500 checked:bg-{color}-500 checked:text-{color}-500
|
|
26
26
|
checked:hover:bg-{color}-500 checked:focus:text-{color}-500 checked:active:text-{color}-500
|
|
@@ -3,7 +3,7 @@ export default /*tw*/ {
|
|
|
3
3
|
input: "{UInput}",
|
|
4
4
|
inputFocused: {
|
|
5
5
|
component: "{UInput}",
|
|
6
|
-
block: "ring-
|
|
6
|
+
block: "ring-dynamic ring-offset-dynamic ring-brand-600/[.15] border-brand-500 hover:border-brand-500",
|
|
7
7
|
},
|
|
8
8
|
calendar: {
|
|
9
9
|
component: "{UCalendar}",
|
|
@@ -2,17 +2,21 @@ export default /*tw*/ {
|
|
|
2
2
|
wrapper: "relative",
|
|
3
3
|
input: "{UInput}",
|
|
4
4
|
buttonWrapper: `
|
|
5
|
-
flex rounded-
|
|
6
|
-
focus-within:ring-
|
|
5
|
+
flex rounded-dynamic max-md:justify-between
|
|
6
|
+
focus-within:ring-dynamic focus-within:ring-offset-dynamic focus-within:ring-brand-700 focus-within:ring-opacity-20
|
|
7
|
+
`,
|
|
8
|
+
button: "{UButton} shrink-0 grow rounded-none !ring-0 !ring-offset-0",
|
|
9
|
+
buttonActive: "",
|
|
10
|
+
buttonWrapperActive: "ring-dynamic ring-offset-dynamic ring-brand-700 ring-opacity-20",
|
|
11
|
+
shiftRangeButton: `
|
|
12
|
+
first:rounded-dynamic first:rounded-r-none
|
|
13
|
+
last:rounded-dynamic last:rounded-l-none
|
|
14
|
+
focus:ring-0 focus:ring-offset-0
|
|
7
15
|
`,
|
|
8
|
-
button: "{UButton} shrink-0 grow rounded-none !ring-0",
|
|
9
|
-
buttonActive: "ring-0",
|
|
10
|
-
buttonWrapperActive: "ring-4 ring-brand-700 ring-opacity-20",
|
|
11
|
-
shiftRangeButton: "focus:ring-0 last:rounded-l-none last:rounded-r-lg first:rounded-l-lg first:rounded-r-none",
|
|
12
16
|
nextIconName: "keyboard_arrow_right",
|
|
13
17
|
prevIconName: "keyboard_arrow_left",
|
|
14
18
|
menu: {
|
|
15
|
-
base: "absolute z-40 my-2 w-80 overflow-hidden rounded-
|
|
19
|
+
base: "absolute z-40 my-2 w-80 overflow-hidden rounded-dynamic border border-brand-300 bg-white p-2 shadow focus:outline-none",
|
|
16
20
|
variants: {
|
|
17
21
|
openDirectionX: {
|
|
18
22
|
left: "left-0",
|
|
@@ -64,7 +68,7 @@ export default /*tw*/ {
|
|
|
64
68
|
component: "{UCalendar}",
|
|
65
69
|
wrapper: "p-0 mt-2 w-full border-none shadow-none",
|
|
66
70
|
navigation: "mb-0 border-none",
|
|
67
|
-
navigationSwitchViewButton: "rounded-
|
|
71
|
+
navigationSwitchViewButton: "rounded-dynamic px-3",
|
|
68
72
|
day: "w-full h-10 mb-0.5",
|
|
69
73
|
},
|
|
70
74
|
i18n: {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
label: "{ULabel}",
|
|
3
3
|
inputWrapper: "flex relative w-full",
|
|
4
|
-
rightIconSlot: "flex items-center justify-end whitespace-nowrap pr-3 gap-1 rounded-
|
|
5
|
-
leftIconSlot: "flex items-center justify-end whitespace-nowrap pl-3 gap-1 rounded-
|
|
4
|
+
rightIconSlot: "flex items-center justify-end whitespace-nowrap pr-3 gap-1 rounded-dynamic rounded-l-none",
|
|
5
|
+
leftIconSlot: "flex items-center justify-end whitespace-nowrap pl-3 gap-1 rounded-dynamic rounded-r-none",
|
|
6
6
|
passwordIcon: "",
|
|
7
7
|
passwordVisibleIconName: "visibility-fill",
|
|
8
8
|
passwordHiddenIconName: "visibility_off-fill",
|
|
9
9
|
block: {
|
|
10
10
|
base: `
|
|
11
11
|
w-full bg-white !opacity-100 relative flex transition
|
|
12
|
-
rounded-
|
|
12
|
+
rounded-dynamic border border-solid border-gray-300
|
|
13
13
|
hover:border-gray-400 hover:focus-within:border-brand-500
|
|
14
|
-
focus-within:border-brand-500 focus-within:ring-
|
|
14
|
+
focus-within:border-brand-500 focus-within:ring-dynamic focus-within:ring-offset-dynamic focus-within:ring-brand-600/[.15]
|
|
15
15
|
`,
|
|
16
16
|
variants: {
|
|
17
17
|
disabled: {
|
|
@@ -28,16 +28,15 @@ export default /*tw*/ {
|
|
|
28
28
|
`,
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
|
-
compoundVariants: [{ labelAlign: "topInside", label: true, class: "rounded-lg" }],
|
|
32
31
|
},
|
|
33
32
|
input: {
|
|
34
33
|
base: `
|
|
35
|
-
block w-full py-2 px-3 font-normal leading-none text-gray-900
|
|
34
|
+
block w-full py-2 px-3 font-normal leading-none text-gray-900 bg-white
|
|
35
|
+
border-none rounded-dynamic transition
|
|
36
36
|
placeholder:font-normal placeholder-gray-400
|
|
37
|
-
|
|
38
|
-
focus:outline-none focus:ring-0 disabled:opacity-50
|
|
37
|
+
focus:ring-0 disabled:opacity-50
|
|
39
38
|
disabled:cursor-not-allowed disabled:text-gray-900 disabled:border-gray-100
|
|
40
|
-
read-only:
|
|
39
|
+
read-only:ring-0 read-only:border-gray-300
|
|
41
40
|
`,
|
|
42
41
|
variants: {
|
|
43
42
|
size: {
|
|
@@ -53,7 +52,6 @@ export default /*tw*/ {
|
|
|
53
52
|
},
|
|
54
53
|
},
|
|
55
54
|
compoundVariants: [
|
|
56
|
-
{ labelAlign: "topInside", label: true, class: "rounded-lg" },
|
|
57
55
|
{ labelAlign: "topInside", label: true, size: "sm", class: "pt-5" },
|
|
58
56
|
{ labelAlign: "topInside", label: true, size: "md", class: "pt-6" },
|
|
59
57
|
{ labelAlign: "topInside", label: true, size: "lg", class: "pt-7" },
|
|
@@ -3,7 +3,7 @@ export default /*tw*/ {
|
|
|
3
3
|
dropzoneWrapper: {
|
|
4
4
|
base: `
|
|
5
5
|
p-3 size-auto w-full bg-white transition
|
|
6
|
-
rounded-
|
|
6
|
+
rounded-dynamic border border-solid border-gray-300 hover:border-gray-400
|
|
7
7
|
`,
|
|
8
8
|
variants: {
|
|
9
9
|
error: {
|
|
@@ -19,7 +19,7 @@ export default /*tw*/ {
|
|
|
19
19
|
descriptionTop: "{UText} text-gray-700 mb-2",
|
|
20
20
|
descriptionBottom: "{UText} text-gray-700 mt-2",
|
|
21
21
|
contentWrapper: {
|
|
22
|
-
base: "p-3 gap-6 w-full rounded-
|
|
22
|
+
base: "p-3 gap-6 w-full rounded-dynamic bg-brand-50 relative flex justify-between items-start",
|
|
23
23
|
variants: {
|
|
24
24
|
multiple: {
|
|
25
25
|
false: "items-center",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
input: {
|
|
3
3
|
component: "{UInput}",
|
|
4
|
-
wrapper: "relative flex items-center justify-between w-full rounded-
|
|
4
|
+
wrapper: "relative flex items-center justify-between w-full rounded-dynamic bg-gray-900 bg-opacity-5",
|
|
5
5
|
input: "w-full",
|
|
6
6
|
label: "w-full",
|
|
7
7
|
rightSlot: "pr-0",
|
|
@@ -7,7 +7,8 @@ export default /*tw*/ {
|
|
|
7
7
|
border border-solid border-{color}-300 text-{color}-500
|
|
8
8
|
hover:border-{color}-400
|
|
9
9
|
active:border-{color}-500
|
|
10
|
-
focus:border-{color}-500 focus:bg-{color}-500
|
|
10
|
+
focus:border-{color}-500 focus:bg-{color}-500
|
|
11
|
+
focus:ring-{color}-200 focus:ring-dynamic focus-within:ring-offset-dynamic
|
|
11
12
|
disabled:border-{color}-100 disabled:bg-{color}-100
|
|
12
13
|
`,
|
|
13
14
|
variants: {
|
|
@@ -5,15 +5,16 @@ export default /*tw*/ {
|
|
|
5
5
|
wrapper: {
|
|
6
6
|
base: `
|
|
7
7
|
py-2 flex flex-row-reverse justify-between w-full min-h-full box-border relative
|
|
8
|
-
rounded-
|
|
8
|
+
rounded-dynamic border border-gray-300 bg-white
|
|
9
9
|
hover:border-gray-400 hover:transition hover:focus-within:border-brand-500
|
|
10
|
-
focus-within:
|
|
10
|
+
focus-within:ring-brand-600/[.15] focus-within:ring-dynamic focus-within:ring-offset-dynamic
|
|
11
|
+
focus-within:border-brand-500 focus-within:outline-none
|
|
11
12
|
`,
|
|
12
13
|
variants: {
|
|
13
14
|
error: {
|
|
14
15
|
true: `
|
|
15
16
|
border-red-300 hover:border-red-300
|
|
16
|
-
focus-within:border-red-500 focus-within:ring-
|
|
17
|
+
focus-within:border-red-500 focus-within:ring-red-100
|
|
17
18
|
`,
|
|
18
19
|
},
|
|
19
20
|
disabled: {
|
|
@@ -24,7 +25,6 @@ export default /*tw*/ {
|
|
|
24
25
|
},
|
|
25
26
|
},
|
|
26
27
|
compoundVariants: [
|
|
27
|
-
{ labelAlign: "topInside", label: true, class: "rounded-lg" },
|
|
28
28
|
{ labelAlign: "topInside", label: true, size: "sm", class: "pt-5" },
|
|
29
29
|
{ labelAlign: "topInside", label: true, size: "md", class: "pt-6" },
|
|
30
30
|
{ labelAlign: "topInside", label: true, size: "lg", class: "pt-7" },
|
|
@@ -4,7 +4,7 @@ export default /*tw*/ {
|
|
|
4
4
|
base: `
|
|
5
5
|
transition duration-300
|
|
6
6
|
flex items-center p-0.5 relative rounded-3xl cursor-pointer
|
|
7
|
-
ring-opacity-10 focus-within:ring-
|
|
7
|
+
ring-opacity-10 focus-within:ring-dynamic focus-within:ring-offset-dynamic
|
|
8
8
|
`,
|
|
9
9
|
variants: {
|
|
10
10
|
checked: {
|
|
@@ -4,9 +4,10 @@ export default /*tw*/ {
|
|
|
4
4
|
rightSlot: "flex items-center justify-center h-full w-11 absolute right-0",
|
|
5
5
|
textareaWrapper: {
|
|
6
6
|
base: `
|
|
7
|
-
px-3 py-2 rounded-
|
|
7
|
+
px-3 py-2 rounded-dynamic border border-gray-300 cursor-text bg-white transition
|
|
8
8
|
hover:border-gray-400 hover:focus-within:border-gray-500
|
|
9
|
-
focus-within:
|
|
9
|
+
focus-within:ring-dynamic focus-within:ring-offset-dynamic focus-within:ring-gray-600/[.15]
|
|
10
|
+
focus-within:border-gray-500 focus-within:outline-none
|
|
10
11
|
`,
|
|
11
12
|
variants: {
|
|
12
13
|
error: {
|
|
@@ -24,7 +25,6 @@ export default /*tw*/ {
|
|
|
24
25
|
},
|
|
25
26
|
},
|
|
26
27
|
compoundVariants: [
|
|
27
|
-
{ labelAlign: "topInside", label: true, class: "rounded-lg" },
|
|
28
28
|
{ labelAlign: "topInside", label: true, size: "sm", class: "pt-5" },
|
|
29
29
|
{ labelAlign: "topInside", label: true, size: "md", class: "pt-6" },
|
|
30
30
|
{ labelAlign: "topInside", label: true, size: "lg", class: "pt-7" },
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
import colors from "tailwindcss/colors";
|
|
39
39
|
import { computed } from "vue";
|
|
40
40
|
|
|
41
|
-
import { GRAY_COLORS } from "../../
|
|
41
|
+
import { GRAY_COLORS } from "../../constants";
|
|
42
42
|
|
|
43
43
|
import useAttrs from "../composables/attrs.composable";
|
|
44
44
|
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.234",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -1164,15 +1164,6 @@
|
|
|
1164
1164
|
},
|
|
1165
1165
|
"default": "\"\""
|
|
1166
1166
|
},
|
|
1167
|
-
{
|
|
1168
|
-
"name": "rounded",
|
|
1169
|
-
"description": "Card border radius.",
|
|
1170
|
-
"value": {
|
|
1171
|
-
"kind": "expression",
|
|
1172
|
-
"type": "'sm' | 'md' | 'lg'"
|
|
1173
|
-
},
|
|
1174
|
-
"default": "md"
|
|
1175
|
-
},
|
|
1176
1167
|
{
|
|
1177
1168
|
"name": "padding",
|
|
1178
1169
|
"description": "Card padding.",
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const GRAY_COLORS = ["slate", "gray", "zinc", "neutral", "stone"];
|
|
2
|
-
export const GRAYSCALE_COLOR = "grayscale";
|
|
3
|
-
export const BRAND_COLOR = "brand";
|
|
4
|
-
export const BRAND_COLORS = [
|
|
5
|
-
BRAND_COLOR,
|
|
6
|
-
"red",
|
|
7
|
-
"orange",
|
|
8
|
-
"amber",
|
|
9
|
-
"yellow",
|
|
10
|
-
"lime",
|
|
11
|
-
"green",
|
|
12
|
-
"emerald",
|
|
13
|
-
"teal",
|
|
14
|
-
"cyan",
|
|
15
|
-
"sky",
|
|
16
|
-
"blue",
|
|
17
|
-
"indigo",
|
|
18
|
-
"violet",
|
|
19
|
-
"purple",
|
|
20
|
-
"fuchsia",
|
|
21
|
-
"pink",
|
|
22
|
-
"rose",
|
|
23
|
-
];
|