@drjoshcsimmons/scl 0.1.12 → 0.1.14

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.
Files changed (123) hide show
  1. package/dist/index100.js +12 -47
  2. package/dist/index101.js +8 -54
  3. package/dist/index102.js +30 -11
  4. package/dist/index103.js +4 -30
  5. package/dist/index104.js +24 -12
  6. package/dist/index105.js +6 -30
  7. package/dist/index107.js +1 -1
  8. package/dist/index108.js +30 -650
  9. package/dist/index109.js +1 -1
  10. package/dist/index11.js +2 -2
  11. package/dist/index110.js +647 -27
  12. package/dist/index112.js +14 -8
  13. package/dist/index113.js +11 -47
  14. package/dist/index114.js +200 -42
  15. package/dist/index115.js +21 -20
  16. package/dist/index116.js +400 -9
  17. package/dist/index117.js +48 -38
  18. package/dist/index118.js +48 -18
  19. package/dist/index119.js +21 -12
  20. package/dist/index12.js +1 -1
  21. package/dist/index120.js +9 -206
  22. package/dist/index121.js +37 -21
  23. package/dist/index122.js +17 -399
  24. package/dist/index124.js +1 -1
  25. package/dist/index126.js +3 -3
  26. package/dist/index127.js +3 -3
  27. package/dist/index129.js +1 -1
  28. package/dist/index13.js +2 -2
  29. package/dist/index130.js +1 -1
  30. package/dist/index131.js +5 -2
  31. package/dist/index132.js +3 -2
  32. package/dist/index133.js +24 -5
  33. package/dist/index134.js +113 -3
  34. package/dist/index135.js +15 -23
  35. package/dist/index136.js +519 -107
  36. package/dist/index137.js +126 -14
  37. package/dist/index138.js +125 -516
  38. package/dist/index139.js +2 -128
  39. package/dist/index14.js +2 -2
  40. package/dist/index140.js +2 -134
  41. package/dist/index141.js +69 -65
  42. package/dist/index142.js +8 -68
  43. package/dist/index143.js +14 -9
  44. package/dist/index144.js +66 -14
  45. package/dist/index145.js +64 -65
  46. package/dist/index15.js +2 -2
  47. package/dist/index17.js +4 -4
  48. package/dist/index18.js +2 -2
  49. package/dist/index20.js +2 -2
  50. package/dist/index21.js +1 -1
  51. package/dist/index22.js +1 -1
  52. package/dist/index23.js +2 -2
  53. package/dist/index24.js +1 -1
  54. package/dist/index25.js +4 -4
  55. package/dist/index26.js +1 -1
  56. package/dist/index27.js +3 -3
  57. package/dist/index29.js +1 -1
  58. package/dist/index31.js +1 -1
  59. package/dist/index33.js +1 -1
  60. package/dist/index36.js +2 -2
  61. package/dist/index37.js +1 -1
  62. package/dist/index4.js +2 -2
  63. package/dist/index45.js +33 -237
  64. package/dist/index46.js +241 -11
  65. package/dist/index47.js +212 -211
  66. package/dist/index48.js +4 -4
  67. package/dist/index49.js +246 -104
  68. package/dist/index5.js +1 -1
  69. package/dist/index50.js +12 -33
  70. package/dist/index51.js +509 -109
  71. package/dist/index52.js +20 -433
  72. package/dist/index53.js +158 -57
  73. package/dist/index54.js +66 -247
  74. package/dist/index55.js +334 -16
  75. package/dist/index56.js +236 -31
  76. package/dist/index57.js +11 -310
  77. package/dist/index58.js +82 -12
  78. package/dist/index59.js +221 -232
  79. package/dist/index6.js +1 -1
  80. package/dist/index60.js +3 -6
  81. package/dist/index61.js +112 -143
  82. package/dist/index62.js +16 -247
  83. package/dist/index63.js +860 -9
  84. package/dist/index64.js +9 -241
  85. package/dist/index65.js +30 -72
  86. package/dist/index66.js +433 -20
  87. package/dist/index67.js +53 -75
  88. package/dist/index68.js +102 -209
  89. package/dist/index69.js +225 -11
  90. package/dist/index7.js +1 -1
  91. package/dist/index70.js +4 -5
  92. package/dist/index71.js +12 -860
  93. package/dist/index72.js +125 -9
  94. package/dist/index73.js +283 -503
  95. package/dist/index74.js +12 -125
  96. package/dist/index75.js +241 -323
  97. package/dist/index76.js +5 -66
  98. package/dist/index77.js +25 -44
  99. package/dist/index78.js +64 -23
  100. package/dist/index79.js +123 -5
  101. package/dist/index8.js +1 -1
  102. package/dist/index80.js +13 -50
  103. package/dist/index81.js +133 -32
  104. package/dist/index82.js +1 -1
  105. package/dist/index83.js +218 -7
  106. package/dist/index84.js +14 -181
  107. package/dist/index85.js +67 -23
  108. package/dist/index86.js +33 -5
  109. package/dist/index87.js +42 -63
  110. package/dist/index88.js +52 -4
  111. package/dist/index89.js +50 -4
  112. package/dist/index9.js +2 -2
  113. package/dist/index90.js +9 -30
  114. package/dist/index91.js +45 -14
  115. package/dist/index92.js +7 -124
  116. package/dist/index93.js +40 -127
  117. package/dist/index94.js +30 -14
  118. package/dist/index95.js +179 -13
  119. package/dist/index96.js +55 -9
  120. package/dist/index97.js +11 -50
  121. package/dist/index98.js +4 -48
  122. package/dist/index99.js +30 -219
  123. package/package.json +1 -1
