@bekk-basen/neutral-ui-do-not-use 0.0.0-pr.24.00fbebe

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1333 @@
1
+ import { jsx as x, jsxs as he, Fragment as on } from "react/jsx-runtime";
2
+ import { Button as rn } from "@base-ui/react/button";
3
+ import { cva as Be } from "class-variance-authority";
4
+ import { clsx as X } from "clsx";
5
+ import { Checkbox as We } from "@base-ui/react/checkbox";
6
+ import { Check as Gn } from "lucide-react";
7
+ import * as s from "react";
8
+ import { createElement as ze, useState as jn } from "react";
9
+ const Hn = "bnui-base-wpVVq", Wn = "bnui-primary-OKCHe", zn = "bnui-secondary-dazFR", qn = "bnui-lg-WgiKr", Yn = "bnui-sm-0Kb5B", Zn = "bnui-iconOnly-LsvO8", Jn = "bnui-content-q0g4H", Xn = "bnui-pending-xP-rH", Qn = "bnui-spinner-jLkEm", B = {
10
+ base: Hn,
11
+ primary: Wn,
12
+ secondary: zn,
13
+ lg: qn,
14
+ sm: Yn,
15
+ iconOnly: Zn,
16
+ content: Jn,
17
+ pending: Xn,
18
+ spinner: Qn
19
+ }, et = Be(B.base, {
20
+ variants: {
21
+ variant: {
22
+ primary: B.primary,
23
+ secondary: B.secondary
24
+ },
25
+ size: {
26
+ lg: B.lg,
27
+ sm: B.sm
28
+ },
29
+ iconOnly: {
30
+ true: B.iconOnly,
31
+ false: ""
32
+ }
33
+ },
34
+ defaultVariants: {
35
+ variant: "primary",
36
+ size: "sm",
37
+ iconOnly: !1
38
+ }
39
+ });
40
+ function Vo({
41
+ className: e,
42
+ variant: n,
43
+ size: t,
44
+ iconOnly: r,
45
+ isPending: o,
46
+ disabled: i,
47
+ children: a,
48
+ ...d
49
+ }) {
50
+ return /* @__PURE__ */ x(
51
+ rn,
52
+ {
53
+ "data-slot": "button",
54
+ disabled: o || i,
55
+ "aria-busy": o,
56
+ className: X(
57
+ et({ variant: n, size: t, iconOnly: r }),
58
+ o && B.pending,
59
+ e
60
+ ),
61
+ ...d,
62
+ children: o ? /* @__PURE__ */ he(on, { children: [
63
+ /* @__PURE__ */ x("span", { className: B.content, children: a }),
64
+ /* @__PURE__ */ x("span", { className: B.spinner, "aria-hidden": "true" })
65
+ ] }) : a
66
+ }
67
+ );
68
+ }
69
+ const nt = "bnui-headline-6c9bn", tt = "bnui-button-lekqm", ot = "bnui-body-2BdnA", rt = "bnui-description-6roeu", g = {
70
+ headline: nt,
71
+ "headline-sm": "bnui-headline-sm-eesRr",
72
+ "headline-xs": "bnui-headline-xs-bBHXL",
73
+ button: tt,
74
+ "body-bold": "bnui-body-bold-0cir6",
75
+ body: ot,
76
+ "body-sm-bold": "bnui-body-sm-bold-9SPZK",
77
+ "body-sm": "bnui-body-sm-MOXMI",
78
+ description: rt,
79
+ "color-default": "bnui-color-default-38dch",
80
+ "color-white": "bnui-color-white-d9q0c",
81
+ "color-background": "bnui-color-background-Flq4G",
82
+ "color-surface": "bnui-color-surface-80oSA",
83
+ "color-divider-dark": "bnui-color-divider-dark-lGQki",
84
+ "color-informative": "bnui-color-informative-xAFpg",
85
+ "color-error": "bnui-color-error-jEnPS",
86
+ "color-warning": "bnui-color-warning-6lm-Z",
87
+ "color-success": "bnui-color-success-ThRnA",
88
+ "color-info": "bnui-color-info-PtkS-",
89
+ "color-interactive": "bnui-color-interactive-b9cqS"
90
+ }, it = Be("", {
91
+ variants: {
92
+ variant: {
93
+ headline: g.headline,
94
+ "headline-sm": g["headline-sm"],
95
+ "headline-xs": g["headline-xs"],
96
+ button: g.button,
97
+ "body-bold": g["body-bold"],
98
+ body: g.body,
99
+ "body-sm-bold": g["body-sm-bold"],
100
+ "body-sm": g["body-sm"],
101
+ description: g.description
102
+ },
103
+ color: {
104
+ default: g["color-default"],
105
+ white: g["color-white"],
106
+ background: g["color-background"],
107
+ surface: g["color-surface"],
108
+ "divider-dark": g["color-divider-dark"],
109
+ informative: g["color-informative"],
110
+ error: g["color-error"],
111
+ warning: g["color-warning"],
112
+ success: g["color-success"],
113
+ info: g["color-info"],
114
+ interactive: g["color-interactive"],
115
+ inherit: ""
116
+ }
117
+ },
118
+ defaultVariants: {
119
+ variant: "body",
120
+ color: "default"
121
+ }
122
+ }), st = {
123
+ headline: "h1",
124
+ "headline-sm": "h2",
125
+ "headline-xs": "h3",
126
+ body: "p",
127
+ "body-bold": "p",
128
+ "body-sm": "p",
129
+ "body-sm-bold": "p",
130
+ description: "p",
131
+ button: "span"
132
+ };
133
+ function at({
134
+ variant: e = "body",
135
+ color: n,
136
+ as: t,
137
+ className: r,
138
+ ...o
139
+ }) {
140
+ const i = t ?? st[e];
141
+ return /* @__PURE__ */ x(
142
+ i,
143
+ {
144
+ "data-slot": "text",
145
+ className: X(it({ variant: e, color: n, className: r })),
146
+ ...o
147
+ }
148
+ );
149
+ }
150
+ const ct = "bnui-checkbox-mTFTt", lt = "bnui-label-JOyrO", ut = "bnui-indicator-VOiAE", dt = "bnui-check-6pYVz", ue = {
151
+ checkbox: ct,
152
+ label: lt,
153
+ indicator: ut,
154
+ check: dt
155
+ };
156
+ function Io({ className: e, label: n, ...t }) {
157
+ const r = /* @__PURE__ */ x(
158
+ We.Root,
159
+ {
160
+ "data-slot": "checkbox",
161
+ className: X(ue.checkbox, e),
162
+ ...t,
163
+ children: /* @__PURE__ */ x(
164
+ We.Indicator,
165
+ {
166
+ "data-slot": "checkbox-indicator",
167
+ className: ue.indicator,
168
+ children: /* @__PURE__ */ x(Gn, { className: ue.check })
169
+ }
170
+ )
171
+ }
172
+ );
173
+ return n === void 0 ? r : /* @__PURE__ */ he("label", { className: ue.label, children: [
174
+ r,
175
+ /* @__PURE__ */ x(at, { variant: "body", as: "span", children: n })
176
+ ] });
177
+ }
178
+ let Re;
179
+ process.env.NODE_ENV !== "production" && (Re = /* @__PURE__ */ new Set());
180
+ function pe(...e) {
181
+ if (process.env.NODE_ENV !== "production") {
182
+ const n = e.join(" ");
183
+ Re.has(n) || (Re.add(n), console.error(`Base UI: ${n}`));
184
+ }
185
+ }
186
+ function sn({
187
+ controlled: e,
188
+ default: n,
189
+ name: t,
190
+ state: r = "value"
191
+ }) {
192
+ const {
193
+ current: o
194
+ } = s.useRef(e !== void 0), [i, a] = s.useState(n), d = o ? e : i;
195
+ if (process.env.NODE_ENV !== "production") {
196
+ s.useEffect(() => {
197
+ o !== (e !== void 0) && pe([`A component is changing the ${o ? "" : "un"}controlled ${r} state of ${t} to be ${o ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${t} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
198
+ `));
199
+ }, [r, t, e]);
200
+ const {
201
+ current: u
202
+ } = s.useRef(n);
203
+ s.useEffect(() => {
204
+ !o && qe(u) !== qe(n) && pe([`A component is changing the default ${r} state of an uncontrolled ${t} after being initialized. To suppress this warning opt to use a controlled ${t}.`].join(`
205
+ `));
206
+ }, [n]);
207
+ }
208
+ const f = s.useCallback((u) => {
209
+ o || a(u);
210
+ }, []);
211
+ return [d, f];
212
+ }
213
+ function qe(e) {
214
+ let n = 0;
215
+ const t = /* @__PURE__ */ new WeakMap();
216
+ try {
217
+ return JSON.stringify(e, function(i, a) {
218
+ if (!(i === "_owner" && this != null && typeof this == "object" && "$$typeof" in this)) {
219
+ if (typeof a == "bigint")
220
+ return `__bigint__:${a}`;
221
+ if (a !== null && typeof a == "object") {
222
+ const d = t.get(a);
223
+ if (d !== void 0)
224
+ return `__object__:${d}`;
225
+ t.set(a, n), n += 1;
226
+ }
227
+ return a;
228
+ }
229
+ }) ?? `__top__:${typeof e}`;
230
+ } catch {
231
+ return "__unserializable__";
232
+ }
233
+ }
234
+ const Ye = {};
235
+ function ge(e, n) {
236
+ const t = s.useRef(Ye);
237
+ return t.current === Ye && (t.current = e(n)), t;
238
+ }
239
+ const Ie = s[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0, -3)], ft = (
240
+ // React 17 doesn't have useInsertionEffect.
241
+ Ie && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
242
+ Ie !== s.useLayoutEffect ? Ie : (e) => e()
243
+ );
244
+ function re(e) {
245
+ const n = ge(pt).current;
246
+ return n.next = e, ft(n.effect), n.trampoline;
247
+ }
248
+ function pt() {
249
+ const e = {
250
+ next: void 0,
251
+ callback: bt,
252
+ trampoline: (...n) => e.callback?.(...n),
253
+ effect: () => {
254
+ e.callback = e.next;
255
+ }
256
+ };
257
+ return e;
258
+ }
259
+ function bt() {
260
+ if (process.env.NODE_ENV !== "production")
261
+ throw (
262
+ /* minify-error-disabled */
263
+ new Error("Base UI: Cannot call an event handler while rendering.")
264
+ );
265
+ }
266
+ function I() {
267
+ }
268
+ const Ze = Object.freeze([]), D = Object.freeze({}), Pe = {
269
+ ...s
270
+ };
271
+ let Je = 0;
272
+ function mt(e, n = "mui") {
273
+ const [t, r] = s.useState(e), o = e || t;
274
+ return s.useEffect(() => {
275
+ t == null && (Je += 1, r(`${n}-${Je}`));
276
+ }, [t, n]), o;
277
+ }
278
+ const Xe = Pe.useId;
279
+ function ht(e, n) {
280
+ if (Xe !== void 0) {
281
+ const t = Xe();
282
+ return e ?? `${n}-${t}`;
283
+ }
284
+ return mt(e, n);
285
+ }
286
+ function oe(e) {
287
+ return ht(e, "base-ui");
288
+ }
289
+ function gt(e, n) {
290
+ return function(r, ...o) {
291
+ const i = new URL(e);
292
+ return i.searchParams.set("code", r.toString()), o.forEach((a) => i.searchParams.append("args[]", a)), `${n} error #${r}; visit ${i} for the full message.`;
293
+ };
294
+ }
295
+ const ye = gt("https://base-ui.com/production-error", "Base UI");
296
+ function Te(e, n, t, r) {
297
+ const o = ge(an).current;
298
+ return Et(o, e, n, t, r) && cn(o, [e, n, t, r]), o.callback;
299
+ }
300
+ function yt(e) {
301
+ const n = ge(an).current;
302
+ return Ct(n, e) && cn(n, e), n.callback;
303
+ }
304
+ function an() {
305
+ return {
306
+ callback: null,
307
+ cleanup: null,
308
+ refs: []
309
+ };
310
+ }
311
+ function Et(e, n, t, r, o) {
312
+ return e.refs[0] !== n || e.refs[1] !== t || e.refs[2] !== r || e.refs[3] !== o;
313
+ }
314
+ function Ct(e, n) {
315
+ return e.refs.length !== n.length || e.refs.some((t, r) => t !== n[r]);
316
+ }
317
+ function cn(e, n) {
318
+ if (e.refs = n, n.every((t) => t == null)) {
319
+ e.callback = null;
320
+ return;
321
+ }
322
+ e.callback = (t) => {
323
+ if (e.cleanup && (e.cleanup(), e.cleanup = null), t != null) {
324
+ const r = Array(n.length).fill(null);
325
+ for (let o = 0; o < n.length; o += 1) {
326
+ const i = n[o];
327
+ if (i != null)
328
+ switch (typeof i) {
329
+ case "function": {
330
+ const a = i(t);
331
+ typeof a == "function" && (r[o] = a);
332
+ break;
333
+ }
334
+ case "object": {
335
+ i.current = t;
336
+ break;
337
+ }
338
+ }
339
+ }
340
+ e.cleanup = () => {
341
+ for (let o = 0; o < n.length; o += 1) {
342
+ const i = n[o];
343
+ if (i != null)
344
+ switch (typeof i) {
345
+ case "function": {
346
+ const a = r[o];
347
+ typeof a == "function" ? a() : i(null);
348
+ break;
349
+ }
350
+ case "object": {
351
+ i.current = null;
352
+ break;
353
+ }
354
+ }
355
+ }
356
+ };
357
+ }
358
+ };
359
+ }
360
+ const vt = parseInt(s.version, 10);
361
+ function kt(e) {
362
+ return vt >= e;
363
+ }
364
+ function Qe(e) {
365
+ if (!/* @__PURE__ */ s.isValidElement(e))
366
+ return null;
367
+ const n = e, t = n.props;
368
+ return (kt(19) ? t?.ref : n.ref) ?? null;
369
+ }
370
+ function Se(e, n) {
371
+ if (e && !n)
372
+ return e;
373
+ if (!e && n)
374
+ return n;
375
+ if (e || n)
376
+ return {
377
+ ...e,
378
+ ...n
379
+ };
380
+ }
381
+ let _e;
382
+ process.env.NODE_ENV !== "production" && (_e = /* @__PURE__ */ new Set());
383
+ function xt(...e) {
384
+ if (process.env.NODE_ENV !== "production") {
385
+ const n = e.join(" ");
386
+ _e.has(n) || (_e.add(n), console.warn(`Base UI: ${n}`));
387
+ }
388
+ }
389
+ function wt(e, n) {
390
+ const t = {};
391
+ for (const r in e) {
392
+ const o = e[r];
393
+ if (n?.hasOwnProperty(r)) {
394
+ const i = n[r](o);
395
+ i != null && Object.assign(t, i);
396
+ continue;
397
+ }
398
+ o === !0 ? t[`data-${r.toLowerCase()}`] = "" : o && (t[`data-${r.toLowerCase()}`] = o.toString());
399
+ }
400
+ return t;
401
+ }
402
+ function Nt(e, n) {
403
+ return typeof e == "function" ? e(n) : e;
404
+ }
405
+ function Vt(e, n) {
406
+ return typeof e == "function" ? e(n) : e;
407
+ }
408
+ const De = {};
409
+ function Ee(e, n, t, r, o) {
410
+ if (!t && !r && !e)
411
+ return be(n);
412
+ let i = be(e);
413
+ return n && (i = fe(i, n)), t && (i = fe(i, t)), r && (i = fe(i, r)), i;
414
+ }
415
+ function It(e) {
416
+ if (e.length === 0)
417
+ return De;
418
+ if (e.length === 1)
419
+ return be(e[0]);
420
+ let n = be(e[0]);
421
+ for (let t = 1; t < e.length; t += 1)
422
+ n = fe(n, e[t]);
423
+ return n;
424
+ }
425
+ function be(e) {
426
+ return $e(e) ? {
427
+ ...un(e, De)
428
+ } : Ot(e);
429
+ }
430
+ function fe(e, n) {
431
+ return $e(n) ? un(n, e) : Rt(e, n);
432
+ }
433
+ function Ot(e) {
434
+ const n = {
435
+ ...e
436
+ };
437
+ for (const t in n) {
438
+ const r = n[t];
439
+ ln(t, r) && (n[t] = dn(r));
440
+ }
441
+ return n;
442
+ }
443
+ function Rt(e, n) {
444
+ if (!n)
445
+ return e;
446
+ for (const t in n) {
447
+ const r = n[t];
448
+ switch (t) {
449
+ case "style": {
450
+ e[t] = Se(e.style, r);
451
+ break;
452
+ }
453
+ case "className": {
454
+ e[t] = fn(e.className, r);
455
+ break;
456
+ }
457
+ default:
458
+ ln(t, r) ? e[t] = Pt(e[t], r) : e[t] = r;
459
+ }
460
+ }
461
+ return e;
462
+ }
463
+ function ln(e, n) {
464
+ const t = e.charCodeAt(0), r = e.charCodeAt(1), o = e.charCodeAt(2);
465
+ return t === 111 && r === 110 && o >= 65 && o <= 90 && (typeof n == "function" || typeof n > "u");
466
+ }
467
+ function $e(e) {
468
+ return typeof e == "function";
469
+ }
470
+ function un(e, n) {
471
+ return $e(e) ? e(n) : e ?? De;
472
+ }
473
+ function Pt(e, n) {
474
+ return n ? e ? (...t) => {
475
+ const r = t[0];
476
+ if (pn(r)) {
477
+ const i = r;
478
+ me(i);
479
+ const a = n(...t);
480
+ return i.baseUIHandlerPrevented || e?.(...t), a;
481
+ }
482
+ const o = n(...t);
483
+ return e?.(...t), o;
484
+ } : dn(n) : e;
485
+ }
486
+ function dn(e) {
487
+ return e && ((...n) => {
488
+ const t = n[0];
489
+ return pn(t) && me(t), e(...n);
490
+ });
491
+ }
492
+ function me(e) {
493
+ return e.preventBaseUIHandler = () => {
494
+ e.baseUIHandlerPrevented = !0;
495
+ }, e;
496
+ }
497
+ function fn(e, n) {
498
+ return n ? e ? n + " " + e : n : e;
499
+ }
500
+ function pn(e) {
501
+ return e != null && typeof e == "object" && "nativeEvent" in e;
502
+ }
503
+ function bn(e, n, t = {}) {
504
+ const r = n.render, o = Tt(n, t);
505
+ if (t.enabled === !1)
506
+ return null;
507
+ const i = t.state ?? D;
508
+ return $t(e, r, o, i);
509
+ }
510
+ function Tt(e, n = {}) {
511
+ const {
512
+ className: t,
513
+ style: r,
514
+ render: o
515
+ } = e, {
516
+ state: i = D,
517
+ ref: a,
518
+ props: d,
519
+ stateAttributesMapping: f,
520
+ enabled: u = !0
521
+ } = n, p = u ? Nt(t, i) : void 0, h = u ? Vt(r, i) : void 0, N = u ? wt(i, f) : D, m = u && d ? St(d) : void 0, c = u ? Se(N, m) ?? {} : D;
522
+ return typeof document < "u" && (u ? Array.isArray(a) ? c.ref = yt([c.ref, Qe(o), ...a]) : c.ref = Te(c.ref, Qe(o), a) : Te(null, null)), u ? (p !== void 0 && (c.className = fn(c.className, p)), h !== void 0 && (c.style = Se(c.style, h)), c) : D;
523
+ }
524
+ function St(e) {
525
+ return Array.isArray(e) ? It(e) : Ee(void 0, e);
526
+ }
527
+ const _t = /* @__PURE__ */ Symbol.for("react.lazy"), Bt = /^[A-Z][A-Za-z0-9$]*$/, Dt = /[a-z]/;
528
+ function $t(e, n, t, r) {
529
+ if (n) {
530
+ if (typeof n == "function")
531
+ return process.env.NODE_ENV !== "production" && Mt(n), n(t, r);
532
+ const o = Ee(t, n.props);
533
+ o.ref = t.ref;
534
+ let i = n;
535
+ if (i?.$$typeof === _t && (i = s.Children.toArray(n)[0]), process.env.NODE_ENV !== "production" && !/* @__PURE__ */ s.isValidElement(i))
536
+ throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join(`
537
+ `));
538
+ return /* @__PURE__ */ s.cloneElement(i, o);
539
+ }
540
+ if (e && typeof e == "string")
541
+ return At(e, t);
542
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: Render element or function are not defined." : ye(8));
543
+ }
544
+ function Mt(e) {
545
+ const n = e.name;
546
+ n.length !== 0 && Bt.test(n) && Dt.test(n) && xt(`The \`render\` prop received a function named \`${n}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop");
547
+ }
548
+ function At(e, n) {
549
+ return e === "button" ? /* @__PURE__ */ ze("button", {
550
+ type: "button",
551
+ ...n,
552
+ key: n.key
553
+ }) : e === "img" ? /* @__PURE__ */ ze("img", {
554
+ alt: "",
555
+ ...n,
556
+ key: n.key
557
+ }) : /* @__PURE__ */ s.createElement(e, n);
558
+ }
559
+ const Me = /* @__PURE__ */ s.createContext(void 0);
560
+ process.env.NODE_ENV !== "production" && (Me.displayName = "CheckboxGroupContext");
561
+ function Lt(e = !0) {
562
+ const n = s.useContext(Me);
563
+ if (n === void 0 && !e)
564
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: CheckboxGroupContext is missing. CheckboxGroup parts must be placed within <CheckboxGroup>." : ye(3));
565
+ return n;
566
+ }
567
+ let en = /* @__PURE__ */ (function(e) {
568
+ return e.disabled = "data-disabled", e.valid = "data-valid", e.invalid = "data-invalid", e.touched = "data-touched", e.dirty = "data-dirty", e.filled = "data-filled", e.focused = "data-focused", e;
569
+ })({});
570
+ const Ut = {
571
+ badInput: !1,
572
+ customError: !1,
573
+ patternMismatch: !1,
574
+ rangeOverflow: !1,
575
+ rangeUnderflow: !1,
576
+ stepMismatch: !1,
577
+ tooLong: !1,
578
+ tooShort: !1,
579
+ typeMismatch: !1,
580
+ valid: null,
581
+ valueMissing: !1
582
+ }, te = {
583
+ valid: null,
584
+ touched: !1,
585
+ dirty: !1,
586
+ filled: !1,
587
+ focused: !1
588
+ }, Ft = {
589
+ disabled: !1,
590
+ ...te
591
+ }, mn = {
592
+ valid(e) {
593
+ return e === null ? null : e ? {
594
+ [en.valid]: ""
595
+ } : {
596
+ [en.invalid]: ""
597
+ };
598
+ }
599
+ }, hn = /* @__PURE__ */ s.createContext({
600
+ invalid: void 0,
601
+ name: void 0,
602
+ validityData: {
603
+ state: Ut,
604
+ errors: [],
605
+ error: "",
606
+ value: "",
607
+ initialValue: null
608
+ },
609
+ setValidityData: I,
610
+ disabled: void 0,
611
+ touched: te.touched,
612
+ setTouched: I,
613
+ dirty: te.dirty,
614
+ setDirty: I,
615
+ filled: te.filled,
616
+ setFilled: I,
617
+ focused: te.focused,
618
+ setFocused: I,
619
+ validate: () => null,
620
+ validationMode: "onSubmit",
621
+ validationDebounceTime: 0,
622
+ shouldValidateOnChange: () => !1,
623
+ state: Ft,
624
+ markedDirtyRef: {
625
+ current: !1
626
+ },
627
+ registerFieldControl: I,
628
+ validation: {
629
+ getValidationProps: (e = D) => e,
630
+ getInputValidationProps: (e = D) => e,
631
+ inputRef: {
632
+ current: null
633
+ },
634
+ commit: async () => {
635
+ }
636
+ }
637
+ });
638
+ process.env.NODE_ENV !== "production" && (hn.displayName = "FieldRootContext");
639
+ function Ae(e = !0) {
640
+ const n = s.useContext(hn);
641
+ if (n.setValidityData === I && !e)
642
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>." : ye(28));
643
+ return n;
644
+ }
645
+ const Kt = () => {
646
+ }, H = typeof document < "u" ? s.useLayoutEffect : Kt;
647
+ function gn(e, n) {
648
+ const {
649
+ enabled: t = !0,
650
+ getValue: r,
651
+ id: o,
652
+ value: i
653
+ } = n, {
654
+ registerFieldControl: a
655
+ } = Ae(), d = s.useRef(null);
656
+ d.current || (d.current = /* @__PURE__ */ Symbol()), H(() => {
657
+ const f = d.current;
658
+ if (!(!f || !t))
659
+ return a(f, {
660
+ controlRef: e,
661
+ getValue: r,
662
+ id: o,
663
+ value: i
664
+ }), () => {
665
+ a(f, void 0);
666
+ };
667
+ }, [e, t, r, o, a, i]);
668
+ }
669
+ const yn = /* @__PURE__ */ s.createContext({
670
+ controlId: void 0,
671
+ registerControlId: I,
672
+ labelId: void 0,
673
+ setLabelId: I,
674
+ messageIds: [],
675
+ setMessageIds: I,
676
+ getDescriptionProps: (e) => e
677
+ });
678
+ process.env.NODE_ENV !== "production" && (yn.displayName = "LabelableContext");
679
+ function En() {
680
+ return s.useContext(yn);
681
+ }
682
+ const Cn = {
683
+ clipPath: "inset(50%)",
684
+ overflow: "hidden",
685
+ whiteSpace: "nowrap",
686
+ border: 0,
687
+ padding: 0,
688
+ width: 1,
689
+ height: 1,
690
+ margin: -1
691
+ }, Gt = {
692
+ ...Cn,
693
+ position: "fixed",
694
+ top: 0,
695
+ left: 0
696
+ }, jt = {
697
+ ...Cn,
698
+ position: "absolute"
699
+ };
700
+ let nn = /* @__PURE__ */ (function(e) {
701
+ return e.checked = "data-checked", e.unchecked = "data-unchecked", e.indeterminate = "data-indeterminate", e.disabled = "data-disabled", e.readonly = "data-readonly", e.required = "data-required", e.valid = "data-valid", e.invalid = "data-invalid", e.touched = "data-touched", e.dirty = "data-dirty", e.filled = "data-filled", e.focused = "data-focused", e;
702
+ })({});
703
+ function Ht(e) {
704
+ return s.useMemo(() => ({
705
+ checked(n) {
706
+ return e.indeterminate ? {} : n ? {
707
+ [nn.checked]: ""
708
+ } : {
709
+ [nn.unchecked]: ""
710
+ };
711
+ },
712
+ ...mn
713
+ }), [e.indeterminate]);
714
+ }
715
+ function Wt() {
716
+ return typeof window < "u";
717
+ }
718
+ function zt(e) {
719
+ var n;
720
+ return (e == null || (n = e.ownerDocument) == null ? void 0 : n.defaultView) || window;
721
+ }
722
+ function qt(e) {
723
+ return Wt() ? e instanceof HTMLElement || e instanceof zt(e).HTMLElement : !1;
724
+ }
725
+ const vn = /* @__PURE__ */ s.createContext(void 0);
726
+ process.env.NODE_ENV !== "production" && (vn.displayName = "CompositeRootContext");
727
+ function Yt(e = !1) {
728
+ const n = s.useContext(vn);
729
+ if (n === void 0 && !e)
730
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : ye(16));
731
+ return n;
732
+ }
733
+ function Zt(e) {
734
+ const {
735
+ focusableWhenDisabled: n,
736
+ disabled: t,
737
+ composite: r = !1,
738
+ tabIndex: o = 0,
739
+ isNativeButton: i
740
+ } = e, a = r && n !== !1, d = r && n === !1;
741
+ return {
742
+ props: s.useMemo(() => {
743
+ const u = {
744
+ // allow Tabbing away from focusableWhenDisabled elements
745
+ onKeyDown(p) {
746
+ t && n && p.key !== "Tab" && p.preventDefault();
747
+ }
748
+ };
749
+ return r || (u.tabIndex = o, !i && t && (u.tabIndex = n ? o : -1)), (i && (n || a) || !i && t) && (u["aria-disabled"] = t), i && (!n || d) && (u.disabled = t), u;
750
+ }, [r, t, n, a, d, i, o])
751
+ };
752
+ }
753
+ function Jt(e = {}) {
754
+ const {
755
+ disabled: n = !1,
756
+ focusableWhenDisabled: t,
757
+ tabIndex: r = 0,
758
+ native: o = !0,
759
+ composite: i
760
+ } = e, a = s.useRef(null), d = Yt(!0), f = i ?? d !== void 0, {
761
+ props: u
762
+ } = Zt({
763
+ focusableWhenDisabled: t,
764
+ disabled: n,
765
+ composite: f,
766
+ tabIndex: r,
767
+ isNativeButton: o
768
+ });
769
+ process.env.NODE_ENV !== "production" && s.useEffect(() => {
770
+ if (!a.current)
771
+ return;
772
+ const m = de(a.current);
773
+ if (o) {
774
+ if (!m) {
775
+ const c = Pe.captureOwnerStack?.() || "";
776
+ pe(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${c}`);
777
+ }
778
+ } else if (m) {
779
+ const c = Pe.captureOwnerStack?.() || "";
780
+ pe(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${c}`);
781
+ }
782
+ }, [o]);
783
+ const p = s.useCallback(() => {
784
+ const m = a.current;
785
+ de(m) && f && n && u.disabled === void 0 && m.disabled && (m.disabled = !1);
786
+ }, [n, u.disabled, f]);
787
+ H(p, [p]);
788
+ const h = s.useCallback((m = {}) => {
789
+ const {
790
+ onClick: c,
791
+ onMouseDown: b,
792
+ onKeyUp: E,
793
+ onKeyDown: C,
794
+ onPointerDown: O,
795
+ ...T
796
+ } = m;
797
+ return Ee({
798
+ type: o ? "button" : void 0,
799
+ onClick(l) {
800
+ if (n) {
801
+ l.preventDefault();
802
+ return;
803
+ }
804
+ c?.(l);
805
+ },
806
+ onMouseDown(l) {
807
+ n || b?.(l);
808
+ },
809
+ onKeyDown(l) {
810
+ if (n || (me(l), C?.(l), l.baseUIHandlerPrevented))
811
+ return;
812
+ const W = l.target === l.currentTarget, $ = l.currentTarget, M = de($), A = !o && Xt($), R = W && (o ? M : !A), L = l.key === "Enter", S = l.key === " ", U = $.getAttribute("role"), z = U?.startsWith("menuitem") || U === "option" || U === "gridcell";
813
+ if (W && f && S) {
814
+ if (l.defaultPrevented && z)
815
+ return;
816
+ l.preventDefault(), A || o && M ? ($.click(), l.preventBaseUIHandler()) : R && (c?.(l), l.preventBaseUIHandler());
817
+ return;
818
+ }
819
+ R && (!o && (S || L) && l.preventDefault(), !o && L && c?.(l));
820
+ },
821
+ onKeyUp(l) {
822
+ if (!n) {
823
+ if (me(l), E?.(l), l.target === l.currentTarget && o && f && de(l.currentTarget) && l.key === " ") {
824
+ l.preventDefault();
825
+ return;
826
+ }
827
+ l.baseUIHandlerPrevented || l.target === l.currentTarget && !o && !f && l.key === " " && c?.(l);
828
+ }
829
+ },
830
+ onPointerDown(l) {
831
+ if (n) {
832
+ l.preventDefault();
833
+ return;
834
+ }
835
+ O?.(l);
836
+ }
837
+ }, o ? void 0 : {
838
+ role: "button"
839
+ }, u, T);
840
+ }, [n, u, f, o]), N = re((m) => {
841
+ a.current = m, p();
842
+ });
843
+ return {
844
+ getButtonProps: h,
845
+ buttonRef: N
846
+ };
847
+ }
848
+ function de(e) {
849
+ return qt(e) && e.tagName === "BUTTON";
850
+ }
851
+ function Xt(e) {
852
+ return !!(e?.tagName === "A" && e?.href);
853
+ }
854
+ const kn = /* @__PURE__ */ s.createContext({
855
+ disabled: !1
856
+ });
857
+ process.env.NODE_ENV !== "production" && (kn.displayName = "FieldItemContext");
858
+ function Qt() {
859
+ return s.useContext(kn);
860
+ }
861
+ const xn = /* @__PURE__ */ s.createContext({
862
+ formRef: {
863
+ current: {
864
+ fields: /* @__PURE__ */ new Map()
865
+ }
866
+ },
867
+ errors: {},
868
+ clearErrors: I,
869
+ validationMode: "onSubmit",
870
+ submitAttemptedRef: {
871
+ current: !1
872
+ }
873
+ });
874
+ process.env.NODE_ENV !== "production" && (xn.displayName = "FormContext");
875
+ function wn() {
876
+ return s.useContext(xn);
877
+ }
878
+ function eo(e, n, t, r = !0, o) {
879
+ const [i, a] = s.useState(), d = oe(o ? `${o}-label` : void 0), f = e ?? n ?? i;
880
+ return H(() => {
881
+ const u = e || n || !r ? void 0 : no(t.current, d);
882
+ i !== u && a(u);
883
+ }), f;
884
+ }
885
+ function no(e, n) {
886
+ const t = to(e);
887
+ if (t)
888
+ return !t.id && n && (t.id = n), t.id || void 0;
889
+ }
890
+ function to(e) {
891
+ if (!e)
892
+ return;
893
+ const n = e.parentElement;
894
+ if (n && n.tagName === "LABEL")
895
+ return n;
896
+ const t = e.id;
897
+ if (t) {
898
+ const o = e.nextElementSibling;
899
+ if (o && o.htmlFor === t)
900
+ return o;
901
+ }
902
+ const r = e.labels;
903
+ return r && r[0];
904
+ }
905
+ const Nn = /* @__PURE__ */ s.createContext(void 0);
906
+ process.env.NODE_ENV !== "production" && (Nn.displayName = "CheckboxRootContext");
907
+ const oo = "none";
908
+ function ro(e, n, t, r) {
909
+ let o = !1, i = !1;
910
+ const a = D;
911
+ return {
912
+ reason: e,
913
+ event: n ?? new Event("base-ui"),
914
+ cancel() {
915
+ o = !0;
916
+ },
917
+ allowPropagation() {
918
+ i = !0;
919
+ },
920
+ get isCanceled() {
921
+ return o;
922
+ },
923
+ get isPropagationAllowed() {
924
+ return i;
925
+ },
926
+ trigger: t,
927
+ ...a
928
+ };
929
+ }
930
+ function Vn(e, n) {
931
+ const t = s.useRef(e), r = re(n);
932
+ H(() => {
933
+ t.current !== e && r(t.current);
934
+ }, [e, r]), H(() => {
935
+ t.current = e;
936
+ }, [e]);
937
+ }
938
+ const In = "data-parent", io = /* @__PURE__ */ s.forwardRef(function(n, t) {
939
+ const {
940
+ checked: r,
941
+ className: o,
942
+ defaultChecked: i = !1,
943
+ "aria-labelledby": a,
944
+ disabled: d = !1,
945
+ form: f,
946
+ id: u,
947
+ indeterminate: p = !1,
948
+ inputRef: h,
949
+ name: N,
950
+ onCheckedChange: m,
951
+ parent: c = !1,
952
+ readOnly: b = !1,
953
+ render: E,
954
+ required: C = !1,
955
+ uncheckedValue: O,
956
+ value: T,
957
+ nativeButton: k = !1,
958
+ style: l,
959
+ ...W
960
+ } = n, {
961
+ clearErrors: $
962
+ } = wn(), {
963
+ disabled: M,
964
+ name: A,
965
+ setDirty: R,
966
+ setFilled: L,
967
+ setFocused: S,
968
+ setTouched: U,
969
+ state: z,
970
+ validationMode: Q,
971
+ validityData: ie,
972
+ shouldValidateOnChange: F,
973
+ validation: Ce
974
+ } = Ae(), ve = Qt(), {
975
+ labelId: ke,
976
+ controlId: P,
977
+ registerControlId: _,
978
+ getDescriptionProps: Le
979
+ } = En(), v = Lt(), ee = v?.parent, ne = ee && v.allValues, K = M || ve.disabled || v?.disabled || d, q = A ?? N, w = T ?? q, Ue = oe(), Rn = oe();
980
+ let G = P;
981
+ ne ? G = c ? Rn : `${ee.id}-${w}` : u && (G = u);
982
+ let xe = {};
983
+ ne && (c ? xe = v.parent.getParentProps() : w && (xe = v.parent.getChildProps(w)));
984
+ const Pn = re(m), {
985
+ checked: Fe = r,
986
+ indeterminate: se = p,
987
+ onCheckedChange: Tn,
988
+ ...Sn
989
+ } = xe, Y = v?.value, Ke = v?.setValue, Ge = v?.defaultValue, we = s.useRef(null), ae = ge(() => /* @__PURE__ */ Symbol("checkbox-control")), Ne = s.useRef(!1), {
990
+ getButtonProps: _n,
991
+ buttonRef: Bn
992
+ } = Jt({
993
+ disabled: K,
994
+ native: k
995
+ }), j = v?.validation ?? Ce, [V, Dn] = sn({
996
+ controlled: w && Y && !c ? Y.includes(w) : Fe,
997
+ default: w && Ge && !c ? Ge.includes(w) : i,
998
+ name: "Checkbox",
999
+ state: "checked"
1000
+ });
1001
+ H(() => {
1002
+ _ !== I && (Ne.current = !0, _(ae.current, G));
1003
+ }, [G, v, _, c, ae]), s.useEffect(() => {
1004
+ const y = ae.current;
1005
+ return () => {
1006
+ !Ne.current || _ === I || (Ne.current = !1, _(y, void 0));
1007
+ };
1008
+ }, [_, ae]), gn(we, {
1009
+ enabled: !v,
1010
+ id: Ue,
1011
+ value: V
1012
+ });
1013
+ const Z = s.useRef(null), $n = Te(h, Z, j.inputRef), Mn = eo(a, ke, Z, !k, G ?? void 0);
1014
+ H(() => {
1015
+ Z.current && (Z.current.indeterminate = se, V && L(!0));
1016
+ }, [V, se, L]), Vn(V, () => {
1017
+ v && !c || ($(q), L(V), R(V !== ie.initialValue), F() ? j.commit(V) : j.commit(V, !0));
1018
+ });
1019
+ const An = Ee(
1020
+ {
1021
+ checked: V,
1022
+ disabled: K,
1023
+ form: f,
1024
+ // parent checkboxes unset `name` to be excluded from form submission
1025
+ name: c ? void 0 : q,
1026
+ // Set `id` to stop Chrome warning about an unassociated input.
1027
+ // When using a native button, the `id` is applied to the button instead.
1028
+ id: k ? void 0 : G ?? void 0,
1029
+ required: C,
1030
+ ref: $n,
1031
+ style: q ? jt : Gt,
1032
+ tabIndex: -1,
1033
+ type: "checkbox",
1034
+ "aria-hidden": !0,
1035
+ onChange(y) {
1036
+ if (y.nativeEvent.defaultPrevented)
1037
+ return;
1038
+ if (b) {
1039
+ y.preventDefault();
1040
+ return;
1041
+ }
1042
+ const ce = y.currentTarget.checked, le = ro(oo, y.nativeEvent);
1043
+ if (Tn?.(ce, le), Pn(ce, le), !le.isCanceled && (Dn(ce), w && Y && Ke && !c && !ne)) {
1044
+ const Fn = ce ? [...Y, w] : Y.filter((Kn) => Kn !== w);
1045
+ Ke(Fn, le);
1046
+ }
1047
+ },
1048
+ onFocus() {
1049
+ we.current?.focus();
1050
+ }
1051
+ },
1052
+ // React <19 sets an empty value if `undefined` is passed explicitly
1053
+ // To avoid this, we only set the value if it's defined
1054
+ T !== void 0 ? {
1055
+ value: (v ? V && T : T) || ""
1056
+ } : D,
1057
+ Le,
1058
+ v ? j.getValidationProps : j.getInputValidationProps
1059
+ ), je = ne ? !!Fe : V, He = ne && se || p;
1060
+ s.useEffect(() => {
1061
+ if (!ee || !w)
1062
+ return;
1063
+ const y = ee.disabledStatesRef.current;
1064
+ return y.set(w, K), () => {
1065
+ y.delete(w);
1066
+ };
1067
+ }, [ee, K, w]);
1068
+ const Ve = s.useMemo(() => ({
1069
+ ...z,
1070
+ checked: je,
1071
+ disabled: K,
1072
+ readOnly: b,
1073
+ required: C,
1074
+ indeterminate: He
1075
+ }), [z, je, K, b, C, He]), Ln = Ht(Ve), Un = bn("span", n, {
1076
+ state: Ve,
1077
+ ref: [Bn, we, t, v?.registerControlRef],
1078
+ props: [{
1079
+ id: k ? G ?? void 0 : Ue,
1080
+ role: "checkbox",
1081
+ "aria-checked": se ? "mixed" : V,
1082
+ "aria-readonly": b || void 0,
1083
+ "aria-required": C || void 0,
1084
+ "aria-labelledby": Mn,
1085
+ [In]: c ? "" : void 0,
1086
+ onFocus() {
1087
+ S(!0);
1088
+ },
1089
+ onBlur() {
1090
+ const y = Z.current;
1091
+ y && (U(!0), S(!1), Q === "onBlur" && j.commit(v ? Y : y.checked));
1092
+ },
1093
+ onClick(y) {
1094
+ b || K || (y.preventDefault(), Z.current?.dispatchEvent(new PointerEvent("click", {
1095
+ bubbles: !0,
1096
+ shiftKey: y.shiftKey,
1097
+ ctrlKey: y.ctrlKey,
1098
+ altKey: y.altKey,
1099
+ metaKey: y.metaKey
1100
+ })));
1101
+ }
1102
+ }, Le, j.getValidationProps, W, Sn, _n],
1103
+ stateAttributesMapping: Ln
1104
+ });
1105
+ return /* @__PURE__ */ he(Nn.Provider, {
1106
+ value: Ve,
1107
+ children: [Un, !V && !v && q && !c && O !== void 0 && /* @__PURE__ */ x("input", {
1108
+ type: "hidden",
1109
+ form: f,
1110
+ name: q,
1111
+ value: O
1112
+ }), /* @__PURE__ */ x("input", {
1113
+ ...An,
1114
+ suppressHydrationWarning: !0
1115
+ })]
1116
+ });
1117
+ });
1118
+ process.env.NODE_ENV !== "production" && (io.displayName = "CheckboxRoot");
1119
+ const tn = [];
1120
+ function so(e) {
1121
+ const {
1122
+ allValues: n = tn,
1123
+ value: t = tn,
1124
+ onValueChange: r
1125
+ } = e, o = s.useRef(t), i = s.useRef(/* @__PURE__ */ new Map()), [a, d] = s.useState("mixed"), f = oe(), u = t.length === n.length, p = t.length !== n.length && t.length > 0, h = re(r), N = s.useCallback(() => ({
1126
+ id: f,
1127
+ indeterminate: p,
1128
+ checked: u,
1129
+ // TODO: custom `id` on child checkboxes breaks this
1130
+ // https://github.com/mui/base-ui/issues/2691
1131
+ "aria-controls": n.map((c) => `${f}-${c}`).join(" "),
1132
+ onCheckedChange(c, b) {
1133
+ const E = o.current, C = n.filter((k) => i.current.get(k) && E.includes(k)), O = n.filter((k) => !i.current.get(k) || i.current.get(k) && E.includes(k));
1134
+ if (E.length === O.length || E.length === 0) {
1135
+ t.length === O.length ? h(C, b) : h(O, b);
1136
+ return;
1137
+ }
1138
+ a === "mixed" ? (h(O, b), d("on")) : a === "on" ? (h(C, b), d("off")) : a === "off" && (h(E, b), d("mixed"));
1139
+ }
1140
+ }), [n, u, f, p, h, a, t.length]), m = s.useCallback((c) => ({
1141
+ checked: t.includes(c),
1142
+ onCheckedChange(b, E) {
1143
+ const C = t.slice();
1144
+ b ? C.push(c) : C.splice(C.indexOf(c), 1), o.current = C, h(C, E), d("mixed");
1145
+ }
1146
+ }), [h, t]);
1147
+ return s.useMemo(() => ({
1148
+ id: f,
1149
+ indeterminate: p,
1150
+ getParentProps: N,
1151
+ getChildProps: m,
1152
+ disabledStatesRef: i
1153
+ }), [f, p, N, m]);
1154
+ }
1155
+ function ao(e, n, t = (r, o) => r === o) {
1156
+ return e.length === n.length && e.every((r, o) => t(r, n[o]));
1157
+ }
1158
+ const On = /* @__PURE__ */ s.forwardRef(function(n, t) {
1159
+ const {
1160
+ allValues: r,
1161
+ className: o,
1162
+ defaultValue: i,
1163
+ disabled: a = !1,
1164
+ id: d,
1165
+ onValueChange: f,
1166
+ render: u,
1167
+ value: p,
1168
+ style: h,
1169
+ ...N
1170
+ } = n, {
1171
+ disabled: m,
1172
+ name: c,
1173
+ state: b,
1174
+ validation: E,
1175
+ setFilled: C,
1176
+ setDirty: O,
1177
+ shouldValidateOnChange: T,
1178
+ validityData: k
1179
+ } = Ae(), {
1180
+ labelId: l,
1181
+ getDescriptionProps: W
1182
+ } = En(), {
1183
+ clearErrors: $
1184
+ } = wn(), M = m || a, A = s.useMemo(() => {
1185
+ if (p === void 0)
1186
+ return i ?? [];
1187
+ }, [p, i]), [R, L] = sn({
1188
+ controlled: p,
1189
+ default: A,
1190
+ name: "CheckboxGroup",
1191
+ state: "value"
1192
+ }), S = re((P, _) => {
1193
+ f?.(P, _), !_.isCanceled && L(P);
1194
+ }), U = so({
1195
+ allValues: r,
1196
+ value: R,
1197
+ onValueChange: S
1198
+ }), z = oe(d), Q = s.useRef(null), ie = s.useCallback((P) => {
1199
+ Q.current == null && P != null && !P.hasAttribute(In) && (Q.current = P);
1200
+ }, []);
1201
+ gn(Q, {
1202
+ enabled: !!c,
1203
+ id: z,
1204
+ value: R
1205
+ });
1206
+ const F = R ?? Ze;
1207
+ Vn(F, () => {
1208
+ c && $(c);
1209
+ const P = Array.isArray(k.initialValue) ? k.initialValue : Ze;
1210
+ C(F.length > 0), O(!ao(F, P)), T() ? E.commit(F) : E.commit(F, !0);
1211
+ });
1212
+ const Ce = {
1213
+ ...b,
1214
+ disabled: M
1215
+ }, ve = s.useMemo(() => ({
1216
+ allValues: r,
1217
+ value: R,
1218
+ defaultValue: A,
1219
+ setValue: S,
1220
+ parent: U,
1221
+ disabled: M,
1222
+ validation: E,
1223
+ registerControlRef: ie
1224
+ }), [r, R, A, S, U, M, E, ie]), ke = bn("div", n, {
1225
+ state: Ce,
1226
+ ref: t,
1227
+ props: [{
1228
+ role: "group",
1229
+ "aria-labelledby": l
1230
+ }, W, N],
1231
+ stateAttributesMapping: mn
1232
+ });
1233
+ return /* @__PURE__ */ x(Me.Provider, {
1234
+ value: ve,
1235
+ children: ke
1236
+ });
1237
+ });
1238
+ process.env.NODE_ENV !== "production" && (On.displayName = "CheckboxGroup");
1239
+ const co = "bnui-group-76ZZz", lo = "bnui-column-ev6Qg", uo = "bnui-row-K6-hO", Oe = {
1240
+ group: co,
1241
+ column: lo,
1242
+ row: uo
1243
+ };
1244
+ function Oo({
1245
+ className: e,
1246
+ orientation: n = "row",
1247
+ ...t
1248
+ }) {
1249
+ return /* @__PURE__ */ x(
1250
+ On,
1251
+ {
1252
+ "data-slot": "checkbox-group",
1253
+ className: X(
1254
+ Oe.group,
1255
+ n === "column" ? Oe.column : Oe.row,
1256
+ e
1257
+ ),
1258
+ ...t
1259
+ }
1260
+ );
1261
+ }
1262
+ const fo = "bnui-root-oLVBN", po = "bnui-hasSelectedSecondOption-LfH49", bo = "bnui-filled-L-AUH", mo = "bnui-stroked-wRb92", ho = "bnui-option-Hou7J", go = "bnui-selectedOption-twuTF", J = {
1263
+ root: fo,
1264
+ hasSelectedSecondOption: po,
1265
+ filled: bo,
1266
+ stroked: mo,
1267
+ option: ho,
1268
+ selectedOption: go
1269
+ };
1270
+ function Ro({
1271
+ options: e,
1272
+ title: n,
1273
+ variant: t = "filled",
1274
+ value: r,
1275
+ defaultValue: o,
1276
+ onValueChange: i,
1277
+ name: a,
1278
+ className: d
1279
+ }) {
1280
+ const [f, u] = jn(
1281
+ o ?? e[0].value
1282
+ ), p = r ?? f, h = e[0].value === p ? 0 : 1, N = e[h], m = e[h === 0 ? 1 : 0];
1283
+ function c() {
1284
+ const b = m.value;
1285
+ r === void 0 && u(b), i?.(b);
1286
+ }
1287
+ return /* @__PURE__ */ he(on, { children: [
1288
+ a && /* @__PURE__ */ x("input", { type: "hidden", name: a, value: p }),
1289
+ /* @__PURE__ */ x(
1290
+ rn,
1291
+ {
1292
+ onClick: c,
1293
+ "aria-label": `Bytt ${n} mellom ${N.label} og ${m.label}, valgt: ${N.label}`,
1294
+ className: X(
1295
+ yo({ variant: t }),
1296
+ h === 1 && J.hasSelectedSecondOption,
1297
+ d
1298
+ ),
1299
+ children: e.map((b) => {
1300
+ const E = b.value === p;
1301
+ return /* @__PURE__ */ x(
1302
+ "span",
1303
+ {
1304
+ "aria-hidden": "true",
1305
+ className: X(J.option, E && J.selectedOption),
1306
+ children: b.icon
1307
+ },
1308
+ b.value
1309
+ );
1310
+ })
1311
+ }
1312
+ )
1313
+ ] });
1314
+ }
1315
+ const yo = Be(J.root, {
1316
+ variants: {
1317
+ variant: {
1318
+ filled: J.filled,
1319
+ stroked: J.stroked
1320
+ }
1321
+ },
1322
+ defaultVariants: {
1323
+ variant: "filled"
1324
+ }
1325
+ });
1326
+ export {
1327
+ Vo as Button,
1328
+ Io as Checkbox,
1329
+ Oo as CheckboxGroup,
1330
+ Ro as IconsToggle,
1331
+ et as buttonVariants
1332
+ };
1333
+ //# sourceMappingURL=index.js.map