@radix-ui/react-select 2.1.7 → 2.1.8-rc.1744259191780

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 WorkOS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,13 +1,3 @@
1
1
  # `react-select`
2
2
 
3
- ## Installation
4
-
5
- ```sh
6
- $ yarn add @radix-ui/react-select
7
- # or
8
- $ npm install @radix-ui/react-select
9
- ```
10
-
11
- ## Usage
12
-
13
3
  View docs [here](https://radix-ui.com/primitives/docs/components/select).
package/dist/index.d.mts CHANGED
@@ -8,11 +8,8 @@ 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 SelectProps {
11
+ interface SelectSharedProps {
12
12
  children?: React.ReactNode;
13
- value?: string;
14
- defaultValue?: string;
15
- onValueChange?(value: string): void;
16
13
  open?: boolean;
17
14
  defaultOpen?: boolean;
18
15
  onOpenChange?(open: boolean): void;
@@ -23,6 +20,11 @@ interface SelectProps {
23
20
  required?: boolean;
24
21
  form?: string;
25
22
  }
23
+ type SelectProps = SelectSharedProps & {
24
+ value?: string;
25
+ defaultValue?: string;
26
+ onValueChange?(value: string): void;
27
+ };
26
28
  declare const Select: React.FC<SelectProps>;
27
29
  type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
28
30
  interface SelectTriggerProps extends PrimitiveButtonProps {
package/dist/index.d.ts CHANGED
@@ -8,11 +8,8 @@ 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 SelectProps {
11
+ interface SelectSharedProps {
12
12
  children?: React.ReactNode;
13
- value?: string;
14
- defaultValue?: string;
15
- onValueChange?(value: string): void;
16
13
  open?: boolean;
17
14
  defaultOpen?: boolean;
18
15
  onOpenChange?(open: boolean): void;
@@ -23,6 +20,11 @@ interface SelectProps {
23
20
  required?: boolean;
24
21
  form?: string;
25
22
  }
23
+ type SelectProps = SelectSharedProps & {
24
+ value?: string;
25
+ defaultValue?: string;
26
+ onValueChange?(value: string): void;
27
+ };
26
28
  declare const Select: React.FC<SelectProps>;
27
29
  type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
28
30
  interface SelectTriggerProps extends PrimitiveButtonProps {
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  ));
29
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
30
 
31
- // packages/react/select/src/index.ts
31
+ // src/index.ts
32
32
  var index_exports = {};
33
33
  __export(index_exports, {
34
34
  Arrow: () => Arrow2,
@@ -67,7 +67,7 @@ __export(index_exports, {
67
67
  });
68
68
  module.exports = __toCommonJS(index_exports);
69
69
 
70
- // packages/react/select/src/select.tsx
70
+ // src/select.tsx
71
71
  var React = __toESM(require("react"));
72
72
  var ReactDOM = __toESM(require("react-dom"));
73
73
  var import_number = require("@radix-ui/number");
@@ -126,15 +126,17 @@ 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 = false, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
129
+ const [open, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
130
130
  prop: openProp,
131
- defaultProp: defaultOpen,
132
- onChange: onOpenChange
131
+ defaultProp: defaultOpen ?? false,
132
+ onChange: onOpenChange,
133
+ caller: SELECT_NAME
133
134
  });
134
135
  const [value, setValue] = (0, import_react_use_controllable_state.useControllableState)({
135
136
  prop: valueProp,
136
137
  defaultProp: defaultValue,
137
- onChange: onValueChange
138
+ onChange: onValueChange,
139
+ caller: SELECT_NAME
138
140
  });
139
141
  const triggerPointerDownPosRef = React.useRef(null);
140
142
  const isFormControl = trigger ? form || !!trigger.closest("form") : true;