@starasia/tabs 1.0.0

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 ADDED
@@ -0,0 +1,89 @@
1
+ # starasia tabs
2
+
3
+ starasia tabs is a strict and customizable tabs component for web development projects, designed for simplicity and adherence to strict design guidelines.
4
+
5
+ ## Screenshots
6
+
7
+ ![App Screenshot](https://github.com/primaramadhaniputra/image/blob/main/ITabs.png)
8
+
9
+ ## Package installation
10
+
11
+ Instal package using pnpm
12
+
13
+ ```bash
14
+ pnpm add @starasia/tabs
15
+ ```
16
+
17
+ Instal package using yarn
18
+
19
+ ```bash
20
+ yarn add @starasia/tabs
21
+ ```
22
+
23
+ Instal package using npm
24
+
25
+ ```bash
26
+ npm i @starasia/tabs
27
+ ```
28
+
29
+ ## Usage/Examples
30
+
31
+ ```javascript
32
+ import React, {useState} from "react";
33
+ import ReactDOM from "react-dom/client";
34
+ import {Tabs, TabsLists, Tab, TabPanels, TabPanel} from "@starasia/tabs";
35
+
36
+ const App = () => (
37
+ <div style={{display: "flex", justifyContent: "center"}}>
38
+ <Tabs activeTab={2}>
39
+ <TabsLists>
40
+ <Tab onClick={() => alert("oke")}>one</Tab>
41
+ <Tab>two</Tab>
42
+ <Tab>Three</Tab>
43
+ </TabsLists>
44
+ <TabPanels>
45
+ <TabPanel>one</TabPanel>
46
+ <TabPanel>two</TabPanel>
47
+ <TabPanel>three </TabPanel>
48
+ </TabPanels>
49
+ </Tabs>
50
+ </div>
51
+ );
52
+
53
+ ReactDOM.createRoot(document.getElementById("app")!).render(<App />);
54
+
55
+ ```
56
+
57
+ ## Props @starasia/tabs
58
+
59
+ #### Props that you can pass to <Tabs {...props} />
60
+
61
+ | Prop Name | Value | required |
62
+ | :-------- | :--------- | :------- |
63
+ | children | ReactNode | true |
64
+ | activeTab | number | false |
65
+ | onClick | () => void | false |
66
+
67
+ #### Props that you can pass to <TabsLists {...props} />
68
+
69
+ | Prop Name | Value | required |
70
+ | :-------- | :-------- | :------- |
71
+ | children | ReactNode | true |
72
+
73
+ #### Props that you can pass to <TabPanels {...props} />
74
+
75
+ | Prop Name | Value | required |
76
+ | :-------- | :-------- | :------- |
77
+ | children | ReactNode | true |
78
+
79
+ #### Props that you can pass to <Tab {...props} />
80
+
81
+ | Prop Name | Value | required |
82
+ | :-------- | :-------- | :------- |
83
+ | children | ReactNode | true |
84
+
85
+ #### Props that you can pass to <TabPanel {...props} />
86
+
87
+ | Prop Name | Value | required |
88
+ | :-------- | :-------- | :------- |
89
+ | children | ReactNode | true |
package/dist/Tabs.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { FC } from "react";
2
+ import { ITabsProps } from "./types";
3
+ export declare const Tabs: FC<ITabsProps>;
4
+ export declare const TabsLists: FC<ITabsProps>;
5
+ export declare const Tab: FC<ITabsProps>;
6
+ export declare const TabPanels: FC<ITabsProps>;
7
+ export declare const TabPanel: FC<ITabsProps>;
@@ -0,0 +1,2 @@
1
+ export { Tabs, TabsLists, Tab, TabPanels, TabPanel } from "./Tabs";
2
+ export * from "./types";
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ @import"https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600&display=swap";*{margin:0}
@@ -0,0 +1,934 @@
1
+ import Dr, { createContext as ha, useState as Y, useEffect as L, useContext as nr, useRef as ir } from "react";
2
+ var tr = { exports: {} }, B = {};
3
+ /**
4
+ * @license React
5
+ * react-jsx-runtime.production.min.js
6
+ *
7
+ * Copyright (c) Facebook, Inc. and its affiliates.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */
12
+ var jr;
13
+ function ya() {
14
+ if (jr)
15
+ return B;
16
+ jr = 1;
17
+ var g = Dr, c = Symbol.for("react.element"), t = Symbol.for("react.fragment"), u = Object.prototype.hasOwnProperty, T = g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, h = { key: !0, ref: !0, __self: !0, __source: !0 };
18
+ function y(x, f, R) {
19
+ var b, _ = {}, w = null, k = null;
20
+ R !== void 0 && (w = "" + R), f.key !== void 0 && (w = "" + f.key), f.ref !== void 0 && (k = f.ref);
21
+ for (b in f)
22
+ u.call(f, b) && !h.hasOwnProperty(b) && (_[b] = f[b]);
23
+ if (x && x.defaultProps)
24
+ for (b in f = x.defaultProps, f)
25
+ _[b] === void 0 && (_[b] = f[b]);
26
+ return { $$typeof: c, type: x, key: w, ref: k, props: _, _owner: T.current };
27
+ }
28
+ return B.Fragment = t, B.jsx = y, B.jsxs = y, B;
29
+ }
30
+ var z = {};
31
+ /**
32
+ * @license React
33
+ * react-jsx-runtime.development.js
34
+ *
35
+ * Copyright (c) Facebook, Inc. and its affiliates.
36
+ *
37
+ * This source code is licensed under the MIT license found in the
38
+ * LICENSE file in the root directory of this source tree.
39
+ */
40
+ var kr;
41
+ function ma() {
42
+ return kr || (kr = 1, process.env.NODE_ENV !== "production" && function() {
43
+ var g = Dr, c = Symbol.for("react.element"), t = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), T = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), y = Symbol.for("react.provider"), x = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), R = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), k = Symbol.for("react.offscreen"), N = Symbol.iterator, Fr = "@@iterator";
44
+ function $r(r) {
45
+ if (r === null || typeof r != "object")
46
+ return null;
47
+ var a = N && r[N] || r[Fr];
48
+ return typeof a == "function" ? a : null;
49
+ }
50
+ var A = g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
51
+ function p(r) {
52
+ {
53
+ for (var a = arguments.length, e = new Array(a > 1 ? a - 1 : 0), n = 1; n < a; n++)
54
+ e[n - 1] = arguments[n];
55
+ Ir("error", r, e);
56
+ }
57
+ }
58
+ function Ir(r, a, e) {
59
+ {
60
+ var n = A.ReactDebugCurrentFrame, o = n.getStackAddendum();
61
+ o !== "" && (a += "%s", e = e.concat([o]));
62
+ var l = e.map(function(s) {
63
+ return String(s);
64
+ });
65
+ l.unshift("Warning: " + a), Function.prototype.apply.call(console[r], console, l);
66
+ }
67
+ }
68
+ var Wr = !1, Br = !1, zr = !1, Yr = !1, Lr = !1, sr;
69
+ sr = Symbol.for("react.module.reference");
70
+ function Nr(r) {
71
+ return !!(typeof r == "string" || typeof r == "function" || r === u || r === h || Lr || r === T || r === R || r === b || Yr || r === k || Wr || Br || zr || typeof r == "object" && r !== null && (r.$$typeof === w || r.$$typeof === _ || r.$$typeof === y || r.$$typeof === x || r.$$typeof === f || // This needs to include all possible module reference object
72
+ // types supported by any Flight configuration anywhere since
73
+ // we don't know which Flight build this will end up being used
74
+ // with.
75
+ r.$$typeof === sr || r.getModuleId !== void 0));
76
+ }
77
+ function Vr(r, a, e) {
78
+ var n = r.displayName;
79
+ if (n)
80
+ return n;
81
+ var o = a.displayName || a.name || "";
82
+ return o !== "" ? e + "(" + o + ")" : e;
83
+ }
84
+ function or(r) {
85
+ return r.displayName || "Context";
86
+ }
87
+ function S(r) {
88
+ if (r == null)
89
+ return null;
90
+ if (typeof r.tag == "number" && p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof r == "function")
91
+ return r.displayName || r.name || null;
92
+ if (typeof r == "string")
93
+ return r;
94
+ switch (r) {
95
+ case u:
96
+ return "Fragment";
97
+ case t:
98
+ return "Portal";
99
+ case h:
100
+ return "Profiler";
101
+ case T:
102
+ return "StrictMode";
103
+ case R:
104
+ return "Suspense";
105
+ case b:
106
+ return "SuspenseList";
107
+ }
108
+ if (typeof r == "object")
109
+ switch (r.$$typeof) {
110
+ case x:
111
+ var a = r;
112
+ return or(a) + ".Consumer";
113
+ case y:
114
+ var e = r;
115
+ return or(e._context) + ".Provider";
116
+ case f:
117
+ return Vr(r, r.render, "ForwardRef");
118
+ case _:
119
+ var n = r.displayName || null;
120
+ return n !== null ? n : S(r.type) || "Memo";
121
+ case w: {
122
+ var o = r, l = o._payload, s = o._init;
123
+ try {
124
+ return S(s(l));
125
+ } catch {
126
+ return null;
127
+ }
128
+ }
129
+ }
130
+ return null;
131
+ }
132
+ var P = Object.assign, $ = 0, ur, lr, cr, fr, dr, vr, br;
133
+ function pr() {
134
+ }
135
+ pr.__reactDisabledLog = !0;
136
+ function Mr() {
137
+ {
138
+ if ($ === 0) {
139
+ ur = console.log, lr = console.info, cr = console.warn, fr = console.error, dr = console.group, vr = console.groupCollapsed, br = console.groupEnd;
140
+ var r = {
141
+ configurable: !0,
142
+ enumerable: !0,
143
+ value: pr,
144
+ writable: !0
145
+ };
146
+ Object.defineProperties(console, {
147
+ info: r,
148
+ log: r,
149
+ warn: r,
150
+ error: r,
151
+ group: r,
152
+ groupCollapsed: r,
153
+ groupEnd: r
154
+ });
155
+ }
156
+ $++;
157
+ }
158
+ }
159
+ function Ur() {
160
+ {
161
+ if ($--, $ === 0) {
162
+ var r = {
163
+ configurable: !0,
164
+ enumerable: !0,
165
+ writable: !0
166
+ };
167
+ Object.defineProperties(console, {
168
+ log: P({}, r, {
169
+ value: ur
170
+ }),
171
+ info: P({}, r, {
172
+ value: lr
173
+ }),
174
+ warn: P({}, r, {
175
+ value: cr
176
+ }),
177
+ error: P({}, r, {
178
+ value: fr
179
+ }),
180
+ group: P({}, r, {
181
+ value: dr
182
+ }),
183
+ groupCollapsed: P({}, r, {
184
+ value: vr
185
+ }),
186
+ groupEnd: P({}, r, {
187
+ value: br
188
+ })
189
+ });
190
+ }
191
+ $ < 0 && p("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
192
+ }
193
+ }
194
+ var K = A.ReactCurrentDispatcher, G;
195
+ function V(r, a, e) {
196
+ {
197
+ if (G === void 0)
198
+ try {
199
+ throw Error();
200
+ } catch (o) {
201
+ var n = o.stack.trim().match(/\n( *(at )?)/);
202
+ G = n && n[1] || "";
203
+ }
204
+ return `
205
+ ` + G + r;
206
+ }
207
+ }
208
+ var X = !1, M;
209
+ {
210
+ var Jr = typeof WeakMap == "function" ? WeakMap : Map;
211
+ M = new Jr();
212
+ }
213
+ function gr(r, a) {
214
+ if (!r || X)
215
+ return "";
216
+ {
217
+ var e = M.get(r);
218
+ if (e !== void 0)
219
+ return e;
220
+ }
221
+ var n;
222
+ X = !0;
223
+ var o = Error.prepareStackTrace;
224
+ Error.prepareStackTrace = void 0;
225
+ var l;
226
+ l = K.current, K.current = null, Mr();
227
+ try {
228
+ if (a) {
229
+ var s = function() {
230
+ throw Error();
231
+ };
232
+ if (Object.defineProperty(s.prototype, "props", {
233
+ set: function() {
234
+ throw Error();
235
+ }
236
+ }), typeof Reflect == "object" && Reflect.construct) {
237
+ try {
238
+ Reflect.construct(s, []);
239
+ } catch (E) {
240
+ n = E;
241
+ }
242
+ Reflect.construct(r, [], s);
243
+ } else {
244
+ try {
245
+ s.call();
246
+ } catch (E) {
247
+ n = E;
248
+ }
249
+ r.call(s.prototype);
250
+ }
251
+ } else {
252
+ try {
253
+ throw Error();
254
+ } catch (E) {
255
+ n = E;
256
+ }
257
+ r();
258
+ }
259
+ } catch (E) {
260
+ if (E && n && typeof E.stack == "string") {
261
+ for (var i = E.stack.split(`
262
+ `), m = n.stack.split(`
263
+ `), d = i.length - 1, v = m.length - 1; d >= 1 && v >= 0 && i[d] !== m[v]; )
264
+ v--;
265
+ for (; d >= 1 && v >= 0; d--, v--)
266
+ if (i[d] !== m[v]) {
267
+ if (d !== 1 || v !== 1)
268
+ do
269
+ if (d--, v--, v < 0 || i[d] !== m[v]) {
270
+ var C = `
271
+ ` + i[d].replace(" at new ", " at ");
272
+ return r.displayName && C.includes("<anonymous>") && (C = C.replace("<anonymous>", r.displayName)), typeof r == "function" && M.set(r, C), C;
273
+ }
274
+ while (d >= 1 && v >= 0);
275
+ break;
276
+ }
277
+ }
278
+ } finally {
279
+ X = !1, K.current = l, Ur(), Error.prepareStackTrace = o;
280
+ }
281
+ var F = r ? r.displayName || r.name : "", O = F ? V(F) : "";
282
+ return typeof r == "function" && M.set(r, O), O;
283
+ }
284
+ function qr(r, a, e) {
285
+ return gr(r, !1);
286
+ }
287
+ function Kr(r) {
288
+ var a = r.prototype;
289
+ return !!(a && a.isReactComponent);
290
+ }
291
+ function U(r, a, e) {
292
+ if (r == null)
293
+ return "";
294
+ if (typeof r == "function")
295
+ return gr(r, Kr(r));
296
+ if (typeof r == "string")
297
+ return V(r);
298
+ switch (r) {
299
+ case R:
300
+ return V("Suspense");
301
+ case b:
302
+ return V("SuspenseList");
303
+ }
304
+ if (typeof r == "object")
305
+ switch (r.$$typeof) {
306
+ case f:
307
+ return qr(r.render);
308
+ case _:
309
+ return U(r.type, a, e);
310
+ case w: {
311
+ var n = r, o = n._payload, l = n._init;
312
+ try {
313
+ return U(l(o), a, e);
314
+ } catch {
315
+ }
316
+ }
317
+ }
318
+ return "";
319
+ }
320
+ var I = Object.prototype.hasOwnProperty, hr = {}, yr = A.ReactDebugCurrentFrame;
321
+ function J(r) {
322
+ if (r) {
323
+ var a = r._owner, e = U(r.type, r._source, a ? a.type : null);
324
+ yr.setExtraStackFrame(e);
325
+ } else
326
+ yr.setExtraStackFrame(null);
327
+ }
328
+ function Gr(r, a, e, n, o) {
329
+ {
330
+ var l = Function.call.bind(I);
331
+ for (var s in r)
332
+ if (l(r, s)) {
333
+ var i = void 0;
334
+ try {
335
+ if (typeof r[s] != "function") {
336
+ var m = Error((n || "React class") + ": " + e + " type `" + s + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof r[s] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
337
+ throw m.name = "Invariant Violation", m;
338
+ }
339
+ i = r[s](a, s, n, e, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
340
+ } catch (d) {
341
+ i = d;
342
+ }
343
+ i && !(i instanceof Error) && (J(o), p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", e, s, typeof i), J(null)), i instanceof Error && !(i.message in hr) && (hr[i.message] = !0, J(o), p("Failed %s type: %s", e, i.message), J(null));
344
+ }
345
+ }
346
+ }
347
+ var Xr = Array.isArray;
348
+ function H(r) {
349
+ return Xr(r);
350
+ }
351
+ function Hr(r) {
352
+ {
353
+ var a = typeof Symbol == "function" && Symbol.toStringTag, e = a && r[Symbol.toStringTag] || r.constructor.name || "Object";
354
+ return e;
355
+ }
356
+ }
357
+ function Zr(r) {
358
+ try {
359
+ return mr(r), !1;
360
+ } catch {
361
+ return !0;
362
+ }
363
+ }
364
+ function mr(r) {
365
+ return "" + r;
366
+ }
367
+ function Er(r) {
368
+ if (Zr(r))
369
+ return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Hr(r)), mr(r);
370
+ }
371
+ var W = A.ReactCurrentOwner, Qr = {
372
+ key: !0,
373
+ ref: !0,
374
+ __self: !0,
375
+ __source: !0
376
+ }, Rr, _r, Z;
377
+ Z = {};
378
+ function ra(r) {
379
+ if (I.call(r, "ref")) {
380
+ var a = Object.getOwnPropertyDescriptor(r, "ref").get;
381
+ if (a && a.isReactWarning)
382
+ return !1;
383
+ }
384
+ return r.ref !== void 0;
385
+ }
386
+ function aa(r) {
387
+ if (I.call(r, "key")) {
388
+ var a = Object.getOwnPropertyDescriptor(r, "key").get;
389
+ if (a && a.isReactWarning)
390
+ return !1;
391
+ }
392
+ return r.key !== void 0;
393
+ }
394
+ function ea(r, a) {
395
+ if (typeof r.ref == "string" && W.current && a && W.current.stateNode !== a) {
396
+ var e = S(W.current.type);
397
+ Z[e] || (p('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', S(W.current.type), r.ref), Z[e] = !0);
398
+ }
399
+ }
400
+ function ta(r, a) {
401
+ {
402
+ var e = function() {
403
+ Rr || (Rr = !0, p("%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://reactjs.org/link/special-props)", a));
404
+ };
405
+ e.isReactWarning = !0, Object.defineProperty(r, "key", {
406
+ get: e,
407
+ configurable: !0
408
+ });
409
+ }
410
+ }
411
+ function na(r, a) {
412
+ {
413
+ var e = function() {
414
+ _r || (_r = !0, p("%s: `ref` 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://reactjs.org/link/special-props)", a));
415
+ };
416
+ e.isReactWarning = !0, Object.defineProperty(r, "ref", {
417
+ get: e,
418
+ configurable: !0
419
+ });
420
+ }
421
+ }
422
+ var ia = function(r, a, e, n, o, l, s) {
423
+ var i = {
424
+ // This tag allows us to uniquely identify this as a React Element
425
+ $$typeof: c,
426
+ // Built-in properties that belong on the element
427
+ type: r,
428
+ key: a,
429
+ ref: e,
430
+ props: s,
431
+ // Record the component responsible for creating this element.
432
+ _owner: l
433
+ };
434
+ return i._store = {}, Object.defineProperty(i._store, "validated", {
435
+ configurable: !1,
436
+ enumerable: !1,
437
+ writable: !0,
438
+ value: !1
439
+ }), Object.defineProperty(i, "_self", {
440
+ configurable: !1,
441
+ enumerable: !1,
442
+ writable: !1,
443
+ value: n
444
+ }), Object.defineProperty(i, "_source", {
445
+ configurable: !1,
446
+ enumerable: !1,
447
+ writable: !1,
448
+ value: o
449
+ }), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i;
450
+ };
451
+ function sa(r, a, e, n, o) {
452
+ {
453
+ var l, s = {}, i = null, m = null;
454
+ e !== void 0 && (Er(e), i = "" + e), aa(a) && (Er(a.key), i = "" + a.key), ra(a) && (m = a.ref, ea(a, o));
455
+ for (l in a)
456
+ I.call(a, l) && !Qr.hasOwnProperty(l) && (s[l] = a[l]);
457
+ if (r && r.defaultProps) {
458
+ var d = r.defaultProps;
459
+ for (l in d)
460
+ s[l] === void 0 && (s[l] = d[l]);
461
+ }
462
+ if (i || m) {
463
+ var v = typeof r == "function" ? r.displayName || r.name || "Unknown" : r;
464
+ i && ta(s, v), m && na(s, v);
465
+ }
466
+ return ia(r, i, m, o, n, W.current, s);
467
+ }
468
+ }
469
+ var Q = A.ReactCurrentOwner, Tr = A.ReactDebugCurrentFrame;
470
+ function D(r) {
471
+ if (r) {
472
+ var a = r._owner, e = U(r.type, r._source, a ? a.type : null);
473
+ Tr.setExtraStackFrame(e);
474
+ } else
475
+ Tr.setExtraStackFrame(null);
476
+ }
477
+ var rr;
478
+ rr = !1;
479
+ function ar(r) {
480
+ return typeof r == "object" && r !== null && r.$$typeof === c;
481
+ }
482
+ function xr() {
483
+ {
484
+ if (Q.current) {
485
+ var r = S(Q.current.type);
486
+ if (r)
487
+ return `
488
+
489
+ Check the render method of \`` + r + "`.";
490
+ }
491
+ return "";
492
+ }
493
+ }
494
+ function oa(r) {
495
+ {
496
+ if (r !== void 0) {
497
+ var a = r.fileName.replace(/^.*[\\\/]/, ""), e = r.lineNumber;
498
+ return `
499
+
500
+ Check your code at ` + a + ":" + e + ".";
501
+ }
502
+ return "";
503
+ }
504
+ }
505
+ var Cr = {};
506
+ function ua(r) {
507
+ {
508
+ var a = xr();
509
+ if (!a) {
510
+ var e = typeof r == "string" ? r : r.displayName || r.name;
511
+ e && (a = `
512
+
513
+ Check the top-level render call using <` + e + ">.");
514
+ }
515
+ return a;
516
+ }
517
+ }
518
+ function Sr(r, a) {
519
+ {
520
+ if (!r._store || r._store.validated || r.key != null)
521
+ return;
522
+ r._store.validated = !0;
523
+ var e = ua(a);
524
+ if (Cr[e])
525
+ return;
526
+ Cr[e] = !0;
527
+ var n = "";
528
+ r && r._owner && r._owner !== Q.current && (n = " It was passed a child from " + S(r._owner.type) + "."), D(r), p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', e, n), D(null);
529
+ }
530
+ }
531
+ function wr(r, a) {
532
+ {
533
+ if (typeof r != "object")
534
+ return;
535
+ if (H(r))
536
+ for (var e = 0; e < r.length; e++) {
537
+ var n = r[e];
538
+ ar(n) && Sr(n, a);
539
+ }
540
+ else if (ar(r))
541
+ r._store && (r._store.validated = !0);
542
+ else if (r) {
543
+ var o = $r(r);
544
+ if (typeof o == "function" && o !== r.entries)
545
+ for (var l = o.call(r), s; !(s = l.next()).done; )
546
+ ar(s.value) && Sr(s.value, a);
547
+ }
548
+ }
549
+ }
550
+ function la(r) {
551
+ {
552
+ var a = r.type;
553
+ if (a == null || typeof a == "string")
554
+ return;
555
+ var e;
556
+ if (typeof a == "function")
557
+ e = a.propTypes;
558
+ else if (typeof a == "object" && (a.$$typeof === f || // Note: Memo only checks outer props here.
559
+ // Inner props are checked in the reconciler.
560
+ a.$$typeof === _))
561
+ e = a.propTypes;
562
+ else
563
+ return;
564
+ if (e) {
565
+ var n = S(a);
566
+ Gr(e, r.props, "prop", n, r);
567
+ } else if (a.PropTypes !== void 0 && !rr) {
568
+ rr = !0;
569
+ var o = S(a);
570
+ p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", o || "Unknown");
571
+ }
572
+ typeof a.getDefaultProps == "function" && !a.getDefaultProps.isReactClassApproved && p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
573
+ }
574
+ }
575
+ function ca(r) {
576
+ {
577
+ for (var a = Object.keys(r.props), e = 0; e < a.length; e++) {
578
+ var n = a[e];
579
+ if (n !== "children" && n !== "key") {
580
+ D(r), p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), D(null);
581
+ break;
582
+ }
583
+ }
584
+ r.ref !== null && (D(r), p("Invalid attribute `ref` supplied to `React.Fragment`."), D(null));
585
+ }
586
+ }
587
+ var Pr = {};
588
+ function Or(r, a, e, n, o, l) {
589
+ {
590
+ var s = Nr(r);
591
+ if (!s) {
592
+ var i = "";
593
+ (r === void 0 || typeof r == "object" && r !== null && Object.keys(r).length === 0) && (i += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
594
+ var m = oa(o);
595
+ m ? i += m : i += xr();
596
+ var d;
597
+ r === null ? d = "null" : H(r) ? d = "array" : r !== void 0 && r.$$typeof === c ? (d = "<" + (S(r.type) || "Unknown") + " />", i = " Did you accidentally export a JSX literal instead of a component?") : d = typeof r, p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", d, i);
598
+ }
599
+ var v = sa(r, a, e, o, l);
600
+ if (v == null)
601
+ return v;
602
+ if (s) {
603
+ var C = a.children;
604
+ if (C !== void 0)
605
+ if (n)
606
+ if (H(C)) {
607
+ for (var F = 0; F < C.length; F++)
608
+ wr(C[F], r);
609
+ Object.freeze && Object.freeze(C);
610
+ } else
611
+ p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
612
+ else
613
+ wr(C, r);
614
+ }
615
+ if (I.call(a, "key")) {
616
+ var O = S(r), E = Object.keys(a).filter(function(ga) {
617
+ return ga !== "key";
618
+ }), er = E.length > 0 ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}";
619
+ if (!Pr[O + er]) {
620
+ var pa = E.length > 0 ? "{" + E.join(": ..., ") + ": ...}" : "{}";
621
+ p(`A props object containing a "key" prop is being spread into JSX:
622
+ let props = %s;
623
+ <%s {...props} />
624
+ React keys must be passed directly to JSX without using spread:
625
+ let props = %s;
626
+ <%s key={someKey} {...props} />`, er, O, pa, O), Pr[O + er] = !0;
627
+ }
628
+ }
629
+ return r === u ? ca(v) : la(v), v;
630
+ }
631
+ }
632
+ function fa(r, a, e) {
633
+ return Or(r, a, e, !0);
634
+ }
635
+ function da(r, a, e) {
636
+ return Or(r, a, e, !1);
637
+ }
638
+ var va = da, ba = fa;
639
+ z.Fragment = u, z.jsx = va, z.jsxs = ba;
640
+ }()), z;
641
+ }
642
+ process.env.NODE_ENV === "production" ? tr.exports = ya() : tr.exports = ma();
643
+ var j = tr.exports;
644
+ const Ea = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
645
+
646
+ :root {
647
+ /* border width */
648
+ --starasia-ui-tabs-border-width: var(--starasia-ui-border, 1px);
649
+
650
+ /* color */
651
+ /* gray */
652
+ --starasia-ui-tabs-color-tertiary-gray: var(
653
+ --starasia-ui-color-gray-300,
654
+ #d1d5db
655
+ );
656
+ --starasia-ui-tabs-color-text-active: var(
657
+ --starasia-ui-color-gray-900,
658
+ #181a19
659
+ );
660
+ --starasia-ui-tabs-color-text: var(--starasia-ui-color-gray-200, #78867f);
661
+ --starasia-ui-tabs-color-white: var(--starasia-ui-color-gray-50, #fffeff);
662
+ /* blue */
663
+ --starasia-ui-tabs-color-primary-blue: var(
664
+ --starasia-ui-brand-primary-default,
665
+ #1976d2
666
+ );
667
+ --starasia-ui-tabs-color-primary-black: var(
668
+ --starasia-ui-color-blue-700,
669
+ #202221
670
+ );
671
+ --starasia-ui-tabs-color-secondary-blue: var(
672
+ --starasia-ui-color-blue-50,
673
+ #e3f2fd
674
+ );
675
+
676
+ /* height */
677
+ --starasia-ui-tabs-height-line: 2px;
678
+
679
+ /* spacing */
680
+ --starasia-ui-tabs-spacing-sm: var(--starasia-ui-spacing-sm, 8px);
681
+ /* 24px */
682
+ --starasia-ui-tabs-spacing-ms: var(--starasia-ui-spacing-md, 12px);
683
+ /* 24px */
684
+ --starasia-ui-tabs-spacing-md: var(--starasia-ui-spacing-lg, 16px);
685
+ /* 24px */
686
+ --starasia-ui-tabs-spacing-lg: var(--starasia-ui-spacing-xl, 24px);
687
+ /* 24px */
688
+
689
+ /* font size */
690
+ --starasia-ui-tabs-font-size-lg: var(--starasia-ui-fontSizes-lg, 16px);
691
+ --starasia-ui-tabs-font-size-md: var(--starasia-ui-fontSizes-md, 14px);
692
+ --starasia-ui-tabs-font-size-sm: var(--starasia-ui-fontSizes-sm, 12px);
693
+ --starasia-ui-tabs-font-size-xs: var(--starasia-ui-fontSizes-xs, 10px);
694
+ }
695
+
696
+ /* css for TabsLists */
697
+ .starasia-tabs-tablist {
698
+ display: flex;
699
+ align-items: center;
700
+
701
+ position: relative;
702
+ }
703
+
704
+ /* variant */
705
+ .starasia-tabs-tablist-underline {
706
+ border-bottom: var(--starasia-ui-tabs-border-width) solid
707
+ var(--starasia-ui-tabs-color-tertiary-gray);
708
+ }
709
+
710
+ .starasia-tabs-tablist-secondary {
711
+ background-color: rgba(120, 134, 127, 0.1);
712
+ padding: 4px;
713
+ box-sizing: border-box;
714
+ border-radius: 12px;
715
+ }
716
+
717
+ /* end variant */
718
+
719
+ .starasia-tabs-tablist-line-move {
720
+ position: absolute;
721
+ content: "";
722
+ height: var(--starasia-ui-tabs-height-line);
723
+ background: var(--starasia-ui-tabs-color-primary-blue);
724
+ bottom: 0;
725
+ transition: all 0.3s;
726
+ }
727
+
728
+ .starasia-tabs-tablist-line-move-overlay {
729
+ height: 100%;
730
+ border-radius: 8px;
731
+ background: var(--starasia-ui-tabs-color-secondary-blue);
732
+ }
733
+
734
+ .starasia-tabs-tablist-line-move-solid {
735
+ height: 100%;
736
+ border-radius: 8px;
737
+ background: var(--starasia-ui-tabs-color-primary-blue);
738
+ }
739
+
740
+ .starasia-tabs-tablist-line-move-secondary {
741
+ height: calc(100% - 8px);
742
+ top: 50%;
743
+ transform: translateY(-50%);
744
+ border-radius: 8px;
745
+ background: var(--starasia-ui-tabs-color-white);
746
+ }
747
+
748
+ /* CSS FOR SINGLE TAB */
749
+ .starasia-tabs-tab {
750
+ border: none;
751
+ background: transparent;
752
+ cursor: pointer;
753
+ padding-inline: var(--starasia-ui-tabs-spacing-md);
754
+ /* padding: var(--starasia-ui-tabs-spacing-sm) var(--starasia-ui-tabs-spacing-md); */
755
+ /* font-size: var(--starasia-ui-tabs-font-size-xs); */
756
+ font-family: "Poppins", serif;
757
+ font-weight: 400;
758
+ z-index: 1;
759
+ }
760
+
761
+ .starasia-tabs-tab-solid {
762
+ color: var(--starasia-ui-tabs-color-text);
763
+ }
764
+
765
+ .starasia-tabs-tab-solid-active {
766
+ color: var(--starasia-ui-tabs-color-white);
767
+ }
768
+
769
+ .starasia-tabs-tab-underline {
770
+ color: var(--starasia-ui-tabs-color-text);
771
+ }
772
+
773
+ .starasia-tabs-tab-underline-active {
774
+ color: var(--starasia-ui-tabs-color-text-active);
775
+ }
776
+
777
+ .starasia-tabs-tab-overlay {
778
+ color: var(--starasia-ui-tabs-color-text);
779
+ }
780
+
781
+ .starasia-tabs-tab-overlay-active {
782
+ color: var(--starasia-ui-tabs-color-text-active);
783
+ }
784
+
785
+ .starasia-tabs-tab-secondary {
786
+ color: var(--starasia-ui-tabs-color-text);
787
+ }
788
+
789
+ .starasia-tabs-tab-secondary-active {
790
+ color: var(--starasia-ui-tabs-color-text-active);
791
+ }
792
+
793
+ .starasia-tabs-tab-xs {
794
+ height: 32px;
795
+ font-size: var(--starasia-ui-tabs-font-size-sm);
796
+ }
797
+
798
+ .starasia-tabs-tab-sm {
799
+ height: 36px;
800
+ font-size: var(--starasia-ui-tabs-font-size-md);
801
+ }
802
+
803
+ .starasia-tabs-tab-md {
804
+ height: 38px;
805
+ font-size: var(--starasia-ui-tabs-font-size-md);
806
+ }
807
+
808
+ .starasia-tabs-tab-lg {
809
+ height: 42px;
810
+ font-size: var(--starasia-ui-tabs-font-size-lg);
811
+ }
812
+ `, Ar = "starasia-tab-styles", Ra = (g) => {
813
+ if (!document.getElementById(Ar)) {
814
+ const c = document.createElement("style");
815
+ c.id = Ar, c.textContent = g, document.head.appendChild(c);
816
+ }
817
+ };
818
+ Ra(Ea);
819
+ const q = ha(null), Ta = ({
820
+ children: g,
821
+ activeTab: c,
822
+ size: t = "md",
823
+ variant: u = "underline",
824
+ ...T
825
+ }) => {
826
+ const [h, y] = Y(0), [x, f] = Y(
827
+ null
828
+ ), [R, b] = Y([]), [_, w] = Y([]), k = (N) => {
829
+ f(N);
830
+ };
831
+ return L(() => {
832
+ f(R[c || 0]);
833
+ }, [R, c]), L(() => {
834
+ y(c || 0);
835
+ }, [c]), /* @__PURE__ */ j.jsx(
836
+ q.Provider,
837
+ {
838
+ value: {
839
+ activeContext: x,
840
+ handleSetActiveContext: k,
841
+ tabsButton: R,
842
+ setTabsButton: b,
843
+ activeTabButton: h,
844
+ setActiveTabButton: y,
845
+ panels: _,
846
+ setPanels: w,
847
+ size: t,
848
+ variant: u
849
+ },
850
+ children: /* @__PURE__ */ j.jsx("div", { ...T, children: g })
851
+ }
852
+ );
853
+ }, xa = ({ children: g, ...c }) => {
854
+ var x;
855
+ const t = nr(q), u = ir(null), [T, h] = Y(0);
856
+ let y = ((x = t == null ? void 0 : t.activeContext) == null ? void 0 : x.getBoundingClientRect().width) || 0;
857
+ return L(() => {
858
+ var f, R;
859
+ if (u.current) {
860
+ const b = ((f = t == null ? void 0 : t.activeContext) == null ? void 0 : f.getBoundingClientRect().left) || 0, _ = ((R = u == null ? void 0 : u.current) == null ? void 0 : R.getBoundingClientRect().left) || 0;
861
+ h(b - _);
862
+ }
863
+ }, [u, t == null ? void 0 : t.activeContext]), /* @__PURE__ */ j.jsxs(
864
+ "div",
865
+ {
866
+ className: `starasia-tabs-tablist starasia-tabs-tablist-${t == null ? void 0 : t.variant}`,
867
+ ...c,
868
+ ref: u,
869
+ children: [
870
+ g,
871
+ /* @__PURE__ */ j.jsx(
872
+ "div",
873
+ {
874
+ className: `starasia-tabs-tablist-line-move starasia-tabs-tablist-line-move-${t == null ? void 0 : t.variant}`,
875
+ style: { width: `${y}px`, left: `${T}px` }
876
+ }
877
+ )
878
+ ]
879
+ }
880
+ );
881
+ }, Ca = ({ children: g, ...c }) => {
882
+ const t = nr(q), u = ir(null);
883
+ L(() => {
884
+ u.current && (t == null || t.setTabsButton((h) => [
885
+ ...h,
886
+ u.current
887
+ ]));
888
+ }, [u]);
889
+ const T = (h) => {
890
+ if (t == null || t.handleSetActiveContext(h.currentTarget), t != null && t.tabsButton)
891
+ for (let y = 0; y < t.tabsButton.length; y++)
892
+ t.tabsButton[y] === h.currentTarget && t.setActiveTabButton(y);
893
+ };
894
+ return /* @__PURE__ */ j.jsx(
895
+ "button",
896
+ {
897
+ className: `starasia-tabs-tab starasia-tabs-tab-${t == null ? void 0 : t.size} starasia-tabs-tab-${t == null ? void 0 : t.variant} ${(t == null ? void 0 : t.tabsButton[t.activeTabButton]) === u.current ? `starasia-tabs-tab-${t == null ? void 0 : t.variant}-active` : ""}`,
898
+ onClick: (h) => {
899
+ T(h), c.onClick && c.onClick();
900
+ },
901
+ ref: u,
902
+ style: {
903
+ fontWeight: (t == null ? void 0 : t.tabsButton[t.activeTabButton]) === u.current ? "var(--starasia-ui-fontWeights-medium, 400)" : "var(--starasia-ui-fontWeights-normal, 300)",
904
+ ...c.style
905
+ },
906
+ children: g
907
+ }
908
+ );
909
+ }, Sa = ({ children: g, ...c }) => /* @__PURE__ */ j.jsx("div", { ...c, children: g }), wa = ({ children: g, ...c }) => {
910
+ const t = nr(q), u = ir(null);
911
+ return L(() => {
912
+ u.current && (t == null || t.setPanels((T) => [
913
+ ...T,
914
+ u.current
915
+ ]));
916
+ }, [u]), /* @__PURE__ */ j.jsx(
917
+ "div",
918
+ {
919
+ ref: u,
920
+ style: {
921
+ display: (t == null ? void 0 : t.panels[t.activeTabButton]) === u.current ? "block" : "none",
922
+ ...c.style
923
+ },
924
+ children: (t == null ? void 0 : t.panels[t.activeTabButton]) === u.current ? g : null
925
+ }
926
+ );
927
+ };
928
+ export {
929
+ Ca as Tab,
930
+ wa as TabPanel,
931
+ Sa as TabPanels,
932
+ Ta as Tabs,
933
+ xa as TabsLists
934
+ };
@@ -0,0 +1,200 @@
1
+ (function(P,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],f):(P=typeof globalThis<"u"?globalThis:P||self,f(P.Tabs={},P.React))})(this,function(P,f){"use strict";var X={exports:{}},B={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var na;function ka(){if(na)return B;na=1;var h=f,c=Symbol.for("react.element"),t=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,C=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,y={key:!0,ref:!0,__self:!0,__source:!0};function m(x,d,_){var p,T={},O=null,D=null;_!==void 0&&(O=""+_),d.key!==void 0&&(O=""+d.key),d.ref!==void 0&&(D=d.ref);for(p in d)u.call(d,p)&&!y.hasOwnProperty(p)&&(T[p]=d[p]);if(x&&x.defaultProps)for(p in d=x.defaultProps,d)T[p]===void 0&&(T[p]=d[p]);return{$$typeof:c,type:x,key:O,ref:D,props:T,_owner:C.current}}return B.Fragment=t,B.jsx=m,B.jsxs=m,B}var z={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var sa;function Aa(){return sa||(sa=1,process.env.NODE_ENV!=="production"&&function(){var h=f,c=Symbol.for("react.element"),t=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),x=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),D=Symbol.for("react.offscreen"),V=Symbol.iterator,Ya="@@iterator";function La(a){if(a===null||typeof a!="object")return null;var e=V&&a[V]||a[Ya];return typeof e=="function"?e:null}var F=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(a){{for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];Na("error",a,r)}}function Na(a,e,r){{var n=F.ReactDebugCurrentFrame,o=n.getStackAddendum();o!==""&&(e+="%s",r=r.concat([o]));var l=r.map(function(i){return String(i)});l.unshift("Warning: "+e),Function.prototype.apply.call(console[a],console,l)}}var Ma=!1,Va=!1,Ua=!1,Ja=!1,Ka=!1,oa;oa=Symbol.for("react.module.reference");function Ga(a){return!!(typeof a=="string"||typeof a=="function"||a===u||a===y||Ka||a===C||a===_||a===p||Ja||a===D||Ma||Va||Ua||typeof a=="object"&&a!==null&&(a.$$typeof===O||a.$$typeof===T||a.$$typeof===m||a.$$typeof===x||a.$$typeof===d||a.$$typeof===oa||a.getModuleId!==void 0))}function Xa(a,e,r){var n=a.displayName;if(n)return n;var o=e.displayName||e.name||"";return o!==""?r+"("+o+")":r}function ua(a){return a.displayName||"Context"}function w(a){if(a==null)return null;if(typeof a.tag=="number"&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case u:return"Fragment";case t:return"Portal";case y:return"Profiler";case C:return"StrictMode";case _:return"Suspense";case p:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case x:var e=a;return ua(e)+".Consumer";case m:var r=a;return ua(r._context)+".Provider";case d:return Xa(a,a.render,"ForwardRef");case T:var n=a.displayName||null;return n!==null?n:w(a.type)||"Memo";case O:{var o=a,l=o._payload,i=o._init;try{return w(i(l))}catch{return null}}}return null}var k=Object.assign,Y=0,la,ca,fa,da,va,ba,pa;function ga(){}ga.__reactDisabledLog=!0;function Ha(){{if(Y===0){la=console.log,ca=console.info,fa=console.warn,da=console.error,va=console.group,ba=console.groupCollapsed,pa=console.groupEnd;var a={configurable:!0,enumerable:!0,value:ga,writable:!0};Object.defineProperties(console,{info:a,log:a,warn:a,error:a,group:a,groupCollapsed:a,groupEnd:a})}Y++}}function Za(){{if(Y--,Y===0){var a={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:k({},a,{value:la}),info:k({},a,{value:ca}),warn:k({},a,{value:fa}),error:k({},a,{value:da}),group:k({},a,{value:va}),groupCollapsed:k({},a,{value:ba}),groupEnd:k({},a,{value:pa})})}Y<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var H=F.ReactCurrentDispatcher,Z;function U(a,e,r){{if(Z===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);Z=n&&n[1]||""}return`
18
+ `+Z+a}}var Q=!1,J;{var Qa=typeof WeakMap=="function"?WeakMap:Map;J=new Qa}function ha(a,e){if(!a||Q)return"";{var r=J.get(a);if(r!==void 0)return r}var n;Q=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var l;l=H.current,H.current=null,Ha();try{if(e){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(R){n=R}Reflect.construct(a,[],i)}else{try{i.call()}catch(R){n=R}a.call(i.prototype)}}else{try{throw Error()}catch(R){n=R}a()}}catch(R){if(R&&n&&typeof R.stack=="string"){for(var s=R.stack.split(`
19
+ `),E=n.stack.split(`
20
+ `),v=s.length-1,b=E.length-1;v>=1&&b>=0&&s[v]!==E[b];)b--;for(;v>=1&&b>=0;v--,b--)if(s[v]!==E[b]){if(v!==1||b!==1)do if(v--,b--,b<0||s[v]!==E[b]){var S=`
21
+ `+s[v].replace(" at new "," at ");return a.displayName&&S.includes("<anonymous>")&&(S=S.replace("<anonymous>",a.displayName)),typeof a=="function"&&J.set(a,S),S}while(v>=1&&b>=0);break}}}finally{Q=!1,H.current=l,Za(),Error.prepareStackTrace=o}var W=a?a.displayName||a.name:"",A=W?U(W):"";return typeof a=="function"&&J.set(a,A),A}function $a(a,e,r){return ha(a,!1)}function qa(a){var e=a.prototype;return!!(e&&e.isReactComponent)}function K(a,e,r){if(a==null)return"";if(typeof a=="function")return ha(a,qa(a));if(typeof a=="string")return U(a);switch(a){case _:return U("Suspense");case p:return U("SuspenseList")}if(typeof a=="object")switch(a.$$typeof){case d:return $a(a.render);case T:return K(a.type,e,r);case O:{var n=a,o=n._payload,l=n._init;try{return K(l(o),e,r)}catch{}}}return""}var L=Object.prototype.hasOwnProperty,ya={},ma=F.ReactDebugCurrentFrame;function G(a){if(a){var e=a._owner,r=K(a.type,a._source,e?e.type:null);ma.setExtraStackFrame(r)}else ma.setExtraStackFrame(null)}function ae(a,e,r,n,o){{var l=Function.call.bind(L);for(var i in a)if(l(a,i)){var s=void 0;try{if(typeof a[i]!="function"){var E=Error((n||"React class")+": "+r+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw E.name="Invariant Violation",E}s=a[i](e,i,n,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(v){s=v}s&&!(s instanceof Error)&&(G(o),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",r,i,typeof s),G(null)),s instanceof Error&&!(s.message in ya)&&(ya[s.message]=!0,G(o),g("Failed %s type: %s",r,s.message),G(null))}}}var ee=Array.isArray;function $(a){return ee(a)}function re(a){{var e=typeof Symbol=="function"&&Symbol.toStringTag,r=e&&a[Symbol.toStringTag]||a.constructor.name||"Object";return r}}function te(a){try{return Ea(a),!1}catch{return!0}}function Ea(a){return""+a}function Ra(a){if(te(a))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",re(a)),Ea(a)}var N=F.ReactCurrentOwner,ne={key:!0,ref:!0,__self:!0,__source:!0},_a,Ta,q;q={};function se(a){if(L.call(a,"ref")){var e=Object.getOwnPropertyDescriptor(a,"ref").get;if(e&&e.isReactWarning)return!1}return a.ref!==void 0}function ie(a){if(L.call(a,"key")){var e=Object.getOwnPropertyDescriptor(a,"key").get;if(e&&e.isReactWarning)return!1}return a.key!==void 0}function oe(a,e){if(typeof a.ref=="string"&&N.current&&e&&N.current.stateNode!==e){var r=w(N.current.type);q[r]||(g('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',w(N.current.type),a.ref),q[r]=!0)}}function ue(a,e){{var r=function(){_a||(_a=!0,g("%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://reactjs.org/link/special-props)",e))};r.isReactWarning=!0,Object.defineProperty(a,"key",{get:r,configurable:!0})}}function le(a,e){{var r=function(){Ta||(Ta=!0,g("%s: `ref` 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://reactjs.org/link/special-props)",e))};r.isReactWarning=!0,Object.defineProperty(a,"ref",{get:r,configurable:!0})}}var ce=function(a,e,r,n,o,l,i){var s={$$typeof:c,type:a,key:e,ref:r,props:i,_owner:l};return s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s};function fe(a,e,r,n,o){{var l,i={},s=null,E=null;r!==void 0&&(Ra(r),s=""+r),ie(e)&&(Ra(e.key),s=""+e.key),se(e)&&(E=e.ref,oe(e,o));for(l in e)L.call(e,l)&&!ne.hasOwnProperty(l)&&(i[l]=e[l]);if(a&&a.defaultProps){var v=a.defaultProps;for(l in v)i[l]===void 0&&(i[l]=v[l])}if(s||E){var b=typeof a=="function"?a.displayName||a.name||"Unknown":a;s&&ue(i,b),E&&le(i,b)}return ce(a,s,E,o,n,N.current,i)}}var aa=F.ReactCurrentOwner,Ca=F.ReactDebugCurrentFrame;function I(a){if(a){var e=a._owner,r=K(a.type,a._source,e?e.type:null);Ca.setExtraStackFrame(r)}else Ca.setExtraStackFrame(null)}var ea;ea=!1;function ra(a){return typeof a=="object"&&a!==null&&a.$$typeof===c}function xa(){{if(aa.current){var a=w(aa.current.type);if(a)return`
22
+
23
+ Check the render method of \``+a+"`."}return""}}function de(a){{if(a!==void 0){var e=a.fileName.replace(/^.*[\\\/]/,""),r=a.lineNumber;return`
24
+
25
+ Check your code at `+e+":"+r+"."}return""}}var Sa={};function ve(a){{var e=xa();if(!e){var r=typeof a=="string"?a:a.displayName||a.name;r&&(e=`
26
+
27
+ Check the top-level render call using <`+r+">.")}return e}}function Pa(a,e){{if(!a._store||a._store.validated||a.key!=null)return;a._store.validated=!0;var r=ve(e);if(Sa[r])return;Sa[r]=!0;var n="";a&&a._owner&&a._owner!==aa.current&&(n=" It was passed a child from "+w(a._owner.type)+"."),I(a),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,n),I(null)}}function wa(a,e){{if(typeof a!="object")return;if($(a))for(var r=0;r<a.length;r++){var n=a[r];ra(n)&&Pa(n,e)}else if(ra(a))a._store&&(a._store.validated=!0);else if(a){var o=La(a);if(typeof o=="function"&&o!==a.entries)for(var l=o.call(a),i;!(i=l.next()).done;)ra(i.value)&&Pa(i.value,e)}}}function be(a){{var e=a.type;if(e==null||typeof e=="string")return;var r;if(typeof e=="function")r=e.propTypes;else if(typeof e=="object"&&(e.$$typeof===d||e.$$typeof===T))r=e.propTypes;else return;if(r){var n=w(e);ae(r,a.props,"prop",n,a)}else if(e.PropTypes!==void 0&&!ea){ea=!0;var o=w(e);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",o||"Unknown")}typeof e.getDefaultProps=="function"&&!e.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pe(a){{for(var e=Object.keys(a.props),r=0;r<e.length;r++){var n=e[r];if(n!=="children"&&n!=="key"){I(a),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),I(null);break}}a.ref!==null&&(I(a),g("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}var Oa={};function ja(a,e,r,n,o,l){{var i=Ga(a);if(!i){var s="";(a===void 0||typeof a=="object"&&a!==null&&Object.keys(a).length===0)&&(s+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var E=de(o);E?s+=E:s+=xa();var v;a===null?v="null":$(a)?v="array":a!==void 0&&a.$$typeof===c?(v="<"+(w(a.type)||"Unknown")+" />",s=" Did you accidentally export a JSX literal instead of a component?"):v=typeof a,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",v,s)}var b=fe(a,e,r,o,l);if(b==null)return b;if(i){var S=e.children;if(S!==void 0)if(n)if($(S)){for(var W=0;W<S.length;W++)wa(S[W],a);Object.freeze&&Object.freeze(S)}else g("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 wa(S,a)}if(L.call(e,"key")){var A=w(a),R=Object.keys(e).filter(function(Re){return Re!=="key"}),ta=R.length>0?"{key: someKey, "+R.join(": ..., ")+": ...}":"{key: someKey}";if(!Oa[A+ta]){var Ee=R.length>0?"{"+R.join(": ..., ")+": ...}":"{}";g(`A props object containing a "key" prop is being spread into JSX:
28
+ let props = %s;
29
+ <%s {...props} />
30
+ React keys must be passed directly to JSX without using spread:
31
+ let props = %s;
32
+ <%s key={someKey} {...props} />`,ta,A,Ee,A),Oa[A+ta]=!0}}return a===u?pe(b):be(b),b}}function ge(a,e,r){return ja(a,e,r,!0)}function he(a,e,r){return ja(a,e,r,!1)}var ye=he,me=ge;z.Fragment=u,z.jsx=ye,z.jsxs=me}()),z}process.env.NODE_ENV==="production"?X.exports=ka():X.exports=Aa();var j=X.exports;const Da=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
33
+
34
+ :root {
35
+ /* border width */
36
+ --starasia-ui-tabs-border-width: var(--starasia-ui-border, 1px);
37
+
38
+ /* color */
39
+ /* gray */
40
+ --starasia-ui-tabs-color-tertiary-gray: var(
41
+ --starasia-ui-color-gray-300,
42
+ #d1d5db
43
+ );
44
+ --starasia-ui-tabs-color-text-active: var(
45
+ --starasia-ui-color-gray-900,
46
+ #181a19
47
+ );
48
+ --starasia-ui-tabs-color-text: var(--starasia-ui-color-gray-200, #78867f);
49
+ --starasia-ui-tabs-color-white: var(--starasia-ui-color-gray-50, #fffeff);
50
+ /* blue */
51
+ --starasia-ui-tabs-color-primary-blue: var(
52
+ --starasia-ui-brand-primary-default,
53
+ #1976d2
54
+ );
55
+ --starasia-ui-tabs-color-primary-black: var(
56
+ --starasia-ui-color-blue-700,
57
+ #202221
58
+ );
59
+ --starasia-ui-tabs-color-secondary-blue: var(
60
+ --starasia-ui-color-blue-50,
61
+ #e3f2fd
62
+ );
63
+
64
+ /* height */
65
+ --starasia-ui-tabs-height-line: 2px;
66
+
67
+ /* spacing */
68
+ --starasia-ui-tabs-spacing-sm: var(--starasia-ui-spacing-sm, 8px);
69
+ /* 24px */
70
+ --starasia-ui-tabs-spacing-ms: var(--starasia-ui-spacing-md, 12px);
71
+ /* 24px */
72
+ --starasia-ui-tabs-spacing-md: var(--starasia-ui-spacing-lg, 16px);
73
+ /* 24px */
74
+ --starasia-ui-tabs-spacing-lg: var(--starasia-ui-spacing-xl, 24px);
75
+ /* 24px */
76
+
77
+ /* font size */
78
+ --starasia-ui-tabs-font-size-lg: var(--starasia-ui-fontSizes-lg, 16px);
79
+ --starasia-ui-tabs-font-size-md: var(--starasia-ui-fontSizes-md, 14px);
80
+ --starasia-ui-tabs-font-size-sm: var(--starasia-ui-fontSizes-sm, 12px);
81
+ --starasia-ui-tabs-font-size-xs: var(--starasia-ui-fontSizes-xs, 10px);
82
+ }
83
+
84
+ /* css for TabsLists */
85
+ .starasia-tabs-tablist {
86
+ display: flex;
87
+ align-items: center;
88
+
89
+ position: relative;
90
+ }
91
+
92
+ /* variant */
93
+ .starasia-tabs-tablist-underline {
94
+ border-bottom: var(--starasia-ui-tabs-border-width) solid
95
+ var(--starasia-ui-tabs-color-tertiary-gray);
96
+ }
97
+
98
+ .starasia-tabs-tablist-secondary {
99
+ background-color: rgba(120, 134, 127, 0.1);
100
+ padding: 4px;
101
+ box-sizing: border-box;
102
+ border-radius: 12px;
103
+ }
104
+
105
+ /* end variant */
106
+
107
+ .starasia-tabs-tablist-line-move {
108
+ position: absolute;
109
+ content: "";
110
+ height: var(--starasia-ui-tabs-height-line);
111
+ background: var(--starasia-ui-tabs-color-primary-blue);
112
+ bottom: 0;
113
+ transition: all 0.3s;
114
+ }
115
+
116
+ .starasia-tabs-tablist-line-move-overlay {
117
+ height: 100%;
118
+ border-radius: 8px;
119
+ background: var(--starasia-ui-tabs-color-secondary-blue);
120
+ }
121
+
122
+ .starasia-tabs-tablist-line-move-solid {
123
+ height: 100%;
124
+ border-radius: 8px;
125
+ background: var(--starasia-ui-tabs-color-primary-blue);
126
+ }
127
+
128
+ .starasia-tabs-tablist-line-move-secondary {
129
+ height: calc(100% - 8px);
130
+ top: 50%;
131
+ transform: translateY(-50%);
132
+ border-radius: 8px;
133
+ background: var(--starasia-ui-tabs-color-white);
134
+ }
135
+
136
+ /* CSS FOR SINGLE TAB */
137
+ .starasia-tabs-tab {
138
+ border: none;
139
+ background: transparent;
140
+ cursor: pointer;
141
+ padding-inline: var(--starasia-ui-tabs-spacing-md);
142
+ /* padding: var(--starasia-ui-tabs-spacing-sm) var(--starasia-ui-tabs-spacing-md); */
143
+ /* font-size: var(--starasia-ui-tabs-font-size-xs); */
144
+ font-family: "Poppins", serif;
145
+ font-weight: 400;
146
+ z-index: 1;
147
+ }
148
+
149
+ .starasia-tabs-tab-solid {
150
+ color: var(--starasia-ui-tabs-color-text);
151
+ }
152
+
153
+ .starasia-tabs-tab-solid-active {
154
+ color: var(--starasia-ui-tabs-color-white);
155
+ }
156
+
157
+ .starasia-tabs-tab-underline {
158
+ color: var(--starasia-ui-tabs-color-text);
159
+ }
160
+
161
+ .starasia-tabs-tab-underline-active {
162
+ color: var(--starasia-ui-tabs-color-text-active);
163
+ }
164
+
165
+ .starasia-tabs-tab-overlay {
166
+ color: var(--starasia-ui-tabs-color-text);
167
+ }
168
+
169
+ .starasia-tabs-tab-overlay-active {
170
+ color: var(--starasia-ui-tabs-color-text-active);
171
+ }
172
+
173
+ .starasia-tabs-tab-secondary {
174
+ color: var(--starasia-ui-tabs-color-text);
175
+ }
176
+
177
+ .starasia-tabs-tab-secondary-active {
178
+ color: var(--starasia-ui-tabs-color-text-active);
179
+ }
180
+
181
+ .starasia-tabs-tab-xs {
182
+ height: 32px;
183
+ font-size: var(--starasia-ui-tabs-font-size-sm);
184
+ }
185
+
186
+ .starasia-tabs-tab-sm {
187
+ height: 36px;
188
+ font-size: var(--starasia-ui-tabs-font-size-md);
189
+ }
190
+
191
+ .starasia-tabs-tab-md {
192
+ height: 38px;
193
+ font-size: var(--starasia-ui-tabs-font-size-md);
194
+ }
195
+
196
+ .starasia-tabs-tab-lg {
197
+ height: 42px;
198
+ font-size: var(--starasia-ui-tabs-font-size-lg);
199
+ }
200
+ `,ia="starasia-tab-styles";(h=>{if(!document.getElementById(ia)){const c=document.createElement("style");c.id=ia,c.textContent=h,document.head.appendChild(c)}})(Da);const M=f.createContext(null),Fa=({children:h,activeTab:c,size:t="md",variant:u="underline",...C})=>{const[y,m]=f.useState(0),[x,d]=f.useState(null),[_,p]=f.useState([]),[T,O]=f.useState([]),D=V=>{d(V)};return f.useEffect(()=>{d(_[c||0])},[_,c]),f.useEffect(()=>{m(c||0)},[c]),j.jsx(M.Provider,{value:{activeContext:x,handleSetActiveContext:D,tabsButton:_,setTabsButton:p,activeTabButton:y,setActiveTabButton:m,panels:T,setPanels:O,size:t,variant:u},children:j.jsx("div",{...C,children:h})})},Ia=({children:h,...c})=>{var x;const t=f.useContext(M),u=f.useRef(null),[C,y]=f.useState(0);let m=((x=t==null?void 0:t.activeContext)==null?void 0:x.getBoundingClientRect().width)||0;return f.useEffect(()=>{var d,_;if(u.current){const p=((d=t==null?void 0:t.activeContext)==null?void 0:d.getBoundingClientRect().left)||0,T=((_=u==null?void 0:u.current)==null?void 0:_.getBoundingClientRect().left)||0;y(p-T)}},[u,t==null?void 0:t.activeContext]),j.jsxs("div",{className:`starasia-tabs-tablist starasia-tabs-tablist-${t==null?void 0:t.variant}`,...c,ref:u,children:[h,j.jsx("div",{className:`starasia-tabs-tablist-line-move starasia-tabs-tablist-line-move-${t==null?void 0:t.variant}`,style:{width:`${m}px`,left:`${C}px`}})]})},Wa=({children:h,...c})=>{const t=f.useContext(M),u=f.useRef(null);f.useEffect(()=>{u.current&&(t==null||t.setTabsButton(y=>[...y,u.current]))},[u]);const C=y=>{if(t==null||t.handleSetActiveContext(y.currentTarget),t!=null&&t.tabsButton)for(let m=0;m<t.tabsButton.length;m++)t.tabsButton[m]===y.currentTarget&&t.setActiveTabButton(m)};return j.jsx("button",{className:`starasia-tabs-tab starasia-tabs-tab-${t==null?void 0:t.size} starasia-tabs-tab-${t==null?void 0:t.variant} ${(t==null?void 0:t.tabsButton[t.activeTabButton])===u.current?`starasia-tabs-tab-${t==null?void 0:t.variant}-active`:""}`,onClick:y=>{C(y),c.onClick&&c.onClick()},ref:u,style:{fontWeight:(t==null?void 0:t.tabsButton[t.activeTabButton])===u.current?"var(--starasia-ui-fontWeights-medium, 400)":"var(--starasia-ui-fontWeights-normal, 300)",...c.style},children:h})},Ba=({children:h,...c})=>j.jsx("div",{...c,children:h}),za=({children:h,...c})=>{const t=f.useContext(M),u=f.useRef(null);return f.useEffect(()=>{u.current&&(t==null||t.setPanels(C=>[...C,u.current]))},[u]),j.jsx("div",{ref:u,style:{display:(t==null?void 0:t.panels[t.activeTabButton])===u.current?"block":"none",...c.style},children:(t==null?void 0:t.panels[t.activeTabButton])===u.current?h:null})};P.Tab=Wa,P.TabPanel=za,P.TabPanels=Ba,P.Tabs=Fa,P.TabsLists=Ia,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,9 @@
1
+ import { CSSProperties, ReactNode } from "react";
2
+ export interface ITabsProps {
3
+ children: ReactNode;
4
+ style?: CSSProperties;
5
+ activeTab?: number;
6
+ onClick?: () => void;
7
+ size?: "xs" | "sm" | "md" | "lg";
8
+ variant?: "solid" | "overlay" | "underline" | "secondary";
9
+ }
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@starasia/tabs",
3
+ "version": "1.0.0",
4
+ "description": "Tabs component for starasia UI",
5
+ "author": "Prawito Hudoro",
6
+ "main": "dist/tabs.umd.js",
7
+ "module": "dist/tabs.es.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist/*.js",
11
+ "dist/*.d.ts",
12
+ "dist/*.map",
13
+ "dist/*.css"
14
+ ],
15
+ "scripts": {
16
+ "dev": "vite --config vite.config.ts --port 3000",
17
+ "build": "vite build --config vite.config.ts"
18
+ },
19
+ "keywords": [],
20
+ "license": "ISC",
21
+ "type": "module",
22
+ "engines": {
23
+ "node": ">=18.0.0"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "^20.11.10",
27
+ "@vitejs/plugin-react": "^4.2.1",
28
+ "tsconfig-paths": "^4.2.0",
29
+ "typescript": "^5.3.3",
30
+ "vite": "^5.0.12",
31
+ "vite-plugin-dts": "^3.7.2",
32
+ "react": "^18.2.0",
33
+ "react-dom": "^18.2.0",
34
+ "@types/react": "^18.2.55",
35
+ "@types/react-dom": "^18.2.19"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ }
40
+ }