@radix-ui/react-checkbox 1.1.0-rc.1 → 1.1.0-rc.3

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 CHANGED
@@ -1,184 +1,193 @@
1
1
  "use strict";
2
- (() => {
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
10
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
11
- }) : x)(function(x) {
12
- if (typeof require !== "undefined") return require.apply(this, arguments);
13
- throw Error('Dynamic require of "' + x + '" is not supported');
14
- });
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from))
18
- if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // packages/react/checkbox/src/index.ts
32
+ var src_exports = {};
33
+ __export(src_exports, {
34
+ Checkbox: () => Checkbox,
35
+ CheckboxIndicator: () => CheckboxIndicator,
36
+ Indicator: () => Indicator,
37
+ Root: () => Root,
38
+ createCheckboxScope: () => createCheckboxScope
39
+ });
40
+ module.exports = __toCommonJS(src_exports);
31
41
 
32
- // packages/react/checkbox/src/Checkbox.tsx
33
- var React = __toESM(__require("react"));
34
- var import_react_compose_refs = __require("@radix-ui/react-compose-refs");
35
- var import_react_context = __require("@radix-ui/react-context");
36
- var import_primitive = __require("@radix-ui/primitive");
37
- var import_react_use_controllable_state = __require("@radix-ui/react-use-controllable-state");
38
- var import_react_use_previous = __require("@radix-ui/react-use-previous");
39
- var import_react_use_size = __require("@radix-ui/react-use-size");
40
- var import_react_presence = __require("@radix-ui/react-presence");
41
- var import_react_primitive = __require("@radix-ui/react-primitive");
42
- var import_jsx_runtime = __require("react/jsx-runtime");
43
- var CHECKBOX_NAME = "Checkbox";
44
- var [createCheckboxContext, createCheckboxScope] = (0, import_react_context.createContextScope)(CHECKBOX_NAME);
45
- var [CheckboxProvider, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
46
- var Checkbox = React.forwardRef(
47
- (props, forwardedRef) => {
48
- const {
49
- __scopeCheckbox,
50
- name,
51
- checked: checkedProp,
52
- defaultChecked,
53
- required,
54
- disabled,
55
- value = "on",
56
- onCheckedChange,
57
- ...checkboxProps
58
- } = props;
59
- const [button, setButton] = React.useState(null);
60
- const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, (node) => setButton(node));
61
- const hasConsumerStoppedPropagationRef = React.useRef(false);
62
- const isFormControl = button ? Boolean(button.closest("form")) : true;
63
- const [checked = false, setChecked] = (0, import_react_use_controllable_state.useControllableState)({
64
- prop: checkedProp,
65
- defaultProp: defaultChecked,
66
- onChange: onCheckedChange
67
- });
68
- const initialCheckedStateRef = React.useRef(checked);
69
- React.useEffect(() => {
70
- const form = button?.form;
71
- if (form) {
72
- const reset = () => setChecked(initialCheckedStateRef.current);
73
- form.addEventListener("reset", reset);
74
- return () => form.removeEventListener("reset", reset);
42
+ // packages/react/checkbox/src/Checkbox.tsx
43
+ var React = __toESM(require("react"));
44
+ var import_react_compose_refs = require("@radix-ui/react-compose-refs");
45
+ var import_react_context = require("@radix-ui/react-context");
46
+ var import_primitive = require("@radix-ui/primitive");
47
+ var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state");
48
+ var import_react_use_previous = require("@radix-ui/react-use-previous");
49
+ var import_react_use_size = require("@radix-ui/react-use-size");
50
+ var import_react_presence = require("@radix-ui/react-presence");
51
+ var import_react_primitive = require("@radix-ui/react-primitive");
52
+ var import_jsx_runtime = require("react/jsx-runtime");
53
+ var CHECKBOX_NAME = "Checkbox";
54
+ var [createCheckboxContext, createCheckboxScope] = (0, import_react_context.createContextScope)(CHECKBOX_NAME);
55
+ var [CheckboxProvider, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
56
+ var Checkbox = React.forwardRef(
57
+ (props, forwardedRef) => {
58
+ const {
59
+ __scopeCheckbox,
60
+ name,
61
+ checked: checkedProp,
62
+ defaultChecked,
63
+ required,
64
+ disabled,
65
+ value = "on",
66
+ onCheckedChange,
67
+ ...checkboxProps
68
+ } = props;
69
+ const [button, setButton] = React.useState(null);
70
+ const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, (node) => setButton(node));
71
+ const hasConsumerStoppedPropagationRef = React.useRef(false);
72
+ const isFormControl = button ? Boolean(button.closest("form")) : true;
73
+ const [checked = false, setChecked] = (0, import_react_use_controllable_state.useControllableState)({
74
+ prop: checkedProp,
75
+ defaultProp: defaultChecked,
76
+ onChange: onCheckedChange
77
+ });
78
+ const initialCheckedStateRef = React.useRef(checked);
79
+ React.useEffect(() => {
80
+ const form = button?.form;
81
+ if (form) {
82
+ const reset = () => setChecked(initialCheckedStateRef.current);
83
+ form.addEventListener("reset", reset);
84
+ return () => form.removeEventListener("reset", reset);
85
+ }
86
+ }, [button, setChecked]);
87
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CheckboxProvider, { scope: __scopeCheckbox, state: checked, disabled, children: [
88
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
89
+ import_react_primitive.Primitive.button,
90
+ {
91
+ type: "button",
92
+ role: "checkbox",
93
+ "aria-checked": isIndeterminate(checked) ? "mixed" : checked,
94
+ "aria-required": required,
95
+ "data-state": getState(checked),
96
+ "data-disabled": disabled ? "" : void 0,
97
+ disabled,
98
+ value,
99
+ ...checkboxProps,
100
+ ref: composedRefs,
101
+ onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => {
102
+ if (event.key === "Enter") event.preventDefault();
103
+ }),
104
+ onClick: (0, import_primitive.composeEventHandlers)(props.onClick, (event) => {
105
+ setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
106
+ if (isFormControl) {
107
+ hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
108
+ if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
109
+ }
110
+ })
75
111
  }
76
- }, [button, setChecked]);
77
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CheckboxProvider, { scope: __scopeCheckbox, state: checked, disabled, children: [
78
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
79
- import_react_primitive.Primitive.button,
80
- {
81
- type: "button",
82
- role: "checkbox",
83
- "aria-checked": isIndeterminate(checked) ? "mixed" : checked,
84
- "aria-required": required,
85
- "data-state": getState(checked),
86
- "data-disabled": disabled ? "" : void 0,
87
- disabled,
88
- value,
89
- ...checkboxProps,
90
- ref: composedRefs,
91
- onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => {
92
- if (event.key === "Enter") event.preventDefault();
93
- }),
94
- onClick: (0, import_primitive.composeEventHandlers)(props.onClick, (event) => {
95
- setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
96
- if (isFormControl) {
97
- hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
98
- if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
99
- }
100
- })
101
- }
102
- ),
103
- isFormControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
104
- BubbleInput,
105
- {
106
- control: button,
107
- bubbles: !hasConsumerStoppedPropagationRef.current,
108
- name,
109
- value,
110
- checked,
111
- required,
112
- disabled,
113
- style: { transform: "translateX(-100%)" }
114
- }
115
- )
116
- ] });
117
- }
118
- );
119
- Checkbox.displayName = CHECKBOX_NAME;
120
- var INDICATOR_NAME = "CheckboxIndicator";
121
- var CheckboxIndicator = React.forwardRef(
122
- (props, forwardedRef) => {
123
- const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
124
- const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);
125
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || isIndeterminate(context.state) || context.state === true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
126
- import_react_primitive.Primitive.span,
112
+ ),
113
+ isFormControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
114
+ BubbleInput,
127
115
  {
128
- "data-state": getState(context.state),
129
- "data-disabled": context.disabled ? "" : void 0,
130
- ...indicatorProps,
131
- ref: forwardedRef,
132
- style: { pointerEvents: "none", ...props.style }
116
+ control: button,
117
+ bubbles: !hasConsumerStoppedPropagationRef.current,
118
+ name,
119
+ value,
120
+ checked,
121
+ required,
122
+ disabled,
123
+ style: { transform: "translateX(-100%)" }
133
124
  }
