baseui 11.0.2 → 11.1.1

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.
Files changed (241) hide show
  1. package/a11y/index.d.ts +1 -1
  2. package/accordion/index.d.ts +25 -28
  3. package/app-nav-bar/app-nav-bar.js +33 -40
  4. package/app-nav-bar/app-nav-bar.js.flow +46 -62
  5. package/app-nav-bar/index.d.ts +9 -8
  6. package/app-nav-bar/styled-components.js +49 -29
  7. package/app-nav-bar/styled-components.js.flow +25 -8
  8. package/app-nav-bar/types.js.flow +2 -0
  9. package/aspect-ratio-box/index.d.ts +2 -4
  10. package/avatar/index.d.ts +6 -12
  11. package/badge/badge.js +109 -0
  12. package/badge/badge.js.flow +91 -0
  13. package/badge/constants.js +54 -0
  14. package/badge/constants.js.flow +52 -0
  15. package/badge/hint-dot.js +96 -0
  16. package/badge/hint-dot.js.flow +68 -0
  17. package/badge/index.d.ts +97 -0
  18. package/badge/index.js +80 -0
  19. package/badge/index.js.flow +20 -0
  20. package/badge/notification-circle.js +103 -0
  21. package/badge/notification-circle.js.flow +81 -0
  22. package/badge/package.json +4 -0
  23. package/badge/styled-components.js +242 -0
  24. package/badge/styled-components.js.flow +325 -0
  25. package/badge/types.js +11 -0
  26. package/badge/types.js.flow +59 -0
  27. package/badge/utils.js +33 -0
  28. package/badge/utils.js.flow +23 -0
  29. package/banner/banner.js +283 -0
  30. package/banner/banner.js.flow +253 -0
  31. package/banner/constants.js +35 -0
  32. package/banner/constants.js.flow +33 -0
  33. package/banner/index.d.ts +75 -0
  34. package/banner/index.js +44 -0
  35. package/banner/index.js.flow +16 -0
  36. package/banner/package.json +4 -0
  37. package/banner/styled-components.js +131 -0
  38. package/banner/styled-components.js.flow +119 -0
  39. package/banner/types.js +11 -0
  40. package/banner/types.js.flow +66 -0
  41. package/block/index.d.ts +4 -4
  42. package/breadcrumbs/breadcrumbs.js +5 -1
  43. package/breadcrumbs/breadcrumbs.js.flow +2 -2
  44. package/breadcrumbs/index.d.ts +5 -5
  45. package/button/button.js +2 -1
  46. package/button/button.js.flow +1 -0
  47. package/button/index.d.ts +19 -29
  48. package/button-group/index.d.ts +18 -24
  49. package/card/index.d.ts +16 -14
  50. package/checkbox/index.d.ts +17 -21
  51. package/combobox/index.d.ts +7 -11
  52. package/data-table/index.d.ts +7 -10
  53. package/datepicker/index.d.ts +42 -63
  54. package/datepicker/types.js.flow +2 -2
  55. package/datepicker/utils/date-helpers.js +1 -1
  56. package/datepicker/utils/date-helpers.js.flow +1 -1
  57. package/dnd-list/index.d.ts +22 -35
  58. package/drawer/index.d.ts +22 -27
  59. package/es/app-nav-bar/app-nav-bar.js +9 -19
  60. package/es/app-nav-bar/styled-components.js +32 -13
  61. package/es/badge/badge.js +70 -0
  62. package/es/badge/constants.js +42 -0
  63. package/es/badge/hint-dot.js +55 -0
  64. package/es/badge/index.js +11 -0
  65. package/es/badge/notification-circle.js +65 -0
  66. package/es/badge/styled-components.js +296 -0
  67. package/es/badge/types.js +8 -0
  68. package/es/badge/utils.js +17 -0
  69. package/es/banner/banner.js +213 -0
  70. package/es/banner/constants.js +24 -0
  71. package/es/banner/index.js +9 -0
  72. package/es/banner/styled-components.js +122 -0
  73. package/es/banner/types.js +8 -0
  74. package/es/breadcrumbs/breadcrumbs.js +5 -1
  75. package/es/button/button.js +1 -0
  76. package/es/datepicker/utils/date-helpers.js +1 -1
  77. package/es/helper/helper-steps.js +3 -1
  78. package/es/input/base-input.js +18 -11
  79. package/es/input/input.js +15 -10
  80. package/es/input/masked-input.js +5 -2
  81. package/es/input/utils.js +4 -2
  82. package/es/locale/tr_TR.js +115 -0
  83. package/es/notification/notification.js +16 -1
  84. package/es/payment-card/custom-cards.config.js +22 -0
  85. package/es/payment-card/icons/uatp.js +52 -0
  86. package/es/payment-card/payment-card.js +8 -3
  87. package/es/popover/popover.js +2 -1
  88. package/es/popover/stateful-container.js +2 -0
  89. package/es/popover/styled-components.js +2 -1
  90. package/es/progress-steps/numbered-step.js +2 -2
  91. package/es/select/select-component.js +44 -21
  92. package/es/select/utils/default-filter-options.js +1 -1
  93. package/es/table-semantic/styled-components.js +14 -0
  94. package/es/table-semantic/table-builder.js +12 -5
  95. package/es/textarea/textarea.js +15 -9
  96. package/es/themes/dark-theme/color-component-tokens.js +8 -0
  97. package/es/themes/light-theme/color-component-tokens.js +8 -0
  98. package/es/tree-view/tree-label.js +9 -1
  99. package/esm/app-nav-bar/app-nav-bar.js +32 -38
  100. package/esm/app-nav-bar/styled-components.js +46 -28
  101. package/esm/badge/badge.js +97 -0
  102. package/esm/badge/constants.js +42 -0
  103. package/esm/badge/hint-dot.js +83 -0
  104. package/esm/badge/index.js +11 -0
  105. package/esm/badge/notification-circle.js +91 -0
  106. package/esm/badge/styled-components.js +235 -0
  107. package/esm/badge/types.js +8 -0
  108. package/esm/badge/utils.js +17 -0
  109. package/esm/banner/banner.js +271 -0
  110. package/esm/banner/constants.js +24 -0
  111. package/esm/banner/index.js +9 -0
  112. package/esm/banner/styled-components.js +113 -0
  113. package/esm/banner/types.js +8 -0
  114. package/esm/breadcrumbs/breadcrumbs.js +5 -1
  115. package/esm/button/button.js +2 -1
  116. package/esm/datepicker/utils/date-helpers.js +1 -1
  117. package/esm/helper/helper-steps.js +3 -1
  118. package/esm/input/base-input.js +18 -11
  119. package/esm/input/input.js +15 -10
  120. package/esm/input/masked-input.js +6 -3
  121. package/esm/input/utils.js +4 -2
  122. package/esm/locale/tr_TR.js +115 -0
  123. package/esm/notification/notification.js +17 -1
  124. package/esm/payment-card/custom-cards.config.js +22 -0
  125. package/esm/payment-card/icons/uatp.js +53 -0
  126. package/esm/payment-card/payment-card.js +9 -7
  127. package/esm/popover/popover.js +2 -1
  128. package/esm/popover/stateful-container.js +2 -0
  129. package/esm/popover/styled-components.js +3 -2
  130. package/esm/progress-steps/numbered-step.js +2 -2
  131. package/esm/select/select-component.js +81 -57
  132. package/esm/select/utils/default-filter-options.js +1 -1
  133. package/esm/table-semantic/styled-components.js +31 -18
  134. package/esm/table-semantic/table-builder.js +34 -23
  135. package/esm/textarea/textarea.js +15 -9
  136. package/esm/themes/dark-theme/color-component-tokens.js +8 -0
  137. package/esm/themes/light-theme/color-component-tokens.js +8 -0
  138. package/esm/tree-view/tree-label.js +10 -2
  139. package/file-uploader/index.d.ts +11 -11
  140. package/flex-grid/index.d.ts +3 -3
  141. package/form-control/index.d.ts +7 -19
  142. package/header-navigation/index.d.ts +8 -9
  143. package/heading/index.d.ts +3 -4
  144. package/helper/helper-steps.js +19 -13
  145. package/helper/helper-steps.js.flow +3 -1
  146. package/helper/index.d.ts +7 -7
  147. package/helpers/base-provider.d.ts +16 -0
  148. package/helpers/overrides.d.ts +23 -0
  149. package/icon/index.d.ts +32 -32
  150. package/index.d.ts +34 -114
  151. package/input/base-input.js +18 -11
  152. package/input/base-input.js.flow +18 -6
  153. package/input/index.d.ts +29 -32
  154. package/input/input.js +15 -10
  155. package/input/input.js.flow +10 -5
  156. package/input/masked-input.js +6 -3
  157. package/input/masked-input.js.flow +3 -0
  158. package/input/types.js.flow +4 -0
  159. package/input/utils.js +4 -2
  160. package/input/utils.js.flow +2 -1
  161. package/layer/index.d.ts +6 -11
  162. package/layout-grid/index.d.ts +25 -7
  163. package/link/index.d.ts +2 -2
  164. package/list/index.d.ts +26 -31
  165. package/{locale.ts → locale/index.d.ts} +8 -0
  166. package/locale/tr_TR.js +123 -0
  167. package/locale/tr_TR.js.flow +124 -0
  168. package/map-marker/index.d.ts +41 -47
  169. package/menu/index.d.ts +27 -37
  170. package/modal/index.d.ts +28 -38
  171. package/notification/index.d.ts +2 -3
  172. package/notification/notification.js +18 -1
  173. package/notification/notification.js.flow +15 -1
  174. package/overrides.ts +2 -22
  175. package/package.json +26 -17
  176. package/pagination/index.d.ts +22 -26
  177. package/payment-card/custom-cards.config.js +30 -0
  178. package/payment-card/custom-cards.config.js.flow +29 -0
  179. package/payment-card/icons/uatp.js +67 -0
  180. package/payment-card/icons/uatp.js.flow +62 -0
  181. package/payment-card/index.d.ts +8 -8
  182. package/payment-card/payment-card.js +12 -7
  183. package/payment-card/payment-card.js.flow +12 -0
  184. package/phone-input/index.d.ts +261 -269
  185. package/pin-code/index.d.ts +11 -18
  186. package/popover/index.d.ts +39 -55
  187. package/popover/popover.js +2 -1
  188. package/popover/popover.js.flow +2 -1
  189. package/popover/stateful-container.js +2 -0
  190. package/popover/stateful-container.js.flow +2 -0
  191. package/popover/styled-components.js +3 -2
  192. package/popover/styled-components.js.flow +2 -1
  193. package/popover/types.js.flow +1 -0
  194. package/progress-bar/index.d.ts +11 -12
  195. package/progress-steps/index.d.ts +16 -16
  196. package/progress-steps/numbered-step.js.flow +2 -2
  197. package/radio/index.d.ts +12 -15
  198. package/rating/index.d.ts +9 -12
  199. package/select/index.d.ts +34 -36
  200. package/select/select-component.js +78 -54
  201. package/select/select-component.js.flow +42 -32
  202. package/select/types.js.flow +1 -0
  203. package/select/utils/default-filter-options.js +1 -1
  204. package/select/utils/default-filter-options.js.flow +1 -1
  205. package/side-navigation/index.d.ts +11 -13
  206. package/skeleton/index.d.ts +1 -1
  207. package/slider/index.d.ts +17 -26
  208. package/snackbar/index.d.ts +8 -8
  209. package/spinner/index.d.ts +4 -3
  210. package/styles/index.d.ts +82 -2
  211. package/table/index.d.ts +16 -16
  212. package/table-grid/index.d.ts +6 -8
  213. package/table-semantic/index.d.ts +26 -32
  214. package/table-semantic/styled-components.js +33 -19
  215. package/table-semantic/styled-components.js.flow +12 -0
  216. package/table-semantic/table-builder.js +38 -22
  217. package/table-semantic/table-builder.js.flow +32 -17
  218. package/table-semantic/types.js.flow +1 -0
  219. package/tabs/index.d.ts +20 -23
  220. package/tabs-motion/index.d.ts +23 -23
  221. package/tag/index.d.ts +14 -18
  222. package/textarea/index.d.ts +11 -14
  223. package/textarea/textarea.js +15 -9
  224. package/textarea/textarea.js.flow +11 -5
  225. package/textarea/types.js.flow +1 -0
  226. package/theme.ts +36 -777
  227. package/themes/dark-theme/color-component-tokens.js +8 -0
  228. package/themes/dark-theme/color-component-tokens.js.flow +9 -0
  229. package/themes/index.d.ts +765 -0
  230. package/themes/light-theme/color-component-tokens.js +8 -0
  231. package/themes/light-theme/color-component-tokens.js.flow +9 -0
  232. package/themes/types.js.flow +9 -0
  233. package/timepicker/index.d.ts +5 -8
  234. package/timezonepicker/index.d.ts +5 -8
  235. package/toast/index.d.ts +26 -40
  236. package/tokens/index.d.ts +1 -1
  237. package/tooltip/index.d.ts +7 -9
  238. package/tree-view/index.d.ts +15 -19
  239. package/tree-view/tree-label.js +10 -2
  240. package/tree-view/tree-label.js.flow +4 -4
  241. 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 interface TYPE {
10
+ export declare const TYPE: {
11
11
  select: 'select';
12
12
  search: 'search';
13
- }
14
- export interface STATE_CHANGE_TYPE {
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(); }
@@ -530,6 +534,12 @@ var Select = /*#__PURE__*/function (_React$Component) {
530
534
  _defineProperty(_assertThisInitialized(_this), "handleInputRef", function (input) {
531
535
  _this.input = input;
532
536
 
537
+ if (typeof _this.props.inputRef === 'function') {
538
+ _this.props.inputRef(input);
539
+ } else if (_this.props.inputRef) {
540
+ _this.props.inputRef.current = input;
541
+ }
542
+
533
543
  if (_this.props.controlRef && typeof _this.props.controlRef === 'function') {
534
544
  _this.props.controlRef(input);
535
545
  }
@@ -687,6 +697,8 @@ var Select = /*#__PURE__*/function (_React$Component) {
687
697
  }, {
688
698
  key: "componentDidUpdate",
689
699
  value: function componentDidUpdate(prevProps, prevState) {
700
+ var _this2 = this;
701
+
690
702
  if (typeof document !== 'undefined') {
691
703
  if (prevState.isOpen !== this.state.isOpen) {
692
704
  if (this.state.isOpen) {
@@ -699,7 +711,9 @@ var Select = /*#__PURE__*/function (_React$Component) {
699
711
  }
700
712
 
701
713
  if (!prevState.isFocused && this.state.isFocused) {
702
- document.addEventListener('click', this.handleClickOutside);
714
+ setTimeout(function () {
715
+ return document.addEventListener('click', _this2.handleClickOutside);
716
+ }, 0);
703
717
  }
704
718
  }
705
719
  }
@@ -768,7 +782,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
768
782
  * Extends the value into an array from the given options
769
783
  */
770
784
  function getValueArray(value) {
771
- var _this2 = this;
785
+ var _this3 = this;
772
786
 
773
787
  if (!Array.isArray(value)) {
774
788
  if (value === null || value === undefined) return [];
@@ -776,7 +790,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
776
790
  }
777
791
 
778
792
  return value.map(function (value) {
779
- return (0, _index3.expandValue)(value, _this2.props);
793
+ return (0, _index3.expandValue)(value, _this3.props);
780
794
  });
781
795
  }
782
796
  }, {
@@ -821,7 +835,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
821
835
  }, {
822
836
  key: "renderValue",
823
837
  value: function renderValue(valueArray, isOpen, locale) {
824
- var _this3 = this;
838
+ var _this4 = this;
825
839
 
826
840
  var _this$props$overrides2 = this.props.overrides,
827
841
  overrides = _this$props$overrides2 === void 0 ? {} : _this$props$overrides2;
@@ -838,9 +852,9 @@ var Select = /*#__PURE__*/function (_React$Component) {
838
852
  var disabled = sharedProps.$disabled || value.clearableValue === false;
839
853
  return /*#__PURE__*/React.createElement(Value, _extends({
840
854
  value: value,
841
- key: "value-".concat(i, "-").concat(value[_this3.props.valueKey]),
855
+ key: "value-".concat(i, "-").concat(value[_this4.props.valueKey]),
842
856
  removeValue: function removeValue() {
843
- return _this3.removeValue(value);
857
+ return _this4.removeValue(value);
844
858
  },
845
859
  disabled: disabled,
846
860
  overrides: {
@@ -869,7 +883,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
869
883
  }, {
870
884
  key: "renderInput",
871
885
  value: function renderInput(listboxId) {
872
- var _this4 = this;
886
+ var _this5 = this;
873
887
 
874
888
  var _this$props$overrides3 = this.props.overrides,
875
889
  overrides = _this$props$overrides3 === void 0 ? {} : _this$props$overrides3;
@@ -882,7 +896,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
882
896
  var sharedProps = this.getSharedProps();
883
897
  var isOpen = this.state.isOpen;
884
898
  var selected = this.getValueArray(this.props.value).map(function (v) {
885
- return v[_this4.props.labelKey];
899
+ return v[_this5.props.labelKey];
886
900
  }).join(', ');
887
901
  var selectedLabel = selected.length ? "Selected ".concat(selected, ". ") : '';
888
902
  var label = "".concat(selectedLabel).concat(this.props['aria-label'] || '');
@@ -946,13 +960,18 @@ var Select = /*#__PURE__*/function (_React$Component) {
946
960
  }, {
947
961
  key: "renderClear",
948
962
  value: function renderClear() {
963
+ var _sizes;
964
+
949
965
  var isValueEntered = Boolean(this.props.value && this.props.value.length || this.state.inputValue);
950
966
 
951
967
  if (!this.props.clearable || this.props.disabled || this.props.isLoading || !isValueEntered) {
952
968
  return;
953
969
  }
954
970
 
955
- var sharedProps = this.getSharedProps();
971
+ var _this$getSharedProps = this.getSharedProps(),
972
+ $size = _this$getSharedProps.$size,
973
+ sharedProps = _objectWithoutProperties(_this$getSharedProps, ["$size"]);
974
+
956
975
  var _this$props$overrides4 = this.props.overrides,
957
976
  overrides = _this$props$overrides4 === void 0 ? {} : _this$props$overrides4;
958
977
 
@@ -962,27 +981,28 @@ var Select = /*#__PURE__*/function (_React$Component) {
962
981
  clearIconProps = _getOverrides6[1];
963
982
 
964
983
  var ariaLabel = this.props.multi ? 'Clear all' : 'Clear value';
984
+ 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
985
  return /*#__PURE__*/React.createElement(ClearIcon, _extends({
966
986
  title: ariaLabel,
967
987
  "aria-label": ariaLabel,
968
988
  onClick: this.clearValue,
969
989
  role: "button",
970
- overrides: {
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
- }
990
+ size: sizes[this.props.size] || sizes[_constants.SIZE.default]
977
991
  }, sharedProps, clearIconProps));
978
992
  }
979
993
  }, {
980
994
  key: "renderArrow",
981
995
  value: function renderArrow() {
996
+ var _sizes2;
997
+
982
998
  if (this.props.type !== _constants.TYPE.select) {
983
999
  return null;
984
1000
  }
985
1001
 
1002
+ var _this$getSharedProps2 = this.getSharedProps(),
1003
+ $size = _this$getSharedProps2.$size,
1004
+ sharedProps = _objectWithoutProperties(_this$getSharedProps2, ["$size"]);
1005
+
986
1006
  var _this$props$overrides5 = this.props.overrides,
987
1007
  overrides = _this$props$overrides5 === void 0 ? {} : _this$props$overrides5;
988
1008
 
@@ -991,17 +1011,21 @@ var Select = /*#__PURE__*/function (_React$Component) {
991
1011
  SelectArrow = _getOverrides8[0],
992
1012
  selectArrowProps = _getOverrides8[1];
993
1013
 
994
- var sharedProps = this.getSharedProps();
995
- return /*#__PURE__*/React.createElement(SelectArrow, _extends({
996
- size: 16,
997
- title: 'open',
998
- overrides: {
999
- Svg: {
1000
- component: _styledComponents.StyledSelectArrow,
1001
- props: overrides.SelectArrow && overrides.SelectArrow.props ? overrides.SelectArrow.props : {},
1002
- style: overrides.SelectArrow && overrides.SelectArrow.style ? overrides.SelectArrow.style : {}
1014
+ selectArrowProps.overrides = (0, _overrides.mergeOverrides)({
1015
+ Svg: {
1016
+ style: function style(_ref4) {
1017
+ var $theme = _ref4.$theme,
1018
+ $disabled = _ref4.$disabled;
1019
+ return {
1020
+ color: $disabled ? $theme.colors.inputTextDisabled : $theme.colors.contentPrimary
1021
+ };
1003
1022
  }
1004
1023
  }
1024
+ }, selectArrowProps.overrides);
1025
+ 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);
1026
+ return /*#__PURE__*/React.createElement(SelectArrow, _extends({
1027
+ size: sizes[this.props.size] || sizes[_constants.SIZE.default],
1028
+ title: 'open'
1005
1029
  }, sharedProps, selectArrowProps));
1006
1030
  }
1007
1031
  }, {
@@ -1033,7 +1057,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
1033
1057
  }, {
1034
1058
  key: "filterOptions",
1035
1059
  value: function filterOptions(excludeOptions) {
1036
- var _this5 = this;
1060
+ var _this6 = this;
1037
1061
 
1038
1062
  var filterValue = this.state.inputValue.trim(); // apply filter function
1039
1063
 
@@ -1046,9 +1070,9 @@ var Select = /*#__PURE__*/function (_React$Component) {
1046
1070
 
1047
1071
 
1048
1072
  var filterDoesNotMatchOption = this.props.ignoreCase ? function (opt) {
1049
- return opt[_this5.props.labelKey].toLowerCase() !== filterValue.toLowerCase().trim();
1073
+ return opt[_this6.props.labelKey].toLowerCase() !== filterValue.toLowerCase().trim();
1050
1074
  } : function (opt) {
1051
- return opt[_this5.props.labelKey] !== filterValue.trim();
1075
+ return opt[_this6.props.labelKey] !== filterValue.trim();
1052
1076
  };
1053
1077
 
1054
1078
  if (filterValue && this.props.creatable && this.options.concat(this.props.value).every(filterDoesNotMatchOption)) {
@@ -1103,7 +1127,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
1103
1127
  }, {
1104
1128
  key: "render",
1105
1129
  value: function render() {
1106
- var _this6 = this;
1130
+ var _this7 = this;
1107
1131
 
1108
1132
  this.options = (0, _index3.normalizeOptions)(this.props.options);
1109
1133
  var _this$props2 = this.props,
@@ -1175,55 +1199,55 @@ var Select = /*#__PURE__*/function (_React$Component) {
1175
1199
  , _extends({
1176
1200
  innerRef: function innerRef(ref) {
1177
1201
  if (!ref) return;
1178
- _this6.anchor = ref.anchorRef;
1202
+ _this7.anchor = ref.anchorRef;
1179
1203
  },
1180
1204
  autoFocus: false,
1181
1205
  focusLock: false,
1182
- mountNode: _this6.props.mountNode,
1206
+ mountNode: _this7.props.mountNode,
1183
1207
  onEsc: function onEsc() {
1184
- return _this6.closeMenu();
1208
+ return _this7.closeMenu();
1185
1209
  },
1186
1210
  isOpen: isOpen,
1187
1211
  popoverMargin: 0,
1188
1212
  content: function content() {
1189
1213
  var dropdownProps = {
1190
- error: _this6.props.error,
1191
- positive: _this6.props.positive,
1192
- getOptionLabel: _this6.props.getOptionLabel || _this6.getOptionLabel.bind(_this6, locale),
1214
+ error: _this7.props.error,
1215
+ positive: _this7.props.positive,
1216
+ getOptionLabel: _this7.props.getOptionLabel || _this7.getOptionLabel.bind(_this7, locale),
1193
1217
  id: listboxId,
1194
- isLoading: _this6.props.isLoading,
1195
- labelKey: _this6.props.labelKey,
1196
- maxDropdownHeight: _this6.props.maxDropdownHeight,
1218
+ isLoading: _this7.props.isLoading,
1219
+ labelKey: _this7.props.labelKey,
1220
+ maxDropdownHeight: _this7.props.maxDropdownHeight,
1197
1221
  multi: multi,
1198
1222
  noResultsMsg: noResultsMsg,
1199
- onActiveDescendantChange: _this6.handleActiveDescendantChange,
1200
- onItemSelect: _this6.selectValue,
1223
+ onActiveDescendantChange: _this7.handleActiveDescendantChange,
1224
+ onItemSelect: _this7.selectValue,
1201
1225
  options: options,
1202
1226
  overrides: overrides,
1203
- required: _this6.props.required,
1204
- searchable: _this6.props.searchable,
1205
- size: _this6.props.size,
1227
+ required: _this7.props.required,
1228
+ searchable: _this7.props.searchable,
1229
+ size: _this7.props.size,
1206
1230
  type: type,
1207
1231
  value: valueArray,
1208
- valueKey: _this6.props.valueKey,
1209
- width: _this6.anchor.current ? _this6.anchor.current.clientWidth : null,
1210
- keyboardControlNode: _this6.anchor
1232
+ valueKey: _this7.props.valueKey,
1233
+ width: _this7.anchor.current ? _this7.anchor.current.clientWidth : null,
1234
+ keyboardControlNode: _this7.anchor
1211
1235
  };
1212
1236
  return /*#__PURE__*/React.createElement(_dropdown.default, _extends({
1213
- innerRef: _this6.dropdown
1237
+ innerRef: _this7.dropdown
1214
1238
  }, dropdownProps));
1215
1239
  },
1216
1240
  placement: _index2.PLACEMENT.bottom
1217
1241
  }, popoverProps), /*#__PURE__*/React.createElement(Root, _extends({
1218
- onBlur: _this6.handleBlur,
1242
+ onBlur: _this7.handleBlur,
1219
1243
  "data-baseweb": "select"
1220
1244
  }, sharedProps, rootProps), /*#__PURE__*/React.createElement(ControlContainer, _extends({
1221
- onKeyDown: _this6.handleKeyDown,
1222
- onClick: _this6.handleClick,
1223
- onTouchEnd: _this6.handleTouchEnd,
1224
- onTouchMove: _this6.handleTouchMove,
1225
- onTouchStart: _this6.handleTouchStart
1226
- }, sharedProps, controlContainerProps), type === _constants.TYPE.search ? _this6.renderSearch() : null, /*#__PURE__*/React.createElement(ValueContainer, _extends({}, sharedProps, valueContainerProps), _this6.renderValue(valueArray, isOpen, locale), _this6.renderInput(listboxId), _this6.shouldShowPlaceholder() ? /*#__PURE__*/React.createElement(Placeholder, _extends({}, sharedProps, placeholderProps), typeof _this6.props.placeholder !== 'undefined' ? _this6.props.placeholder : locale.select.placeholder) : null), /*#__PURE__*/React.createElement(IconsContainer, _extends({}, sharedProps, iconsContainerProps), _this6.renderLoading(), _this6.renderClear(), type === _constants.TYPE.select ? _this6.renderArrow() : null))));
1245
+ onKeyDown: _this7.handleKeyDown,
1246
+ onClick: _this7.handleClick,
1247
+ onTouchEnd: _this7.handleTouchEnd,
1248
+ onTouchMove: _this7.handleTouchMove,
1249
+ onTouchStart: _this7.handleTouchStart
1250
+ }, 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
1251
  });
1228
1252
  });
1229
1253
  }
@@ -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
  }
@@ -497,11 +495,16 @@ class Select extends React.Component<PropsT, SelectStateT> {
497
495
  }
498
496
  };
499
497
 
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
498
  //flowlint-next-line unclear-type:off
503
499
  handleInputRef = (input: React.ElementRef<any>) => {
504
500
  this.input = input;
501
+
502
+ if (typeof this.props.inputRef === 'function') {
503
+ this.props.inputRef(input);
504
+ } else if (this.props.inputRef) {
505
+ this.props.inputRef.current = input;
506
+ }
507
+
505
508
  if (this.props.controlRef && typeof this.props.controlRef === 'function') {
506
509
  this.props.controlRef(input);
507
510
  }
@@ -783,10 +786,17 @@ class Select extends React.Component<PropsT, SelectStateT> {
783
786
  return;
784
787
  }
785
788
 
786
- const sharedProps = this.getSharedProps();
789
+ const { $size, ...sharedProps } = this.getSharedProps();
787
790
  const { overrides = {} } = this.props;
788
791
  const [ClearIcon, clearIconProps] = getOverrides(overrides.ClearIcon, DeleteAlt);
792
+
789
793
  const ariaLabel = this.props.multi ? 'Clear all' : 'Clear value';
794
+ const sizes = {
795
+ [SIZE.mini]: 15,
796
+ [SIZE.compact]: 15,
797
+ [SIZE.default]: 18,
798
+ [SIZE.large]: 22,
799
+ };
790
800
 
791
801
  return (
792
802
  <ClearIcon
@@ -794,15 +804,7 @@ class Select extends React.Component<PropsT, SelectStateT> {
794
804
  aria-label={ariaLabel}
795
805
  onClick={this.clearValue}
796
806
  role="button"
797
- overrides={{
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
- }}
807
+ size={sizes[this.props.size] || sizes[SIZE.default]}
806
808
  {...sharedProps}
807
809
  {...clearIconProps}
808
810
  />
@@ -813,26 +815,34 @@ class Select extends React.Component<PropsT, SelectStateT> {
813
815
  if (this.props.type !== TYPE.select) {
814
816
  return null;
815
817
  }
818
+
819
+ const { $size, ...sharedProps } = this.getSharedProps();
816
820
  const { overrides = {} } = this.props;
817
821
  const [SelectArrow, selectArrowProps] = getOverrides(overrides.SelectArrow, TriangleDownIcon);
818
- const sharedProps = this.getSharedProps();
822
+ selectArrowProps.overrides = mergeOverrides(
823
+ {
824
+ Svg: {
825
+ style: ({ $theme, $disabled }) => {
826
+ return {
827
+ color: $disabled ? $theme.colors.inputTextDisabled : $theme.colors.contentPrimary,
828
+ };
829
+ },
830
+ },
831
+ },
832
+ selectArrowProps.overrides
833
+ );
834
+
835
+ const sizes = {
836
+ [SIZE.mini]: 16,
837
+ [SIZE.compact]: 16,
838
+ [SIZE.default]: 20,
839
+ [SIZE.large]: 24,
840
+ };
841
+
819
842
  return (
820
843
  <SelectArrow
821
- size={16}
844
+ size={sizes[this.props.size] || sizes[SIZE.default]}
822
845
  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
846
  {...sharedProps}
837
847
  {...selectArrowProps}
838
848
  />
@@ -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' ? '$' : '').concat(escapeRegExp(filterValue)), props.ignoreCase ? 'i' : ''); // $FlowFixMe
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' ? '$' : ''}${escapeRegExp(filterValue)}`,
61
+ `${props.matchPos === 'start' ? '^' : ''}${escapeRegExp(filterValue)}`,
62
62
  props.ignoreCase ? 'i' : ''
63
63
  );
64
64
 
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
- import {StyletronComponent} from 'styletron-react';
3
- import {Override} from '../overrides';
2
+ import { StyletronComponent } from 'styletron-react';
3
+ import { Override } from '../overrides';
4
4
 
5
- export interface STATE_CHANGE_TYPE {
5
+ export declare const STATE_CHANGE_TYPE: {
6
6
  change: 'change';
7
- }
7
+ };
8
8
 
9
9
  export interface Item {
10
10
  title: React.ReactNode;
@@ -25,7 +25,7 @@ export interface NavigationProps {
25
25
  activeItemId: string;
26
26
  activePredicate?: (item: any, activeItemId: string) => boolean;
27
27
  items?: Item[];
28
- onChange?: (args: {item: any; event: React.SyntheticEvent<any>}) => any;
28
+ onChange?: (args: { item: any; event: React.SyntheticEvent<any> }) => any;
29
29
  overrides?: NavigationOverrides;
30
30
  mapItem?: (item: Item) => Item;
31
31
  }
@@ -44,7 +44,7 @@ export interface NavItemProps {
44
44
  $level?: number;
45
45
  $selectable?: boolean;
46
46
  item: Item;
47
- onSelect?: (args: {item: any; event: Event | KeyboardEvent}) => any;
47
+ onSelect?: (args: { item: any; event: Event | KeyboardEvent }) => any;
48
48
  overrides?: NavItemOverrides;
49
49
  }
50
50
 
@@ -53,10 +53,8 @@ export class NavItem extends React.Component<NavItemProps> {
53
53
  handleKeyDown(event: React.KeyboardEvent): void;
54
54
  }
55
55
 
56
- export const StyledRoot: StyletronComponent<any>;
57
- export const StyledNavItemContainer: StyletronComponent<any>;
58
- export const StyledNavLink: StyletronComponent<any>;
59
- export const StyledNavItem: StyletronComponent<any>;
60
- export const StyledSubNavContainer: StyletronComponent<any>;
61
-
62
- export const STATE_CHANGE_TYPE: STATE_CHANGE_TYPE;
56
+ export declare const StyledRoot: StyletronComponent<any>;
57
+ export declare const StyledNavItemContainer: StyletronComponent<any>;
58
+ export declare const StyledNavLink: StyletronComponent<any>;
59
+ export declare const StyledNavItem: StyletronComponent<any>;
60
+ export declare const StyledSubNavContainer: StyletronComponent<any>;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import {Override} from '../overrides';
2
+ import { Override } from '../overrides';
3
3
 
4
4
  export type SkeletonOverrides = {
5
5
  Root?: Override<any>;