@solibo/solibo-ui 0.3.41 → 0.4.2
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/README.md +18 -8
- package/dist/assets/index.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/components/_collapsible/index.cjs +1 -1
- package/dist/components/_collapsible/index.js +1 -1
- package/dist/components/_dropdown/index.cjs +1 -1
- package/dist/components/_dropdown/index.js +2 -2
- package/dist/components/_portal/index.cjs +1 -1
- package/dist/components/_portal/index.js +2 -2
- package/dist/components/accordion/index.cjs +1 -1
- package/dist/components/accordion/index.cjs.map +1 -1
- package/dist/components/accordion/index.js +11 -17
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.cjs.map +1 -1
- package/dist/components/button/index.js +22 -19
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/dialog/index.cjs +1 -1
- package/dist/components/dialog/index.cjs.map +1 -1
- package/dist/components/dialog/index.js +6 -6
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/file/index.cjs +1 -1
- package/dist/components/file/index.cjs.map +1 -1
- package/dist/components/file/index.js +17 -16
- package/dist/components/file/index.js.map +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.cjs.map +1 -1
- package/dist/components/input/index.js +22 -21
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +2 -2
- package/dist/components/textarea/index.cjs +1 -1
- package/dist/components/textarea/index.cjs.map +1 -1
- package/dist/components/textarea/index.js +1 -1
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/toggle/index.cjs +1 -1
- package/dist/components/toggle/index.cjs.map +1 -1
- package/dist/components/toggle/index.js +17 -14
- package/dist/components/toggle/index.js.map +1 -1
- package/dist/{index-CfK1ATlt.cjs → index-D0Nzihh-.cjs} +2 -2
- package/dist/{index-CfK1ATlt.cjs.map → index-D0Nzihh-.cjs.map} +1 -1
- package/dist/{index-C_OgUYu-.js → index-s_TTRzH8.js} +2 -2
- package/dist/{index-C_OgUYu-.js.map → index-s_TTRzH8.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +26 -29
- package/dist/index.js +1 -1
- package/dist/tokens.css +76 -0
- package/dist/tokens.json +334 -0
- package/dist/utils--n2yqjCy.js +45 -0
- package/dist/utils--n2yqjCy.js.map +1 -0
- package/dist/utils-DBzf7CFq.cjs +2 -0
- package/dist/utils-DBzf7CFq.cjs.map +1 -0
- package/package.json +11 -5
- package/dist/utils-BFlnRYx7.js +0 -34
- package/dist/utils-BFlnRYx7.js.map +0 -1
- package/dist/utils-DqVa4K58.cjs +0 -2
- package/dist/utils-DqVa4K58.cjs.map +0 -1
package/dist/tokens.json
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"format": "solibo-design-tokens",
|
|
4
|
+
"packageName": "@solibo/solibo-ui",
|
|
5
|
+
"packageVersion": "0.4.2",
|
|
6
|
+
"schemaVersion": 1
|
|
7
|
+
},
|
|
8
|
+
"tokens": {
|
|
9
|
+
"border": {
|
|
10
|
+
"$type": "string",
|
|
11
|
+
"$value": "{border.width} solid {color.border}",
|
|
12
|
+
"radius": {
|
|
13
|
+
"$type": "dimension",
|
|
14
|
+
"$value": "calc({unit} / 1.5)",
|
|
15
|
+
"large": {
|
|
16
|
+
"$type": "dimension",
|
|
17
|
+
"$value": "calc({unit} * 1.5)"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"width": {
|
|
21
|
+
"$type": "dimension",
|
|
22
|
+
"$value": "1px",
|
|
23
|
+
"heavy": {
|
|
24
|
+
"$type": "dimension",
|
|
25
|
+
"$value": "2px"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"color": {
|
|
30
|
+
"background": {
|
|
31
|
+
"light": {
|
|
32
|
+
"$type": "color",
|
|
33
|
+
"$value": "{color.neutral.light}"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"black": {
|
|
37
|
+
"$type": "color",
|
|
38
|
+
"$value": "rgb(23 23 23)"
|
|
39
|
+
},
|
|
40
|
+
"border": {
|
|
41
|
+
"$type": "color",
|
|
42
|
+
"$value": "{color.timberwolf}",
|
|
43
|
+
"primary": {
|
|
44
|
+
"$type": "color",
|
|
45
|
+
"$value": "rgb(42 42 42 / 12%)"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"cod": {
|
|
49
|
+
"gray": {
|
|
50
|
+
"$type": "color",
|
|
51
|
+
"$value": "rgb(11 11 11)"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"dark": {
|
|
55
|
+
"$type": "color",
|
|
56
|
+
"$value": "rgb(180 180 180)"
|
|
57
|
+
},
|
|
58
|
+
"draft": {
|
|
59
|
+
"$type": "color",
|
|
60
|
+
"$value": "rgb(255 255 200 / 80%)"
|
|
61
|
+
},
|
|
62
|
+
"electric": {
|
|
63
|
+
"violet": {
|
|
64
|
+
"$type": "color",
|
|
65
|
+
"$value": "rgb(90 35 245)"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"fallback": {
|
|
69
|
+
"$type": "color",
|
|
70
|
+
"$value": "{color.silver}"
|
|
71
|
+
},
|
|
72
|
+
"green": {
|
|
73
|
+
"$type": "color",
|
|
74
|
+
"$value": "rgb(0 146 20)",
|
|
75
|
+
"dark": {
|
|
76
|
+
"$type": "color",
|
|
77
|
+
"$value": "rgb(33 69 45)"
|
|
78
|
+
},
|
|
79
|
+
"light": {
|
|
80
|
+
"$type": "color",
|
|
81
|
+
"$value": "rgb(209 250 229)"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"highlight": {
|
|
85
|
+
"$type": "color",
|
|
86
|
+
"$value": "rgb(235 235 235)"
|
|
87
|
+
},
|
|
88
|
+
"icon": {
|
|
89
|
+
"$type": "color",
|
|
90
|
+
"$value": "{color.outer.space}"
|
|
91
|
+
},
|
|
92
|
+
"mahogany": {
|
|
93
|
+
"$type": "color",
|
|
94
|
+
"$value": "rgb(136 4 2)"
|
|
95
|
+
},
|
|
96
|
+
"neutral": {
|
|
97
|
+
"$type": "color",
|
|
98
|
+
"$value": "{color.timberwolf}",
|
|
99
|
+
"light": {
|
|
100
|
+
"$type": "color",
|
|
101
|
+
"$value": "{color.wild.sand}"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"outer": {
|
|
105
|
+
"space": {
|
|
106
|
+
"$type": "color",
|
|
107
|
+
"$value": "rgb(82 82 82)"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"placeholder": {
|
|
111
|
+
"text": {
|
|
112
|
+
"$type": "color",
|
|
113
|
+
"$value": "{color.silver}"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"primary": {
|
|
117
|
+
"$type": "color",
|
|
118
|
+
"$value": "{color.electric.violet}",
|
|
119
|
+
"dark": {
|
|
120
|
+
"$type": "color",
|
|
121
|
+
"$value": "{color.purple.heart}"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"purple": {
|
|
125
|
+
"heart": {
|
|
126
|
+
"$type": "color",
|
|
127
|
+
"$value": "rgb(64 25 174)"
|
|
128
|
+
},
|
|
129
|
+
"light": {
|
|
130
|
+
"$type": "color",
|
|
131
|
+
"$value": "rgb(239 233 254)"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"red": {
|
|
135
|
+
"$type": "color",
|
|
136
|
+
"$value": "rgb(191 6 3)",
|
|
137
|
+
"light": {
|
|
138
|
+
"$type": "color",
|
|
139
|
+
"$value": "rgb(235 178 177)"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"silver": {
|
|
143
|
+
"$type": "color",
|
|
144
|
+
"$value": "rgb(194 194 194)"
|
|
145
|
+
},
|
|
146
|
+
"surface": {
|
|
147
|
+
"active": {
|
|
148
|
+
"$type": "color",
|
|
149
|
+
"$value": "rgb(123 79 247 / 20%)"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"text": {
|
|
153
|
+
"$type": "color",
|
|
154
|
+
"$value": "{color.text.primary}",
|
|
155
|
+
"primary": {
|
|
156
|
+
"$type": "color",
|
|
157
|
+
"$value": "{color.cod.gray}"
|
|
158
|
+
},
|
|
159
|
+
"secondary": {
|
|
160
|
+
"$type": "color",
|
|
161
|
+
"$value": "{color.outer.space}"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"timberwolf": {
|
|
165
|
+
"$type": "color",
|
|
166
|
+
"$value": "rgb(223 223 223)"
|
|
167
|
+
},
|
|
168
|
+
"translucent": {
|
|
169
|
+
"$type": "color",
|
|
170
|
+
"$value": "rgba(255 255 255 / 60%)"
|
|
171
|
+
},
|
|
172
|
+
"warning": {
|
|
173
|
+
"$type": "color",
|
|
174
|
+
"$value": "{color.red}"
|
|
175
|
+
},
|
|
176
|
+
"white": {
|
|
177
|
+
"$type": "color",
|
|
178
|
+
"$value": "rgb(255 255 255)"
|
|
179
|
+
},
|
|
180
|
+
"wild": {
|
|
181
|
+
"sand": {
|
|
182
|
+
"$type": "color",
|
|
183
|
+
"$value": "rgb(245 245 245)"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"font": {
|
|
188
|
+
"family": {
|
|
189
|
+
"$type": "fontFamily",
|
|
190
|
+
"$value": "'Figtree', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"
|
|
191
|
+
},
|
|
192
|
+
"size": {
|
|
193
|
+
"$type": "string",
|
|
194
|
+
"$value": "{unit}",
|
|
195
|
+
"h1": {
|
|
196
|
+
"$type": "dimension",
|
|
197
|
+
"$value": "calc({unit} * 2)"
|
|
198
|
+
},
|
|
199
|
+
"h2": {
|
|
200
|
+
"$type": "dimension",
|
|
201
|
+
"$value": "calc({unit} * 1.25)"
|
|
202
|
+
},
|
|
203
|
+
"h3": {
|
|
204
|
+
"$type": "dimension",
|
|
205
|
+
"$value": "calc({unit})"
|
|
206
|
+
},
|
|
207
|
+
"small": {
|
|
208
|
+
"$type": "dimension",
|
|
209
|
+
"$value": "calc({unit} * 0.75)"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
"weight": {
|
|
213
|
+
"bold": {
|
|
214
|
+
"$type": "fontWeight",
|
|
215
|
+
"$value": "700"
|
|
216
|
+
},
|
|
217
|
+
"normal": {
|
|
218
|
+
"$type": "fontWeight",
|
|
219
|
+
"$value": "400"
|
|
220
|
+
},
|
|
221
|
+
"semibold": {
|
|
222
|
+
"$type": "fontWeight",
|
|
223
|
+
"$value": "600"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"gradient": {
|
|
228
|
+
"$type": "gradient",
|
|
229
|
+
"$value": "linear-gradient(180deg, rgb(255 255 255 / 100%), transparent 50%)"
|
|
230
|
+
},
|
|
231
|
+
"icon": {
|
|
232
|
+
"size": {
|
|
233
|
+
"$type": "dimension",
|
|
234
|
+
"$value": "calc({unit} * 1.5)"
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"negative": {
|
|
238
|
+
"unit": {
|
|
239
|
+
"$type": "dimension",
|
|
240
|
+
"$value": "calc(-1 * {unit})",
|
|
241
|
+
"large": {
|
|
242
|
+
"$type": "dimension",
|
|
243
|
+
"$value": "calc({negative.unit} * 2)"
|
|
244
|
+
},
|
|
245
|
+
"small": {
|
|
246
|
+
"$type": "dimension",
|
|
247
|
+
"$value": "calc({negative.unit} / 2)"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
"offset": {
|
|
252
|
+
"$type": "dimension",
|
|
253
|
+
"$value": "calc(-2 * {unit})"
|
|
254
|
+
},
|
|
255
|
+
"opacity": {
|
|
256
|
+
"disabled": {
|
|
257
|
+
"$type": "number",
|
|
258
|
+
"$value": "{opacity.minimal}"
|
|
259
|
+
},
|
|
260
|
+
"minimal": {
|
|
261
|
+
"$type": "number",
|
|
262
|
+
"$value": "0.5"
|
|
263
|
+
},
|
|
264
|
+
"visited": {
|
|
265
|
+
"$type": "number",
|
|
266
|
+
"$value": "{opacity.minimal}"
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
"padding": {
|
|
270
|
+
"box": {
|
|
271
|
+
"$type": "string",
|
|
272
|
+
"$value": "0.05px {unit}"
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
"shadow": {
|
|
276
|
+
"$type": "shadow",
|
|
277
|
+
"$value": "{shadow.color} {unit.micro} {unit.micro} {unit.tiny}",
|
|
278
|
+
"big": {
|
|
279
|
+
"$type": "shadow",
|
|
280
|
+
"$value": "{shadow.color} {unit.micro} {unit.micro} {unit.small}"
|
|
281
|
+
},
|
|
282
|
+
"color": {
|
|
283
|
+
"$type": "shadow",
|
|
284
|
+
"$value": "rgb(0 0 0 / 10%)"
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
"transition": {
|
|
288
|
+
"delay": {
|
|
289
|
+
"$type": "duration",
|
|
290
|
+
"$value": "125ms"
|
|
291
|
+
},
|
|
292
|
+
"duration": {
|
|
293
|
+
"$type": "duration",
|
|
294
|
+
"$value": "250ms",
|
|
295
|
+
"long": {
|
|
296
|
+
"$type": "duration",
|
|
297
|
+
"$value": "calc({transition.duration} * 2)"
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"timing": {
|
|
301
|
+
"function": {
|
|
302
|
+
"$type": "string",
|
|
303
|
+
"$value": "ease-out"
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
"unit": {
|
|
308
|
+
"$type": "dimension",
|
|
309
|
+
"$value": "16px",
|
|
310
|
+
"large": {
|
|
311
|
+
"$type": "dimension",
|
|
312
|
+
"$value": "calc({unit} * 2)"
|
|
313
|
+
},
|
|
314
|
+
"micro": {
|
|
315
|
+
"$type": "dimension",
|
|
316
|
+
"$value": "calc({unit} / 8)"
|
|
317
|
+
},
|
|
318
|
+
"small": {
|
|
319
|
+
"$type": "dimension",
|
|
320
|
+
"$value": "calc({unit} / 2)"
|
|
321
|
+
},
|
|
322
|
+
"tiny": {
|
|
323
|
+
"$type": "dimension",
|
|
324
|
+
"$value": "calc({unit} / 4)"
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
"z": {
|
|
328
|
+
"max": {
|
|
329
|
+
"$type": "number",
|
|
330
|
+
"$value": "2147483647"
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useState as d, useCallback as m, useEffect as f } from "react";
|
|
2
|
+
const p = /^--[\w-]+$/, y = /^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/, C = /* @__PURE__ */ new Set(["currentcolor", "inherit", "initial", "revert", "revert-layer", "unset"]), s = typeof document < "u" ? document.createElement("span") : null;
|
|
3
|
+
function a(u) {
|
|
4
|
+
const e = u.trim();
|
|
5
|
+
if (!e || !s || C.has(e.toLowerCase()))
|
|
6
|
+
return e;
|
|
7
|
+
const t = document.body ?? document.documentElement;
|
|
8
|
+
if (!t || (s.style.color = e, !s.style.color))
|
|
9
|
+
return e;
|
|
10
|
+
t.appendChild(s);
|
|
11
|
+
const o = getComputedStyle(s).color.trim();
|
|
12
|
+
return s.remove(), o || e;
|
|
13
|
+
}
|
|
14
|
+
function w(u, e = "currentColor") {
|
|
15
|
+
var l;
|
|
16
|
+
if (typeof document > "u")
|
|
17
|
+
return e;
|
|
18
|
+
const t = getComputedStyle(document.documentElement), o = /* @__PURE__ */ new Set();
|
|
19
|
+
let n = u.trim();
|
|
20
|
+
for (; n; ) {
|
|
21
|
+
const r = n.match(y), c = (r == null ? void 0 : r[1]) ?? (p.test(n) ? n : null), i = (l = r == null ? void 0 : r[2]) == null ? void 0 : l.trim();
|
|
22
|
+
if (!c)
|
|
23
|
+
return a(n);
|
|
24
|
+
if (o.has(c)) {
|
|
25
|
+
n = i ?? "";
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
o.add(c), n = t.getPropertyValue(c).trim() || i || "";
|
|
29
|
+
}
|
|
30
|
+
return a(e);
|
|
31
|
+
}
|
|
32
|
+
function b(u) {
|
|
33
|
+
const [e, t] = d(!1), o = m(() => t(!0), []);
|
|
34
|
+
return f(() => {
|
|
35
|
+
t(!1);
|
|
36
|
+
}, [u]), {
|
|
37
|
+
touched: e,
|
|
38
|
+
onBlur: o
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
w as r,
|
|
43
|
+
b as u
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=utils--n2yqjCy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils--n2yqjCy.js","sources":["../src/utils.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nconst cssVariablePattern = /^--[\\w-]+$/;\nconst cssVariableReferencePattern = /^var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.+))?\\)$/;\n\nconst unresolvedColorKeywords = new Set([\n 'currentcolor',\n 'inherit',\n 'initial',\n 'revert',\n 'revert-layer',\n 'unset',\n]);\n\nconst probe = typeof document !== 'undefined' ? document.createElement('span') : null;\n\nfunction normalizeColorValue(input: string): string {\n const value = input.trim();\n\n if (!value || !probe || unresolvedColorKeywords.has(value.toLowerCase())) {\n return value;\n }\n\n const mountNode = document.body ?? document.documentElement;\n\n if (!mountNode) {\n return value;\n }\n\n probe.style.color = value;\n\n if (!probe.style.color) {\n return value;\n }\n\n mountNode.appendChild(probe);\n\n const normalized = getComputedStyle(probe).color.trim();\n probe.remove();\n\n return normalized || value;\n}\n\nexport function resolveColor(input: `--${string}` | string, fallback = 'currentColor'): string {\n if (typeof document === 'undefined') {\n return fallback;\n }\n\n const styles = getComputedStyle(document.documentElement);\n const seen = new Set<string>();\n let current = input.trim();\n\n while (current) {\n const match = current.match(cssVariableReferencePattern);\n const variableName = match?.[1] ?? (cssVariablePattern.test(current) ? current : null);\n const nestedFallback = match?.[2]?.trim();\n\n if (!variableName) {\n return normalizeColorValue(current);\n }\n\n if (seen.has(variableName)) {\n current = nestedFallback ?? '';\n continue;\n }\n\n seen.add(variableName);\n\n current = styles.getPropertyValue(variableName).trim() || nestedFallback || '';\n }\n\n return normalizeColorValue(fallback);\n}\n\nexport function useTouched(resetKey?: unknown) {\n const [touched, setTouched] = useState(false);\n const onBlur = useCallback(() => setTouched(true), []);\n\n useEffect(() => {\n setTouched(false);\n }, [resetKey]);\n\n return { touched, onBlur };\n}\n"],"names":["cssVariablePattern","cssVariableReferencePattern","unresolvedColorKeywords","Set","probe","document","createElement","normalizeColorValue","input","value","trim","has","toLowerCase","mountNode","body","documentElement","style","color","appendChild","normalized","getComputedStyle","remove","resolveColor","fallback","styles","seen","current","match","variableName","test","nestedFallback","add","getPropertyValue","useTouched","resetKey","touched","setTouched","useState","onBlur","useCallback","useEffect"],"mappings":";AAEA,MAAMA,IAAqB,cACrBC,IAA8B,0CAE9BC,IAA0B,oBAAIC,IAAI,CACtC,gBACA,WACA,WACA,UACA,gBACA,OAAO,CACR,GAEKC,IAAQ,OAAOC,WAAa,MAAcA,SAASC,cAAc,MAAM,IAAI;AAEjF,SAASC,EAAoBC,GAAuB;AAClD,QAAMC,IAAQD,EAAME,KAAAA;AAEpB,MAAI,CAACD,KAAS,CAACL,KAASF,EAAwBS,IAAIF,EAAMG,YAAAA,CAAa;AACrE,WAAOH;AAGT,QAAMI,IAAYR,SAASS,QAAQT,SAASU;AAQ5C,MANI,CAACF,MAILT,EAAMY,MAAMC,QAAQR,GAEhB,CAACL,EAAMY,MAAMC;AACf,WAAOR;AAGTI,EAAAA,EAAUK,YAAYd,CAAK;AAE3B,QAAMe,IAAaC,iBAAiBhB,CAAK,EAAEa,MAAMP,KAAAA;AACjDN,SAAAA,EAAMiB,OAAAA,GAECF,KAAcV;AACvB;AAEO,SAASa,EAAad,GAA+Be,IAAW,gBAAwB;;AAC7F,MAAI,OAAOlB,WAAa;AACtB,WAAOkB;AAGT,QAAMC,IAASJ,iBAAiBf,SAASU,eAAe,GAClDU,wBAAWtB,IAAAA;AACjB,MAAIuB,IAAUlB,EAAME,KAAAA;AAEpB,SAAOgB,KAAS;AACd,UAAMC,IAAQD,EAAQC,MAAM1B,CAA2B,GACjD2B,KAAeD,KAAAA,gBAAAA,EAAQ,QAAO3B,EAAmB6B,KAAKH,CAAO,IAAIA,IAAU,OAC3EI,KAAiBH,IAAAA,KAAAA,gBAAAA,EAAQ,OAARA,gBAAAA,EAAYjB;AAEnC,QAAI,CAACkB;AACH,aAAOrB,EAAoBmB,CAAO;AAGpC,QAAID,EAAKd,IAAIiB,CAAY,GAAG;AAC1BF,MAAAA,IAAUI,KAAkB;AAC5B;AAAA,IACF;AAEAL,IAAAA,EAAKM,IAAIH,CAAY,GAErBF,IAAUF,EAAOQ,iBAAiBJ,CAAY,EAAElB,KAAAA,KAAUoB,KAAkB;AAAA,EAC9E;AAEA,SAAOvB,EAAoBgB,CAAQ;AACrC;AAEO,SAASU,EAAWC,GAAoB;AAC7C,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAS,EAAK,GACtCC,IAASC,EAAY,MAAMH,EAAW,EAAI,GAAG,CAAA,CAAE;AAErDI,SAAAA,EAAU,MAAM;AACdJ,IAAAA,EAAW,EAAK;AAAA,EAClB,GAAG,CAACF,CAAQ,CAAC,GAEN;AAAA,IAAEC,SAAAA;AAAAA,IAASG,QAAAA;AAAAA,EAAAA;AACpB;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const l=require("react"),m=/^--[\w-]+$/,f=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/,y=new Set(["currentcolor","inherit","initial","revert","revert-layer","unset"]),s=typeof document<"u"?document.createElement("span"):null;function d(u){const e=u.trim();if(!e||!s||y.has(e.toLowerCase()))return e;const t=document.body??document.documentElement;if(!t||(s.style.color=e,!s.style.color))return e;t.appendChild(s);const o=getComputedStyle(s).color.trim();return s.remove(),o||e}function C(u,e="currentColor"){var i;if(typeof document>"u")return e;const t=getComputedStyle(document.documentElement),o=new Set;let n=u.trim();for(;n;){const r=n.match(f),c=(r==null?void 0:r[1])??(m.test(n)?n:null),a=(i=r==null?void 0:r[2])==null?void 0:i.trim();if(!c)return d(n);if(o.has(c)){n=a??"";continue}o.add(c),n=t.getPropertyValue(c).trim()||a||""}return d(e)}function p(u){const[e,t]=l.useState(!1),o=l.useCallback(()=>t(!0),[]);return l.useEffect(()=>{t(!1)},[u]),{touched:e,onBlur:o}}exports.resolveColor=C;exports.useTouched=p;
|
|
2
|
+
//# sourceMappingURL=utils-DBzf7CFq.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils-DBzf7CFq.cjs","sources":["../src/utils.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nconst cssVariablePattern = /^--[\\w-]+$/;\nconst cssVariableReferencePattern = /^var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.+))?\\)$/;\n\nconst unresolvedColorKeywords = new Set([\n 'currentcolor',\n 'inherit',\n 'initial',\n 'revert',\n 'revert-layer',\n 'unset',\n]);\n\nconst probe = typeof document !== 'undefined' ? document.createElement('span') : null;\n\nfunction normalizeColorValue(input: string): string {\n const value = input.trim();\n\n if (!value || !probe || unresolvedColorKeywords.has(value.toLowerCase())) {\n return value;\n }\n\n const mountNode = document.body ?? document.documentElement;\n\n if (!mountNode) {\n return value;\n }\n\n probe.style.color = value;\n\n if (!probe.style.color) {\n return value;\n }\n\n mountNode.appendChild(probe);\n\n const normalized = getComputedStyle(probe).color.trim();\n probe.remove();\n\n return normalized || value;\n}\n\nexport function resolveColor(input: `--${string}` | string, fallback = 'currentColor'): string {\n if (typeof document === 'undefined') {\n return fallback;\n }\n\n const styles = getComputedStyle(document.documentElement);\n const seen = new Set<string>();\n let current = input.trim();\n\n while (current) {\n const match = current.match(cssVariableReferencePattern);\n const variableName = match?.[1] ?? (cssVariablePattern.test(current) ? current : null);\n const nestedFallback = match?.[2]?.trim();\n\n if (!variableName) {\n return normalizeColorValue(current);\n }\n\n if (seen.has(variableName)) {\n current = nestedFallback ?? '';\n continue;\n }\n\n seen.add(variableName);\n\n current = styles.getPropertyValue(variableName).trim() || nestedFallback || '';\n }\n\n return normalizeColorValue(fallback);\n}\n\nexport function useTouched(resetKey?: unknown) {\n const [touched, setTouched] = useState(false);\n const onBlur = useCallback(() => setTouched(true), []);\n\n useEffect(() => {\n setTouched(false);\n }, [resetKey]);\n\n return { touched, onBlur };\n}\n"],"names":["cssVariablePattern","cssVariableReferencePattern","unresolvedColorKeywords","Set","probe","document","createElement","normalizeColorValue","input","value","trim","has","toLowerCase","mountNode","body","documentElement","style","color","appendChild","normalized","getComputedStyle","remove","resolveColor","fallback","styles","seen","current","match","variableName","test","nestedFallback","add","getPropertyValue","useTouched","resetKey","touched","setTouched","useState","onBlur","useCallback","useEffect"],"mappings":"sCAEMA,EAAqB,aACrBC,EAA8B,yCAE9BC,EAA0B,IAAIC,IAAI,CACtC,eACA,UACA,UACA,SACA,eACA,OAAO,CACR,EAEKC,EAAQ,OAAOC,SAAa,IAAcA,SAASC,cAAc,MAAM,EAAI,KAEjF,SAASC,EAAoBC,EAAuB,CAClD,MAAMC,EAAQD,EAAME,KAAAA,EAEpB,GAAI,CAACD,GAAS,CAACL,GAASF,EAAwBS,IAAIF,EAAMG,YAAAA,CAAa,EACrE,OAAOH,EAGT,MAAMI,EAAYR,SAASS,MAAQT,SAASU,gBAQ5C,GANI,CAACF,IAILT,EAAMY,MAAMC,MAAQR,EAEhB,CAACL,EAAMY,MAAMC,OACf,OAAOR,EAGTI,EAAUK,YAAYd,CAAK,EAE3B,MAAMe,EAAaC,iBAAiBhB,CAAK,EAAEa,MAAMP,KAAAA,EACjDN,OAAAA,EAAMiB,OAAAA,EAECF,GAAcV,CACvB,CAEO,SAASa,EAAad,EAA+Be,EAAW,eAAwB,OAC7F,GAAI,OAAOlB,SAAa,IACtB,OAAOkB,EAGT,MAAMC,EAASJ,iBAAiBf,SAASU,eAAe,EAClDU,MAAWtB,IACjB,IAAIuB,EAAUlB,EAAME,KAAAA,EAEpB,KAAOgB,GAAS,CACd,MAAMC,EAAQD,EAAQC,MAAM1B,CAA2B,EACjD2B,GAAeD,GAAAA,YAAAA,EAAQ,MAAO3B,EAAmB6B,KAAKH,CAAO,EAAIA,EAAU,MAC3EI,GAAiBH,EAAAA,GAAAA,YAAAA,EAAQ,KAARA,YAAAA,EAAYjB,OAEnC,GAAI,CAACkB,EACH,OAAOrB,EAAoBmB,CAAO,EAGpC,GAAID,EAAKd,IAAIiB,CAAY,EAAG,CAC1BF,EAAUI,GAAkB,GAC5B,QACF,CAEAL,EAAKM,IAAIH,CAAY,EAErBF,EAAUF,EAAOQ,iBAAiBJ,CAAY,EAAElB,KAAAA,GAAUoB,GAAkB,EAC9E,CAEA,OAAOvB,EAAoBgB,CAAQ,CACrC,CAEO,SAASU,EAAWC,EAAoB,CAC7C,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAS,EAAK,EACtCC,EAASC,EAAAA,YAAY,IAAMH,EAAW,EAAI,EAAG,CAAA,CAAE,EAErDI,OAAAA,EAAAA,UAAU,IAAM,CACdJ,EAAW,EAAK,CAClB,EAAG,CAACF,CAAQ,CAAC,EAEN,CAAEC,QAAAA,EAASG,OAAAA,CAAAA,CACpB"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solibo/solibo-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "vite build --watch",
|
|
7
|
-
"build": "tsc -b && vite build",
|
|
6
|
+
"dev": "pnpm run tokens:build && vite build --watch",
|
|
7
|
+
"build": "pnpm run tokens:build && tsc -b && vite build && pnpm run tokens:dist",
|
|
8
8
|
"coverage": "vitest run --coverage",
|
|
9
9
|
"format": "prettier --check .",
|
|
10
10
|
"format:fix": "prettier --write .",
|
|
@@ -17,7 +17,11 @@
|
|
|
17
17
|
"stylelint": "stylelint **/*.css",
|
|
18
18
|
"stylelint:fix": "stylelint **/*.css --fix",
|
|
19
19
|
"test": "vitest --ui --coverage.enabled=true",
|
|
20
|
-
"test:ci": "vitest run"
|
|
20
|
+
"test:ci": "vitest run",
|
|
21
|
+
"tokens:audit": "node scripts/design-tokens.mjs audit",
|
|
22
|
+
"tokens:build": "node scripts/design-tokens.mjs build",
|
|
23
|
+
"tokens:dist": "node scripts/design-tokens.mjs dist",
|
|
24
|
+
"tokens:import": "node scripts/design-tokens.mjs import"
|
|
21
25
|
},
|
|
22
26
|
"main": "./dist/index.cjs",
|
|
23
27
|
"module": "./dist/index.js",
|
|
@@ -27,7 +31,9 @@
|
|
|
27
31
|
"types": "./dist/index.d.ts",
|
|
28
32
|
"import": "./dist/index.js",
|
|
29
33
|
"require": "./dist/index.cjs"
|
|
30
|
-
}
|
|
34
|
+
},
|
|
35
|
+
"./tokens.css": "./dist/tokens.css",
|
|
36
|
+
"./tokens.json": "./dist/tokens.json"
|
|
31
37
|
},
|
|
32
38
|
"files": [
|
|
33
39
|
"dist"
|
package/dist/utils-BFlnRYx7.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { useState as d, useCallback as f, useEffect as m } from "react";
|
|
2
|
-
function b(o, n = "currentColor") {
|
|
3
|
-
var l;
|
|
4
|
-
const r = /^--[\w-]+$/, u = /^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/;
|
|
5
|
-
if (typeof document > "u")
|
|
6
|
-
return n;
|
|
7
|
-
const i = getComputedStyle(document.documentElement), c = /* @__PURE__ */ new Set();
|
|
8
|
-
let e = o.trim();
|
|
9
|
-
for (; e; ) {
|
|
10
|
-
const t = e.match(u), s = (t == null ? void 0 : t[1]) ?? (r.test(e) ? e : null), a = (l = t == null ? void 0 : t[2]) == null ? void 0 : l.trim();
|
|
11
|
-
if (!s)
|
|
12
|
-
return e;
|
|
13
|
-
if (c.has(s)) {
|
|
14
|
-
e = a ?? "";
|
|
15
|
-
continue;
|
|
16
|
-
}
|
|
17
|
-
c.add(s), e = i.getPropertyValue(s).trim() || a || "";
|
|
18
|
-
}
|
|
19
|
-
return n;
|
|
20
|
-
}
|
|
21
|
-
function w(o) {
|
|
22
|
-
const [n, r] = d(!1), u = f(() => r(!0), []);
|
|
23
|
-
return m(() => {
|
|
24
|
-
r(!1);
|
|
25
|
-
}, [o]), {
|
|
26
|
-
touched: n,
|
|
27
|
-
onBlur: u
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
b as r,
|
|
32
|
-
w as u
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=utils-BFlnRYx7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils-BFlnRYx7.js","sources":["../src/utils.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nexport function resolveColor(input: `--${string}` | string, fallback = 'currentColor'): string {\n const cssVariablePattern = /^--[\\w-]+$/;\n const cssVariableReferencePattern = /^var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.+))?\\)$/;\n\n if (typeof document === 'undefined') {\n return fallback;\n }\n\n const styles = getComputedStyle(document.documentElement);\n const seen = new Set<string>();\n let current = input.trim();\n\n while (current) {\n const match = current.match(cssVariableReferencePattern);\n const variableName = match?.[1] ?? (cssVariablePattern.test(current) ? current : null);\n const nestedFallback = match?.[2]?.trim();\n\n if (!variableName) {\n return current;\n }\n\n if (seen.has(variableName)) {\n current = nestedFallback ?? '';\n continue;\n }\n\n seen.add(variableName);\n\n current = styles.getPropertyValue(variableName).trim() || nestedFallback || '';\n }\n\n return fallback;\n}\n\nexport function useTouched(resetKey?: unknown) {\n const [touched, setTouched] = useState(false);\n const onBlur = useCallback(() => setTouched(true), []);\n\n useEffect(() => {\n setTouched(false);\n }, [resetKey]);\n\n return { touched, onBlur };\n}\n"],"names":["resolveColor","input","fallback","cssVariablePattern","cssVariableReferencePattern","document","styles","getComputedStyle","documentElement","seen","Set","current","trim","match","variableName","test","nestedFallback","has","add","getPropertyValue","useTouched","resetKey","touched","setTouched","useState","onBlur","useCallback","useEffect"],"mappings":";AAEO,SAASA,EAAaC,GAA+BC,IAAW,gBAAwB;;AAC7F,QAAMC,IAAqB,cACrBC,IAA8B;AAEpC,MAAI,OAAOC,WAAa;AACtB,WAAOH;AAGT,QAAMI,IAASC,iBAAiBF,SAASG,eAAe,GAClDC,wBAAWC,IAAAA;AACjB,MAAIC,IAAUV,EAAMW,KAAAA;AAEpB,SAAOD,KAAS;AACd,UAAME,IAAQF,EAAQE,MAAMT,CAA2B,GACjDU,KAAeD,KAAAA,gBAAAA,EAAQ,QAAOV,EAAmBY,KAAKJ,CAAO,IAAIA,IAAU,OAC3EK,KAAiBH,IAAAA,KAAAA,gBAAAA,EAAQ,OAARA,gBAAAA,EAAYD;AAEnC,QAAI,CAACE;AACH,aAAOH;AAGT,QAAIF,EAAKQ,IAAIH,CAAY,GAAG;AAC1BH,MAAAA,IAAUK,KAAkB;AAC5B;AAAA,IACF;AAEAP,IAAAA,EAAKS,IAAIJ,CAAY,GAErBH,IAAUL,EAAOa,iBAAiBL,CAAY,EAAEF,KAAAA,KAAUI,KAAkB;AAAA,EAC9E;AAEA,SAAOd;AACT;AAEO,SAASkB,EAAWC,GAAoB;AAC7C,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAS,EAAK,GACtCC,IAASC,EAAY,MAAMH,EAAW,EAAI,GAAG,CAAA,CAAE;AAErDI,SAAAA,EAAU,MAAM;AACdJ,IAAAA,EAAW,EAAK;AAAA,EAClB,GAAG,CAACF,CAAQ,CAAC,GAEN;AAAA,IAAEC,SAAAA;AAAAA,IAASG,QAAAA;AAAAA,EAAAA;AACpB;"}
|
package/dist/utils-DqVa4K58.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const c=require("react");function f(o,n="currentColor"){var a;const s=/^--[\w-]+$/,u=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/;if(typeof document>"u")return n;const d=getComputedStyle(document.documentElement),l=new Set;let e=o.trim();for(;e;){const t=e.match(u),r=(t==null?void 0:t[1])??(s.test(e)?e:null),i=(a=t==null?void 0:t[2])==null?void 0:a.trim();if(!r)return e;if(l.has(r)){e=i??"";continue}l.add(r),e=d.getPropertyValue(r).trim()||i||""}return n}function m(o){const[n,s]=c.useState(!1),u=c.useCallback(()=>s(!0),[]);return c.useEffect(()=>{s(!1)},[o]),{touched:n,onBlur:u}}exports.resolveColor=f;exports.useTouched=m;
|
|
2
|
-
//# sourceMappingURL=utils-DqVa4K58.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils-DqVa4K58.cjs","sources":["../src/utils.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nexport function resolveColor(input: `--${string}` | string, fallback = 'currentColor'): string {\n const cssVariablePattern = /^--[\\w-]+$/;\n const cssVariableReferencePattern = /^var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.+))?\\)$/;\n\n if (typeof document === 'undefined') {\n return fallback;\n }\n\n const styles = getComputedStyle(document.documentElement);\n const seen = new Set<string>();\n let current = input.trim();\n\n while (current) {\n const match = current.match(cssVariableReferencePattern);\n const variableName = match?.[1] ?? (cssVariablePattern.test(current) ? current : null);\n const nestedFallback = match?.[2]?.trim();\n\n if (!variableName) {\n return current;\n }\n\n if (seen.has(variableName)) {\n current = nestedFallback ?? '';\n continue;\n }\n\n seen.add(variableName);\n\n current = styles.getPropertyValue(variableName).trim() || nestedFallback || '';\n }\n\n return fallback;\n}\n\nexport function useTouched(resetKey?: unknown) {\n const [touched, setTouched] = useState(false);\n const onBlur = useCallback(() => setTouched(true), []);\n\n useEffect(() => {\n setTouched(false);\n }, [resetKey]);\n\n return { touched, onBlur };\n}\n"],"names":["resolveColor","input","fallback","cssVariablePattern","cssVariableReferencePattern","document","styles","getComputedStyle","documentElement","seen","Set","current","trim","match","variableName","test","nestedFallback","has","add","getPropertyValue","useTouched","resetKey","touched","setTouched","useState","onBlur","useCallback","useEffect"],"mappings":"sCAEO,SAASA,EAAaC,EAA+BC,EAAW,eAAwB,OAC7F,MAAMC,EAAqB,aACrBC,EAA8B,yCAEpC,GAAI,OAAOC,SAAa,IACtB,OAAOH,EAGT,MAAMI,EAASC,iBAAiBF,SAASG,eAAe,EAClDC,MAAWC,IACjB,IAAIC,EAAUV,EAAMW,KAAAA,EAEpB,KAAOD,GAAS,CACd,MAAME,EAAQF,EAAQE,MAAMT,CAA2B,EACjDU,GAAeD,GAAAA,YAAAA,EAAQ,MAAOV,EAAmBY,KAAKJ,CAAO,EAAIA,EAAU,MAC3EK,GAAiBH,EAAAA,GAAAA,YAAAA,EAAQ,KAARA,YAAAA,EAAYD,OAEnC,GAAI,CAACE,EACH,OAAOH,EAGT,GAAIF,EAAKQ,IAAIH,CAAY,EAAG,CAC1BH,EAAUK,GAAkB,GAC5B,QACF,CAEAP,EAAKS,IAAIJ,CAAY,EAErBH,EAAUL,EAAOa,iBAAiBL,CAAY,EAAEF,KAAAA,GAAUI,GAAkB,EAC9E,CAEA,OAAOd,CACT,CAEO,SAASkB,EAAWC,EAAoB,CAC7C,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAS,EAAK,EACtCC,EAASC,EAAAA,YAAY,IAAMH,EAAW,EAAI,EAAG,CAAA,CAAE,EAErDI,OAAAA,EAAAA,UAAU,IAAM,CACdJ,EAAW,EAAK,CAClB,EAAG,CAACF,CAAQ,CAAC,EAEN,CAAEC,QAAAA,EAASG,OAAAA,CAAAA,CACpB"}
|