134
- ) });
135
- }
136
- );
137
- CheckboxIndicator.displayName = INDICATOR_NAME;
138
- var BubbleInput = (props) => {
139
- const { control, checked, bubbles = true, ...inputProps } = props;
140
- const ref = React.useRef(null);
141
- const prevChecked = (0, import_react_use_previous.usePrevious)(checked);
142
- const controlSize = (0, import_react_use_size.useSize)(control);
143
- React.useEffect(() => {
144
- const input = ref.current;
145
- const inputProto = window.HTMLInputElement.prototype;
146
- const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
147
- const setChecked = descriptor.set;
148
- if (prevChecked !== checked && setChecked) {
149
- const event = new Event("click", { bubbles });
150
- input.indeterminate = isIndeterminate(checked);
151
- setChecked.call(input, isIndeterminate(checked) ? false : checked);
152
- input.dispatchEvent(event);
153
- }
154
- }, [prevChecked, checked, bubbles]);
155
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
156
- "input",
125
+ )
126
+ ] });
127
+ }
128
+ );
129
+ Checkbox.displayName = CHECKBOX_NAME;
130
+ var INDICATOR_NAME = "CheckboxIndicator";
131
+ var CheckboxIndicator = React.forwardRef(
132
+ (props, forwardedRef) => {
133
+ const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
134
+ const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);
135
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || isIndeterminate(context.state) || context.state === true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
136
+ import_react_primitive.Primitive.span,
157
137
  {
158
- type: "checkbox",
159
- "aria-hidden": true,
160
- defaultChecked: isIndeterminate(checked) ? false : checked,
161
- ...inputProps,
162
- tabIndex: -1,
163
- ref,
164
- style: {
165
- ...props.style,
166
- ...controlSize,
167
- position: "absolute",
168
- pointerEvents: "none",
169
- opacity: 0,
170
- margin: 0
171
- }
138
+ "data-state": getState(context.state),
139
+ "data-disabled": context.disabled ? "" : void 0,
140
+ ...indicatorProps,
141
+ ref: forwardedRef,
142
+ style: { pointerEvents: "none", ...props.style }
172
143
  }
173
- );
174
- };
175
- function isIndeterminate(checked) {
176
- return checked === "indeterminate";
177
- }
178
- function getState(checked) {
179
- return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
144
+ ) });
180
145
  }
