vueless 0.0.280 → 0.0.282
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/service.platform/index.js +45 -0
- package/service.ui/index.js +135 -233
- package/ui.button/configs/default.config.js +1 -1
- package/ui.button/index.vue +12 -12
- package/ui.button-link/configs/default.config.js +1 -1
- package/ui.button-link/index.vue +17 -17
- package/ui.button-toggle/index.vue +10 -10
- package/ui.button-toggle-item/index.vue +9 -9
- package/ui.container-accordion/index.vue +2 -2
- package/ui.container-card/index.vue +3 -3
- package/ui.container-col/index.vue +6 -6
- package/ui.container-divider/index.vue +12 -12
- package/ui.container-group/index.vue +4 -4
- package/ui.container-modal/index.vue +9 -9
- package/ui.container-modal-confirm/index.stories.js +5 -3
- package/ui.container-modal-confirm/index.vue +5 -5
- package/ui.container-page/composables/attrs.composable.js +2 -1
- package/ui.container-page/index.vue +6 -6
- package/ui.container-row/index.vue +7 -7
- package/ui.data-list/index.vue +7 -7
- package/ui.data-table/index.vue +5 -5
- package/ui.dropdown-badge/index.vue +10 -10
- package/ui.dropdown-button/index.vue +13 -13
- package/ui.dropdown-link/index.vue +12 -12
- package/ui.dropdown-list/index.vue +7 -6
- package/ui.form-calendar/index.vue +7 -7
- package/ui.form-checkbox/index.vue +6 -6
- package/ui.form-checkbox-group/index.vue +4 -4
- package/ui.form-checkbox-multi-state/index.vue +5 -5
- package/ui.form-color-picker/index.vue +5 -5
- package/ui.form-date-picker/index.vue +11 -11
- package/ui.form-date-picker-range/index.vue +9 -9
- package/ui.form-input/configs/default.config.js +1 -1
- package/ui.form-input/index.vue +7 -8
- package/ui.form-input-file/index.vue +7 -7
- package/ui.form-input-money/index.vue +12 -12
- package/ui.form-input-number/index.vue +2 -2
- package/ui.form-input-rating/index.vue +6 -6
- package/ui.form-input-search/index.vue +6 -6
- package/ui.form-label/index.vue +5 -5
- package/ui.form-radio/index.vue +6 -6
- package/ui.form-radio-group/index.vue +4 -4
- package/ui.form-select/configs/default.config.js +1 -1
- package/ui.form-select/index.vue +14 -13
- package/ui.form-switch/index.vue +7 -7
- package/ui.form-textarea/configs/default.config.js +1 -1
- package/ui.form-textarea/index.vue +8 -8
- package/ui.image-avatar/index.vue +6 -6
- package/ui.image-icon/index.vue +6 -6
- package/ui.loader/index.vue +4 -4
- package/ui.loader-rendering/index.vue +2 -2
- package/ui.loader-top/index.vue +3 -2
- package/ui.navigation-pagination/index.vue +11 -11
- package/ui.navigation-progress/index.vue +5 -5
- package/ui.navigation-tab/index.vue +3 -3
- package/ui.navigation-tabs/index.vue +3 -3
- package/ui.other-dot/index.vue +3 -3
- package/ui.text-alert/index.vue +7 -7
- package/ui.text-badge/index.vue +5 -5
- package/ui.text-block/index.vue +4 -4
- package/ui.text-empty/index.vue +2 -2
- package/ui.text-file/index.vue +2 -2
- package/ui.text-files/index.vue +3 -3
- package/ui.text-header/index.vue +7 -7
- package/ui.text-money/index.vue +12 -12
- package/ui.text-notify/index.vue +4 -4
- package/web-types.json +2 -2
package/package.json
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const isBrowser = typeof window !== "undefined";
|
|
2
|
+
const isMac = isBrowser && checkIsMac();
|
|
3
|
+
const isPWA = isBrowser && checkIsPWA();
|
|
4
|
+
const isIOS = isBrowser && checkIsIOS();
|
|
5
|
+
const isWindows = isBrowser && checkIsWindows();
|
|
6
|
+
const isAndroid = isBrowser && checkIsAndroid();
|
|
7
|
+
const isMobileApp = isPWA || isIOS || isAndroid;
|
|
8
|
+
|
|
9
|
+
function checkIsWindows() {
|
|
10
|
+
return getPlatform().toUpperCase().indexOf("WINDOWS") >= 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function checkIsMac() {
|
|
14
|
+
return getPlatform().toUpperCase().indexOf("MAC") >= 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function checkIsPWA() {
|
|
18
|
+
return !!navigator.standalone;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function checkIsIOS() {
|
|
22
|
+
const iOSDevices = [
|
|
23
|
+
"iPad Simulator",
|
|
24
|
+
"iPhone Simulator",
|
|
25
|
+
"iPod Simulator",
|
|
26
|
+
"iPad",
|
|
27
|
+
"iPhone",
|
|
28
|
+
"iPod",
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const platform = getPlatform();
|
|
32
|
+
const isIpodIOS13 = platform.includes("Mac") && "ontouchend" in document;
|
|
33
|
+
|
|
34
|
+
return iOSDevices.includes(platform) || isIpodIOS13;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function checkIsAndroid() {
|
|
38
|
+
return getPlatform().toUpperCase().indexOf("ANDROID") >= 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function getPlatform() {
|
|
42
|
+
return navigator.userAgentData?.platform || navigator.platform || "unknown";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { isBrowser, isMac, isPWA, isIOS, isAndroid, isMobileApp, isWindows };
|
package/service.ui/index.js
CHANGED
|
@@ -90,277 +90,179 @@ export const cva = ({ base = "", variants = {}, compoundVariants = [], defaultVa
|
|
|
90
90
|
defaultVariants,
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
isPWA = false;
|
|
96
|
-
isIOS = false;
|
|
97
|
-
isAndroid = false;
|
|
98
|
-
isMobileApp = false;
|
|
99
|
-
PX_IN_REM = 16;
|
|
100
|
-
HYPHEN_SYMBOL = "-";
|
|
101
|
-
|
|
102
|
-
constructor() {
|
|
103
|
-
// Needed to avoid error in server context for ssr
|
|
104
|
-
// TODO: Find way call it in browser
|
|
105
|
-
// Possible solution: https://github.com/nuxt/nuxt/discussions/7878
|
|
106
|
-
const isBrowser = typeof window !== "undefined";
|
|
107
|
-
|
|
108
|
-
this.isMac = isBrowser && this.checkIsMac();
|
|
109
|
-
this.isPWA = isBrowser && this.checkIsPWA();
|
|
110
|
-
this.isIOS = isBrowser && this.checkIsIOS();
|
|
111
|
-
this.isAndroid = isBrowser && this.checkIsAndroid();
|
|
112
|
-
this.isMobileApp = this.isPWA || this.isIOS || this.isAndroid;
|
|
113
|
-
|
|
114
|
-
this.initTheme();
|
|
115
|
-
}
|
|
93
|
+
const PX_IN_REM = 16;
|
|
94
|
+
const HYPHEN_SYMBOL = "-";
|
|
116
95
|
|
|
117
|
-
|
|
118
|
-
|
|
96
|
+
(() => {
|
|
97
|
+
const prefersColorSchemeDark = window && window.matchMedia("(prefers-color-scheme: dark)");
|
|
119
98
|
|
|
120
|
-
|
|
99
|
+
setTheme({ systemDarkMode: prefersColorSchemeDark.matches });
|
|
121
100
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
101
|
+
prefersColorSchemeDark.addEventListener("change", (event) =>
|
|
102
|
+
setTheme({ systemDarkMode: event.matches }),
|
|
103
|
+
);
|
|
104
|
+
})();
|
|
126
105
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
106
|
+
function getRandomId(length = 15) {
|
|
107
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
108
|
+
const charactersLength = characters.length;
|
|
109
|
+
let id = "";
|
|
130
110
|
|
|
131
|
-
|
|
132
|
-
|
|
111
|
+
while (id.length < length) {
|
|
112
|
+
id += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
133
113
|
}
|
|
134
114
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
"iPad Simulator",
|
|
138
|
-
"iPhone Simulator",
|
|
139
|
-
"iPod Simulator",
|
|
140
|
-
"iPad",
|
|
141
|
-
"iPhone",
|
|
142
|
-
"iPod",
|
|
143
|
-
];
|
|
144
|
-
const platform = this.getPlatform();
|
|
145
|
-
const isIpodIOS13 = platform.includes("Mac") && "ontouchend" in document;
|
|
146
|
-
|
|
147
|
-
return iOSDevices.includes(platform) || isIpodIOS13;
|
|
148
|
-
}
|
|
115
|
+
return id;
|
|
116
|
+
}
|
|
149
117
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
118
|
+
function setTitle({ title, separator = " / ", suffix = "" }) {
|
|
119
|
+
document.title = title ? title + separator + suffix : suffix;
|
|
120
|
+
}
|
|
153
121
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
122
|
+
function setFavicon(faviconPath) {
|
|
123
|
+
if (!faviconPath) return;
|
|
157
124
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
@param { Number } length
|
|
161
|
-
@returns { String }
|
|
162
|
-
*/
|
|
163
|
-
getRandomId(length = 15) {
|
|
164
|
-
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
165
|
-
const charactersLength = characters.length;
|
|
166
|
-
let id = "";
|
|
167
|
-
|
|
168
|
-
while (id.length < length) {
|
|
169
|
-
id += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return id;
|
|
173
|
-
}
|
|
125
|
+
const head = document.querySelector("head");
|
|
126
|
+
const faviconTag = document.createElement("link");
|
|
174
127
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
128
|
+
faviconTag.setAttribute("rel", "shortcut icon");
|
|
129
|
+
faviconTag.setAttribute("href", `${faviconPath}?${Math.random()}`);
|
|
130
|
+
|
|
131
|
+
head.appendChild(faviconTag);
|
|
132
|
+
}
|
|
178
133
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
static setFavicon(faviconPath) {
|
|
185
|
-
if (!faviconPath) return;
|
|
134
|
+
function getDefault(defaultConfig, name) {
|
|
135
|
+
const defaultVariants = merge(
|
|
136
|
+
cloneDeep(defaultConfig.defaultVariants),
|
|
137
|
+
globalComponentConfig[name]?.defaultVariants,
|
|
138
|
+
);
|
|
186
139
|
|
|
187
|
-
|
|
188
|
-
const faviconTag = document.createElement("link");
|
|
140
|
+
defaultVariants.color = getColor(defaultVariants.color);
|
|
189
141
|
|
|
190
|
-
|
|
191
|
-
|
|
142
|
+
return defaultVariants;
|
|
143
|
+
}
|
|
192
144
|
|
|
193
|
-
|
|
194
|
-
|
|
145
|
+
function getColor(color) {
|
|
146
|
+
return (brand ?? DEFAULT_BRAND_COLOR) === GRAYSCALE_COLOR && color === BRAND_COLOR
|
|
147
|
+
? GRAYSCALE_COLOR
|
|
148
|
+
: color;
|
|
149
|
+
}
|
|
195
150
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
@param { String } name
|
|
200
|
-
@returns { Object }
|
|
201
|
-
*/
|
|
202
|
-
static get(defaultConfig, name) {
|
|
203
|
-
const defaultVariants = merge(
|
|
204
|
-
cloneDeep(defaultConfig.defaultVariants),
|
|
205
|
-
globalComponentConfig[name]?.defaultVariants,
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
defaultVariants.color = getColor(defaultVariants.color);
|
|
209
|
-
|
|
210
|
-
return {
|
|
211
|
-
default: defaultVariants,
|
|
212
|
-
};
|
|
151
|
+
function setColor(classes, color) {
|
|
152
|
+
if (typeof classes !== "string") {
|
|
153
|
+
return "";
|
|
213
154
|
}
|
|
214
155
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
156
|
+
return classes?.replaceAll("{color}", color);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function setDarkMode(config) {
|
|
160
|
+
config?.darkMode === undefined
|
|
161
|
+
? localStorage.removeItem(DARK_MODE_SELECTOR)
|
|
162
|
+
: localStorage.setItem(DARK_MODE_SELECTOR, Number(!!config?.darkMode));
|
|
163
|
+
|
|
164
|
+
const storedDarkMode = localStorage.getItem(DARK_MODE_SELECTOR);
|
|
165
|
+
|
|
166
|
+
let isDarkMode =
|
|
167
|
+
storedDarkMode !== null
|
|
168
|
+
? !!Number(storedDarkMode)
|
|
169
|
+
: !!(config?.darkMode ?? vuelessConfig?.darkMode ?? config?.systemDarkMode);
|
|
170
|
+
|
|
171
|
+
isDarkMode
|
|
172
|
+
? document.documentElement.classList.add(DARK_MODE_SELECTOR)
|
|
173
|
+
: document.documentElement.classList.remove(DARK_MODE_SELECTOR);
|
|
174
|
+
|
|
175
|
+
return isDarkMode;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function setTheme(config = {}) {
|
|
179
|
+
const isDarkMode = setDarkMode(config);
|
|
180
|
+
const ring = config?.ring ?? vuelessConfig?.ring ?? DEFAULT_RING;
|
|
181
|
+
const ringOffset = config?.ringOffset ?? vuelessConfig?.ringOffset ?? DEFAULT_RING_OFFSET;
|
|
182
|
+
const rounding = config?.rounding ?? vuelessConfig?.rounding ?? DEFAULT_ROUNDING;
|
|
183
|
+
let brand = config?.brand ?? vuelessConfig?.brand ?? DEFAULT_BRAND_COLOR;
|
|
184
|
+
let gray = config?.gray ?? vuelessConfig?.gray ?? DEFAULT_GRAY_COLOR;
|
|
185
|
+
|
|
186
|
+
const isBrandColor = BRAND_COLORS.some((color) => color === brand);
|
|
187
|
+
const isGrayColor = GRAY_COLORS.some((color) => color === gray);
|
|
188
|
+
|
|
189
|
+
if (!isBrandColor) {
|
|
190
|
+
// eslint-disable-next-line no-console
|
|
191
|
+
console.warn(`Brand color '${brand}' is incorrect.`);
|
|
224
192
|
}
|
|
225
193
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
@param { String } color
|
|
230
|
-
@returns { String }
|
|
231
|
-
*/
|
|
232
|
-
setColor(classes, color) {
|
|
233
|
-
if (typeof classes !== "string") {
|
|
234
|
-
return "";
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
return classes?.replaceAll("{color}", color);
|
|
194
|
+
if (!isGrayColor) {
|
|
195
|
+
// eslint-disable-next-line no-console
|
|
196
|
+
console.warn(`Gray color '${gray}' is incorrect.`);
|
|
238
197
|
}
|
|
239
198
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
@param { Object } config
|
|
243
|
-
@returns { Boolean } isDarkMode
|
|
244
|
-
*/
|
|
245
|
-
setDarkMode(config) {
|
|
246
|
-
config?.darkMode === undefined
|
|
247
|
-
? localStorage.removeItem(DARK_MODE_SELECTOR)
|
|
248
|
-
: localStorage.setItem(DARK_MODE_SELECTOR, Number(!!config?.darkMode));
|
|
199
|
+
const defaultBrandShade = isDarkMode ? 400 : 600;
|
|
200
|
+
const defaultGrayShade = isDarkMode ? 400 : 600;
|
|
249
201
|
|
|
250
|
-
|
|
202
|
+
if (gray === COOL_COLOR) {
|
|
203
|
+
gray = GRAY_COLOR;
|
|
204
|
+
}
|
|
251
205
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
: !!(config?.darkMode ?? vuelessConfig?.darkMode ?? config?.systemDarkMode);
|
|
206
|
+
if (brand === GRAYSCALE_COLOR) {
|
|
207
|
+
brand = gray;
|
|
208
|
+
}
|
|
256
209
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
210
|
+
const variables = {
|
|
211
|
+
"--vl-ring": `${ring}px`,
|
|
212
|
+
"--vl-ring-offset": `${ringOffset}px`,
|
|
213
|
+
"--vl-rounding": `${Number(rounding) / PX_IN_REM}rem`,
|
|
214
|
+
"--vl-color-gray-default": convertHexInRgb(colors[gray][defaultBrandShade]),
|
|
215
|
+
"--vl-color-brand-default": convertHexInRgb(colors[brand][defaultGrayShade]),
|
|
216
|
+
};
|
|
260
217
|
|
|
261
|
-
|
|
218
|
+
for (const key in colors[gray]) {
|
|
219
|
+
variables[`--vl-color-gray-${key}`] = convertHexInRgb(colors[gray][key]);
|
|
262
220
|
}
|
|
263
221
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
const ringOffset = config?.ringOffset ?? vuelessConfig?.ringOffset ?? DEFAULT_RING_OFFSET;
|
|
273
|
-
const rounding = config?.rounding ?? vuelessConfig?.rounding ?? DEFAULT_ROUNDING;
|
|
274
|
-
let brand = config?.brand ?? vuelessConfig?.brand ?? DEFAULT_BRAND_COLOR;
|
|
275
|
-
let gray = config?.gray ?? vuelessConfig?.gray ?? DEFAULT_GRAY_COLOR;
|
|
276
|
-
|
|
277
|
-
const isBrandColor = BRAND_COLORS.some((color) => color === brand);
|
|
278
|
-
const isGrayColor = GRAY_COLORS.some((color) => color === gray);
|
|
279
|
-
|
|
280
|
-
if (!isBrandColor) {
|
|
281
|
-
// eslint-disable-next-line no-console
|
|
282
|
-
console.log(`Brand color '${brand}' is incorrect.`);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
if (!isGrayColor) {
|
|
286
|
-
// eslint-disable-next-line no-console
|
|
287
|
-
console.log(`Gray color '${gray}' is incorrect.`);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// set default shade related to the selected mode
|
|
291
|
-
const defaultBrandShade = isDarkMode ? 400 : 600;
|
|
292
|
-
const defaultGrayShade = isDarkMode ? 400 : 600;
|
|
293
|
-
|
|
294
|
-
// handling custom `cool` color
|
|
295
|
-
if (gray === COOL_COLOR) {
|
|
296
|
-
gray = GRAY_COLOR;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// handling custom `grayscale` color
|
|
300
|
-
if (brand === GRAYSCALE_COLOR) {
|
|
301
|
-
brand = gray;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
const variables = {
|
|
305
|
-
"--vl-ring": `${ring}px`,
|
|
306
|
-
"--vl-ring-offset": `${ringOffset}px`,
|
|
307
|
-
"--vl-rounding": `${Number(rounding) / this.PX_IN_REM}rem`,
|
|
308
|
-
"--vl-color-gray-default": UIService.convertHexInRgb(colors[gray][defaultBrandShade]),
|
|
309
|
-
"--vl-color-brand-default": UIService.convertHexInRgb(colors[brand][defaultGrayShade]),
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
for (const key in colors[gray]) {
|
|
313
|
-
variables[`--vl-color-gray-${key}`] = UIService.convertHexInRgb(colors[gray][key]);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
for (const key in colors[brand]) {
|
|
317
|
-
variables[`--vl-color-brand-${key}`] = UIService.convertHexInRgb(colors[brand][key]);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
const style = document.createElement("style");
|
|
321
|
-
const stringVariables = Object.entries(variables)
|
|
322
|
-
.map(([key, value]) => `${key}: ${value};`)
|
|
323
|
-
.join(" ");
|
|
324
|
-
|
|
325
|
-
style.innerHTML = `:root {${stringVariables}`;
|
|
326
|
-
|
|
327
|
-
document.head.appendChild(style);
|
|
328
|
-
};
|
|
222
|
+
for (const key in colors[brand]) {
|
|
223
|
+
variables[`--vl-color-brand-${key}`] = convertHexInRgb(colors[brand][key]);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const style = document.createElement("style");
|
|
227
|
+
const stringVariables = Object.entries(variables)
|
|
228
|
+
.map(([key, value]) => `${key}: ${value};`)
|
|
229
|
+
.join(" ");
|
|
329
230
|
|
|
330
|
-
|
|
331
|
-
|
|
231
|
+
style.innerHTML = `:root {${stringVariables}`;
|
|
232
|
+
|
|
233
|
+
document.head.appendChild(style);
|
|
234
|
+
}
|
|
332
235
|
|
|
333
|
-
|
|
236
|
+
function convertHexInRgb(hex) {
|
|
237
|
+
const color = hex.replace(/#/g, "");
|
|
334
238
|
|
|
335
|
-
|
|
336
|
-
r = parseInt(color.substring(0, 2), 16);
|
|
337
|
-
g = parseInt(color.substring(2, 4), 16);
|
|
338
|
-
b = parseInt(color.substring(4, 6), 16);
|
|
339
|
-
}
|
|
239
|
+
let r, g, b;
|
|
340
240
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
241
|
+
if (color.length === 6) {
|
|
242
|
+
r = parseInt(color.substring(0, 2), 16);
|
|
243
|
+
g = parseInt(color.substring(2, 4), 16);
|
|
244
|
+
b = parseInt(color.substring(4, 6), 16);
|
|
245
|
+
}
|
|
346
246
|
|
|
347
|
-
|
|
247
|
+
if (color.length === 3) {
|
|
248
|
+
r = parseInt(color.substring(0, 1).repeat(2), 16);
|
|
249
|
+
g = parseInt(color.substring(1, 2).repeat(2), 16);
|
|
250
|
+
b = parseInt(color.substring(2, 3).repeat(2), 16);
|
|
348
251
|
}
|
|
252
|
+
|
|
253
|
+
return color.length === 6 || color.length === 3 ? `${r}, ${g}, ${b}` : "";
|
|
349
254
|
}
|
|
350
255
|
|
|
351
|
-
export
|
|
256
|
+
export {
|
|
257
|
+
PX_IN_REM,
|
|
258
|
+
HYPHEN_SYMBOL,
|
|
352
259
|
getRandomId,
|
|
260
|
+
setTitle,
|
|
261
|
+
setFavicon,
|
|
262
|
+
getDefault,
|
|
353
263
|
getColor,
|
|
354
264
|
setColor,
|
|
265
|
+
setDarkMode,
|
|
355
266
|
setTheme,
|
|
356
|
-
setTitle,
|
|
357
|
-
setFavicon,
|
|
358
267
|
convertHexInRgb,
|
|
359
|
-
|
|
360
|
-
isPWA,
|
|
361
|
-
isIOS,
|
|
362
|
-
isAndroid,
|
|
363
|
-
isMobileApp,
|
|
364
|
-
PX_IN_REM,
|
|
365
|
-
HYPHEN_SYMBOL,
|
|
366
|
-
} = new UIService();
|
|
268
|
+
};
|
|
@@ -6,7 +6,7 @@ export default /*tw*/ {
|
|
|
6
6
|
border border-solid transition
|
|
7
7
|
focus:ring-{color}-700/15 focus:ring-dynamic focus:ring-offset-dynamic
|
|
8
8
|
focus-within:ring-{color}-700/15 focus-within:ring-dynamic focus-within:ring-offset-dynamic
|
|
9
|
-
disabled:ring-0 disabled:cursor-not-allowed cursor-pointer
|
|
9
|
+
disabled:ring-0 disabled:ring-offset-0 disabled:cursor-not-allowed cursor-pointer
|
|
10
10
|
`,
|
|
11
11
|
variants: {
|
|
12
12
|
size: {
|
package/ui.button/index.vue
CHANGED
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
<script setup>
|
|
84
84
|
import { computed, ref } from "vue";
|
|
85
85
|
|
|
86
|
-
import
|
|
86
|
+
import { getRandomId, getDefault } from "../service.ui";
|
|
87
87
|
import ULoader from "../ui.loader";
|
|
88
88
|
import UIcon from "../ui.image-icon";
|
|
89
89
|
|
|
@@ -101,7 +101,7 @@ const props = defineProps({
|
|
|
101
101
|
*/
|
|
102
102
|
variant: {
|
|
103
103
|
type: String,
|
|
104
|
-
default:
|
|
104
|
+
default: getDefault(defaultConfig, UButton).variant,
|
|
105
105
|
},
|
|
106
106
|
|
|
107
107
|
/**
|
|
@@ -110,7 +110,7 @@ const props = defineProps({
|
|
|
110
110
|
*/
|
|
111
111
|
color: {
|
|
112
112
|
type: String,
|
|
113
|
-
default:
|
|
113
|
+
default: getDefault(defaultConfig, UButton).color,
|
|
114
114
|
},
|
|
115
115
|
|
|
116
116
|
/**
|
|
@@ -119,7 +119,7 @@ const props = defineProps({
|
|
|
119
119
|
*/
|
|
120
120
|
size: {
|
|
121
121
|
type: String,
|
|
122
|
-
default:
|
|
122
|
+
default: getDefault(defaultConfig, UButton).size,
|
|
123
123
|
},
|
|
124
124
|
|
|
125
125
|
/**
|
|
@@ -151,7 +151,7 @@ const props = defineProps({
|
|
|
151
151
|
*/
|
|
152
152
|
tag: {
|
|
153
153
|
type: String,
|
|
154
|
-
default:
|
|
154
|
+
default: getDefault(defaultConfig, UButton).tag,
|
|
155
155
|
},
|
|
156
156
|
|
|
157
157
|
/**
|
|
@@ -159,7 +159,7 @@ const props = defineProps({
|
|
|
159
159
|
*/
|
|
160
160
|
filled: {
|
|
161
161
|
type: Boolean,
|
|
162
|
-
default:
|
|
162
|
+
default: getDefault(defaultConfig, UButton).filled,
|
|
163
163
|
},
|
|
164
164
|
|
|
165
165
|
/**
|
|
@@ -167,7 +167,7 @@ const props = defineProps({
|
|
|
167
167
|
*/
|
|
168
168
|
disabled: {
|
|
169
169
|
type: Boolean,
|
|
170
|
-
default:
|
|
170
|
+
default: getDefault(defaultConfig, UButton).disabled,
|
|
171
171
|
},
|
|
172
172
|
|
|
173
173
|
/**
|
|
@@ -175,7 +175,7 @@ const props = defineProps({
|
|
|
175
175
|
*/
|
|
176
176
|
block: {
|
|
177
177
|
type: Boolean,
|
|
178
|
-
default:
|
|
178
|
+
default: getDefault(defaultConfig, UButton).block,
|
|
179
179
|
},
|
|
180
180
|
|
|
181
181
|
/**
|
|
@@ -183,7 +183,7 @@ const props = defineProps({
|
|
|
183
183
|
*/
|
|
184
184
|
pill: {
|
|
185
185
|
type: Boolean,
|
|
186
|
-
default:
|
|
186
|
+
default: getDefault(defaultConfig, UButton).pill,
|
|
187
187
|
},
|
|
188
188
|
|
|
189
189
|
/**
|
|
@@ -191,7 +191,7 @@ const props = defineProps({
|
|
|
191
191
|
*/
|
|
192
192
|
square: {
|
|
193
193
|
type: Boolean,
|
|
194
|
-
default:
|
|
194
|
+
default: getDefault(defaultConfig, UButton).square,
|
|
195
195
|
},
|
|
196
196
|
|
|
197
197
|
/**
|
|
@@ -199,7 +199,7 @@ const props = defineProps({
|
|
|
199
199
|
*/
|
|
200
200
|
loading: {
|
|
201
201
|
type: Boolean,
|
|
202
|
-
default:
|
|
202
|
+
default: getDefault(defaultConfig, UButton).loading,
|
|
203
203
|
},
|
|
204
204
|
|
|
205
205
|
/**
|
|
@@ -207,7 +207,7 @@ const props = defineProps({
|
|
|
207
207
|
*/
|
|
208
208
|
noRing: {
|
|
209
209
|
type: Boolean,
|
|
210
|
-
default:
|
|
210
|
+
default: getDefault(defaultConfig, UButton).noRing,
|
|
211
211
|
},
|
|
212
212
|
|
|
213
213
|
/**
|
|
@@ -10,7 +10,7 @@ export default /*tw*/ {
|
|
|
10
10
|
white: "focus-within:ring-white/15",
|
|
11
11
|
},
|
|
12
12
|
disabled: {
|
|
13
|
-
true: "focus-within:ring-0 cursor-not-allowed",
|
|
13
|
+
true: "focus-within:ring-0 focus-within:ring-offset-0 cursor-not-allowed",
|
|
14
14
|
},
|
|
15
15
|
noRing: {
|
|
16
16
|
true: "focus-within:ring-0 focus-within:ring-offset-0",
|