@starasia/toggle 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Toggle.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { default as React } from 'react';
2
- import { ToggleProps } from './types';
3
-
1
+ import React from "react";
2
+ import { ToggleProps } from "./types";
4
3
  export declare const Toggle: React.FC<ToggleProps>;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { Toggle } from './Toggle';
2
- export * from './types';
1
+ export { Toggle } from "./Toggle";
2
+ export * from "./types";
package/dist/toggle.es.js CHANGED
@@ -1,631 +1,5 @@
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");
1
+ import { jsxs as e, jsx as n } from "react/jsx-runtime";
2
+ const g = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
629
3
  :root {
630
4
  /* toogle root color */
631
5
  --starasia-ui-background-toggle-checked: #1e88e5;
@@ -807,52 +181,52 @@ input:checked + .starasia-toggle-slider:before {
807
181
  .starasia-toggle-slider.starasia-toggle-round:before {
808
182
  border-radius: 50%;
809
183
  }
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);
184
+ `, r = "starasia-toggle-styles", l = (t) => {
185
+ if (!document.getElementById(r)) {
186
+ const a = document.createElement("style");
187
+ a.id = r, a.textContent = t, document.head.appendChild(a);
814
188
  }
815
189
  };
816
- vr(gr);
817
- const hr = (x) => {
818
- const { size: v = "md", label: E, description: b, ..._ } = x;
819
- return /* @__PURE__ */ S.jsxs(
190
+ l(g);
191
+ const c = (t) => {
192
+ const { size: a = "md", label: s, description: i, ...o } = t;
193
+ return /* @__PURE__ */ e(
820
194
  "div",
821
195
  {
822
- className: `starasia-toggle-container starasia-toggle-container-${v}`,
196
+ className: `starasia-toggle-container starasia-toggle-container-${a}`,
823
197
  children: [
824
- /* @__PURE__ */ S.jsxs(
198
+ /* @__PURE__ */ e(
825
199
  "label",
826
200
  {
827
- className: `starasia-toggle-switch starasia-toggle-switch-${v}`,
201
+ className: `starasia-toggle-switch starasia-toggle-switch-${a}`,
828
202
  children: [
829
- /* @__PURE__ */ S.jsx("input", { type: "checkbox", ..._ }),
830
- /* @__PURE__ */ S.jsx(
203
+ /* @__PURE__ */ n("input", { type: "checkbox", ...o }),
204
+ /* @__PURE__ */ n(
831
205
  "span",
832
206
  {
833
- className: `starasia-toggle-slider starasia-toggle-round starasia-toggle-${v}`
207
+ className: `starasia-toggle-slider starasia-toggle-round starasia-toggle-${a}`
834
208
  }
835
209
  )
836
210
  ]
837
211
  }
838
212
  ),
839
- E || b ? /* @__PURE__ */ S.jsxs("div", { children: [
840
- E ? /* @__PURE__ */ S.jsx(
213
+ s || i ? /* @__PURE__ */ e("div", { children: [
214
+ s ? /* @__PURE__ */ n(
841
215
  "label",
842
216
  {
843
- htmlFor: _.id,
217
+ htmlFor: o.id,
844
218
  style: {
845
219
  display: "block"
846
220
  },
847
- children: E
221
+ children: s
848
222
  }
849
223
  ) : null,
850
- b ? /* @__PURE__ */ S.jsx("p", { children: b }) : null
224
+ i ? /* @__PURE__ */ n("p", { children: i }) : null
851
225
  ] }) : null
852
226
  ]
853
227
  }
854
228
  );
855
229
  };
856
230
  export {
857
- hr as Toggle
231
+ c as Toggle
858
232
  };
@@ -1,33 +1,4 @@
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");
1
+ (function(n,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime"],a):(n=typeof globalThis<"u"?globalThis:n||self,a(n.Toggle={},n.jsxRuntime))})(this,function(n,a){"use strict";const g=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
31
2
  :root {
32
3
  /* toogle root color */
33
4
  --starasia-ui-background-toggle-checked: #1e88e5;
@@ -209,4 +180,4 @@ input:checked + .starasia-toggle-slider:before {
209
180
  .starasia-toggle-slider.starasia-toggle-round:before {
210
181
  border-radius: 50%;
211
182
  }
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"})});
183
+ `,o="starasia-toggle-styles";(s=>{if(!document.getElementById(o)){const t=document.createElement("style");t.id=o,t.textContent=s,document.head.appendChild(t)}})(g);const l=s=>{const{size:t="md",label:e,description:i,...r}=s;return a.jsxs("div",{className:`starasia-toggle-container starasia-toggle-container-${t}`,children:[a.jsxs("label",{className:`starasia-toggle-switch starasia-toggle-switch-${t}`,children:[a.jsx("input",{type:"checkbox",...r}),a.jsx("span",{className:`starasia-toggle-slider starasia-toggle-round starasia-toggle-${t}`})]}),e||i?a.jsxs("div",{children:[e?a.jsx("label",{htmlFor:r.id,style:{display:"block"},children:e}):null,i?a.jsx("p",{children:i}):null]}):null]})};n.Toggle=l,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starasia/toggle",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "toggle component for starasia UI",
5
5
  "author": "Prawito Hudoro",
6
6
  "main": "dist/toggle.umd.js",
@@ -12,16 +12,16 @@
12
12
  "dist/*.map",
13
13
  "dist/*.css"
14
14
  ],
15
- "scripts": {
16
- "dev": "vite --config vite.config.ts --port 3000",
17
- "build": "vite build --config vite.config.ts"
18
- },
19
15
  "keywords": [],
20
16
  "license": "ISC",
21
17
  "type": "module",
22
18
  "engines": {
23
19
  "node": ">=18.0.0"
24
20
  },
21
+ "peerDependencies": {
22
+ "react": ">=18.0.0 <20.0.0",
23
+ "react-dom": ">=18.0.0 <20.0.0"
24
+ },
25
25
  "devDependencies": {
26
26
  "@types/node": "^20.11.16",
27
27
  "@vitejs/plugin-react": "^4.2.1",
@@ -33,5 +33,9 @@
33
33
  "react-dom": "^18.2.0",
34
34
  "@types/react": "^18.2.55",
35
35
  "@types/react-dom": "^18.2.19"
36
+ },
37
+ "scripts": {
38
+ "dev": "vite --config vite.config.ts --port 3000",
39
+ "build": "vite build --config vite.config.ts"
36
40
  }
37
- }
41
+ }