181
- var Root = Checkbox;
182
- var Indicator = CheckboxIndicator;
183
- })();
146
+ );
147
+ CheckboxIndicator.displayName = INDICATOR_NAME;
148
+ var BubbleInput = (props) => {
149
+ const { control, checked, bubbles = true, ...inputProps } = props;
150
+ const ref = React.useRef(null);
151
+ const prevChecked = (0, import_react_use_previous.usePrevious)(checked);
152
+ const controlSize = (0, import_react_use_size.useSize)(control);
153
+ React.useEffect(() => {
154
+ const input = ref.current;
155
+ const inputProto = window.HTMLInputElement.prototype;
156
+ const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
157
+ const setChecked = descriptor.set;
158
+ if (prevChecked !== checked && setChecked) {
159
+ const event = new Event("click", { bubbles });
160
+ input.indeterminate = isIndeterminate(checked);
161
+ setChecked.call(input, isIndeterminate(checked) ? false : checked);
162
+ input.dispatchEvent(event);
163
+ }
164
+ }, [prevChecked, checked, bubbles]);
165
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
166
+ "input",
167
+ {
168
+ type: "checkbox",
169
+ "aria-hidden": true,
170
+ defaultChecked: isIndeterminate(checked) ? false : checked,
171
+ ...inputProps,
172
+ tabIndex: -1,
173
+ ref,
174
+ style: {
175
+ ...props.style,
176
+ ...controlSize,
177
+ position: "absolute",
178
+ pointerEvents: "none",
179
+ opacity: 0,
180
+ margin: 0
181
+ }
182
+ }
183
+ );
184
+ };
185
+ function isIndeterminate(checked) {
186
+ return checked === "indeterminate";
187
+ }
188
+ function getState(checked) {
189
+ return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
190
+ }
191
+ var Root = Checkbox;
192
+ var Indicator = CheckboxIndicator;
184
193
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/Checkbox.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { usePrevious } from '@radix-ui/react-use-previous';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Checkbox\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_NAME = 'Checkbox';\n\ntype ScopedProps<P> = P & { __scopeCheckbox?: Scope };\nconst [createCheckboxContext, createCheckboxScope] = createContextScope(CHECKBOX_NAME);\n\ntype CheckedState = boolean | 'indeterminate';\n\ntype CheckboxContextValue = {\n state: CheckedState;\n disabled?: boolean;\n};\n\nconst [CheckboxProvider, useCheckboxContext] =\n createCheckboxContext<CheckboxContextValue>(CHECKBOX_NAME);\n\ntype CheckboxElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface CheckboxProps extends Omit<PrimitiveButtonProps, 'checked' | 'defaultChecked'> {\n checked?: CheckedState;\n defaultChecked?: CheckedState;\n required?: boolean;\n onCheckedChange?(checked: CheckedState): void;\n}\n\nconst Checkbox = React.forwardRef<CheckboxElement, CheckboxProps>(\n (props: ScopedProps<CheckboxProps>, forwardedRef) => {\n const {\n __scopeCheckbox,\n name,\n checked: checkedProp,\n defaultChecked,\n required,\n disabled,\n value = 'on',\n onCheckedChange,\n ...checkboxProps\n } = props;\n const [button, setButton] = React.useState<HTMLButtonElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));\n const hasConsumerStoppedPropagationRef = React.useRef(false);\n // We set this to true by default so that events bubble to forms without JS (SSR)\n const isFormControl = button ? Boolean(button.closest('form')) : true;\n const [checked = false, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked,\n onChange: onCheckedChange,\n });\n const initialCheckedStateRef = React.useRef(checked);\n React.useEffect(() => {\n const form = button?.form;\n if (form) {\n const reset = () => setChecked(initialCheckedStateRef.current);\n form.addEventListener('reset', reset);\n return () => form.removeEventListener('reset', reset);\n }\n }, [button, setChecked]);\n\n return (\n <CheckboxProvider scope={__scopeCheckbox} state={checked} disabled={disabled}>\n <Primitive.button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={isIndeterminate(checked) ? 'mixed' : checked}\n aria-required={required}\n data-state={getState(checked)}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n value={value}\n {...checkboxProps}\n ref={composedRefs}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n // According to WAI ARIA, Checkboxes don't activate on enter keypress\n if (event.key === 'Enter') event.preventDefault();\n })}\n onClick={composeEventHandlers(props.onClick, (event) => {\n setChecked((prevChecked) => (isIndeterminate(prevChecked) ? true : !prevChecked));\n if (isFormControl) {\n hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n // if checkbox is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect checkbox updates.\n if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n }\n })}\n />\n {isFormControl && (\n <BubbleInput\n control={button}\n bubbles={!hasConsumerStoppedPropagationRef.current}\n name={name}\n value={value}\n checked={checked}\n required={required}\n disabled={disabled}\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n style={{ transform: 'translateX(-100%)' }}\n />\n )}\n </CheckboxProvider>\n );\n }\n);\n\nCheckbox.displayName = CHECKBOX_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'CheckboxIndicator';\n\ntype CheckboxIndicatorElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface CheckboxIndicatorProps extends PrimitiveSpanProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst CheckboxIndicator = React.forwardRef<CheckboxIndicatorElement, CheckboxIndicatorProps>(\n (props: ScopedProps<CheckboxIndicatorProps>, forwardedRef) => {\n const { __scopeCheckbox, forceMount, ...indicatorProps } = props;\n const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);\n return (\n <Presence present={forceMount || isIndeterminate(context.state) || context.state === true}>\n <Primitive.span\n data-state={getState(context.state)}\n data-disabled={context.disabled ? '' : undefined}\n {...indicatorProps}\n ref={forwardedRef}\n style={{ pointerEvents: 'none', ...props.style }}\n />\n </Presence>\n );\n }\n);\n\nCheckboxIndicator.displayName = INDICATOR_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype InputProps = Radix.ComponentPropsWithoutRef<'input'>;\ninterface BubbleInputProps extends Omit<InputProps, 'checked'> {\n checked: CheckedState;\n control: HTMLElement | null;\n bubbles: boolean;\n}\n\nconst BubbleInput = (props: BubbleInputProps) => {\n const { control, checked, bubbles = true, ...inputProps } = props;\n const ref = React.useRef<HTMLInputElement>(null);\n const prevChecked = usePrevious(checked);\n const controlSize = useSize(control);\n\n // Bubble checked change to parents (e.g form change event)\n React.useEffect(() => {\n const input = ref.current!;\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked') as PropertyDescriptor;\n const setChecked = descriptor.set;\n\n if (prevChecked !== checked && setChecked) {\n const event = new Event('click', { bubbles });\n input.indeterminate = isIndeterminate(checked);\n setChecked.call(input, isIndeterminate(checked) ? false : checked);\n input.dispatchEvent(event);\n }\n }, [prevChecked, checked, bubbles]);\n\n return (\n <input\n type=\"checkbox\"\n aria-hidden\n defaultChecked={isIndeterminate(checked) ? false : checked}\n {...inputProps}\n tabIndex={-1}\n ref={ref}\n style={{\n ...props.style,\n ...controlSize,\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n }}\n />\n );\n};\n\nfunction isIndeterminate(checked?: CheckedState): checked is 'indeterminate' {\n return checked === 'indeterminate';\n}\n\nfunction getState(checked: CheckedState) {\n return isIndeterminate(checked) ? 'indeterminate' : checked ? 'checked' : 'unchecked';\n}\n\nconst Root = Checkbox;\nconst Indicator = CheckboxIndicator;\n\nexport {\n createCheckboxScope,\n //\n Checkbox,\n CheckboxIndicator,\n //\n Root,\n Indicator,\n};\nexport type { CheckboxProps, CheckboxIndicatorProps };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAuB;AACvB,kCAAgC;AAChC,6BAAmC;AACnC,yBAAqC;AACrC,4CAAqC;AACrC,kCAA4B;AAC5B,8BAAwB;AACxB,8BAAyB;AACzB,+BAA0B;AAmEpB;AA1DN,MAAM,gBAAgB;AAGtB,MAAM,CAAC,uBAAuB,mBAAmB,QAAI,yCAAmB,aAAa;AASrF,MAAM,CAAC,kBAAkB,kBAAkB,IACzC,sBAA4C,aAAa;AAW3D,MAAM,W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,IAAM,gBAAU,MAAM;AACpB,YAAM,QAAQ,IAAI;AAClB,YAAM,aAAa,OAAO,iBAAiB;AAC3C,YAAM,aAAa,OAAO,yBAAyB,YAAY,SAAS;AACxE,YAAM,aAAa,WAAW;AAE9B,UAAI,gBAAgB,WAAW,YAAY;AACzC,cAAM,QAAQ,IAAI,MAAM,SAAS,EAAE,QAAQ,CAAC;AAC5C,cAAM,gBAAgB,gBAAgB,OAAO;AAC7C,mBAAW,KAAK,OAAO,gBAAgB,OAAO,IAAI,QAAQ,OAAO;AACjE,cAAM,cAAc,KAAK;AAAA,MAC3B;AAAA,IACF,GAAG,CAAC,aAAa,SAAS,OAAO,CAAC;AAElC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,eAAW;AAAA,QACX,gBAAgB,gBAAgB,OAAO,IAAI,QAAQ;AAAA,QAClD,GAAG;AAAA,QACJ,UAAU;AAAA,QACV;AAAA,QACA,OAAO;AAAA,UACL,GAAG,MAAM;AAAA,UACT,GAAG;AAAA,UACH,UAAU;AAAA,UACV,eAAe;AAAA,UACf,SAAS;AAAA,UACT,QAAQ;AAAA,QACV;AAAA;AAAA,IACF;AAAA,EAEJ;AAEA,WAAS,gBAAgB,SAAoD;AAC3E,WAAO,YAAY;AAAA,EACrB;AAEA,WAAS,SAAS,SAAuB;AACvC,WAAO,gBAAgB,OAAO,IAAI,kBAAkB,UAAU,YAAY;AAAA,EAC5E;AAEA,MAAM,OAAO;AACb,MAAM,YAAY;",
3
+ "sources": ["../src/index.ts", "../src/Checkbox.tsx"],
4
+ "sourcesContent": ["'use client';\nexport {\n createCheckboxScope,\n //\n Checkbox,\n CheckboxIndicator,\n //\n Root,\n Indicator,\n} from './Checkbox';\nexport type { CheckboxProps, CheckboxIndicatorProps } from './Checkbox';\n", "import * as React from 'react';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { usePrevious } from '@radix-ui/react-use-previous';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Checkbox\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_NAME = 'Checkbox';\n\ntype ScopedProps<P> = P & { __scopeCheckbox?: Scope };\nconst [createCheckboxContext, createCheckboxScope] = createContextScope(CHECKBOX_NAME);\n\ntype CheckedState = boolean | 'indeterminate';\n\ntype CheckboxContextValue = {\n state: CheckedState;\n disabled?: boolean;\n};\n\nconst [CheckboxProvider, useCheckboxContext] =\n createCheckboxContext<CheckboxContextValue>(CHECKBOX_NAME);\n\ntype CheckboxElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface CheckboxProps extends Omit<PrimitiveButtonProps, 'checked' | 'defaultChecked'> {\n checked?: CheckedState;\n defaultChecked?: CheckedState;\n required?: boolean;\n onCheckedChange?(checked: CheckedState): void;\n}\n\nconst Checkbox = React.forwardRef<CheckboxElement, CheckboxProps>(\n (props: ScopedProps<CheckboxProps>, forwardedRef) => {\n const {\n __scopeCheckbox,\n name,\n checked: checkedProp,\n defaultChecked,\n required,\n disabled,\n value = 'on',\n onCheckedChange,\n ...checkboxProps\n } = props;\n const [button, setButton] = React.useState<HTMLButtonElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));\n const hasConsumerStoppedPropagationRef = React.useRef(false);\n // We set this to true by default so that events bubble to forms without JS (SSR)\n const isFormControl = button ? Boolean(button.closest('form')) : true;\n const [checked = false, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked,\n onChange: onCheckedChange,\n });\n const initialCheckedStateRef = React.useRef(checked);\n React.useEffect(() => {\n const form = button?.form;\n if (form) {\n const reset = () => setChecked(initialCheckedStateRef.current);\n form.addEventListener('reset', reset);\n return () => form.removeEventListener('reset', reset);\n }\n }, [button, setChecked]);\n\n return (\n <CheckboxProvider scope={__scopeCheckbox} state={checked} disabled={disabled}>\n <Primitive.button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={isIndeterminate(checked) ? 'mixed' : checked}\n aria-required={required}\n data-state={getState(checked)}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n value={value}\n {...checkboxProps}\n ref={composedRefs}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n // According to WAI ARIA, Checkboxes don't activate on enter keypress\n if (event.key === 'Enter') event.preventDefault();\n })}\n onClick={composeEventHandlers(props.onClick, (event) => {\n setChecked((prevChecked) => (isIndeterminate(prevChecked) ? true : !prevChecked));\n if (isFormControl) {\n hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n // if checkbox is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect checkbox updates.\n if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n }\n })}\n />\n {isFormControl && (\n <BubbleInput\n control={button}\n bubbles={!hasConsumerStoppedPropagationRef.current}\n name={name}\n value={value}\n checked={checked}\n required={required}\n disabled={disabled}\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n style={{ transform: 'translateX(-100%)' }}\n />\n )}\n </CheckboxProvider>\n );\n }\n);\n\nCheckbox.displayName = CHECKBOX_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'CheckboxIndicator';\n\ntype CheckboxIndicatorElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface CheckboxIndicatorProps extends PrimitiveSpanProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst CheckboxIndicator = React.forwardRef<CheckboxIndicatorElement, CheckboxIndicatorProps>(\n (props: ScopedProps<CheckboxIndicatorProps>, forwardedRef) => {\n const { __scopeCheckbox, forceMount, ...indicatorProps } = props;\n const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);\n return (\n <Presence present={forceMount || isIndeterminate(context.state) || context.state === true}>\n <Primitive.span\n data-state={getState(context.state)}\n data-disabled={context.disabled ? '' : undefined}\n {...indicatorProps}\n ref={forwardedRef}\n style={{ pointerEvents: 'none', ...props.style }}\n />\n </Presence>\n );\n }\n);\n\nCheckboxIndicator.displayName = INDICATOR_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype InputProps = Radix.ComponentPropsWithoutRef<'input'>;\ninterface BubbleInputProps extends Omit<InputProps, 'checked'> {\n checked: CheckedState;\n control: HTMLElement | null;\n bubbles: boolean;\n}\n\nconst BubbleInput = (props: BubbleInputProps) => {\n const { control, checked, bubbles = true, ...inputProps } = props;\n const ref = React.useRef<HTMLInputElement>(null);\n const prevChecked = usePrevious(checked);\n const controlSize = useSize(control);\n\n // Bubble checked change to parents (e.g form change event)\n React.useEffect(() => {\n const input = ref.current!;\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked') as PropertyDescriptor;\n const setChecked = descriptor.set;\n\n if (prevChecked !== checked && setChecked) {\n const event = new Event('click', { bubbles });\n input.indeterminate = isIndeterminate(checked);\n setChecked.call(input, isIndeterminate(checked) ? false : checked);\n input.dispatchEvent(event);\n }\n }, [prevChecked, checked, bubbles]);\n\n return (\n <input\n type=\"checkbox\"\n aria-hidden\n defaultChecked={isIndeterminate(checked) ? false : checked}\n {...inputProps}\n tabIndex={-1}\n ref={ref}\n style={{\n ...props.style,\n ...controlSize,\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n }}\n />\n );\n};\n\nfunction isIndeterminate(checked?: CheckedState): checked is 'indeterminate' {\n return checked === 'indeterminate';\n}\n\nfunction getState(checked: CheckedState) {\n return isIndeterminate(checked) ? 'indeterminate' : checked ? 'checked' : 'unchecked';\n}\n\nconst Root = Checkbox;\nconst Indicator = CheckboxIndicator;\n\nexport {\n createCheckboxScope,\n //\n Checkbox,\n CheckboxIndicator,\n //\n Root,\n Indicator,\n};\nexport type { CheckboxProps, CheckboxIndicatorProps };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,gCAAgC;AAChC,2BAAmC;AACnC,uBAAqC;AACrC,0CAAqC;AACrC,gCAA4B;AAC5B,4BAAwB;AACxB,4BAAyB;AACzB,6BAA0B;AAmEpB;AA1DN,IAAM,gBAAgB;AAGtB,IAAM,CAAC,uBAAuB,mBAAmB,QAAI,yCAAmB,aAAa;AASrF,IAAM,CAAC,kBAAkB,kBAAkB,IACzC,sBAA4C,aAAa;AAW3D,IAAM,WAAiB;AAAA,EACrB,CAAC,OAAmC,iBAAiB;AACnD,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACA,GAAG;AAAA,IACL,IAAI;AACJ,UAAM,CAAC,QAAQ,SAAS,IAAU,eAAmC,IAAI;AACzE,UAAM,mBAAe,2CAAgB,cAAc,CAAC,SAAS,UAAU,IAAI,CAAC;AAC5E,UAAM,mCAAyC,aAAO,KAAK;AAE3D,UAAM,gBAAgB,SAAS,QAAQ,OAAO,QAAQ,MAAM,CAAC,IAAI;AACjE,UAAM,CAAC,UAAU,OAAO,UAAU,QAAI,0DAAqB;AAAA,MACzD,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU;AAAA,IACZ,CAAC;AACD,UAAM,yB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AA,MACJ,UAAU;AAAA,MACV;AAAA,MACA,OAAO;AAAA,QACL,GAAG,MAAM;AAAA,QACT,GAAG;AAAA,QACH,UAAU;AAAA,QACV,eAAe;AAAA,QACf,SAAS;AAAA,QACT,QAAQ;AAAA,MACV;AAAA;AAAA,EACF;AAEJ;AAEA,SAAS,gBAAgB,SAAoD;AAC3E,SAAO,YAAY;AACrB;AAEA,SAAS,SAAS,SAAuB;AACvC,SAAO,gBAAgB,OAAO,IAAI,kBAAkB,UAAU,YAAY;AAC5E;AAEA,IAAM,OAAO;AACb,IAAM,YAAY;",
6
6
  "names": []
7
7
  }
