cekat-ui 1.0.1 → 1.0.3

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.d.ts CHANGED
@@ -0,0 +1,5 @@
1
+ export * from '../stories/Button/index';
2
+ export * from '../stories/Checkbox/index';
3
+ export * from '../stories/Radio/index';
4
+ export * from '../stories/Toggle/index';
5
+ export * from '../stories/Tooltip/index';
package/dist/index.es.js CHANGED
@@ -1 +1,785 @@
1
-
1
+ import * as y from "react";
2
+ import ue from "react";
3
+ import { createPortal as ce } from "react-dom";
4
+ var V = { exports: {} }, O = {};
5
+ var J;
6
+ function de() {
7
+ if (J) return O;
8
+ J = 1;
9
+ var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), n = /* @__PURE__ */ Symbol.for("react.fragment");
10
+ function r(a, s, l) {
11
+ var b = null;
12
+ if (l !== void 0 && (b = "" + l), s.key !== void 0 && (b = "" + s.key), "key" in s) {
13
+ l = {};
14
+ for (var m in s)
15
+ m !== "key" && (l[m] = s[m]);
16
+ } else l = s;
17
+ return s = l.ref, {
18
+ $$typeof: t,
19
+ type: a,
20
+ key: b,
21
+ ref: s !== void 0 ? s : null,
22
+ props: l
23
+ };
24
+ }
25
+ return O.Fragment = n, O.jsx = r, O.jsxs = r, O;
26
+ }
27
+ var C = {};
28
+ var q;
29
+ function fe() {
30
+ return q || (q = 1, process.env.NODE_ENV !== "production" && (function() {
31
+ function t(e) {
32
+ if (e == null) return null;
33
+ if (typeof e == "function")
34
+ return e.$$typeof === se ? null : e.displayName || e.name || null;
35
+ if (typeof e == "string") return e;
36
+ switch (e) {
37
+ case E:
38
+ return "Fragment";
39
+ case T:
40
+ return "Profiler";
41
+ case h:
42
+ return "StrictMode";
43
+ case re:
44
+ return "Suspense";
45
+ case ne:
46
+ return "SuspenseList";
47
+ case oe:
48
+ return "Activity";
49
+ }
50
+ if (typeof e == "object")
51
+ switch (typeof e.tag == "number" && console.error(
52
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
53
+ ), e.$$typeof) {
54
+ case k:
55
+ return "Portal";
56
+ case A:
57
+ return e.displayName || "Context";
58
+ case N:
59
+ return (e._context.displayName || "Context") + ".Consumer";
60
+ case te:
61
+ var o = e.render;
62
+ return e = e.displayName, e || (e = o.displayName || o.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
63
+ case ae:
64
+ return o = e.displayName || null, o !== null ? o : t(e.type) || "Memo";
65
+ case F:
66
+ o = e._payload, e = e._init;
67
+ try {
68
+ return t(e(o));
69
+ } catch {
70
+ }
71
+ }
72
+ return null;
73
+ }
74
+ function n(e) {
75
+ return "" + e;
76
+ }
77
+ function r(e) {
78
+ try {
79
+ n(e);
80
+ var o = !1;
81
+ } catch {
82
+ o = !0;
83
+ }
84
+ if (o) {
85
+ o = console;
86
+ var i = o.error, c = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
87
+ return i.call(
88
+ o,
89
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
90
+ c
91
+ ), n(e);
92
+ }
93
+ }
94
+ function a(e) {
95
+ if (e === E) return "<>";
96
+ if (typeof e == "object" && e !== null && e.$$typeof === F)
97
+ return "<...>";
98
+ try {
99
+ var o = t(e);
100
+ return o ? "<" + o + ">" : "<...>";
101
+ } catch {
102
+ return "<...>";
103
+ }
104
+ }
105
+ function s() {
106
+ var e = D.A;
107
+ return e === null ? null : e.getOwner();
108
+ }
109
+ function l() {
110
+ return Error("react-stack-top-frame");
111
+ }
112
+ function b(e) {
113
+ if ($.call(e, "key")) {
114
+ var o = Object.getOwnPropertyDescriptor(e, "key").get;
115
+ if (o && o.isReactWarning) return !1;
116
+ }
117
+ return e.key !== void 0;
118
+ }
119
+ function m(e, o) {
120
+ function i() {
121
+ M || (M = !0, console.error(
122
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
123
+ o
124
+ ));
125
+ }
126
+ i.isReactWarning = !0, Object.defineProperty(e, "key", {
127
+ get: i,
128
+ configurable: !0
129
+ });
130
+ }
131
+ function v() {
132
+ var e = t(this.type);
133
+ return G[e] || (G[e] = !0, console.error(
134
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
135
+ )), e = this.props.ref, e !== void 0 ? e : null;
136
+ }
137
+ function u(e, o, i, c, P, z) {
138
+ var d = i.ref;
139
+ return e = {
140
+ $$typeof: _,
141
+ type: e,
142
+ key: o,
143
+ props: i,
144
+ _owner: c
145
+ }, (d !== void 0 ? d : null) !== null ? Object.defineProperty(e, "ref", {
146
+ enumerable: !1,
147
+ get: v
148
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
149
+ configurable: !1,
150
+ enumerable: !1,
151
+ writable: !0,
152
+ value: 0
153
+ }), Object.defineProperty(e, "_debugInfo", {
154
+ configurable: !1,
155
+ enumerable: !1,
156
+ writable: !0,
157
+ value: null
158
+ }), Object.defineProperty(e, "_debugStack", {
159
+ configurable: !1,
160
+ enumerable: !1,
161
+ writable: !0,
162
+ value: P
163
+ }), Object.defineProperty(e, "_debugTask", {
164
+ configurable: !1,
165
+ enumerable: !1,
166
+ writable: !0,
167
+ value: z
168
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
169
+ }
170
+ function p(e, o, i, c, P, z) {
171
+ var d = o.children;
172
+ if (d !== void 0)
173
+ if (c)
174
+ if (le(d)) {
175
+ for (c = 0; c < d.length; c++)
176
+ w(d[c]);
177
+ Object.freeze && Object.freeze(d);
178
+ } else
179
+ console.error(
180
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
181
+ );
182
+ else w(d);
183
+ if ($.call(o, "key")) {
184
+ d = t(e);
185
+ var S = Object.keys(o).filter(function(ie) {
186
+ return ie !== "key";
187
+ });
188
+ c = 0 < S.length ? "{key: someKey, " + S.join(": ..., ") + ": ...}" : "{key: someKey}", U[d + c] || (S = 0 < S.length ? "{" + S.join(": ..., ") + ": ...}" : "{}", console.error(
189
+ `A props object containing a "key" prop is being spread into JSX:
190
+ let props = %s;
191
+ <%s {...props} />
192
+ React keys must be passed directly to JSX without using spread:
193
+ let props = %s;
194
+ <%s key={someKey} {...props} />`,
195
+ c,
196
+ d,
197
+ S,
198
+ d
199
+ ), U[d + c] = !0);
200
+ }
201
+ if (d = null, i !== void 0 && (r(i), d = "" + i), b(o) && (r(o.key), d = "" + o.key), "key" in o) {
202
+ i = {};
203
+ for (var L in o)
204
+ L !== "key" && (i[L] = o[L]);
205
+ } else i = o;
206
+ return d && m(
207
+ i,
208
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
209
+ ), u(
210
+ e,
211
+ d,
212
+ i,
213
+ s(),
214
+ P,
215
+ z
216
+ );
217
+ }
218
+ function w(e) {
219
+ x(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === F && (e._payload.status === "fulfilled" ? x(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
220
+ }
221
+ function x(e) {
222
+ return typeof e == "object" && e !== null && e.$$typeof === _;
223
+ }
224
+ var g = ue, _ = /* @__PURE__ */ Symbol.for("react.transitional.element"), k = /* @__PURE__ */ Symbol.for("react.portal"), E = /* @__PURE__ */ Symbol.for("react.fragment"), h = /* @__PURE__ */ Symbol.for("react.strict_mode"), T = /* @__PURE__ */ Symbol.for("react.profiler"), N = /* @__PURE__ */ Symbol.for("react.consumer"), A = /* @__PURE__ */ Symbol.for("react.context"), te = /* @__PURE__ */ Symbol.for("react.forward_ref"), re = /* @__PURE__ */ Symbol.for("react.suspense"), ne = /* @__PURE__ */ Symbol.for("react.suspense_list"), ae = /* @__PURE__ */ Symbol.for("react.memo"), F = /* @__PURE__ */ Symbol.for("react.lazy"), oe = /* @__PURE__ */ Symbol.for("react.activity"), se = /* @__PURE__ */ Symbol.for("react.client.reference"), D = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, $ = Object.prototype.hasOwnProperty, le = Array.isArray, Y = console.createTask ? console.createTask : function() {
225
+ return null;
226
+ };
227
+ g = {
228
+ react_stack_bottom_frame: function(e) {
229
+ return e();
230
+ }
231
+ };
232
+ var M, G = {}, W = g.react_stack_bottom_frame.bind(
233
+ g,
234
+ l
235
+ )(), B = Y(a(l)), U = {};
236
+ C.Fragment = E, C.jsx = function(e, o, i) {
237
+ var c = 1e4 > D.recentlyCreatedOwnerStacks++;
238
+ return p(
239
+ e,
240
+ o,
241
+ i,
242
+ !1,
243
+ c ? Error("react-stack-top-frame") : W,
244
+ c ? Y(a(e)) : B
245
+ );
246
+ }, C.jsxs = function(e, o, i) {
247
+ var c = 1e4 > D.recentlyCreatedOwnerStacks++;
248
+ return p(
249
+ e,
250
+ o,
251
+ i,
252
+ !0,
253
+ c ? Error("react-stack-top-frame") : W,
254
+ c ? Y(a(e)) : B
255
+ );
256
+ };
257
+ })()), C;
258
+ }
259
+ var X;
260
+ function me() {
261
+ return X || (X = 1, process.env.NODE_ENV === "production" ? V.exports = de() : V.exports = fe()), V.exports;
262
+ }
263
+ var f = me();
264
+ function Q(t) {
265
+ var n, r, a = "";
266
+ if (typeof t == "string" || typeof t == "number") a += t;
267
+ else if (typeof t == "object") if (Array.isArray(t)) {
268
+ var s = t.length;
269
+ for (n = 0; n < s; n++) t[n] && (r = Q(t[n])) && (a && (a += " "), a += r);
270
+ } else for (r in t) t[r] && (a && (a += " "), a += r);
271
+ return a;
272
+ }
273
+ function j() {
274
+ for (var t, n, r = 0, a = "", s = arguments.length; r < s; r++) (t = arguments[r]) && (n = Q(t)) && (a && (a += " "), a += n);
275
+ return a;
276
+ }
277
+ const Z = (t) => typeof t == "boolean" ? `${t}` : t === 0 ? "0" : t, H = j, R = (t, n) => (r) => {
278
+ var a;
279
+ if (n?.variants == null) return H(t, r?.class, r?.className);
280
+ const { variants: s, defaultVariants: l } = n, b = Object.keys(s).map((u) => {
281
+ const p = r?.[u], w = l?.[u];
282
+ if (p === null) return null;
283
+ const x = Z(p) || Z(w);
284
+ return s[u][x];
285
+ }), m = r && Object.entries(r).reduce((u, p) => {
286
+ let [w, x] = p;
287
+ return x === void 0 || (u[w] = x), u;
288
+ }, {}), v = n == null || (a = n.compoundVariants) === null || a === void 0 ? void 0 : a.reduce((u, p) => {
289
+ let { class: w, className: x, ...g } = p;
290
+ return Object.entries(g).every((_) => {
291
+ let [k, E] = _;
292
+ return Array.isArray(E) ? E.includes({
293
+ ...l,
294
+ ...m
295
+ }[k]) : {
296
+ ...l,
297
+ ...m
298
+ }[k] === E;
299
+ }) ? [
300
+ ...u,
301
+ w,
302
+ x
303
+ ] : u;
304
+ }, []);
305
+ return H(t, b, v, r?.class, r?.className);
306
+ }, pe = R(["inline-flex items-center justify-center font-medium", "transition-colors duration-150", "focus-visible:outline-none", "disabled:cursor-not-allowed"], {
307
+ variants: {
308
+ size: {
309
+ sm: "h-[36px] px-4 gap-1 rounded-lg text-sm",
310
+ md: "h-[44px] px-4 gap-2 rounded-lg text-sm",
311
+ lg: "h-[52px] px-5 gap-2 rounded-[10px] text-base",
312
+ xl: "h-[60px] px-6 gap-2 rounded-[10px] text-base",
313
+ "2xl": "h-[68px] px-6 gap-2 rounded-[10px] text-lg"
314
+ },
315
+ tone: {
316
+ primary: ""
317
+ },
318
+ variant: {
319
+ solid: [
320
+ "bg-primary-500 text-white",
321
+ "hover:bg-primary-800",
322
+ "focus-visible:ring-2 focus-visible:ring-primary-400",
323
+ "focus-visible:ring-offset-2 focus-visible:ring-offset-white",
324
+ "disabled:bg-light-100 disabled:text-light-400"
325
+ ]
326
+ }
327
+ },
328
+ defaultVariants: {
329
+ size: "md",
330
+ tone: "primary",
331
+ variant: "solid"
332
+ }
333
+ }), be = ({ children: t, className: n, tone: r, variant: a, size: s, ...l }) => /* @__PURE__ */ f.jsx("button", { className: j(pe({ tone: r, variant: a, size: s }), n), ...l, children: t }), he = ({ children: t }) => /* @__PURE__ */ f.jsx("span", { className: "flex items-center", children: t }), ve = ({ children: t }) => /* @__PURE__ */ f.jsx("span", { className: "whitespace-nowrap", children: t }), K = be;
334
+ K.Icon = he;
335
+ K.Text = ve;
336
+ const xe = R(
337
+ [
338
+ "inline-flex items-center justify-center",
339
+ "border-2 transition-colors duration-150",
340
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400"
341
+ ],
342
+ {
343
+ variants: {
344
+ size: {
345
+ sm: "h-5 w-5 rounded-[4px]",
346
+ md: "h-6 w-6 rounded-[6px]",
347
+ lg: "h-8 w-8 rounded-[8px]"
348
+ },
349
+ checked: {
350
+ true: "",
351
+ false: ""
352
+ },
353
+ disabled: {
354
+ true: "cursor-not-allowed",
355
+ false: "cursor-pointer"
356
+ }
357
+ },
358
+ compoundVariants: [
359
+ {
360
+ checked: !1,
361
+ disabled: !1,
362
+ className: "bg-white border-[#D0D5DD]"
363
+ },
364
+ {
365
+ checked: !0,
366
+ disabled: !1,
367
+ className: "bg-primary-500 border-primary-500 text-white"
368
+ },
369
+ {
370
+ disabled: !0,
371
+ className: "bg-[#F2F4F7] border-[#E4E7EC] text-white"
372
+ }
373
+ ],
374
+ defaultVariants: {
375
+ size: "md",
376
+ checked: !1,
377
+ disabled: !1
378
+ }
379
+ }
380
+ ), ge = {
381
+ sm: { width: 12, height: 9 },
382
+ md: { width: 14, height: 10 },
383
+ lg: { width: 18, height: 14 }
384
+ }, we = y.forwardRef(
385
+ ({
386
+ id: t,
387
+ checked: n,
388
+ indeterminate: r = !1,
389
+ disabled: a,
390
+ size: s = "md",
391
+ onCheckedChange: l,
392
+ className: b
393
+ }, m) => {
394
+ const v = () => {
395
+ a || l?.(!n);
396
+ }, u = ge[s], p = a ? "text-white/80" : "text-current";
397
+ return /* @__PURE__ */ f.jsxs(
398
+ "button",
399
+ {
400
+ id: t,
401
+ ref: m,
402
+ type: "button",
403
+ role: "checkbox",
404
+ "aria-checked": r ? "mixed" : n,
405
+ disabled: a,
406
+ onClick: v,
407
+ className: j(
408
+ xe({ size: s, checked: n, disabled: a }),
409
+ b
410
+ ),
411
+ children: [
412
+ n && !r && /* @__PURE__ */ f.jsx(
413
+ "svg",
414
+ {
415
+ width: u.width,
416
+ height: u.height,
417
+ viewBox: "0 0 14 10",
418
+ fill: "none",
419
+ className: p,
420
+ children: /* @__PURE__ */ f.jsx(
421
+ "path",
422
+ {
423
+ d: "M1 5L5 9L13 1",
424
+ stroke: "currentColor",
425
+ strokeWidth: "2",
426
+ strokeLinecap: "round",
427
+ strokeLinejoin: "round"
428
+ }
429
+ )
430
+ }
431
+ ),
432
+ r && /* @__PURE__ */ f.jsx(
433
+ "span",
434
+ {
435
+ className: j(
436
+ p,
437
+ "bg-current rounded-sm",
438
+ s === "sm" && "h-0.5 w-3",
439
+ s === "md" && "h-0.5 w-4",
440
+ s === "lg" && "h-0.5 w-5"
441
+ )
442
+ }
443
+ )
444
+ ]
445
+ }
446
+ );
447
+ }
448
+ );
449
+ we.displayName = "Checkbox";
450
+ const ee = y.createContext(null), Pe = ({
451
+ value: t,
452
+ defaultValue: n,
453
+ onValueChange: r,
454
+ children: a,
455
+ className: s
456
+ }) => {
457
+ const [l, b] = y.useState(n), m = t ?? l, v = (u) => {
458
+ b(u), r?.(u);
459
+ };
460
+ return /* @__PURE__ */ f.jsx(
461
+ ee.Provider,
462
+ {
463
+ value: { value: m, onValueChange: v },
464
+ children: /* @__PURE__ */ f.jsx("div", { role: "radiogroup", className: s, children: a })
465
+ }
466
+ );
467
+ }, ye = () => {
468
+ const t = y.useContext(ee);
469
+ if (!t)
470
+ throw new Error("RadioGroupItem must be used within RadioGroup");
471
+ return t;
472
+ }, Ee = R(
473
+ [
474
+ "relative inline-flex items-center justify-center",
475
+ "border-2 rounded-full transition-colors duration-150",
476
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400"
477
+ ],
478
+ {
479
+ variants: {
480
+ size: {
481
+ sm: "h-5 w-5",
482
+ md: "h-6 w-6",
483
+ lg: "h-8 w-8"
484
+ },
485
+ checked: {
486
+ true: "",
487
+ false: ""
488
+ },
489
+ disabled: {
490
+ true: "cursor-not-allowed",
491
+ false: "cursor-pointer"
492
+ }
493
+ },
494
+ compoundVariants: [
495
+ {
496
+ checked: !1,
497
+ disabled: !1,
498
+ className: "border-[#D0D5DD] bg-white"
499
+ },
500
+ {
501
+ checked: !0,
502
+ disabled: !1,
503
+ className: "border-primary-500 bg-primary-500"
504
+ },
505
+ {
506
+ disabled: !0,
507
+ className: "border-[#E4E7EC] bg-[#F2F4F7]"
508
+ }
509
+ ],
510
+ defaultVariants: {
511
+ size: "md",
512
+ checked: !1,
513
+ disabled: !1
514
+ }
515
+ }
516
+ ), Re = R(
517
+ ["rounded-full bg-white transition-all"],
518
+ {
519
+ variants: {
520
+ size: {
521
+ sm: "h-2 w-2",
522
+ md: "h-2.5 w-2.5",
523
+ lg: "h-3 w-3"
524
+ },
525
+ checked: {
526
+ true: "scale-100",
527
+ false: "scale-0"
528
+ }
529
+ },
530
+ defaultVariants: {
531
+ size: "md",
532
+ checked: !1
533
+ }
534
+ }
535
+ ), _e = y.forwardRef(({ id: t, value: n, disabled: r, size: a = "md", className: s }, l) => {
536
+ const { value: b, onValueChange: m } = ye(), v = b === n;
537
+ return /* @__PURE__ */ f.jsx(
538
+ "button",
539
+ {
540
+ ref: l,
541
+ id: t,
542
+ type: "button",
543
+ role: "radio",
544
+ "aria-checked": v,
545
+ disabled: r,
546
+ onClick: () => {
547
+ r || m?.(n);
548
+ },
549
+ className: j(
550
+ Ee({ size: a, checked: v, disabled: r }),
551
+ s
552
+ ),
553
+ children: /* @__PURE__ */ f.jsx(
554
+ "span",
555
+ {
556
+ className: Re({
557
+ size: a,
558
+ checked: v
559
+ })
560
+ }
561
+ )
562
+ }
563
+ );
564
+ });
565
+ _e.displayName = "RadioGroupItem";
566
+ const ke = R(
567
+ "relative inline-flex shrink-0 cursor-pointer rounded-full transition-colors duration-200 focus-visible:outline-none",
568
+ {
569
+ variants: {
570
+ size: {
571
+ sm: "h-6 w-10",
572
+ md: "h-8 w-14",
573
+ lg: "h-10 w-[72px]"
574
+ },
575
+ checked: {
576
+ true: "bg-primary-500",
577
+ false: "bg-[#e4e7ec]"
578
+ },
579
+ disabled: {
580
+ true: "cursor-not-allowed opacity-60"
581
+ }
582
+ },
583
+ defaultVariants: {
584
+ size: "md",
585
+ checked: !1
586
+ }
587
+ }
588
+ ), Te = R(
589
+ "absolute top-1 left-1 rounded-full bg-white transition-transform duration-200 shadow",
590
+ {
591
+ variants: {
592
+ size: {
593
+ sm: "h-4 w-4",
594
+ md: "h-6 w-6",
595
+ lg: "h-8 w-8"
596
+ },
597
+ checked: {
598
+ true: "",
599
+ false: ""
600
+ }
601
+ },
602
+ compoundVariants: [
603
+ {
604
+ size: "sm",
605
+ checked: !0,
606
+ className: "translate-x-4"
607
+ },
608
+ {
609
+ size: "md",
610
+ checked: !0,
611
+ className: "translate-x-6"
612
+ },
613
+ {
614
+ size: "lg",
615
+ checked: !0,
616
+ className: "translate-x-8"
617
+ }
618
+ ],
619
+ defaultVariants: {
620
+ size: "md",
621
+ checked: !1
622
+ }
623
+ }
624
+ ), Ne = y.forwardRef(
625
+ ({
626
+ checked: t = !1,
627
+ size: n = "md",
628
+ disabled: r,
629
+ onCheckedChange: a,
630
+ className: s
631
+ }, l) => /* @__PURE__ */ f.jsx(
632
+ "button",
633
+ {
634
+ ref: l,
635
+ type: "button",
636
+ role: "switch",
637
+ "aria-checked": t,
638
+ disabled: r,
639
+ onClick: () => {
640
+ r || a?.(!t);
641
+ },
642
+ className: j(
643
+ ke({ size: n, checked: t, disabled: r }),
644
+ s
645
+ ),
646
+ children: /* @__PURE__ */ f.jsx(
647
+ "span",
648
+ {
649
+ className: Te({
650
+ size: n,
651
+ checked: t
652
+ })
653
+ }
654
+ )
655
+ }
656
+ )
657
+ );
658
+ Ne.displayName = "Toggle";
659
+ const je = R(
660
+ [
661
+ "relative rounded-xl px-4 py-2 text-sm text-white",
662
+ "bg-[#020b1c]",
663
+ "shadow-[0_10px_30px_rgba(2,8,23,0.25)]",
664
+ "pointer-events-none",
665
+ "select-none"
666
+ ],
667
+ {
668
+ variants: {
669
+ side: {
670
+ top: "",
671
+ bottom: "",
672
+ left: "",
673
+ right: ""
674
+ }
675
+ },
676
+ defaultVariants: {
677
+ side: "top"
678
+ }
679
+ }
680
+ ), Se = R(
681
+ [
682
+ "absolute w-2 h-2 rotate-45",
683
+ "bg-[#020b1c]"
684
+ ],
685
+ {
686
+ variants: {
687
+ side: {
688
+ top: "bottom-[-4px] left-1/2 -translate-x-1/2",
689
+ bottom: "top-[-4px] left-1/2 -translate-x-1/2",
690
+ left: "right-[-4px] top-1/2 -translate-y-1/2",
691
+ right: "left-[-4px] top-1/2 -translate-y-1/2"
692
+ }
693
+ },
694
+ defaultVariants: {
695
+ side: "top"
696
+ }
697
+ }
698
+ ), I = 12, Oe = ({
699
+ content: t,
700
+ side: n = "top",
701
+ open: r,
702
+ defaultOpen: a = !1,
703
+ disabled: s = !1,
704
+ delay: l = 0,
705
+ className: b,
706
+ children: m
707
+ }) => {
708
+ const [v, u] = y.useState(a), [p, w] = y.useState(null), x = y.useRef(null), g = y.useRef(null), _ = () => {
709
+ if (s || !x.current) return;
710
+ const h = x.current.getBoundingClientRect();
711
+ let T = 0, N = 0;
712
+ switch (n) {
713
+ case "top":
714
+ T = h.top - I, N = h.left + h.width / 2;
715
+ break;
716
+ case "bottom":
717
+ T = h.bottom + I, N = h.left + h.width / 2;
718
+ break;
719
+ case "left":
720
+ T = h.top + h.height / 2, N = h.left - I;
721
+ break;
722
+ case "right":
723
+ T = h.top + h.height / 2, N = h.right + I;
724
+ break;
725
+ }
726
+ const A = () => {
727
+ w({ top: T, left: N }), u(!0);
728
+ };
729
+ l > 0 ? g.current = window.setTimeout(A, l) : A();
730
+ }, k = () => {
731
+ g.current && (clearTimeout(g.current), g.current = null), u(!1);
732
+ }, E = r ?? v;
733
+ return /* @__PURE__ */ f.jsxs(f.Fragment, { children: [
734
+ /* @__PURE__ */ f.jsx(
735
+ "span",
736
+ {
737
+ ref: x,
738
+ className: "inline-flex",
739
+ onMouseEnter: _,
740
+ onMouseLeave: k,
741
+ onFocus: _,
742
+ onBlur: k,
743
+ tabIndex: 0,
744
+ children: m
745
+ }
746
+ ),
747
+ E && p && ce(
748
+ /* @__PURE__ */ f.jsx(
749
+ "div",
750
+ {
751
+ role: "tooltip",
752
+ className: "fixed z-[9999] pointer-events-none",
753
+ style: {
754
+ top: p.top,
755
+ left: p.left,
756
+ transform: n === "top" ? "translate(-50%, -100%)" : n === "bottom" ? "translate(-50%, 0)" : n === "left" ? "translate(-100%, -50%)" : "translate(0, -50%)"
757
+ },
758
+ children: /* @__PURE__ */ f.jsxs(
759
+ "div",
760
+ {
761
+ className: j(
762
+ je({ side: n }),
763
+ b
764
+ ),
765
+ children: [
766
+ t,
767
+ /* @__PURE__ */ f.jsx("span", { className: Se({ side: n }) })
768
+ ]
769
+ }
770
+ )
771
+ }
772
+ ),
773
+ document.body
774
+ )
775
+ ] });
776
+ };
777
+ Oe.displayName = "Tooltip";
778
+ export {
779
+ K as Button,
780
+ we as Checkbox,
781
+ Pe as RadioGroup,
782
+ _e as RadioGroupItem,
783
+ Ne as Toggle,
784
+ Oe as Tooltip
785
+ };
package/dist/index.umd.js CHANGED
@@ -1 +1,6 @@
1
- (function(n){typeof define=="function"&&define.amd?define(n):n()})((function(){"use strict"}));
1
+ (function(v,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],O):(v=typeof globalThis<"u"?globalThis:v||self,O(v.CekatUI={},v.React,v.reactDom))})(this,(function(v,O,le){"use strict";function ie(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const y=ie(O);var V={exports:{}},P={};var W;function ue(){if(W)return P;W=1;var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(o,s,l){var p=null;if(l!==void 0&&(p=""+l),s.key!==void 0&&(p=""+s.key),"key"in s){l={};for(var m in s)m!=="key"&&(l[m]=s[m])}else l=s;return s=l.ref,{$$typeof:t,type:o,key:p,ref:s!==void 0?s:null,props:l}}return P.Fragment=n,P.jsx=r,P.jsxs=r,P}var A={};var B;function ce(){return B||(B=1,process.env.NODE_ENV!=="production"&&(function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case N:return"Profiler";case h:return"StrictMode";case je:return"Suspense";case Ne:return"SuspenseList";case Oe:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case j:return"Portal";case D:return e.displayName||"Context";case S:return(e._context.displayName||"Context")+".Consumer";case Te:var a=e.render;return e=e.displayName,e||(e=a.displayName||a.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Se:return a=e.displayName||null,a!==null?a:t(e.type)||"Memo";case z:a=e._payload,e=e._init;try{return t(e(a))}catch{}}return null}function n(e){return""+e}function r(e){try{n(e);var a=!1}catch{a=!0}if(a){a=console;var i=a.error,d=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i.call(a,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",d),n(e)}}function o(e){if(e===E)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===z)return"<...>";try{var a=t(e);return a?"<"+a+">":"<...>"}catch{return"<...>"}}function s(){var e=$.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function p(e){if(te.call(e,"key")){var a=Object.getOwnPropertyDescriptor(e,"key").get;if(a&&a.isReactWarning)return!1}return e.key!==void 0}function m(e,a){function i(){re||(re=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",a))}i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}function x(){var e=t(this.type);return ne[e]||(ne[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function u(e,a,i,d,F,M){var f=i.ref;return e={$$typeof:T,type:e,key:a,props:i,_owner:d},(f!==void 0?f:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:x}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:F}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function b(e,a,i,d,F,M){var f=a.children;if(f!==void 0)if(d)if(Pe(f)){for(d=0;d<f.length;d++)k(f[d]);Object.freeze&&Object.freeze(f)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else k(f);if(te.call(a,"key")){f=t(e);var C=Object.keys(a).filter(function(Ae){return Ae!=="key"});d=0<C.length?"{key: someKey, "+C.join(": ..., ")+": ...}":"{key: someKey}",se[f+d]||(C=0<C.length?"{"+C.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
+ let props = %s;
3
+ <%s {...props} />
4
+ React keys must be passed directly to JSX without using spread:
5
+ let props = %s;
6
+ <%s key={someKey} {...props} />`,d,f,C,f),se[f+d]=!0)}if(f=null,i!==void 0&&(r(i),f=""+i),p(a)&&(r(a.key),f=""+a.key),"key"in a){i={};for(var G in a)G!=="key"&&(i[G]=a[G])}else i=a;return f&&m(i,typeof e=="function"?e.displayName||e.name||"Unknown":e),u(e,f,i,s(),F,M)}function k(e){g(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===z&&(e._payload.status==="fulfilled"?g(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function g(e){return typeof e=="object"&&e!==null&&e.$$typeof===T}var w=O,T=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),D=Symbol.for("react.context"),Te=Symbol.for("react.forward_ref"),je=Symbol.for("react.suspense"),Ne=Symbol.for("react.suspense_list"),Se=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),Oe=Symbol.for("react.activity"),Ce=Symbol.for("react.client.reference"),$=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=Object.prototype.hasOwnProperty,Pe=Array.isArray,L=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(e){return e()}};var re,ne={},oe=w.react_stack_bottom_frame.bind(w,l)(),ae=L(o(l)),se={};A.Fragment=E,A.jsx=function(e,a,i){var d=1e4>$.recentlyCreatedOwnerStacks++;return b(e,a,i,!1,d?Error("react-stack-top-frame"):oe,d?L(o(e)):ae)},A.jsxs=function(e,a,i){var d=1e4>$.recentlyCreatedOwnerStacks++;return b(e,a,i,!0,d?Error("react-stack-top-frame"):oe,d?L(o(e)):ae)}})()),A}var U;function de(){return U||(U=1,process.env.NODE_ENV==="production"?V.exports=ue():V.exports=ce()),V.exports}var c=de();function q(t){var n,r,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(n=0;n<s;n++)t[n]&&(r=q(t[n]))&&(o&&(o+=" "),o+=r)}else for(r in t)t[r]&&(o&&(o+=" "),o+=r);return o}function _(){for(var t,n,r=0,o="",s=arguments.length;r<s;r++)(t=arguments[r])&&(n=q(t))&&(o&&(o+=" "),o+=n);return o}const J=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,X=_,R=(t,n)=>r=>{var o;if(n?.variants==null)return X(t,r?.class,r?.className);const{variants:s,defaultVariants:l}=n,p=Object.keys(s).map(u=>{const b=r?.[u],k=l?.[u];if(b===null)return null;const g=J(b)||J(k);return s[u][g]}),m=r&&Object.entries(r).reduce((u,b)=>{let[k,g]=b;return g===void 0||(u[k]=g),u},{}),x=n==null||(o=n.compoundVariants)===null||o===void 0?void 0:o.reduce((u,b)=>{let{class:k,className:g,...w}=b;return Object.entries(w).every(T=>{let[j,E]=T;return Array.isArray(E)?E.includes({...l,...m}[j]):{...l,...m}[j]===E})?[...u,k,g]:u},[]);return X(t,p,x,r?.class,r?.className)},fe=R(["inline-flex items-center justify-center font-medium","transition-colors duration-150","focus-visible:outline-none","disabled:cursor-not-allowed"],{variants:{size:{sm:"h-[36px] px-4 gap-1 rounded-lg text-sm",md:"h-[44px] px-4 gap-2 rounded-lg text-sm",lg:"h-[52px] px-5 gap-2 rounded-[10px] text-base",xl:"h-[60px] px-6 gap-2 rounded-[10px] text-base","2xl":"h-[68px] px-6 gap-2 rounded-[10px] text-lg"},tone:{primary:""},variant:{solid:["bg-primary-500 text-white","hover:bg-primary-800","focus-visible:ring-2 focus-visible:ring-primary-400","focus-visible:ring-offset-2 focus-visible:ring-offset-white","disabled:bg-light-100 disabled:text-light-400"]}},defaultVariants:{size:"md",tone:"primary",variant:"solid"}}),me=({children:t,className:n,tone:r,variant:o,size:s,...l})=>c.jsx("button",{className:_(fe({tone:r,variant:o,size:s}),n),...l,children:t}),be=({children:t})=>c.jsx("span",{className:"flex items-center",children:t}),pe=({children:t})=>c.jsx("span",{className:"whitespace-nowrap",children:t}),Y=me;Y.Icon=be,Y.Text=pe;const he=R(["inline-flex items-center justify-center","border-2 transition-colors duration-150","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400"],{variants:{size:{sm:"h-5 w-5 rounded-[4px]",md:"h-6 w-6 rounded-[6px]",lg:"h-8 w-8 rounded-[8px]"},checked:{true:"",false:""},disabled:{true:"cursor-not-allowed",false:"cursor-pointer"}},compoundVariants:[{checked:!1,disabled:!1,className:"bg-white border-[#D0D5DD]"},{checked:!0,disabled:!1,className:"bg-primary-500 border-primary-500 text-white"},{disabled:!0,className:"bg-[#F2F4F7] border-[#E4E7EC] text-white"}],defaultVariants:{size:"md",checked:!1,disabled:!1}}),ve={sm:{width:12,height:9},md:{width:14,height:10},lg:{width:18,height:14}},Z=y.forwardRef(({id:t,checked:n,indeterminate:r=!1,disabled:o,size:s="md",onCheckedChange:l,className:p},m)=>{const x=()=>{o||l?.(!n)},u=ve[s],b=o?"text-white/80":"text-current";return c.jsxs("button",{id:t,ref:m,type:"button",role:"checkbox","aria-checked":r?"mixed":n,disabled:o,onClick:x,className:_(he({size:s,checked:n,disabled:o}),p),children:[n&&!r&&c.jsx("svg",{width:u.width,height:u.height,viewBox:"0 0 14 10",fill:"none",className:b,children:c.jsx("path",{d:"M1 5L5 9L13 1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),r&&c.jsx("span",{className:_(b,"bg-current rounded-sm",s==="sm"&&"h-0.5 w-3",s==="md"&&"h-0.5 w-4",s==="lg"&&"h-0.5 w-5")})]})});Z.displayName="Checkbox";const H=y.createContext(null),xe=({value:t,defaultValue:n,onValueChange:r,children:o,className:s})=>{const[l,p]=y.useState(n),m=t??l,x=u=>{p(u),r?.(u)};return c.jsx(H.Provider,{value:{value:m,onValueChange:x},children:c.jsx("div",{role:"radiogroup",className:s,children:o})})},ge=()=>{const t=y.useContext(H);if(!t)throw new Error("RadioGroupItem must be used within RadioGroup");return t},we=R(["relative inline-flex items-center justify-center","border-2 rounded-full transition-colors duration-150","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-400"],{variants:{size:{sm:"h-5 w-5",md:"h-6 w-6",lg:"h-8 w-8"},checked:{true:"",false:""},disabled:{true:"cursor-not-allowed",false:"cursor-pointer"}},compoundVariants:[{checked:!1,disabled:!1,className:"border-[#D0D5DD] bg-white"},{checked:!0,disabled:!1,className:"border-primary-500 bg-primary-500"},{disabled:!0,className:"border-[#E4E7EC] bg-[#F2F4F7]"}],defaultVariants:{size:"md",checked:!1,disabled:!1}}),ye=R(["rounded-full bg-white transition-all"],{variants:{size:{sm:"h-2 w-2",md:"h-2.5 w-2.5",lg:"h-3 w-3"},checked:{true:"scale-100",false:"scale-0"}},defaultVariants:{size:"md",checked:!1}}),Q=y.forwardRef(({id:t,value:n,disabled:r,size:o="md",className:s},l)=>{const{value:p,onValueChange:m}=ge(),x=p===n;return c.jsx("button",{ref:l,id:t,type:"button",role:"radio","aria-checked":x,disabled:r,onClick:()=>{r||m?.(n)},className:_(we({size:o,checked:x,disabled:r}),s),children:c.jsx("span",{className:ye({size:o,checked:x})})})});Q.displayName="RadioGroupItem";const ke=R("relative inline-flex shrink-0 cursor-pointer rounded-full transition-colors duration-200 focus-visible:outline-none",{variants:{size:{sm:"h-6 w-10",md:"h-8 w-14",lg:"h-10 w-[72px]"},checked:{true:"bg-primary-500",false:"bg-[#e4e7ec]"},disabled:{true:"cursor-not-allowed opacity-60"}},defaultVariants:{size:"md",checked:!1}}),Ee=R("absolute top-1 left-1 rounded-full bg-white transition-transform duration-200 shadow",{variants:{size:{sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"},checked:{true:"",false:""}},compoundVariants:[{size:"sm",checked:!0,className:"translate-x-4"},{size:"md",checked:!0,className:"translate-x-6"},{size:"lg",checked:!0,className:"translate-x-8"}],defaultVariants:{size:"md",checked:!1}}),K=y.forwardRef(({checked:t=!1,size:n="md",disabled:r,onCheckedChange:o,className:s},l)=>c.jsx("button",{ref:l,type:"button",role:"switch","aria-checked":t,disabled:r,onClick:()=>{r||o?.(!t)},className:_(ke({size:n,checked:t,disabled:r}),s),children:c.jsx("span",{className:Ee({size:n,checked:t})})}));K.displayName="Toggle";const Re=R(["relative rounded-xl px-4 py-2 text-sm text-white","bg-[#020b1c]","shadow-[0_10px_30px_rgba(2,8,23,0.25)]","pointer-events-none","select-none"],{variants:{side:{top:"",bottom:"",left:"",right:""}},defaultVariants:{side:"top"}}),_e=R(["absolute w-2 h-2 rotate-45","bg-[#020b1c]"],{variants:{side:{top:"bottom-[-4px] left-1/2 -translate-x-1/2",bottom:"top-[-4px] left-1/2 -translate-x-1/2",left:"right-[-4px] top-1/2 -translate-y-1/2",right:"left-[-4px] top-1/2 -translate-y-1/2"}},defaultVariants:{side:"top"}}),I=12,ee=({content:t,side:n="top",open:r,defaultOpen:o=!1,disabled:s=!1,delay:l=0,className:p,children:m})=>{const[x,u]=y.useState(o),[b,k]=y.useState(null),g=y.useRef(null),w=y.useRef(null),T=()=>{if(s||!g.current)return;const h=g.current.getBoundingClientRect();let N=0,S=0;switch(n){case"top":N=h.top-I,S=h.left+h.width/2;break;case"bottom":N=h.bottom+I,S=h.left+h.width/2;break;case"left":N=h.top+h.height/2,S=h.left-I;break;case"right":N=h.top+h.height/2,S=h.right+I;break}const D=()=>{k({top:N,left:S}),u(!0)};l>0?w.current=window.setTimeout(D,l):D()},j=()=>{w.current&&(clearTimeout(w.current),w.current=null),u(!1)},E=r??x;return c.jsxs(c.Fragment,{children:[c.jsx("span",{ref:g,className:"inline-flex",onMouseEnter:T,onMouseLeave:j,onFocus:T,onBlur:j,tabIndex:0,children:m}),E&&b&&le.createPortal(c.jsx("div",{role:"tooltip",className:"fixed z-[9999] pointer-events-none",style:{top:b.top,left:b.left,transform:n==="top"?"translate(-50%, -100%)":n==="bottom"?"translate(-50%, 0)":n==="left"?"translate(-100%, -50%)":"translate(0, -50%)"},children:c.jsxs("div",{className:_(Re({side:n}),p),children:[t,c.jsx("span",{className:_e({side:n})})]})}),document.body)]})};ee.displayName="Tooltip",v.Button=Y,v.Checkbox=Z,v.RadioGroup=xe,v.RadioGroupItem=Q,v.Toggle=K,v.Tooltip=ee,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cekat-ui",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Cekat UI Component Library",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.es.js",