baseui 11.0.1 → 11.1.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/a11y/index.d.ts +1 -1
- package/accordion/index.d.ts +25 -28
- package/app-nav-bar/app-nav-bar.js +33 -40
- package/app-nav-bar/app-nav-bar.js.flow +46 -62
- package/app-nav-bar/index.d.ts +9 -8
- package/app-nav-bar/styled-components.js +49 -29
- package/app-nav-bar/styled-components.js.flow +25 -8
- package/app-nav-bar/types.js.flow +2 -0
- package/aspect-ratio-box/index.d.ts +2 -4
- package/avatar/index.d.ts +6 -12
- package/badge/badge.js +109 -0
- package/badge/badge.js.flow +91 -0
- package/badge/constants.js +54 -0
- package/badge/constants.js.flow +52 -0
- package/badge/hint-dot.js +96 -0
- package/badge/hint-dot.js.flow +68 -0
- package/badge/index.d.ts +97 -0
- package/badge/index.js +80 -0
- package/badge/index.js.flow +20 -0
- package/badge/notification-circle.js +103 -0
- package/badge/notification-circle.js.flow +81 -0
- package/badge/package.json +4 -0
- package/badge/styled-components.js +242 -0
- package/badge/styled-components.js.flow +325 -0
- package/badge/types.js +11 -0
- package/badge/types.js.flow +59 -0
- package/badge/utils.js +33 -0
- package/badge/utils.js.flow +23 -0
- package/banner/banner.js +283 -0
- package/banner/banner.js.flow +253 -0
- package/banner/constants.js +35 -0
- package/banner/constants.js.flow +33 -0
- package/banner/index.d.ts +75 -0
- package/banner/index.js +44 -0
- package/banner/index.js.flow +16 -0
- package/banner/package.json +4 -0
- package/banner/styled-components.js +131 -0
- package/banner/styled-components.js.flow +119 -0
- package/banner/types.js +11 -0
- package/banner/types.js.flow +66 -0
- package/block/index.d.ts +4 -4
- package/breadcrumbs/breadcrumbs.js +5 -1
- package/breadcrumbs/breadcrumbs.js.flow +2 -2
- package/breadcrumbs/index.d.ts +5 -5
- package/button/button.js +2 -1
- package/button/button.js.flow +1 -0
- package/button/index.d.ts +19 -29
- package/button-group/index.d.ts +18 -24
- package/card/index.d.ts +16 -14
- package/checkbox/index.d.ts +17 -21
- package/combobox/index.d.ts +7 -11
- package/data-table/index.d.ts +7 -10
- package/datepicker/calendar.js +16 -11
- package/datepicker/calendar.js.flow +12 -9
- package/datepicker/datepicker.js +58 -58
- package/datepicker/datepicker.js.flow +51 -34
- package/datepicker/index.d.ts +42 -63
- package/datepicker/stateful-calendar.js +6 -1
- package/datepicker/stateful-calendar.js.flow +8 -1
- package/datepicker/stateful-container.js +23 -2
- package/datepicker/stateful-container.js.flow +17 -4
- package/datepicker/stateful-datepicker.js +6 -1
- package/datepicker/stateful-datepicker.js.flow +7 -1
- package/datepicker/types.js.flow +21 -43
- package/datepicker/utils/date-helpers.js +1 -1
- package/datepicker/utils/date-helpers.js.flow +1 -1
- package/dnd-list/index.d.ts +22 -35
- package/drawer/index.d.ts +22 -27
- package/es/app-nav-bar/app-nav-bar.js +9 -19
- package/es/app-nav-bar/styled-components.js +32 -13
- package/es/badge/badge.js +70 -0
- package/es/badge/constants.js +42 -0
- package/es/badge/hint-dot.js +55 -0
- package/es/badge/index.js +11 -0
- package/es/badge/notification-circle.js +65 -0
- package/es/badge/styled-components.js +296 -0
- package/es/badge/types.js +8 -0
- package/es/badge/utils.js +17 -0
- package/es/banner/banner.js +213 -0
- package/es/banner/constants.js +24 -0
- package/es/banner/index.js +9 -0
- package/es/banner/styled-components.js +122 -0
- package/es/banner/types.js +8 -0
- package/es/breadcrumbs/breadcrumbs.js +5 -1
- package/es/button/button.js +1 -0
- package/es/datepicker/calendar.js +15 -10
- package/es/datepicker/datepicker.js +52 -52
- package/es/datepicker/stateful-calendar.js +6 -1
- package/es/datepicker/stateful-container.js +22 -2
- package/es/datepicker/stateful-datepicker.js +6 -1
- package/es/datepicker/utils/date-helpers.js +1 -1
- package/es/helper/helper-steps.js +3 -1
- package/es/input/base-input.js +18 -11
- package/es/input/input.js +15 -10
- package/es/input/masked-input.js +5 -2
- package/es/input/utils.js +4 -2
- package/es/locale/tr_TR.js +115 -0
- package/es/notification/notification.js +16 -1
- package/es/payment-card/custom-cards.config.js +22 -0
- package/es/payment-card/icons/uatp.js +52 -0
- package/es/payment-card/payment-card.js +8 -3
- package/es/popover/popover.js +2 -1
- package/es/popover/stateful-container.js +2 -0
- package/es/popover/styled-components.js +2 -1
- package/es/progress-steps/numbered-step.js +2 -2
- package/es/select/select-component.js +48 -23
- package/es/select/utils/default-filter-options.js +1 -1
- package/es/snackbar/snackbar-context.js +1 -1
- package/es/table-semantic/styled-components.js +14 -0
- package/es/table-semantic/table-builder.js +12 -5
- package/es/textarea/textarea.js +15 -9
- package/es/themes/dark-theme/color-component-tokens.js +8 -0
- package/es/themes/light-theme/color-component-tokens.js +8 -0
- package/es/tree-view/tree-label.js +9 -1
- package/esm/app-nav-bar/app-nav-bar.js +32 -38
- package/esm/app-nav-bar/styled-components.js +46 -28
- package/esm/badge/badge.js +97 -0
- package/esm/badge/constants.js +42 -0
- package/esm/badge/hint-dot.js +83 -0
- package/esm/badge/index.js +11 -0
- package/esm/badge/notification-circle.js +91 -0
- package/esm/badge/styled-components.js +235 -0
- package/esm/badge/types.js +8 -0
- package/esm/badge/utils.js +17 -0
- package/esm/banner/banner.js +271 -0
- package/esm/banner/constants.js +24 -0
- package/esm/banner/index.js +9 -0
- package/esm/banner/styled-components.js +113 -0
- package/esm/banner/types.js +8 -0
- package/esm/breadcrumbs/breadcrumbs.js +5 -1
- package/esm/button/button.js +2 -1
- package/esm/datepicker/calendar.js +16 -11
- package/esm/datepicker/datepicker.js +58 -58
- package/esm/datepicker/stateful-calendar.js +6 -1
- package/esm/datepicker/stateful-container.js +23 -2
- package/esm/datepicker/stateful-datepicker.js +6 -1
- package/esm/datepicker/utils/date-helpers.js +1 -1
- package/esm/helper/helper-steps.js +3 -1
- package/esm/input/base-input.js +18 -11
- package/esm/input/input.js +15 -10
- package/esm/input/masked-input.js +6 -3
- package/esm/input/utils.js +4 -2
- package/esm/locale/tr_TR.js +115 -0
- package/esm/notification/notification.js +17 -1
- package/esm/payment-card/custom-cards.config.js +22 -0
- package/esm/payment-card/icons/uatp.js +53 -0
- package/esm/payment-card/payment-card.js +9 -7
- package/esm/popover/popover.js +2 -1
- package/esm/popover/stateful-container.js +2 -0
- package/esm/popover/styled-components.js +3 -2
- package/esm/progress-steps/numbered-step.js +2 -2
- package/esm/select/select-component.js +85 -59
- package/esm/select/utils/default-filter-options.js +1 -1
- package/esm/snackbar/snackbar-context.js +1 -1
- package/esm/table-semantic/styled-components.js +31 -18
- package/esm/table-semantic/table-builder.js +34 -23
- package/esm/textarea/textarea.js +15 -9
- package/esm/themes/dark-theme/color-component-tokens.js +8 -0
- package/esm/themes/light-theme/color-component-tokens.js +8 -0
- package/esm/tree-view/tree-label.js +10 -2
- package/file-uploader/index.d.ts +11 -11
- package/flex-grid/index.d.ts +3 -3
- package/form-control/index.d.ts +7 -19
- package/header-navigation/index.d.ts +8 -9
- package/heading/index.d.ts +3 -4
- package/helper/helper-steps.js +19 -13
- package/helper/helper-steps.js.flow +3 -1
- package/helper/index.d.ts +7 -7
- package/helpers/base-provider.d.ts +16 -0
- package/helpers/overrides.d.ts +23 -0
- package/icon/index.d.ts +32 -32
- package/index.d.ts +34 -114
- package/input/base-input.js +18 -11
- package/input/base-input.js.flow +18 -6
- package/input/index.d.ts +29 -32
- package/input/input.js +15 -10
- package/input/input.js.flow +10 -5
- package/input/masked-input.js +6 -3
- package/input/masked-input.js.flow +3 -0
- package/input/types.js.flow +4 -0
- package/input/utils.js +4 -2
- package/input/utils.js.flow +2 -1
- package/layer/index.d.ts +6 -11
- package/layout-grid/index.d.ts +25 -7
- package/link/index.d.ts +2 -2
- package/list/index.d.ts +26 -31
- package/{locale.ts → locale/index.d.ts} +8 -0
- package/locale/tr_TR.js +123 -0
- package/locale/tr_TR.js.flow +124 -0
- package/map-marker/index.d.ts +41 -47
- package/menu/index.d.ts +27 -37
- package/modal/index.d.ts +28 -38
- package/notification/index.d.ts +2 -3
- package/notification/notification.js +18 -1
- package/notification/notification.js.flow +15 -1
- package/overrides.ts +2 -22
- package/package.json +26 -17
- package/pagination/index.d.ts +22 -26
- package/payment-card/custom-cards.config.js +30 -0
- package/payment-card/custom-cards.config.js.flow +29 -0
- package/payment-card/icons/uatp.js +67 -0
- package/payment-card/icons/uatp.js.flow +62 -0
- package/payment-card/index.d.ts +8 -8
- package/payment-card/payment-card.js +12 -7
- package/payment-card/payment-card.js.flow +12 -0
- package/phone-input/index.d.ts +261 -269
- package/pin-code/index.d.ts +11 -18
- package/popover/index.d.ts +39 -55
- package/popover/popover.js +2 -1
- package/popover/popover.js.flow +2 -1
- package/popover/stateful-container.js +2 -0
- package/popover/stateful-container.js.flow +2 -0
- package/popover/styled-components.js +3 -2
- package/popover/styled-components.js.flow +2 -1
- package/popover/types.js.flow +1 -0
- package/progress-bar/index.d.ts +11 -12
- package/progress-steps/index.d.ts +16 -16
- package/progress-steps/numbered-step.js.flow +2 -2
- package/radio/index.d.ts +12 -15
- package/rating/index.d.ts +9 -12
- package/select/index.d.ts +34 -36
- package/select/select-component.js +82 -56
- package/select/select-component.js.flow +46 -34
- package/select/types.js.flow +1 -0
- package/select/utils/default-filter-options.js +1 -1
- package/select/utils/default-filter-options.js.flow +1 -1
- package/side-navigation/index.d.ts +11 -13
- package/skeleton/index.d.ts +1 -1
- package/slider/index.d.ts +17 -26
- package/snackbar/index.d.ts +8 -8
- package/snackbar/snackbar-context.js +1 -1
- package/snackbar/snackbar-context.js.flow +1 -1
- package/spinner/index.d.ts +4 -3
- package/styles/index.d.ts +82 -2
- package/table/index.d.ts +16 -16
- package/table-grid/index.d.ts +6 -8
- package/table-semantic/index.d.ts +26 -32
- package/table-semantic/styled-components.js +33 -19
- package/table-semantic/styled-components.js.flow +12 -0
- package/table-semantic/table-builder.js +38 -22
- package/table-semantic/table-builder.js.flow +32 -17
- package/table-semantic/types.js.flow +1 -0
- package/tabs/index.d.ts +20 -23
- package/tabs-motion/index.d.ts +23 -23
- package/tag/index.d.ts +14 -18
- package/tag/types.js.flow +1 -1
- package/textarea/index.d.ts +11 -14
- package/textarea/textarea.js +15 -9
- package/textarea/textarea.js.flow +11 -5
- package/textarea/types.js.flow +1 -0
- package/theme.ts +36 -777
- package/themes/dark-theme/color-component-tokens.js +8 -0
- package/themes/dark-theme/color-component-tokens.js.flow +9 -0
- package/themes/index.d.ts +765 -0
- package/themes/light-theme/color-component-tokens.js +8 -0
- package/themes/light-theme/color-component-tokens.js.flow +9 -0
- package/themes/types.js.flow +9 -0
- package/timepicker/index.d.ts +5 -8
- package/timezonepicker/index.d.ts +5 -8
- package/toast/index.d.ts +26 -40
- package/tokens/index.d.ts +1 -1
- package/tooltip/index.d.ts +7 -9
- package/tree-view/index.d.ts +15 -19
- package/tree-view/tree-label.js +10 -2
- package/tree-view/tree-label.js.flow +4 -4
- package/typography/index.d.ts +37 -37
package/select/index.d.ts
CHANGED
|
@@ -7,15 +7,15 @@ import { Locale } from '../locale';
|
|
|
7
7
|
|
|
8
8
|
export { SIZE } from '../input';
|
|
9
9
|
|
|
10
|
-
export
|
|
10
|
+
export declare const TYPE: {
|
|
11
11
|
select: 'select';
|
|
12
12
|
search: 'search';
|
|
13
|
-
}
|
|
14
|
-
export
|
|
13
|
+
};
|
|
14
|
+
export declare const STATE_CHANGE_TYPE: {
|
|
15
15
|
select: 'select';
|
|
16
16
|
remove: 'remove';
|
|
17
17
|
clear: 'clear';
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
19
|
|
|
20
20
|
export interface Option {
|
|
21
21
|
readonly id?: string | number;
|
|
@@ -111,6 +111,7 @@ export interface SelectProps {
|
|
|
111
111
|
}) => React.ReactNode;
|
|
112
112
|
getValueLabel?: (args: { option: Option }) => React.ReactNode;
|
|
113
113
|
id?: string;
|
|
114
|
+
inputRef?: React.Ref<any>;
|
|
114
115
|
controlRef?: React.Ref<ImperativeMethods>;
|
|
115
116
|
isLoading?: boolean;
|
|
116
117
|
labelKey?: string;
|
|
@@ -133,8 +134,8 @@ export interface SelectProps {
|
|
|
133
134
|
placeholder?: React.ReactNode;
|
|
134
135
|
required?: boolean;
|
|
135
136
|
searchable?: boolean;
|
|
136
|
-
size?: SIZE[keyof SIZE];
|
|
137
|
-
type?: TYPE[keyof TYPE];
|
|
137
|
+
size?: typeof SIZE[keyof typeof SIZE];
|
|
138
|
+
type?: typeof TYPE[keyof typeof TYPE];
|
|
138
139
|
value?: Value;
|
|
139
140
|
valueKey?: string;
|
|
140
141
|
mountNode?: HTMLElement;
|
|
@@ -201,13 +202,13 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|
|
201
202
|
$multi: boolean;
|
|
202
203
|
$required: boolean;
|
|
203
204
|
$searchable: boolean;
|
|
204
|
-
$size: SIZE[keyof SIZE];
|
|
205
|
-
$type: TYPE[keyof TYPE];
|
|
205
|
+
$size: typeof SIZE[keyof typeof SIZE];
|
|
206
|
+
$type: typeof TYPE[keyof typeof TYPE];
|
|
206
207
|
};
|
|
207
208
|
}
|
|
208
209
|
|
|
209
|
-
export const SingleValue: React.FC<any>;
|
|
210
|
-
export const MultiValue: React.FC<any>;
|
|
210
|
+
export declare const SingleValue: React.FC<any>;
|
|
211
|
+
export declare const MultiValue: React.FC<any>;
|
|
211
212
|
|
|
212
213
|
export interface AutosizeInputOverrides {
|
|
213
214
|
Input?: Override<any>;
|
|
@@ -217,7 +218,7 @@ export interface AutosizeInputProps {
|
|
|
217
218
|
defaultValue?: string;
|
|
218
219
|
inputRef?: React.Ref<any>;
|
|
219
220
|
overrides?: AutosizeInputOverrides;
|
|
220
|
-
$size?: SIZE[keyof SIZE];
|
|
221
|
+
$size?: typeof SIZE[keyof typeof SIZE];
|
|
221
222
|
}
|
|
222
223
|
export interface AutosizeInputState {
|
|
223
224
|
inputWidth: number;
|
|
@@ -258,8 +259,8 @@ export interface DropdownProps {
|
|
|
258
259
|
overrides?: DropdownOverrides;
|
|
259
260
|
required?: boolean;
|
|
260
261
|
searchable?: boolean;
|
|
261
|
-
size?: SIZE[keyof SIZE];
|
|
262
|
-
type?: TYPE[keyof TYPE];
|
|
262
|
+
size?: typeof SIZE[keyof typeof SIZE];
|
|
263
|
+
type?: typeof TYPE[keyof typeof TYPE];
|
|
263
264
|
value?: Value;
|
|
264
265
|
valueKey?: string;
|
|
265
266
|
width?: number;
|
|
@@ -272,8 +273,8 @@ export class SelectDropdown extends React.Component<DropdownProps> {
|
|
|
272
273
|
$multi: boolean;
|
|
273
274
|
$required: boolean;
|
|
274
275
|
$searchable: boolean;
|
|
275
|
-
$size: SIZE[keyof SIZE];
|
|
276
|
-
$type: TYPE[keyof TYPE];
|
|
276
|
+
$size: typeof SIZE[keyof typeof SIZE];
|
|
277
|
+
$type: typeof TYPE[keyof typeof TYPE];
|
|
277
278
|
$width: number;
|
|
278
279
|
};
|
|
279
280
|
getItemLabel(option: { [key: string]: any }): React.ReactNode;
|
|
@@ -287,13 +288,13 @@ export type StateReducer = (stateType: string, nextState: State, currentState: S
|
|
|
287
288
|
export interface OnChangeParams {
|
|
288
289
|
value: Value;
|
|
289
290
|
option?: Option;
|
|
290
|
-
type?: STATE_CHANGE_TYPE[keyof STATE_CHANGE_TYPE];
|
|
291
|
+
type?: typeof STATE_CHANGE_TYPE[keyof typeof STATE_CHANGE_TYPE];
|
|
291
292
|
}
|
|
292
293
|
export type StatefulSelectProps = SelectProps & {
|
|
293
294
|
initialState?: State;
|
|
294
295
|
stateReducer?: StateReducer;
|
|
295
296
|
};
|
|
296
|
-
export const StatefulSelect: React.FC<StatefulSelectProps>;
|
|
297
|
+
export declare const StatefulSelect: React.FC<StatefulSelectProps>;
|
|
297
298
|
|
|
298
299
|
export interface StatefulContainerProps {
|
|
299
300
|
overrides?: SelectOverrides;
|
|
@@ -307,22 +308,19 @@ export class StatefulSelectContainer extends React.Component<StatefulContainerPr
|
|
|
307
308
|
internalSetState(params: OnChangeParams): void;
|
|
308
309
|
}
|
|
309
310
|
|
|
310
|
-
export const StyledRoot: StyletronComponent<any>;
|
|
311
|
-
export const StyledControlContainer: StyletronComponent<any>;
|
|
312
|
-
export const StyledValueContainer: StyletronComponent<any>;
|
|
313
|
-
export const StyledPlaceholder: StyletronComponent<any>;
|
|
314
|
-
export const StyledSingleValue: StyletronComponent<any>;
|
|
315
|
-
export const StyledInputContainer: StyletronComponent<any>;
|
|
316
|
-
export const StyledInput: StyletronComponent<any>;
|
|
317
|
-
export const StyledInputSizer: StyletronComponent<any>;
|
|
318
|
-
export const StyledIconsContainer: StyletronComponent<any>;
|
|
319
|
-
export const StyledSelectArrow: StyletronComponent<any>;
|
|
320
|
-
export const StyledClearIcon: StyletronComponent<any>;
|
|
321
|
-
export const StyledSearchIconContainer: StyletronComponent<any>;
|
|
322
|
-
export const StyledDropdownContainer: StyletronComponent<any>;
|
|
323
|
-
export const StyledDropdown: StyletronComponent<any>;
|
|
324
|
-
export const StyledDropdownListItem: StyletronComponent<any>;
|
|
325
|
-
export const StyledOptionContent: StyletronComponent<any>;
|
|
326
|
-
|
|
327
|
-
export const TYPE: TYPE;
|
|
328
|
-
export const STATE_CHANGE_TYPE: STATE_CHANGE_TYPE;
|
|
311
|
+
export declare const StyledRoot: StyletronComponent<any>;
|
|
312
|
+
export declare const StyledControlContainer: StyletronComponent<any>;
|
|
313
|
+
export declare const StyledValueContainer: StyletronComponent<any>;
|
|
314
|
+
export declare const StyledPlaceholder: StyletronComponent<any>;
|
|
315
|
+
export declare const StyledSingleValue: StyletronComponent<any>;
|
|
316
|
+
export declare const StyledInputContainer: StyletronComponent<any>;
|
|
317
|
+
export declare const StyledInput: StyletronComponent<any>;
|
|
318
|
+
export declare const StyledInputSizer: StyletronComponent<any>;
|
|
319
|
+
export declare const StyledIconsContainer: StyletronComponent<any>;
|
|
320
|
+
export declare const StyledSelectArrow: StyletronComponent<any>;
|
|
321
|
+
export declare const StyledClearIcon: StyletronComponent<any>;
|
|
322
|
+
export declare const StyledSearchIconContainer: StyletronComponent<any>;
|
|
323
|
+
export declare const StyledDropdownContainer: StyletronComponent<any>;
|
|
324
|
+
export declare const StyledDropdown: StyletronComponent<any>;
|
|
325
|
+
export declare const StyledDropdownListItem: StyletronComponent<any>;
|
|
326
|
+
export declare const StyledOptionContent: StyletronComponent<any>;
|
|
@@ -42,6 +42,10 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
42
42
|
|
|
43
43
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
44
44
|
|
|
45
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
46
|
+
|
|
47
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
48
|
+
|
|
45
49
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
46
50
|
|
|
47
51
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -311,8 +315,10 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
311
315
|
if (containsNode(_this.anchor.current, event.relatedTarget) || containsNode(_this.dropdown.current, event.relatedTarget)) {
|
|
312
316
|
return;
|
|
313
317
|
}
|
|
314
|
-
} else if (
|
|
315
|
-
|
|
318
|
+
} else if (event.type !== 'blur') {
|
|
319
|
+
if (containsNode(_this.anchor.current, event.target)) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
316
322
|
}
|
|
317
323
|
|
|
318
324
|
if (_this.props.onBlur) {
|
|
@@ -530,6 +536,12 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
530
536
|
_defineProperty(_assertThisInitialized(_this), "handleInputRef", function (input) {
|
|
531
537
|
_this.input = input;
|
|
532
538
|
|
|
539
|
+
if (typeof _this.props.inputRef === 'function') {
|
|
540
|
+
_this.props.inputRef(input);
|
|
541
|
+
} else if (_this.props.inputRef) {
|
|
542
|
+
_this.props.inputRef.current = input;
|
|
543
|
+
}
|
|
544
|
+
|
|
533
545
|
if (_this.props.controlRef && typeof _this.props.controlRef === 'function') {
|
|
534
546
|
_this.props.controlRef(input);
|
|
535
547
|
}
|
|
@@ -687,6 +699,8 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
687
699
|
}, {
|
|
688
700
|
key: "componentDidUpdate",
|
|
689
701
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
702
|
+
var _this2 = this;
|
|
703
|
+
|
|
690
704
|
if (typeof document !== 'undefined') {
|
|
691
705
|
if (prevState.isOpen !== this.state.isOpen) {
|
|
692
706
|
if (this.state.isOpen) {
|
|
@@ -699,7 +713,9 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
699
713
|
}
|
|
700
714
|
|
|
701
715
|
if (!prevState.isFocused && this.state.isFocused) {
|
|
702
|
-
|
|
716
|
+
setTimeout(function () {
|
|
717
|
+
return document.addEventListener('click', _this2.handleClickOutside);
|
|
718
|
+
}, 0);
|
|
703
719
|
}
|
|
704
720
|
}
|
|
705
721
|
}
|
|
@@ -768,7 +784,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
768
784
|
* Extends the value into an array from the given options
|
|
769
785
|
*/
|
|
770
786
|
function getValueArray(value) {
|
|
771
|
-
var
|
|
787
|
+
var _this3 = this;
|
|
772
788
|
|
|
773
789
|
if (!Array.isArray(value)) {
|
|
774
790
|
if (value === null || value === undefined) return [];
|
|
@@ -776,7 +792,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
776
792
|
}
|
|
777
793
|
|
|
778
794
|
return value.map(function (value) {
|
|
779
|
-
return (0, _index3.expandValue)(value,
|
|
795
|
+
return (0, _index3.expandValue)(value, _this3.props);
|
|
780
796
|
});
|
|
781
797
|
}
|
|
782
798
|
}, {
|
|
@@ -821,7 +837,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
821
837
|
}, {
|
|
822
838
|
key: "renderValue",
|
|
823
839
|
value: function renderValue(valueArray, isOpen, locale) {
|
|
824
|
-
var
|
|
840
|
+
var _this4 = this;
|
|
825
841
|
|
|
826
842
|
var _this$props$overrides2 = this.props.overrides,
|
|
827
843
|
overrides = _this$props$overrides2 === void 0 ? {} : _this$props$overrides2;
|
|
@@ -838,9 +854,9 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
838
854
|
var disabled = sharedProps.$disabled || value.clearableValue === false;
|
|
839
855
|
return /*#__PURE__*/React.createElement(Value, _extends({
|
|
840
856
|
value: value,
|
|
841
|
-
key: "value-".concat(i, "-").concat(value[
|
|
857
|
+
key: "value-".concat(i, "-").concat(value[_this4.props.valueKey]),
|
|
842
858
|
removeValue: function removeValue() {
|
|
843
|
-
return
|
|
859
|
+
return _this4.removeValue(value);
|
|
844
860
|
},
|
|
845
861
|
disabled: disabled,
|
|
846
862
|
overrides: {
|
|
@@ -869,7 +885,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
869
885
|
}, {
|
|
870
886
|
key: "renderInput",
|
|
871
887
|
value: function renderInput(listboxId) {
|
|
872
|
-
var
|
|
888
|
+
var _this5 = this;
|
|
873
889
|
|
|
874
890
|
var _this$props$overrides3 = this.props.overrides,
|
|
875
891
|
overrides = _this$props$overrides3 === void 0 ? {} : _this$props$overrides3;
|
|
@@ -882,7 +898,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
882
898
|
var sharedProps = this.getSharedProps();
|
|
883
899
|
var isOpen = this.state.isOpen;
|
|
884
900
|
var selected = this.getValueArray(this.props.value).map(function (v) {
|
|
885
|
-
return v[
|
|
901
|
+
return v[_this5.props.labelKey];
|
|
886
902
|
}).join(', ');
|
|
887
903
|
var selectedLabel = selected.length ? "Selected ".concat(selected, ". ") : '';
|
|
888
904
|
var label = "".concat(selectedLabel).concat(this.props['aria-label'] || '');
|
|
@@ -946,13 +962,18 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
946
962
|
}, {
|
|
947
963
|
key: "renderClear",
|
|
948
964
|
value: function renderClear() {
|
|
965
|
+
var _sizes;
|
|
966
|
+
|
|
949
967
|
var isValueEntered = Boolean(this.props.value && this.props.value.length || this.state.inputValue);
|
|
950
968
|
|
|
951
969
|
if (!this.props.clearable || this.props.disabled || this.props.isLoading || !isValueEntered) {
|
|
952
970
|
return;
|
|
953
971
|
}
|
|
954
972
|
|
|
955
|
-
var
|
|
973
|
+
var _this$getSharedProps = this.getSharedProps(),
|
|
974
|
+
$size = _this$getSharedProps.$size,
|
|
975
|
+
sharedProps = _objectWithoutProperties(_this$getSharedProps, ["$size"]);
|
|
976
|
+
|
|
956
977
|
var _this$props$overrides4 = this.props.overrides,
|
|
957
978
|
overrides = _this$props$overrides4 === void 0 ? {} : _this$props$overrides4;
|
|
958
979
|
|
|
@@ -962,27 +983,28 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
962
983
|
clearIconProps = _getOverrides6[1];
|
|
963
984
|
|
|
964
985
|
var ariaLabel = this.props.multi ? 'Clear all' : 'Clear value';
|
|
986
|
+
var sizes = (_sizes = {}, _defineProperty(_sizes, _constants.SIZE.mini, 15), _defineProperty(_sizes, _constants.SIZE.compact, 15), _defineProperty(_sizes, _constants.SIZE.default, 18), _defineProperty(_sizes, _constants.SIZE.large, 22), _sizes);
|
|
965
987
|
return /*#__PURE__*/React.createElement(ClearIcon, _extends({
|
|
966
988
|
title: ariaLabel,
|
|
967
989
|
"aria-label": ariaLabel,
|
|
968
990
|
onClick: this.clearValue,
|
|
969
991
|
role: "button",
|
|
970
|
-
|
|
971
|
-
Svg: {
|
|
972
|
-
component: _styledComponents.StyledClearIcon,
|
|
973
|
-
props: overrides.ClearIcon && overrides.ClearIcon.props ? overrides.ClearIcon.props : {},
|
|
974
|
-
style: overrides.ClearIcon && overrides.ClearIcon.style ? overrides.ClearIcon.style : {}
|
|
975
|
-
}
|
|
976
|
-
}
|
|
992
|
+
size: sizes[this.props.size] || sizes[_constants.SIZE.default]
|
|
977
993
|
}, sharedProps, clearIconProps));
|
|
978
994
|
}
|
|
979
995
|
}, {
|
|
980
996
|
key: "renderArrow",
|
|
981
997
|
value: function renderArrow() {
|
|
998
|
+
var _sizes2;
|
|
999
|
+
|
|
982
1000
|
if (this.props.type !== _constants.TYPE.select) {
|
|
983
1001
|
return null;
|
|
984
1002
|
}
|
|
985
1003
|
|
|
1004
|
+
var _this$getSharedProps2 = this.getSharedProps(),
|
|
1005
|
+
$size = _this$getSharedProps2.$size,
|
|
1006
|
+
sharedProps = _objectWithoutProperties(_this$getSharedProps2, ["$size"]);
|
|
1007
|
+
|
|
986
1008
|
var _this$props$overrides5 = this.props.overrides,
|
|
987
1009
|
overrides = _this$props$overrides5 === void 0 ? {} : _this$props$overrides5;
|
|
988
1010
|
|
|
@@ -991,17 +1013,21 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
991
1013
|
SelectArrow = _getOverrides8[0],
|
|
992
1014
|
selectArrowProps = _getOverrides8[1];
|
|
993
1015
|
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
style: overrides.SelectArrow && overrides.SelectArrow.style ? overrides.SelectArrow.style : {}
|
|
1016
|
+
selectArrowProps.overrides = (0, _overrides.mergeOverrides)({
|
|
1017
|
+
Svg: {
|
|
1018
|
+
style: function style(_ref4) {
|
|
1019
|
+
var $theme = _ref4.$theme,
|
|
1020
|
+
$disabled = _ref4.$disabled;
|
|
1021
|
+
return {
|
|
1022
|
+
color: $disabled ? $theme.colors.inputTextDisabled : $theme.colors.contentPrimary
|
|
1023
|
+
};
|
|
1003
1024
|
}
|
|
1004
1025
|
}
|
|
1026
|
+
}, selectArrowProps.overrides);
|
|
1027
|
+
var sizes = (_sizes2 = {}, _defineProperty(_sizes2, _constants.SIZE.mini, 16), _defineProperty(_sizes2, _constants.SIZE.compact, 16), _defineProperty(_sizes2, _constants.SIZE.default, 20), _defineProperty(_sizes2, _constants.SIZE.large, 24), _sizes2);
|
|
1028
|
+
return /*#__PURE__*/React.createElement(SelectArrow, _extends({
|
|
1029
|
+
size: sizes[this.props.size] || sizes[_constants.SIZE.default],
|
|
1030
|
+
title: 'open'
|
|
1005
1031
|
}, sharedProps, selectArrowProps));
|
|
1006
1032
|
}
|
|
1007
1033
|
}, {
|
|
@@ -1033,7 +1059,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
1033
1059
|
}, {
|
|
1034
1060
|
key: "filterOptions",
|
|
1035
1061
|
value: function filterOptions(excludeOptions) {
|
|
1036
|
-
var
|
|
1062
|
+
var _this6 = this;
|
|
1037
1063
|
|
|
1038
1064
|
var filterValue = this.state.inputValue.trim(); // apply filter function
|
|
1039
1065
|
|
|
@@ -1046,9 +1072,9 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
1046
1072
|
|
|
1047
1073
|
|
|
1048
1074
|
var filterDoesNotMatchOption = this.props.ignoreCase ? function (opt) {
|
|
1049
|
-
return opt[
|
|
1075
|
+
return opt[_this6.props.labelKey].toLowerCase() !== filterValue.toLowerCase().trim();
|
|
1050
1076
|
} : function (opt) {
|
|
1051
|
-
return opt[
|
|
1077
|
+
return opt[_this6.props.labelKey] !== filterValue.trim();
|
|
1052
1078
|
};
|
|
1053
1079
|
|
|
1054
1080
|
if (filterValue && this.props.creatable && this.options.concat(this.props.value).every(filterDoesNotMatchOption)) {
|
|
@@ -1103,7 +1129,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
1103
1129
|
}, {
|
|
1104
1130
|
key: "render",
|
|
1105
1131
|
value: function render() {
|
|
1106
|
-
var
|
|
1132
|
+
var _this7 = this;
|
|
1107
1133
|
|
|
1108
1134
|
this.options = (0, _index3.normalizeOptions)(this.props.options);
|
|
1109
1135
|
var _this$props2 = this.props,
|
|
@@ -1175,55 +1201,55 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
1175
1201
|
, _extends({
|
|
1176
1202
|
innerRef: function innerRef(ref) {
|
|
1177
1203
|
if (!ref) return;
|
|
1178
|
-
|
|
1204
|
+
_this7.anchor = ref.anchorRef;
|
|
1179
1205
|
},
|
|
1180
1206
|
autoFocus: false,
|
|
1181
1207
|
focusLock: false,
|
|
1182
|
-
mountNode:
|
|
1208
|
+
mountNode: _this7.props.mountNode,
|
|
1183
1209
|
onEsc: function onEsc() {
|
|
1184
|
-
return
|
|
1210
|
+
return _this7.closeMenu();
|
|
1185
1211
|
},
|
|
1186
1212
|
isOpen: isOpen,
|
|
1187
1213
|
popoverMargin: 0,
|
|
1188
1214
|
content: function content() {
|
|
1189
1215
|
var dropdownProps = {
|
|
1190
|
-
error:
|
|
1191
|
-
positive:
|
|
1192
|
-
getOptionLabel:
|
|
1216
|
+
error: _this7.props.error,
|
|
1217
|
+
positive: _this7.props.positive,
|
|
1218
|
+
getOptionLabel: _this7.props.getOptionLabel || _this7.getOptionLabel.bind(_this7, locale),
|
|
1193
1219
|
id: listboxId,
|
|
1194
|
-
isLoading:
|
|
1195
|
-
labelKey:
|
|
1196
|
-
maxDropdownHeight:
|
|
1220
|
+
isLoading: _this7.props.isLoading,
|
|
1221
|
+
labelKey: _this7.props.labelKey,
|
|
1222
|
+
maxDropdownHeight: _this7.props.maxDropdownHeight,
|
|
1197
1223
|
multi: multi,
|
|
1198
1224
|
noResultsMsg: noResultsMsg,
|
|
1199
|
-
onActiveDescendantChange:
|
|
1200
|
-
onItemSelect:
|
|
1225
|
+
onActiveDescendantChange: _this7.handleActiveDescendantChange,
|
|
1226
|
+
onItemSelect: _this7.selectValue,
|
|
1201
1227
|
options: options,
|
|
1202
1228
|
overrides: overrides,
|
|
1203
|
-
required:
|
|
1204
|
-
searchable:
|
|
1205
|
-
size:
|
|
1229
|
+
required: _this7.props.required,
|
|
1230
|
+
searchable: _this7.props.searchable,
|
|
1231
|
+
size: _this7.props.size,
|
|
1206
1232
|
type: type,
|
|
1207
1233
|
value: valueArray,
|
|
1208
|
-
valueKey:
|
|
1209
|
-
width:
|
|
1210
|
-
keyboardControlNode:
|
|
1234
|
+
valueKey: _this7.props.valueKey,
|
|
1235
|
+
width: _this7.anchor.current ? _this7.anchor.current.clientWidth : null,
|
|
1236
|
+
keyboardControlNode: _this7.anchor
|
|
1211
1237
|
};
|
|
1212
1238
|
return /*#__PURE__*/React.createElement(_dropdown.default, _extends({
|
|
1213
|
-
innerRef:
|
|
1239
|
+
innerRef: _this7.dropdown
|
|
1214
1240
|
}, dropdownProps));
|
|
1215
1241
|
},
|
|
1216
1242
|
placement: _index2.PLACEMENT.bottom
|
|
1217
1243
|
}, popoverProps), /*#__PURE__*/React.createElement(Root, _extends({
|
|
1218
|
-
onBlur:
|
|
1244
|
+
onBlur: _this7.handleBlur,
|
|
1219
1245
|
"data-baseweb": "select"
|
|
1220
1246
|
}, sharedProps, rootProps), /*#__PURE__*/React.createElement(ControlContainer, _extends({
|
|
1221
|
-
onKeyDown:
|
|
1222
|
-
onClick:
|
|
1223
|
-
onTouchEnd:
|
|
1224
|
-
onTouchMove:
|
|
1225
|
-
onTouchStart:
|
|
1226
|
-
}, sharedProps, controlContainerProps), type === _constants.TYPE.search ?
|
|
1247
|
+
onKeyDown: _this7.handleKeyDown,
|
|
1248
|
+
onClick: _this7.handleClick,
|
|
1249
|
+
onTouchEnd: _this7.handleTouchEnd,
|
|
1250
|
+
onTouchMove: _this7.handleTouchMove,
|
|
1251
|
+
onTouchStart: _this7.handleTouchStart
|
|
1252
|
+
}, sharedProps, controlContainerProps), type === _constants.TYPE.search ? _this7.renderSearch() : null, /*#__PURE__*/React.createElement(ValueContainer, _extends({}, sharedProps, valueContainerProps), _this7.renderValue(valueArray, isOpen, locale), _this7.renderInput(listboxId), _this7.shouldShowPlaceholder() ? /*#__PURE__*/React.createElement(Placeholder, _extends({}, sharedProps, placeholderProps), typeof _this7.props.placeholder !== 'undefined' ? _this7.props.placeholder : locale.select.placeholder) : null), /*#__PURE__*/React.createElement(IconsContainer, _extends({}, sharedProps, iconsContainerProps), _this7.renderLoading(), _this7.renderClear(), type === _constants.TYPE.select ? _this7.renderArrow() : null))));
|
|
1227
1253
|
});
|
|
1228
1254
|
});
|
|
1229
1255
|
}
|
|
@@ -8,7 +8,7 @@ LICENSE file in the root directory of this source tree.
|
|
|
8
8
|
/* eslint-disable cup/no-undef */
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
|
|
11
|
-
import { getOverrides } from '../helpers/overrides.js';
|
|
11
|
+
import { getOverrides, mergeOverrides } from '../helpers/overrides.js';
|
|
12
12
|
import DeleteAlt from '../icon/delete-alt.js';
|
|
13
13
|
import TriangleDownIcon from '../icon/triangle-down.js';
|
|
14
14
|
import SearchIconComponent from '../icon/search.js';
|
|
@@ -18,7 +18,7 @@ import { Popover, PLACEMENT } from '../popover/index.js';
|
|
|
18
18
|
import { UIDConsumer } from 'react-uid';
|
|
19
19
|
|
|
20
20
|
import AutosizeInput from './autosize-input.js';
|
|
21
|
-
import { TYPE, STATE_CHANGE_TYPE } from './constants.js';
|
|
21
|
+
import { TYPE, STATE_CHANGE_TYPE, SIZE } from './constants.js';
|
|
22
22
|
import defaultProps from './default-props.js';
|
|
23
23
|
import SelectDropdown from './dropdown.js';
|
|
24
24
|
import {
|
|
@@ -28,8 +28,6 @@ import {
|
|
|
28
28
|
StyledValueContainer,
|
|
29
29
|
StyledInputContainer,
|
|
30
30
|
StyledIconsContainer,
|
|
31
|
-
StyledSelectArrow,
|
|
32
|
-
StyledClearIcon,
|
|
33
31
|
StyledSearchIconContainer,
|
|
34
32
|
StyledLoadingIndicator,
|
|
35
33
|
} from './styled-components.js';
|
|
@@ -144,7 +142,7 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
144
142
|
}
|
|
145
143
|
|
|
146
144
|
if (!prevState.isFocused && this.state.isFocused) {
|
|
147
|
-
document.addEventListener('click', this.handleClickOutside);
|
|
145
|
+
setTimeout(() => document.addEventListener('click', this.handleClickOutside), 0);
|
|
148
146
|
}
|
|
149
147
|
}
|
|
150
148
|
}
|
|
@@ -318,8 +316,10 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
318
316
|
) {
|
|
319
317
|
return;
|
|
320
318
|
}
|
|
321
|
-
} else if (
|
|
322
|
-
|
|
319
|
+
} else if (event.type !== 'blur') {
|
|
320
|
+
if (containsNode(this.anchor.current, event.target)) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
if (this.props.onBlur) {
|
|
@@ -497,11 +497,16 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
497
497
|
}
|
|
498
498
|
};
|
|
499
499
|
|
|
500
|
-
// This method is to preserve backwards compatibility for users using controlRef to directly
|
|
501
|
-
// access the input element. This capability is not documented, and may be removed in the future.
|
|
502
500
|
//flowlint-next-line unclear-type:off
|
|
503
501
|
handleInputRef = (input: React.ElementRef<any>) => {
|
|
504
502
|
this.input = input;
|
|
503
|
+
|
|
504
|
+
if (typeof this.props.inputRef === 'function') {
|
|
505
|
+
this.props.inputRef(input);
|
|
506
|
+
} else if (this.props.inputRef) {
|
|
507
|
+
this.props.inputRef.current = input;
|
|
508
|
+
}
|
|
509
|
+
|
|
505
510
|
if (this.props.controlRef && typeof this.props.controlRef === 'function') {
|
|
506
511
|
this.props.controlRef(input);
|
|
507
512
|
}
|
|
@@ -783,10 +788,17 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
783
788
|
return;
|
|
784
789
|
}
|
|
785
790
|
|
|
786
|
-
const sharedProps = this.getSharedProps();
|
|
791
|
+
const { $size, ...sharedProps } = this.getSharedProps();
|
|
787
792
|
const { overrides = {} } = this.props;
|
|
788
793
|
const [ClearIcon, clearIconProps] = getOverrides(overrides.ClearIcon, DeleteAlt);
|
|
794
|
+
|
|
789
795
|
const ariaLabel = this.props.multi ? 'Clear all' : 'Clear value';
|
|
796
|
+
const sizes = {
|
|
797
|
+
[SIZE.mini]: 15,
|
|
798
|
+
[SIZE.compact]: 15,
|
|
799
|
+
[SIZE.default]: 18,
|
|
800
|
+
[SIZE.large]: 22,
|
|
801
|
+
};
|
|
790
802
|
|
|
791
803
|
return (
|
|
792
804
|
<ClearIcon
|
|
@@ -794,15 +806,7 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
794
806
|
aria-label={ariaLabel}
|
|
795
807
|
onClick={this.clearValue}
|
|
796
808
|
role="button"
|
|
797
|
-
|
|
798
|
-
Svg: {
|
|
799
|
-
component: StyledClearIcon,
|
|
800
|
-
props:
|
|
801
|
-
overrides.ClearIcon && overrides.ClearIcon.props ? overrides.ClearIcon.props : {},
|
|
802
|
-
style:
|
|
803
|
-
overrides.ClearIcon && overrides.ClearIcon.style ? overrides.ClearIcon.style : {},
|
|
804
|
-
},
|
|
805
|
-
}}
|
|
809
|
+
size={sizes[this.props.size] || sizes[SIZE.default]}
|
|
806
810
|
{...sharedProps}
|
|
807
811
|
{...clearIconProps}
|
|
808
812
|
/>
|
|
@@ -813,26 +817,34 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
813
817
|
if (this.props.type !== TYPE.select) {
|
|
814
818
|
return null;
|
|
815
819
|
}
|
|
820
|
+
|
|
821
|
+
const { $size, ...sharedProps } = this.getSharedProps();
|
|
816
822
|
const { overrides = {} } = this.props;
|
|
817
823
|
const [SelectArrow, selectArrowProps] = getOverrides(overrides.SelectArrow, TriangleDownIcon);
|
|
818
|
-
|
|
824
|
+
selectArrowProps.overrides = mergeOverrides(
|
|
825
|
+
{
|
|
826
|
+
Svg: {
|
|
827
|
+
style: ({ $theme, $disabled }) => {
|
|
828
|
+
return {
|
|
829
|
+
color: $disabled ? $theme.colors.inputTextDisabled : $theme.colors.contentPrimary,
|
|
830
|
+
};
|
|
831
|
+
},
|
|
832
|
+
},
|
|
833
|
+
},
|
|
834
|
+
selectArrowProps.overrides
|
|
835
|
+
);
|
|
836
|
+
|
|
837
|
+
const sizes = {
|
|
838
|
+
[SIZE.mini]: 16,
|
|
839
|
+
[SIZE.compact]: 16,
|
|
840
|
+
[SIZE.default]: 20,
|
|
841
|
+
[SIZE.large]: 24,
|
|
842
|
+
};
|
|
843
|
+
|
|
819
844
|
return (
|
|
820
845
|
<SelectArrow
|
|
821
|
-
size={
|
|
846
|
+
size={sizes[this.props.size] || sizes[SIZE.default]}
|
|
822
847
|
title={'open'}
|
|
823
|
-
overrides={{
|
|
824
|
-
Svg: {
|
|
825
|
-
component: StyledSelectArrow,
|
|
826
|
-
props:
|
|
827
|
-
overrides.SelectArrow && overrides.SelectArrow.props
|
|
828
|
-
? overrides.SelectArrow.props
|
|
829
|
-
: {},
|
|
830
|
-
style:
|
|
831
|
-
overrides.SelectArrow && overrides.SelectArrow.style
|
|
832
|
-
? overrides.SelectArrow.style
|
|
833
|
-
: {},
|
|
834
|
-
},
|
|
835
|
-
}}
|
|
836
848
|
{...sharedProps}
|
|
837
849
|
{...selectArrowProps}
|
|
838
850
|
/>
|
package/select/types.js.flow
CHANGED
|
@@ -138,6 +138,7 @@ export type PropsT = {
|
|
|
138
138
|
id?: string,
|
|
139
139
|
/** Defines if the comparison for a new creatable value should be case-insensitive. */
|
|
140
140
|
ignoreCase?: boolean,
|
|
141
|
+
inputRef?: ReactRefT<HTMLInputElement>,
|
|
141
142
|
/** An imperative handle exposing internal methods. */
|
|
142
143
|
controlRef?: ControlRefT,
|
|
143
144
|
/** Defines if the select is in a loading (async) state. */
|
|
@@ -50,7 +50,7 @@ var filterOptions = function filterOptions(options, filterValue, excludeOptions,
|
|
|
50
50
|
acc.add(option[props.valueKey]);
|
|
51
51
|
return acc;
|
|
52
52
|
}, new Set());
|
|
53
|
-
var re = new RegExp("".concat(props.matchPos === 'start' ? '
|
|
53
|
+
var re = new RegExp("".concat(props.matchPos === 'start' ? '^' : '').concat(escapeRegExp(filterValue)), props.ignoreCase ? 'i' : ''); // $FlowFixMe
|
|
54
54
|
|
|
55
55
|
return options.filter(function (option) {
|
|
56
56
|
if (excludeValues.has(option[props.valueKey])) return false;
|
|
@@ -58,7 +58,7 @@ const filterOptions = (
|
|
|
58
58
|
}, new Set());
|
|
59
59
|
|
|
60
60
|
const re = new RegExp(
|
|
61
|
-
`${props.matchPos === 'start' ? '
|
|
61
|
+
`${props.matchPos === 'start' ? '^' : ''}${escapeRegExp(filterValue)}`,
|
|
62
62
|
props.ignoreCase ? 'i' : ''
|
|
63
63
|
);
|
|
64
64
|
|