package/dist/index.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  // packages/react/checkbox/src/Checkbox.tsx
2
4
  import * as React from "react";
3
5
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/Checkbox.tsx"],
4
4
  "sourcesContent": ["import * as React from 'react';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { usePrevious } from '@radix-ui/react-use-previous';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Checkbox\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_NAME = 'Checkbox';\n\ntype ScopedProps<P> = P & { __scopeCheckbox?: Scope };\nconst [createCheckboxContext, createCheckboxScope] = createContextScope(CHECKBOX_NAME);\n\ntype CheckedState = boolean | 'indeterminate';\n\ntype CheckboxContextValue = {\n state: CheckedState;\n disabled?: boolean;\n};\n\nconst [CheckboxProvider, useCheckboxContext] =\n createCheckboxContext<CheckboxContextValue>(CHECKBOX_NAME);\n\ntype CheckboxElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface CheckboxProps extends Omit<PrimitiveButtonProps, 'checked' | 'defaultChecked'> {\n checked?: CheckedState;\n defaultChecked?: CheckedState;\n required?: boolean;\n onCheckedChange?(checked: CheckedState): void;\n}\n\nconst Checkbox = React.forwardRef<CheckboxElement, CheckboxProps>(\n (props: ScopedProps<CheckboxProps>, forwardedRef) => {\n const {\n __scopeCheckbox,\n name,\n checked: checkedProp,\n defaultChecked,\n required,\n disabled,\n value = 'on',\n onCheckedChange,\n ...checkboxProps\n } = props;\n const [button, setButton] = React.useState<HTMLButtonElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));\n const hasConsumerStoppedPropagationRef = React.useRef(false);\n // We set this to true by default so that events bubble to forms without JS (SSR)\n const isFormControl = button ? Boolean(button.closest('form')) : true;\n const [checked = false, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked,\n onChange: onCheckedChange,\n });\n const initialCheckedStateRef = React.useRef(checked);\n React.useEffect(() => {\n const form = button?.form;\n if (form) {\n const reset = () => setChecked(initialCheckedStateRef.current);\n form.addEventListener('reset', reset);\n return () => form.removeEventListener('reset', reset);\n }\n }, [button, setChecked]);\n\n return (\n <CheckboxProvider scope={__scopeCheckbox} state={checked} disabled={disabled}>\n <Primitive.button\n type=\"button\"\n role=\"checkbox\"\n aria-checked={isIndeterminate(checked) ? 'mixed' : checked}\n aria-required={required}\n data-state={getState(checked)}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n value={value}\n {...checkboxProps}\n ref={composedRefs}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n // According to WAI ARIA, Checkboxes don't activate on enter keypress\n if (event.key === 'Enter') event.preventDefault();\n })}\n onClick={composeEventHandlers(props.onClick, (event) => {\n setChecked((prevChecked) => (isIndeterminate(prevChecked) ? true : !prevChecked));\n if (isFormControl) {\n hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n // if checkbox is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect checkbox updates.\n if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n }\n })}\n />\n {isFormControl && (\n <BubbleInput\n control={button}\n bubbles={!hasConsumerStoppedPropagationRef.current}\n name={name}\n value={value}\n checked={checked}\n required={required}\n disabled={disabled}\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n style={{ transform: 'translateX(-100%)' }}\n />\n )}\n </CheckboxProvider>\n );\n }\n);\n\nCheckbox.displayName = CHECKBOX_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'CheckboxIndicator';\n\ntype CheckboxIndicatorElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface CheckboxIndicatorProps extends PrimitiveSpanProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst CheckboxIndicator = React.forwardRef<CheckboxIndicatorElement, CheckboxIndicatorProps>(\n (props: ScopedProps<CheckboxIndicatorProps>, forwardedRef) => {\n const { __scopeCheckbox, forceMount, ...indicatorProps } = props;\n const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);\n return (\n <Presence present={forceMount || isIndeterminate(context.state) || context.state === true}>\n <Primitive.span\n data-state={getState(context.state)}\n data-disabled={context.disabled ? '' : undefined}\n {...indicatorProps}\n ref={forwardedRef}\n style={{ pointerEvents: 'none', ...props.style }}\n />\n </Presence>\n );\n }\n);\n\nCheckboxIndicator.displayName = INDICATOR_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype InputProps = Radix.ComponentPropsWithoutRef<'input'>;\ninterface BubbleInputProps extends Omit<InputProps, 'checked'> {\n checked: CheckedState;\n control: HTMLElement | null;\n bubbles: boolean;\n}\n\nconst BubbleInput = (props: BubbleInputProps) => {\n const { control, checked, bubbles = true, ...inputProps } = props;\n const ref = React.useRef<HTMLInputElement>(null);\n const prevChecked = usePrevious(checked);\n const controlSize = useSize(control);\n\n // Bubble checked change to parents (e.g form change event)\n React.useEffect(() => {\n const input = ref.current!;\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked') as PropertyDescriptor;\n const setChecked = descriptor.set;\n\n if (prevChecked !== checked && setChecked) {\n const event = new Event('click', { bubbles });\n input.indeterminate = isIndeterminate(checked);\n setChecked.call(input, isIndeterminate(checked) ? false : checked);\n input.dispatchEvent(event);\n }\n }, [prevChecked, checked, bubbles]);\n\n return (\n <input\n type=\"checkbox\"\n aria-hidden\n defaultChecked={isIndeterminate(checked) ? false : checked}\n {...inputProps}\n tabIndex={-1}\n ref={ref}\n style={{\n ...props.style,\n ...controlSize,\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n }}\n />\n );\n};\n\nfunction isIndeterminate(checked?: CheckedState): checked is 'indeterminate' {\n return checked === 'indeterminate';\n}\n\nfunction getState(checked: CheckedState) {\n return isIndeterminate(checked) ? 'indeterminate' : checked ? 'checked' : 'unchecked';\n}\n\nconst Root = Checkbox;\nconst Indicator = CheckboxIndicator;\n\nexport {\n createCheckboxScope,\n //\n Checkbox,\n CheckboxIndicator,\n //\n Root,\n Indicator,\n};\nexport type { CheckboxProps, CheckboxIndicatorProps };\n"],
