@tinybigui/react 0.1.0-rc.1 → 0.1.0

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.cjs CHANGED
@@ -1,21 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var $7jXr9$clsx = require('clsx');
3
+ var clsx = require('clsx');
4
4
  var tailwindMerge = require('tailwind-merge');
5
5
  var materialColorUtilities = require('@material/material-color-utilities');
6
- var $3whtM$react = require('react');
6
+ var react = require('react');
7
7
  var reactAria = require('react-aria');
8
+ var utils = require('@react-aria/utils');
8
9
  var jsxRuntime = require('react/jsx-runtime');
9
10
  var classVarianceAuthority = require('class-variance-authority');
10
-
11
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
-
13
- var $7jXr9$clsx__default = /*#__PURE__*/_interopDefault($7jXr9$clsx);
14
- var $3whtM$react__default = /*#__PURE__*/_interopDefault($3whtM$react);
11
+ var reactStately = require('react-stately');
15
12
 
16
13
  // src/utils/cn.ts
17
14
  function cn(...inputs) {
18
- return tailwindMerge.twMerge($7jXr9$clsx.clsx(inputs));
15
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
19
16
  }
20
17
  function getColorValue(variable, element = document.documentElement) {
21
18
  const varName = variable.startsWith("--") ? variable : `--${variable}`;
@@ -134,160 +131,9 @@ function truncateText(lines = 1) {
134
131
  textOverflow: "ellipsis"
135
132
  };
136
133
  }
