@redis-ui/components 47.3.2 → 47.4.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/AppSelectionMenu/components/Compose/Compose.cjs +1 -1
- package/dist/AppSelectionMenu/components/Compose/Compose.js +1 -1
- package/dist/Banner/components/BannerSemanticComponents/SemanticCloseButton/SemanticCloseButton.style.cjs +1 -1
- package/dist/Banner/components/BannerSemanticComponents/SemanticCloseButton/SemanticCloseButton.style.js +1 -1
- package/dist/BoxSelectionGroup/hooks/useBoxSelectionGroup.cjs +1 -1
- package/dist/BoxSelectionGroup/hooks/useBoxSelectionGroup.js +1 -1
- package/dist/Checkbox/components/Compose/Compose.cjs +1 -1
- package/dist/Checkbox/components/Compose/Compose.js +1 -1
- package/dist/Checkbox/components/Indicator/Indicator.style.cjs +2 -2
- package/dist/Checkbox/components/Indicator/Indicator.style.js +3 -3
- package/dist/Drawer/components/Description/Description.cjs +1 -1
- package/dist/Drawer/components/Description/Description.js +1 -1
- package/dist/Drawer/components/Header/components/Title/Title.cjs +1 -1
- package/dist/Drawer/components/Header/components/Title/Title.js +1 -1
- package/dist/Inputs/PasswordInput/components/PasswordInput.context.cjs +1 -1
- package/dist/Inputs/PasswordInput/components/PasswordInput.context.js +1 -1
- package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.cjs +1 -1
- package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.js +1 -1
- package/dist/Inputs/components/Context/InputValue.context.d.ts +1 -1
- package/dist/Inputs/components/Context/InputValueProvider.cjs +1 -1
- package/dist/Inputs/components/Context/InputValueProvider.js +1 -1
- package/dist/Inputs/components/Context/NumericInputValueProvider.cjs +1 -1
- package/dist/Inputs/components/Context/NumericInputValueProvider.js +1 -1
- package/dist/Inputs/components/InputTag/InputTag.cjs +1 -1
- package/dist/Inputs/components/InputTag/InputTag.js +1 -1
- package/dist/Loader/Loader.cjs +1 -1
- package/dist/Loader/Loader.js +1 -1
- package/dist/Modal/components/Content/components/Description/Description.cjs +1 -1
- package/dist/Modal/components/Content/components/Description/Description.js +1 -1
- package/dist/Modal/components/Content/components/Header/components/Title/Title.cjs +1 -1
- package/dist/Modal/components/Content/components/Header/components/Title/Title.js +1 -1
- package/dist/MultiSelect/components/Compose/hooks/useMultiSelectContextApi.cjs +1 -1
- package/dist/MultiSelect/components/Compose/hooks/useMultiSelectContextApi.d.ts +1 -1
- package/dist/MultiSelect/components/Compose/hooks/useMultiSelectContextApi.js +1 -1
- package/dist/RadioGroup/components/Compose/Compose.cjs +2 -2
- package/dist/RadioGroup/components/Compose/Compose.js +2 -2
- package/dist/ScreenReaderAnnounce/ScreenReaderAnnounce.cjs +1 -1
- package/dist/ScreenReaderAnnounce/ScreenReaderAnnounce.js +1 -1
- package/dist/Section/components/Compose/Compose.cjs +1 -1
- package/dist/Section/components/Compose/Compose.js +1 -1
- package/dist/Section/components/Header/components/CollapseButton/CollapseButton.cjs +1 -1
- package/dist/Section/components/Header/components/CollapseButton/CollapseButton.js +1 -1
- package/dist/Select/components/Context/hooks/useSelectContextApi.d.ts +1 -1
- package/dist/Select/components/Trigger/components/Compose/Compose.cjs +1 -1
- package/dist/Select/components/Trigger/components/Compose/Compose.js +1 -1
- package/dist/Slider/components/Compose/Compose.cjs +1 -1
- package/dist/Slider/components/Compose/Compose.js +1 -1
- package/dist/Switch/components/Compose/Compose.cjs +1 -1
- package/dist/Switch/components/Compose/Compose.js +1 -1
- package/dist/Toast/Toaster.style.cjs +2 -2
- package/dist/Toast/Toaster.style.js +2 -2
- package/dist/Toast/core/mapping.helpers.cjs +1 -1
- package/dist/Toast/core/mapping.helpers.js +1 -1
- package/dist/Typography/hooks/useEllipsisTooltip.d.ts +1 -1
- package/dist/node_modules/@radix-ui/primitive/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.cjs +108 -62
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +108 -62
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.cjs +5 -4
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +5 -4
- package/dist/node_modules/@radix-ui/react-collection/dist/index.cjs +4 -2
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +5 -3
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +16 -2
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +16 -2
- package/dist/node_modules/@radix-ui/react-context/dist/index.cjs +8 -8
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +8 -8
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.cjs +6 -4
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +6 -4
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.cjs +4 -3
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +4 -3
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.cjs +4 -1
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +4 -1
- package/dist/node_modules/@radix-ui/react-id/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-menu/dist/index.cjs +8 -5
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +8 -5
- package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs +6 -4
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +6 -4
- package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs +4 -1
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +4 -1
- package/dist/node_modules/@radix-ui/react-presence/dist/index.cjs +16 -6
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +16 -5
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs +3 -1
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +3 -1
- package/dist/node_modules/@radix-ui/react-progress/dist/index.cjs +2 -2
- package/dist/node_modules/@radix-ui/react-progress/dist/index.js +2 -2
- package/dist/node_modules/@radix-ui/{react-slider → react-progress}/node_modules/@radix-ui/react-context/dist/index.cjs +2 -1
- package/dist/node_modules/@radix-ui/{react-switch → react-progress}/node_modules/@radix-ui/react-context/dist/index.js +2 -1
- package/dist/node_modules/@radix-ui/{react-slider → react-progress}/node_modules/@radix-ui/react-primitive/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/{react-switch → react-progress}/node_modules/@radix-ui/react-primitive/dist/index.js +4 -2
- package/dist/node_modules/@radix-ui/{react-slider → react-progress}/node_modules/@radix-ui/react-slot/dist/index.cjs +14 -4
- package/dist/node_modules/@radix-ui/react-progress/node_modules/@radix-ui/react-slot/dist/index.js +97 -0
- package/dist/node_modules/@radix-ui/react-radio-group/dist/index.cjs +16 -11
- package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +16 -11
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.cjs +11 -6
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +11 -6
- package/dist/node_modules/@radix-ui/react-select/dist/index.cjs +56 -35
- package/dist/node_modules/@radix-ui/react-select/dist/index.js +57 -36
- package/dist/node_modules/@radix-ui/react-slider/dist/index.cjs +35 -35
- package/dist/node_modules/@radix-ui/react-slider/dist/index.js +10 -10
- package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs +55 -39
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +54 -38
- package/dist/node_modules/@radix-ui/react-switch/dist/index.cjs +27 -23
- package/dist/node_modules/@radix-ui/react-switch/dist/index.js +17 -13
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.cjs +2 -1
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +2 -1
- package/dist/node_modules/@radix-ui/react-toggle/dist/index.cjs +4 -3
- package/dist/node_modules/@radix-ui/react-toggle/dist/index.js +4 -3
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs +33 -17
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +33 -17
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +29 -16
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +29 -16
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +1 -1
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs +14 -11
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +14 -11
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs +8 -2
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +8 -2
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.cjs +3 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +3 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.cjs +4 -2
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +4 -2
- package/dist/{node_modules/@radix-ui/react-switch → packages/components}/node_modules/@radix-ui/react-primitive/dist/index.cjs +5 -3
- package/dist/{node_modules/@radix-ui/react-slider → packages/components}/node_modules/@radix-ui/react-primitive/dist/index.js +1 -1
- package/dist/packages/components/node_modules/@radix-ui/react-slot/dist/index.cjs +99 -0
- package/dist/{node_modules/@radix-ui/react-slider → packages/components}/node_modules/@radix-ui/react-slot/dist/index.js +14 -4
- package/dist/packages/components/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs +32 -0
- package/dist/packages/components/node_modules/@radix-ui/react-visually-hidden/dist/index.js +30 -0
- package/dist/{node_modules → packages/components/node_modules}/react-toastify/dist/react-toastify.esm.cjs +3 -3
- package/dist/{node_modules → packages/components/node_modules}/react-toastify/dist/react-toastify.esm.js +2 -2
- package/package.json +18 -14
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/number/dist/index.cjs +0 -6
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/number/dist/index.js +0 -6
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/primitive/dist/index.cjs +0 -9
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/primitive/dist/index.js +0 -9
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-collection/dist/index.cjs +0 -81
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-collection/dist/index.js +0 -79
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +0 -31
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -28
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-context/dist/index.js +0 -67
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-direction/dist/index.cjs +0 -12
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-direction/dist/index.js +0 -10
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +0 -57
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -55
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +0 -7
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -5
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-previous/dist/index.cjs +0 -19
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-previous/dist/index.js +0 -17
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-size/dist/index.cjs +0 -41
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-size/dist/index.js +0 -39
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/primitive/dist/index.cjs +0 -9
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/primitive/dist/index.js +0 -9
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +0 -31
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -28
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-context/dist/index.cjs +0 -69
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-slot/dist/index.cjs +0 -82
- package/dist/node_modules/@radix-ui/react-switch/node_modules/@radix-ui/react-slot/dist/index.js +0 -80
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createSlot } from "../../react-slot/dist/index.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
4
|
import "react-dom";
|
|
5
|
-
//#region ../../node_modules/@radix-ui/react-
|
|
5
|
+
//#region ../../node_modules/@radix-ui/react-progress/node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
6
6
|
var Primitive = [
|
|
7
7
|
"a",
|
|
8
8
|
"button",
|
|
@@ -17,10 +17,12 @@ var Primitive = [
|
|
|
17
17
|
"nav",
|
|
18
18
|
"ol",
|
|
19
19
|
"p",
|
|
20
|
+
"select",
|
|
20
21
|
"span",
|
|
21
22
|
"svg",
|
|
22
23
|
"ul"
|
|
23
24
|
].reduce((primitive, node) => {
|
|
25
|
+
const Slot = createSlot(`Primitive.${node}`);
|
|
24
26
|
const Node = React$1.forwardRef((props, forwardedRef) => {
|
|
25
27
|
const { asChild, ...primitiveProps } = props;
|
|
26
28
|
const Comp = asChild ? Slot : node;
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
const require_runtime = require("../../../../../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
-
const require_index = require("
|
|
2
|
+
const require_index = require("../../../../../react-compose-refs/dist/index.cjs");
|
|
3
3
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
4
|
let react = require("react");
|
|
5
5
|
react = require_runtime.__toESM(react, 1);
|
|
6
|
-
//#region ../../node_modules/@radix-ui/react-
|
|
6
|
+
//#region ../../node_modules/@radix-ui/react-progress/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
7
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
8
|
+
var use = react[" use ".trim().toString()];
|
|
9
|
+
function isPromiseLike(value) {
|
|
10
|
+
return typeof value === "object" && value !== null && "then" in value;
|
|
11
|
+
}
|
|
12
|
+
function isLazyComponent(element) {
|
|
13
|
+
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
14
|
+
}
|
|
7
15
|
/* @__NO_SIDE_EFFECTS__ */
|
|
8
16
|
function createSlot(ownerName) {
|
|
9
17
|
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
10
18
|
const Slot2 = react.forwardRef((props, forwardedRef) => {
|
|
11
|
-
|
|
19
|
+
let { children, ...slotProps } = props;
|
|
20
|
+
if (isLazyComponent(children) && typeof use === "function") children = use(children._payload);
|
|
12
21
|
const childrenArray = react.Children.toArray(children);
|
|
13
22
|
const slottable = childrenArray.find(isSlottable);
|
|
14
23
|
if (slottable) {
|
|
@@ -37,7 +46,8 @@ function createSlot(ownerName) {
|
|
|
37
46
|
/* @__NO_SIDE_EFFECTS__ */
|
|
38
47
|
function createSlotClone(ownerName) {
|
|
39
48
|
const SlotClone = react.forwardRef((props, forwardedRef) => {
|
|
40
|
-
|
|
49
|
+
let { children, ...slotProps } = props;
|
|
50
|
+
if (isLazyComponent(children) && typeof use === "function") children = use(children._payload);
|
|
41
51
|
if (react.isValidElement(children)) {
|
|
42
52
|
const childrenRef = getElementRef(children);
|
|
43
53
|
const props2 = mergeProps(slotProps, children.props);
|
package/dist/node_modules/@radix-ui/react-progress/node_modules/@radix-ui/react-slot/dist/index.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { composeRefs } from "../../../../../react-compose-refs/dist/index.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
//#region ../../node_modules/@radix-ui/react-progress/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
5
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
6
|
+
var use = React$1[" use ".trim().toString()];
|
|
7
|
+
function isPromiseLike(value) {
|
|
8
|
+
return typeof value === "object" && value !== null && "then" in value;
|
|
9
|
+
}
|
|
10
|
+
function isLazyComponent(element) {
|
|
11
|
+
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
12
|
+
}
|
|
13
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
14
|
+
function createSlot(ownerName) {
|
|
15
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
16
|
+
const Slot2 = React$1.forwardRef((props, forwardedRef) => {
|
|
17
|
+
let { children, ...slotProps } = props;
|
|
18
|
+
if (isLazyComponent(children) && typeof use === "function") children = use(children._payload);
|
|
19
|
+
const childrenArray = React$1.Children.toArray(children);
|
|
20
|
+
const slottable = childrenArray.find(isSlottable);
|
|
21
|
+
if (slottable) {
|
|
22
|
+
const newElement = slottable.props.children;
|
|
23
|
+
const newChildren = childrenArray.map((child) => {
|
|
24
|
+
if (child === slottable) {
|
|
25
|
+
if (React$1.Children.count(newElement) > 1) return React$1.Children.only(null);
|
|
26
|
+
return React$1.isValidElement(newElement) ? newElement.props.children : null;
|
|
27
|
+
} else return child;
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ jsx(SlotClone, {
|
|
30
|
+
...slotProps,
|
|
31
|
+
ref: forwardedRef,
|
|
32
|
+
children: React$1.isValidElement(newElement) ? React$1.cloneElement(newElement, void 0, newChildren) : null
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ jsx(SlotClone, {
|
|
36
|
+
...slotProps,
|
|
37
|
+
ref: forwardedRef,
|
|
38
|
+
children
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
42
|
+
return Slot2;
|
|
43
|
+
}
|
|
44
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
45
|
+
function createSlotClone(ownerName) {
|
|
46
|
+
const SlotClone = React$1.forwardRef((props, forwardedRef) => {
|
|
47
|
+
let { children, ...slotProps } = props;
|
|
48
|
+
if (isLazyComponent(children) && typeof use === "function") children = use(children._payload);
|
|
49
|
+
if (React$1.isValidElement(children)) {
|
|
50
|
+
const childrenRef = getElementRef(children);
|
|
51
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
52
|
+
if (children.type !== React$1.Fragment) props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
53
|
+
return React$1.cloneElement(children, props2);
|
|
54
|
+
}
|
|
55
|
+
return React$1.Children.count(children) > 1 ? React$1.Children.only(null) : null;
|
|
56
|
+
});
|
|
57
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
58
|
+
return SlotClone;
|
|
59
|
+
}
|
|
60
|
+
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
61
|
+
function isSlottable(child) {
|
|
62
|
+
return React$1.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
63
|
+
}
|
|
64
|
+
function mergeProps(slotProps, childProps) {
|
|
65
|
+
const overrideProps = { ...childProps };
|
|
66
|
+
for (const propName in childProps) {
|
|
67
|
+
const slotPropValue = slotProps[propName];
|
|
68
|
+
const childPropValue = childProps[propName];
|
|
69
|
+
if (/^on[A-Z]/.test(propName)) {
|
|
70
|
+
if (slotPropValue && childPropValue) overrideProps[propName] = (...args) => {
|
|
71
|
+
const result = childPropValue(...args);
|
|
72
|
+
slotPropValue(...args);
|
|
73
|
+
return result;
|
|
74
|
+
};
|
|
75
|
+
else if (slotPropValue) overrideProps[propName] = slotPropValue;
|
|
76
|
+
} else if (propName === "style") overrideProps[propName] = {
|
|
77
|
+
...slotPropValue,
|
|
78
|
+
...childPropValue
|
|
79
|
+
};
|
|
80
|
+
else if (propName === "className") overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
...slotProps,
|
|
84
|
+
...overrideProps
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function getElementRef(element) {
|
|
88
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
89
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
90
|
+
if (mayWarn) return element.ref;
|
|
91
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
92
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
93
|
+
if (mayWarn) return element.props.ref;
|
|
94
|
+
return element.props.ref || element.ref;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { createSlot };
|
|
@@ -18,11 +18,11 @@ var RADIO_NAME = "Radio";
|
|
|
18
18
|
var [createRadioContext, createRadioScope] = require_index$2.createContextScope(RADIO_NAME);
|
|
19
19
|
var [RadioProvider, useRadioContext] = createRadioContext(RADIO_NAME);
|
|
20
20
|
var Radio = react.forwardRef((props, forwardedRef) => {
|
|
21
|
-
const { __scopeRadio, name, checked = false, required, disabled, value = "on", onCheck, ...radioProps } = props;
|
|
21
|
+
const { __scopeRadio, name, checked = false, required, disabled, value = "on", onCheck, form, ...radioProps } = props;
|
|
22
22
|
const [button, setButton] = react.useState(null);
|
|
23
23
|
const composedRefs = require_index$1.useComposedRefs(forwardedRef, (node) => setButton(node));
|
|
24
24
|
const hasConsumerStoppedPropagationRef = react.useRef(false);
|
|
25
|
-
const isFormControl = button ?
|
|
25
|
+
const isFormControl = button ? form || !!button.closest("form") : true;
|
|
26
26
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(RadioProvider, {
|
|
27
27
|
scope: __scopeRadio,
|
|
28
28
|
checked,
|
|
@@ -44,7 +44,7 @@ var Radio = react.forwardRef((props, forwardedRef) => {
|
|
|
44
44
|
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
45
45
|
}
|
|
46
46
|
})
|
|
47
|
-
}), isFormControl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
47
|
+
}), isFormControl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadioBubbleInput, {
|
|
48
48
|
control: button,
|
|
49
49
|
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
50
50
|
name,
|
|
@@ -52,6 +52,7 @@ var Radio = react.forwardRef((props, forwardedRef) => {
|
|
|
52
52
|
checked,
|
|
53
53
|
required,
|
|
54
54
|
disabled,
|
|
55
|
+
form,
|
|
55
56
|
style: { transform: "translateX(-100%)" }
|
|
56
57
|
})]
|
|
57
58
|
});
|
|
@@ -72,13 +73,15 @@ var RadioIndicator = react.forwardRef((props, forwardedRef) => {
|
|
|
72
73
|
});
|
|
73
74
|
});
|
|
74
75
|
RadioIndicator.displayName = INDICATOR_NAME;
|
|
75
|
-
var
|
|
76
|
-
|
|
76
|
+
var BUBBLE_INPUT_NAME = "RadioBubbleInput";
|
|
77
|
+
var RadioBubbleInput = react.forwardRef(({ __scopeRadio, control, checked, bubbles = true, ...props }, forwardedRef) => {
|
|
77
78
|
const ref = react.useRef(null);
|
|
79
|
+
const composedRefs = require_index$1.useComposedRefs(ref, forwardedRef);
|
|
78
80
|
const prevChecked = require_index$9.usePrevious(checked);
|
|
79
81
|
const controlSize = require_index$4.useSize(control);
|
|
80
82
|
react.useEffect(() => {
|
|
81
83
|
const input = ref.current;
|
|
84
|
+
if (!input) return;
|
|
82
85
|
const inputProto = window.HTMLInputElement.prototype;
|
|
83
86
|
const setChecked = Object.getOwnPropertyDescriptor(inputProto, "checked").set;
|
|
84
87
|
if (prevChecked !== checked && setChecked) {
|
|
@@ -91,13 +94,13 @@ var BubbleInput = (props) => {
|
|
|
91
94
|
checked,
|
|
92
95
|
bubbles
|
|
93
96
|
]);
|
|
94
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
97
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$3.Primitive.input, {
|
|
95
98
|
type: "radio",
|
|
96
99
|
"aria-hidden": true,
|
|
97
100
|
defaultChecked: checked,
|
|
98
|
-
...
|
|
101
|
+
...props,
|
|
99
102
|
tabIndex: -1,
|
|
100
|
-
ref,
|
|
103
|
+
ref: composedRefs,
|
|
101
104
|
style: {
|
|
102
105
|
...props.style,
|
|
103
106
|
...controlSize,
|
|
@@ -107,7 +110,8 @@ var BubbleInput = (props) => {
|
|
|
107
110
|
margin: 0
|
|
108
111
|
}
|
|
109
112
|
});
|
|
110
|
-
};
|
|
113
|
+
});
|
|
114
|
+
RadioBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
111
115
|
function getState(checked) {
|
|
112
116
|
return checked ? "checked" : "unchecked";
|
|
113
117
|
}
|
|
@@ -128,8 +132,9 @@ var RadioGroup = react.forwardRef((props, forwardedRef) => {
|
|
|
128
132
|
const direction = require_index$7.useDirection(dir);
|
|
129
133
|
const [value, setValue] = require_index$6.useControllableState({
|
|
130
134
|
prop: valueProp,
|
|
131
|
-
defaultProp: defaultValue,
|
|
132
|
-
onChange: onValueChange
|
|
135
|
+
defaultProp: defaultValue ?? null,
|
|
136
|
+
onChange: onValueChange,
|
|
137
|
+
caller: RADIO_GROUP_NAME
|
|
133
138
|
});
|
|
134
139
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadioGroupProvider, {
|
|
135
140
|
scope: __scopeRadioGroup,
|
|
@@ -16,11 +16,11 @@ var RADIO_NAME = "Radio";
|
|
|
16
16
|
var [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);
|
|
17
17
|
var [RadioProvider, useRadioContext] = createRadioContext(RADIO_NAME);
|
|
18
18
|
var Radio = React2.forwardRef((props, forwardedRef) => {
|
|
19
|
-
const { __scopeRadio, name, checked = false, required, disabled, value = "on", onCheck, ...radioProps } = props;
|
|
19
|
+
const { __scopeRadio, name, checked = false, required, disabled, value = "on", onCheck, form, ...radioProps } = props;
|
|
20
20
|
const [button, setButton] = React2.useState(null);
|
|
21
21
|
const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
|
|
22
22
|
const hasConsumerStoppedPropagationRef = React2.useRef(false);
|
|
23
|
-
const isFormControl = button ?
|
|
23
|
+
const isFormControl = button ? form || !!button.closest("form") : true;
|
|
24
24
|
return /* @__PURE__ */ jsxs(RadioProvider, {
|
|
25
25
|
scope: __scopeRadio,
|
|
26
26
|
checked,
|
|
@@ -42,7 +42,7 @@ var Radio = React2.forwardRef((props, forwardedRef) => {
|
|
|
42
42
|
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
|
-
}), isFormControl && /* @__PURE__ */ jsx(
|
|
45
|
+
}), isFormControl && /* @__PURE__ */ jsx(RadioBubbleInput, {
|
|
46
46
|
control: button,
|
|
47
47
|
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
48
48
|
name,
|
|
@@ -50,6 +50,7 @@ var Radio = React2.forwardRef((props, forwardedRef) => {
|
|
|
50
50
|
checked,
|
|
51
51
|
required,
|
|
52
52
|
disabled,
|
|
53
|
+
form,
|
|
53
54
|
style: { transform: "translateX(-100%)" }
|
|
54
55
|
})]
|
|
55
56
|
});
|
|
@@ -70,13 +71,15 @@ var RadioIndicator = React2.forwardRef((props, forwardedRef) => {
|
|
|
70
71
|
});
|
|
71
72
|
});
|
|
72
73
|
RadioIndicator.displayName = INDICATOR_NAME;
|
|
73
|
-
var
|
|
74
|
-
|
|
74
|
+
var BUBBLE_INPUT_NAME = "RadioBubbleInput";
|
|
75
|
+
var RadioBubbleInput = React2.forwardRef(({ __scopeRadio, control, checked, bubbles = true, ...props }, forwardedRef) => {
|
|
75
76
|
const ref = React2.useRef(null);
|
|
77
|
+
const composedRefs = useComposedRefs(ref, forwardedRef);
|
|
76
78
|
const prevChecked = usePrevious(checked);
|
|
77
79
|
const controlSize = useSize(control);
|
|
78
80
|
React2.useEffect(() => {
|
|
79
81
|
const input = ref.current;
|
|
82
|
+
if (!input) return;
|
|
80
83
|
const inputProto = window.HTMLInputElement.prototype;
|
|
81
84
|
const setChecked = Object.getOwnPropertyDescriptor(inputProto, "checked").set;
|
|
82
85
|
if (prevChecked !== checked && setChecked) {
|
|
@@ -89,13 +92,13 @@ var BubbleInput = (props) => {
|
|
|
89
92
|
checked,
|
|
90
93
|
bubbles
|
|
91
94
|
]);
|
|
92
|
-
return /* @__PURE__ */ jsx(
|
|
95
|
+
return /* @__PURE__ */ jsx(Primitive.input, {
|
|
93
96
|
type: "radio",
|
|
94
97
|
"aria-hidden": true,
|
|
95
98
|
defaultChecked: checked,
|
|
96
|
-
...
|
|
99
|
+
...props,
|
|
97
100
|
tabIndex: -1,
|
|
98
|
-
ref,
|
|
101
|
+
ref: composedRefs,
|
|
99
102
|
style: {
|
|
100
103
|
...props.style,
|
|
101
104
|
...controlSize,
|
|
@@ -105,7 +108,8 @@ var BubbleInput = (props) => {
|
|
|
105
108
|
margin: 0
|
|
106
109
|
}
|
|
107
110
|
});
|
|
108
|
-
};
|
|
111
|
+
});
|
|
112
|
+
RadioBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
109
113
|
function getState(checked) {
|
|
110
114
|
return checked ? "checked" : "unchecked";
|
|
111
115
|
}
|
|
@@ -126,8 +130,9 @@ var RadioGroup = React2.forwardRef((props, forwardedRef) => {
|
|
|
126
130
|
const direction = useDirection(dir);
|
|
127
131
|
const [value, setValue] = useControllableState({
|
|
128
132
|
prop: valueProp,
|
|
129
|
-
defaultProp: defaultValue,
|
|
130
|
-
onChange: onValueChange
|
|
133
|
+
defaultProp: defaultValue ?? null,
|
|
134
|
+
onChange: onValueChange,
|
|
135
|
+
caller: RADIO_GROUP_NAME
|
|
131
136
|
});
|
|
132
137
|
return /* @__PURE__ */ jsx(RadioGroupProvider, {
|
|
133
138
|
scope: __scopeRadioGroup,
|
|
@@ -40,10 +40,11 @@ var RovingFocusGroupImpl = react.forwardRef((props, forwardedRef) => {
|
|
|
40
40
|
const ref = react.useRef(null);
|
|
41
41
|
const composedRefs = require_index$1.useComposedRefs(forwardedRef, ref);
|
|
42
42
|
const direction = require_index$8.useDirection(dir);
|
|
43
|
-
const [currentTabStopId
|
|
43
|
+
const [currentTabStopId, setCurrentTabStopId] = require_index$6.useControllableState({
|
|
44
44
|
prop: currentTabStopIdProp,
|
|
45
|
-
defaultProp: defaultCurrentTabStopId,
|
|
46
|
-
onChange: onCurrentTabStopIdChange
|
|
45
|
+
defaultProp: defaultCurrentTabStopId ?? null,
|
|
46
|
+
onChange: onCurrentTabStopIdChange,
|
|
47
|
+
caller: GROUP_NAME
|
|
47
48
|
});
|
|
48
49
|
const [isTabbingBackOut, setIsTabbingBackOut] = react.useState(false);
|
|
49
50
|
const handleEntryFocus = require_index$4.useCallbackRef(onEntryFocus);
|
|
@@ -101,13 +102,13 @@ var RovingFocusGroupImpl = react.forwardRef((props, forwardedRef) => {
|
|
|
101
102
|
});
|
|
102
103
|
var ITEM_NAME = "RovingFocusGroupItem";
|
|
103
104
|
var RovingFocusGroupItem = react.forwardRef((props, forwardedRef) => {
|
|
104
|
-
const { __scopeRovingFocusGroup, focusable = true, active = false, tabStopId, ...itemProps } = props;
|
|
105
|
+
const { __scopeRovingFocusGroup, focusable = true, active = false, tabStopId, children, ...itemProps } = props;
|
|
105
106
|
const autoId = require_index$5.useId();
|
|
106
107
|
const id = tabStopId || autoId;
|
|
107
108
|
const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);
|
|
108
109
|
const isCurrentTabStop = context.currentTabStopId === id;
|
|
109
110
|
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
110
|
-
const { onFocusableItemAdd, onFocusableItemRemove } = context;
|
|
111
|
+
const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;
|
|
111
112
|
react.useEffect(() => {
|
|
112
113
|
if (focusable) {
|
|
113
114
|
onFocusableItemAdd();
|
|
@@ -152,7 +153,11 @@ var RovingFocusGroupItem = react.forwardRef((props, forwardedRef) => {
|
|
|
152
153
|
}
|
|
153
154
|
setTimeout(() => focusFirst(candidateNodes));
|
|
154
155
|
}
|
|
155
|
-
})
|
|
156
|
+
}),
|
|
157
|
+
children: typeof children === "function" ? children({
|
|
158
|
+
isCurrentTabStop,
|
|
159
|
+
hasTabStop: currentTabStopId != null
|
|
160
|
+
}) : children
|
|
156
161
|
})
|
|
157
162
|
});
|
|
158
163
|
});
|
|
@@ -38,10 +38,11 @@ var RovingFocusGroupImpl = React$1.forwardRef((props, forwardedRef) => {
|
|
|
38
38
|
const ref = React$1.useRef(null);
|
|
39
39
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
40
40
|
const direction = useDirection(dir);
|
|
41
|
-
const [currentTabStopId
|
|
41
|
+
const [currentTabStopId, setCurrentTabStopId] = useControllableState({
|
|
42
42
|
prop: currentTabStopIdProp,
|
|
43
|
-
defaultProp: defaultCurrentTabStopId,
|
|
44
|
-
onChange: onCurrentTabStopIdChange
|
|
43
|
+
defaultProp: defaultCurrentTabStopId ?? null,
|
|
44
|
+
onChange: onCurrentTabStopIdChange,
|
|
45
|
+
caller: GROUP_NAME
|
|
45
46
|
});
|
|
46
47
|
const [isTabbingBackOut, setIsTabbingBackOut] = React$1.useState(false);
|
|
47
48
|
const handleEntryFocus = useCallbackRef(onEntryFocus);
|
|
@@ -99,13 +100,13 @@ var RovingFocusGroupImpl = React$1.forwardRef((props, forwardedRef) => {
|
|
|
99
100
|
});
|
|
100
101
|
var ITEM_NAME = "RovingFocusGroupItem";
|
|
101
102
|
var RovingFocusGroupItem = React$1.forwardRef((props, forwardedRef) => {
|
|
102
|
-
const { __scopeRovingFocusGroup, focusable = true, active = false, tabStopId, ...itemProps } = props;
|
|
103
|
+
const { __scopeRovingFocusGroup, focusable = true, active = false, tabStopId, children, ...itemProps } = props;
|
|
103
104
|
const autoId = useId();
|
|
104
105
|
const id = tabStopId || autoId;
|
|
105
106
|
const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);
|
|
106
107
|
const isCurrentTabStop = context.currentTabStopId === id;
|
|
107
108
|
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
108
|
-
const { onFocusableItemAdd, onFocusableItemRemove } = context;
|
|
109
|
+
const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;
|
|
109
110
|
React$1.useEffect(() => {
|
|
110
111
|
if (focusable) {
|
|
111
112
|
onFocusableItemAdd();
|
|
@@ -150,7 +151,11 @@ var RovingFocusGroupItem = React$1.forwardRef((props, forwardedRef) => {
|
|
|
150
151
|
}
|
|
151
152
|
setTimeout(() => focusFirst(candidateNodes));
|
|
152
153
|
}
|
|
153
|
-
})
|
|
154
|
+
}),
|
|
155
|
+
children: typeof children === "function" ? children({
|
|
156
|
+
isCurrentTabStop,
|
|
157
|
+
hasTabStop: currentTabStopId != null
|
|
158
|
+
}) : children
|
|
154
159
|
})
|
|
155
160
|
});
|
|
156
161
|
});
|
|
@@ -41,24 +41,26 @@ var usePopperScope = require_index$11.createPopperScope();
|
|
|
41
41
|
var [SelectProvider, useSelectContext] = createSelectContext(SELECT_NAME);
|
|
42
42
|
var [SelectNativeOptionsProvider, useSelectNativeOptionsContext] = createSelectContext(SELECT_NAME);
|
|
43
43
|
var Select = (props) => {
|
|
44
|
-
const { __scopeSelect, children, open: openProp, defaultOpen, onOpenChange, value: valueProp, defaultValue, onValueChange, dir, name, autoComplete, disabled, required } = props;
|
|
44
|
+
const { __scopeSelect, children, open: openProp, defaultOpen, onOpenChange, value: valueProp, defaultValue, onValueChange, dir, name, autoComplete, disabled, required, form } = props;
|
|
45
45
|
const popperScope = usePopperScope(__scopeSelect);
|
|
46
46
|
const [trigger, setTrigger] = react.useState(null);
|
|
47
47
|
const [valueNode, setValueNode] = react.useState(null);
|
|
48
48
|
const [valueNodeHasChildren, setValueNodeHasChildren] = react.useState(false);
|
|
49
49
|
const direction = require_index$17.useDirection(dir);
|
|
50
|
-
const [open
|
|
50
|
+
const [open, setOpen] = require_index$13.useControllableState({
|
|
51
51
|
prop: openProp,
|
|
52
|
-
defaultProp: defaultOpen,
|
|
53
|
-
onChange: onOpenChange
|
|
52
|
+
defaultProp: defaultOpen ?? false,
|
|
53
|
+
onChange: onOpenChange,
|
|
54
|
+
caller: SELECT_NAME
|
|
54
55
|
});
|
|
55
56
|
const [value, setValue] = require_index$13.useControllableState({
|
|
56
57
|
prop: valueProp,
|
|
57
58
|
defaultProp: defaultValue,
|
|
58
|
-
onChange: onValueChange
|
|
59
|
+
onChange: onValueChange,
|
|
60
|
+
caller: SELECT_NAME
|
|
59
61
|
});
|
|
60
62
|
const triggerPointerDownPosRef = react.useRef(null);
|
|
61
|
-
const isFormControl = trigger ?
|
|
63
|
+
const isFormControl = trigger ? form || !!trigger.closest("form") : true;
|
|
62
64
|
const [nativeOptionsSet, setNativeOptionsSet] = react.useState(/* @__PURE__ */ new Set());
|
|
63
65
|
const nativeSelectKey = Array.from(nativeOptionsSet).map((option) => option.props.value).join(";");
|
|
64
66
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$11.Root2, {
|
|
@@ -96,7 +98,7 @@ var Select = (props) => {
|
|
|
96
98
|
}, []),
|
|
97
99
|
children
|
|
98
100
|
})
|
|
99
|
-
}), isFormControl ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
101
|
+
}), isFormControl ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(SelectBubbleInput, {
|
|
100
102
|
"aria-hidden": true,
|
|
101
103
|
required,
|
|
102
104
|
tabIndex: -1,
|
|
@@ -105,6 +107,7 @@ var Select = (props) => {
|
|
|
105
107
|
value,
|
|
106
108
|
onChange: (event) => setValue(event.target.value),
|
|
107
109
|
disabled,
|
|
110
|
+
form,
|
|
108
111
|
children: [value === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", { value: "" }) : null, Array.from(nativeOptionsSet)]
|
|
109
112
|
}, nativeSelectKey) : null]
|
|
110
113
|
})
|
|
@@ -119,16 +122,21 @@ var SelectTrigger = react.forwardRef((props, forwardedRef) => {
|
|
|
119
122
|
const isDisabled = context.disabled || disabled;
|
|
120
123
|
const composedRefs = require_index$1.useComposedRefs(forwardedRef, context.onTriggerChange);
|
|
121
124
|
const getItems = useCollection(__scopeSelect);
|
|
125
|
+
const pointerTypeRef = react.useRef("touch");
|
|
122
126
|
const [searchRef, handleTypeaheadSearch, resetTypeahead] = useTypeaheadSearch((search) => {
|
|
123
127
|
const enabledItems = getItems().filter((item) => !item.disabled);
|
|
124
128
|
const nextItem = findNextItem(enabledItems, search, enabledItems.find((item) => item.value === context.value));
|
|
125
129
|
if (nextItem !== void 0) context.onValueChange(nextItem.value);
|
|
126
130
|
});
|
|
127
|
-
const handleOpen = () => {
|
|
131
|
+
const handleOpen = (pointerEvent) => {
|
|
128
132
|
if (!isDisabled) {
|
|
129
133
|
context.onOpenChange(true);
|
|
130
134
|
resetTypeahead();
|
|
131
135
|
}
|
|
136
|
+
if (pointerEvent) context.triggerPointerDownPosRef.current = {
|
|
137
|
+
x: Math.round(pointerEvent.pageX),
|
|
138
|
+
y: Math.round(pointerEvent.pageY)
|
|
139
|
+
};
|
|
132
140
|
};
|
|
133
141
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$11.Anchor, {
|
|
134
142
|
asChild: true,
|
|
@@ -149,16 +157,14 @@ var SelectTrigger = react.forwardRef((props, forwardedRef) => {
|
|
|
149
157
|
ref: composedRefs,
|
|
150
158
|
onClick: require_index.composeEventHandlers(triggerProps.onClick, (event) => {
|
|
151
159
|
event.currentTarget.focus();
|
|
160
|
+
if (pointerTypeRef.current !== "mouse") handleOpen(event);
|
|
152
161
|
}),
|
|
153
162
|
onPointerDown: require_index.composeEventHandlers(triggerProps.onPointerDown, (event) => {
|
|
163
|
+
pointerTypeRef.current = event.pointerType;
|
|
154
164
|
const target = event.target;
|
|
155
165
|
if (target.hasPointerCapture(event.pointerId)) target.releasePointerCapture(event.pointerId);
|
|
156
|
-
if (event.button === 0 && event.ctrlKey === false) {
|
|
157
|
-
handleOpen();
|
|
158
|
-
context.triggerPointerDownPosRef.current = {
|
|
159
|
-
x: Math.round(event.pageX),
|
|
160
|
-
y: Math.round(event.pageY)
|
|
161
|
-
};
|
|
166
|
+
if (event.button === 0 && event.ctrlKey === false && event.pointerType === "mouse") {
|
|
167
|
+
handleOpen(event);
|
|
162
168
|
event.preventDefault();
|
|
163
169
|
}
|
|
164
170
|
}),
|
|
@@ -238,6 +244,7 @@ SelectContent.displayName = CONTENT_NAME;
|
|
|
238
244
|
var CONTENT_MARGIN = 10;
|
|
239
245
|
var [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME);
|
|
240
246
|
var CONTENT_IMPL_NAME = "SelectContentImpl";
|
|
247
|
+
var Slot = require_index$3.createSlot("SelectContent.RemoveScroll");
|
|
241
248
|
var SelectContentImpl = react.forwardRef((props, forwardedRef) => {
|
|
242
249
|
const { __scopeSelect, position = "item-aligned", onCloseAutoFocus, onEscapeKeyDown, onPointerDownOutside, side, sideOffset, align, alignOffset, arrowPadding, collisionBoundary, collisionPadding, sticky, hideWhenDetached, avoidCollisions, ...contentProps } = props;
|
|
243
250
|
const context = useSelectContext(CONTENT_NAME, __scopeSelect);
|
|
@@ -364,7 +371,7 @@ var SelectContentImpl = react.forwardRef((props, forwardedRef) => {
|
|
|
364
371
|
isPositioned,
|
|
365
372
|
searchRef,
|
|
366
373
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Combination.default, {
|
|
367
|
-
as:
|
|
374
|
+
as: Slot,
|
|
368
375
|
allowPinchZoom: true,
|
|
369
376
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$8.FocusScope, {
|
|
370
377
|
asChild: true,
|
|
@@ -451,7 +458,8 @@ var SelectItemAlignedPosition = react.forwardRef((props, forwardedRef) => {
|
|
|
451
458
|
const leftDelta = triggerRect.left - left;
|
|
452
459
|
const minContentWidth = triggerRect.width + leftDelta;
|
|
453
460
|
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
454
|
-
const
|
|
461
|
+
const rightEdge = window.innerWidth - CONTENT_MARGIN;
|
|
462
|
+
const clampedLeft = require_index$19.clamp(left, [CONTENT_MARGIN, Math.max(CONTENT_MARGIN, rightEdge - contentWidth)]);
|
|
455
463
|
contentWrapper.style.minWidth = minContentWidth + "px";
|
|
456
464
|
contentWrapper.style.left = clampedLeft + "px";
|
|
457
465
|
} else {
|
|
@@ -460,7 +468,8 @@ var SelectItemAlignedPosition = react.forwardRef((props, forwardedRef) => {
|
|
|
460
468
|
const rightDelta = window.innerWidth - triggerRect.right - right;
|
|
461
469
|
const minContentWidth = triggerRect.width + rightDelta;
|
|
462
470
|
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
463
|
-
const
|
|
471
|
+
const leftEdge = window.innerWidth - CONTENT_MARGIN;
|
|
472
|
+
const clampedRight = require_index$19.clamp(right, [CONTENT_MARGIN, Math.max(CONTENT_MARGIN, leftEdge - contentWidth)]);
|
|
464
473
|
contentWrapper.style.minWidth = minContentWidth + "px";
|
|
465
474
|
contentWrapper.style.right = clampedRight + "px";
|
|
466
475
|
}
|
|
@@ -484,13 +493,13 @@ var SelectItemAlignedPosition = react.forwardRef((props, forwardedRef) => {
|
|
|
484
493
|
const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;
|
|
485
494
|
const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;
|
|
486
495
|
if (contentTopToItemMiddle <= topEdgeToTriggerMiddle) {
|
|
487
|
-
const isLastItem = selectedItem === items[items.length - 1].ref.current;
|
|
496
|
+
const isLastItem = items.length > 0 && selectedItem === items[items.length - 1].ref.current;
|
|
488
497
|
contentWrapper.style.bottom = "0px";
|
|
489
498
|
const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight;
|
|
490
499
|
const height = contentTopToItemMiddle + Math.max(triggerMiddleToBottomEdge, selectedItemHalfHeight + (isLastItem ? viewportPaddingBottom : 0) + viewportOffsetBottom + contentBorderBottomWidth);
|
|
491
500
|
contentWrapper.style.height = height + "px";
|
|
492
501
|
} else {
|
|
493
|
-
const isFirstItem = selectedItem === items[0].ref.current;
|
|
502
|
+
const isFirstItem = items.length > 0 && selectedItem === items[0].ref.current;
|
|
494
503
|
contentWrapper.style.top = "0px";
|
|
495
504
|
const height = Math.max(topEdgeToTriggerMiddle, contentBorderTopWidth + viewport.offsetTop + (isFirstItem ? viewportPaddingTop : 0) + selectedItemHalfHeight) + itemMiddleToContentBottom;
|
|
496
505
|
contentWrapper.style.height = height + "px";
|
|
@@ -594,7 +603,7 @@ var SelectViewport = react.forwardRef((props, forwardedRef) => {
|
|
|
594
603
|
style: {
|
|
595
604
|
position: "relative",
|
|
596
605
|
flex: 1,
|
|
597
|
-
overflow: "auto",
|
|
606
|
+
overflow: "hidden auto",
|
|
598
607
|
...viewportProps.style
|
|
599
608
|
},
|
|
600
609
|
onScroll: require_index.composeEventHandlers(viewportProps.onScroll, (event) => {
|
|
@@ -664,6 +673,7 @@ var SelectItem = react.forwardRef((props, forwardedRef) => {
|
|
|
664
673
|
const [isFocused, setIsFocused] = react.useState(false);
|
|
665
674
|
const composedRefs = require_index$1.useComposedRefs(forwardedRef, (node) => contentContext.itemRefCallback?.(node, value, disabled));
|
|
666
675
|
const textId = require_index$10.useId();
|
|
676
|
+
const pointerTypeRef = react.useRef("touch");
|
|
667
677
|
const handleSelect = () => {
|
|
668
678
|
if (!disabled) {
|
|
669
679
|
context.onValueChange(value);
|
|
@@ -698,10 +708,19 @@ var SelectItem = react.forwardRef((props, forwardedRef) => {
|
|
|
698
708
|
ref: composedRefs,
|
|
699
709
|
onFocus: require_index.composeEventHandlers(itemProps.onFocus, () => setIsFocused(true)),
|
|
700
710
|
onBlur: require_index.composeEventHandlers(itemProps.onBlur, () => setIsFocused(false)),
|
|
701
|
-
|
|
711
|
+
onClick: require_index.composeEventHandlers(itemProps.onClick, () => {
|
|
712
|
+
if (pointerTypeRef.current !== "mouse") handleSelect();
|
|
713
|
+
}),
|
|
714
|
+
onPointerUp: require_index.composeEventHandlers(itemProps.onPointerUp, () => {
|
|
715
|
+
if (pointerTypeRef.current === "mouse") handleSelect();
|
|
716
|
+
}),
|
|
717
|
+
onPointerDown: require_index.composeEventHandlers(itemProps.onPointerDown, (event) => {
|
|
718
|
+
pointerTypeRef.current = event.pointerType;
|
|
719
|
+
}),
|
|
702
720
|
onPointerMove: require_index.composeEventHandlers(itemProps.onPointerMove, (event) => {
|
|
721
|
+
pointerTypeRef.current = event.pointerType;
|
|
703
722
|
if (disabled) contentContext.onItemLeave?.();
|
|
704
|
-
else event.currentTarget.focus({ preventScroll: true });
|
|
723
|
+
else if (pointerTypeRef.current === "mouse") event.currentTarget.focus({ preventScroll: true });
|
|
705
724
|
}),
|
|
706
725
|
onPointerLeave: require_index.composeEventHandlers(itemProps.onPointerLeave, (event) => {
|
|
707
726
|
if (event.currentTarget === document.activeElement) contentContext.onItemLeave?.();
|
|
@@ -876,16 +895,14 @@ var SelectArrow = react.forwardRef((props, forwardedRef) => {
|
|
|
876
895
|
}) : null;
|
|
877
896
|
});
|
|
878
897
|
SelectArrow.displayName = ARROW_NAME;
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
}
|
|
882
|
-
var BubbleSelect = react.forwardRef((props, forwardedRef) => {
|
|
883
|
-
const { value, ...selectProps } = props;
|
|
898
|
+
var BUBBLE_INPUT_NAME = "SelectBubbleInput";
|
|
899
|
+
var SelectBubbleInput = react.forwardRef(({ __scopeSelect, value, ...props }, forwardedRef) => {
|
|
884
900
|
const ref = react.useRef(null);
|
|
885
901
|
const composedRefs = require_index$1.useComposedRefs(forwardedRef, ref);
|
|
886
902
|
const prevValue = require_index$18.usePrevious(value);
|
|
887
903
|
react.useEffect(() => {
|
|
888
904
|
const select = ref.current;
|
|
905
|
+
if (!select) return;
|
|
889
906
|
const selectProto = window.HTMLSelectElement.prototype;
|
|
890
907
|
const setValue = Object.getOwnPropertyDescriptor(selectProto, "value").set;
|
|
891
908
|
if (prevValue !== value && setValue) {
|
|
@@ -894,16 +911,20 @@ var BubbleSelect = react.forwardRef((props, forwardedRef) => {
|
|
|
894
911
|
select.dispatchEvent(event);
|
|
895
912
|
}
|
|
896
913
|
}, [prevValue, value]);
|
|
897
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
...
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
914
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$4.Primitive.select, {
|
|
915
|
+
...props,
|
|
916
|
+
style: {
|
|
917
|
+
...require_index$15.VISUALLY_HIDDEN_STYLES,
|
|
918
|
+
...props.style
|
|
919
|
+
},
|
|
920
|
+
ref: composedRefs,
|
|
921
|
+
defaultValue: value
|
|
904
922
|
});
|
|
905
923
|
});
|
|
906
|
-
|
|
924
|
+
SelectBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
925
|
+
function shouldShowPlaceholder(value) {
|
|
926
|
+
return value === "" || value === void 0;
|
|
927
|
+
}
|
|
907
928
|
function useTypeaheadSearch(onSearchChange) {
|
|
908
929
|
const handleSearchChange = require_index$5.useCallbackRef(onSearchChange);
|
|
909
930
|
const searchRef = react.useRef("");
|