5
- "mappings": ";AAAA,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAmEpB,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
  ".": {
@@ -28,14 +28,14 @@
28
28
  "version": "yarn version"
29
29
  },
30
30
  "dependencies": {
31
- "@radix-ui/primitive": "1.1.0-rc.1",
32
- "@radix-ui/react-compose-refs": "1.1.0-rc.1",
33
- "@radix-ui/react-context": "1.1.0-rc.1",
34
- "@radix-ui/react-presence": "1.1.0-rc.1",
35
- "@radix-ui/react-primitive": "1.1.0-rc.1",
36
- "@radix-ui/react-use-controllable-state": "1.1.0-rc.1",
37
- "@radix-ui/react-use-previous": "1.1.0-rc.1",
38
- "@radix-ui/react-use-size": "1.1.0-rc.1"
31
+ "@radix-ui/primitive": "1.1.0-rc.3",
32
+ "@radix-ui/react-compose-refs": "1.1.0-rc.3",
33
+ "@radix-ui/react-context": "1.1.0-rc.3",
34
+ "@radix-ui/react-presence": "1.1.0-rc.3",
35
+ "@radix-ui/react-primitive": "1.1.0-rc.3",
36
+ "@radix-ui/react-use-controllable-state": "1.1.0-rc.3",
37
+ "@radix-ui/react-use-previous": "1.1.0-rc.3",
38
+ "@radix-ui/react-use-size": "1.1.0-rc.3"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@types/react": "*",