137
- var $bdb11010cef70236$export$d41a04c74483c6ef = /* @__PURE__ */ new Map();
138
- if (typeof FinalizationRegistry !== "undefined") new FinalizationRegistry((heldValue) => {
139
- $bdb11010cef70236$export$d41a04c74483c6ef.delete(heldValue);
140
- });
141
- function $bdb11010cef70236$export$cd8c9cb68f842629(idA, idB) {
142
- if (idA === idB) return idA;
143
- let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef.get(idA);
144
- if (setIdsA) {
145
- setIdsA.forEach((ref) => ref.current = idB);
146
- return idB;
147
- }
148
- let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef.get(idB);
149
- if (setIdsB) {
150
- setIdsB.forEach((ref) => ref.current = idA);
151
- return idA;
152
- }
153
- return idB;
154
- }
155
-
156
- // ../../node_modules/.pnpm/@react-aria+utils@3.32.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@react-aria/utils/dist/chain.mjs
157
- function $ff5963eb1fccf552$export$e08e3b67e392101e(...callbacks) {
158
- return (...args) => {
159
- for (let callback of callbacks) if (typeof callback === "function") callback(...args);
160
- };
161
- }
162
- function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) {
163
- let result = {
164
- ...args[0]
165
- };
166
- for (let i = 1; i < args.length; i++) {
167
- let props = args[i];
168
- for (let key in props) {
169
- let a = result[key];
170
- let b = props[key];
171
- if (typeof a === "function" && typeof b === "function" && // This is a lot faster than a regex.
172
- key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
173
- 65 && key.charCodeAt(2) <= /* 'Z' */
174
- 90) result[key] = ($ff5963eb1fccf552$export$e08e3b67e392101e)(a, b);
175
- else if ((key === "className" || key === "UNSAFE_className") && typeof a === "string" && typeof b === "string") result[key] = ($7jXr9$clsx__default.default)(a, b);
176
- else if (key === "id" && a && b) result.id = ($bdb11010cef70236$export$cd8c9cb68f842629)(a, b);
177
- else result[key] = b !== void 0 ? b : a;
178
- }
179
- }
180
- return result;
181
- }
182
-
183
- // ../../node_modules/.pnpm/@react-aria+utils@3.32.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@react-aria/utils/dist/filterDOMProps.mjs
184
- var $65484d02dcb7eb3e$var$DOMPropNames = /* @__PURE__ */ new Set([
185
- "id"
186
- ]);
187
- var $65484d02dcb7eb3e$var$labelablePropNames = /* @__PURE__ */ new Set([
188
- "aria-label",
189
- "aria-labelledby",
190
- "aria-describedby",
191
- "aria-details"
192
- ]);
193
- var $65484d02dcb7eb3e$var$linkPropNames = /* @__PURE__ */ new Set([
194
- "href",
195
- "hrefLang",
196
- "target",
197
- "rel",
198
- "download",
199
- "ping",
200
- "referrerPolicy"
201
- ]);
202
- var $65484d02dcb7eb3e$var$globalAttrs = /* @__PURE__ */ new Set([
203
- "dir",
204
- "lang",
205
- "hidden",
206
- "inert",
207
- "translate"
208
- ]);
209
- var $65484d02dcb7eb3e$var$globalEvents = /* @__PURE__ */ new Set([
210
- "onClick",
211
- "onAuxClick",
212
- "onContextMenu",
213
- "onDoubleClick",
214
- "onMouseDown",
215
- "onMouseEnter",
216
- "onMouseLeave",
217
- "onMouseMove",
218
- "onMouseOut",
219
- "onMouseOver",
220
- "onMouseUp",
221
- "onTouchCancel",
222
- "onTouchEnd",
223
- "onTouchMove",
224
- "onTouchStart",
225
- "onPointerDown",
226
- "onPointerMove",
227
- "onPointerUp",
228
- "onPointerCancel",
229
- "onPointerEnter",
230
- "onPointerLeave",
231
- "onPointerOver",
232
- "onPointerOut",
233
- "onGotPointerCapture",
234
- "onLostPointerCapture",
235
- "onScroll",
236
- "onWheel",
237
- "onAnimationStart",
238
- "onAnimationEnd",
239
- "onAnimationIteration",
240
- "onTransitionCancel",
241
- "onTransitionEnd",
242
- "onTransitionRun",
243
- "onTransitionStart"
244
- ]);
245
- var $65484d02dcb7eb3e$var$propRe = /^(data-.*)$/;
246
- function $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, opts = {}) {
247
- let { labelable, isLink, global, events = global, propNames } = opts;
248
- let filteredProps = {};
249
- for (const prop in props) if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames.has(prop) || global && $65484d02dcb7eb3e$var$globalAttrs.has(prop) || events && ($65484d02dcb7eb3e$var$globalEvents.has(prop) || prop.endsWith("Capture") && $65484d02dcb7eb3e$var$globalEvents.has(prop.slice(0, -7))) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe.test(prop))) filteredProps[prop] = props[prop];
250
- return filteredProps;
251
- }
252
- var $458b0a5536c1a7cf$var$_React_useInsertionEffect;
253
- var $458b0a5536c1a7cf$var$useEarlyEffect = typeof document !== "undefined" ? ($458b0a5536c1a7cf$var$_React_useInsertionEffect = ($3whtM$react__default.default)["useInsertionEffect"]) !== null && $458b0a5536c1a7cf$var$_React_useInsertionEffect !== void 0 ? $458b0a5536c1a7cf$var$_React_useInsertionEffect : ($3whtM$react__default.default).useLayoutEffect : () => {
254
- };
255
- function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
256
- let [stateValue, setStateValue] = ($3whtM$react.useState)(value || defaultValue);
257
- let valueRef = ($3whtM$react.useRef)(stateValue);
258
- let isControlledRef = ($3whtM$react.useRef)(value !== void 0);
259
- let isControlled = value !== void 0;
260
- ($3whtM$react.useEffect)(() => {
261
- let wasControlled = isControlledRef.current;
262
- if (wasControlled !== isControlled && process.env.NODE_ENV !== "production") console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
263
- isControlledRef.current = isControlled;
264
- }, [
265
- isControlled
266
- ]);
267
- let currentValue = isControlled ? value : stateValue;
268
- $458b0a5536c1a7cf$var$useEarlyEffect(() => {
269
- valueRef.current = currentValue;
270
- });
271
- let [, forceUpdate] = ($3whtM$react.useReducer)(() => ({}), {});
272
- let setValue = ($3whtM$react.useCallback)((value2, ...args) => {
273
- let newValue = typeof value2 === "function" ? value2(valueRef.current) : value2;
274
- if (!Object.is(valueRef.current, newValue)) {
275
- valueRef.current = newValue;
276
- setStateValue(newValue);
277
- forceUpdate();
278
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue, ...args);
279
- }
280
- }, [
281
- onChange
282
- ]);
283
- return [
284
- currentValue,
285
- setValue
286
- ];
287
- }
288
- var ButtonHeadless = $3whtM$react.forwardRef(
134
+ var ButtonHeadless = react.forwardRef(
289
135
  ({ className, children, tabIndex = 0, onMouseDown, type, ...restProps }, forwardedRef) => {
290
- const internalRef = $3whtM$react.useRef(null);
136
+ const internalRef = react.useRef(null);
291
137
  const ref = forwardedRef ?? internalRef;
292
138
  const { buttonProps } = reactAria.useButton(
293
139
  {
@@ -306,7 +152,7 @@ var ButtonHeadless = $3whtM$react.forwardRef(
306
152
  onPressUp: _onPressUp,
307
153
  ...htmlAttrs
308
154
  } = restProps;
309
- const mergedProps = $3ef42575df84b30b$export$9d1611c77c2fe928(
155
+ const mergedProps = utils.mergeProps(
310
156
  buttonProps,
311
157
  {
312
158
  tabIndex,
@@ -537,9 +383,9 @@ var buttonVariants = classVarianceAuthority.cva(
537
383
  );
538
384
  function useRipple(options = {}) {
539
385
  const { disabled = false, color = "currentColor", duration = 450 } = options;
540
- const [ripples, setRipples] = $3whtM$react.useState([]);
541
- const rippleKeyCounter = $3whtM$react.useRef(0);
542
- const onMouseDown = $3whtM$react.useCallback(
386
+ const [ripples, setRipples] = react.useState([]);
387
+ const rippleKeyCounter = react.useRef(0);
388
+ const onMouseDown = react.useCallback(
543
389
  (event) => {
544
390
  if (disabled) return;
545
391
  const element = event.currentTarget;
@@ -607,7 +453,7 @@ var Spinner = () => /* @__PURE__ */ jsxRuntime.jsxs(
607
453
  ]
608
454
  }
609
455
  );
610
- var Button = $3whtM$react.forwardRef(
456
+ var Button = react.forwardRef(
611
457
  ({
612
458
  // Variant props (CVA)
613
459
  variant = "filled",
@@ -679,7 +525,7 @@ var Button = $3whtM$react.forwardRef(
679
525
  }
680
526
  );
681
527
  Button.displayName = "Button";
682
- var IconButtonHeadless = $3whtM$react.forwardRef(
528
+ var IconButtonHeadless = react.forwardRef(
683
529
  ({
684
530
  className,
685
531
  children,
@@ -691,7 +537,7 @@ var IconButtonHeadless = $3whtM$react.forwardRef(
691
537
  title,
692
538
  ...props
693
539
  }, forwardedRef) => {
694
- const internalRef = $3whtM$react.useRef(null);
540
+ const internalRef = react.useRef(null);
695
541
  const ref = forwardedRef ?? internalRef;
696
542
  const { buttonProps } = reactAria.useButton(
697
543
  {
@@ -703,8 +549,8 @@ var IconButtonHeadless = $3whtM$react.forwardRef(
703
549
  },
704
550
  ref
705
551
  );
706
- const domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
707
- const mergedProps = $3ef42575df84b30b$export$9d1611c77c2fe928(
552
+ const domProps = utils.filterDOMProps(props);
553
+ const mergedProps = utils.mergeProps(
708
554
  buttonProps,
709
555
  domProps,
710
556
  {
@@ -925,7 +771,7 @@ var iconButtonVariants = classVarianceAuthority.cva(
925
771
  }
926
772
  }
927
773
  );
928
- var IconButton = $3whtM$react.forwardRef(
774
+ var IconButton = react.forwardRef(
929
775
  ({
930
776
  // Variant props (CVA)
931
777
  variant = "standard",
@@ -962,7 +808,7 @@ var IconButton = $3whtM$react.forwardRef(
962
808
  onMouseDown?.(e);
963
809
  handleRipple(e);
964
810
  };
965
- const mergedPropsValue = $3ef42575df84b30b$export$9d1611c77c2fe928(props, {
811
+ const mergedPropsValue = utils.mergeProps(props, {
966
812
  ...onPress && { onPress },
967
813
  onMouseDown: mergedOnMouseDown,
968
814
  isDisabled
@@ -1002,7 +848,7 @@ var IconButton = $3whtM$react.forwardRef(
1002
848
  }
1003
849
  );
1004
850
  IconButton.displayName = "IconButton";
1005
- var FABHeadless = $3whtM$react.forwardRef(
851
+ var FABHeadless = react.forwardRef(
1006
852
  ({
1007
853
  className,
1008
854
  children,
@@ -1013,7 +859,7 @@ var FABHeadless = $3whtM$react.forwardRef(
1013
859
  title,
1014
860
  ...props
1015
861
  }, forwardedRef) => {
1016
- const internalRef = $3whtM$react.useRef(null);
862
+ const internalRef = react.useRef(null);
1017
863
  const ref = forwardedRef ?? internalRef;
1018
864
  const { buttonProps } = reactAria.useButton(
1019
865
  {
@@ -1022,8 +868,8 @@ var FABHeadless = $3whtM$react.forwardRef(
1022
868
  },
1023
869
  ref
1024
870
  );
1025
- const domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
1026
- const mergedProps = $3ef42575df84b30b$export$9d1611c77c2fe928(buttonProps, domProps, {
871
+ const domProps = utils.filterDOMProps(props);
872
+ const mergedProps = utils.mergeProps(buttonProps, domProps, {
1027
873
  tabIndex,
1028
874
  className,
1029
875
  onMouseDown,
@@ -1250,7 +1096,7 @@ var Spinner2 = () => /* @__PURE__ */ jsxRuntime.jsxs(
1250
1096
  ]
1251
1097
  }
1252
1098
  );
1253
- var FAB = $3whtM$react.forwardRef(
1099
+ var FAB = react.forwardRef(
1254
1100
  ({
1255
1101
  // Variant props (CVA)
1256
1102
  size = "medium",
@@ -1290,7 +1136,7 @@ var FAB = $3whtM$react.forwardRef(
1290
1136
  onMouseDown?.(e);
1291
1137
  handleRipple(e);
1292
1138
  };
1293
- const mergedPropsValue = $3ef42575df84b30b$export$9d1611c77c2fe928(props, {
1139
+ const mergedPropsValue = utils.mergeProps(props, {
1294
1140
  ...onPress && { onPress },
1295
1141
  onMouseDown: mergedOnMouseDown,
1296
1142
  isDisabled
@@ -1606,7 +1452,7 @@ var textFieldCharacterCountVariants = classVarianceAuthority.cva(
1606
1452
  }
1607
1453
  }
1608
1454
  );
1609
- var TextFieldHeadless = $3whtM$react.forwardRef(
1455
+ var TextFieldHeadless = react.forwardRef(
1610
1456
  ({
1611
1457
  label,
1612
1458
  description,
@@ -1623,7 +1469,7 @@ var TextFieldHeadless = $3whtM$react.forwardRef(
1623
1469
  children,
1624
1470
  ...restProps
1625
1471
  }, forwardedRef) => {
1626
- const internalRef = $3whtM$react.useRef(null);
1472
+ const internalRef = react.useRef(null);
1627
1473
  const ref = forwardedRef ?? internalRef;
1628
1474
  const inputElementType = multiline ? "textarea" : "input";
1629
1475
  const {
@@ -1650,7 +1496,7 @@ var TextFieldHeadless = $3whtM$react.forwardRef(
1650
1496
  const displayErrorMessage = errorMessage ?? validationErrors.join(" ");
1651
1497
  const currentValue = typeof inputProps.value === "string" ? inputProps.value : typeof inputProps.defaultValue === "string" ? inputProps.defaultValue : "";
1652
1498
  if (typeof children === "function") {
1653
- const mergedInputProps2 = $3ef42575df84b30b$export$9d1611c77c2fe928(
1499
+ const mergedInputProps2 = utils.mergeProps(
1654
1500
  inputProps,
1655
1501
  focusProps
1656
1502
  );
@@ -1692,7 +1538,7 @@ var TextFieldHeadless = $3whtM$react.forwardRef(
1692
1538
  onFocusChange: _onFocusChange,
1693
1539
  ...htmlAttrs
1694
1540
  } = restProps;
1695
- const mergedInputProps = $3ef42575df84b30b$export$9d1611c77c2fe928(inputProps, focusProps, htmlAttrs, {
1541
+ const mergedInputProps = utils.mergeProps(inputProps, focusProps, htmlAttrs, {
1696
1542
  className: inputClassName
1697
1543
  });
1698
1544
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: fullWidth ? { width: "100%" } : void 0, children: [
@@ -1711,7 +1557,7 @@ var TextFieldHeadless = $3whtM$react.forwardRef(
1711
1557
  }
1712
1558
  );
1713
1559
  TextFieldHeadless.displayName = "TextFieldHeadless";
1714
- var TextField = $3whtM$react.forwardRef(
1560
+ var TextField = react.forwardRef(
1715
1561
  ({
1716
1562
  variant = "filled",
1717
1563
  size = "medium",
@@ -1909,196 +1755,6 @@ var TextField = $3whtM$react.forwardRef(
1909
1755
  }
1910
1756
  );
1911
1757
  TextField.displayName = "TextField";
1912
- var $e5be200c675c3b3a$export$aca958c65c314e6c = {
1913
- badInput: false,
1914
- customError: false,
1915
- patternMismatch: false,
1916
- rangeOverflow: false,
1917
- rangeUnderflow: false,
1918
- stepMismatch: false,
1919
- tooLong: false,
1920
- tooShort: false,
1921
- typeMismatch: false,
1922
- valueMissing: false,
1923
- valid: true
1924
- };
1925
- var $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE = {
1926
- ...$e5be200c675c3b3a$export$aca958c65c314e6c,
1927
- customError: true,
1928
- valid: false
1929
- };
1930
- var $e5be200c675c3b3a$export$dad6ae84456c676a = {
1931
- isInvalid: false,
1932
- validationDetails: $e5be200c675c3b3a$export$aca958c65c314e6c,
1933
- validationErrors: []
1934
- };
1935
- var $e5be200c675c3b3a$export$571b5131b7e65c11 = ($3whtM$react.createContext)({});
1936
- var $e5be200c675c3b3a$export$a763b9476acd3eb = "__formValidationState" + Date.now();
1937
- function $e5be200c675c3b3a$export$fc1a364ae1f3ff10(props) {
1938
- if (props[$e5be200c675c3b3a$export$a763b9476acd3eb]) {
1939
- let { realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation } = props[$e5be200c675c3b3a$export$a763b9476acd3eb];
1940
- return {
1941
- realtimeValidation,
1942
- displayValidation,
1943
- updateValidation,
1944
- resetValidation,
1945
- commitValidation
1946
- };
1947
- }
1948
- return $e5be200c675c3b3a$var$useFormValidationStateImpl(props);
1949
- }
1950
- function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
1951
- let { isInvalid, validationState, name, value, builtinValidation, validate, validationBehavior = "aria" } = props;
1952
- if (validationState) isInvalid || (isInvalid = validationState === "invalid");
1953
- let controlledError = isInvalid !== void 0 ? {
1954
- isInvalid,
1955
- validationErrors: [],
1956
- validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
1957
- } : null;
1958
- let clientError = ($3whtM$react.useMemo)(() => {
1959
- if (!validate || value == null) return null;
1960
- let validateErrors = $e5be200c675c3b3a$var$runValidate(validate, value);
1961
- return $e5be200c675c3b3a$var$getValidationResult(validateErrors);
1962
- }, [
1963
- validate,
1964
- value
1965
- ]);
1966
- if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid) builtinValidation = void 0;
1967
- let serverErrors = ($3whtM$react.useContext)($e5be200c675c3b3a$export$571b5131b7e65c11);
1968
- let serverErrorMessages = ($3whtM$react.useMemo)(() => {
1969
- if (name) return Array.isArray(name) ? name.flatMap((name2) => $e5be200c675c3b3a$var$asArray(serverErrors[name2])) : $e5be200c675c3b3a$var$asArray(serverErrors[name]);
1970
- return [];
1971
- }, [
1972
- serverErrors,
1973
- name
1974
- ]);
1975
- let [lastServerErrors, setLastServerErrors] = ($3whtM$react.useState)(serverErrors);
1976
- let [isServerErrorCleared, setServerErrorCleared] = ($3whtM$react.useState)(false);
1977
- if (serverErrors !== lastServerErrors) {
1978
- setLastServerErrors(serverErrors);
1979
- setServerErrorCleared(false);
1980
- }
1981
- let serverError = ($3whtM$react.useMemo)(() => $e5be200c675c3b3a$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [
1982
- isServerErrorCleared,
1983
- serverErrorMessages
1984
- ]);
1985
- let nextValidation = ($3whtM$react.useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
1986
- let [currentValidity, setCurrentValidity] = ($3whtM$react.useState)($e5be200c675c3b3a$export$dad6ae84456c676a);
1987
- let lastError = ($3whtM$react.useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
1988
- let commitValidation = () => {
1989
- if (!commitQueued) return;
1990
- setCommitQueued(false);
1991
- let error = clientError || builtinValidation || nextValidation.current;
1992
- if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
1993
- lastError.current = error;
1994
- setCurrentValidity(error);
1995
- }
1996
- };
1997
- let [commitQueued, setCommitQueued] = ($3whtM$react.useState)(false);
1998
- ($3whtM$react.useEffect)(commitValidation);
1999
- let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $e5be200c675c3b3a$export$dad6ae84456c676a;
2000
- let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
2001
- return {
2002
- realtimeValidation,
2003
- displayValidation,
2004
- updateValidation(value2) {
2005
- if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation(currentValidity, value2)) setCurrentValidity(value2);
2006
- else nextValidation.current = value2;
2007
- },
2008
- resetValidation() {
2009
- let error = $e5be200c675c3b3a$export$dad6ae84456c676a;
2010
- if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
2011
- lastError.current = error;
2012
- setCurrentValidity(error);
2013
- }
2014
- if (validationBehavior === "native") setCommitQueued(false);
2015
- setServerErrorCleared(true);
2016
- },
2017
- commitValidation() {
2018
- if (validationBehavior === "native") setCommitQueued(true);
2019
- setServerErrorCleared(true);
2020
- }
2021
- };
2022
- }
2023
- function $e5be200c675c3b3a$var$asArray(v) {
2024
- if (!v) return [];
2025
- return Array.isArray(v) ? v : [
2026
- v
2027
- ];
2028
- }
2029
- function $e5be200c675c3b3a$var$runValidate(validate, value) {
2030
- if (typeof validate === "function") {
2031
- let e = validate(value);
2032
- if (e && typeof e !== "boolean") return $e5be200c675c3b3a$var$asArray(e);
2033
- }
2034
- return [];
2035
- }
2036
- function $e5be200c675c3b3a$var$getValidationResult(errors) {
2037
- return errors.length ? {
2038
- isInvalid: true,
2039
- validationErrors: errors,
2040
- validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
2041
- } : null;
2042
- }
2043
- function $e5be200c675c3b3a$var$isEqualValidation(a, b) {
2044
- if (a === b) return true;
2045
- return !!a && !!b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a2, i) => a2 === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v]) => b.validationDetails[k] === v);
2046
- }
2047
- var $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 1e10);
2048
- var $a54cdc5c1942b639$var$i = 0;
2049
- function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
2050
- let name = ($3whtM$react.useMemo)(() => props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [
2051
- props.name
2052
- ]);
2053
- var _props_defaultValue;
2054
- let [selectedValue, setSelected] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
2055
- let [initialValue] = ($3whtM$react.useState)(selectedValue);
2056
- let [lastFocusedValue, setLastFocusedValue] = ($3whtM$react.useState)(null);
2057
- let validation = ($e5be200c675c3b3a$export$fc1a364ae1f3ff10)({
2058
- ...props,
2059
- value: selectedValue
2060
- });
2061
- let setSelectedValue = (value) => {
2062
- if (!props.isReadOnly && !props.isDisabled) {
2063
- setSelected(value);
2064
- validation.commitValidation();
2065
- }
2066
- };
2067
- let isInvalid = validation.displayValidation.isInvalid;
2068
- var _props_defaultValue1;
2069
- return {
2070
- ...validation,
2071
- name,
2072
- selectedValue,
2073
- defaultSelectedValue: props.value !== void 0 ? initialValue : (_props_defaultValue1 = props.defaultValue) !== null && _props_defaultValue1 !== void 0 ? _props_defaultValue1 : null,
2074
- setSelectedValue,
2075
- lastFocusedValue,
2076
- setLastFocusedValue,
2077
- isDisabled: props.isDisabled || false,
2078
- isReadOnly: props.isReadOnly || false,
2079
- isRequired: props.isRequired || false,
2080
- validationState: props.validationState || (isInvalid ? "invalid" : null),
2081
- isInvalid
2082
- };
2083
- }
2084
- function $3017fa7ffdddec74$export$8042c6c013fd5226(props = {}) {
2085
- let { isReadOnly } = props;
2086
- let [isSelected, setSelected] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.isSelected, props.defaultSelected || false, props.onChange);
2087
- let [initialValue] = ($3whtM$react.useState)(isSelected);
2088
- function updateSelected(value) {
2089
- if (!isReadOnly) setSelected(value);
2090
- }
2091
- function toggleState() {
2092
- if (!isReadOnly) setSelected(!isSelected);
2093
- }
2094
- var _props_defaultSelected;
2095
- return {
2096
- isSelected,
2097
- defaultSelected: (_props_defaultSelected = props.defaultSelected) !== null && _props_defaultSelected !== void 0 ? _props_defaultSelected : initialValue,
2098
- setSelected: updateSelected,
2099
- toggle: toggleState
2100
- };
2101
- }
2102
1758
  var checkboxVariants = classVarianceAuthority.cva(
2103
1759
  [
2104
1760
  // Base classes (always applied to label wrapper)
@@ -2288,7 +1944,7 @@ var checkboxLabelVariants = classVarianceAuthority.cva(
2288
1944
  }
2289
1945
  }
2290
1946
  );
2291
- var Checkbox = $3whtM$react.forwardRef(
1947
+ var Checkbox = react.forwardRef(
2292
1948
  ({
2293
1949
  // Content props
2294
1950
  children,
@@ -2302,7 +1958,7 @@ var Checkbox = $3whtM$react.forwardRef(
2302
1958
  // Other props
2303
1959
  ...props
2304
1960
  }, forwardedRef) => {
2305
- const internalRef = $3whtM$react.useRef(null);
1961
+ const internalRef = react.useRef(null);
2306
1962
  const ref = forwardedRef ?? internalRef;
2307
1963
  const htmlAttrs = props;
2308
1964
  const dataTestId = htmlAttrs["data-testid"];
@@ -2314,7 +1970,7 @@ var Checkbox = $3whtM$react.forwardRef(
2314
1970
  title: _htmlTitle,
2315
1971
  ...restPropsWithoutHtmlAttrs
2316
1972
  } = props;
2317
- const state = $3017fa7ffdddec74$export$8042c6c013fd5226(restPropsWithoutHtmlAttrs);
1973
+ const state = reactStately.useToggleState(restPropsWithoutHtmlAttrs);
2318
1974
  const { inputProps, labelProps } = reactAria.useCheckbox(
2319
1975
  restPropsWithoutHtmlAttrs,
2320
1976
  state,
@@ -2326,7 +1982,7 @@ var Checkbox = $3whtM$react.forwardRef(
2326
1982
  const { onMouseDown: handleRipple, ripples } = useRipple({
2327
1983
  disabled: isDisabled || disableRipple
2328
1984
  });
2329
- $3whtM$react.useEffect(() => {
1985
+ react.useEffect(() => {
2330
1986
  if (ref.current) {
2331
1987
  ref.current.indeterminate = isIndeterminate;
2332
1988
  }
@@ -2705,7 +2361,7 @@ var switchLabelVariants = classVarianceAuthority.cva(
2705
2361
  }
2706
2362
  }
2707
2363
  );
2708
- var Switch = $3whtM$react.forwardRef(
2364
+ var Switch = react.forwardRef(
2709
2365
  ({
2710
2366
  // Content props
2711
2367
  children,
@@ -2719,7 +2375,7 @@ var Switch = $3whtM$react.forwardRef(
2719
2375
  // Other props
2720
2376
  ...props
2721
2377
  }, forwardedRef) => {
2722
- const internalRef = $3whtM$react.useRef(null);
2378
+ const internalRef = react.useRef(null);
2723
2379
  const ref = forwardedRef ?? internalRef;
2724
2380
  const htmlAttrs = props;
2725
2381
  const dataTestId = htmlAttrs["data-testid"];
@@ -2731,7 +2387,7 @@ var Switch = $3whtM$react.forwardRef(
2731
2387
  title: _htmlTitle,
2732
2388
  ...restPropsWithoutHtmlAttrs
2733
2389
  } = props;
2734
- const state = $3017fa7ffdddec74$export$8042c6c013fd5226(restPropsWithoutHtmlAttrs);
2390
+ const state = reactStately.useToggleState(restPropsWithoutHtmlAttrs);
2735
2391
  const { inputProps, labelProps, isPressed } = reactAria.useSwitch(
2736
2392
  restPropsWithoutHtmlAttrs,
2737
2393
  state,
@@ -2857,12 +2513,12 @@ var Switch = $3whtM$react.forwardRef(
2857
2513
  }
2858
2514
  );
2859
2515
  Switch.displayName = "Switch";
2860
- var RadioGroupContext = $3whtM$react.createContext(null);
2861
- var RadioGroupHeadless = $3whtM$react.forwardRef(
2516
+ var RadioGroupContext = react.createContext(null);
2517
+ var RadioGroupHeadless = react.forwardRef(
2862
2518
  ({ className, children, renderLabel, ...props }, forwardedRef) => {
2863
- const internalRef = $3whtM$react.useRef(null);
2519
+ const internalRef = react.useRef(null);
2864
2520
  const ref = forwardedRef ?? internalRef;
2865
- const state = $a54cdc5c1942b639$export$bca9d026f8e704eb(props);
2521
+ const state = reactStately.useRadioGroupState(props);
2866
2522
  const { radioGroupProps, labelProps } = reactAria.useRadioGroup(props, state);
2867
2523
  const dataTestId = props["data-testid"];
2868
2524
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...radioGroupProps, ref, className, "data-testid": dataTestId, children: [
@@ -3091,7 +2747,7 @@ var radioLabelVariants = classVarianceAuthority.cva(
3091
2747
  }
3092
2748
  }
3093
2749
  );
3094
- var Radio = $3whtM$react.forwardRef(
2750
+ var Radio = react.forwardRef(
3095
2751
  ({
3096
2752
  // Content props
3097
2753
  children,
@@ -3103,11 +2759,11 @@ var Radio = $3whtM$react.forwardRef(
3103
2759
  // Other props
3104
2760
  ...props
3105
2761
  }, forwardedRef) => {
3106
- const state = $3whtM$react.useContext(RadioGroupContext);
2762
+ const state = react.useContext(RadioGroupContext);
3107
2763
  if (!state) {
3108
2764
  throw new Error("Radio must be used within a RadioGroup");
3109
2765
  }
3110
- const internalRef = $3whtM$react.useRef(null);
2766
+ const internalRef = react.useRef(null);
3111
2767
  const ref = forwardedRef ?? internalRef;
3112
2768
  const htmlAttrs = props;
3113
2769
  const dataTestId = htmlAttrs["data-testid"];
@@ -3245,13 +2901,13 @@ var Radio = $3whtM$react.forwardRef(
3245
2901
  }
3246
2902
  );
3247
2903
  Radio.displayName = "Radio";
3248
- var RadioGroup = $3whtM$react.forwardRef(
2904
+ var RadioGroup = react.forwardRef(
3249
2905
  ({
3250
2906
  // Content props
3251
2907
  children,
3252
2908
  // State props
3253
2909
  orientation = "vertical",
3254
- isInvalid = false,
2910
+ isInvalid: _isInvalid = false,
3255
2911
  isDisabled = false,
3256
2912
  // Styling
3257
2913
  className,
@@ -3306,13 +2962,13 @@ var RadioGroup = $3whtM$react.forwardRef(
3306
2962
  }
3307
2963
  );
3308
2964
  RadioGroup.displayName = "RadioGroup";
3309
- var RadioHeadless = $3whtM$react.forwardRef(
2965
+ var RadioHeadless = react.forwardRef(
3310
2966
  ({ className, children, renderRadio, ...props }, forwardedRef) => {
3311
- const state = $3whtM$react.useContext(RadioGroupContext);
2967
+ const state = react.useContext(RadioGroupContext);
3312
2968
  if (!state) {
3313
2969
  throw new Error("RadioHeadless must be used within a RadioGroupHeadless");
3314
2970
  }
3315
- const internalRef = $3whtM$react.useRef(null);
2971
+ const internalRef = react.useRef(null);
3316
2972
  const ref = forwardedRef ?? internalRef;
3317
2973
  const { inputProps, isSelected, isDisabled, isPressed } = reactAria.useRadio(props, state, ref);
3318
2974
  const { isFocusVisible, focusProps } = reactAria.useFocusRing();