@seeqdev/qomponents 0.0.155-react-19-v7 → 0.0.155-react-19-v9

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.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import React__default, { useLayoutEffect, useState, useRef, useEffect, useCallback, forwardRef, useContext, useMemo, createContext, Component, Fragment as Fragment$1, useId as useId$1, useInsertionEffect as useInsertionEffect$1, Children, isValidElement, createElement } from 'react';
3
- import { jsx as jsx$1, Fragment, jsxs } from 'react/jsx-runtime';
2
+ import React__default, { useLayoutEffect, useState, useRef, useEffect, useCallback, forwardRef, useContext, useMemo, createContext, Component, Fragment, useId as useId$1, useInsertionEffect as useInsertionEffect$2, Children, isValidElement, createElement } from 'react';
3
+ import { jsx as jsx$1, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
4
4
  import * as ReactDOM from 'react-dom';
5
5
  import ReactDOM__default, { createPortal } from 'react-dom';
6
6
 
@@ -191,7 +191,7 @@ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForD
191
191
  };
192
192
  }
193
193
 
194
- // packages/react/compose-refs/src/composeRefs.tsx
194
+ // packages/react/compose-refs/src/compose-refs.tsx
195
195
  function setRef(ref, value) {
196
196
  if (typeof ref === "function") {
197
197
  return ref(value);
@@ -227,7 +227,7 @@ function useComposedRefs(...refs) {
227
227
  return React.useCallback(composeRefs(...refs), refs);
228
228
  }
229
229
 
230
- // packages/react/context/src/createContext.tsx
230
+ // packages/react/context/src/create-context.tsx
231
231
  function createContext2(rootComponentName, defaultContext) {
232
232
  const Context = React.createContext(defaultContext);
233
233
  const Provider = (props) => {
@@ -302,44 +302,51 @@ function composeContextScopes(...scopes) {
302
302
  return createScope;
303
303
  }
304
304
 
305
- // packages/react/slot/src/slot.tsx
306
- var Slot = React.forwardRef((props, forwardedRef) => {
307
- const { children, ...slotProps } = props;
308
- const childrenArray = React.Children.toArray(children);
309
- const slottable = childrenArray.find(isSlottable);
310
- if (slottable) {
311
- const newElement = slottable.props.children;
312
- const newChildren = childrenArray.map((child) => {
313
- if (child === slottable) {
314
- if (React.Children.count(newElement) > 1) return React.Children.only(null);
315
- return React.isValidElement(newElement) ? newElement.props.children : null;
316
- } else {
317
- return child;
305
+ // src/slot.tsx
306
+ // @__NO_SIDE_EFFECTS__
307
+ function createSlot(ownerName) {
308
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
309
+ const Slot2 = React.forwardRef((props, forwardedRef) => {
310
+ const { children, ...slotProps } = props;
311
+ const childrenArray = React.Children.toArray(children);
312
+ const slottable = childrenArray.find(isSlottable);
313
+ if (slottable) {
314
+ const newElement = slottable.props.children;
315
+ const newChildren = childrenArray.map((child) => {
316
+ if (child === slottable) {
317
+ if (React.Children.count(newElement) > 1) return React.Children.only(null);
318
+ return React.isValidElement(newElement) ? newElement.props.children : null;
319
+ } else {
320
+ return child;
321
+ }
322
+ });
323
+ return /* @__PURE__ */ jsx$1(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
324
+ }
325
+ return /* @__PURE__ */ jsx$1(SlotClone, { ...slotProps, ref: forwardedRef, children });
326
+ });
327
+ Slot2.displayName = `${ownerName}.Slot`;
328
+ return Slot2;
329
+ }
330
+ // @__NO_SIDE_EFFECTS__
331
+ function createSlotClone(ownerName) {
332
+ const SlotClone = React.forwardRef((props, forwardedRef) => {
333
+ const { children, ...slotProps } = props;
334
+ if (React.isValidElement(children)) {
335
+ const childrenRef = getElementRef$1(children);
336
+ const props2 = mergeProps(slotProps, children.props);
337
+ if (children.type !== React.Fragment) {
338
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
318
339
  }
319
- });
320
- return /* @__PURE__ */ jsx$1(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
321
- }
322
- return /* @__PURE__ */ jsx$1(SlotClone, { ...slotProps, ref: forwardedRef, children });
323
- });
324
- Slot.displayName = "Slot";
325
- var SlotClone = React.forwardRef((props, forwardedRef) => {
326
- const { children, ...slotProps } = props;
327
- if (React.isValidElement(children)) {
328
- const childrenRef = getElementRef$1(children);
329
- const props2 = mergeProps(slotProps, children.props);
330
- if (children.type !== React.Fragment) {
331
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
332
- }
333
- return React.cloneElement(children, props2);
334
- }
335
- return React.Children.count(children) > 1 ? React.Children.only(null) : null;
336
- });
337
- SlotClone.displayName = "SlotClone";
338
- var Slottable = ({ children }) => {
339
- return /* @__PURE__ */ jsx$1(Fragment, { children });
340
- };
340
+ return React.cloneElement(children, props2);
341
+ }
342
+ return React.Children.count(children) > 1 ? React.Children.only(null) : null;
343
+ });
344
+ SlotClone.displayName = `${ownerName}.SlotClone`;
345
+ return SlotClone;
346
+ }
347
+ var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
341
348
  function isSlottable(child) {
342
- return React.isValidElement(child) && child.type === Slottable;
349
+ return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
343
350
  }
344
351
  function mergeProps(slotProps, childProps) {
345
352
  const overrideProps = { ...childProps };
@@ -350,8 +357,9 @@ function mergeProps(slotProps, childProps) {
350
357
  if (isHandler) {
351
358
  if (slotPropValue && childPropValue) {
352
359
  overrideProps[propName] = (...args) => {
353
- childPropValue(...args);
360
+ const result = childPropValue(...args);
354
361
  slotPropValue(...args);
362
+ return result;
355
363
  };
356
364
  } else if (slotPropValue) {
357
365
  overrideProps[propName] = slotPropValue;
@@ -378,7 +386,7 @@ function getElementRef$1(element) {
378
386
  return element.props.ref || element.ref;
379
387
  }
380
388
 
381
- // packages/react/primitive/src/primitive.tsx
389
+ // src/primitive.tsx
382
390
  var NODES = [
383
391
  "a",
384
392
  "button",
@@ -393,11 +401,13 @@ var NODES = [
393
401
  "nav",
394
402
  "ol",
395
403
  "p",
404
+ "select",
396
405
  "span",
397
406
  "svg",
398
407
  "ul"
399
408
  ];
400
409
  var Primitive = NODES.reduce((primitive, node) => {
410
+ const Slot = createSlot(`Primitive.${node}`);
401
411
  const Node = React.forwardRef((props, forwardedRef) => {
402
412
  const { asChild, ...primitiveProps } = props;
403
413
  const Comp = asChild ? Slot : node;
@@ -413,7 +423,7 @@ function dispatchDiscreteCustomEvent(target, event) {
413
423
  if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
414
424
  }
415
425
 
416
- // packages/react/use-callback-ref/src/useCallbackRef.tsx
426
+ // packages/react/use-callback-ref/src/use-callback-ref.tsx
417
427
  function useCallbackRef$1(callback) {
418
428
  const callbackRef = React.useRef(callback);
419
429
  React.useEffect(() => {
@@ -422,7 +432,7 @@ function useCallbackRef$1(callback) {
422
432
  return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
423
433
  }
424
434
 
425
- // packages/react/use-escape-keydown/src/useEscapeKeydown.tsx
435
+ // packages/react/use-escape-keydown/src/use-escape-keydown.tsx
426
436
  function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
427
437
  const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
428
438
  React.useEffect(() => {
@@ -864,12 +874,12 @@ function removeLinks(items) {
864
874
  return items.filter((item) => item.tagName !== "A");
865
875
  }
866
876
 
867
- // packages/react/use-layout-effect/src/useLayoutEffect.tsx
868
- var useLayoutEffect2 = Boolean(globalThis?.document) ? React.useLayoutEffect : () => {
877
+ // packages/react/use-layout-effect/src/use-layout-effect.tsx
878
+ var useLayoutEffect2 = globalThis?.document ? React.useLayoutEffect : () => {
869
879
  };
870
880
 
871
881
  // packages/react/id/src/id.tsx
872
- var useReactId = React["useId".toString()] || (() => void 0);
882
+ var useReactId = React[" useId ".trim().toString()] || (() => void 0);
873
883
  var count = 0;
874
884
  function useId(deterministicId) {
875
885
  const [id, setId] = React.useState(useReactId());
@@ -2857,7 +2867,7 @@ const arrow = (options, deps) => ({
2857
2867
  options: [options, deps]
2858
2868
  });
2859
2869
 
2860
- // packages/react/arrow/src/arrow.tsx
2870
+ // src/arrow.tsx
2861
2871
  var NAME = "Arrow";
2862
2872
  var Arrow$1 = React.forwardRef((props, forwardedRef) => {
2863
2873
  const { children, width = 10, height = 5, ...arrowProps } = props;
@@ -2877,7 +2887,7 @@ var Arrow$1 = React.forwardRef((props, forwardedRef) => {
2877
2887
  Arrow$1.displayName = NAME;
2878
2888
  var Root$5 = Arrow$1;
2879
2889
 
2880
- // packages/react/use-size/src/useSize.tsx
2890
+ // packages/react/use-size/src/use-size.tsx
2881
2891
  function useSize(element) {
2882
2892
  const [size, setSize] = React.useState(void 0);
2883
2893
  useLayoutEffect2(() => {
@@ -3195,7 +3205,7 @@ function useStateMachine(initialState, machine) {
3195
3205
  }, initialState);
3196
3206
  }
3197
3207
 
3198
- // packages/react/presence/src/Presence.tsx
3208
+ // src/presence.tsx
3199
3209
  var Presence = (props) => {
3200
3210
  const { present, children } = props;
3201
3211
  const presence = usePresence$1(present);
@@ -3207,7 +3217,7 @@ var Presence = (props) => {
3207
3217
  Presence.displayName = "Presence";
3208
3218
  function usePresence$1(present) {
3209
3219
  const [node, setNode] = React.useState();
3210
- const stylesRef = React.useRef({});
3220
+ const stylesRef = React.useRef(null);
3211
3221
  const prevPresentRef = React.useRef(present);
3212
3222
  const prevAnimationNameRef = React.useRef("none");
3213
3223
  const initialState = present ? "mounted" : "unmounted";
@@ -3291,7 +3301,7 @@ function usePresence$1(present) {
3291
3301
  return {
3292
3302
  isPresent: ["mounted", "unmountSuspended"].includes(state),
3293
3303
  ref: React.useCallback((node2) => {
3294
- if (node2) stylesRef.current = getComputedStyle(node2);
3304
+ stylesRef.current = node2 ? getComputedStyle(node2) : null;
3295
3305
  setNode(node2);
3296
3306
  }, [])
3297
3307
  };
@@ -3313,28 +3323,47 @@ function getElementRef(element) {
3313
3323
  return element.props.ref || element.ref;
3314
3324
  }
3315
3325
 
3316
- // packages/react/use-controllable-state/src/useControllableState.tsx
3326
+ // src/use-controllable-state.tsx
3327
+ var useInsertionEffect$1 = React[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
3317
3328
  function useControllableState({
3318
3329
  prop,
3319
3330
  defaultProp,
3320
3331
  onChange = () => {
3321
- }
3332
+ },
3333
+ caller
3322
3334
  }) {
3323
- const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
3335
+ const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
3336
+ defaultProp,
3337
+ onChange
3338
+ });
3324
3339
  const isControlled = prop !== void 0;
3325
3340
  const value = isControlled ? prop : uncontrolledProp;
3326
- const handleChange = useCallbackRef$1(onChange);
3341
+ {
3342
+ const isControlledRef = React.useRef(prop !== void 0);
3343
+ React.useEffect(() => {
3344
+ const wasControlled = isControlledRef.current;
3345
+ if (wasControlled !== isControlled) {
3346
+ const from = wasControlled ? "controlled" : "uncontrolled";
3347
+ const to = isControlled ? "controlled" : "uncontrolled";
3348
+ console.warn(
3349
+ `${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.`
3350
+ );
3351
+ }
3352
+ isControlledRef.current = isControlled;
3353
+ }, [isControlled, caller]);
3354
+ }
3327
3355
  const setValue = React.useCallback(
3328
3356
  (nextValue) => {
3329
3357
  if (isControlled) {
3330
- const setter = nextValue;
3331
- const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
3332
- if (value2 !== prop) handleChange(value2);
3358
+ const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
3359
+ if (value2 !== prop) {
3360
+ onChangeRef.current?.(value2);
3361
+ }
3333
3362
  } else {
3334
3363
  setUncontrolledProp(nextValue);
3335
3364
  }
3336
3365
  },
3337
- [isControlled, prop, setUncontrolledProp, handleChange]
3366
+ [isControlled, prop, setUncontrolledProp, onChangeRef]
3338
3367
  );
3339
3368
  return [value, setValue];
3340
3369
  }
@@ -3342,17 +3371,22 @@ function useUncontrolledState({
3342
3371
  defaultProp,
3343
3372
  onChange
3344
3373
  }) {
3345
- const uncontrolledState = React.useState(defaultProp);
3346
- const [value] = uncontrolledState;
3374
+ const [value, setValue] = React.useState(defaultProp);
3347
3375
  const prevValueRef = React.useRef(value);
3348
- const handleChange = useCallbackRef$1(onChange);
3376
+ const onChangeRef = React.useRef(onChange);
3377
+ useInsertionEffect$1(() => {
3378
+ onChangeRef.current = onChange;
3379
+ }, [onChange]);
3349
3380
  React.useEffect(() => {
3350
3381
  if (prevValueRef.current !== value) {
3351
- handleChange(value);
3382
+ onChangeRef.current?.(value);
3352
3383
  prevValueRef.current = value;
3353
3384
  }
3354
- }, [value, prevValueRef, handleChange]);
3355
- return uncontrolledState;
3385
+ }, [value, prevValueRef]);
3386
+ return [value, setValue, onChangeRef];
3387
+ }
3388
+ function isFunction(value) {
3389
+ return typeof value === "function";
3356
3390
  }
3357
3391
 
3358
3392
  var getDefaultParent = function (originalTarget) {
@@ -4256,10 +4290,11 @@ var Popover = (props) => {
4256
4290
  const popperScope = usePopperScope$1(__scopePopover);
4257
4291
  const triggerRef = React.useRef(null);
4258
4292
  const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
4259
- const [open = false, setOpen] = useControllableState({
4293
+ const [open, setOpen] = useControllableState({
4260
4294
  prop: openProp,
4261
- defaultProp: defaultOpen,
4262
- onChange: onOpenChange
4295
+ defaultProp: defaultOpen ?? false,
4296
+ onChange: onOpenChange,
4297
+ caller: POPOVER_NAME
4263
4298
  });
4264
4299
  return /* @__PURE__ */ jsx$1(Root2$4, { ...popperScope, children: /* @__PURE__ */ jsx$1(
4265
4300
  PopoverProvider,
@@ -4338,6 +4373,7 @@ var PopoverContent$1 = React.forwardRef(
4338
4373
  }
4339
4374
  );
4340
4375
  PopoverContent$1.displayName = CONTENT_NAME$6;
4376
+ var Slot$2 = createSlot("PopoverContent.RemoveScroll");
4341
4377
  var PopoverContentModal = React.forwardRef(
4342
4378
  (props, forwardedRef) => {
4343
4379
  const context = usePopoverContext(CONTENT_NAME$6, props.__scopePopover);
@@ -4348,7 +4384,7 @@ var PopoverContentModal = React.forwardRef(
4348
4384
  const content = contentRef.current;
4349
4385
  if (content) return hideOthers(content);
4350
4386
  }, []);
4351
- return /* @__PURE__ */ jsx$1(RemoveScroll, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ jsx$1(
4387
+ return /* @__PURE__ */ jsx$1(RemoveScroll, { as: Slot$2, allowPinchZoom: true, children: /* @__PURE__ */ jsx$1(
4352
4388
  PopoverContentImpl,
4353
4389
  {
4354
4390
  ...props,
@@ -4646,6 +4682,13 @@ const TextField = React__default.forwardRef((props, ref) => {
4646
4682
  ref.current = receivedRef;
4647
4683
  internalRef.current = receivedRef;
4648
4684
  };
4685
+ useEffect(() => {
4686
+ if (autoFocus) {
4687
+ setTimeout(() => {
4688
+ internalRef.current?.focus();
4689
+ }, 0);
4690
+ }
4691
+ }, []);
4649
4692
  useEffect(() => {
4650
4693
  const input = internalRef.current;
4651
4694
  if (input && type !== 'number' && type !== 'email')
@@ -4685,7 +4728,7 @@ const TextField = React__default.forwardRef((props, ref) => {
4685
4728
  if (minLength)
4686
4729
  inputLenghtProp.minLength = minLength;
4687
4730
  return (React__default.createElement(React__default.Fragment, null,
4688
- React__default.createElement("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: disabled, readOnly: readonly, autoComplete: autoComplete, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onKeyUp: onKeyUp, step: step, required: required, autoFocus: autoFocus, min: min, max: max, ...inputLenghtProp, ...inputProp, ...tooltipData }),
4731
+ React__default.createElement("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: disabled, readOnly: readonly, autoComplete: autoComplete, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onKeyUp: onKeyUp, step: step, required: required, min: min, max: max, ...inputLenghtProp, ...inputProp, ...tooltipData }),
4689
4732
  errorText && showError && React__default.createElement("div", { className: "tw-text-sq-danger-color tw-text-xs tw-mt-1" }, errorText)));
4690
4733
  });
4691
4734
 
@@ -11224,7 +11267,7 @@ var LiveRegion = function LiveRegion(props) {
11224
11267
  }
11225
11268
  return guidanceMsg;
11226
11269
  }, [ariaLabel, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
11227
- var ScreenReaderText = jsx(Fragment$1, null, jsx("span", {
11270
+ var ScreenReaderText = jsx(Fragment, null, jsx("span", {
11228
11271
  id: "aria-selection"
11229
11272
  }, ariaSelected), jsx("span", {
11230
11273
  id: "aria-focused"
@@ -11233,7 +11276,7 @@ var LiveRegion = function LiveRegion(props) {
11233
11276
  }, ariaResults), jsx("span", {
11234
11277
  id: "aria-guidance"
11235
11278
  }, ariaGuidance));
11236
- return jsx(Fragment$1, null, jsx(A11yText$1, {
11279
+ return jsx(Fragment, null, jsx(A11yText$1, {
11237
11280
  id: id
11238
11281
  }, isInitialFocus && ScreenReaderText), jsx(A11yText$1, {
11239
11282
  "aria-live": ariaLive,
@@ -11845,7 +11888,7 @@ function ScrollManager(_ref) {
11845
11888
  setScrollCaptureTarget(element);
11846
11889
  setScrollLockTarget(element);
11847
11890
  };
11848
- return jsx(Fragment$1, null, lockEnabled && jsx("div", {
11891
+ return jsx(Fragment, null, lockEnabled && jsx("div", {
11849
11892
  onClick: blurSelectInput,
11850
11893
  css: _ref2$1
11851
11894
  }), children(targetRef));
@@ -13946,10 +13989,11 @@ var Dialog$1 = (props) => {
13946
13989
  } = props;
13947
13990
  const triggerRef = React.useRef(null);
13948
13991
  const contentRef = React.useRef(null);
13949
- const [open = false, setOpen] = useControllableState({
13992
+ const [open, setOpen] = useControllableState({
13950
13993
  prop: openProp,
13951
- defaultProp: defaultOpen,
13952
- onChange: onOpenChange
13994
+ defaultProp: defaultOpen ?? false,
13995
+ onChange: onOpenChange,
13996
+ caller: DIALOG_NAME
13953
13997
  });
13954
13998
  return /* @__PURE__ */ jsx$1(
13955
13999
  DialogProvider,
@@ -14011,6 +14055,7 @@ var DialogOverlay = React.forwardRef(
14011
14055
  }
14012
14056
  );
14013
14057
  DialogOverlay.displayName = OVERLAY_NAME;
14058
+ var Slot$1 = createSlot("DialogOverlay.RemoveScroll");
14014
14059
  var DialogOverlayImpl = React.forwardRef(
14015
14060
  (props, forwardedRef) => {
14016
14061
  const { __scopeDialog, ...overlayProps } = props;
@@ -14018,7 +14063,7 @@ var DialogOverlayImpl = React.forwardRef(
14018
14063
  return (
14019
14064
  // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
14020
14065
  // ie. when `Overlay` and `Content` are siblings
14021
- /* @__PURE__ */ jsx$1(RemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx$1(
14066
+ /* @__PURE__ */ jsx$1(RemoveScroll, { as: Slot$1, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx$1(
14022
14067
  Primitive.div,
14023
14068
  {
14024
14069
  "data-state": getState$2(context.open),
@@ -14121,7 +14166,7 @@ var DialogContentImpl = React.forwardRef(
14121
14166
  const contentRef = React.useRef(null);
14122
14167
  const composedRefs = useComposedRefs(forwardedRef, contentRef);
14123
14168
  useFocusGuards();
14124
- return /* @__PURE__ */ jsxs(Fragment, { children: [
14169
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
14125
14170
  /* @__PURE__ */ jsx$1(
14126
14171
  FocusScope,
14127
14172
  {
@@ -14145,7 +14190,7 @@ var DialogContentImpl = React.forwardRef(
14145
14190
  )
14146
14191
  }
14147
14192
  ),
14148
- /* @__PURE__ */ jsxs(Fragment, { children: [
14193
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
14149
14194
  /* @__PURE__ */ jsx$1(TitleWarning, { titleId: context.titleId }),
14150
14195
  /* @__PURE__ */ jsx$1(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
14151
14196
  ] })
@@ -14405,17 +14450,19 @@ function createCollection(name) {
14405
14450
  };
14406
14451
  CollectionProvider.displayName = PROVIDER_NAME;
14407
14452
  const COLLECTION_SLOT_NAME = name + "CollectionSlot";
14453
+ const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
14408
14454
  const CollectionSlot = React__default.forwardRef(
14409
14455
  (props, forwardedRef) => {
14410
14456
  const { scope, children } = props;
14411
14457
  const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
14412
14458
  const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
14413
- return /* @__PURE__ */ jsx$1(Slot, { ref: composedRefs, children });
14459
+ return /* @__PURE__ */ jsx$1(CollectionSlotImpl, { ref: composedRefs, children });
14414
14460
  }
14415
14461
  );
14416
14462
  CollectionSlot.displayName = COLLECTION_SLOT_NAME;
14417
14463
  const ITEM_SLOT_NAME = name + "CollectionItemSlot";
14418
14464
  const ITEM_DATA_ATTR = "data-radix-collection-item";
14465
+ const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
14419
14466
  const CollectionItemSlot = React__default.forwardRef(
14420
14467
  (props, forwardedRef) => {
14421
14468
  const { scope, children, ...itemData } = props;
@@ -14426,7 +14473,7 @@ function createCollection(name) {
14426
14473
  context.itemMap.set(ref, { ref, ...itemData });
14427
14474
  return () => void context.itemMap.delete(ref);
14428
14475
  });
14429
- return /* @__PURE__ */ jsx$1(Slot, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
14476
+ return /* @__PURE__ */ jsx$1(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
14430
14477
  }
14431
14478
  );
14432
14479
  CollectionItemSlot.displayName = ITEM_SLOT_NAME;
@@ -14451,7 +14498,7 @@ function createCollection(name) {
14451
14498
  ];
14452
14499
  }
14453
14500
 
14454
- // packages/react/direction/src/Direction.tsx
14501
+ // packages/react/direction/src/direction.tsx
14455
14502
  var DirectionContext = React.createContext(void 0);
14456
14503
  function useDirection(localDir) {
14457
14504
  const globalDir = React.useContext(DirectionContext);
@@ -14489,10 +14536,11 @@ var RovingFocusGroupImpl = React.forwardRef((props, forwardedRef) => {
14489
14536
  const ref = React.useRef(null);
14490
14537
  const composedRefs = useComposedRefs(forwardedRef, ref);
14491
14538
  const direction = useDirection(dir);
14492
- const [currentTabStopId = null, setCurrentTabStopId] = useControllableState({
14539
+ const [currentTabStopId, setCurrentTabStopId] = useControllableState({
14493
14540
  prop: currentTabStopIdProp,
14494
- defaultProp: defaultCurrentTabStopId,
14495
- onChange: onCurrentTabStopIdChange
14541
+ defaultProp: defaultCurrentTabStopId ?? null,
14542
+ onChange: onCurrentTabStopIdChange,
14543
+ caller: GROUP_NAME$2
14496
14544
  });
14497
14545
  const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);
14498
14546
  const handleEntryFocus = useCallbackRef$1(onEntryFocus);
@@ -14570,6 +14618,7 @@ var RovingFocusGroupItem = React.forwardRef(
14570
14618
  focusable = true,
14571
14619
  active = false,
14572
14620
  tabStopId,
14621
+ children,
14573
14622
  ...itemProps
14574
14623
  } = props;
14575
14624
  const autoId = useId();
@@ -14577,7 +14626,7 @@ var RovingFocusGroupItem = React.forwardRef(
14577
14626
  const context = useRovingFocusContext(ITEM_NAME$3, __scopeRovingFocusGroup);
14578
14627
  const isCurrentTabStop = context.currentTabStopId === id;
14579
14628
  const getItems = useCollection$3(__scopeRovingFocusGroup);
14580
- const { onFocusableItemAdd, onFocusableItemRemove } = context;
14629
+ const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;
14581
14630
  React.useEffect(() => {
14582
14631
  if (focusable) {
14583
14632
  onFocusableItemAdd();
@@ -14623,7 +14672,8 @@ var RovingFocusGroupItem = React.forwardRef(
14623
14672
  }
14624
14673
  setTimeout(() => focusFirst$1(candidateNodes));
14625
14674
  }
14626
- })
14675
+ }),
14676
+ children: typeof children === "function" ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children
14627
14677
  }
14628
14678
  )
14629
14679
  }
@@ -14687,7 +14737,8 @@ var Tabs$1 = React.forwardRef(
14687
14737
  const [value, setValue] = useControllableState({
14688
14738
  prop: valueProp,
14689
14739
  onChange: onValueChange,
14690
- defaultProp: defaultValue
14740
+ defaultProp: defaultValue ?? "",
14741
+ caller: TABS_NAME
14691
14742
  });
14692
14743
  return /* @__PURE__ */ jsx$1(
14693
14744
  TabsProvider,
@@ -14870,10 +14921,11 @@ var Collapsible = React.forwardRef(
14870
14921
  onOpenChange,
14871
14922
  ...collapsibleProps
14872
14923
  } = props;
14873
- const [open = false, setOpen] = useControllableState({
14924
+ const [open, setOpen] = useControllableState({
14874
14925
  prop: openProp,
14875
- defaultProp: defaultOpen,
14876
- onChange: onOpenChange
14926
+ defaultProp: defaultOpen ?? false,
14927
+ onChange: onOpenChange,
14928
+ caller: COLLAPSIBLE_NAME
14877
14929
  });
14878
14930
  return /* @__PURE__ */ jsx$1(
14879
14931
  CollapsibleProvider,
@@ -15023,14 +15075,15 @@ var AccordionImplSingle = React__default.forwardRef(
15023
15075
  } = props;
15024
15076
  const [value, setValue] = useControllableState({
15025
15077
  prop: valueProp,
15026
- defaultProp: defaultValue,
15027
- onChange: onValueChange
15078
+ defaultProp: defaultValue ?? "",
15079
+ onChange: onValueChange,
15080
+ caller: ACCORDION_NAME
15028
15081
  });
15029
15082
  return /* @__PURE__ */ jsx$1(
15030
15083
  AccordionValueProvider,
15031
15084
  {
15032
15085
  scope: props.__scopeAccordion,
15033
- value: value ? [value] : [],
15086
+ value: React__default.useMemo(() => value ? [value] : [], [value]),
15034
15087
  onItemOpen: setValue,
15035
15088
  onItemClose: React__default.useCallback(() => collapsible && setValue(""), [collapsible, setValue]),
15036
15089
  children: /* @__PURE__ */ jsx$1(AccordionCollapsibleProvider, { scope: props.__scopeAccordion, collapsible, children: /* @__PURE__ */ jsx$1(AccordionImpl, { ...accordionSingleProps, ref: forwardedRef }) })
@@ -15046,10 +15099,11 @@ var AccordionImplMultiple = React__default.forwardRef((props, forwardedRef) => {
15046
15099
  },
15047
15100
  ...accordionMultipleProps
15048
15101
  } = props;
15049
- const [value = [], setValue] = useControllableState({
15102
+ const [value, setValue] = useControllableState({
15050
15103
  prop: valueProp,
15051
- defaultProp: defaultValue,
15052
- onChange: onValueChange
15104
+ defaultProp: defaultValue ?? [],
15105
+ onChange: onValueChange,
15106
+ caller: ACCORDION_NAME
15053
15107
  });
15054
15108
  const handleItemOpen = React__default.useCallback(
15055
15109
  (itemValue) => setValue((prevValue = []) => [...prevValue, itemValue]),
@@ -15479,6 +15533,7 @@ var MenuRootContentNonModal = React.forwardRef((props, forwardedRef) => {
15479
15533
  }
15480
15534
  );
15481
15535
  });
15536
+ var Slot = createSlot("MenuContent.ScrollLock");
15482
15537
  var MenuContentImpl = React.forwardRef(
15483
15538
  (props, forwardedRef) => {
15484
15539
  const {
@@ -16116,10 +16171,12 @@ function isPointInPolygon(point, polygon) {
16116
16171
  const { x, y } = point;
16117
16172
  let inside = false;
16118
16173
  for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
16119
- const xi = polygon[i].x;
16120
- const yi = polygon[i].y;
16121
- const xj = polygon[j].x;
16122
- const yj = polygon[j].y;
16174
+ const ii = polygon[i];
16175
+ const jj = polygon[j];
16176
+ const xi = ii.x;
16177
+ const yi = ii.y;
16178
+ const xj = jj.x;
16179
+ const yj = jj.y;
16123
16180
  const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
16124
16181
  if (intersect) inside = !inside;
16125
16182
  }
@@ -16169,10 +16226,11 @@ var DropdownMenu = (props) => {
16169
16226
  } = props;
16170
16227
  const menuScope = useMenuScope(__scopeDropdownMenu);
16171
16228
  const triggerRef = React.useRef(null);
16172
- const [open = false, setOpen] = useControllableState({
16229
+ const [open, setOpen] = useControllableState({
16173
16230
  prop: openProp,
16174
- defaultProp: defaultOpen,
16175
- onChange: onOpenChange
16231
+ defaultProp: defaultOpen ?? false,
16232
+ onChange: onOpenChange,
16233
+ caller: DROPDOWN_MENU_NAME
16176
16234
  });
16177
16235
  return /* @__PURE__ */ jsx$1(
16178
16236
  DropdownMenuProvider,
@@ -16349,10 +16407,11 @@ DropdownMenuArrow.displayName = ARROW_NAME;
16349
16407
  var DropdownMenuSub = (props) => {
16350
16408
  const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
16351
16409
  const menuScope = useMenuScope(__scopeDropdownMenu);
16352
- const [open = false, setOpen] = useControllableState({
16410
+ const [open, setOpen] = useControllableState({
16353
16411
  prop: openProp,
16354
- defaultProp: defaultOpen,
16355
- onChange: onOpenChange
16412
+ defaultProp: defaultOpen ?? false,
16413
+ onChange: onOpenChange,
16414
+ caller: "DropdownMenuSub"
16356
16415
  });
16357
16416
  return /* @__PURE__ */ jsx$1(Sub, { ...menuScope, open, onOpenChange: setOpen, children });
16358
16417
  };
@@ -20427,7 +20486,7 @@ function PopChild({ children, isPresent, anchorX }) {
20427
20486
  * styles directly on the DOM node, we might be overwriting
20428
20487
  * styles set via the style prop.
20429
20488
  */
20430
- useInsertionEffect$1(() => {
20489
+ useInsertionEffect$2(() => {
20431
20490
  const { width, height, top, left, right } = size.current;
20432
20491
  if (isPresent || !ref.current || !width || !height)
20433
20492
  return;
@@ -20687,7 +20746,7 @@ const AnimatePresence = ({ children, custom, initial = true, onExitComplete, pre
20687
20746
  * all components have finished animating out.
20688
20747
  */
20689
20748
  const { forceRender } = useContext(LayoutGroupContext);
20690
- return (jsx$1(Fragment, { children: renderedChildren.map((child) => {
20749
+ return (jsx$1(Fragment$1, { children: renderedChildren.map((child) => {
20691
20750
  const key = getChildKey(child);
20692
20751
  const isPresent = propagate && !isParentPresent
20693
20752
  ? false
@@ -21048,7 +21107,7 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
21048
21107
  createProjectionNode$1(visualElementRef.current, props, ProjectionNodeConstructor, initialLayoutGroupConfig);
21049
21108
  }
21050
21109
  const isMounted = useRef(false);
21051
- useInsertionEffect$1(() => {
21110
+ useInsertionEffect$2(() => {
21052
21111
  /**
21053
21112
  * Check the component has already mounted before calling
21054
21113
  * `update` unnecessarily. This ensures we skip the initial update.
@@ -21579,7 +21638,7 @@ function createUseRender(forwardMotionProps = false) {
21579
21638
  : useHTMLProps;
21580
21639
  const visualProps = useVisualProps(props, latestValues, isStatic, Component);
21581
21640
  const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
21582
- const elementProps = Component !== Fragment$1
21641
+ const elementProps = Component !== Fragment
21583
21642
  ? { ...filteredProps, ...visualProps, ref }
21584
21643
  : {};
21585
21644
  /**
@@ -26745,7 +26804,7 @@ const createDomVisualElement = (Component, options) => {
26745
26804
  return isSVGComponent(Component)
26746
26805
  ? new SVGVisualElement(options)
26747
26806
  : new HTMLVisualElement(options, {
26748
- allowProjection: Component !== Fragment$1,
26807
+ allowProjection: Component !== Fragment,
26749
26808
  });
26750
26809
  };
26751
26810
 
@@ -26775,7 +26834,7 @@ function clamp(value, [min, max]) {
26775
26834
  return Math.min(max, Math.max(min, value));
26776
26835
  }
26777
26836
 
26778
- // packages/react/use-previous/src/usePrevious.tsx
26837
+ // packages/react/use-previous/src/use-previous.tsx
26779
26838
  function usePrevious(value) {
26780
26839
  const ref = React.useRef({ value, previous: value });
26781
26840
  return React.useMemo(() => {
@@ -27221,7 +27280,7 @@ var SliderThumbImpl = React.forwardRef(
27221
27280
  }
27222
27281
  ) }),
27223
27282
  isFormControl && /* @__PURE__ */ jsx$1(
27224
- BubbleInput,
27283
+ SliderBubbleInput,
27225
27284
  {
27226
27285
  name: name ?? (context.name ? context.name + (context.values.length > 1 ? "[]" : "") : void 0),
27227
27286
  form: context.form,
@@ -27235,23 +27294,36 @@ var SliderThumbImpl = React.forwardRef(
27235
27294
  }
27236
27295
  );
27237
27296
  SliderThumb.displayName = THUMB_NAME;
27238
- var BubbleInput = (props) => {
27239
- const { value, ...inputProps } = props;
27240
- const ref = React.useRef(null);
27241
- const prevValue = usePrevious(value);
27242
- React.useEffect(() => {
27243
- const input = ref.current;
27244
- const inputProto = window.HTMLInputElement.prototype;
27245
- const descriptor = Object.getOwnPropertyDescriptor(inputProto, "value");
27246
- const setValue = descriptor.set;
27247
- if (prevValue !== value && setValue) {
27248
- const event = new Event("input", { bubbles: true });
27249
- setValue.call(input, value);
27250
- input.dispatchEvent(event);
27251
- }
27252
- }, [prevValue, value]);
27253
- return /* @__PURE__ */ jsx$1("input", { style: { display: "none" }, ...inputProps, ref, defaultValue: value });
27254
- };
27297
+ var BUBBLE_INPUT_NAME = "RadioBubbleInput";
27298
+ var SliderBubbleInput = React.forwardRef(
27299
+ ({ __scopeSlider, value, ...props }, forwardedRef) => {
27300
+ const ref = React.useRef(null);
27301
+ const composedRefs = useComposedRefs(ref, forwardedRef);
27302
+ const prevValue = usePrevious(value);
27303
+ React.useEffect(() => {
27304
+ const input = ref.current;
27305
+ if (!input) return;
27306
+ const inputProto = window.HTMLInputElement.prototype;
27307
+ const descriptor = Object.getOwnPropertyDescriptor(inputProto, "value");
27308
+ const setValue = descriptor.set;
27309
+ if (prevValue !== value && setValue) {
27310
+ const event = new Event("input", { bubbles: true });
27311
+ setValue.call(input, value);
27312
+ input.dispatchEvent(event);
27313
+ }
27314
+ }, [prevValue, value]);
27315
+ return /* @__PURE__ */ jsx$1(
27316
+ Primitive.input,
27317
+ {
27318
+ style: { display: "none" },
27319
+ ...props,
27320
+ ref: composedRefs,
27321
+ defaultValue: value
27322
+ }
27323
+ );
27324
+ }
27325
+ );
27326
+ SliderBubbleInput.displayName = BUBBLE_INPUT_NAME;
27255
27327
  function getNextSortedValues(prevValues = [], nextValue, atIndex) {
27256
27328
  const nextValues = [...prevValues];
27257
27329
  nextValues[atIndex] = nextValue;