@rescui/select 0.15.1-RUI-280-Update-select-component-downshift-2f40ef205.67 → 0.15.2
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/common-prop-types.d.ts +14 -9
- package/lib/common-prop-types.js +3 -4
- package/lib/index.css +432 -808
- package/lib/index.d.ts +6 -4
- package/lib/index.js +3 -3
- package/lib/key-codes.d.ts +7 -0
- package/lib/key-codes.js +8 -0
- package/lib/parts/common-select.p.module.css.js +15 -0
- package/lib/parts/foldable.js +2 -1
- package/lib/parts/form-trigger-wrapper.d.ts +7 -7
- package/lib/parts/form-trigger-wrapper.js +34 -16
- package/lib/parts/form-trigger.p.module.css.js +15 -0
- package/lib/parts/multiselect.d.ts +86 -0
- package/lib/parts/multiselect.js +455 -0
- package/lib/parts/native-select.d.ts +36 -0
- package/lib/parts/native-select.js +255 -0
- package/lib/parts/native-select.p.module.css.js +9 -0
- package/lib/parts/throttle.d.ts +1 -0
- package/lib/parts/trigger.d.ts +37 -0
- package/lib/parts/trigger.js +255 -0
- package/lib/parts/trigger.p.module.css.js +31 -0
- package/lib/parts/use-observable-force-rerender.d.ts +2 -0
- package/lib/parts/use-observable-force-rerender.js +16 -0
- package/lib/public-api.p.css +309 -545
- package/lib/public-api.pcss +309 -545
- package/lib/select.d.ts +91 -27
- package/lib/select.js +351 -51
- package/lib/types.d.ts +4 -167
- package/lib/utils.d.ts +22 -0
- package/lib/utils.js +199 -0
- package/package.json +12 -12
- package/lib/constants.d.ts +0 -6
- package/lib/constants.js +0 -7
- package/lib/hooks/use-a11y.d.ts +0 -29
- package/lib/hooks/use-a11y.js +0 -53
- package/lib/hooks/use-focus.d.ts +0 -10
- package/lib/hooks/use-focus.js +0 -17
- package/lib/hooks/use-hover.d.ts +0 -10
- package/lib/hooks/use-hover.js +0 -17
- package/lib/hooks/use-label-focus.d.ts +0 -9
- package/lib/hooks/use-label-focus.js +0 -22
- package/lib/hooks/use-multi-handlers.d.ts +0 -11
- package/lib/hooks/use-multi-handlers.js +0 -48
- package/lib/hooks/use-options.d.ts +0 -13
- package/lib/hooks/use-options.js +0 -89
- package/lib/multiselect.d.ts +0 -3
- package/lib/multiselect.js +0 -312
- package/lib/native-select.d.ts +0 -4
- package/lib/native-select.js +0 -211
- package/lib/parts/hidden-select.d.ts +0 -13
- package/lib/parts/hidden-select.js +0 -45
- package/lib/parts/icons.d.ts +0 -17
- package/lib/parts/icons.js +0 -69
- package/lib/parts/list-box.d.ts +0 -11
- package/lib/parts/list-box.js +0 -116
- package/lib/parts/multi-trigger.d.ts +0 -12
- package/lib/parts/multi-trigger.js +0 -74
- package/lib/parts/native-select-options-with-groups.d.ts +0 -8
- package/lib/parts/native-select-options-with-groups.js +0 -76
- package/lib/select-basic.d.ts +0 -3
- package/lib/select-basic.js +0 -203
- package/lib/select-searchable.d.ts +0 -3
- package/lib/select-searchable.js +0 -250
- package/lib/styles/common.p.module.css.js +0 -31
- package/lib/styles/form-trigger.p.module.css.js +0 -15
- package/lib/styles/list-box.p.module.css.js +0 -14
- package/lib/utils/calculate-max-height-by-items.d.ts +0 -13
- package/lib/utils/calculate-max-height-by-items.js +0 -22
- package/lib/utils/get-empty-message.d.ts +0 -6
- package/lib/utils/get-empty-message.js +0 -32
- package/lib/utils/get-option-value.d.ts +0 -2
- package/lib/utils/get-option-value.js +0 -11
- package/lib/utils/get-real-items-cnt.d.ts +0 -2
- package/lib/utils/get-real-items-cnt.js +0 -19
- package/lib/utils/get-text-from-nodes.d.ts +0 -2
- package/lib/utils/get-text-from-nodes.js +0 -28
- package/lib/utils/is-option-a-group.d.ts +0 -2
- package/lib/utils/is-option-a-group.js +0 -5
- package/lib/utils/item-to-string.d.ts +0 -2
- package/lib/utils/item-to-string.js +0 -7
- package/lib/utils/merge-props.d.ts +0 -29
- package/lib/utils/merge-props.js +0 -106
- package/lib/utils/throttle.d.ts +0 -1
- /package/lib/{utils → parts}/throttle.js +0 -0
- /package/lib/{hooks → parts}/use-backward-compatible-id.d.ts +0 -0
- /package/lib/{hooks → parts}/use-backward-compatible-id.js +0 -0
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { Select } from './select';
|
|
2
|
-
export {
|
|
3
|
-
export { NativeSelect } from './native-select';
|
|
4
|
-
export type {
|
|
1
|
+
export { default as Select } from './select';
|
|
2
|
+
export type { SelectProps } from './select';
|
|
3
|
+
export { default as NativeSelect } from './parts/native-select';
|
|
4
|
+
export type { NativeSelectProps } from './parts/native-select';
|
|
5
|
+
export { default as Multiselect } from './parts/multiselect';
|
|
6
|
+
export type { MultiselectProps } from './parts/multiselect';
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import './index.css';
|
|
2
|
-
export { Select } from './select.js';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
2
|
+
export { default as Select } from './select.js';
|
|
3
|
+
export { default as NativeSelect } from './parts/native-select.js';
|
|
4
|
+
export { default as Multiselect } from './parts/multiselect.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const ARROW_UP = "ArrowUp";
|
|
2
|
+
export declare const ARROW_DOWN = "ArrowDown";
|
|
3
|
+
export declare const SPACE = " ";
|
|
4
|
+
export declare const ESCAPE = "Escape";
|
|
5
|
+
export declare const ENTER = "Enter";
|
|
6
|
+
export declare const TAB = "Tab";
|
|
7
|
+
export declare const BACKSPACE = "Backspace";
|
package/lib/key-codes.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var styles = {
|
|
2
|
+
"sizeS": "_sizeS_1kt3z5d_3",
|
|
3
|
+
"sizeM": "_sizeM_1kt3z5d_6",
|
|
4
|
+
"sizeL": "_sizeL_1kt3z5d_9",
|
|
5
|
+
"menu": "_menu_1kt3z5d_13",
|
|
6
|
+
"menuSizeS": "_menuSizeS_1kt3z5d_26",
|
|
7
|
+
"menuSizeM": "_menuSizeM_1kt3z5d_30",
|
|
8
|
+
"menuSizeL": "_menuSizeL_1kt3z5d_34",
|
|
9
|
+
"withGroupsLabel": "_withGroupsLabel_1kt3z5d_40",
|
|
10
|
+
"lastOption": "_lastOption_1kt3z5d_39",
|
|
11
|
+
"divider": "_divider_1kt3z5d_45",
|
|
12
|
+
"checkIcon": "_checkIcon_1kt3z5d_51",
|
|
13
|
+
"observable": "_observable_1kt3z5d_56"
|
|
14
|
+
};
|
|
15
|
+
export { styles as default };
|
package/lib/parts/foldable.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import React, { Component } from 'react';
|
|
2
|
-
import { throttle } from '
|
|
3
|
+
import { throttle } from './throttle.js';
|
|
3
4
|
|
|
4
5
|
function lastVisibleIndex(lens, maxLen, gap) {
|
|
5
6
|
let extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
@@ -5,29 +5,29 @@ export declare type FormTriggerWrapperProps = {
|
|
|
5
5
|
size?: SelectSize;
|
|
6
6
|
theme?: Theme;
|
|
7
7
|
className?: string;
|
|
8
|
+
id?: string;
|
|
8
9
|
disabled?: boolean;
|
|
10
|
+
errorId?: string;
|
|
9
11
|
error?: boolean | React.ReactNode;
|
|
10
12
|
reserveErrorLine?: boolean;
|
|
11
|
-
errorMessageProps?: object;
|
|
12
13
|
label?: React.ReactNode;
|
|
13
|
-
labelProps?: object;
|
|
14
14
|
note?: React.ReactNode;
|
|
15
|
-
|
|
15
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
16
16
|
boldLabel?: boolean;
|
|
17
17
|
children?: React.ReactNode;
|
|
18
18
|
} & React.HTMLAttributes<HTMLDivElement>;
|
|
19
|
-
|
|
19
|
+
declare const FormTriggerWrapper: React.ForwardRefExoticComponent<{
|
|
20
20
|
size?: SelectSize;
|
|
21
21
|
theme?: Theme;
|
|
22
22
|
className?: string;
|
|
23
|
+
id?: string;
|
|
23
24
|
disabled?: boolean;
|
|
25
|
+
errorId?: string;
|
|
24
26
|
error?: boolean | React.ReactNode;
|
|
25
27
|
reserveErrorLine?: boolean;
|
|
26
|
-
errorMessageProps?: object;
|
|
27
28
|
label?: React.ReactNode;
|
|
28
|
-
labelProps?: object;
|
|
29
29
|
note?: React.ReactNode;
|
|
30
|
-
|
|
30
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
31
31
|
boldLabel?: boolean;
|
|
32
32
|
children?: React.ReactNode;
|
|
33
33
|
} & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import cn from 'classnames';
|
|
3
4
|
import { useThemeWithUndefined } from '@rescui/ui-contexts';
|
|
4
5
|
import { shouldRenderErrorMessage, ErrorMessage } from '@rescui/form-field';
|
|
5
|
-
import styles from '
|
|
6
|
+
import styles from './form-trigger.p.module.css.js';
|
|
6
7
|
const SIZE_STYLES = {
|
|
7
8
|
l: styles.sizeL,
|
|
8
9
|
m: styles.sizeM,
|
|
@@ -12,47 +13,64 @@ const THEME_STYLES = {
|
|
|
12
13
|
light: styles.themeLight,
|
|
13
14
|
dark: styles.themeDark
|
|
14
15
|
};
|
|
16
|
+
|
|
17
|
+
const Label = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
children,
|
|
20
|
+
boldLabel
|
|
21
|
+
} = _ref;
|
|
22
|
+
|
|
23
|
+
if (!children) {
|
|
24
|
+
return null;
|
|
25
|
+
} else {
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: styles.label,
|
|
28
|
+
"data-rs-internal": boldLabel ? 'select-form-trigger-wrapper__bold-label' : 'select-form-trigger-wrapper__label'
|
|
29
|
+
}, children);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
15
33
|
const FormTriggerWrapper = /*#__PURE__*/React.forwardRef( // eslint-disable-next-line complexity
|
|
16
|
-
(
|
|
34
|
+
(_ref2, ref) => {
|
|
17
35
|
let {
|
|
18
36
|
size,
|
|
19
37
|
theme: themeFromProps,
|
|
20
38
|
className,
|
|
39
|
+
id,
|
|
21
40
|
disabled,
|
|
22
41
|
error,
|
|
42
|
+
errorId,
|
|
23
43
|
reserveErrorLine = false,
|
|
24
|
-
errorMessageProps,
|
|
25
44
|
label,
|
|
26
|
-
labelProps,
|
|
27
45
|
note,
|
|
28
|
-
descriptionProps,
|
|
29
46
|
children,
|
|
47
|
+
onKeyDown,
|
|
30
48
|
boldLabel,
|
|
31
49
|
...restProps
|
|
32
|
-
} =
|
|
50
|
+
} = _ref2;
|
|
33
51
|
const theme = useThemeWithUndefined(themeFromProps);
|
|
34
52
|
const hasFooter = Boolean(note) || shouldRenderErrorMessage(error, reserveErrorLine);
|
|
35
53
|
return /*#__PURE__*/React.createElement("div", {
|
|
36
54
|
className: cn(className, styles.main, SIZE_STYLES[size], THEME_STYLES[theme], Boolean(error) && styles.error, disabled && styles.disabled),
|
|
55
|
+
id: id,
|
|
37
56
|
ref: ref,
|
|
38
57
|
"data-test": "select-wrapper",
|
|
39
58
|
"data-rs-internal": 'select-form-trigger-wrapper',
|
|
40
59
|
...restProps
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
60
|
+
}, /*#__PURE__*/React.createElement(Label, {
|
|
61
|
+
boldLabel: boldLabel
|
|
62
|
+
}, label), /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
onKeyDown: onKeyDown
|
|
64
|
+
}, children), hasFooter && /*#__PURE__*/React.createElement("div", {
|
|
46
65
|
className: styles.footer
|
|
47
66
|
}, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
67
|
+
id: errorId,
|
|
48
68
|
className: styles.errorMessage,
|
|
49
|
-
reserveLine: reserveErrorLine
|
|
50
|
-
...errorMessageProps
|
|
69
|
+
reserveLine: reserveErrorLine
|
|
51
70
|
}, error), note && /*#__PURE__*/React.createElement("div", {
|
|
52
71
|
className: styles.note,
|
|
53
|
-
"data-rs-internal": 'select-form-trigger-wrapper__note'
|
|
54
|
-
...descriptionProps
|
|
72
|
+
"data-rs-internal": 'select-form-trigger-wrapper__note'
|
|
55
73
|
}, note)));
|
|
56
74
|
});
|
|
57
75
|
FormTriggerWrapper.displayName = 'FormTriggerWrapper';
|
|
58
|
-
export { FormTriggerWrapper
|
|
76
|
+
export { FormTriggerWrapper as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var styles = {
|
|
2
|
+
"themeLight": "_themeLight_1bgbtrf_6",
|
|
3
|
+
"themeDark": "_themeDark_1bgbtrf_9",
|
|
4
|
+
"sizeS": "_sizeS_1bgbtrf_13",
|
|
5
|
+
"sizeM": "_sizeM_1bgbtrf_16",
|
|
6
|
+
"sizeL": "_sizeL_1bgbtrf_19",
|
|
7
|
+
"main": "_main_1bgbtrf_23",
|
|
8
|
+
"label": "_label_1bgbtrf_27",
|
|
9
|
+
"disabled": "_disabled_1bgbtrf_33",
|
|
10
|
+
"footer": "_footer_1bgbtrf_38",
|
|
11
|
+
"errorMessage": "_errorMessage_1bgbtrf_45",
|
|
12
|
+
"error": "_error_1bgbtrf_45",
|
|
13
|
+
"note": "_note_1bgbtrf_54"
|
|
14
|
+
};
|
|
15
|
+
export { styles as default };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@rescui/ui-contexts';
|
|
3
|
+
import { SelectOptionOrGroup, SelectOption, SelectSize, SelectMode, NoOptionsMessage } from '../types';
|
|
4
|
+
export interface MultiselectProps {
|
|
5
|
+
/**
|
|
6
|
+
* Additional class name
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Array of options
|
|
12
|
+
*/
|
|
13
|
+
options: SelectOptionOrGroup[];
|
|
14
|
+
/**
|
|
15
|
+
* Is Multiselect preserve single string
|
|
16
|
+
*/
|
|
17
|
+
isSingleLine?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Is Multiselect supports clear the value
|
|
20
|
+
*/
|
|
21
|
+
isClearable?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Is Multiselect has been disabled
|
|
24
|
+
*/
|
|
25
|
+
isDisabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Is loader displayed inside select
|
|
28
|
+
*/
|
|
29
|
+
isLoading?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* A hint to the user of what can be entered in the control
|
|
32
|
+
*/
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Size
|
|
36
|
+
*/
|
|
37
|
+
size?: SelectSize;
|
|
38
|
+
/**
|
|
39
|
+
* Appearance mode
|
|
40
|
+
*/
|
|
41
|
+
mode?: SelectMode;
|
|
42
|
+
/**
|
|
43
|
+
* Appearance theme
|
|
44
|
+
*/
|
|
45
|
+
theme?: Theme;
|
|
46
|
+
/**
|
|
47
|
+
* Value of the select
|
|
48
|
+
*/
|
|
49
|
+
value: SelectOption[];
|
|
50
|
+
/**
|
|
51
|
+
* Change value callback. `value => ...`
|
|
52
|
+
*/
|
|
53
|
+
onChange?: (newValue: SelectOption[]) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Error state flag or React.ReactNode (use with forms)
|
|
56
|
+
*/
|
|
57
|
+
error?: boolean | React.ReactNode;
|
|
58
|
+
/**
|
|
59
|
+
* If `true`, there will be reserved a space for a 1-line error message. Subsequent lines will be placed below normally.
|
|
60
|
+
* If `false`, there will be no reservation.
|
|
61
|
+
*/
|
|
62
|
+
reserveErrorLine?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Label element upper then Multiselect element (use with forms)
|
|
65
|
+
*/
|
|
66
|
+
label?: React.ReactNode;
|
|
67
|
+
/**
|
|
68
|
+
* Placement of dropdown element
|
|
69
|
+
*/
|
|
70
|
+
placement?: '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';
|
|
71
|
+
/**
|
|
72
|
+
* Note element below then Multiselect element (use with forms)
|
|
73
|
+
*/
|
|
74
|
+
note?: React.ReactNode;
|
|
75
|
+
/**
|
|
76
|
+
* Text to display when there are no options
|
|
77
|
+
*/
|
|
78
|
+
noOptionsMessage?: NoOptionsMessage;
|
|
79
|
+
/**
|
|
80
|
+
* Input name attribute
|
|
81
|
+
*/
|
|
82
|
+
name?: string;
|
|
83
|
+
boldLabel?: boolean;
|
|
84
|
+
}
|
|
85
|
+
declare const Multiselect: React.FC<MultiselectProps>;
|
|
86
|
+
export default Multiselect;
|