@starasia/toggle 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,55 @@
1
+ # starasia toggle
2
+
3
+ starasia toggle is a strict and customizable toggle 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/IToggle.png)
8
+
9
+ ## Package instalation
10
+
11
+ Instal package using pnpm
12
+
13
+ ```bash
14
+ pnpm add @starasia/toggle
15
+ ```
16
+
17
+ Instal package using yarn
18
+
19
+ ```bash
20
+ yarn add @starasia/toggle
21
+ ```
22
+
23
+ Instal package using npm
24
+
25
+ ```bash
26
+ npm i @starasia/toggle
27
+ ```
28
+
29
+ ## Usage/Examples
30
+
31
+ ```javascript
32
+ import React from "react";
33
+ import {Toggle} from "@starasia/toggle";
34
+ import ReactDOM from "react-dom/client";
35
+
36
+ const App = () => (
37
+ <div>
38
+ <Toggle size="lg" />
39
+ <Toggle size="lg" />
40
+ </div>
41
+ );
42
+
43
+ ReactDOM.createRoot(document.getElementById("app")!).render(<App />);
44
+
45
+
46
+
47
+ ```
48
+
49
+ ## Props @starasia/toggle
50
+
51
+ #### Props that you can pass to <Toggle {...props} />
52
+
53
+ | Prop Name | Value | required |
54
+ | :-------- | :------------------------ | :------- | ----- |
55
+ | size | "xs" / "sm" / "md" / "lg" | "none" | false |
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { ToggleProps } from './types';
3
+
4
+ export declare const Toggle: React.FC<ToggleProps>;
@@ -0,0 +1,2 @@
1
+ export { Toggle } from './Toggle';
2
+ export * from './types';
@@ -0,0 +1,858 @@
1
+ import Se from "react";
2
+ var H = { exports: {} }, W = {};
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 we;
13
+ function fr() {
14
+ if (we) return W;
15
+ we = 1;
16
+ var x = Se, v = Symbol.for("react.element"), E = Symbol.for("react.fragment"), b = Object.prototype.hasOwnProperty, _ = x.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, $ = { key: !0, ref: !0, __self: !0, __source: !0 };
17
+ function D(R, c, O) {
18
+ var p, m = {}, w = null, Y = null;
19
+ O !== void 0 && (w = "" + O), c.key !== void 0 && (w = "" + c.key), c.ref !== void 0 && (Y = c.ref);
20
+ for (p in c) b.call(c, p) && !$.hasOwnProperty(p) && (m[p] = c[p]);
21
+ if (R && R.defaultProps) for (p in c = R.defaultProps, c) m[p] === void 0 && (m[p] = c[p]);
22
+ return { $$typeof: v, type: R, key: w, ref: Y, props: m, _owner: _.current };
23
+ }
24
+ return W.Fragment = E, W.jsx = D, W.jsxs = D, W;
25
+ }
26
+ var I = {};
27
+ /**
28
+ * @license React
29
+ * react-jsx-runtime.development.js
30
+ *
31
+ * Copyright (c) Facebook, Inc. and its affiliates.
32
+ *
33
+ * This source code is licensed under the MIT license found in the
34
+ * LICENSE file in the root directory of this source tree.
35
+ */
36
+ var ke;
37
+ function dr() {
38
+ return ke || (ke = 1, process.env.NODE_ENV !== "production" && function() {
39
+ var x = Se, v = Symbol.for("react.element"), E = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), _ = Symbol.for("react.strict_mode"), $ = Symbol.for("react.profiler"), D = Symbol.for("react.provider"), R = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), O = Symbol.for("react.suspense"), p = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), Y = Symbol.for("react.offscreen"), Z = Symbol.iterator, Oe = "@@iterator";
40
+ function Pe(e) {
41
+ if (e === null || typeof e != "object")
42
+ return null;
43
+ var r = Z && e[Z] || e[Oe];
44
+ return typeof r == "function" ? r : null;
45
+ }
46
+ var P = x.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
47
+ function f(e) {
48
+ {
49
+ for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
50
+ t[n - 1] = arguments[n];
51
+ Ce("error", e, t);
52
+ }
53
+ }
54
+ function Ce(e, r, t) {
55
+ {
56
+ var n = P.ReactDebugCurrentFrame, o = n.getStackAddendum();
57
+ o !== "" && (r += "%s", t = t.concat([o]));
58
+ var s = t.map(function(i) {
59
+ return String(i);
60
+ });
61
+ s.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, s);
62
+ }
63
+ }
64
+ var je = !1, De = !1, Fe = !1, Ae = !1, We = !1, Q;
65
+ Q = Symbol.for("react.module.reference");
66
+ function Ie(e) {
67
+ return !!(typeof e == "string" || typeof e == "function" || e === b || e === $ || We || e === _ || e === O || e === p || Ae || e === Y || je || De || Fe || typeof e == "object" && e !== null && (e.$$typeof === w || e.$$typeof === m || e.$$typeof === D || e.$$typeof === R || e.$$typeof === c || // This needs to include all possible module reference object
68
+ // types supported by any Flight configuration anywhere since
69
+ // we don't know which Flight build this will end up being used
70
+ // with.
71
+ e.$$typeof === Q || e.getModuleId !== void 0));
72
+ }
73
+ function $e(e, r, t) {
74
+ var n = e.displayName;
75
+ if (n)
76
+ return n;
77
+ var o = r.displayName || r.name || "";
78
+ return o !== "" ? t + "(" + o + ")" : t;
79
+ }
80
+ function ee(e) {
81
+ return e.displayName || "Context";
82
+ }
83
+ function y(e) {
84
+ if (e == null)
85
+ return null;
86
+ if (typeof e.tag == "number" && f("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
87
+ return e.displayName || e.name || null;
88
+ if (typeof e == "string")
89
+ return e;
90
+ switch (e) {
91
+ case b:
92
+ return "Fragment";
93
+ case E:
94
+ return "Portal";
95
+ case $:
96
+ return "Profiler";
97
+ case _:
98
+ return "StrictMode";
99
+ case O:
100
+ return "Suspense";
101
+ case p:
102
+ return "SuspenseList";
103
+ }
104
+ if (typeof e == "object")
105
+ switch (e.$$typeof) {
106
+ case R:
107
+ var r = e;
108
+ return ee(r) + ".Consumer";
109
+ case D:
110
+ var t = e;
111
+ return ee(t._context) + ".Provider";
112
+ case c:
113
+ return $e(e, e.render, "ForwardRef");
114
+ case m:
115
+ var n = e.displayName || null;
116
+ return n !== null ? n : y(e.type) || "Memo";
117
+ case w: {
118
+ var o = e, s = o._payload, i = o._init;
119
+ try {
120
+ return y(i(s));
121
+ } catch {
122
+ return null;
123
+ }
124
+ }
125
+ }
126
+ return null;
127
+ }
128
+ var k = Object.assign, F = 0, re, te, ne, ae, ie, oe, se;
129
+ function le() {
130
+ }
131
+ le.__reactDisabledLog = !0;
132
+ function Ye() {
133
+ {
134
+ if (F === 0) {
135
+ re = console.log, te = console.info, ne = console.warn, ae = console.error, ie = console.group, oe = console.groupCollapsed, se = console.groupEnd;
136
+ var e = {
137
+ configurable: !0,
138
+ enumerable: !0,
139
+ value: le,
140
+ writable: !0
141
+ };
142
+ Object.defineProperties(console, {
143
+ info: e,
144
+ log: e,
145
+ warn: e,
146
+ error: e,
147
+ group: e,
148
+ groupCollapsed: e,
149
+ groupEnd: e
150
+ });
151
+ }
152
+ F++;
153
+ }
154
+ }
155
+ function ze() {
156
+ {
157
+ if (F--, F === 0) {
158
+ var e = {
159
+ configurable: !0,
160
+ enumerable: !0,
161
+ writable: !0
162
+ };
163
+ Object.defineProperties(console, {
164
+ log: k({}, e, {
165
+ value: re
166
+ }),
167
+ info: k({}, e, {
168
+ value: te
169
+ }),
170
+ warn: k({}, e, {
171
+ value: ne
172
+ }),
173
+ error: k({}, e, {
174
+ value: ae
175
+ }),
176
+ group: k({}, e, {
177
+ value: ie
178
+ }),
179
+ groupCollapsed: k({}, e, {
180
+ value: oe
181
+ }),
182
+ groupEnd: k({}, e, {
183
+ value: se
184
+ })
185
+ });
186
+ }
187
+ F < 0 && f("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
188
+ }
189
+ }
190
+ var N = P.ReactCurrentDispatcher, U;
191
+ function z(e, r, t) {
192
+ {
193
+ if (U === void 0)
194
+ try {
195
+ throw Error();
196
+ } catch (o) {
197
+ var n = o.stack.trim().match(/\n( *(at )?)/);
198
+ U = n && n[1] || "";
199
+ }
200
+ return `
201
+ ` + U + e;
202
+ }
203
+ }
204
+ var B = !1, L;
205
+ {
206
+ var Le = typeof WeakMap == "function" ? WeakMap : Map;
207
+ L = new Le();
208
+ }
209
+ function ue(e, r) {
210
+ if (!e || B)
211
+ return "";
212
+ {
213
+ var t = L.get(e);
214
+ if (t !== void 0)
215
+ return t;
216
+ }
217
+ var n;
218
+ B = !0;
219
+ var o = Error.prepareStackTrace;
220
+ Error.prepareStackTrace = void 0;
221
+ var s;
222
+ s = N.current, N.current = null, Ye();
223
+ try {
224
+ if (r) {
225
+ var i = function() {
226
+ throw Error();
227
+ };
228
+ if (Object.defineProperty(i.prototype, "props", {
229
+ set: function() {
230
+ throw Error();
231
+ }
232
+ }), typeof Reflect == "object" && Reflect.construct) {
233
+ try {
234
+ Reflect.construct(i, []);
235
+ } catch (g) {
236
+ n = g;
237
+ }
238
+ Reflect.construct(e, [], i);
239
+ } else {
240
+ try {
241
+ i.call();
242
+ } catch (g) {
243
+ n = g;
244
+ }
245
+ e.call(i.prototype);
246
+ }
247
+ } else {
248
+ try {
249
+ throw Error();
250
+ } catch (g) {
251
+ n = g;
252
+ }
253
+ e();
254
+ }
255
+ } catch (g) {
256
+ if (g && n && typeof g.stack == "string") {
257
+ for (var a = g.stack.split(`
258
+ `), d = n.stack.split(`
259
+ `), l = a.length - 1, u = d.length - 1; l >= 1 && u >= 0 && a[l] !== d[u]; )
260
+ u--;
261
+ for (; l >= 1 && u >= 0; l--, u--)
262
+ if (a[l] !== d[u]) {
263
+ if (l !== 1 || u !== 1)
264
+ do
265
+ if (l--, u--, u < 0 || a[l] !== d[u]) {
266
+ var h = `
267
+ ` + a[l].replace(" at new ", " at ");
268
+ return e.displayName && h.includes("<anonymous>") && (h = h.replace("<anonymous>", e.displayName)), typeof e == "function" && L.set(e, h), h;
269
+ }
270
+ while (l >= 1 && u >= 0);
271
+ break;
272
+ }
273
+ }
274
+ } finally {
275
+ B = !1, N.current = s, ze(), Error.prepareStackTrace = o;
276
+ }
277
+ var j = e ? e.displayName || e.name : "", T = j ? z(j) : "";
278
+ return typeof e == "function" && L.set(e, T), T;
279
+ }
280
+ function Ve(e, r, t) {
281
+ return ue(e, !1);
282
+ }
283
+ function Me(e) {
284
+ var r = e.prototype;
285
+ return !!(r && r.isReactComponent);
286
+ }
287
+ function V(e, r, t) {
288
+ if (e == null)
289
+ return "";
290
+ if (typeof e == "function")
291
+ return ue(e, Me(e));
292
+ if (typeof e == "string")
293
+ return z(e);
294
+ switch (e) {
295
+ case O:
296
+ return z("Suspense");
297
+ case p:
298
+ return z("SuspenseList");
299
+ }
300
+ if (typeof e == "object")
301
+ switch (e.$$typeof) {
302
+ case c:
303
+ return Ve(e.render);
304
+ case m:
305
+ return V(e.type, r, t);
306
+ case w: {
307
+ var n = e, o = n._payload, s = n._init;
308
+ try {
309
+ return V(s(o), r, t);
310
+ } catch {
311
+ }
312
+ }
313
+ }
314
+ return "";
315
+ }
316
+ var A = Object.prototype.hasOwnProperty, ce = {}, fe = P.ReactDebugCurrentFrame;
317
+ function M(e) {
318
+ if (e) {
319
+ var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
320
+ fe.setExtraStackFrame(t);
321
+ } else
322
+ fe.setExtraStackFrame(null);
323
+ }
324
+ function Ne(e, r, t, n, o) {
325
+ {
326
+ var s = Function.call.bind(A);
327
+ for (var i in e)
328
+ if (s(e, i)) {
329
+ var a = void 0;
330
+ try {
331
+ if (typeof e[i] != "function") {
332
+ var d = Error((n || "React class") + ": " + t + " type `" + i + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[i] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
333
+ throw d.name = "Invariant Violation", d;
334
+ }
335
+ a = e[i](r, i, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
336
+ } catch (l) {
337
+ a = l;
338
+ }
339
+ a && !(a instanceof Error) && (M(o), f("%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", t, i, typeof a), M(null)), a instanceof Error && !(a.message in ce) && (ce[a.message] = !0, M(o), f("Failed %s type: %s", t, a.message), M(null));
340
+ }
341
+ }
342
+ }
343
+ var Ue = Array.isArray;
344
+ function J(e) {
345
+ return Ue(e);
346
+ }
347
+ function Be(e) {
348
+ {
349
+ var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
350
+ return t;
351
+ }
352
+ }
353
+ function Je(e) {
354
+ try {
355
+ return de(e), !1;
356
+ } catch {
357
+ return !0;
358
+ }
359
+ }
360
+ function de(e) {
361
+ return "" + e;
362
+ }
363
+ function ge(e) {
364
+ if (Je(e))
365
+ return f("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Be(e)), de(e);
366
+ }
367
+ var ve = P.ReactCurrentOwner, qe = {
368
+ key: !0,
369
+ ref: !0,
370
+ __self: !0,
371
+ __source: !0
372
+ }, pe, he;
373
+ function Ke(e) {
374
+ if (A.call(e, "ref")) {
375
+ var r = Object.getOwnPropertyDescriptor(e, "ref").get;
376
+ if (r && r.isReactWarning)
377
+ return !1;
378
+ }
379
+ return e.ref !== void 0;
380
+ }
381
+ function Ge(e) {
382
+ if (A.call(e, "key")) {
383
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
384
+ if (r && r.isReactWarning)
385
+ return !1;
386
+ }
387
+ return e.key !== void 0;
388
+ }
389
+ function Xe(e, r) {
390
+ typeof e.ref == "string" && ve.current;
391
+ }
392
+ function He(e, r) {
393
+ {
394
+ var t = function() {
395
+ pe || (pe = !0, f("%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)", r));
396
+ };
397
+ t.isReactWarning = !0, Object.defineProperty(e, "key", {
398
+ get: t,
399
+ configurable: !0
400
+ });
401
+ }
402
+ }
403
+ function Ze(e, r) {
404
+ {
405
+ var t = function() {
406
+ he || (he = !0, f("%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)", r));
407
+ };
408
+ t.isReactWarning = !0, Object.defineProperty(e, "ref", {
409
+ get: t,
410
+ configurable: !0
411
+ });
412
+ }
413
+ }
414
+ var Qe = function(e, r, t, n, o, s, i) {
415
+ var a = {
416
+ // This tag allows us to uniquely identify this as a React Element
417
+ $$typeof: v,
418
+ // Built-in properties that belong on the element
419
+ type: e,
420
+ key: r,
421
+ ref: t,
422
+ props: i,
423
+ // Record the component responsible for creating this element.
424
+ _owner: s
425
+ };
426
+ return a._store = {}, Object.defineProperty(a._store, "validated", {
427
+ configurable: !1,
428
+ enumerable: !1,
429
+ writable: !0,
430
+ value: !1
431
+ }), Object.defineProperty(a, "_self", {
432
+ configurable: !1,
433
+ enumerable: !1,
434
+ writable: !1,
435
+ value: n
436
+ }), Object.defineProperty(a, "_source", {
437
+ configurable: !1,
438
+ enumerable: !1,
439
+ writable: !1,
440
+ value: o
441
+ }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
442
+ };
443
+ function er(e, r, t, n, o) {
444
+ {
445
+ var s, i = {}, a = null, d = null;
446
+ t !== void 0 && (ge(t), a = "" + t), Ge(r) && (ge(r.key), a = "" + r.key), Ke(r) && (d = r.ref, Xe(r, o));
447
+ for (s in r)
448
+ A.call(r, s) && !qe.hasOwnProperty(s) && (i[s] = r[s]);
449
+ if (e && e.defaultProps) {
450
+ var l = e.defaultProps;
451
+ for (s in l)
452
+ i[s] === void 0 && (i[s] = l[s]);
453
+ }
454
+ if (a || d) {
455
+ var u = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
456
+ a && He(i, u), d && Ze(i, u);
457
+ }
458
+ return Qe(e, a, d, o, n, ve.current, i);
459
+ }
460
+ }
461
+ var q = P.ReactCurrentOwner, be = P.ReactDebugCurrentFrame;
462
+ function C(e) {
463
+ if (e) {
464
+ var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
465
+ be.setExtraStackFrame(t);
466
+ } else
467
+ be.setExtraStackFrame(null);
468
+ }
469
+ var K;
470
+ K = !1;
471
+ function G(e) {
472
+ return typeof e == "object" && e !== null && e.$$typeof === v;
473
+ }
474
+ function me() {
475
+ {
476
+ if (q.current) {
477
+ var e = y(q.current.type);
478
+ if (e)
479
+ return `
480
+
481
+ Check the render method of \`` + e + "`.";
482
+ }
483
+ return "";
484
+ }
485
+ }
486
+ function rr(e) {
487
+ return "";
488
+ }
489
+ var ye = {};
490
+ function tr(e) {
491
+ {
492
+ var r = me();
493
+ if (!r) {
494
+ var t = typeof e == "string" ? e : e.displayName || e.name;
495
+ t && (r = `
496
+
497
+ Check the top-level render call using <` + t + ">.");
498
+ }
499
+ return r;
500
+ }
501
+ }
502
+ function xe(e, r) {
503
+ {
504
+ if (!e._store || e._store.validated || e.key != null)
505
+ return;
506
+ e._store.validated = !0;
507
+ var t = tr(r);
508
+ if (ye[t])
509
+ return;
510
+ ye[t] = !0;
511
+ var n = "";
512
+ e && e._owner && e._owner !== q.current && (n = " It was passed a child from " + y(e._owner.type) + "."), C(e), f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), C(null);
513
+ }
514
+ }
515
+ function Ee(e, r) {
516
+ {
517
+ if (typeof e != "object")
518
+ return;
519
+ if (J(e))
520
+ for (var t = 0; t < e.length; t++) {
521
+ var n = e[t];
522
+ G(n) && xe(n, r);
523
+ }
524
+ else if (G(e))
525
+ e._store && (e._store.validated = !0);
526
+ else if (e) {
527
+ var o = Pe(e);
528
+ if (typeof o == "function" && o !== e.entries)
529
+ for (var s = o.call(e), i; !(i = s.next()).done; )
530
+ G(i.value) && xe(i.value, r);
531
+ }
532
+ }
533
+ }
534
+ function nr(e) {
535
+ {
536
+ var r = e.type;
537
+ if (r == null || typeof r == "string")
538
+ return;
539
+ var t;
540
+ if (typeof r == "function")
541
+ t = r.propTypes;
542
+ else if (typeof r == "object" && (r.$$typeof === c || // Note: Memo only checks outer props here.
543
+ // Inner props are checked in the reconciler.
544
+ r.$$typeof === m))
545
+ t = r.propTypes;
546
+ else
547
+ return;
548
+ if (t) {
549
+ var n = y(r);
550
+ Ne(t, e.props, "prop", n, e);
551
+ } else if (r.PropTypes !== void 0 && !K) {
552
+ K = !0;
553
+ var o = y(r);
554
+ f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", o || "Unknown");
555
+ }
556
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && f("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
557
+ }
558
+ }
559
+ function ar(e) {
560
+ {
561
+ for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
562
+ var n = r[t];
563
+ if (n !== "children" && n !== "key") {
564
+ C(e), f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), C(null);
565
+ break;
566
+ }
567
+ }
568
+ e.ref !== null && (C(e), f("Invalid attribute `ref` supplied to `React.Fragment`."), C(null));
569
+ }
570
+ }
571
+ var _e = {};
572
+ function Re(e, r, t, n, o, s) {
573
+ {
574
+ var i = Ie(e);
575
+ if (!i) {
576
+ var a = "";
577
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
578
+ var d = rr();
579
+ d ? a += d : a += me();
580
+ var l;
581
+ e === null ? l = "null" : J(e) ? l = "array" : e !== void 0 && e.$$typeof === v ? (l = "<" + (y(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : l = typeof e, f("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", l, a);
582
+ }
583
+ var u = er(e, r, t, o, s);
584
+ if (u == null)
585
+ return u;
586
+ if (i) {
587
+ var h = r.children;
588
+ if (h !== void 0)
589
+ if (n)
590
+ if (J(h)) {
591
+ for (var j = 0; j < h.length; j++)
592
+ Ee(h[j], e);
593
+ Object.freeze && Object.freeze(h);
594
+ } else
595
+ f("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
596
+ else
597
+ Ee(h, e);
598
+ }
599
+ if (A.call(r, "key")) {
600
+ var T = y(e), g = Object.keys(r).filter(function(cr) {
601
+ return cr !== "key";
602
+ }), X = g.length > 0 ? "{key: someKey, " + g.join(": ..., ") + ": ...}" : "{key: someKey}";
603
+ if (!_e[T + X]) {
604
+ var ur = g.length > 0 ? "{" + g.join(": ..., ") + ": ...}" : "{}";
605
+ f(`A props object containing a "key" prop is being spread into JSX:
606
+ let props = %s;
607
+ <%s {...props} />
608
+ React keys must be passed directly to JSX without using spread:
609
+ let props = %s;
610
+ <%s key={someKey} {...props} />`, X, T, ur, T), _e[T + X] = !0;
611
+ }
612
+ }
613
+ return e === b ? ar(u) : nr(u), u;
614
+ }
615
+ }
616
+ function ir(e, r, t) {
617
+ return Re(e, r, t, !0);
618
+ }
619
+ function or(e, r, t) {
620
+ return Re(e, r, t, !1);
621
+ }
622
+ var sr = or, lr = ir;
623
+ I.Fragment = b, I.jsx = sr, I.jsxs = lr;
624
+ }()), I;
625
+ }
626
+ process.env.NODE_ENV === "production" ? H.exports = fr() : H.exports = dr();
627
+ var S = H.exports;
628
+ const gr = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
629
+ :root {
630
+ /* toogle root color */
631
+ --starasia-ui-background-toggle-checked: #1e88e5;
632
+ --starasia-ui-background-toggle-checked-hover: #1976d2;
633
+ --starasia-ui-shadow-toggle-checked: 0px 0px 0px 1px rgba(100, 181, 246, 0.28);
634
+
635
+ --starasia-ui-background-toggle-base: rgba(120, 134, 127, 0.2);
636
+ --starasia-ui-shadow-toggle-base: 0px 0px 0px 1px rgba(201, 206, 204, 0.28);
637
+
638
+ --starasia-ui-background-toggle-disable: rgba(120, 134, 127, 0.2);
639
+ }
640
+
641
+ * {
642
+ font-family: "Poppins", serif;
643
+ margin: 0;
644
+ padding: 0;
645
+ }
646
+
647
+ .starasia-toggle-container {
648
+ display: flex;
649
+ flex-direction: row;
650
+ align-items: flex-start;
651
+ }
652
+
653
+ .starasia-toggle-container-lg {
654
+ gap: 16px;
655
+ & label {
656
+ font-size: var(--starasia-ui-fontSizes-lg, 16px);
657
+ font-weight: var(--starasia-ui-fontWeights-medium, 400);
658
+ }
659
+ & p {
660
+ font-size: var(--starasia-ui-fontSizes-lg, 16px);
661
+ font-weight: var(--starasia-ui-fontWeights-normal, 300);
662
+ color: #78867f;
663
+ }
664
+ }
665
+
666
+ .starasia-toggle-container-md {
667
+ gap: 12px;
668
+ & label {
669
+ font-size: var(--starasia-ui-fontSizes-md, 14px);
670
+ font-weight: var(--starasia-ui-fontWeights-medium, 400);
671
+ }
672
+ & p {
673
+ font-size: var(--starasia-ui-fontSizes-md, 14px);
674
+ font-weight: var(--starasia-ui-fontWeights-normal, 300);
675
+ color: #78867f;
676
+ }
677
+ }
678
+ .starasia-toggle-container-sm {
679
+ gap: 12px;
680
+ & label {
681
+ font-size: var(--starasia-ui-fontSizes-sm, 12px);
682
+ font-weight: var(--starasia-ui-fontWeights-medium, 400);
683
+ }
684
+ & p {
685
+ font-size: var(--starasia-ui-fontSizes-sm, 12px);
686
+ font-weight: var(--starasia-ui-fontWeights-normal, 300);
687
+ color: #78867f;
688
+ }
689
+ }
690
+ .starasia-toggle-container-xs {
691
+ gap: 10px;
692
+ & label {
693
+ font-size: var(--starasia-ui-fontSizes-xs, 10px);
694
+ font-weight: var(--starasia-ui-fontWeights-medium, 400);
695
+ }
696
+ & p {
697
+ font-size: var(--starasia-ui-fontSizes-xs, 10px);
698
+ font-weight: var(--starasia-ui-fontWeights-normal, 300);
699
+ color: #78867f;
700
+ }
701
+ }
702
+
703
+ .starasia-toggle-switch {
704
+ position: relative;
705
+ display: inline-block;
706
+ }
707
+
708
+ .starasia-toggle-switch input {
709
+ display: none;
710
+ }
711
+
712
+ .starasia-toggle-switch-xs {
713
+ width: 30px;
714
+ height: 16px;
715
+ }
716
+ .starasia-toggle-switch-sm {
717
+ width: 32px;
718
+ height: 18px;
719
+ }
720
+ .starasia-toggle-switch-md {
721
+ width: 36px;
722
+ height: 20px;
723
+ }
724
+ .starasia-toggle-switch-lg {
725
+ width: 38px;
726
+ height: 22px;
727
+ }
728
+
729
+ .starasia-toggle-slider::before {
730
+ filter: drop-shadow(2px 0px 2px rgba(13, 16, 23, 0.07));
731
+ }
732
+ .starasia-toggle-slider.starasia-toggle-xs::before {
733
+ height: 12px;
734
+ width: 12px;
735
+ }
736
+ .starasia-toggle-slider.starasia-toggle-sm::before {
737
+ height: 14px;
738
+ width: 14px;
739
+ }
740
+ .starasia-toggle-slider.starasia-toggle-md::before {
741
+ height: 16px;
742
+ width: 16px;
743
+ }
744
+ .starasia-toggle-slider.starasia-toggle-lg::before {
745
+ height: 18px;
746
+ width: 18px;
747
+ }
748
+
749
+ .starasia-toggle-slider {
750
+ position: absolute;
751
+ top: 0;
752
+ left: 0;
753
+ right: 0;
754
+ bottom: 0;
755
+ background-color: var(--starasia-ui-background-toggle-base);
756
+ border-radius: 34px;
757
+ cursor: pointer;
758
+ transition: 0.4s;
759
+ }
760
+
761
+ .starasia-toggle-slider:hover {
762
+ box-shadow: var(--starasia-ui-shadow-toggle-base);
763
+ }
764
+
765
+ .starasia-toggle-slider:before {
766
+ position: absolute;
767
+ content: "";
768
+ background-color: #fffeff;
769
+ border-radius: 50%;
770
+ transition: 0.4s;
771
+ bottom: 50%;
772
+ transform: translateY(50%);
773
+ left: 2px;
774
+ }
775
+
776
+ input:checked + .starasia-toggle-slider {
777
+ background-color: var(--starasia-ui-background-toggle-checked);
778
+ /* background-color: var(--starasia-ui-background-active-toggle); */
779
+ }
780
+
781
+ input:checked:hover:not(:disabled) + .starasia-toggle-slider {
782
+ background-color: var(--starasia-ui-background-toggle-checked-hover);
783
+ /* background-color: var(--starasia-ui-background-active-toggle); */
784
+ }
785
+ input:checked:hover:not(:disabled) + .starasia-toggle-slider:hover {
786
+ box-shadow: var(--starasia-ui-shadow-toggle-checked);
787
+ }
788
+
789
+ input:disabled + .starasia-toggle-slider {
790
+ background-color: var(--starasia-ui-background-toggle-disable);
791
+ }
792
+ input:disabled + .starasia-toggle-slider:before {
793
+ background-color: rgba(255, 254, 255, 0.5);
794
+ /* background-color: var(--starasia-ui-background-active-toggle); */
795
+ }
796
+
797
+ input:checked + .starasia-toggle-slider:before {
798
+ right: 2px;
799
+ /* left: calc(50% - 2px); */
800
+ left: auto;
801
+ }
802
+ /* Additional styles for a beautiful look */
803
+ .starasia-toggle-slider.starasia-toggle-round {
804
+ border-radius: 34px;
805
+ }
806
+
807
+ .starasia-toggle-slider.starasia-toggle-round:before {
808
+ border-radius: 50%;
809
+ }
810
+ `, Te = "starasia-toggle-styles", vr = (x) => {
811
+ if (!document.getElementById(Te)) {
812
+ const v = document.createElement("style");
813
+ v.id = Te, v.textContent = x, document.head.appendChild(v);
814
+ }
815
+ };
816
+ vr(gr);
817
+ const hr = (x) => {
818
+ const { size: v = "md", label: E, description: b, ..._ } = x;
819
+ return /* @__PURE__ */ S.jsxs(
820
+ "div",
821
+ {
822
+ className: `starasia-toggle-container starasia-toggle-container-${v}`,
823
+ children: [
824
+ /* @__PURE__ */ S.jsxs(
825
+ "label",
826
+ {
827
+ className: `starasia-toggle-switch starasia-toggle-switch-${v}`,
828
+ children: [
829
+ /* @__PURE__ */ S.jsx("input", { type: "checkbox", ..._ }),
830
+ /* @__PURE__ */ S.jsx(
831
+ "span",
832
+ {
833
+ className: `starasia-toggle-slider starasia-toggle-round starasia-toggle-${v}`
834
+ }
835
+ )
836
+ ]
837
+ }
838
+ ),
839
+ E || b ? /* @__PURE__ */ S.jsxs("div", { children: [
840
+ E ? /* @__PURE__ */ S.jsx(
841
+ "label",
842
+ {
843
+ htmlFor: _.id,
844
+ style: {
845
+ display: "block"
846
+ },
847
+ children: E
848
+ }
849
+ ) : null,
850
+ b ? /* @__PURE__ */ S.jsx("p", { children: b }) : null
851
+ ] }) : null
852
+ ]
853
+ }
854
+ );
855
+ };
856
+ export {
857
+ hr as Toggle
858
+ };
@@ -0,0 +1,212 @@
1
+ (function(x,j){typeof exports=="object"&&typeof module<"u"?j(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],j):(x=typeof globalThis<"u"?globalThis:x||self,j(x.Toggle={},x.React))})(this,function(x,j){"use strict";var B={exports:{}},A={};/**
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 ee;function je(){if(ee)return A;ee=1;var _=j,v=Symbol.for("react.element"),R=Symbol.for("react.fragment"),b=Object.prototype.hasOwnProperty,w=_.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,z={key:!0,ref:!0,__self:!0,__source:!0};function I(k,c,P){var p,m={},T=null,L=null;P!==void 0&&(T=""+P),c.key!==void 0&&(T=""+c.key),c.ref!==void 0&&(L=c.ref);for(p in c)b.call(c,p)&&!z.hasOwnProperty(p)&&(m[p]=c[p]);if(k&&k.defaultProps)for(p in c=k.defaultProps,c)m[p]===void 0&&(m[p]=c[p]);return{$$typeof:v,type:k,key:T,ref:L,props:m,_owner:w.current}}return A.Fragment=R,A.jsx=I,A.jsxs=I,A}var W={};/**
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 re;function Pe(){return re||(re=1,process.env.NODE_ENV!=="production"&&function(){var _=j,v=Symbol.for("react.element"),R=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),k=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),L=Symbol.for("react.offscreen"),ne=Symbol.iterator,Fe="@@iterator";function Ae(e){if(e===null||typeof e!="object")return null;var r=ne&&e[ne]||e[Fe];return typeof r=="function"?r:null}var C=_.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function f(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];We("error",e,t)}}function We(e,r,t){{var n=C.ReactDebugCurrentFrame,o=n.getStackAddendum();o!==""&&(r+="%s",t=t.concat([o]));var s=t.map(function(i){return String(i)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,s)}}var Ie=!1,Ye=!1,$e=!1,ze=!1,Le=!1,ae;ae=Symbol.for("react.module.reference");function Me(e){return!!(typeof e=="string"||typeof e=="function"||e===b||e===z||Le||e===w||e===P||e===p||ze||e===L||Ie||Ye||$e||typeof e=="object"&&e!==null&&(e.$$typeof===T||e.$$typeof===m||e.$$typeof===I||e.$$typeof===k||e.$$typeof===c||e.$$typeof===ae||e.getModuleId!==void 0))}function Ve(e,r,t){var n=e.displayName;if(n)return n;var o=r.displayName||r.name||"";return o!==""?t+"("+o+")":t}function ie(e){return e.displayName||"Context"}function y(e){if(e==null)return null;if(typeof e.tag=="number"&&f("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case R:return"Portal";case z:return"Profiler";case w:return"StrictMode";case P:return"Suspense";case p:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case k:var r=e;return ie(r)+".Consumer";case I:var t=e;return ie(t._context)+".Provider";case c:return Ve(e,e.render,"ForwardRef");case m:var n=e.displayName||null;return n!==null?n:y(e.type)||"Memo";case T:{var o=e,s=o._payload,i=o._init;try{return y(i(s))}catch{return null}}}return null}var S=Object.assign,Y=0,oe,se,le,ue,ce,fe,de;function ge(){}ge.__reactDisabledLog=!0;function Ne(){{if(Y===0){oe=console.log,se=console.info,le=console.warn,ue=console.error,ce=console.group,fe=console.groupCollapsed,de=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ge,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Y++}}function Ue(){{if(Y--,Y===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},e,{value:oe}),info:S({},e,{value:se}),warn:S({},e,{value:le}),error:S({},e,{value:ue}),group:S({},e,{value:ce}),groupCollapsed:S({},e,{value:fe}),groupEnd:S({},e,{value:de})})}Y<0&&f("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var J=C.ReactCurrentDispatcher,K;function M(e,r,t){{if(K===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);K=n&&n[1]||""}return`
18
+ `+K+e}}var q=!1,V;{var Be=typeof WeakMap=="function"?WeakMap:Map;V=new Be}function ve(e,r){if(!e||q)return"";{var t=V.get(e);if(t!==void 0)return t}var n;q=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=J.current,J.current=null,Ne();try{if(r){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(g){n=g}Reflect.construct(e,[],i)}else{try{i.call()}catch(g){n=g}e.call(i.prototype)}}else{try{throw Error()}catch(g){n=g}e()}}catch(g){if(g&&n&&typeof g.stack=="string"){for(var a=g.stack.split(`
19
+ `),d=n.stack.split(`
20
+ `),l=a.length-1,u=d.length-1;l>=1&&u>=0&&a[l]!==d[u];)u--;for(;l>=1&&u>=0;l--,u--)if(a[l]!==d[u]){if(l!==1||u!==1)do if(l--,u--,u<0||a[l]!==d[u]){var h=`
21
+ `+a[l].replace(" at new "," at ");return e.displayName&&h.includes("<anonymous>")&&(h=h.replace("<anonymous>",e.displayName)),typeof e=="function"&&V.set(e,h),h}while(l>=1&&u>=0);break}}}finally{q=!1,J.current=s,Ue(),Error.prepareStackTrace=o}var F=e?e.displayName||e.name:"",O=F?M(F):"";return typeof e=="function"&&V.set(e,O),O}function Je(e,r,t){return ve(e,!1)}function Ke(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function N(e,r,t){if(e==null)return"";if(typeof e=="function")return ve(e,Ke(e));if(typeof e=="string")return M(e);switch(e){case P:return M("Suspense");case p:return M("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case c:return Je(e.render);case m:return N(e.type,r,t);case T:{var n=e,o=n._payload,s=n._init;try{return N(s(o),r,t)}catch{}}}return""}var $=Object.prototype.hasOwnProperty,pe={},he=C.ReactDebugCurrentFrame;function U(e){if(e){var r=e._owner,t=N(e.type,e._source,r?r.type:null);he.setExtraStackFrame(t)}else he.setExtraStackFrame(null)}function qe(e,r,t,n,o){{var s=Function.call.bind($);for(var i in e)if(s(e,i)){var a=void 0;try{if(typeof e[i]!="function"){var d=Error((n||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}a=e[i](r,i,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(l){a=l}a&&!(a instanceof Error)&&(U(o),f("%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",t,i,typeof a),U(null)),a instanceof Error&&!(a.message in pe)&&(pe[a.message]=!0,U(o),f("Failed %s type: %s",t,a.message),U(null))}}}var Ge=Array.isArray;function G(e){return Ge(e)}function Xe(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function He(e){try{return be(e),!1}catch{return!0}}function be(e){return""+e}function me(e){if(He(e))return f("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Xe(e)),be(e)}var ye=C.ReactCurrentOwner,Ze={key:!0,ref:!0,__self:!0,__source:!0},xe,Ee;function Qe(e){if($.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function er(e){if($.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function rr(e,r){typeof e.ref=="string"&&ye.current}function tr(e,r){{var t=function(){xe||(xe=!0,f("%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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function nr(e,r){{var t=function(){Ee||(Ee=!0,f("%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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var ar=function(e,r,t,n,o,s,i){var a={$$typeof:v,type:e,key:r,ref:t,props:i,_owner:s};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function ir(e,r,t,n,o){{var s,i={},a=null,d=null;t!==void 0&&(me(t),a=""+t),er(r)&&(me(r.key),a=""+r.key),Qe(r)&&(d=r.ref,rr(r,o));for(s in r)$.call(r,s)&&!Ze.hasOwnProperty(s)&&(i[s]=r[s]);if(e&&e.defaultProps){var l=e.defaultProps;for(s in l)i[s]===void 0&&(i[s]=l[s])}if(a||d){var u=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&tr(i,u),d&&nr(i,u)}return ar(e,a,d,o,n,ye.current,i)}}var X=C.ReactCurrentOwner,_e=C.ReactDebugCurrentFrame;function D(e){if(e){var r=e._owner,t=N(e.type,e._source,r?r.type:null);_e.setExtraStackFrame(t)}else _e.setExtraStackFrame(null)}var H;H=!1;function Z(e){return typeof e=="object"&&e!==null&&e.$$typeof===v}function Re(){{if(X.current){var e=y(X.current.type);if(e)return`
22
+
23
+ Check the render method of \``+e+"`."}return""}}function or(e){return""}var we={};function sr(e){{var r=Re();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
24
+
25
+ Check the top-level render call using <`+t+">.")}return r}}function ke(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=sr(r);if(we[t])return;we[t]=!0;var n="";e&&e._owner&&e._owner!==X.current&&(n=" It was passed a child from "+y(e._owner.type)+"."),D(e),f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),D(null)}}function Te(e,r){{if(typeof e!="object")return;if(G(e))for(var t=0;t<e.length;t++){var n=e[t];Z(n)&&ke(n,r)}else if(Z(e))e._store&&(e._store.validated=!0);else if(e){var o=Ae(e);if(typeof o=="function"&&o!==e.entries)for(var s=o.call(e),i;!(i=s.next()).done;)Z(i.value)&&ke(i.value,r)}}}function lr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===c||r.$$typeof===m))t=r.propTypes;else return;if(t){var n=y(r);qe(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!H){H=!0;var o=y(r);f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",o||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&f("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ur(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){D(e),f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),D(null);break}}e.ref!==null&&(D(e),f("Invalid attribute `ref` supplied to `React.Fragment`."),D(null))}}var Se={};function Oe(e,r,t,n,o,s){{var i=Me(e);if(!i){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" 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 d=or();d?a+=d:a+=Re();var l;e===null?l="null":G(e)?l="array":e!==void 0&&e.$$typeof===v?(l="<"+(y(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,f("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,a)}var u=ir(e,r,t,o,s);if(u==null)return u;if(i){var h=r.children;if(h!==void 0)if(n)if(G(h)){for(var F=0;F<h.length;F++)Te(h[F],e);Object.freeze&&Object.freeze(h)}else f("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 Te(h,e)}if($.call(r,"key")){var O=y(e),g=Object.keys(r).filter(function(pr){return pr!=="key"}),Q=g.length>0?"{key: someKey, "+g.join(": ..., ")+": ...}":"{key: someKey}";if(!Se[O+Q]){var vr=g.length>0?"{"+g.join(": ..., ")+": ...}":"{}";f(`A props object containing a "key" prop is being spread into JSX:
26
+ let props = %s;
27
+ <%s {...props} />
28
+ React keys must be passed directly to JSX without using spread:
29
+ let props = %s;
30
+ <%s key={someKey} {...props} />`,Q,O,vr,O),Se[O+Q]=!0}}return e===b?ur(u):lr(u),u}}function cr(e,r,t){return Oe(e,r,t,!0)}function fr(e,r,t){return Oe(e,r,t,!1)}var dr=fr,gr=cr;W.Fragment=b,W.jsx=dr,W.jsxs=gr}()),W}process.env.NODE_ENV==="production"?B.exports=je():B.exports=Pe();var E=B.exports;const Ce=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
31
+ :root {
32
+ /* toogle root color */
33
+ --starasia-ui-background-toggle-checked: #1e88e5;
34
+ --starasia-ui-background-toggle-checked-hover: #1976d2;
35
+ --starasia-ui-shadow-toggle-checked: 0px 0px 0px 1px rgba(100, 181, 246, 0.28);
36
+
37
+ --starasia-ui-background-toggle-base: rgba(120, 134, 127, 0.2);
38
+ --starasia-ui-shadow-toggle-base: 0px 0px 0px 1px rgba(201, 206, 204, 0.28);
39
+
40
+ --starasia-ui-background-toggle-disable: rgba(120, 134, 127, 0.2);
41
+ }
42
+
43
+ * {
44
+ font-family: "Poppins", serif;
45
+ margin: 0;
46
+ padding: 0;
47
+ }
48
+
49
+ .starasia-toggle-container {
50
+ display: flex;
51
+ flex-direction: row;
52
+ align-items: flex-start;
53
+ }
54
+
55
+ .starasia-toggle-container-lg {
56
+ gap: 16px;
57
+ & label {
58
+ font-size: var(--starasia-ui-fontSizes-lg, 16px);
59
+ font-weight: var(--starasia-ui-fontWeights-medium, 400);
60
+ }
61
+ & p {
62
+ font-size: var(--starasia-ui-fontSizes-lg, 16px);
63
+ font-weight: var(--starasia-ui-fontWeights-normal, 300);
64
+ color: #78867f;
65
+ }
66
+ }
67
+
68
+ .starasia-toggle-container-md {
69
+ gap: 12px;
70
+ & label {
71
+ font-size: var(--starasia-ui-fontSizes-md, 14px);
72
+ font-weight: var(--starasia-ui-fontWeights-medium, 400);
73
+ }
74
+ & p {
75
+ font-size: var(--starasia-ui-fontSizes-md, 14px);
76
+ font-weight: var(--starasia-ui-fontWeights-normal, 300);
77
+ color: #78867f;
78
+ }
79
+ }
80
+ .starasia-toggle-container-sm {
81
+ gap: 12px;
82
+ & label {
83
+ font-size: var(--starasia-ui-fontSizes-sm, 12px);
84
+ font-weight: var(--starasia-ui-fontWeights-medium, 400);
85
+ }
86
+ & p {
87
+ font-size: var(--starasia-ui-fontSizes-sm, 12px);
88
+ font-weight: var(--starasia-ui-fontWeights-normal, 300);
89
+ color: #78867f;
90
+ }
91
+ }
92
+ .starasia-toggle-container-xs {
93
+ gap: 10px;
94
+ & label {
95
+ font-size: var(--starasia-ui-fontSizes-xs, 10px);
96
+ font-weight: var(--starasia-ui-fontWeights-medium, 400);
97
+ }
98
+ & p {
99
+ font-size: var(--starasia-ui-fontSizes-xs, 10px);
100
+ font-weight: var(--starasia-ui-fontWeights-normal, 300);
101
+ color: #78867f;
102
+ }
103
+ }
104
+
105
+ .starasia-toggle-switch {
106
+ position: relative;
107
+ display: inline-block;
108
+ }
109
+
110
+ .starasia-toggle-switch input {
111
+ display: none;
112
+ }
113
+
114
+ .starasia-toggle-switch-xs {
115
+ width: 30px;
116
+ height: 16px;
117
+ }
118
+ .starasia-toggle-switch-sm {
119
+ width: 32px;
120
+ height: 18px;
121
+ }
122
+ .starasia-toggle-switch-md {
123
+ width: 36px;
124
+ height: 20px;
125
+ }
126
+ .starasia-toggle-switch-lg {
127
+ width: 38px;
128
+ height: 22px;
129
+ }
130
+
131
+ .starasia-toggle-slider::before {
132
+ filter: drop-shadow(2px 0px 2px rgba(13, 16, 23, 0.07));
133
+ }
134
+ .starasia-toggle-slider.starasia-toggle-xs::before {
135
+ height: 12px;
136
+ width: 12px;
137
+ }
138
+ .starasia-toggle-slider.starasia-toggle-sm::before {
139
+ height: 14px;
140
+ width: 14px;
141
+ }
142
+ .starasia-toggle-slider.starasia-toggle-md::before {
143
+ height: 16px;
144
+ width: 16px;
145
+ }
146
+ .starasia-toggle-slider.starasia-toggle-lg::before {
147
+ height: 18px;
148
+ width: 18px;
149
+ }
150
+
151
+ .starasia-toggle-slider {
152
+ position: absolute;
153
+ top: 0;
154
+ left: 0;
155
+ right: 0;
156
+ bottom: 0;
157
+ background-color: var(--starasia-ui-background-toggle-base);
158
+ border-radius: 34px;
159
+ cursor: pointer;
160
+ transition: 0.4s;
161
+ }
162
+
163
+ .starasia-toggle-slider:hover {
164
+ box-shadow: var(--starasia-ui-shadow-toggle-base);
165
+ }
166
+
167
+ .starasia-toggle-slider:before {
168
+ position: absolute;
169
+ content: "";
170
+ background-color: #fffeff;
171
+ border-radius: 50%;
172
+ transition: 0.4s;
173
+ bottom: 50%;
174
+ transform: translateY(50%);
175
+ left: 2px;
176
+ }
177
+
178
+ input:checked + .starasia-toggle-slider {
179
+ background-color: var(--starasia-ui-background-toggle-checked);
180
+ /* background-color: var(--starasia-ui-background-active-toggle); */
181
+ }
182
+
183
+ input:checked:hover:not(:disabled) + .starasia-toggle-slider {
184
+ background-color: var(--starasia-ui-background-toggle-checked-hover);
185
+ /* background-color: var(--starasia-ui-background-active-toggle); */
186
+ }
187
+ input:checked:hover:not(:disabled) + .starasia-toggle-slider:hover {
188
+ box-shadow: var(--starasia-ui-shadow-toggle-checked);
189
+ }
190
+
191
+ input:disabled + .starasia-toggle-slider {
192
+ background-color: var(--starasia-ui-background-toggle-disable);
193
+ }
194
+ input:disabled + .starasia-toggle-slider:before {
195
+ background-color: rgba(255, 254, 255, 0.5);
196
+ /* background-color: var(--starasia-ui-background-active-toggle); */
197
+ }
198
+
199
+ input:checked + .starasia-toggle-slider:before {
200
+ right: 2px;
201
+ /* left: calc(50% - 2px); */
202
+ left: auto;
203
+ }
204
+ /* Additional styles for a beautiful look */
205
+ .starasia-toggle-slider.starasia-toggle-round {
206
+ border-radius: 34px;
207
+ }
208
+
209
+ .starasia-toggle-slider.starasia-toggle-round:before {
210
+ border-radius: 50%;
211
+ }
212
+ `,te="starasia-toggle-styles";(_=>{if(!document.getElementById(te)){const v=document.createElement("style");v.id=te,v.textContent=_,document.head.appendChild(v)}})(Ce);const De=_=>{const{size:v="md",label:R,description:b,...w}=_;return E.jsxs("div",{className:`starasia-toggle-container starasia-toggle-container-${v}`,children:[E.jsxs("label",{className:`starasia-toggle-switch starasia-toggle-switch-${v}`,children:[E.jsx("input",{type:"checkbox",...w}),E.jsx("span",{className:`starasia-toggle-slider starasia-toggle-round starasia-toggle-${v}`})]}),R||b?E.jsxs("div",{children:[R?E.jsx("label",{htmlFor:w.id,style:{display:"block"},children:R}):null,b?E.jsx("p",{children:b}):null]}):null]})};x.Toggle=De,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,5 @@
1
+ export interface ToggleProps extends Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "size"> {
2
+ size?: "xs" | "sm" | "md" | "lg";
3
+ label?: string;
4
+ description?: string;
5
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@starasia/toggle",
3
+ "version": "1.0.0",
4
+ "description": "toggle component for starasia UI",
5
+ "author": "Prawito Hudoro",
6
+ "main": "dist/toggle.umd.js",
7
+ "module": "dist/toggle.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.16",
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
+ }