@radix-ui/react-select 2.2.0-rc.1744574857111 → 2.2.0-rc.1744660991666
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +4 -6
- package/dist/index.d.ts +4 -6
- package/dist/index.js +13 -24
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +14 -25
- package/dist/index.mjs.map +2 -2
- package/package.json +13 -13
package/dist/index.d.mts
CHANGED
|
@@ -8,8 +8,11 @@ import { Primitive } from '@radix-ui/react-primitive';
|
|
|
8
8
|
|
|
9
9
|
type Direction = 'ltr' | 'rtl';
|
|
10
10
|
declare const createSelectScope: _radix_ui_react_context.CreateScope;
|
|
11
|
-
interface
|
|
11
|
+
interface SelectProps {
|
|
12
12
|
children?: React.ReactNode;
|
|
13
|
+
value?: string;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
onValueChange?(value: string): void;
|
|
13
16
|
open?: boolean;
|
|
14
17
|
defaultOpen?: boolean;
|
|
15
18
|
onOpenChange?(open: boolean): void;
|
|
@@ -20,11 +23,6 @@ interface SelectSharedProps {
|
|
|
20
23
|
required?: boolean;
|
|
21
24
|
form?: string;
|
|
22
25
|
}
|
|
23
|
-
type SelectProps = SelectSharedProps & {
|
|
24
|
-
value?: string;
|
|
25
|
-
defaultValue?: string;
|
|
26
|
-
onValueChange?(value: string): void;
|
|
27
|
-
};
|
|
28
26
|
declare const Select: React.FC<SelectProps>;
|
|
29
27
|
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
30
28
|
interface SelectTriggerProps extends PrimitiveButtonProps {
|
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,11 @@ import { Primitive } from '@radix-ui/react-primitive';
|
|
|
8
8
|
|
|
9
9
|
type Direction = 'ltr' | 'rtl';
|
|
10
10
|
declare const createSelectScope: _radix_ui_react_context.CreateScope;
|
|
11
|
-
interface
|
|
11
|
+
interface SelectProps {
|
|
12
12
|
children?: React.ReactNode;
|
|
13
|
+
value?: string;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
onValueChange?(value: string): void;
|
|
13
16
|
open?: boolean;
|
|
14
17
|
defaultOpen?: boolean;
|
|
15
18
|
onOpenChange?(open: boolean): void;
|
|
@@ -20,11 +23,6 @@ interface SelectSharedProps {
|
|
|
20
23
|
required?: boolean;
|
|
21
24
|
form?: string;
|
|
22
25
|
}
|
|
23
|
-
type SelectProps = SelectSharedProps & {
|
|
24
|
-
value?: string;
|
|
25
|
-
defaultValue?: string;
|
|
26
|
-
onValueChange?(value: string): void;
|
|
27
|
-
};
|
|
28
26
|
declare const Select: React.FC<SelectProps>;
|
|
29
27
|
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
30
28
|
interface SelectTriggerProps extends PrimitiveButtonProps {
|
package/dist/index.js
CHANGED
|
@@ -126,17 +126,15 @@ var Select = (props) => {
|
|
|
126
126
|
const [valueNode, setValueNode] = React.useState(null);
|
|
127
127
|
const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false);
|
|
128
128
|
const direction = (0, import_react_direction.useDirection)(dir);
|
|
129
|
-
const [open, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
|
|
129
|
+
const [open = false, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
|
|
130
130
|
prop: openProp,
|
|
131
|
-
defaultProp: defaultOpen
|
|
132
|
-
onChange: onOpenChange
|
|
133
|
-
caller: SELECT_NAME
|
|
131
|
+
defaultProp: defaultOpen,
|
|
132
|
+
onChange: onOpenChange
|
|
134
133
|
});
|
|
135
134
|
const [value, setValue] = (0, import_react_use_controllable_state.useControllableState)({
|
|
136
135
|
prop: valueProp,
|
|
137
136
|
defaultProp: defaultValue,
|
|
138
|
-
onChange: onValueChange
|
|
139
|
-
caller: SELECT_NAME
|
|
137
|
+
onChange: onValueChange
|
|
140
138
|
});
|
|
141
139
|
const triggerPointerDownPosRef = React.useRef(null);
|
|
142
140
|
const isFormControl = trigger ? form || !!trigger.closest("form") : true;
|
|
@@ -180,7 +178,7 @@ var Select = (props) => {
|
|
|
180
178
|
}
|
|
181
179
|
) }),
|
|
182
180
|
isFormControl ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
183
|
-
|
|
181
|
+
BubbleSelect,
|
|
184
182
|
{
|
|
185
183
|
"aria-hidden": true,
|
|
186
184
|
required,
|
|
@@ -1133,15 +1131,17 @@ var SelectArrow = React.forwardRef(
|
|
|
1133
1131
|
}
|
|
1134
1132
|
);
|
|
1135
1133
|
SelectArrow.displayName = ARROW_NAME;
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1134
|
+
function shouldShowPlaceholder(value) {
|
|
1135
|
+
return value === "" || value === void 0;
|
|
1136
|
+
}
|
|
1137
|
+
var BubbleSelect = React.forwardRef(
|
|
1138
|
+
(props, forwardedRef) => {
|
|
1139
|
+
const { value, ...selectProps } = props;
|
|
1139
1140
|
const ref = React.useRef(null);
|
|
1140
1141
|
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
|
|
1141
1142
|
const prevValue = (0, import_react_use_previous.usePrevious)(value);
|
|
1142
1143
|
React.useEffect(() => {
|
|
1143
1144
|
const select = ref.current;
|
|
1144
|
-
if (!select) return;
|
|
1145
1145
|
const selectProto = window.HTMLSelectElement.prototype;
|
|
1146
1146
|
const descriptor = Object.getOwnPropertyDescriptor(
|
|
1147
1147
|
selectProto,
|
|
@@ -1154,21 +1154,10 @@ var SelectBubbleInput = React.forwardRef(
|
|
|
1154
1154
|
select.dispatchEvent(event);
|
|
1155
1155
|
}
|
|
1156
1156
|
}, [prevValue, value]);
|
|
1157
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1158
|
-
import_react_primitive.Primitive.select,
|
|
1159
|
-
{
|
|
1160
|
-
...props,
|
|
1161
|
-
style: { ...import_react_visually_hidden.VISUALLY_HIDDEN_STYLES, ...props.style },
|
|
1162
|
-
ref: composedRefs,
|
|
1163
|
-
defaultValue: value
|
|
1164
|
-
}
|
|
1165
|
-
);
|
|
1157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_visually_hidden.VisuallyHidden, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("select", { ...selectProps, ref: composedRefs, defaultValue: value }) });
|
|
1166
1158
|
}
|
|
1167
1159
|
);
|
|
1168
|
-
|
|
1169
|
-
function shouldShowPlaceholder(value) {
|
|
1170
|
-
return value === "" || value === void 0;
|
|
1171
|
-
}
|
|
1160
|
+
BubbleSelect.displayName = "BubbleSelect";
|
|
1172
1161
|
function useTypeaheadSearch(onSearchChange) {
|
|
1173
1162
|
const handleSearchChange = (0, import_react_use_callback_ref.useCallbackRef)(onSearchChange);
|
|
1174
1163
|
const searchRef = React.useRef("");
|