package/dist/index61.js CHANGED
@@ -1,163 +1,132 @@
1
- import * as v from "react";
2
- import { composeEventHandlers as g } from "./index79.js";
3
- import { createContextScope as x } from "./index76.js";
4
- import { createRovingFocusGroupScope as C, Root as E, Item as F } from "./index84.js";
5
- import { Presence as w } from "./index87.js";
6
- import { Primitive as b } from "./index81.js";
7
- import { useDirection as D } from "./index83.js";
8
- import { useControllableState as V } from "./index80.js";
9
- import { useId as G } from "./index82.js";
10
- import { jsx as l } from "react/jsx-runtime";
11
- var p = "Tabs", [L] = x(p, [
12
- C
13
- ]), h = C(), [$, T] = L(p), I = v.forwardRef(
14
- (e, r) => {
1
+ import * as r from "react";
2
+ import { composeEventHandlers as T } from "./index76.js";
3
+ import { useComposedRefs as P } from "./index77.js";
4
+ import { createContextScope as I } from "./index78.js";
5
+ import { useControllableState as M } from "./index88.js";
6
+ import { usePrevious as H } from "./index105.js";
7
+ import { useSize as j } from "./index104.js";
8
+ import { Primitive as y } from "./index86.js";
9
+ import { jsxs as A, jsx as m } from "react/jsx-runtime";
10
+ var h = "Switch", [U] = I(h), [q, z] = U(h), R = r.forwardRef(
11
+ (t, a) => {
15
12
  const {
16
- __scopeTabs: s,
17
- value: t,
18
- onValueChange: n,
19
- defaultValue: c,
20
- orientation: o = "horizontal",
21
- dir: d,
22
- activationMode: f = "automatic",
23
- ...m
24
- } = e, i = D(d), [a, u] = V({
25
- prop: t,
26
- onChange: n,
27
- defaultProp: c ?? "",
28
- caller: p
13
+ __scopeSwitch: e,
14
+ name: c,
15
+ checked: o,
16
+ defaultChecked: v,
17
+ required: i,
18
+ disabled: n,
19
+ value: p = "on",
20
+ onCheckedChange: w,
21
+ form: s,
22
+ ...S
23
+ } = t, [d, u] = r.useState(null), b = P(a, (f) => u(f)), C = r.useRef(!1), k = d ? s || !!d.closest("form") : !0, [l, B] = M({
24
+ prop: o,
25
+ defaultProp: v ?? !1,
26
+ onChange: w,
27
+ caller: h
29
28
  });
30
- return /* @__PURE__ */ l(
31
- $,
32
- {
33
- scope: s,
34
- baseId: G(),
35
- value: a,
36
- onValueChange: u,
37
- orientation: o,
38
- dir: i,
39
- activationMode: f,
40
- children: /* @__PURE__ */ l(
41
- b.div,
42
- {
43
- dir: i,
44
- "data-orientation": o,
45
- ...m,
46
- ref: r
47
- }
48
- )
49
- }
50
- );
29
+ return /* @__PURE__ */ A(q, { scope: e, checked: l, disabled: n, children: [
30
+ /* @__PURE__ */ m(
31
+ y.button,
32
+ {
33
+ type: "button",
34
+ role: "switch",
35
+ "aria-checked": l,
36
+ "aria-required": i,
37
+ "data-state": g(l),
38
+ "data-disabled": n ? "" : void 0,
39
+ disabled: n,
40
+ value: p,
41
+ ...S,
42
+ ref: b,
43
+ onClick: T(t.onClick, (f) => {
44
+ B((N) => !N), k && (C.current = f.isPropagationStopped(), C.current || f.stopPropagation());
45
+ })
46
+ }
47
+ ),
48
+ k && /* @__PURE__ */ m(
49
+ x,
50
+ {
51
+ control: d,
52
+ bubbles: !C.current,
53
+ name: c,
54
+ value: p,
55
+ checked: l,
56
+ required: i,
57
+ disabled: n,
58
+ form: s,
59
+ style: { transform: "translateX(-100%)" }
60
+ }
61
+ )
62
+ ] });
51
63
  }
52
64
  );
53
- I.displayName = p;
54
- var R = "TabsList", _ = v.forwardRef(
55
- (e, r) => {
56
- const { __scopeTabs: s, loop: t = !0, ...n } = e, c = T(R, s), o = h(s);
57
- return /* @__PURE__ */ l(
58
- E,
65
+ R.displayName = h;
66
+ var E = "SwitchThumb", _ = r.forwardRef(
67
+ (t, a) => {
68
+ const { __scopeSwitch: e, ...c } = t, o = z(E, e);
69
+ return /* @__PURE__ */ m(
70
+ y.span,
59
71
  {
60
- asChild: !0,
61
- ...o,
62
- orientation: c.orientation,
63
- dir: c.dir,
64
- loop: t,
65
- children: /* @__PURE__ */ l(
66
- b.div,
67
- {
68
- role: "tablist",
69
- "aria-orientation": c.orientation,
70
- ...n,
71
- ref: r
72
- }
73
- )
72
+ "data-state": g(o.checked),
73
+ "data-disabled": o.disabled ? "" : void 0,
74
+ ...c,
75
+ ref: a
74
76
  }
75
77
  );
76
78
  }
77
79
  );
78
- _.displayName = R;
79
- var y = "TabsTrigger", A = v.forwardRef(
80
- (e, r) => {
81
- const { __scopeTabs: s, value: t, disabled: n = !1, ...c } = e, o = T(y, s), d = h(s), f = P(o.baseId, t), m = S(o.baseId, t), i = t === o.value;
82
- return /* @__PURE__ */ l(
83
- F,
84
- {
85
- asChild: !0,
86
- ...d,
87
- focusable: !n,
88
- active: i,
89
- children: /* @__PURE__ */ l(
90
- b.button,
91
- {
92
- type: "button",
93
- role: "tab",
94
- "aria-selected": i,
95
- "aria-controls": m,
96
- "data-state": i ? "active" : "inactive",
97
- "data-disabled": n ? "" : void 0,
98
- disabled: n,
99
- id: f,
100
- ...c,
101
- ref: r,
102
- onMouseDown: g(e.onMouseDown, (a) => {
103
- !n && a.button === 0 && a.ctrlKey === !1 ? o.onValueChange(t) : a.preventDefault();
104
- }),
105
- onKeyDown: g(e.onKeyDown, (a) => {
106
- [" ", "Enter"].includes(a.key) && o.onValueChange(t);
107
- }),
108
- onFocus: g(e.onFocus, () => {
109
- const a = o.activationMode !== "manual";
110
- !i && !n && a && o.onValueChange(t);
111
- })
112
- }
113
- )
80
+ _.displayName = E;
81
+ var L = "SwitchBubbleInput", x = r.forwardRef(
82
+ ({
83
+ __scopeSwitch: t,
84
+ control: a,
85
+ checked: e,
86
+ bubbles: c = !0,
87
+ ...o
88
+ }, v) => {
89
+ const i = r.useRef(null), n = P(i, v), p = H(e), w = j(a);
90
+ return r.useEffect(() => {
91
+ const s = i.current;
92
+ if (!s) return;
93
+ const S = window.HTMLInputElement.prototype, u = Object.getOwnPropertyDescriptor(
94
+ S,
95
+ "checked"
96
+ ).set;
97
+ if (p !== e && u) {
98
+ const b = new Event("click", { bubbles: c });
99
+ u.call(s, e), s.dispatchEvent(b);
114
100
  }
115
- );
116
- }
117
- );
118
- A.displayName = y;
119
- var M = "TabsContent", N = v.forwardRef(
120
- (e, r) => {
121
- const { __scopeTabs: s, value: t, forceMount: n, children: c, ...o } = e, d = T(M, s), f = P(d.baseId, t), m = S(d.baseId, t), i = t === d.value, a = v.useRef(i);
122
- return v.useEffect(() => {
123
- const u = requestAnimationFrame(() => a.current = !1);
124
- return () => cancelAnimationFrame(u);
125
- }, []), /* @__PURE__ */ l(w, { present: n || i, children: ({ present: u }) => /* @__PURE__ */ l(
126
- b.div,
101
+ }, [p, e, c]), /* @__PURE__ */ m(
102
+ "input",
127
103
  {
128
- "data-state": i ? "active" : "inactive",
129
- "data-orientation": d.orientation,
130
- role: "tabpanel",
131
- "aria-labelledby": f,
132
- hidden: !u,
133
- id: m,
134
- tabIndex: 0,
104
+ type: "checkbox",
105
+ "aria-hidden": !0,
106
+ defaultChecked: e,
135
107
  ...o,
136
- ref: r,
108
+ tabIndex: -1,
109
+ ref: n,
137
110
  style: {
138
- ...e.style,
139
- animationDuration: a.current ? "0s" : void 0
140
- },
141
- children: u && c
111
+ ...o.style,
112
+ ...w,
113
+ position: "absolute",
114
+ pointerEvents: "none",
115
+ opacity: 0,
116
+ margin: 0
117
+ }
142
118
  }
143
- ) });
119
+ );
144
120
  }
145
121
  );
146
- N.displayName = M;
147
- function P(e, r) {
148
- return `${e}-trigger-${r}`;
149
- }
150
- function S(e, r) {
151
- return `${e}-content-${r}`;
122
+ x.displayName = L;
123
+ function g(t) {
124
+ return t ? "checked" : "unchecked";
152
125
  }
153
- var Q = I, U = _, W = A, X = N;
126
+ var Q = R, V = _;
154
127
  export {
155
- X as Content,
156
- U as List,
157
128
  Q as Root,
158
- I as Tabs,
159
- N as TabsContent,
160
- _ as TabsList,
161
- A as TabsTrigger,
162
- W as Trigger
129
+ R as Switch,
130
+ _ as SwitchThumb,
131
+ V as Thumb
163
132
  };
package/dist/index62.js CHANGED
@@ -1,251 +1,20 @@
1
- import * as s from "react";
2
- import { useComposedRefs as B } from "./index78.js";
3
- import { createContextScope as L } from "./index76.js";
4
- import { composeEventHandlers as S } from "./index79.js";
5
- import { useControllableState as O } from "./index80.js";
6
- import { usePrevious as j } from "./index86.js";
7
- import { useSize as H } from "./index85.js";
8
- import { Presence as z } from "./index87.js";
9
- import { Primitive as P } from "./index81.js";
10
- import { jsx as b, jsxs as G, Fragment as K } from "react/jsx-runtime";
11
- var g = "Checkbox", [U] = L(g), [X, E] = U(g);
12
- function J(t) {
13
- const {
14
- __scopeCheckbox: a,
15
- checked: c,
16
- children: u,
17
- defaultChecked: r,
18
- disabled: e,
19
- form: p,
20
- name: f,
21
- onCheckedChange: i,
22
- required: m,
23
- value: C = "on",
24
- // @ts-expect-error
25
- internal_do_not_use_render: d
26
- } = t, [l, v] = O({
27
- prop: c,
28
- defaultProp: r ?? !1,
29
- onChange: i,
30
- caller: g
31
- }), [k, x] = s.useState(null), [_, o] = s.useState(null), n = s.useRef(!1), I = k ? !!p || !!k.closest("form") : (
32
- // We set this to true by default so that events bubble to forms without JS (SSR)
33
- !0
34
- ), R = {
35
- checked: l,
36
- disabled: e,
37
- setChecked: v,
38
- control: k,
39
- setControl: x,
40
- name: f,
41
- form: p,
42
- value: C,
43
- hasConsumerStoppedPropagationRef: n,
44
- required: m,
45
- defaultChecked: h(r) ? !1 : r,
46
- isFormControl: I,
47
- bubbleInput: _,
48
- setBubbleInput: o
49
- };
50
- return /* @__PURE__ */ b(
51
- X,
52
- {
53
- scope: a,
54
- ...R,
55
- children: W(d) ? d(R) : u
1
+ import * as i from "react";
2
+ import { Primitive as f } from "./index108.js";
3
+ import { jsx as l } from "react/jsx-runtime";
4
+ var m = "Label", r = i.forwardRef((e, o) => /* @__PURE__ */ l(
5
+ f.label,
6
+ {
7
+ ...e,
8
+ ref: o,
9
+ onMouseDown: (t) => {
10
+ var a;
11
+ t.target.closest("button, input, select, textarea") || ((a = e.onMouseDown) == null || a.call(e, t), !t.defaultPrevented && t.detail > 1 && t.preventDefault());
56
12
  }
57
- );
58
- }
59
- var N = "CheckboxTrigger", w = s.forwardRef(
60
- ({ __scopeCheckbox: t, onKeyDown: a, onClick: c, ...u }, r) => {
61
- const {
62
- control: e,
63
- value: p,
64
- disabled: f,
65
- checked: i,
66
- required: m,
67
- setControl: C,
68
- setChecked: d,
69
- hasConsumerStoppedPropagationRef: l,
70
- isFormControl: v,
71
- bubbleInput: k
72
- } = E(N, t), x = B(r, C), _ = s.useRef(i);
73
- return s.useEffect(() => {
74
- const o = e == null ? void 0 : e.form;
75
- if (o) {
76
- const n = () => d(_.current);
77
- return o.addEventListener("reset", n), () => o.removeEventListener("reset", n);
78
- }
79
- }, [e, d]), /* @__PURE__ */ b(
80
- P.button,
81
- {
82
- type: "button",
83
- role: "checkbox",
84
- "aria-checked": h(i) ? "mixed" : i,
85
- "aria-required": m,
86
- "data-state": A(i),
87
- "data-disabled": f ? "" : void 0,
88
- disabled: f,
89
- value: p,
90
- ...u,
91
- ref: x,
92
- onKeyDown: S(a, (o) => {
93
- o.key === "Enter" && o.preventDefault();
94
- }),
95
- onClick: S(c, (o) => {
96
- d((n) => h(n) ? !0 : !n), k && v && (l.current = o.isPropagationStopped(), l.current || o.stopPropagation());
97
- })
98
- }
99
- );
100
13
  }
101
- );
102
- w.displayName = N;
103
- var Q = s.forwardRef(
104
- (t, a) => {
105
- const {
106
- __scopeCheckbox: c,
107
- name: u,
108
- checked: r,
109
- defaultChecked: e,
110
- required: p,
111
- disabled: f,
112
- value: i,
113
- onCheckedChange: m,
114
- form: C,
115
- ...d
116
- } = t;
117
- return /* @__PURE__ */ b(
118
- J,
119
- {
120
- __scopeCheckbox: c,
121
- checked: r,
122
- defaultChecked: e,
123
- disabled: f,
124
- required: p,
125
- onCheckedChange: m,
126
- name: u,
127
- form: C,
128
- value: i,
129
- internal_do_not_use_render: ({ isFormControl: l }) => /* @__PURE__ */ G(K, { children: [
130
- /* @__PURE__ */ b(
131
- w,
132
- {
133
- ...d,
134
- ref: a,
135
- __scopeCheckbox: c
136
- }
137
- ),
138
- l && /* @__PURE__ */ b(
139
- q,
140
- {
141
- __scopeCheckbox: c
142
- }
143
- )
144
- ] })
145
- }
146
- );
147
- }
148
- );
149
- Q.displayName = g;
150
- var T = "CheckboxIndicator", V = s.forwardRef(
151
- (t, a) => {
152
- const { __scopeCheckbox: c, forceMount: u, ...r } = t, e = E(T, c);
153
- return /* @__PURE__ */ b(
154
- z,
155
- {
156
- present: u || h(e.checked) || e.checked === !0,
157
- children: /* @__PURE__ */ b(
158
- P.span,
159
- {
160
- "data-state": A(e.checked),
161
- "data-disabled": e.disabled ? "" : void 0,
162
- ...r,
163
- ref: a,
164
- style: { pointerEvents: "none", ...t.style }
165
- }
166
- )
167
- }
168
- );
169
- }
170
- );
171
- V.displayName = T;
172
- var M = "CheckboxBubbleInput", q = s.forwardRef(
173
- ({ __scopeCheckbox: t, ...a }, c) => {
174
- const {
175
- control: u,
176
- hasConsumerStoppedPropagationRef: r,
177
- checked: e,
178
- defaultChecked: p,
179
- required: f,
180
- disabled: i,
181
- name: m,
182
- value: C,
183
- form: d,
184
- bubbleInput: l,
185
- setBubbleInput: v
186
- } = E(M, t), k = B(c, v), x = j(e), _ = H(u);
187
- s.useEffect(() => {
188
- const n = l;
189
- if (!n) return;
190
- const I = window.HTMLInputElement.prototype, y = Object.getOwnPropertyDescriptor(
191
- I,
192
- "checked"
193
- ).set, D = !r.current;
194
- if (x !== e && y) {
195
- const F = new Event("click", { bubbles: D });
196
- n.indeterminate = h(e), y.call(n, h(e) ? !1 : e), n.dispatchEvent(F);
197
- }
198
- }, [l, x, e, r]);
199
- const o = s.useRef(h(e) ? !1 : e);
200
- return /* @__PURE__ */ b(
201
- P.input,
202
- {
203
- type: "checkbox",
204
- "aria-hidden": !0,
205
- defaultChecked: p ?? o.current,
206
- required: f,
207
- disabled: i,
208
- name: m,
209
- value: C,
210
- form: d,
211
- ...a,
212
- tabIndex: -1,
213
- ref: k,
214
- style: {
215
- ...a.style,
216
- ..._,
217
- position: "absolute",
218
- pointerEvents: "none",
219
- opacity: 0,
220
- margin: 0,
221
- // We transform because the input is absolutely positioned but we have
222
- // rendered it **after** the button. This pulls it back to sit on top
223
- // of the button.
224
- transform: "translateX(-100%)"
225
- }
226
- }
227
- );
228
- }
229
- );
230
- q.displayName = M;
231
- function W(t) {
232
- return typeof t == "function";
233
- }
234
- function h(t) {
235
- return t === "indeterminate";
236
- }
237
- function A(t) {
238
- return h(t) ? "indeterminate" : t ? "checked" : "unchecked";
239
- }
14
+ ));
15
+ r.displayName = m;
16
+ var b = r;
240
17
  export {
241
- Q as Checkbox,
242
- V as CheckboxIndicator,
243
- V as Indicator,
244
- Q as Root,
245
- q as unstable_BubbleInput,
246
- q as unstable_CheckboxBubbleInput,
247
- J as unstable_CheckboxProvider,
248
- w as unstable_CheckboxTrigger,
249
- J as unstable_Provider,
250
- w as unstable_Trigger
18
+ r as Label,
19
+ b as Root
251
20
  };