@bigstack-oss/cube-ui 0.0.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/dist/index.js ADDED
@@ -0,0 +1,1483 @@
1
+ 'use strict';
2
+
3
+ var lodash = require('lodash');
4
+ var tailwindMerge = require('tailwind-merge');
5
+ var classVarianceAuthority = require('class-variance-authority');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var react = require('react');
8
+ var i18next = require('i18next');
9
+ var reactI18next = require('react-i18next');
10
+ var defaultTheme = require('tailwindcss/defaultTheme');
11
+
12
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
+
14
+ var i18next__default = /*#__PURE__*/_interopDefault(i18next);
15
+ var defaultTheme__default = /*#__PURE__*/_interopDefault(defaultTheme);
16
+
17
+ // src/components/CubeButton/CubeButton.tsx
18
+ var button = classVarianceAuthority.cva(
19
+ "flex shrink-0 items-center justify-center gap-x-2 whitespace-nowrap rounded-[5px] font-urbanist font-semibold transition-colors",
20
+ {
21
+ variants: {
22
+ type: {
23
+ primary: [
24
+ "bg-primary text-grey-0",
25
+ "hover:bg-functional-hover-primary"
26
+ ],
27
+ secondary: [
28
+ "border border-primary bg-grey-0 text-primary",
29
+ "hover:border-functional-hover-primary hover:bg-functional-hover-secondary"
30
+ ],
31
+ ghost: [
32
+ "bg-transparent text-primary",
33
+ "hover:bg-functional-hover-secondary"
34
+ ],
35
+ warning: [
36
+ "border border-status-negative bg-grey-0 text-status-negative",
37
+ "hover:bg-status-negative hover:text-grey-0"
38
+ ],
39
+ light: ["bg-secondary text-dark-400", "hover:bg-secondary-400"]
40
+ },
41
+ size: {
42
+ sm: "secondary-body3 h-[26px] px-3 py-[5px]",
43
+ md: "secondary-body2 h-[34px] px-4 py-2",
44
+ lg: "secondary-body2 h-[42px] px-5 py-3"
45
+ },
46
+ usage: {},
47
+ loading: {
48
+ true: "cursor-default",
49
+ false: ""
50
+ },
51
+ disabled: {
52
+ true: "cursor-default",
53
+ false: ""
54
+ }
55
+ },
56
+ compoundVariants: [
57
+ { usage: "icon-only", size: "sm", className: "p-[5px]" },
58
+ { usage: "icon-only", size: "md", className: "p-2" },
59
+ { usage: "icon-only", size: "lg", className: "p-3" },
60
+ {
61
+ type: "primary",
62
+ disabled: true,
63
+ className: [
64
+ "bg-functional-disable-light text-functional-disable-text",
65
+ "hover:bg-functional-disable-light hover:text-functional-disable-text"
66
+ ]
67
+ },
68
+ {
69
+ type: "primary",
70
+ loading: true,
71
+ className: [
72
+ [
73
+ "bg-functional-disable-light text-functional-border-darker",
74
+ "hover:text-functional-border-darker"
75
+ ]
76
+ ]
77
+ },
78
+ {
79
+ type: "secondary",
80
+ disabled: true,
81
+ className: [
82
+ "border-functional-disable-text bg-grey-0 text-functional-disable-text",
83
+ "hover:border-functional-disable-text hover:bg-grey-0"
84
+ ]
85
+ },
86
+ {
87
+ type: "secondary",
88
+ loading: true,
89
+ className: [
90
+ "border-functional-border-darker bg-grey-0 text-functional-border-darker",
91
+ "hover:border-functional-border-darker hover:text-functional-border-darker"
92
+ ]
93
+ },
94
+ {
95
+ type: "ghost",
96
+ disabled: true,
97
+ className: [
98
+ "bg-transparent text-functional-disable-text",
99
+ "text-functional-disable-text hover:bg-transparent"
100
+ ]
101
+ },
102
+ {
103
+ type: "ghost",
104
+ loading: true,
105
+ className: "bg-transparent text-functional-border-darker"
106
+ },
107
+ {
108
+ type: "warning",
109
+ disabled: true,
110
+ className: [
111
+ "border-red-100 bg-grey-0 text-red-100",
112
+ "hover:border-red-100 hover:bg-grey-0 hover:text-red-100"
113
+ ]
114
+ },
115
+ {
116
+ type: "warning",
117
+ loading: true,
118
+ className: [
119
+ "border-red-200 bg-grey-0 text-red-200",
120
+ "hover:text-red-200"
121
+ ]
122
+ },
123
+ {
124
+ type: "light",
125
+ disabled: true,
126
+ className: [
127
+ "bg-secondary-50 text-functional-disable-text",
128
+ "hover:bg-secondary-50 hover:text-functional-disable-text"
129
+ ]
130
+ },
131
+ {
132
+ type: "light",
133
+ loading: true,
134
+ className: [
135
+ "bg-secondary-50 text-functional-border-darker",
136
+ "hover:text-functional-border-darker"
137
+ ]
138
+ },
139
+ /**
140
+ * We expect the button only show the loading spinner when the usage is 'text-only'.
141
+ *
142
+ * disabled:relative => position the absolute positioned spinner relative to the button.
143
+ * disabled:text-transparent => hide the text but keep the button's width and height.
144
+ */
145
+ {
146
+ usage: "text-only",
147
+ loading: true,
148
+ className: "relative text-transparent hover:text-transparent"
149
+ }
150
+ ]
151
+ }
152
+ );
153
+ var iconContainer = classVarianceAuthority.cva("flex items-center justify-center", {
154
+ variants: {
155
+ size: {
156
+ sm: "size-[16px]",
157
+ md: "size-[18px]",
158
+ lg: "size-[18px]"
159
+ }
160
+ }
161
+ });
162
+ var loadingSpinner = classVarianceAuthority.cva(void 0, {
163
+ variants: {
164
+ type: {
165
+ primary: "text-functional-border-darker",
166
+ secondary: "text-functional-border-darker",
167
+ ghost: "text-functional-border-darker",
168
+ warning: "text-red-200",
169
+ light: "text-functional-border-darker"
170
+ },
171
+ /**
172
+ * The button should only show the loading spinner when the usage is 'text-only',
173
+ * so we need to center the absolute positioned spinner within the button.
174
+ */
175
+ usage: {
176
+ "text-only": "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"
177
+ }
178
+ }
179
+ });
180
+ var buttonSkeleton = classVarianceAuthority.cva(void 0, {
181
+ variants: {
182
+ size: {
183
+ sm: "h-[26px]",
184
+ md: "h-[34px]",
185
+ lg: "h-[42px]"
186
+ },
187
+ usage: {
188
+ "text-only": "",
189
+ "icon-only": "",
190
+ "icon-left": "",
191
+ "icon-right": ""
192
+ }
193
+ },
194
+ compoundVariants: [
195
+ {
196
+ usage: "text-only",
197
+ size: "sm",
198
+ className: "w-[104px]"
199
+ },
200
+ {
201
+ usage: "text-only",
202
+ size: "md",
203
+ className: "w-[118px]"
204
+ },
205
+ {
206
+ usage: "text-only",
207
+ size: "lg",
208
+ className: "w-[126px]"
209
+ },
210
+ {
211
+ usage: "icon-only",
212
+ size: "sm",
213
+ className: "w-[26px]"
214
+ },
215
+ {
216
+ usage: "icon-only",
217
+ size: "md",
218
+ className: "w-[34px]"
219
+ },
220
+ {
221
+ usage: "icon-only",
222
+ size: "lg",
223
+ className: "w-[42px]"
224
+ },
225
+ {
226
+ usage: ["icon-left", "icon-right"],
227
+ size: "sm",
228
+ className: "w-[128px]"
229
+ },
230
+ {
231
+ usage: ["icon-left", "icon-right"],
232
+ size: "md",
233
+ className: "w-[144px]"
234
+ },
235
+ {
236
+ usage: ["icon-left", "icon-right"],
237
+ size: "lg",
238
+ className: "w-[156px]"
239
+ }
240
+ ]
241
+ });
242
+ var sizeClasses = {
243
+ xs: {
244
+ container: tailwindMerge.twMerge("icon-frame-xs"),
245
+ icon: tailwindMerge.twMerge("icon-xs")
246
+ },
247
+ sm: {
248
+ container: tailwindMerge.twMerge("icon-frame-sm"),
249
+ icon: tailwindMerge.twMerge("icon-sm")
250
+ },
251
+ "md-sm": {
252
+ container: tailwindMerge.twMerge("icon-frame-md-sm"),
253
+ icon: tailwindMerge.twMerge("icon-md-sm")
254
+ },
255
+ md: {
256
+ container: tailwindMerge.twMerge("icon-frame-md"),
257
+ icon: tailwindMerge.twMerge("icon-md")
258
+ },
259
+ lg: {
260
+ container: tailwindMerge.twMerge("icon-frame-lg"),
261
+ icon: tailwindMerge.twMerge("icon-lg")
262
+ },
263
+ xl: {
264
+ container: tailwindMerge.twMerge("icon-frame-xl"),
265
+ icon: tailwindMerge.twMerge("icon-xl")
266
+ }
267
+ };
268
+ var getIconSizeClass = (size) => {
269
+ return sizeClasses[size].icon;
270
+ };
271
+ var getContainerClasses = (size, classNameProps) => {
272
+ return tailwindMerge.twMerge(
273
+ "inline-flex items-center justify-center",
274
+ classNameProps,
275
+ sizeClasses[size].container
276
+ );
277
+ };
278
+ var getIconClasses = (size, classNameProps) => {
279
+ return tailwindMerge.twMerge(classNameProps, getIconSizeClass(size));
280
+ };
281
+
282
+ // src/components/CubeButton/cubeButtonUtils.ts
283
+ var getIconSizeByButtonSize = (size) => {
284
+ const sizeMapping = {
285
+ sm: "md-sm",
286
+ md: "md",
287
+ lg: "md"
288
+ };
289
+ const iconSize = sizeMapping[size];
290
+ return getIconSizeClass(iconSize);
291
+ };
292
+ var CubeLeft = (props) => {
293
+ const { className } = props;
294
+ return /* @__PURE__ */ jsxRuntime.jsx(
295
+ "svg",
296
+ {
297
+ className,
298
+ width: "30",
299
+ height: "30",
300
+ viewBox: "0 0 30 30",
301
+ fill: "none",
302
+ xmlns: "http://www.w3.org/2000/svg",
303
+ children: /* @__PURE__ */ jsxRuntime.jsx(
304
+ "path",
305
+ {
306
+ d: "M5.96908 21.6725C5.36405 21.366 5.00776 20.7837 5.02457 20.1571L4.95062 11.9881C4.96743 11.4568 5.52875 11.1333 5.98252 11.3955L8.60428 12.9006C8.83284 13.0335 8.96729 13.2854 8.95385 13.5544L8.87654 17.6747C8.84629 18.4818 9.03115 19.0402 9.43114 19.5272C9.6429 19.786 9.90171 20.0005 10.1874 20.1674L13.9722 22.425C14.1839 22.551 14.315 22.786 14.315 23.038V25.534C14.315 26.0754 13.747 26.4159 13.2831 26.1503L5.96908 21.6725Z",
307
+ fill: "currentColor"
308
+ }
309
+ )
310
+ }
311
+ );
312
+ };
313
+ var CubeRight = (props) => {
314
+ const { className } = props;
315
+ return /* @__PURE__ */ jsxRuntime.jsx(
316
+ "svg",
317
+ {
318
+ className,
319
+ width: "30",
320
+ height: "30",
321
+ viewBox: "0 0 30 30",
322
+ fill: "none",
323
+ xmlns: "http://www.w3.org/2000/svg",
324
+ children: /* @__PURE__ */ jsxRuntime.jsx(
325
+ "path",
326
+ {
327
+ d: "M24.95 19.8473L25.0474 12.2945C25.0878 11.7258 24.4895 11.3411 24.0088 11.6305L16.7486 15.7849C16.5368 15.9108 15.9116 16.3637 15.9116 17.1469V25.5408C15.9116 26.089 16.4931 26.4295 16.9536 26.1503C16.9536 26.1503 24.0357 21.9108 24.234 21.7099C24.4323 21.509 24.95 21.1957 24.95 19.8473Z",
328
+ fill: "currentColor"
329
+ }
330
+ )
331
+ }
332
+ );
333
+ };
334
+ var CubeTop = (props) => {
335
+ const { className } = props;
336
+ return /* @__PURE__ */ jsxRuntime.jsx(
337
+ "svg",
338
+ {
339
+ className,
340
+ width: "30",
341
+ height: "30",
342
+ viewBox: "0 0 30 30",
343
+ fill: "none",
344
+ xmlns: "http://www.w3.org/2000/svg",
345
+ children: /* @__PURE__ */ jsxRuntime.jsx(
346
+ "path",
347
+ {
348
+ d: "M6.05312 8.78375L14.5268 3.83939C14.7352 3.7202 14.994 3.7202 15.2024 3.83939L23.5349 8.47728C24.0021 8.74629 24.0088 9.43074 23.545 9.70656L15.0511 14.6373C14.836 14.7667 14.5671 14.7667 14.352 14.6373L6.03968 10.013C5.57583 9.73721 5.58255 9.04936 6.05312 8.78375Z",
349
+ fill: "currentColor"
350
+ }
351
+ )
352
+ }
353
+ );
354
+ };
355
+ var CubeLogoSpinner = (props) => {
356
+ const { className } = props;
357
+ return (
358
+ // The size of container must be equal to the size of dots.
359
+ /* @__PURE__ */ jsxRuntime.jsxs(
360
+ "div",
361
+ {
362
+ className: tailwindMerge.twMerge(
363
+ "relative inline size-[30px] text-functional-text",
364
+ className
365
+ ),
366
+ children: [
367
+ /* @__PURE__ */ jsxRuntime.jsx(CubeLeft, { className: "absolute animate-cube-spinner-vector-0" }),
368
+ /* @__PURE__ */ jsxRuntime.jsx(CubeTop, { className: "absolute animate-cube-spinner-vector-1" }),
369
+ /* @__PURE__ */ jsxRuntime.jsx(CubeRight, { className: "absolute animate-cube-spinner-vector-2" })
370
+ ]
371
+ }
372
+ )
373
+ );
374
+ };
375
+ var Dot120 = (props) => {
376
+ const { className } = props;
377
+ return /* @__PURE__ */ jsxRuntime.jsx(
378
+ "svg",
379
+ {
380
+ className,
381
+ width: "16",
382
+ height: "16",
383
+ viewBox: "0 0 16 16",
384
+ fill: "none",
385
+ xmlns: "http://www.w3.org/2000/svg",
386
+ children: /* @__PURE__ */ jsxRuntime.jsx(
387
+ "path",
388
+ {
389
+ fillRule: "evenodd",
390
+ clipRule: "evenodd",
391
+ d: "M2.138 6.905c.59.003 1.065.482 1.062 1.071v.048a1.067 1.067 0 1 1-2.133.01v-.068a1.067 1.067 0 0 1 1.071-1.061Zm11.723 0a1.067 1.067 0 0 1 1.072 1.061v.068a1.067 1.067 0 1 1-2.133-.01v-.048a1.067 1.067 0 0 1 1.061-1.071ZM3.082 11.37a1.067 1.067 0 0 1 1.508.008l.033.033a1.067 1.067 0 1 1-1.548 1.468 1.067 1.067 0 0 1 .007-1.509Zm9.838 0a1.067 1.067 0 0 1-.04 1.556 1.067 1.067 0 0 1-1.501-1.515l.033-.033a1.067 1.067 0 0 1 1.508-.008Zm-6.014 2.492a1.067 1.067 0 0 1 1.07-1.062h.047a1.067 1.067 0 0 1 .01 2.133h-.067a1.067 1.067 0 0 1-1.061-1.072Z",
392
+ fill: "currentColor"
393
+ }
394
+ )
395
+ }
396
+ );
397
+ };
398
+ var CubeDotSpinner120 = (props) => {
399
+ const { className } = props;
400
+ return (
401
+ // The size of container must be equal to the size of dots.
402
+ /* @__PURE__ */ jsxRuntime.jsxs(
403
+ "div",
404
+ {
405
+ className: tailwindMerge.twMerge(
406
+ "relative inline size-4 text-cosmos-primary",
407
+ className
408
+ ),
409
+ children: [
410
+ /* @__PURE__ */ jsxRuntime.jsx(Dot120, { className: "absolute rotate-0 animate-cube-dot-spinner-120-vector-0" }),
411
+ /* @__PURE__ */ jsxRuntime.jsx(Dot120, { className: "absolute rotate-[135deg] animate-cube-dot-spinner-120-vector-1" }),
412
+ /* @__PURE__ */ jsxRuntime.jsx(Dot120, { className: "absolute rotate-[270deg] animate-cube-dot-spinner-120-vector-2" })
413
+ ]
414
+ }
415
+ )
416
+ );
417
+ };
418
+ var Dot45 = (props) => {
419
+ const { className } = props;
420
+ return /* @__PURE__ */ jsxRuntime.jsx(
421
+ "svg",
422
+ {
423
+ className,
424
+ width: "16",
425
+ height: "16",
426
+ viewBox: "0 0 16 16",
427
+ fill: "none",
428
+ xmlns: "http://www.w3.org/2000/svg",
429
+ children: /* @__PURE__ */ jsxRuntime.jsx(
430
+ "path",
431
+ {
432
+ fillRule: "evenodd",
433
+ clipRule: "evenodd",
434
+ d: "M3.38841 11.1597C3.78081 10.771 4.41397 10.7741 4.80261 11.1665L4.83351 11.1974C5.22591 11.586 5.22896 12.2192 4.84032 12.6116C4.45168 13.004 3.81852 13.007 3.42612 12.6184C3.41121 12.6036 3.39637 12.5888 3.3816 12.5739C2.99296 12.1815 2.99601 11.5483 3.38841 11.1597ZM12.6116 11.1597C13.004 11.5483 13.007 12.1815 12.6184 12.5739C12.6036 12.5888 12.5888 12.6036 12.5739 12.6184C12.1815 13.007 11.5483 13.004 11.1597 12.6116C10.771 12.2192 10.7741 11.586 11.1665 11.1974L11.1974 11.1665C11.586 10.7741 12.2192 10.771 12.6116 11.1597ZM6.9732 13.4952C6.97584 12.9429 7.42569 12.4973 7.97796 12.4999L8 12.5L8.02203 12.4999C8.57431 12.4973 9.02416 12.9429 9.02679 13.4952C9.02943 14.0474 8.58386 14.4973 8.03158 14.4999L8 14.5L7.96842 14.4999C7.41614 14.4973 6.97057 14.0474 6.9732 13.4952Z",
435
+ fill: "currentColor"
436
+ }
437
+ )
438
+ }
439
+ );
440
+ };
441
+ var CubeDotSpinner45 = (props) => {
442
+ const { className } = props;
443
+ return /* @__PURE__ */ jsxRuntime.jsxs(
444
+ "div",
445
+ {
446
+ className: tailwindMerge.twMerge(
447
+ // The size of container must be equal to the size of dots.
448
+ "relative inline size-4 text-cosmos-primary",
449
+ className
450
+ ),
451
+ children: [
452
+ /* @__PURE__ */ jsxRuntime.jsx(Dot45, { className: "absolute rotate-0 animate-cube-dot-spinner-45-vector-0" }),
453
+ /* @__PURE__ */ jsxRuntime.jsx(Dot45, { className: "absolute rotate-45 animate-cube-dot-spinner-45-vector-1" }),
454
+ /* @__PURE__ */ jsxRuntime.jsx(Dot45, { className: "absolute rotate-90 animate-cube-dot-spinner-45-vector-2" }),
455
+ /* @__PURE__ */ jsxRuntime.jsx(Dot45, { className: "absolute rotate-[135deg] animate-cube-dot-spinner-45-vector-3" }),
456
+ /* @__PURE__ */ jsxRuntime.jsx(Dot45, { className: "absolute rotate-180 animate-cube-dot-spinner-45-vector-4" }),
457
+ /* @__PURE__ */ jsxRuntime.jsx(Dot45, { className: "absolute rotate-[225deg] animate-cube-dot-spinner-45-vector-5" }),
458
+ /* @__PURE__ */ jsxRuntime.jsx(Dot45, { className: "absolute rotate-[270deg] animate-cube-dot-spinner-45-vector-6" }),
459
+ /* @__PURE__ */ jsxRuntime.jsx(Dot45, { className: "absolute rotate-[315deg] animate-cube-dot-spinner-45-vector-7" })
460
+ ]
461
+ }
462
+ );
463
+ };
464
+ var spinnerComponents = {
465
+ dot45: CubeDotSpinner45,
466
+ dot120: CubeDotSpinner120,
467
+ cube: CubeLogoSpinner
468
+ };
469
+ var CubeLoadingSpinner = (props) => {
470
+ const { variant, className } = props;
471
+ const Component = spinnerComponents[variant];
472
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { className });
473
+ };
474
+ var CubeButtonLoadingSpinner = (props) => {
475
+ const { type, usage } = props;
476
+ return /* @__PURE__ */ jsxRuntime.jsx(
477
+ CubeLoadingSpinner,
478
+ {
479
+ variant: "dot45",
480
+ className: loadingSpinner({ type, usage })
481
+ }
482
+ );
483
+ };
484
+ var CubeButton = (props) => {
485
+ const {
486
+ htmlType = "button",
487
+ type = "primary",
488
+ size = "md",
489
+ usage = "text-only",
490
+ disabled: disabledProp = false,
491
+ loading = false,
492
+ onClick,
493
+ className,
494
+ ...restProps
495
+ } = props;
496
+ const disabled = disabledProp || loading;
497
+ const renderIcon = (Icon) => {
498
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge(iconContainer({ size })), children: loading ? /* @__PURE__ */ jsxRuntime.jsx(CubeButtonLoadingSpinner, { type, usage }) : /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: getIconSizeByButtonSize(size) }) });
499
+ };
500
+ const renderButtonContent = () => {
501
+ switch (props.usage) {
502
+ case "icon-only":
503
+ return renderIcon(props.Icon);
504
+ case "icon-left":
505
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
506
+ renderIcon(props.Icon),
507
+ props.children
508
+ ] });
509
+ case "icon-right":
510
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
511
+ props.children,
512
+ renderIcon(props.Icon)
513
+ ] });
514
+ case "text-only":
515
+ default:
516
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
517
+ props.children,
518
+ loading && /* @__PURE__ */ jsxRuntime.jsx(CubeButtonLoadingSpinner, { type, usage })
519
+ ] });
520
+ }
521
+ };
522
+ return /* @__PURE__ */ jsxRuntime.jsx(
523
+ "button",
524
+ {
525
+ type: htmlType,
526
+ className: tailwindMerge.twMerge(
527
+ button({ type, size, usage, loading, disabled }),
528
+ className
529
+ ),
530
+ disabled,
531
+ onClick,
532
+ ...lodash.omit(restProps, "Icon"),
533
+ children: renderButtonContent()
534
+ }
535
+ );
536
+ };
537
+ var CubeSkeleton = (props) => {
538
+ const { className, style } = props;
539
+ return /* @__PURE__ */ jsxRuntime.jsx(
540
+ "div",
541
+ {
542
+ className: tailwindMerge.twMerge(
543
+ "cube-skeleton animate-cube-skeleton rounded-[5px]",
544
+ className
545
+ ),
546
+ style
547
+ }
548
+ );
549
+ };
550
+ var CubeButtonSkeleton = (props) => {
551
+ const { size = "md", usage = "text-only" } = props;
552
+ return /* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: tailwindMerge.twMerge(buttonSkeleton({ size, usage })) });
553
+ };
554
+ var CubeIconFrame = (props) => {
555
+ const { className: classNameProps, size = "md", children, onClick } = props;
556
+ const containerClasses = getContainerClasses(size, classNameProps);
557
+ const iconClasses = getIconClasses(size, children.props.className);
558
+ const icon = react.cloneElement(children, { className: iconClasses });
559
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: containerClasses, onClick, children: icon });
560
+ };
561
+ var SvgView = ({
562
+ title,
563
+ titleId,
564
+ ...props
565
+ }, ref) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 15.286", ref, "aria-labelledby": titleId, ...props, children: [
566
+ title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
567
+ /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", d: "m1.5 8-.58-.154a.6.6 0 0 0 0 .308zm13 0 .58.154a.6.6 0 0 0 0-.308zM9.718 8c0 .95-.77 1.721-1.721 1.721v1.2A2.92 2.92 0 0 0 10.918 8zM7.997 9.721c-.951 0-1.722-.77-1.722-1.721h-1.2a2.92 2.92 0 0 0 2.922 2.921zM6.275 8c0-.95.771-1.721 1.722-1.721v-1.2A2.92 2.92 0 0 0 5.075 8zm1.722-1.721c.95 0 1.721.77 1.721 1.721h1.2a2.92 2.92 0 0 0-2.921-2.921zm0-3.522C4.122 2.757 1.6 5.276.92 7.847l1.16.307c.549-2.073 2.615-4.197 5.917-4.197zM.92 8.154c.68 2.57 3.202 5.089 7.08 5.089v-1.2c-3.305 0-5.371-2.125-5.92-4.197zM8 13.243c3.878 0 6.396-2.519 7.08-5.089l-1.16-.308c-.552 2.073-2.615 4.197-5.92 4.197zm7.08-5.397c-.685-2.57-3.209-5.089-7.083-5.089v1.2c3.302 0 5.371 2.125 5.923 4.197z" })
568
+ ] });
569
+ var ForwardRef = react.forwardRef(SvgView);
570
+ var View_default = ForwardRef;
571
+ var SvgViewOff = ({
572
+ title,
573
+ titleId,
574
+ ...props
575
+ }, ref) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
576
+ title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
577
+ /* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.2, d: "M5.675 8.143A2.32 2.32 0 0 1 7.997 5.82M6.41 9.838a2.321 2.321 0 0 0 3.322-3.237M11.715 4.5c1.464.893 2.419 2.268 2.785 3.643-.618 2.321-2.908 4.643-6.5 4.643-1.424 0-2.643-.365-3.635-.95M3 10.76a6.04 6.04 0 0 1-1.5-2.617C2.115 5.82 4.408 3.5 7.997 3.5c.761 0 1.464.105 2.106.291M14.2 2l-12 12" })
578
+ ] });
579
+ var ForwardRef2 = react.forwardRef(SvgViewOff);
580
+ var ViewOff_default = ForwardRef2;
581
+ var SvgWarningFilled = ({
582
+ title,
583
+ titleId,
584
+ ...props
585
+ }, ref) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
586
+ title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
587
+ /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M8.1 15.2A7.1 7.1 0 1 0 8.1 1a7.1 7.1 0 0 0 0 14.2m.9-4.1a.9.9 0 1 1-1.8 0 .9.9 0 0 1 1.8 0M7.5 8.5a.6.6 0 0 0 1.2 0v-4a.6.6 0 1 0-1.2 0z", clipRule: "evenodd" })
588
+ ] });
589
+ var ForwardRef3 = react.forwardRef(SvgWarningFilled);
590
+ var WarningFilled_default = ForwardRef3;
591
+ var input = classVarianceAuthority.cva(
592
+ [
593
+ "primary-body2 w-full truncate rounded-[6px] py-[9px] outline-none",
594
+ "bg-grey-0",
595
+ "text-functional-text placeholder:text-functional-border-darker",
596
+ "border border-functional-border-divider",
597
+ "hover:border-functional-hover-primary focus:border-functional-hover-primary"
598
+ ],
599
+ {
600
+ variants: {
601
+ isError: {
602
+ true: [
603
+ "pl-4 pr-8",
604
+ "border-status-negative hover:border-status-negative"
605
+ ]
606
+ },
607
+ disabled: {
608
+ true: [
609
+ "disabled:border-functional-disable-text disabled:text-functional-disable-text disabled:placeholder:text-functional-border-divider",
610
+ "disabled:hover:border-functional-disable-text"
611
+ ]
612
+ },
613
+ hasIcon: {
614
+ true: "pl-4 pr-8",
615
+ false: "px-4"
616
+ }
617
+ },
618
+ compoundVariants: [
619
+ { isError: true, hasIcon: true, class: "pr-[56px]" },
620
+ { isError: true, hasIcon: false, class: "pr-9" }
621
+ ]
622
+ }
623
+ );
624
+ var customIcon = classVarianceAuthority.cva("icon-md", {
625
+ variants: {
626
+ disabled: {
627
+ true: "cursor-default text-functional-border-divider",
628
+ false: "cursor-pointer text-functional-text"
629
+ }
630
+ }
631
+ });
632
+ var footer = classVarianceAuthority.cva("primary-body4", {
633
+ variants: {
634
+ isError: {
635
+ true: "text-status-negative",
636
+ false: "text-functional-text-light"
637
+ }
638
+ }
639
+ });
640
+ var skeleton = classVarianceAuthority.cva("w-full", {
641
+ variants: {
642
+ type: {
643
+ label: "h-[20px]",
644
+ input: "h-[38px]",
645
+ footer: "h-[16px]"
646
+ }
647
+ }
648
+ });
649
+ var CubeInputSkeleton = (props) => {
650
+ const { type } = props;
651
+ return /* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: skeleton({ type }) });
652
+ };
653
+ var CubeInput = react.forwardRef(
654
+ (props, ref) => {
655
+ const {
656
+ className,
657
+ required = false,
658
+ isLoading = false,
659
+ label,
660
+ tooltip,
661
+ helpMessage,
662
+ errorMessage,
663
+ trailingIcon,
664
+ disabled,
665
+ ...restProps
666
+ } = props;
667
+ const defaultId = react.useId();
668
+ const inputId = restProps.id || defaultId;
669
+ const isError = !!errorMessage && typeof errorMessage === "string";
670
+ const hasFooter = !!helpMessage || isError;
671
+ const hasIcon = !!trailingIcon;
672
+ const renderLabel = () => {
673
+ if (!label && !tooltip) return null;
674
+ if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(CubeInputSkeleton, { type: "label" });
675
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "primary-body2 flex items-center space-x-1", children: [
676
+ /* @__PURE__ */ jsxRuntime.jsx(
677
+ "label",
678
+ {
679
+ htmlFor: inputId,
680
+ className: "font-semibold text-functional-title",
681
+ children: label
682
+ }
683
+ ),
684
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-status-negative", children: "*" }),
685
+ tooltip
686
+ ] });
687
+ };
688
+ const renderIcon = () => {
689
+ const errorIcon = (() => {
690
+ if (!isError) return null;
691
+ return /* @__PURE__ */ jsxRuntime.jsx(WarningFilled_default, { className: "icon-md text-status-negative" });
692
+ })();
693
+ const customIcon2 = (() => {
694
+ if (!hasIcon) return null;
695
+ return react.cloneElement(trailingIcon, {
696
+ className: tailwindMerge.twMerge(
697
+ trailingIcon.props.className,
698
+ // Overrides icon size, color, and cursor style within the input.
699
+ customIcon({ disabled })
700
+ )
701
+ });
702
+ })();
703
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "absolute right-0 flex h-4 shrink-0 -translate-x-4 items-center justify-center gap-2 overflow-hidden", children: [
704
+ errorIcon,
705
+ customIcon2
706
+ ] });
707
+ };
708
+ const renderInput = () => {
709
+ if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(CubeInputSkeleton, { type: "input" });
710
+ return /* @__PURE__ */ jsxRuntime.jsx(
711
+ "input",
712
+ {
713
+ ...restProps,
714
+ id: inputId,
715
+ ref,
716
+ disabled,
717
+ className: tailwindMerge.twMerge(input({ isError, disabled, hasIcon }), className),
718
+ required
719
+ }
720
+ );
721
+ };
722
+ const renderFooter = () => {
723
+ if (!hasFooter) return null;
724
+ if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(CubeInputSkeleton, { type: "footer" });
725
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge(footer({ isError })), children: errorMessage ?? helpMessage });
726
+ };
727
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-[202px] space-y-[6px]", children: [
728
+ renderLabel(),
729
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-center", children: [
730
+ renderInput(),
731
+ renderIcon()
732
+ ] }),
733
+ renderFooter()
734
+ ] });
735
+ }
736
+ );
737
+ CubeInput.displayName = "CubeInput";
738
+ var CubePasswordInput = (props) => {
739
+ const { initialShowPassword = false, disabled, ...restProps } = props;
740
+ const [showPassword, setShowPassword] = react.useState(initialShowPassword);
741
+ const handleShowHide = () => {
742
+ setShowPassword((prev) => !prev);
743
+ };
744
+ const IconComponent = showPassword ? View_default : ViewOff_default;
745
+ return /* @__PURE__ */ jsxRuntime.jsx(
746
+ CubeInput,
747
+ {
748
+ ...restProps,
749
+ type: showPassword ? "text" : "password",
750
+ disabled,
751
+ trailingIcon: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { onClick: disabled ? void 0 : handleShowHide })
752
+ }
753
+ );
754
+ };
755
+
756
+ // src/i18n/resources/en-US.json
757
+ var en_US_default = {
758
+ "component.common.loading": "Loading",
759
+ "component.common.noData": "No Data"
760
+ };
761
+
762
+ // src/i18n/resources/zh-TW.json
763
+ var zh_TW_default = {
764
+ "component.common.loading": "\u8F09\u5165\u4E2D",
765
+ "component.common.noData": "\u6C92\u6709\u8CC7\u6599"
766
+ };
767
+
768
+ // src/i18n/i18n.ts
769
+ var i18n = i18next__default.default.createInstance();
770
+ i18n.use(reactI18next.initReactI18next).init({
771
+ resources: {
772
+ "en-US": { translation: en_US_default },
773
+ "zh-TW": { translation: zh_TW_default }
774
+ },
775
+ lng: "en-US",
776
+ fallbackLng: "en-US",
777
+ interpolation: {
778
+ escapeValue: false
779
+ // react already escapes from xss
780
+ }
781
+ });
782
+ var i18n_default = i18n;
783
+
784
+ // src/i18n/addCubeUiTranslations.ts
785
+ function addCubeUiTranslations(locale, resources) {
786
+ i18n_default.addResourceBundle(locale, "translation", resources, true, true);
787
+ if (i18n_default.isInitialized) {
788
+ i18n_default.emit("languageChanged", i18n_default.language);
789
+ }
790
+ }
791
+ var CubeUiLocaleProvider = (props) => {
792
+ const { locale, children } = props;
793
+ react.useEffect(() => {
794
+ i18n_default.changeLanguage(locale);
795
+ }, [locale]);
796
+ return children;
797
+ };
798
+ var useCubeUiTranslation = (ns, options) => {
799
+ return reactI18next.useTranslation(ns, { ...options, i18n: i18n_default });
800
+ };
801
+ var CubeThemeProvider = (props) => {
802
+ const { theme, children } = props;
803
+ react.useEffect(() => {
804
+ document.documentElement.dataset.cubeTheme = theme;
805
+ }, [theme]);
806
+ return children;
807
+ };
808
+
809
+ // src/theme/tokens/utils/animationKeyframes.ts
810
+ var skeletonKeyframes = {
811
+ "cube-skeleton": {
812
+ "100%": {
813
+ backgroundPositionX: "-20%"
814
+ }
815
+ }
816
+ };
817
+ var dotSpinner45Keyframes = {
818
+ "cube-dot-spinner-45-vector-0": {
819
+ "0%, 100%": { opacity: "1" },
820
+ "12.5%, 87.5%": { opacity: "0" }
821
+ },
822
+ "cube-dot-spinner-45-vector-1": {
823
+ "0%, 25%, 100%": { opacity: "0" },
824
+ "12.5%": { opacity: "1" }
825
+ },
826
+ "cube-dot-spinner-45-vector-2": {
827
+ "0%, 12.5%, 37.5%, 100%": { opacity: "0" },
828
+ "25%": { opacity: "1" }
829
+ },
830
+ "cube-dot-spinner-45-vector-3": {
831
+ "0%, 25%, 50%, 100%": { opacity: "0" },
832
+ "37.5%": { opacity: "1" }
833
+ },
834
+ "cube-dot-spinner-45-vector-4": {
835
+ "0%, 37.5%, 62.5%, 100%": { opacity: "0" },
836
+ "50%": { opacity: "1" }
837
+ },
838
+ "cube-dot-spinner-45-vector-5": {
839
+ "0%, 50%, 75%, 100%": { opacity: "0" },
840
+ "62.5%": { opacity: "1" }
841
+ },
842
+ "cube-dot-spinner-45-vector-6": {
843
+ "0%, 62.5%, 87.5%, 100%": { opacity: "0" },
844
+ "75%": { opacity: "1" }
845
+ },
846
+ "cube-dot-spinner-45-vector-7": {
847
+ "0%, 75%, 100%": { opacity: "0" },
848
+ "87.5%": { opacity: "1" }
849
+ }
850
+ };
851
+ var dotSpinner120Keyframes = {
852
+ "cube-dot-spinner-120-vector-0": {
853
+ "0%, 100%": { opacity: "1" },
854
+ "33.3%, 66.6%": { opacity: "0" }
855
+ },
856
+ "cube-dot-spinner-120-vector-1": {
857
+ "0%, 66.6%, 100%": { opacity: "0" },
858
+ "33.3%": { opacity: "1" }
859
+ },
860
+ "cube-dot-spinner-120-vector-2": {
861
+ "0%, 33.3%, 100%": { opacity: "0" },
862
+ "66.6%": { opacity: "1" }
863
+ }
864
+ };
865
+ var cubeSpinnerKeyframes = {
866
+ "cube-spinner-vector-0": {
867
+ "0%, 100%": { opacity: "1" },
868
+ "33.3%, 66.6%": { opacity: "0" }
869
+ },
870
+ "cube-spinner-vector-1": {
871
+ "0%, 66.6%, 100%": { opacity: "0" },
872
+ "33.3%": { opacity: "1" }
873
+ },
874
+ "cube-spinner-vector-2": {
875
+ "0%, 33.3%, 100%": { opacity: "0" },
876
+ "66.6%": { opacity: "1" }
877
+ }
878
+ };
879
+ var cubeAnimationKeyframes = {
880
+ ...skeletonKeyframes,
881
+ ...dotSpinner45Keyframes,
882
+ ...dotSpinner120Keyframes,
883
+ ...cubeSpinnerKeyframes
884
+ };
885
+
886
+ // src/theme/tokens/utils/animations.ts
887
+ var skeletonAnimations = {
888
+ "cube-skeleton": "cube-skeleton 1.5s ease-in-out infinite"
889
+ };
890
+ var dotSpinner45VectorShorthand = (vectorIndex) => `cube-dot-spinner-45-vector-${vectorIndex} 1s linear infinite`;
891
+ var dotSpinner45Animations = {
892
+ "cube-dot-spinner-45-vector-0": dotSpinner45VectorShorthand(0),
893
+ "cube-dot-spinner-45-vector-1": dotSpinner45VectorShorthand(1),
894
+ "cube-dot-spinner-45-vector-2": dotSpinner45VectorShorthand(2),
895
+ "cube-dot-spinner-45-vector-3": dotSpinner45VectorShorthand(3),
896
+ "cube-dot-spinner-45-vector-4": dotSpinner45VectorShorthand(4),
897
+ "cube-dot-spinner-45-vector-5": dotSpinner45VectorShorthand(5),
898
+ "cube-dot-spinner-45-vector-6": dotSpinner45VectorShorthand(6),
899
+ "cube-dot-spinner-45-vector-7": dotSpinner45VectorShorthand(7)
900
+ };
901
+ var dotSpinner120VectorShorthand = (vectorIndex) => `cube-dot-spinner-120-vector-${vectorIndex} 1s linear infinite`;
902
+ var dotSpinner120Animations = {
903
+ "cube-dot-spinner-120-vector-0": dotSpinner120VectorShorthand(0),
904
+ "cube-dot-spinner-120-vector-1": dotSpinner120VectorShorthand(1),
905
+ "cube-dot-spinner-120-vector-2": dotSpinner120VectorShorthand(2)
906
+ };
907
+ var cubeSpinnerVectorShorthand = (vectorIndex) => `cube-spinner-vector-${vectorIndex} 1.25s linear infinite`;
908
+ var cubeSpinnerAnimations = {
909
+ "cube-spinner-vector-0": cubeSpinnerVectorShorthand(0),
910
+ "cube-spinner-vector-1": cubeSpinnerVectorShorthand(1),
911
+ "cube-spinner-vector-2": cubeSpinnerVectorShorthand(2)
912
+ };
913
+ var cubeAnimations = {
914
+ ...skeletonAnimations,
915
+ ...dotSpinner45Animations,
916
+ ...dotSpinner120Animations,
917
+ ...cubeSpinnerAnimations
918
+ };
919
+
920
+ // src/theme/tokens/cubeTheme.ts
921
+ var cubeTheme = {
922
+ screens: {
923
+ "height-sm": {
924
+ raw: "(min-height: 768px)"
925
+ },
926
+ "height-md": {
927
+ raw: "(min-height: 864px)"
928
+ },
929
+ "height-lg": {
930
+ raw: "(min-height: 960px)"
931
+ },
932
+ "height-xl": {
933
+ raw: "(min-height: 1080px)"
934
+ }
935
+ },
936
+ colors: {
937
+ // Every color below resolves through a CSS custom property (defined in
938
+ // `themes/*.css`) so a consuming product can swap colors at runtime
939
+ // without a rebuild. Only `cubeCOS` sets all of them; other
940
+ // themes only need to override the tokens that actually differ (e.g.
941
+ // primary/secondary/cosmos) - anything unset falls back to `cubeCOS`'s
942
+ // value via normal CSS cascade.
943
+ primary: {
944
+ DEFAULT: "var(--cube-color-primary-DEFAULT)",
945
+ 0: "var(--cube-color-primary-0)",
946
+ 50: "var(--cube-color-primary-50)",
947
+ 100: "var(--cube-color-primary-100)",
948
+ 150: "var(--cube-color-primary-150)",
949
+ 200: "var(--cube-color-primary-200)",
950
+ 300: "var(--cube-color-primary-300)",
951
+ 400: "var(--cube-color-primary-400)",
952
+ 500: "var(--cube-color-primary-500)",
953
+ 600: "var(--cube-color-primary-600)",
954
+ 700: "var(--cube-color-primary-700)",
955
+ 800: "var(--cube-color-primary-800)",
956
+ 850: "var(--cube-color-primary-850)"
957
+ },
958
+ secondary: {
959
+ DEFAULT: "var(--cube-color-secondary-DEFAULT)",
960
+ 0: "var(--cube-color-secondary-0)",
961
+ 50: "var(--cube-color-secondary-50)",
962
+ 100: "var(--cube-color-secondary-100)",
963
+ 150: "var(--cube-color-secondary-150)",
964
+ 200: "var(--cube-color-secondary-200)",
965
+ 300: "var(--cube-color-secondary-300)",
966
+ 400: "var(--cube-color-secondary-400)",
967
+ 500: "var(--cube-color-secondary-500)",
968
+ 600: "var(--cube-color-secondary-600)",
969
+ 700: "var(--cube-color-secondary-700)",
970
+ 800: "var(--cube-color-secondary-800)",
971
+ 850: "var(--cube-color-secondary-850)"
972
+ },
973
+ dark: {
974
+ 0: "var(--cube-color-dark-0)",
975
+ 50: "var(--cube-color-dark-50)",
976
+ 100: "var(--cube-color-dark-100)",
977
+ 150: "var(--cube-color-dark-150)",
978
+ 200: "var(--cube-color-dark-200)",
979
+ 300: "var(--cube-color-dark-300)",
980
+ 400: "var(--cube-color-dark-400)",
981
+ 500: "var(--cube-color-dark-500)",
982
+ 600: "var(--cube-color-dark-600)",
983
+ 700: "var(--cube-color-dark-700)",
984
+ 800: "var(--cube-color-dark-800)",
985
+ 850: "var(--cube-color-dark-850)"
986
+ },
987
+ grey: {
988
+ 0: "var(--cube-color-grey-0)",
989
+ 50: "var(--cube-color-grey-50)",
990
+ 100: "var(--cube-color-grey-100)",
991
+ 150: "var(--cube-color-grey-150)",
992
+ 200: "var(--cube-color-grey-200)",
993
+ 300: "var(--cube-color-grey-300)",
994
+ 400: "var(--cube-color-grey-400)",
995
+ 500: "var(--cube-color-grey-500)",
996
+ 600: "var(--cube-color-grey-600)",
997
+ 700: "var(--cube-color-grey-700)",
998
+ 800: "var(--cube-color-grey-800)",
999
+ 850: "var(--cube-color-grey-850)"
1000
+ },
1001
+ blue: {
1002
+ 0: "var(--cube-color-blue-0)",
1003
+ 50: "var(--cube-color-blue-50)",
1004
+ 100: "var(--cube-color-blue-100)",
1005
+ 150: "var(--cube-color-blue-150)",
1006
+ 200: "var(--cube-color-blue-200)",
1007
+ 300: "var(--cube-color-blue-300)",
1008
+ 400: "var(--cube-color-blue-400)",
1009
+ 500: "var(--cube-color-blue-500)",
1010
+ 600: "var(--cube-color-blue-600)",
1011
+ 700: "var(--cube-color-blue-700)",
1012
+ 800: "var(--cube-color-blue-800)",
1013
+ 850: "var(--cube-color-blue-850)"
1014
+ },
1015
+ green: {
1016
+ 0: "var(--cube-color-green-0)",
1017
+ 50: "var(--cube-color-green-50)",
1018
+ 100: "var(--cube-color-green-100)",
1019
+ 150: "var(--cube-color-green-150)",
1020
+ 200: "var(--cube-color-green-200)",
1021
+ 300: "var(--cube-color-green-300)",
1022
+ 400: "var(--cube-color-green-400)",
1023
+ 500: "var(--cube-color-green-500)",
1024
+ 600: "var(--cube-color-green-600)",
1025
+ 700: "var(--cube-color-green-700)",
1026
+ 800: "var(--cube-color-green-800)",
1027
+ 850: "var(--cube-color-green-850)"
1028
+ },
1029
+ yellow: {
1030
+ 0: "var(--cube-color-yellow-0)",
1031
+ 50: "var(--cube-color-yellow-50)",
1032
+ 100: "var(--cube-color-yellow-100)",
1033
+ 150: "var(--cube-color-yellow-150)",
1034
+ 200: "var(--cube-color-yellow-200)",
1035
+ 300: "var(--cube-color-yellow-300)",
1036
+ 400: "var(--cube-color-yellow-400)",
1037
+ 500: "var(--cube-color-yellow-500)",
1038
+ 600: "var(--cube-color-yellow-600)",
1039
+ 700: "var(--cube-color-yellow-700)",
1040
+ 800: "var(--cube-color-yellow-800)",
1041
+ 850: "var(--cube-color-yellow-850)"
1042
+ },
1043
+ red: {
1044
+ 0: "var(--cube-color-red-0)",
1045
+ 50: "var(--cube-color-red-50)",
1046
+ 100: "var(--cube-color-red-100)",
1047
+ 150: "var(--cube-color-red-150)",
1048
+ 200: "var(--cube-color-red-200)",
1049
+ 300: "var(--cube-color-red-300)",
1050
+ 400: "var(--cube-color-red-400)",
1051
+ 500: "var(--cube-color-red-500)",
1052
+ 600: "var(--cube-color-red-600)",
1053
+ 700: "var(--cube-color-red-700)",
1054
+ 800: "var(--cube-color-red-800)",
1055
+ 850: "var(--cube-color-red-850)"
1056
+ },
1057
+ cosmos: {
1058
+ primary: "var(--cube-color-primary-DEFAULT)",
1059
+ secondary: "var(--cube-color-secondary-DEFAULT)"
1060
+ },
1061
+ scene: {
1062
+ gradient: "linear-gradient(90deg, var(--cube-color-scene-gradient-1) 0%, var(--cube-color-scene-gradient-2) 30%, var(--cube-color-scene-gradient-3) 65%, var(--cube-color-scene-gradient-4) 100%)",
1063
+ background: "var(--cube-color-scene-background)"
1064
+ },
1065
+ functional: {
1066
+ title: "var(--cube-color-functional-title)",
1067
+ text: "var(--cube-color-functional-text)",
1068
+ "text-light": "var(--cube-color-functional-text-light)",
1069
+ "hover-primary": "var(--cube-color-functional-hover-primary)",
1070
+ "hover-secondary": "var(--cube-color-functional-hover-secondary)",
1071
+ "hover-grey": "var(--cube-color-functional-hover-grey)",
1072
+ "hover-grey-darker": "var(--cube-color-functional-hover-grey-darker)",
1073
+ "border-divider": "var(--cube-color-functional-border-divider)",
1074
+ "border-darker": "var(--cube-color-functional-border-darker)",
1075
+ disable: "var(--cube-color-functional-disable)",
1076
+ "disable-text": "var(--cube-color-functional-disable-text)",
1077
+ "disable-light": "var(--cube-color-functional-disable-light)",
1078
+ skeleton: "var(--cube-color-functional-skeleton)"
1079
+ },
1080
+ status: {
1081
+ positive: "var(--cube-color-status-positive)",
1082
+ "positive-text": "var(--cube-color-status-positive-text)",
1083
+ negative: "var(--cube-color-status-negative)",
1084
+ warning: "var(--cube-color-status-warning)",
1085
+ paused: "var(--cube-color-status-paused)",
1086
+ neutral: "var(--cube-color-status-neutral)",
1087
+ "over-limit": "var(--cube-color-status-over-limit)"
1088
+ },
1089
+ chart: {
1090
+ 1: "var(--cube-color-chart-1)",
1091
+ 2: "var(--cube-color-chart-2)",
1092
+ 3: "var(--cube-color-chart-3)",
1093
+ 4: "var(--cube-color-chart-4)",
1094
+ 5: "var(--cube-color-chart-5)",
1095
+ 6: "var(--cube-color-chart-6)",
1096
+ 7: "var(--cube-color-chart-7)",
1097
+ 8: "var(--cube-color-chart-8)",
1098
+ 9: "var(--cube-color-chart-9)",
1099
+ 10: "var(--cube-color-chart-10)",
1100
+ 11: "var(--cube-color-chart-11)",
1101
+ 12: "var(--cube-color-chart-12)",
1102
+ 13: "var(--cube-color-chart-13)",
1103
+ 14: "var(--cube-color-chart-14)",
1104
+ 15: "var(--cube-color-chart-15)",
1105
+ 16: "var(--cube-color-chart-16)",
1106
+ 17: "var(--cube-color-chart-17)",
1107
+ 18: "var(--cube-color-chart-18)",
1108
+ 19: "var(--cube-color-chart-19)",
1109
+ 20: "var(--cube-color-chart-20)",
1110
+ 21: "var(--cube-color-chart-21)",
1111
+ 22: "var(--cube-color-chart-22)",
1112
+ 23: "var(--cube-color-chart-23)",
1113
+ 24: "var(--cube-color-chart-24)",
1114
+ 25: "var(--cube-color-chart-25)",
1115
+ 26: "var(--cube-color-chart-26)",
1116
+ 27: "var(--cube-color-chart-27)",
1117
+ 28: "var(--cube-color-chart-28)",
1118
+ 29: "var(--cube-color-chart-29)",
1119
+ 30: "var(--cube-color-chart-30)",
1120
+ 31: "var(--cube-color-chart-31)",
1121
+ 32: "var(--cube-color-chart-32)"
1122
+ }
1123
+ },
1124
+ fontFamily: {
1125
+ // Fallback to Noto Sans TC for Traditional Chinese.
1126
+ urbanist: ["Urbanist", "Noto Sans TC", ...defaultTheme__default.default.fontFamily.sans],
1127
+ inter: ["Inter", "Noto Sans TC", ...defaultTheme__default.default.fontFamily.sans],
1128
+ ["noto-sans-tc"]: ["Noto Sans TC", ...defaultTheme__default.default.fontFamily.sans],
1129
+ sans: ["Inter", "Noto Sans TC", ...defaultTheme__default.default.fontFamily.sans]
1130
+ },
1131
+ fontWeight: {
1132
+ regular: "400",
1133
+ medium: "500",
1134
+ semibold: "600"
1135
+ },
1136
+ keyframes: {
1137
+ ...cubeAnimationKeyframes
1138
+ },
1139
+ animation: {
1140
+ ...cubeAnimations
1141
+ }
1142
+ };
1143
+
1144
+ // src/theme/tokens/plugins/backgroundGradientPlugin.ts
1145
+ var backgroundGradientPlugin = ({
1146
+ addUtilities,
1147
+ theme
1148
+ }) => {
1149
+ addUtilities({
1150
+ ".background-scene-gradient": {
1151
+ background: theme("colors.scene.gradient")
1152
+ },
1153
+ ".bg-image-scene-gradient": {
1154
+ backgroundImage: theme("colors.scene.gradient")
1155
+ }
1156
+ });
1157
+ };
1158
+
1159
+ // src/theme/tokens/plugins/iconPlugin.ts
1160
+ var iconPlugin = ({ addComponents }) => {
1161
+ addComponents({
1162
+ ".icon-xs": {
1163
+ width: "10px",
1164
+ height: "10px"
1165
+ },
1166
+ ".icon-frame-xs": {
1167
+ width: "16px",
1168
+ height: "16px"
1169
+ },
1170
+ ".icon-sm": {
1171
+ width: "12px",
1172
+ height: "12px"
1173
+ },
1174
+ ".icon-frame-sm": {
1175
+ width: "24px",
1176
+ height: "24px"
1177
+ },
1178
+ ".icon-md-sm": {
1179
+ width: "14px",
1180
+ height: "14px"
1181
+ },
1182
+ ".icon-frame-md-sm": {
1183
+ width: "28px",
1184
+ height: "28px"
1185
+ },
1186
+ ".icon-md": {
1187
+ width: "16px",
1188
+ height: "16px"
1189
+ },
1190
+ ".icon-frame-md": {
1191
+ width: "32px",
1192
+ height: "32px"
1193
+ },
1194
+ ".icon-lg": {
1195
+ width: "18px",
1196
+ height: "18px"
1197
+ },
1198
+ ".icon-frame-lg": {
1199
+ width: "40px",
1200
+ height: "40px"
1201
+ },
1202
+ ".icon-xl": {
1203
+ width: "24px",
1204
+ height: "24px"
1205
+ },
1206
+ ".icon-frame-xl": {
1207
+ width: "48px",
1208
+ height: "48px"
1209
+ }
1210
+ });
1211
+ };
1212
+
1213
+ // src/theme/tokens/plugins/skeletonPlugin.ts
1214
+ var skeletonPlugin = ({ addComponents, theme }) => {
1215
+ const skeletonColor = theme("colors.functional.skeleton");
1216
+ addComponents({
1217
+ ".cube-skeleton": {
1218
+ background: `linear-gradient(90deg, transparent 60%, rgba(255, 255, 255, .5) 70%, transparent 80%) ${skeletonColor}`,
1219
+ backgroundSize: "200% 100%",
1220
+ backgroundPositionX: "180%"
1221
+ }
1222
+ });
1223
+ };
1224
+
1225
+ // src/theme/tokens/utils/typography/primaryBodies.ts
1226
+ var FONT_FAMILY = "inter";
1227
+ var LETTER_SPACING = "normal";
1228
+ var FONT_WEIGHT = 400;
1229
+ var primaryBody1 = {
1230
+ fontFamily: FONT_FAMILY,
1231
+ fontSize: "15px",
1232
+ lineHeight: "22px",
1233
+ letterSpacing: LETTER_SPACING,
1234
+ fontWeight: FONT_WEIGHT
1235
+ };
1236
+ var primaryBody2 = {
1237
+ fontFamily: FONT_FAMILY,
1238
+ fontSize: "14px",
1239
+ lineHeight: "20px",
1240
+ letterSpacing: LETTER_SPACING,
1241
+ fontWeight: FONT_WEIGHT
1242
+ };
1243
+ var primaryBody3 = {
1244
+ fontFamily: FONT_FAMILY,
1245
+ fontSize: "13px",
1246
+ lineHeight: "18px",
1247
+ letterSpacing: LETTER_SPACING,
1248
+ fontWeight: FONT_WEIGHT
1249
+ };
1250
+ var primaryBody4 = {
1251
+ fontFamily: FONT_FAMILY,
1252
+ fontSize: "12px",
1253
+ lineHeight: "16px",
1254
+ letterSpacing: LETTER_SPACING,
1255
+ fontWeight: FONT_WEIGHT
1256
+ };
1257
+ var primaryBody5 = {
1258
+ fontFamily: FONT_FAMILY,
1259
+ fontSize: "11px",
1260
+ lineHeight: "15px",
1261
+ letterSpacing: LETTER_SPACING,
1262
+ fontWeight: FONT_WEIGHT
1263
+ };
1264
+ var primaryBody6 = {
1265
+ fontFamily: FONT_FAMILY,
1266
+ fontSize: "10px",
1267
+ lineHeight: "13px",
1268
+ letterSpacing: LETTER_SPACING,
1269
+ fontWeight: FONT_WEIGHT
1270
+ };
1271
+
1272
+ // src/theme/tokens/utils/typography/primaryHeadings.ts
1273
+ var FONT_FAMILY2 = "urbanist";
1274
+ var LETTER_SPACING2 = "0.02em";
1275
+ var FONT_WEIGHT2 = 600;
1276
+ var primaryH1 = {
1277
+ fontFamily: FONT_FAMILY2,
1278
+ fontSize: "30px",
1279
+ lineHeight: "38px",
1280
+ letterSpacing: LETTER_SPACING2,
1281
+ fontWeight: FONT_WEIGHT2
1282
+ };
1283
+ var primaryH2 = {
1284
+ fontFamily: FONT_FAMILY2,
1285
+ fontSize: "24px",
1286
+ lineHeight: "30px",
1287
+ letterSpacing: LETTER_SPACING2,
1288
+ fontWeight: FONT_WEIGHT2
1289
+ };
1290
+ var primaryH3 = {
1291
+ fontFamily: FONT_FAMILY2,
1292
+ fontSize: "20px",
1293
+ lineHeight: "24px",
1294
+ letterSpacing: LETTER_SPACING2,
1295
+ fontWeight: FONT_WEIGHT2
1296
+ };
1297
+ var primaryH4 = {
1298
+ fontFamily: FONT_FAMILY2,
1299
+ fontSize: "18px",
1300
+ lineHeight: "22px",
1301
+ letterSpacing: LETTER_SPACING2,
1302
+ fontWeight: FONT_WEIGHT2
1303
+ };
1304
+ var primaryH5 = {
1305
+ fontFamily: FONT_FAMILY2,
1306
+ fontSize: "16px",
1307
+ lineHeight: "20px",
1308
+ letterSpacing: LETTER_SPACING2,
1309
+ fontWeight: FONT_WEIGHT2
1310
+ };
1311
+
1312
+ // src/theme/tokens/utils/typography/secondaryBodies.ts
1313
+ var FONT_FAMILY3 = "urbanist";
1314
+ var LETTER_SPACING3 = "0.02em";
1315
+ var FONT_WEIGHT3 = 400;
1316
+ var secondaryBody1 = {
1317
+ fontFamily: FONT_FAMILY3,
1318
+ fontSize: "15px",
1319
+ lineHeight: "22px",
1320
+ letterSpacing: LETTER_SPACING3,
1321
+ fontWeight: FONT_WEIGHT3
1322
+ };
1323
+ var secondaryBody2 = {
1324
+ fontFamily: FONT_FAMILY3,
1325
+ fontSize: "14px",
1326
+ lineHeight: "18px",
1327
+ letterSpacing: LETTER_SPACING3,
1328
+ fontWeight: FONT_WEIGHT3
1329
+ };
1330
+ var secondaryBody3 = {
1331
+ fontFamily: FONT_FAMILY3,
1332
+ fontSize: "13px",
1333
+ lineHeight: "16px",
1334
+ letterSpacing: LETTER_SPACING3,
1335
+ fontWeight: FONT_WEIGHT3
1336
+ };
1337
+ var secondaryBody4 = {
1338
+ fontFamily: FONT_FAMILY3,
1339
+ fontSize: "12px",
1340
+ lineHeight: "16px",
1341
+ letterSpacing: LETTER_SPACING3,
1342
+ fontWeight: FONT_WEIGHT3
1343
+ };
1344
+ var secondaryBody5 = {
1345
+ fontFamily: FONT_FAMILY3,
1346
+ fontSize: "11px",
1347
+ lineHeight: "15px",
1348
+ letterSpacing: LETTER_SPACING3,
1349
+ fontWeight: FONT_WEIGHT3
1350
+ };
1351
+ var secondaryBody6 = {
1352
+ fontFamily: FONT_FAMILY3,
1353
+ fontSize: "10px",
1354
+ lineHeight: "14px",
1355
+ letterSpacing: LETTER_SPACING3,
1356
+ fontWeight: FONT_WEIGHT3
1357
+ };
1358
+ var secondaryBody7 = {
1359
+ fontFamily: FONT_FAMILY3,
1360
+ fontSize: "9px",
1361
+ lineHeight: "12px",
1362
+ letterSpacing: LETTER_SPACING3,
1363
+ fontWeight: FONT_WEIGHT3
1364
+ };
1365
+
1366
+ // src/theme/tokens/utils/typography/secondaryHeadings.ts
1367
+ var FONT_FAMILY4 = "inter";
1368
+ var LETTER_SPACING4 = "0.02em";
1369
+ var FONT_WEIGHT4 = 600;
1370
+ var secondaryH1 = {
1371
+ fontFamily: FONT_FAMILY4,
1372
+ fontSize: "30px",
1373
+ lineHeight: "38px",
1374
+ letterSpacing: LETTER_SPACING4,
1375
+ fontWeight: FONT_WEIGHT4
1376
+ };
1377
+ var secondaryH2 = {
1378
+ fontFamily: FONT_FAMILY4,
1379
+ fontSize: "24px",
1380
+ lineHeight: "30px",
1381
+ letterSpacing: LETTER_SPACING4,
1382
+ fontWeight: FONT_WEIGHT4
1383
+ };
1384
+ var secondaryH3 = {
1385
+ fontFamily: FONT_FAMILY4,
1386
+ fontSize: "20px",
1387
+ lineHeight: "24px",
1388
+ letterSpacing: LETTER_SPACING4,
1389
+ fontWeight: FONT_WEIGHT4
1390
+ };
1391
+ var secondaryH4 = {
1392
+ fontFamily: FONT_FAMILY4,
1393
+ fontSize: "18px",
1394
+ lineHeight: "22px",
1395
+ letterSpacing: LETTER_SPACING4,
1396
+ fontWeight: FONT_WEIGHT4
1397
+ };
1398
+ var secondaryH5 = {
1399
+ fontFamily: FONT_FAMILY4,
1400
+ fontSize: "16px",
1401
+ lineHeight: "20px",
1402
+ letterSpacing: LETTER_SPACING4,
1403
+ fontWeight: FONT_WEIGHT4
1404
+ };
1405
+
1406
+ // src/theme/tokens/utils/typography/typography.ts
1407
+ var typographyMap = {
1408
+ "primary-h1": primaryH1,
1409
+ "primary-h2": primaryH2,
1410
+ "primary-h3": primaryH3,
1411
+ "primary-h4": primaryH4,
1412
+ "primary-h5": primaryH5,
1413
+ "secondary-h1": secondaryH1,
1414
+ "secondary-h2": secondaryH2,
1415
+ "secondary-h3": secondaryH3,
1416
+ "secondary-h4": secondaryH4,
1417
+ "secondary-h5": secondaryH5,
1418
+ "primary-body1": primaryBody1,
1419
+ "primary-body2": primaryBody2,
1420
+ "primary-body3": primaryBody3,
1421
+ "primary-body4": primaryBody4,
1422
+ "primary-body5": primaryBody5,
1423
+ "primary-body6": primaryBody6,
1424
+ "secondary-body1": secondaryBody1,
1425
+ "secondary-body2": secondaryBody2,
1426
+ "secondary-body3": secondaryBody3,
1427
+ "secondary-body4": secondaryBody4,
1428
+ "secondary-body5": secondaryBody5,
1429
+ "secondary-body6": secondaryBody6,
1430
+ "secondary-body7": secondaryBody7
1431
+ };
1432
+ var getTypography = (className) => {
1433
+ return typographyMap[className];
1434
+ };
1435
+
1436
+ // src/theme/tokens/plugins/typographyPlugin.ts
1437
+ var typographyPlugin = ({ addComponents }) => {
1438
+ const components = Object.fromEntries(
1439
+ Object.entries(typographyMap).map(([className, typography]) => {
1440
+ const selector = `.${className}`;
1441
+ const fontFamily = cubeTheme.fontFamily[typography.fontFamily].join(", ");
1442
+ const definition = {
1443
+ fontFamily,
1444
+ fontSize: typography.fontSize,
1445
+ lineHeight: typography.lineHeight,
1446
+ letterSpacing: typography.letterSpacing ?? null,
1447
+ fontWeight: typography.fontWeight.toString()
1448
+ };
1449
+ return [selector, definition];
1450
+ })
1451
+ );
1452
+ addComponents(components);
1453
+ };
1454
+
1455
+ // src/theme/tokens/cubePreset.ts
1456
+ var cubePreset = {
1457
+ theme: {
1458
+ extend: cubeTheme
1459
+ },
1460
+ plugins: [
1461
+ backgroundGradientPlugin,
1462
+ iconPlugin,
1463
+ skeletonPlugin,
1464
+ typographyPlugin
1465
+ ]
1466
+ };
1467
+
1468
+ exports.CubeButton = CubeButton;
1469
+ exports.CubeButtonSkeleton = CubeButtonSkeleton;
1470
+ exports.CubeIconFrame = CubeIconFrame;
1471
+ exports.CubeInput = CubeInput;
1472
+ exports.CubeLoadingSpinner = CubeLoadingSpinner;
1473
+ exports.CubePasswordInput = CubePasswordInput;
1474
+ exports.CubeSkeleton = CubeSkeleton;
1475
+ exports.CubeThemeProvider = CubeThemeProvider;
1476
+ exports.CubeUiLocaleProvider = CubeUiLocaleProvider;
1477
+ exports.addCubeUiTranslations = addCubeUiTranslations;
1478
+ exports.cubePreset = cubePreset;
1479
+ exports.cubeTheme = cubeTheme;
1480
+ exports.getTypography = getTypography;
1481
+ exports.useCubeUiTranslation = useCubeUiTranslation;
1482
+ //# sourceMappingURL=index.js.map
1483
+ //# sourceMappingURL=index.js.map