@vritti/quantum-ui 0.1.5 → 0.1.6

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/Button.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { S as Slot } from './index2.js';
2
+ import { S as Slot } from './index3.js';
3
3
  import { a as clsx, c as cn } from './utils.js';
4
4
 
5
5
  const falsyToString = (value)=>typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
@@ -0,0 +1,27 @@
1
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
2
+ import * as React_2 from 'react';
3
+
4
+ export declare function Checkbox({
5
+ className,
6
+ ...props
7
+ }: React_2.ComponentProps<typeof CheckboxPrimitive.Root>) {
8
+ return (
9
+ <CheckboxPrimitive.Root
10
+ data-slot="checkbox"
11
+ className={cn(
12
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
13
+ className
14
+ )}
15
+ {...props}
16
+ >
17
+ <CheckboxPrimitive.Indicator
18
+ data-slot="checkbox-indicator"
19
+ className="grid place-content-center text-current transition-none"
20
+ >
21
+ <CheckIcon className="size-3.5" />
22
+ </CheckboxPrimitive.Indicator>
23
+ </CheckboxPrimitive.Root>
24
+ )
25
+ }
26
+
27
+ export { }
@@ -0,0 +1,615 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { u as useComposedRefs } from './index3.js';
4
+ import { P as Primitive } from './index2.js';
5
+ import { c as cn } from './utils.js';
6
+ import { c as createLucideIcon } from './createLucideIcon.js';
7
+
8
+ // packages/react/context/src/create-context.tsx
9
+ function createContextScope(scopeName, createContextScopeDeps = []) {
10
+ let defaultContexts = [];
11
+ function createContext3(rootComponentName, defaultContext) {
12
+ const BaseContext = React.createContext(defaultContext);
13
+ const index = defaultContexts.length;
14
+ defaultContexts = [...defaultContexts, defaultContext];
15
+ const Provider = (props) => {
16
+ const { scope, children, ...context } = props;
17
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
18
+ const value = React.useMemo(() => context, Object.values(context));
19
+ return /* @__PURE__ */ jsx(Context.Provider, { value, children });
20
+ };
21
+ Provider.displayName = rootComponentName + "Provider";
22
+ function useContext2(consumerName, scope) {
23
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
24
+ const context = React.useContext(Context);
25
+ if (context) return context;
26
+ if (defaultContext !== void 0) return defaultContext;
27
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
28
+ }
29
+ return [Provider, useContext2];
30
+ }
31
+ const createScope = () => {
32
+ const scopeContexts = defaultContexts.map((defaultContext) => {
33
+ return React.createContext(defaultContext);
34
+ });
35
+ return function useScope(scope) {
36
+ const contexts = scope?.[scopeName] || scopeContexts;
37
+ return React.useMemo(
38
+ () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
39
+ [scope, contexts]
40
+ );
41
+ };
42
+ };
43
+ createScope.scopeName = scopeName;
44
+ return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
45
+ }
46
+ function composeContextScopes(...scopes) {
47
+ const baseScope = scopes[0];
48
+ if (scopes.length === 1) return baseScope;
49
+ const createScope = () => {
50
+ const scopeHooks = scopes.map((createScope2) => ({
51
+ useScope: createScope2(),
52
+ scopeName: createScope2.scopeName
53
+ }));
54
+ return function useComposedScopes(overrideScopes) {
55
+ const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
56
+ const scopeProps = useScope(overrideScopes);
57
+ const currentScope = scopeProps[`__scope${scopeName}`];
58
+ return { ...nextScopes2, ...currentScope };
59
+ }, {});
60
+ return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
61
+ };
62
+ };
63
+ createScope.scopeName = baseScope.scopeName;
64
+ return createScope;
65
+ }
66
+
67
+ // src/primitive.tsx
68
+ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
69
+ return function handleEvent(event) {
70
+ originalEventHandler?.(event);
71
+ if (checkForDefaultPrevented === false || !event.defaultPrevented) {
72
+ return ourEventHandler?.(event);
73
+ }
74
+ };
75
+ }
76
+
77
+ // packages/react/use-layout-effect/src/use-layout-effect.tsx
78
+ var useLayoutEffect2 = globalThis?.document ? React.useLayoutEffect : () => {
79
+ };
80
+
81
+ // src/use-controllable-state.tsx
82
+ var useInsertionEffect = React[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
83
+ function useControllableState({
84
+ prop,
85
+ defaultProp,
86
+ onChange = () => {
87
+ },
88
+ caller
89
+ }) {
90
+ const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
91
+ defaultProp,
92
+ onChange
93
+ });
94
+ const isControlled = prop !== void 0;
95
+ const value = isControlled ? prop : uncontrolledProp;
96
+ {
97
+ const isControlledRef = React.useRef(prop !== void 0);
98
+ React.useEffect(() => {
99
+ const wasControlled = isControlledRef.current;
100
+ if (wasControlled !== isControlled) {
101
+ const from = wasControlled ? "controlled" : "uncontrolled";
102
+ const to = isControlled ? "controlled" : "uncontrolled";
103
+ console.warn(
104
+ `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
105
+ );
106
+ }
107
+ isControlledRef.current = isControlled;
108
+ }, [isControlled, caller]);
109
+ }
110
+ const setValue = React.useCallback(
111
+ (nextValue) => {
112
+ if (isControlled) {
113
+ const value2 = isFunction$1(nextValue) ? nextValue(prop) : nextValue;
114
+ if (value2 !== prop) {
115
+ onChangeRef.current?.(value2);
116
+ }
117
+ } else {
118
+ setUncontrolledProp(nextValue);
119
+ }
120
+ },
121
+ [isControlled, prop, setUncontrolledProp, onChangeRef]
122
+ );
123
+ return [value, setValue];
124
+ }
125
+ function useUncontrolledState({
126
+ defaultProp,
127
+ onChange
128
+ }) {
129
+ const [value, setValue] = React.useState(defaultProp);
130
+ const prevValueRef = React.useRef(value);
131
+ const onChangeRef = React.useRef(onChange);
132
+ useInsertionEffect(() => {
133
+ onChangeRef.current = onChange;
134
+ }, [onChange]);
135
+ React.useEffect(() => {
136
+ if (prevValueRef.current !== value) {
137
+ onChangeRef.current?.(value);
138
+ prevValueRef.current = value;
139
+ }
140
+ }, [value, prevValueRef]);
141
+ return [value, setValue, onChangeRef];
142
+ }
143
+ function isFunction$1(value) {
144
+ return typeof value === "function";
145
+ }
146
+
147
+ // packages/react/use-previous/src/use-previous.tsx
148
+ function usePrevious(value) {
149
+ const ref = React.useRef({ value, previous: value });
150
+ return React.useMemo(() => {
151
+ if (ref.current.value !== value) {
152
+ ref.current.previous = ref.current.value;
153
+ ref.current.value = value;
154
+ }
155
+ return ref.current.previous;
156
+ }, [value]);
157
+ }
158
+
159
+ // packages/react/use-size/src/use-size.tsx
160
+ function useSize(element) {
161
+ const [size, setSize] = React.useState(void 0);
162
+ useLayoutEffect2(() => {
163
+ if (element) {
164
+ setSize({ width: element.offsetWidth, height: element.offsetHeight });
165
+ const resizeObserver = new ResizeObserver((entries) => {
166
+ if (!Array.isArray(entries)) {
167
+ return;
168
+ }
169
+ if (!entries.length) {
170
+ return;
171
+ }
172
+ const entry = entries[0];
173
+ let width;
174
+ let height;
175
+ if ("borderBoxSize" in entry) {
176
+ const borderSizeEntry = entry["borderBoxSize"];
177
+ const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
178
+ width = borderSize["inlineSize"];
179
+ height = borderSize["blockSize"];
180
+ } else {
181
+ width = element.offsetWidth;
182
+ height = element.offsetHeight;
183
+ }
184
+ setSize({ width, height });
185
+ });
186
+ resizeObserver.observe(element, { box: "border-box" });
187
+ return () => resizeObserver.unobserve(element);
188
+ } else {
189
+ setSize(void 0);
190
+ }
191
+ }, [element]);
192
+ return size;
193
+ }
194
+
195
+ function useStateMachine(initialState, machine) {
196
+ return React.useReducer((state, event) => {
197
+ const nextState = machine[state][event];
198
+ return nextState ?? state;
199
+ }, initialState);
200
+ }
201
+
202
+ // src/presence.tsx
203
+ var Presence = (props) => {
204
+ const { present, children } = props;
205
+ const presence = usePresence(present);
206
+ const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
207
+ const ref = useComposedRefs(presence.ref, getElementRef(child));
208
+ const forceMount = typeof children === "function";
209
+ return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
210
+ };
211
+ Presence.displayName = "Presence";
212
+ function usePresence(present) {
213
+ const [node, setNode] = React.useState();
214
+ const stylesRef = React.useRef(null);
215
+ const prevPresentRef = React.useRef(present);
216
+ const prevAnimationNameRef = React.useRef("none");
217
+ const initialState = present ? "mounted" : "unmounted";
218
+ const [state, send] = useStateMachine(initialState, {
219
+ mounted: {
220
+ UNMOUNT: "unmounted",
221
+ ANIMATION_OUT: "unmountSuspended"
222
+ },
223
+ unmountSuspended: {
224
+ MOUNT: "mounted",
225
+ ANIMATION_END: "unmounted"
226
+ },
227
+ unmounted: {
228
+ MOUNT: "mounted"
229
+ }
230
+ });
231
+ React.useEffect(() => {
232
+ const currentAnimationName = getAnimationName(stylesRef.current);
233
+ prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
234
+ }, [state]);
235
+ useLayoutEffect2(() => {
236
+ const styles = stylesRef.current;
237
+ const wasPresent = prevPresentRef.current;
238
+ const hasPresentChanged = wasPresent !== present;
239
+ if (hasPresentChanged) {
240
+ const prevAnimationName = prevAnimationNameRef.current;
241
+ const currentAnimationName = getAnimationName(styles);
242
+ if (present) {
243
+ send("MOUNT");
244
+ } else if (currentAnimationName === "none" || styles?.display === "none") {
245
+ send("UNMOUNT");
246
+ } else {
247
+ const isAnimating = prevAnimationName !== currentAnimationName;
248
+ if (wasPresent && isAnimating) {
249
+ send("ANIMATION_OUT");
250
+ } else {
251
+ send("UNMOUNT");
252
+ }
253
+ }
254
+ prevPresentRef.current = present;
255
+ }
256
+ }, [present, send]);
257
+ useLayoutEffect2(() => {
258
+ if (node) {
259
+ let timeoutId;
260
+ const ownerWindow = node.ownerDocument.defaultView ?? window;
261
+ const handleAnimationEnd = (event) => {
262
+ const currentAnimationName = getAnimationName(stylesRef.current);
263
+ const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
264
+ if (event.target === node && isCurrentAnimation) {
265
+ send("ANIMATION_END");
266
+ if (!prevPresentRef.current) {
267
+ const currentFillMode = node.style.animationFillMode;
268
+ node.style.animationFillMode = "forwards";
269
+ timeoutId = ownerWindow.setTimeout(() => {
270
+ if (node.style.animationFillMode === "forwards") {
271
+ node.style.animationFillMode = currentFillMode;
272
+ }
273
+ });
274
+ }
275
+ }
276
+ };
277
+ const handleAnimationStart = (event) => {
278
+ if (event.target === node) {
279
+ prevAnimationNameRef.current = getAnimationName(stylesRef.current);
280
+ }
281
+ };
282
+ node.addEventListener("animationstart", handleAnimationStart);
283
+ node.addEventListener("animationcancel", handleAnimationEnd);
284
+ node.addEventListener("animationend", handleAnimationEnd);
285
+ return () => {
286
+ ownerWindow.clearTimeout(timeoutId);
287
+ node.removeEventListener("animationstart", handleAnimationStart);
288
+ node.removeEventListener("animationcancel", handleAnimationEnd);
289
+ node.removeEventListener("animationend", handleAnimationEnd);
290
+ };
291
+ } else {
292
+ send("ANIMATION_END");
293
+ }
294
+ }, [node, send]);
295
+ return {
296
+ isPresent: ["mounted", "unmountSuspended"].includes(state),
297
+ ref: React.useCallback((node2) => {
298
+ stylesRef.current = node2 ? getComputedStyle(node2) : null;
299
+ setNode(node2);
300
+ }, [])
301
+ };
302
+ }
303
+ function getAnimationName(styles) {
304
+ return styles?.animationName || "none";
305
+ }
306
+ function getElementRef(element) {
307
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
308
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
309
+ if (mayWarn) {
310
+ return element.ref;
311
+ }
312
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
313
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
314
+ if (mayWarn) {
315
+ return element.props.ref;
316
+ }
317
+ return element.props.ref || element.ref;
318
+ }
319
+
320
+ var CHECKBOX_NAME = "Checkbox";
321
+ var [createCheckboxContext] = createContextScope(CHECKBOX_NAME);
322
+ var [CheckboxProviderImpl, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
323
+ function CheckboxProvider(props) {
324
+ const {
325
+ __scopeCheckbox,
326
+ checked: checkedProp,
327
+ children,
328
+ defaultChecked,
329
+ disabled,
330
+ form,
331
+ name,
332
+ onCheckedChange,
333
+ required,
334
+ value = "on",
335
+ // @ts-expect-error
336
+ internal_do_not_use_render
337
+ } = props;
338
+ const [checked, setChecked] = useControllableState({
339
+ prop: checkedProp,
340
+ defaultProp: defaultChecked ?? false,
341
+ onChange: onCheckedChange,
342
+ caller: CHECKBOX_NAME
343
+ });
344
+ const [control, setControl] = React.useState(null);
345
+ const [bubbleInput, setBubbleInput] = React.useState(null);
346
+ const hasConsumerStoppedPropagationRef = React.useRef(false);
347
+ const isFormControl = control ? !!form || !!control.closest("form") : (
348
+ // We set this to true by default so that events bubble to forms without JS (SSR)
349
+ true
350
+ );
351
+ const context = {
352
+ checked,
353
+ disabled,
354
+ setChecked,
355
+ control,
356
+ setControl,
357
+ name,
358
+ form,
359
+ value,
360
+ hasConsumerStoppedPropagationRef,
361
+ required,
362
+ defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,
363
+ isFormControl,
364
+ bubbleInput,
365
+ setBubbleInput
366
+ };
367
+ return /* @__PURE__ */ jsx(
368
+ CheckboxProviderImpl,
369
+ {
370
+ scope: __scopeCheckbox,
371
+ ...context,
372
+ children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children
373
+ }
374
+ );
375
+ }
376
+ var TRIGGER_NAME = "CheckboxTrigger";
377
+ var CheckboxTrigger = React.forwardRef(
378
+ ({ __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }, forwardedRef) => {
379
+ const {
380
+ control,
381
+ value,
382
+ disabled,
383
+ checked,
384
+ required,
385
+ setControl,
386
+ setChecked,
387
+ hasConsumerStoppedPropagationRef,
388
+ isFormControl,
389
+ bubbleInput
390
+ } = useCheckboxContext(TRIGGER_NAME, __scopeCheckbox);
391
+ const composedRefs = useComposedRefs(forwardedRef, setControl);
392
+ const initialCheckedStateRef = React.useRef(checked);
393
+ React.useEffect(() => {
394
+ const form = control?.form;
395
+ if (form) {
396
+ const reset = () => setChecked(initialCheckedStateRef.current);
397
+ form.addEventListener("reset", reset);
398
+ return () => form.removeEventListener("reset", reset);
399
+ }
400
+ }, [control, setChecked]);
401
+ return /* @__PURE__ */ jsx(
402
+ Primitive.button,
403
+ {
404
+ type: "button",
405
+ role: "checkbox",
406
+ "aria-checked": isIndeterminate(checked) ? "mixed" : checked,
407
+ "aria-required": required,
408
+ "data-state": getState(checked),
409
+ "data-disabled": disabled ? "" : void 0,
410
+ disabled,
411
+ value,
412
+ ...checkboxProps,
413
+ ref: composedRefs,
414
+ onKeyDown: composeEventHandlers(onKeyDown, (event) => {
415
+ if (event.key === "Enter") event.preventDefault();
416
+ }),
417
+ onClick: composeEventHandlers(onClick, (event) => {
418
+ setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
419
+ if (bubbleInput && isFormControl) {
420
+ hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
421
+ if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
422
+ }
423
+ })
424
+ }
425
+ );
426
+ }
427
+ );
428
+ CheckboxTrigger.displayName = TRIGGER_NAME;
429
+ var Checkbox$1 = React.forwardRef(
430
+ (props, forwardedRef) => {
431
+ const {
432
+ __scopeCheckbox,
433
+ name,
434
+ checked,
435
+ defaultChecked,
436
+ required,
437
+ disabled,
438
+ value,
439
+ onCheckedChange,
440
+ form,
441
+ ...checkboxProps
442
+ } = props;
443
+ return /* @__PURE__ */ jsx(
444
+ CheckboxProvider,
445
+ {
446
+ __scopeCheckbox,
447
+ checked,
448
+ defaultChecked,
449
+ disabled,
450
+ required,
451
+ onCheckedChange,
452
+ name,
453
+ form,
454
+ value,
455
+ internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ jsxs(Fragment, { children: [
456
+ /* @__PURE__ */ jsx(
457
+ CheckboxTrigger,
458
+ {
459
+ ...checkboxProps,
460
+ ref: forwardedRef,
461
+ __scopeCheckbox
462
+ }
463
+ ),
464
+ isFormControl && /* @__PURE__ */ jsx(
465
+ CheckboxBubbleInput,
466
+ {
467
+ __scopeCheckbox
468
+ }
469
+ )
470
+ ] })
471
+ }
472
+ );
473
+ }
474
+ );
475
+ Checkbox$1.displayName = CHECKBOX_NAME;
476
+ var INDICATOR_NAME = "CheckboxIndicator";
477
+ var CheckboxIndicator = React.forwardRef(
478
+ (props, forwardedRef) => {
479
+ const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
480
+ const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);
481
+ return /* @__PURE__ */ jsx(
482
+ Presence,
483
+ {
484
+ present: forceMount || isIndeterminate(context.checked) || context.checked === true,
485
+ children: /* @__PURE__ */ jsx(
486
+ Primitive.span,
487
+ {
488
+ "data-state": getState(context.checked),
489
+ "data-disabled": context.disabled ? "" : void 0,
490
+ ...indicatorProps,
491
+ ref: forwardedRef,
492
+ style: { pointerEvents: "none", ...props.style }
493
+ }
494
+ )
495
+ }
496
+ );
497
+ }
498
+ );
499
+ CheckboxIndicator.displayName = INDICATOR_NAME;
500
+ var BUBBLE_INPUT_NAME = "CheckboxBubbleInput";
501
+ var CheckboxBubbleInput = React.forwardRef(
502
+ ({ __scopeCheckbox, ...props }, forwardedRef) => {
503
+ const {
504
+ control,
505
+ hasConsumerStoppedPropagationRef,
506
+ checked,
507
+ defaultChecked,
508
+ required,
509
+ disabled,
510
+ name,
511
+ value,
512
+ form,
513
+ bubbleInput,
514
+ setBubbleInput
515
+ } = useCheckboxContext(BUBBLE_INPUT_NAME, __scopeCheckbox);
516
+ const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);
517
+ const prevChecked = usePrevious(checked);
518
+ const controlSize = useSize(control);
519
+ React.useEffect(() => {
520
+ const input = bubbleInput;
521
+ if (!input) return;
522
+ const inputProto = window.HTMLInputElement.prototype;
523
+ const descriptor = Object.getOwnPropertyDescriptor(
524
+ inputProto,
525
+ "checked"
526
+ );
527
+ const setChecked = descriptor.set;
528
+ const bubbles = !hasConsumerStoppedPropagationRef.current;
529
+ if (prevChecked !== checked && setChecked) {
530
+ const event = new Event("click", { bubbles });
531
+ input.indeterminate = isIndeterminate(checked);
532
+ setChecked.call(input, isIndeterminate(checked) ? false : checked);
533
+ input.dispatchEvent(event);
534
+ }
535
+ }, [bubbleInput, prevChecked, checked, hasConsumerStoppedPropagationRef]);
536
+ const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);
537
+ return /* @__PURE__ */ jsx(
538
+ Primitive.input,
539
+ {
540
+ type: "checkbox",
541
+ "aria-hidden": true,
542
+ defaultChecked: defaultChecked ?? defaultCheckedRef.current,
543
+ required,
544
+ disabled,
545
+ name,
546
+ value,
547
+ form,
548
+ ...props,
549
+ tabIndex: -1,
550
+ ref: composedRefs,
551
+ style: {
552
+ ...props.style,
553
+ ...controlSize,
554
+ position: "absolute",
555
+ pointerEvents: "none",
556
+ opacity: 0,
557
+ margin: 0,
558
+ // We transform because the input is absolutely positioned but we have
559
+ // rendered it **after** the button. This pulls it back to sit on top
560
+ // of the button.
561
+ transform: "translateX(-100%)"
562
+ }
563
+ }
564
+ );
565
+ }
566
+ );
567
+ CheckboxBubbleInput.displayName = BUBBLE_INPUT_NAME;
568
+ function isFunction(value) {
569
+ return typeof value === "function";
570
+ }
571
+ function isIndeterminate(checked) {
572
+ return checked === "indeterminate";
573
+ }
574
+ function getState(checked) {
575
+ return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
576
+ }
577
+
578
+ /**
579
+ * @license lucide-react v0.544.0 - ISC
580
+ *
581
+ * This source code is licensed under the ISC license.
582
+ * See the LICENSE file in the root directory of this source tree.
583
+ */
584
+
585
+
586
+ const __iconNode = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
587
+ const Check = createLucideIcon("check", __iconNode);
588
+
589
+ function Checkbox({
590
+ className,
591
+ ...props
592
+ }) {
593
+ return /* @__PURE__ */ jsx(
594
+ Checkbox$1,
595
+ {
596
+ "data-slot": "checkbox",
597
+ className: cn(
598
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
599
+ className
600
+ ),
601
+ ...props,
602
+ children: /* @__PURE__ */ jsx(
603
+ CheckboxIndicator,
604
+ {
605
+ "data-slot": "checkbox-indicator",
606
+ className: "grid place-content-center text-current transition-none",
607
+ children: /* @__PURE__ */ jsx(Check, { className: "size-3.5" })
608
+ }
609
+ )
610
+ }
611
+ );
612
+ }
613
+
614
+ export { Checkbox as C };
615
+ //# sourceMappingURL=Checkbox.js.map