@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { composeEventHandlers } from "../../primitive/dist/index.js";
|
|
3
3
|
import { useComposedRefs } from "../../react-compose-refs/dist/index.js";
|
|
4
4
|
import { createContextScope } from "../../react-context/dist/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createSlot } from "../../react-slot/dist/index.js";
|
|
6
6
|
import { Primitive } from "../../react-primitive/dist/index.js";
|
|
7
7
|
import { useCallbackRef } from "../../react-use-callback-ref/dist/index.js";
|
|
8
8
|
import { DismissableLayer } from "../../react-dismissable-layer/dist/index.js";
|
|
@@ -15,7 +15,7 @@ import { Portal as Portal$1 } from "../../react-portal/dist/index.js";
|
|
|
15
15
|
import { useControllableState } from "../../react-use-controllable-state/dist/index.js";
|
|
16
16
|
import { hideOthers } from "../../../aria-hidden/dist/es2015/index.js";
|
|
17
17
|
import ReactRemoveScroll from "../../../react-remove-scroll/dist/es2015/Combination.js";
|
|
18
|
-
import {
|
|
18
|
+
import { VISUALLY_HIDDEN_STYLES } from "../../react-visually-hidden/dist/index.js";
|
|
19
19
|
import { createCollection } from "../../react-collection/dist/index.js";
|
|
20
20
|
import { useDirection } from "../../react-direction/dist/index.js";
|
|
21
21
|
import { usePrevious } from "../../react-use-previous/dist/index.js";
|
|
@@ -38,24 +38,26 @@ var usePopperScope = createPopperScope();
|
|
|
38
38
|
var [SelectProvider, useSelectContext] = createSelectContext(SELECT_NAME);
|
|
39
39
|
var [SelectNativeOptionsProvider, useSelectNativeOptionsContext] = createSelectContext(SELECT_NAME);
|
|
40
40
|
var Select = (props) => {
|
|
41
|
-
const { __scopeSelect, children, open: openProp, defaultOpen, onOpenChange, value: valueProp, defaultValue, onValueChange, dir, name, autoComplete, disabled, required } = props;
|
|
41
|
+
const { __scopeSelect, children, open: openProp, defaultOpen, onOpenChange, value: valueProp, defaultValue, onValueChange, dir, name, autoComplete, disabled, required, form } = props;
|
|
42
42
|
const popperScope = usePopperScope(__scopeSelect);
|
|
43
43
|
const [trigger, setTrigger] = React$1.useState(null);
|
|
44
44
|
const [valueNode, setValueNode] = React$1.useState(null);
|
|
45
45
|
const [valueNodeHasChildren, setValueNodeHasChildren] = React$1.useState(false);
|
|
46
46
|
const direction = useDirection(dir);
|
|
47
|
-
const [open
|
|
47
|
+
const [open, setOpen] = useControllableState({
|
|
48
48
|
prop: openProp,
|
|
49
|
-
defaultProp: defaultOpen,
|
|
50
|
-
onChange: onOpenChange
|
|
49
|
+
defaultProp: defaultOpen ?? false,
|
|
50
|
+
onChange: onOpenChange,
|
|
51
|
+
caller: SELECT_NAME
|
|
51
52
|
});
|
|
52
53
|
const [value, setValue] = useControllableState({
|
|
53
54
|
prop: valueProp,
|
|
54
55
|
defaultProp: defaultValue,
|
|
55
|
-
onChange: onValueChange
|
|
56
|
+
onChange: onValueChange,
|
|
57
|
+
caller: SELECT_NAME
|
|
56
58
|
});
|
|
57
59
|
const triggerPointerDownPosRef = React$1.useRef(null);
|
|
58
|
-
const isFormControl = trigger ?
|
|
60
|
+
const isFormControl = trigger ? form || !!trigger.closest("form") : true;
|
|
59
61
|
const [nativeOptionsSet, setNativeOptionsSet] = React$1.useState(/* @__PURE__ */ new Set());
|
|
60
62
|
const nativeSelectKey = Array.from(nativeOptionsSet).map((option) => option.props.value).join(";");
|
|
61
63
|
return /* @__PURE__ */ jsx(Root2$1, {
|
|
@@ -93,7 +95,7 @@ var Select = (props) => {
|
|
|
93
95
|
}, []),
|
|
94
96
|
children
|
|
95
97
|
})
|
|
96
|
-
}), isFormControl ? /* @__PURE__ */ jsxs(
|
|
98
|
+
}), isFormControl ? /* @__PURE__ */ jsxs(SelectBubbleInput, {
|
|
97
99
|
"aria-hidden": true,
|
|
98
100
|
required,
|
|
99
101
|
tabIndex: -1,
|
|
@@ -102,6 +104,7 @@ var Select = (props) => {
|
|
|
102
104
|
value,
|
|
103
105
|
onChange: (event) => setValue(event.target.value),
|
|
104
106
|
disabled,
|
|
107
|
+
form,
|
|
105
108
|
children: [value === void 0 ? /* @__PURE__ */ jsx("option", { value: "" }) : null, Array.from(nativeOptionsSet)]
|
|
106
109
|
}, nativeSelectKey) : null]
|
|
107
110
|
})
|
|
@@ -116,16 +119,21 @@ var SelectTrigger = React$1.forwardRef((props, forwardedRef) => {
|
|
|
116
119
|
const isDisabled = context.disabled || disabled;
|
|
117
120
|
const composedRefs = useComposedRefs(forwardedRef, context.onTriggerChange);
|
|
118
121
|
const getItems = useCollection(__scopeSelect);
|
|
122
|
+
const pointerTypeRef = React$1.useRef("touch");
|
|
119
123
|
const [searchRef, handleTypeaheadSearch, resetTypeahead] = useTypeaheadSearch((search) => {
|
|
120
124
|
const enabledItems = getItems().filter((item) => !item.disabled);
|
|
121
125
|
const nextItem = findNextItem(enabledItems, search, enabledItems.find((item) => item.value === context.value));
|
|
122
126
|
if (nextItem !== void 0) context.onValueChange(nextItem.value);
|
|
123
127
|
});
|
|
124
|
-
const handleOpen = () => {
|
|
128
|
+
const handleOpen = (pointerEvent) => {
|
|
125
129
|
if (!isDisabled) {
|
|
126
130
|
context.onOpenChange(true);
|
|
127
131
|
resetTypeahead();
|
|
128
132
|
}
|
|
133
|
+
if (pointerEvent) context.triggerPointerDownPosRef.current = {
|
|
134
|
+
x: Math.round(pointerEvent.pageX),
|
|
135
|
+
y: Math.round(pointerEvent.pageY)
|
|
136
|
+
};
|
|
129
137
|
};
|
|
130
138
|
return /* @__PURE__ */ jsx(Anchor, {
|
|
131
139
|
asChild: true,
|
|
@@ -146,16 +154,14 @@ var SelectTrigger = React$1.forwardRef((props, forwardedRef) => {
|
|
|
146
154
|
ref: composedRefs,
|
|
147
155
|
onClick: composeEventHandlers(triggerProps.onClick, (event) => {
|
|
148
156
|
event.currentTarget.focus();
|
|
157
|
+
if (pointerTypeRef.current !== "mouse") handleOpen(event);
|
|
149
158
|
}),
|
|
150
159
|
onPointerDown: composeEventHandlers(triggerProps.onPointerDown, (event) => {
|
|
160
|
+
pointerTypeRef.current = event.pointerType;
|
|
151
161
|
const target = event.target;
|
|
152
162
|
if (target.hasPointerCapture(event.pointerId)) target.releasePointerCapture(event.pointerId);
|
|
153
|
-
if (event.button === 0 && event.ctrlKey === false) {
|
|
154
|
-
handleOpen();
|
|
155
|
-
context.triggerPointerDownPosRef.current = {
|
|
156
|
-
x: Math.round(event.pageX),
|
|
157
|
-
y: Math.round(event.pageY)
|
|
158
|
-
};
|
|
163
|
+
if (event.button === 0 && event.ctrlKey === false && event.pointerType === "mouse") {
|
|
164
|
+
handleOpen(event);
|
|
159
165
|
event.preventDefault();
|
|
160
166
|
}
|
|
161
167
|
}),
|
|
@@ -235,6 +241,7 @@ SelectContent.displayName = CONTENT_NAME;
|
|
|
235
241
|
var CONTENT_MARGIN = 10;
|
|
236
242
|
var [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME);
|
|
237
243
|
var CONTENT_IMPL_NAME = "SelectContentImpl";
|
|
244
|
+
var Slot = createSlot("SelectContent.RemoveScroll");
|
|
238
245
|
var SelectContentImpl = React$1.forwardRef((props, forwardedRef) => {
|
|
239
246
|
const { __scopeSelect, position = "item-aligned", onCloseAutoFocus, onEscapeKeyDown, onPointerDownOutside, side, sideOffset, align, alignOffset, arrowPadding, collisionBoundary, collisionPadding, sticky, hideWhenDetached, avoidCollisions, ...contentProps } = props;
|
|
240
247
|
const context = useSelectContext(CONTENT_NAME, __scopeSelect);
|
|
@@ -448,7 +455,8 @@ var SelectItemAlignedPosition = React$1.forwardRef((props, forwardedRef) => {
|
|
|
448
455
|
const leftDelta = triggerRect.left - left;
|
|
449
456
|
const minContentWidth = triggerRect.width + leftDelta;
|
|
450
457
|
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
451
|
-
const
|
|
458
|
+
const rightEdge = window.innerWidth - CONTENT_MARGIN;
|
|
459
|
+
const clampedLeft = clamp(left, [CONTENT_MARGIN, Math.max(CONTENT_MARGIN, rightEdge - contentWidth)]);
|
|
452
460
|
contentWrapper.style.minWidth = minContentWidth + "px";
|
|
453
461
|
contentWrapper.style.left = clampedLeft + "px";
|
|
454
462
|
} else {
|
|
@@ -457,7 +465,8 @@ var SelectItemAlignedPosition = React$1.forwardRef((props, forwardedRef) => {
|
|
|
457
465
|
const rightDelta = window.innerWidth - triggerRect.right - right;
|
|
458
466
|
const minContentWidth = triggerRect.width + rightDelta;
|
|
459
467
|
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
460
|
-
const
|
|
468
|
+
const leftEdge = window.innerWidth - CONTENT_MARGIN;
|
|
469
|
+
const clampedRight = clamp(right, [CONTENT_MARGIN, Math.max(CONTENT_MARGIN, leftEdge - contentWidth)]);
|
|
461
470
|
contentWrapper.style.minWidth = minContentWidth + "px";
|
|
462
471
|
contentWrapper.style.right = clampedRight + "px";
|
|
463
472
|
}
|
|
@@ -481,13 +490,13 @@ var SelectItemAlignedPosition = React$1.forwardRef((props, forwardedRef) => {
|
|
|
481
490
|
const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;
|
|
482
491
|
const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;
|
|
483
492
|
if (contentTopToItemMiddle <= topEdgeToTriggerMiddle) {
|
|
484
|
-
const isLastItem = selectedItem === items[items.length - 1].ref.current;
|
|
493
|
+
const isLastItem = items.length > 0 && selectedItem === items[items.length - 1].ref.current;
|
|
485
494
|
contentWrapper.style.bottom = "0px";
|
|
486
495
|
const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight;
|
|
487
496
|
const height = contentTopToItemMiddle + Math.max(triggerMiddleToBottomEdge, selectedItemHalfHeight + (isLastItem ? viewportPaddingBottom : 0) + viewportOffsetBottom + contentBorderBottomWidth);
|
|
488
497
|
contentWrapper.style.height = height + "px";
|
|
489
498
|
} else {
|
|
490
|
-
const isFirstItem = selectedItem === items[0].ref.current;
|
|
499
|
+
const isFirstItem = items.length > 0 && selectedItem === items[0].ref.current;
|
|
491
500
|
contentWrapper.style.top = "0px";
|
|
492
501
|
const height = Math.max(topEdgeToTriggerMiddle, contentBorderTopWidth + viewport.offsetTop + (isFirstItem ? viewportPaddingTop : 0) + selectedItemHalfHeight) + itemMiddleToContentBottom;
|
|
493
502
|
contentWrapper.style.height = height + "px";
|
|
@@ -590,7 +599,7 @@ var SelectViewport = React$1.forwardRef((props, forwardedRef) => {
|
|
|
590
599
|
style: {
|
|
591
600
|
position: "relative",
|
|
592
601
|
flex: 1,
|
|
593
|
-
overflow: "auto",
|
|
602
|
+
overflow: "hidden auto",
|
|
594
603
|
...viewportProps.style
|
|
595
604
|
},
|
|
596
605
|
onScroll: composeEventHandlers(viewportProps.onScroll, (event) => {
|
|
@@ -660,6 +669,7 @@ var SelectItem = React$1.forwardRef((props, forwardedRef) => {
|
|
|
660
669
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
661
670
|
const composedRefs = useComposedRefs(forwardedRef, (node) => contentContext.itemRefCallback?.(node, value, disabled));
|
|
662
671
|
const textId = useId();
|
|
672
|
+
const pointerTypeRef = React$1.useRef("touch");
|
|
663
673
|
const handleSelect = () => {
|
|
664
674
|
if (!disabled) {
|
|
665
675
|
context.onValueChange(value);
|
|
@@ -694,10 +704,19 @@ var SelectItem = React$1.forwardRef((props, forwardedRef) => {
|
|
|
694
704
|
ref: composedRefs,
|
|
695
705
|
onFocus: composeEventHandlers(itemProps.onFocus, () => setIsFocused(true)),
|
|
696
706
|
onBlur: composeEventHandlers(itemProps.onBlur, () => setIsFocused(false)),
|
|
697
|
-
|
|
707
|
+
onClick: composeEventHandlers(itemProps.onClick, () => {
|
|
708
|
+
if (pointerTypeRef.current !== "mouse") handleSelect();
|
|
709
|
+
}),
|
|
710
|
+
onPointerUp: composeEventHandlers(itemProps.onPointerUp, () => {
|
|
711
|
+
if (pointerTypeRef.current === "mouse") handleSelect();
|
|
712
|
+
}),
|
|
713
|
+
onPointerDown: composeEventHandlers(itemProps.onPointerDown, (event) => {
|
|
714
|
+
pointerTypeRef.current = event.pointerType;
|
|
715
|
+
}),
|
|
698
716
|
onPointerMove: composeEventHandlers(itemProps.onPointerMove, (event) => {
|
|
717
|
+
pointerTypeRef.current = event.pointerType;
|
|
699
718
|
if (disabled) contentContext.onItemLeave?.();
|
|
700
|
-
else event.currentTarget.focus({ preventScroll: true });
|
|
719
|
+
else if (pointerTypeRef.current === "mouse") event.currentTarget.focus({ preventScroll: true });
|
|
701
720
|
}),
|
|
702
721
|
onPointerLeave: composeEventHandlers(itemProps.onPointerLeave, (event) => {
|
|
703
722
|
if (event.currentTarget === document.activeElement) contentContext.onItemLeave?.();
|
|
@@ -872,16 +891,14 @@ var SelectArrow = React$1.forwardRef((props, forwardedRef) => {
|
|
|
872
891
|
}) : null;
|
|
873
892
|
});
|
|
874
893
|
SelectArrow.displayName = ARROW_NAME;
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
}
|
|
878
|
-
var BubbleSelect = React$1.forwardRef((props, forwardedRef) => {
|
|
879
|
-
const { value, ...selectProps } = props;
|
|
894
|
+
var BUBBLE_INPUT_NAME = "SelectBubbleInput";
|
|
895
|
+
var SelectBubbleInput = React$1.forwardRef(({ __scopeSelect, value, ...props }, forwardedRef) => {
|
|
880
896
|
const ref = React$1.useRef(null);
|
|
881
897
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
882
898
|
const prevValue = usePrevious(value);
|
|
883
899
|
React$1.useEffect(() => {
|
|
884
900
|
const select = ref.current;
|
|
901
|
+
if (!select) return;
|
|
885
902
|
const selectProto = window.HTMLSelectElement.prototype;
|
|
886
903
|
const setValue = Object.getOwnPropertyDescriptor(selectProto, "value").set;
|
|
887
904
|
if (prevValue !== value && setValue) {
|
|
@@ -890,16 +907,20 @@ var BubbleSelect = React$1.forwardRef((props, forwardedRef) => {
|
|
|
890
907
|
select.dispatchEvent(event);
|
|
891
908
|
}
|
|
892
909
|
}, [prevValue, value]);
|
|
893
|
-
return /* @__PURE__ */ jsx(
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
...
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
910
|
+
return /* @__PURE__ */ jsx(Primitive.select, {
|
|
911
|
+
...props,
|
|
912
|
+
style: {
|
|
913
|
+
...VISUALLY_HIDDEN_STYLES,
|
|
914
|
+
...props.style
|
|
915
|
+
},
|
|
916
|
+
ref: composedRefs,
|
|
917
|
+
defaultValue: value
|
|
900
918
|
});
|
|
901
919
|
});
|
|
902
|
-
|
|
920
|
+
SelectBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
921
|
+
function shouldShowPlaceholder(value) {
|
|
922
|
+
return value === "" || value === void 0;
|
|
923
|
+
}
|
|
903
924
|
function useTypeaheadSearch(onSearchChange) {
|
|
904
925
|
const handleSearchChange = useCallbackRef(onSearchChange);
|
|
905
926
|
const searchRef = React$1.useRef("");
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
const require_runtime = require("../../../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
-
const require_index = require("
|
|
4
|
-
const require_index$1 = require("
|
|
5
|
-
const require_index$2 = require("
|
|
6
|
-
const require_index$3 = require("
|
|
7
|
-
const require_index$4 = require("
|
|
8
|
-
const require_index$5 = require("
|
|
9
|
-
const require_index$6 = require("
|
|
10
|
-
const require_index$7 = require("
|
|
11
|
-
const require_index$8 = require("
|
|
12
|
-
const require_index$9 = require("
|
|
3
|
+
const require_index = require("../../primitive/dist/index.cjs");
|
|
4
|
+
const require_index$1 = require("../../react-compose-refs/dist/index.cjs");
|
|
5
|
+
const require_index$2 = require("../../react-context/dist/index.cjs");
|
|
6
|
+
const require_index$3 = require("../../react-primitive/dist/index.cjs");
|
|
7
|
+
const require_index$4 = require("../../react-use-size/dist/index.cjs");
|
|
8
|
+
const require_index$5 = require("../../react-use-controllable-state/dist/index.cjs");
|
|
9
|
+
const require_index$6 = require("../../react-collection/dist/index.cjs");
|
|
10
|
+
const require_index$7 = require("../../react-direction/dist/index.cjs");
|
|
11
|
+
const require_index$8 = require("../../react-use-previous/dist/index.cjs");
|
|
12
|
+
const require_index$9 = require("../../number/dist/index.cjs");
|
|
13
13
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
14
|
let react = require("react");
|
|
15
15
|
react = require_runtime.__toESM(react, 1);
|
|
@@ -48,15 +48,15 @@ var BACK_KEYS = {
|
|
|
48
48
|
]
|
|
49
49
|
};
|
|
50
50
|
var SLIDER_NAME = "Slider";
|
|
51
|
-
var [Collection, useCollection, createCollectionScope] = require_index$
|
|
52
|
-
var [createSliderContext, createSliderScope] = require_index$
|
|
51
|
+
var [Collection, useCollection, createCollectionScope] = require_index$6.createCollection(SLIDER_NAME);
|
|
52
|
+
var [createSliderContext, createSliderScope] = require_index$2.createContextScope(SLIDER_NAME, [createCollectionScope]);
|
|
53
53
|
var [SliderProvider, useSliderContext] = createSliderContext(SLIDER_NAME);
|
|
54
54
|
var Slider = react.forwardRef((props, forwardedRef) => {
|
|
55
55
|
const { name, min = 0, max = 100, step = 1, orientation = "horizontal", disabled = false, minStepsBetweenThumbs = 0, defaultValue = [min], value, onValueChange = () => {}, onValueCommit = () => {}, inverted = false, form, ...sliderProps } = props;
|
|
56
56
|
const thumbRefs = react.useRef(/* @__PURE__ */ new Set());
|
|
57
57
|
const valueIndexToChangeRef = react.useRef(0);
|
|
58
58
|
const SliderOrientation = orientation === "horizontal" ? SliderHorizontal : SliderVertical;
|
|
59
|
-
const [values = [], setValues] = require_index$
|
|
59
|
+
const [values = [], setValues] = require_index$5.useControllableState({
|
|
60
60
|
prop: value,
|
|
61
61
|
defaultProp: defaultValue,
|
|
62
62
|
onChange: (value2) => {
|
|
@@ -77,7 +77,7 @@ var Slider = react.forwardRef((props, forwardedRef) => {
|
|
|
77
77
|
}
|
|
78
78
|
function updateValues(value2, atIndex, { commit } = { commit: false }) {
|
|
79
79
|
const decimalCount = getDecimalCount(step);
|
|
80
|
-
const nextValue = require_index.clamp(roundValue(Math.round((value2 - min) / step) * step + min, decimalCount), [min, max]);
|
|
80
|
+
const nextValue = require_index$9.clamp(roundValue(Math.round((value2 - min) / step) * step + min, decimalCount), [min, max]);
|
|
81
81
|
setValues((prevValues = []) => {
|
|
82
82
|
const nextValues = getNextSortedValues(prevValues, nextValue, atIndex);
|
|
83
83
|
if (hasMinStepsBetweenValues(nextValues, minStepsBetweenThumbs * step)) {
|
|
@@ -108,7 +108,7 @@ var Slider = react.forwardRef((props, forwardedRef) => {
|
|
|
108
108
|
"data-disabled": disabled ? "" : void 0,
|
|
109
109
|
...sliderProps,
|
|
110
110
|
ref: forwardedRef,
|
|
111
|
-
onPointerDown: require_index
|
|
111
|
+
onPointerDown: require_index.composeEventHandlers(sliderProps.onPointerDown, () => {
|
|
112
112
|
if (!disabled) valuesBeforeSlideStartRef.current = values;
|
|
113
113
|
}),
|
|
114
114
|
min,
|
|
@@ -142,9 +142,9 @@ var [SliderOrientationProvider, useSliderOrientationContext] = createSliderConte
|
|
|
142
142
|
var SliderHorizontal = react.forwardRef((props, forwardedRef) => {
|
|
143
143
|
const { min, max, dir, inverted, onSlideStart, onSlideMove, onSlideEnd, onStepKeyDown, ...sliderProps } = props;
|
|
144
144
|
const [slider, setSlider] = react.useState(null);
|
|
145
|
-
const composedRefs = require_index$
|
|
145
|
+
const composedRefs = require_index$1.useComposedRefs(forwardedRef, (node) => setSlider(node));
|
|
146
146
|
const rectRef = react.useRef(void 0);
|
|
147
|
-
const direction = require_index$
|
|
147
|
+
const direction = require_index$7.useDirection(dir);
|
|
148
148
|
const isDirectionLTR = direction === "ltr";
|
|
149
149
|
const isSlidingFromLeft = isDirectionLTR && !inverted || !isDirectionLTR && inverted;
|
|
150
150
|
function getValueFromPointer(pointerPosition) {
|
|
@@ -193,7 +193,7 @@ var SliderHorizontal = react.forwardRef((props, forwardedRef) => {
|
|
|
193
193
|
var SliderVertical = react.forwardRef((props, forwardedRef) => {
|
|
194
194
|
const { min, max, inverted, onSlideStart, onSlideMove, onSlideEnd, onStepKeyDown, ...sliderProps } = props;
|
|
195
195
|
const sliderRef = react.useRef(null);
|
|
196
|
-
const ref = require_index$
|
|
196
|
+
const ref = require_index$1.useComposedRefs(forwardedRef, sliderRef);
|
|
197
197
|
const rectRef = react.useRef(void 0);
|
|
198
198
|
const isSlidingFromBottom = !inverted;
|
|
199
199
|
function getValueFromPointer(pointerPosition) {
|
|
@@ -241,10 +241,10 @@ var SliderVertical = react.forwardRef((props, forwardedRef) => {
|
|
|
241
241
|
var SliderImpl = react.forwardRef((props, forwardedRef) => {
|
|
242
242
|
const { __scopeSlider, onSlideStart, onSlideMove, onSlideEnd, onHomeKeyDown, onEndKeyDown, onStepKeyDown, ...sliderProps } = props;
|
|
243
243
|
const context = useSliderContext(SLIDER_NAME, __scopeSlider);
|
|
244
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$
|
|
244
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$3.Primitive.span, {
|
|
245
245
|
...sliderProps,
|
|
246
246
|
ref: forwardedRef,
|
|
247
|
-
onKeyDown: require_index
|
|
247
|
+
onKeyDown: require_index.composeEventHandlers(props.onKeyDown, (event) => {
|
|
248
248
|
if (event.key === "Home") {
|
|
249
249
|
onHomeKeyDown(event);
|
|
250
250
|
event.preventDefault();
|
|
@@ -256,17 +256,17 @@ var SliderImpl = react.forwardRef((props, forwardedRef) => {
|
|
|
256
256
|
event.preventDefault();
|
|
257
257
|
}
|
|
258
258
|
}),
|
|
259
|
-
onPointerDown: require_index
|
|
259
|
+
onPointerDown: require_index.composeEventHandlers(props.onPointerDown, (event) => {
|
|
260
260
|
const target = event.target;
|
|
261
261
|
target.setPointerCapture(event.pointerId);
|
|
262
262
|
event.preventDefault();
|
|
263
263
|
if (context.thumbs.has(target)) target.focus();
|
|
264
264
|
else onSlideStart(event);
|
|
265
265
|
}),
|
|
266
|
-
onPointerMove: require_index
|
|
266
|
+
onPointerMove: require_index.composeEventHandlers(props.onPointerMove, (event) => {
|
|
267
267
|
if (event.target.hasPointerCapture(event.pointerId)) onSlideMove(event);
|
|
268
268
|
}),
|
|
269
|
-
onPointerUp: require_index
|
|
269
|
+
onPointerUp: require_index.composeEventHandlers(props.onPointerUp, (event) => {
|
|
270
270
|
const target = event.target;
|
|
271
271
|
if (target.hasPointerCapture(event.pointerId)) {
|
|
272
272
|
target.releasePointerCapture(event.pointerId);
|
|
@@ -279,7 +279,7 @@ var TRACK_NAME = "SliderTrack";
|
|
|
279
279
|
var SliderTrack = react.forwardRef((props, forwardedRef) => {
|
|
280
280
|
const { __scopeSlider, ...trackProps } = props;
|
|
281
281
|
const context = useSliderContext(TRACK_NAME, __scopeSlider);
|
|
282
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$
|
|
282
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$3.Primitive.span, {
|
|
283
283
|
"data-disabled": context.disabled ? "" : void 0,
|
|
284
284
|
"data-orientation": context.orientation,
|
|
285
285
|
...trackProps,
|
|
@@ -292,12 +292,12 @@ var SliderRange = react.forwardRef((props, forwardedRef) => {
|
|
|
292
292
|
const { __scopeSlider, ...rangeProps } = props;
|
|
293
293
|
const context = useSliderContext(RANGE_NAME, __scopeSlider);
|
|
294
294
|
const orientation = useSliderOrientationContext(RANGE_NAME, __scopeSlider);
|
|
295
|
-
const composedRefs = require_index$
|
|
295
|
+
const composedRefs = require_index$1.useComposedRefs(forwardedRef, react.useRef(null));
|
|
296
296
|
const valuesCount = context.values.length;
|
|
297
297
|
const percentages = context.values.map((value) => convertValueToPercentage(value, context.min, context.max));
|
|
298
298
|
const offsetStart = valuesCount > 1 ? Math.min(...percentages) : 0;
|
|
299
299
|
const offsetEnd = 100 - Math.max(...percentages);
|
|
300
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$
|
|
300
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$3.Primitive.span, {
|
|
301
301
|
"data-orientation": context.orientation,
|
|
302
302
|
"data-disabled": context.disabled ? "" : void 0,
|
|
303
303
|
...rangeProps,
|
|
@@ -314,7 +314,7 @@ var THUMB_NAME = "SliderThumb";
|
|
|
314
314
|
var SliderThumb = react.forwardRef((props, forwardedRef) => {
|
|
315
315
|
const getItems = useCollection(props.__scopeSlider);
|
|
316
316
|
const [thumb, setThumb] = react.useState(null);
|
|
317
|
-
const composedRefs = require_index$
|
|
317
|
+
const composedRefs = require_index$1.useComposedRefs(forwardedRef, (node) => setThumb(node));
|
|
318
318
|
const index = react.useMemo(() => thumb ? getItems().findIndex((item) => item.ref.current === thumb) : -1, [getItems, thumb]);
|
|
319
319
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SliderThumbImpl, {
|
|
320
320
|
...props,
|
|
@@ -327,9 +327,9 @@ var SliderThumbImpl = react.forwardRef((props, forwardedRef) => {
|
|
|
327
327
|
const context = useSliderContext(THUMB_NAME, __scopeSlider);
|
|
328
328
|
const orientation = useSliderOrientationContext(THUMB_NAME, __scopeSlider);
|
|
329
329
|
const [thumb, setThumb] = react.useState(null);
|
|
330
|
-
const composedRefs = require_index$
|
|
330
|
+
const composedRefs = require_index$1.useComposedRefs(forwardedRef, (node) => setThumb(node));
|
|
331
331
|
const isFormControl = thumb ? context.form || !!thumb.closest("form") : true;
|
|
332
|
-
const size = require_index$
|
|
332
|
+
const size = require_index$4.useSize(thumb);
|
|
333
333
|
const value = context.values[index];
|
|
334
334
|
const percent = value === void 0 ? 0 : convertValueToPercentage(value, context.min, context.max);
|
|
335
335
|
const label = getLabel(index, context.values.length);
|
|
@@ -351,7 +351,7 @@ var SliderThumbImpl = react.forwardRef((props, forwardedRef) => {
|
|
|
351
351
|
},
|
|
352
352
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Collection.ItemSlot, {
|
|
353
353
|
scope: props.__scopeSlider,
|
|
354
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$
|
|
354
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$3.Primitive.span, {
|
|
355
355
|
role: "slider",
|
|
356
356
|
"aria-label": props["aria-label"] || label,
|
|
357
357
|
"aria-valuemin": context.min,
|
|
@@ -364,7 +364,7 @@ var SliderThumbImpl = react.forwardRef((props, forwardedRef) => {
|
|
|
364
364
|
...thumbProps,
|
|
365
365
|
ref: composedRefs,
|
|
366
366
|
style: value === void 0 ? { display: "none" } : props.style,
|
|
367
|
-
onFocus: require_index
|
|
367
|
+
onFocus: require_index.composeEventHandlers(props.onFocus, () => {
|
|
368
368
|
context.valueIndexToChangeRef.current = index;
|
|
369
369
|
})
|
|
370
370
|
})
|
|
@@ -379,8 +379,8 @@ SliderThumb.displayName = THUMB_NAME;
|
|
|
379
379
|
var BUBBLE_INPUT_NAME = "RadioBubbleInput";
|
|
380
380
|
var SliderBubbleInput = react.forwardRef(({ __scopeSlider, value, ...props }, forwardedRef) => {
|
|
381
381
|
const ref = react.useRef(null);
|
|
382
|
-
const composedRefs = require_index$
|
|
383
|
-
const prevValue = require_index$
|
|
382
|
+
const composedRefs = require_index$1.useComposedRefs(ref, forwardedRef);
|
|
383
|
+
const prevValue = require_index$8.usePrevious(value);
|
|
384
384
|
react.useEffect(() => {
|
|
385
385
|
const input = ref.current;
|
|
386
386
|
if (!input) return;
|
|
@@ -392,7 +392,7 @@ var SliderBubbleInput = react.forwardRef(({ __scopeSlider, value, ...props }, fo
|
|
|
392
392
|
input.dispatchEvent(event);
|
|
393
393
|
}
|
|
394
394
|
}, [prevValue, value]);
|
|
395
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$
|
|
395
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$3.Primitive.input, {
|
|
396
396
|
style: { display: "none" },
|
|
397
397
|
...props,
|
|
398
398
|
ref: composedRefs,
|
|
@@ -406,7 +406,7 @@ function getNextSortedValues(prevValues = [], nextValue, atIndex) {
|
|
|
406
406
|
return nextValues.sort((a, b) => a - b);
|
|
407
407
|
}
|
|
408
408
|
function convertValueToPercentage(value, min, max) {
|
|
409
|
-
return require_index.clamp(100 / (max - min) * (value - min), [0, 100]);
|
|
409
|
+
return require_index$9.clamp(100 / (max - min) * (value - min), [0, 100]);
|
|
410
410
|
}
|
|
411
411
|
function getLabel(index, totalValues) {
|
|
412
412
|
if (totalValues > 2) return `Value ${index + 1} of ${totalValues}`;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
2
|
+
import { composeEventHandlers } from "../../primitive/dist/index.js";
|
|
3
|
+
import { useComposedRefs } from "../../react-compose-refs/dist/index.js";
|
|
4
|
+
import { createContextScope } from "../../react-context/dist/index.js";
|
|
5
|
+
import { Primitive } from "../../react-primitive/dist/index.js";
|
|
6
|
+
import { useSize } from "../../react-use-size/dist/index.js";
|
|
7
|
+
import { useControllableState } from "../../react-use-controllable-state/dist/index.js";
|
|
8
|
+
import { createCollection } from "../../react-collection/dist/index.js";
|
|
9
|
+
import { useDirection } from "../../react-direction/dist/index.js";
|
|
10
|
+
import { usePrevious } from "../../react-use-previous/dist/index.js";
|
|
11
|
+
import { clamp } from "../../number/dist/index.js";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React$1 from "react";
|
|
14
14
|
//#region ../../node_modules/@radix-ui/react-slider/dist/index.mjs
|
|
@@ -4,48 +4,63 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
4
4
|
let react = require("react");
|
|
5
5
|
react = require_runtime.__toESM(react, 1);
|
|
6
6
|
//#region ../../node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
8
|
+
function createSlot(ownerName) {
|
|
9
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
10
|
+
const Slot2 = react.forwardRef((props, forwardedRef) => {
|
|
11
|
+
const { children, ...slotProps } = props;
|
|
12
|
+
const childrenArray = react.Children.toArray(children);
|
|
13
|
+
const slottable = childrenArray.find(isSlottable);
|
|
14
|
+
if (slottable) {
|
|
15
|
+
const newElement = slottable.props.children;
|
|
16
|
+
const newChildren = childrenArray.map((child) => {
|
|
17
|
+
if (child === slottable) {
|
|
18
|
+
if (react.Children.count(newElement) > 1) return react.Children.only(null);
|
|
19
|
+
return react.isValidElement(newElement) ? newElement.props.children : null;
|
|
20
|
+
} else return child;
|
|
21
|
+
});
|
|
22
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SlotClone, {
|
|
23
|
+
...slotProps,
|
|
24
|
+
ref: forwardedRef,
|
|
25
|
+
children: react.isValidElement(newElement) ? react.cloneElement(newElement, void 0, newChildren) : null
|
|
26
|
+
});
|
|
27
|
+
}
|
|
19
28
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SlotClone, {
|
|
20
29
|
...slotProps,
|
|
21
30
|
ref: forwardedRef,
|
|
22
|
-
children
|
|
31
|
+
children
|
|
23
32
|
});
|
|
24
|
-
}
|
|
25
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SlotClone, {
|
|
26
|
-
...slotProps,
|
|
27
|
-
ref: forwardedRef,
|
|
28
|
-
children
|
|
29
33
|
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
35
|
+
return Slot2;
|
|
36
|
+
}
|
|
37
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
38
|
+
function createSlotClone(ownerName) {
|
|
39
|
+
const SlotClone = react.forwardRef((props, forwardedRef) => {
|
|
40
|
+
const { children, ...slotProps } = props;
|
|
41
|
+
if (react.isValidElement(children)) {
|
|
42
|
+
const childrenRef = getElementRef(children);
|
|
43
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
44
|
+
if (children.type !== react.Fragment) props2.ref = forwardedRef ? require_index.composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
45
|
+
return react.cloneElement(children, props2);
|
|
46
|
+
}
|
|
47
|
+
return react.Children.count(children) > 1 ? react.Children.only(null) : null;
|
|
48
|
+
});
|
|
49
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
50
|
+
return SlotClone;
|
|
51
|
+
}
|
|
52
|
+
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
53
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
54
|
+
function createSlottable(ownerName) {
|
|
55
|
+
const Slottable2 = ({ children }) => {
|
|
56
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
|
|
57
|
+
};
|
|
58
|
+
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
59
|
+
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
60
|
+
return Slottable2;
|
|
61
|
+
}
|
|
47
62
|
function isSlottable(child) {
|
|
48
|
-
return react.isValidElement(child) && child.type ===
|
|
63
|
+
return react.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
49
64
|
}
|
|
50
65
|
function mergeProps(slotProps, childProps) {
|
|
51
66
|
const overrideProps = { ...childProps };
|
|
@@ -54,8 +69,9 @@ function mergeProps(slotProps, childProps) {
|
|
|
54
69
|
const childPropValue = childProps[propName];
|
|
55
70
|
if (/^on[A-Z]/.test(propName)) {
|
|
56
71
|
if (slotPropValue && childPropValue) overrideProps[propName] = (...args) => {
|
|
57
|
-
childPropValue(...args);
|
|
72
|
+
const result = childPropValue(...args);
|
|
58
73
|
slotPropValue(...args);
|
|
74
|
+
return result;
|
|
59
75
|
};
|
|
60
76
|
else if (slotPropValue) overrideProps[propName] = slotPropValue;
|
|
61
77
|
} else if (propName === "style") overrideProps[propName] = {
|
|
@@ -79,5 +95,5 @@ function getElementRef(element) {
|
|
|
79
95
|
return element.props.ref || element.ref;
|
|
80
96
|
}
|
|
81
97
|
//#endregion
|
|
82
|
-
exports.
|
|
83
|
-
exports.
|
|
98
|
+
exports.createSlot = createSlot;
|
|
99
|
+
exports.createSlottable = createSlottable;
|