@rescui/select 0.17.1-RUI-293-Update-menu-component-6ca9d26d3.22 → 0.17.1-RUI-293-Update-menu-component-hover-icon-d8a5b0551.33
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/lib/_virtual/index.css.js +12 -12
- package/lib/index.css +189 -189
- package/lib/multiselect.d.ts +1 -1
- package/lib/multiselect.js +4 -0
- package/lib/parts/popup-content.d.ts +3 -1
- package/lib/parts/popup-content.js +4 -0
- package/lib/select-basic.d.ts +1 -1
- package/lib/select-basic.js +4 -0
- package/lib/select-searchable.d.ts +1 -1
- package/lib/select-searchable.js +4 -0
- package/lib/select.d.ts +3 -1
- package/lib/select.js +6 -0
- package/lib/styles/common.p.module.css.js +29 -29
- package/lib/styles/form-trigger.p.module.css.js +12 -12
- package/lib/styles/list-box.p.module.css.js +13 -13
- package/lib/types.d.ts +8 -0
- package/llm/components/multiselect.md +68 -23
- package/llm/components/select.md +68 -45
- package/package.json +8 -8
package/lib/multiselect.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { MultiselectProps } from './types';
|
|
3
|
-
export declare function Multiselect({ options, value, onChange, error, label, note, size, mode, theme: themeFromProps, placement, isSingleLine, boldLabel, reserveErrorLine, maxVisibleItems, isClearable, isLoading, isDisabled, name, noOptionsMessage, className, id, style, placeholder, ...rest }: MultiselectProps): React.JSX.Element;
|
|
3
|
+
export declare function Multiselect({ options, value, onChange, error, label, note, size, mode, theme: themeFromProps, placement, renderInTrigger, disableFlip, isSingleLine, boldLabel, reserveErrorLine, maxVisibleItems, isClearable, isLoading, isDisabled, name, noOptionsMessage, className, id, style, placeholder, ...rest }: MultiselectProps): React.JSX.Element;
|
package/lib/multiselect.js
CHANGED
|
@@ -69,6 +69,8 @@ function Multiselect(_ref) {
|
|
|
69
69
|
mode = 'classic',
|
|
70
70
|
theme: themeFromProps,
|
|
71
71
|
placement = 'bottom',
|
|
72
|
+
renderInTrigger = false,
|
|
73
|
+
disableFlip = false,
|
|
72
74
|
isSingleLine = false,
|
|
73
75
|
boldLabel = true,
|
|
74
76
|
reserveErrorLine = false,
|
|
@@ -261,6 +263,8 @@ function Multiselect(_ref) {
|
|
|
261
263
|
dropdownRef: dropdownRef,
|
|
262
264
|
triggerRef: triggerRef,
|
|
263
265
|
placement: placement,
|
|
266
|
+
renderInTrigger: renderInTrigger,
|
|
267
|
+
disableFlip: disableFlip,
|
|
264
268
|
isOpen: isOpen,
|
|
265
269
|
listBoxState: listBoxState,
|
|
266
270
|
maxVisibleItems: maxVisibleItems,
|
|
@@ -14,7 +14,9 @@ export type PopupContentProps = {
|
|
|
14
14
|
emptyListMessage: string;
|
|
15
15
|
maxVisibleItems?: number;
|
|
16
16
|
trigger?: DropdownProps['trigger'];
|
|
17
|
+
renderInTrigger?: boolean;
|
|
18
|
+
disableFlip?: boolean;
|
|
17
19
|
isOpen?: boolean;
|
|
18
20
|
dropdownUpdateDeps?: unknown[];
|
|
19
21
|
};
|
|
20
|
-
export declare const PopupContent: ({ theme, listBoxState, triggerRef, dropdownRef, listBoxItems, placement, size: sizeFromProps, mode, emptyListMessage, maxVisibleItems, trigger, isOpen, dropdownUpdateDeps }: PopupContentProps) => React.JSX.Element;
|
|
22
|
+
export declare const PopupContent: ({ theme, listBoxState, triggerRef, dropdownRef, listBoxItems, placement, size: sizeFromProps, mode, emptyListMessage, maxVisibleItems, trigger, renderInTrigger, disableFlip, isOpen, dropdownUpdateDeps }: PopupContentProps) => React.JSX.Element;
|
|
@@ -18,6 +18,8 @@ const PopupContent = _ref => {
|
|
|
18
18
|
emptyListMessage,
|
|
19
19
|
maxVisibleItems,
|
|
20
20
|
trigger,
|
|
21
|
+
renderInTrigger,
|
|
22
|
+
disableFlip,
|
|
21
23
|
isOpen,
|
|
22
24
|
dropdownUpdateDeps = []
|
|
23
25
|
} = _ref;
|
|
@@ -53,6 +55,8 @@ const PopupContent = _ref => {
|
|
|
53
55
|
isOpen: isOpen,
|
|
54
56
|
cancelCloseAnimation: true,
|
|
55
57
|
disableFocusLock: true,
|
|
58
|
+
renderInTrigger: renderInTrigger,
|
|
59
|
+
disableFlip: disableFlip,
|
|
56
60
|
trigger: trigger
|
|
57
61
|
}, /*#__PURE__*/React.createElement(ListBox, {
|
|
58
62
|
state: listBoxState,
|
package/lib/select-basic.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { InnerSingleComponentProps } from './types';
|
|
3
|
-
export declare function SelectBasic({ options, value: selectedItem, onChange, error, label, note, size, mode, theme, placement, boldLabel, reserveErrorLine, maxVisibleItems, isClearable, isLoading, isDisabled, name, noOptionsMessage, className, id, style, placeholder, ...rest }: InnerSingleComponentProps): React.JSX.Element;
|
|
3
|
+
export declare function SelectBasic({ options, value: selectedItem, onChange, error, label, note, size, mode, theme, placement, renderInTrigger, disableFlip, boldLabel, reserveErrorLine, maxVisibleItems, isClearable, isLoading, isDisabled, name, noOptionsMessage, className, id, style, placeholder, ...rest }: InnerSingleComponentProps): React.JSX.Element;
|
package/lib/select-basic.js
CHANGED
|
@@ -28,6 +28,8 @@ function SelectBasic(_ref) {
|
|
|
28
28
|
mode,
|
|
29
29
|
theme,
|
|
30
30
|
placement,
|
|
31
|
+
renderInTrigger,
|
|
32
|
+
disableFlip,
|
|
31
33
|
boldLabel,
|
|
32
34
|
reserveErrorLine,
|
|
33
35
|
maxVisibleItems,
|
|
@@ -167,6 +169,8 @@ function SelectBasic(_ref) {
|
|
|
167
169
|
maxVisibleItems: maxVisibleItems,
|
|
168
170
|
emptyListMessage: emptyListMessage,
|
|
169
171
|
listBoxItems: listBoxItems,
|
|
172
|
+
renderInTrigger: renderInTrigger,
|
|
173
|
+
disableFlip: disableFlip,
|
|
170
174
|
trigger: _ref3 => {
|
|
171
175
|
let {
|
|
172
176
|
ref: triggerRefForDropdown
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InnerSingleComponentProps } from './types';
|
|
3
|
-
export declare function SelectSearchable({ options, value: selectedItem, onChange, error, label, note, size, mode, theme, placement, boldLabel, reserveErrorLine, maxVisibleItems, isClearable, isLoading, isDisabled, name, noOptionsMessage, className, id, style, placeholder, ...rest }: InnerSingleComponentProps): React.JSX.Element;
|
|
3
|
+
export declare function SelectSearchable({ options, value: selectedItem, onChange, error, label, note, size, mode, theme, placement, renderInTrigger, disableFlip, boldLabel, reserveErrorLine, maxVisibleItems, isClearable, isLoading, isDisabled, name, noOptionsMessage, className, id, style, placeholder, ...rest }: InnerSingleComponentProps): React.JSX.Element;
|
package/lib/select-searchable.js
CHANGED
|
@@ -27,6 +27,8 @@ function SelectSearchable(_ref) {
|
|
|
27
27
|
mode,
|
|
28
28
|
theme,
|
|
29
29
|
placement,
|
|
30
|
+
renderInTrigger,
|
|
31
|
+
disableFlip,
|
|
30
32
|
boldLabel,
|
|
31
33
|
reserveErrorLine,
|
|
32
34
|
maxVisibleItems,
|
|
@@ -198,6 +200,8 @@ function SelectSearchable(_ref) {
|
|
|
198
200
|
dropdownRef: dropdownRef,
|
|
199
201
|
triggerRef: inputRef,
|
|
200
202
|
placement: placement,
|
|
203
|
+
renderInTrigger: renderInTrigger,
|
|
204
|
+
disableFlip: disableFlip,
|
|
201
205
|
isOpen: isOpen,
|
|
202
206
|
listBoxState: listBoxState,
|
|
203
207
|
maxVisibleItems: maxVisibleItems,
|
package/lib/select.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import type { SelectProps, SelectOption, SelectOptionOrGroup } from './types';
|
|
4
4
|
export declare const Select: {
|
|
5
|
-
({ options, size, mode, theme: themeFromProps, className, style, value, onChange, placeholder, isClearable, isLoading, isDisabled, isSearchable, noOptionsMessage, error, placement, boldLabel, reserveErrorLine, note, maxVisibleItems, id, ...restProps }: SelectProps): React.JSX.Element;
|
|
5
|
+
({ options, size, mode, theme: themeFromProps, className, style, value, onChange, placeholder, isClearable, isLoading, isDisabled, isSearchable, noOptionsMessage, error, placement, renderInTrigger, disableFlip, boldLabel, reserveErrorLine, note, maxVisibleItems, id, ...restProps }: SelectProps): React.JSX.Element;
|
|
6
6
|
propTypes: {
|
|
7
7
|
className: PropTypes.Requireable<string>;
|
|
8
8
|
style: PropTypes.Requireable<object>;
|
|
@@ -23,6 +23,8 @@ export declare const Select: {
|
|
|
23
23
|
note: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
24
24
|
noOptionsMessage: PropTypes.Validator<import("./types").NoOptionsMessage>;
|
|
25
25
|
placement: PropTypes.Requireable<string>;
|
|
26
|
+
renderInTrigger: PropTypes.Requireable<boolean>;
|
|
27
|
+
disableFlip: PropTypes.Requireable<boolean>;
|
|
26
28
|
name: PropTypes.Requireable<string>;
|
|
27
29
|
};
|
|
28
30
|
};
|
package/lib/select.js
CHANGED
|
@@ -40,6 +40,8 @@ const Select = _ref => {
|
|
|
40
40
|
noOptionsMessage,
|
|
41
41
|
error,
|
|
42
42
|
placement = 'bottom',
|
|
43
|
+
renderInTrigger = false,
|
|
44
|
+
disableFlip = false,
|
|
43
45
|
boldLabel = true,
|
|
44
46
|
reserveErrorLine = false,
|
|
45
47
|
note,
|
|
@@ -71,6 +73,8 @@ const Select = _ref => {
|
|
|
71
73
|
noOptionsMessage: noOptionsMessage,
|
|
72
74
|
error: error,
|
|
73
75
|
placement: placement,
|
|
76
|
+
renderInTrigger: renderInTrigger,
|
|
77
|
+
disableFlip: disableFlip,
|
|
74
78
|
boldLabel: boldLabel,
|
|
75
79
|
reserveErrorLine: reserveErrorLine,
|
|
76
80
|
note: note,
|
|
@@ -98,6 +102,8 @@ Select.propTypes = {
|
|
|
98
102
|
note: PropTypes.node,
|
|
99
103
|
noOptionsMessage: noOptionsMessageType,
|
|
100
104
|
placement: PropTypes.oneOf(['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']),
|
|
105
|
+
renderInTrigger: PropTypes.bool,
|
|
106
|
+
disableFlip: PropTypes.bool,
|
|
101
107
|
name: PropTypes.string
|
|
102
108
|
};
|
|
103
109
|
export { Select };
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
"themeLight": "
|
|
3
|
-
"themeDark": "
|
|
4
|
-
"sizeS": "
|
|
5
|
-
"sizeM": "
|
|
6
|
-
"sizeL": "
|
|
7
|
-
"classic": "
|
|
8
|
-
"rock": "
|
|
9
|
-
"root": "
|
|
10
|
-
"triggerContainer": "
|
|
11
|
-
"disabled": "
|
|
12
|
-
"trigger": "
|
|
13
|
-
"error": "
|
|
14
|
-
"enabled": "
|
|
15
|
-
"searchable": "
|
|
16
|
-
"canBeMultiline": "
|
|
17
|
-
"triggerText": "
|
|
18
|
-
"searchInput": "
|
|
19
|
-
"labelNotSelected": "
|
|
20
|
-
"multi": "
|
|
21
|
-
"tagsContainer": "
|
|
22
|
-
"tag": "
|
|
23
|
-
"filledTag": "
|
|
24
|
-
"iconsWrapper": "
|
|
25
|
-
"toggle": "
|
|
26
|
-
"icon": "
|
|
27
|
-
"clearIcon": "
|
|
28
|
-
"visuallyHidden": "
|
|
29
|
-
"select": "
|
|
30
|
-
"observable": "
|
|
2
|
+
"themeLight": "_themeLight_pw64y2_6",
|
|
3
|
+
"themeDark": "_themeDark_pw64y2_9",
|
|
4
|
+
"sizeS": "_sizeS_pw64y2_13",
|
|
5
|
+
"sizeM": "_sizeM_pw64y2_16",
|
|
6
|
+
"sizeL": "_sizeL_pw64y2_19",
|
|
7
|
+
"classic": "_classic_pw64y2_23",
|
|
8
|
+
"rock": "_rock_pw64y2_26",
|
|
9
|
+
"root": "_root_pw64y2_30",
|
|
10
|
+
"triggerContainer": "_triggerContainer_pw64y2_36",
|
|
11
|
+
"disabled": "_disabled_pw64y2_41",
|
|
12
|
+
"trigger": "_trigger_pw64y2_36",
|
|
13
|
+
"error": "_error_pw64y2_78",
|
|
14
|
+
"enabled": "_enabled_pw64y2_83",
|
|
15
|
+
"searchable": "_searchable_pw64y2_98",
|
|
16
|
+
"canBeMultiline": "_canBeMultiline_pw64y2_125",
|
|
17
|
+
"triggerText": "_triggerText_pw64y2_129",
|
|
18
|
+
"searchInput": "_searchInput_pw64y2_130",
|
|
19
|
+
"labelNotSelected": "_labelNotSelected_pw64y2_161",
|
|
20
|
+
"multi": "_multi_pw64y2_217",
|
|
21
|
+
"tagsContainer": "_tagsContainer_pw64y2_234",
|
|
22
|
+
"tag": "_tag_pw64y2_234",
|
|
23
|
+
"filledTag": "_filledTag_pw64y2_256",
|
|
24
|
+
"iconsWrapper": "_iconsWrapper_pw64y2_264",
|
|
25
|
+
"toggle": "_toggle_pw64y2_282",
|
|
26
|
+
"icon": "_icon_pw64y2_264",
|
|
27
|
+
"clearIcon": "_clearIcon_pw64y2_356",
|
|
28
|
+
"visuallyHidden": "_visuallyHidden_pw64y2_416",
|
|
29
|
+
"select": "_select_pw64y2_433",
|
|
30
|
+
"observable": "_observable_pw64y2_455"
|
|
31
31
|
};
|
|
32
32
|
export { styles as default };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
"themeLight": "
|
|
3
|
-
"themeDark": "
|
|
4
|
-
"sizeS": "
|
|
5
|
-
"sizeM": "
|
|
6
|
-
"sizeL": "
|
|
7
|
-
"main": "
|
|
8
|
-
"label": "
|
|
9
|
-
"disabled": "
|
|
10
|
-
"footer": "
|
|
11
|
-
"errorMessage": "
|
|
12
|
-
"error": "
|
|
13
|
-
"note": "
|
|
2
|
+
"themeLight": "_themeLight_1bpvhm_6",
|
|
3
|
+
"themeDark": "_themeDark_1bpvhm_9",
|
|
4
|
+
"sizeS": "_sizeS_1bpvhm_13",
|
|
5
|
+
"sizeM": "_sizeM_1bpvhm_16",
|
|
6
|
+
"sizeL": "_sizeL_1bpvhm_19",
|
|
7
|
+
"main": "_main_1bpvhm_23",
|
|
8
|
+
"label": "_label_1bpvhm_27",
|
|
9
|
+
"disabled": "_disabled_1bpvhm_33",
|
|
10
|
+
"footer": "_footer_1bpvhm_38",
|
|
11
|
+
"errorMessage": "_errorMessage_1bpvhm_45",
|
|
12
|
+
"error": "_error_1bpvhm_45",
|
|
13
|
+
"note": "_note_1bpvhm_54"
|
|
14
14
|
};
|
|
15
15
|
export { styles as default };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
"sizeS": "
|
|
3
|
-
"sizeM": "
|
|
4
|
-
"sizeL": "
|
|
5
|
-
"classic": "
|
|
6
|
-
"rock": "
|
|
7
|
-
"listBox": "
|
|
8
|
-
"item": "
|
|
9
|
-
"selected": "
|
|
10
|
-
"disabled": "
|
|
11
|
-
"checkIcon": "
|
|
12
|
-
"visible": "
|
|
13
|
-
"divider": "
|
|
14
|
-
"groupHeader": "
|
|
2
|
+
"sizeS": "_sizeS_fouuu0_6",
|
|
3
|
+
"sizeM": "_sizeM_fouuu0_9",
|
|
4
|
+
"sizeL": "_sizeL_fouuu0_12",
|
|
5
|
+
"classic": "_classic_fouuu0_16",
|
|
6
|
+
"rock": "_rock_fouuu0_19",
|
|
7
|
+
"listBox": "_listBox_fouuu0_23",
|
|
8
|
+
"item": "_item_fouuu0_39",
|
|
9
|
+
"selected": "_selected_fouuu0_77",
|
|
10
|
+
"disabled": "_disabled_fouuu0_91",
|
|
11
|
+
"checkIcon": "_checkIcon_fouuu0_98",
|
|
12
|
+
"visible": "_visible_fouuu0_105",
|
|
13
|
+
"divider": "_divider_fouuu0_112",
|
|
14
|
+
"groupHeader": "_groupHeader_fouuu0_126"
|
|
15
15
|
};
|
|
16
16
|
export { styles as default };
|
package/lib/types.d.ts
CHANGED
|
@@ -126,6 +126,14 @@ export type SelectProps = {
|
|
|
126
126
|
* Placement of dropdown element
|
|
127
127
|
*/
|
|
128
128
|
placement?: Placement;
|
|
129
|
+
/**
|
|
130
|
+
* Render dropdown inside trigger function or wrapper. May be useful when the trigger placed in the fixed layout or popovers.
|
|
131
|
+
* */
|
|
132
|
+
renderInTrigger?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Disable dropdown flip behavior. By default dropdown will flip its position if it's not fully visible.
|
|
135
|
+
* */
|
|
136
|
+
disableFlip?: boolean;
|
|
129
137
|
/**
|
|
130
138
|
* Note element at the bottom (use with forms)
|
|
131
139
|
*/
|
|
@@ -134,7 +134,7 @@ const MySelect = () => {
|
|
|
134
134
|
render(<MySelect />);
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
```postcss
|
|
137
|
+
```postcss attached
|
|
138
138
|
.select-with-contrast-primary {
|
|
139
139
|
--rs-select-contrast-primary: 1;
|
|
140
140
|
}
|
|
@@ -150,6 +150,68 @@ render(<MySelect />);
|
|
|
150
150
|
}
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
+
#### In the native dialog element
|
|
154
|
+
|
|
155
|
+
Because the [popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using) places the dialog element on the Top Layer, any value of `z-index` for the options list will be ignored.
|
|
156
|
+
|
|
157
|
+
To work around this, we can use the `renderInTrigger` prop to render the popover in the dialog element instead of the bottom of the `body`.
|
|
158
|
+
|
|
159
|
+
Also use `disableFlip` prop and `overflow: visible` css on the dialog if options will overflow it.
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
import { useState } from 'react';
|
|
163
|
+
import { Multiselect } from '@rescui/select';
|
|
164
|
+
|
|
165
|
+
const options = [
|
|
166
|
+
{ label: 'Blue', value: 'blue' },
|
|
167
|
+
{ label: 'Black', value: 'black' },
|
|
168
|
+
{ label: 'Red', value: 'red' },
|
|
169
|
+
{ label: 'Orange', value: 'orange' },
|
|
170
|
+
{ label: 'Yellow', value: 'yellow' },
|
|
171
|
+
{ label: 'White', value: 'white' }
|
|
172
|
+
];
|
|
173
|
+
|
|
174
|
+
const MySelect = () => {
|
|
175
|
+
const [selected, setSelected] = useState([options[1], options[5]]);
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<div style={{ maxWidth: '380px' }}>
|
|
179
|
+
<Multiselect
|
|
180
|
+
className="clazz"
|
|
181
|
+
options={options}
|
|
182
|
+
value={selected}
|
|
183
|
+
onChange={value => setSelected(value)}
|
|
184
|
+
isSingleLine
|
|
185
|
+
size="m"
|
|
186
|
+
placeholder="Select colors..."
|
|
187
|
+
aria-label="Select colors"
|
|
188
|
+
renderInTrigger
|
|
189
|
+
disableFlip
|
|
190
|
+
/>
|
|
191
|
+
</div>
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
render(
|
|
196
|
+
<>
|
|
197
|
+
<button command="show-modal" commandfor="my-dialog">
|
|
198
|
+
Open dialog
|
|
199
|
+
</button>
|
|
200
|
+
|
|
201
|
+
<dialog id="my-dialog" style={{ width: 500, overflow: 'visible' }}>
|
|
202
|
+
<div>
|
|
203
|
+
<button commandfor="my-dialog" command="close">
|
|
204
|
+
Close
|
|
205
|
+
</button>
|
|
206
|
+
</div>
|
|
207
|
+
<div style={{ marginTop: 12 }}>
|
|
208
|
+
<MySelect />
|
|
209
|
+
</div>
|
|
210
|
+
</dialog>
|
|
211
|
+
</>
|
|
212
|
+
);
|
|
213
|
+
```
|
|
214
|
+
|
|
153
215
|
## CSS Mixins API
|
|
154
216
|
|
|
155
217
|
#### `Multiselect` mixins
|
|
@@ -162,9 +224,7 @@ render(<MySelect />);
|
|
|
162
224
|
|
|
163
225
|
#### Demo
|
|
164
226
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
You can use `@media` queries instead of `@container` queries:
|
|
227
|
+
Use the controls to see the effect at different viewport widths.
|
|
168
228
|
|
|
169
229
|
```tsx
|
|
170
230
|
import { useState } from 'react';
|
|
@@ -183,7 +243,7 @@ const MyMultiselect = ({ className }) => {
|
|
|
183
243
|
const [selected, setSelected] = useState([options[0], options[5]]);
|
|
184
244
|
|
|
185
245
|
return (
|
|
186
|
-
<div style={{ maxWidth:
|
|
246
|
+
<div style={{ maxWidth: 380, height: 380 }}>
|
|
187
247
|
<Multiselect
|
|
188
248
|
options={options}
|
|
189
249
|
value={selected}
|
|
@@ -197,32 +257,17 @@ const MyMultiselect = ({ className }) => {
|
|
|
197
257
|
);
|
|
198
258
|
};
|
|
199
259
|
|
|
200
|
-
render(
|
|
201
|
-
<div className="preview-container">
|
|
202
|
-
<p style={{ position: 'absolute', right: 12, bottom: 12 }}>Resize me</p>
|
|
203
|
-
<MyMultiselect className="my-multiselect" />
|
|
204
|
-
</div>
|
|
205
|
-
);
|
|
260
|
+
render(<MyMultiselect className="my-multiselect" />);
|
|
206
261
|
```
|
|
207
262
|
|
|
208
263
|
```postcss
|
|
209
264
|
@import '@rescui/select/lib/public-api.p.css';
|
|
210
265
|
|
|
211
|
-
.preview-container {
|
|
212
|
-
position: relative;
|
|
213
|
-
container-type: inline-size;
|
|
214
|
-
resize: horizontal;
|
|
215
|
-
overflow: auto;
|
|
216
|
-
padding: 12px;
|
|
217
|
-
background-color: var(--rs-color-black-t5);
|
|
218
|
-
max-width: 800px;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
266
|
.my-multiselect {
|
|
222
|
-
@
|
|
267
|
+
@media (max-width: 640px) {
|
|
223
268
|
@mixin rs-multiselect-size-l;
|
|
224
269
|
}
|
|
225
|
-
@
|
|
270
|
+
@media (max-width: 500px) {
|
|
226
271
|
@mixin rs-multiselect-size-s;
|
|
227
272
|
}
|
|
228
273
|
}
|
package/llm/components/select.md
CHANGED
|
@@ -290,7 +290,7 @@ const MySelect = () => {
|
|
|
290
290
|
render(<MySelect />);
|
|
291
291
|
```
|
|
292
292
|
|
|
293
|
-
```postcss
|
|
293
|
+
```postcss attached
|
|
294
294
|
.select-with-contrast-primary {
|
|
295
295
|
--rs-select-contrast-primary: 1;
|
|
296
296
|
}
|
|
@@ -306,6 +306,63 @@ render(<MySelect />);
|
|
|
306
306
|
}
|
|
307
307
|
```
|
|
308
308
|
|
|
309
|
+
#### In the native dialog element
|
|
310
|
+
|
|
311
|
+
Because the [popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using) places the dialog element on the Top Layer, any value of `z-index` for the options list will be ignored.
|
|
312
|
+
|
|
313
|
+
To work around this, we can use the `renderInTrigger` prop to render the popover in the dialog element instead of the bottom of the `body`.
|
|
314
|
+
|
|
315
|
+
Also use `disableFlip` prop and `overflow: visible` css on the dialog if options will overflow it.
|
|
316
|
+
|
|
317
|
+
```tsx
|
|
318
|
+
import { useState } from 'react';
|
|
319
|
+
import { Select } from '@rescui/select';
|
|
320
|
+
|
|
321
|
+
const options = [
|
|
322
|
+
{ label: 'Light', value: 'light' },
|
|
323
|
+
{ label: 'Regular', value: 'regular' },
|
|
324
|
+
{ label: 'Medium', value: 'medium' },
|
|
325
|
+
{ label: 'Bold', value: 'bold' }
|
|
326
|
+
];
|
|
327
|
+
|
|
328
|
+
const MySelect = () => {
|
|
329
|
+
const [selected, setSelected] = useState(options[2]);
|
|
330
|
+
|
|
331
|
+
return (
|
|
332
|
+
<Select
|
|
333
|
+
options={options}
|
|
334
|
+
value={selected}
|
|
335
|
+
onChange={value => setSelected(value)}
|
|
336
|
+
size="m"
|
|
337
|
+
placeholder="Select font weight..."
|
|
338
|
+
aria-label="Select font weight"
|
|
339
|
+
placement="bottom"
|
|
340
|
+
renderInTrigger
|
|
341
|
+
disableFlip
|
|
342
|
+
/>
|
|
343
|
+
);
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
render(
|
|
347
|
+
<>
|
|
348
|
+
<button command="show-modal" commandfor="my-dialog">
|
|
349
|
+
Open dialog
|
|
350
|
+
</button>
|
|
351
|
+
|
|
352
|
+
<dialog id="my-dialog" style={{ width: 500, overflow: 'visible' }}>
|
|
353
|
+
<div>
|
|
354
|
+
<button commandfor="my-dialog" command="close">
|
|
355
|
+
Close
|
|
356
|
+
</button>
|
|
357
|
+
</div>
|
|
358
|
+
<div style={{ marginTop: 12 }}>
|
|
359
|
+
<MySelect />
|
|
360
|
+
</div>
|
|
361
|
+
</dialog>
|
|
362
|
+
</>
|
|
363
|
+
);
|
|
364
|
+
```
|
|
365
|
+
|
|
309
366
|
## Native
|
|
310
367
|
|
|
311
368
|
### Features showcase
|
|
@@ -398,9 +455,7 @@ render(<MySelect />);
|
|
|
398
455
|
|
|
399
456
|
##### Demo
|
|
400
457
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
You can use `@media` queries instead of `@container` queries:
|
|
458
|
+
Use the controls to see the effect at different viewport widths.
|
|
404
459
|
|
|
405
460
|
```tsx
|
|
406
461
|
import { useState } from 'react';
|
|
@@ -419,7 +474,7 @@ const MySelect = ({ className }) => {
|
|
|
419
474
|
const [selected, setSelected] = useState(options[0]);
|
|
420
475
|
|
|
421
476
|
return (
|
|
422
|
-
<div style={{ maxWidth:
|
|
477
|
+
<div style={{ maxWidth: 380, height: 380 }}>
|
|
423
478
|
<Select
|
|
424
479
|
options={options}
|
|
425
480
|
value={selected}
|
|
@@ -433,32 +488,17 @@ const MySelect = ({ className }) => {
|
|
|
433
488
|
);
|
|
434
489
|
};
|
|
435
490
|
|
|
436
|
-
render(
|
|
437
|
-
<div className="select-preview-container">
|
|
438
|
-
<p style={{ position: 'absolute', right: 12, bottom: 12 }}>Resize me</p>
|
|
439
|
-
<MySelect className="my-select" />
|
|
440
|
-
</div>
|
|
441
|
-
);
|
|
491
|
+
render(<MySelect className="my-select" />);
|
|
442
492
|
```
|
|
443
493
|
|
|
444
494
|
```postcss attached
|
|
445
495
|
@import '@rescui/select/lib/public-api.p.css';
|
|
446
496
|
|
|
447
|
-
.select-preview-container {
|
|
448
|
-
position: relative;
|
|
449
|
-
container-type: inline-size;
|
|
450
|
-
resize: horizontal;
|
|
451
|
-
overflow: auto;
|
|
452
|
-
padding: 12px;
|
|
453
|
-
background-color: var(--rs-color-black-t5);
|
|
454
|
-
max-width: 800px;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
497
|
.my-select {
|
|
458
|
-
@
|
|
498
|
+
@media (max-width: 640px) {
|
|
459
499
|
@mixin rs-select-size-l;
|
|
460
500
|
}
|
|
461
|
-
@
|
|
501
|
+
@media (max-width: 500px) {
|
|
462
502
|
@mixin rs-select-size-s;
|
|
463
503
|
}
|
|
464
504
|
}
|
|
@@ -482,9 +522,7 @@ Check out [this example](/components/select/#contrast-primary-color) for contras
|
|
|
482
522
|
|
|
483
523
|
##### Demo
|
|
484
524
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
You can use `@media` queries instead of `@container` queries:
|
|
525
|
+
Use the controls to see the effect at different viewport widths.
|
|
488
526
|
|
|
489
527
|
```tsx
|
|
490
528
|
import { useState } from 'react';
|
|
@@ -503,7 +541,7 @@ const MyNativeSelect = ({ className }) => {
|
|
|
503
541
|
const [selected, setSelected] = useState(options[0]);
|
|
504
542
|
|
|
505
543
|
return (
|
|
506
|
-
<div style={{ maxWidth:
|
|
544
|
+
<div style={{ maxWidth: 380, height: 380 }}>
|
|
507
545
|
<NativeSelect
|
|
508
546
|
options={options}
|
|
509
547
|
value={selected}
|
|
@@ -517,32 +555,17 @@ const MyNativeSelect = ({ className }) => {
|
|
|
517
555
|
);
|
|
518
556
|
};
|
|
519
557
|
|
|
520
|
-
render(
|
|
521
|
-
<div className="native-select-preview-container">
|
|
522
|
-
<p style={{ position: 'absolute', right: 12, bottom: 12 }}>Resize me</p>
|
|
523
|
-
<MyNativeSelect className="my-native-select" />
|
|
524
|
-
</div>
|
|
525
|
-
);
|
|
558
|
+
render(<MyNativeSelect className="my-native-select" />);
|
|
526
559
|
```
|
|
527
560
|
|
|
528
561
|
```postcss
|
|
529
562
|
@import '@rescui/select/lib/public-api.p.css';
|
|
530
563
|
|
|
531
|
-
.native-select-preview-container {
|
|
532
|
-
position: relative;
|
|
533
|
-
container-type: inline-size;
|
|
534
|
-
resize: horizontal;
|
|
535
|
-
overflow: auto;
|
|
536
|
-
padding: 12px;
|
|
537
|
-
background-color: var(--rs-color-black-t5);
|
|
538
|
-
max-width: 800px;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
564
|
.my-native-select {
|
|
542
|
-
@
|
|
565
|
+
@media (max-width: 640px) {
|
|
543
566
|
@mixin rs-native-select-size-l;
|
|
544
567
|
}
|
|
545
|
-
@
|
|
568
|
+
@media (max-width: 500px) {
|
|
546
569
|
@mixin rs-native-select-size-s;
|
|
547
570
|
}
|
|
548
571
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rescui/select",
|
|
3
|
-
"version": "0.17.1-RUI-293-Update-menu-component-
|
|
3
|
+
"version": "0.17.1-RUI-293-Update-menu-component-hover-icon-d8a5b0551.33+d8a5b0551",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "JetBrains",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime-corejs3": "^7.26.0",
|
|
20
|
-
"@rescui/dropdown": "0.10.1-RUI-293-Update-menu-component-
|
|
21
|
-
"@rescui/form-field": "0.1.4-RUI-293-Update-menu-component-
|
|
22
|
-
"@rescui/tag": "0.13.9-RUI-293-Update-menu-component-
|
|
23
|
-
"@rescui/use-resize-observer": "0.3.1-RUI-293-Update-menu-component-
|
|
20
|
+
"@rescui/dropdown": "0.10.1-RUI-293-Update-menu-component-hover-icon-d8a5b0551.33+d8a5b0551",
|
|
21
|
+
"@rescui/form-field": "0.1.4-RUI-293-Update-menu-component-hover-icon-d8a5b0551.33+d8a5b0551",
|
|
22
|
+
"@rescui/tag": "0.13.9-RUI-293-Update-menu-component-hover-icon-d8a5b0551.33+d8a5b0551",
|
|
23
|
+
"@rescui/use-resize-observer": "0.3.1-RUI-293-Update-menu-component-hover-icon-d8a5b0551.180+d8a5b0551",
|
|
24
24
|
"classnames": "^2.2.6",
|
|
25
25
|
"downshift": "^9.3.2",
|
|
26
26
|
"scroll-into-view-if-needed": "3.1.0"
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"react": ">=16.8.0 <20"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@rescui/colors": "0.3.1-RUI-293-Update-menu-component-
|
|
34
|
+
"@rescui/colors": "0.3.1-RUI-293-Update-menu-component-hover-icon-d8a5b0551.68+d8a5b0551",
|
|
35
35
|
"@rescui/scripts": "0.5.2",
|
|
36
|
-
"@rescui/typography": "0.27.1-RUI-293-Update-menu-component-
|
|
36
|
+
"@rescui/typography": "0.27.1-RUI-293-Update-menu-component-hover-icon-d8a5b0551.33+d8a5b0551",
|
|
37
37
|
"@rescui/visual-regression": "0.1.4",
|
|
38
38
|
"sniffr": "^1.2.0"
|
|
39
39
|
},
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
|
|
43
43
|
},
|
|
44
44
|
"nx": {},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "d8a5b055167d8b1ea55c32621655b8e0acc98a1a"
|
|
46
46
|
}
|