baseui 10.2.1 → 10.6.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.
Files changed (142) hide show
  1. package/button/styled-components.js +1 -1
  2. package/button/styled-components.js.flow +4 -1
  3. package/data-table/data-table.js +13 -3
  4. package/data-table/data-table.js.flow +20 -4
  5. package/data-table/types.js.flow +2 -1
  6. package/datepicker/calendar-header.js +227 -95
  7. package/datepicker/calendar-header.js.flow +270 -139
  8. package/datepicker/constants.js +4 -2
  9. package/datepicker/constants.js.flow +2 -0
  10. package/datepicker/day.js +1 -0
  11. package/datepicker/day.js.flow +1 -0
  12. package/datepicker/index.d.ts +1 -0
  13. package/datepicker/types.js.flow +1 -0
  14. package/datepicker/utils/calendar-header-helpers.js +51 -0
  15. package/datepicker/utils/calendar-header-helpers.js.flow +53 -0
  16. package/dnd-list/index.js.flow +2 -1
  17. package/drawer/close-icon.js +3 -2
  18. package/drawer/close-icon.js.flow +2 -2
  19. package/drawer/drawer.js +5 -2
  20. package/drawer/drawer.js.flow +2 -2
  21. package/es/button/styled-components.js +1 -1
  22. package/es/data-table/data-table.js +13 -3
  23. package/es/datepicker/calendar-header.js +184 -84
  24. package/es/datepicker/constants.js +2 -1
  25. package/es/datepicker/day.js +1 -0
  26. package/es/datepicker/utils/calendar-header-helpers.js +34 -0
  27. package/es/dnd-list/index.js +2 -1
  28. package/es/drawer/close-icon.js +3 -2
  29. package/es/drawer/drawer.js +5 -2
  30. package/es/list/list-heading.js +17 -6
  31. package/es/map-marker/constants.js +69 -0
  32. package/es/map-marker/fixed-marker.js +98 -0
  33. package/es/map-marker/floating-marker.js +65 -0
  34. package/es/map-marker/index.js +9 -0
  35. package/es/map-marker/pin-head.js +108 -0
  36. package/es/map-marker/styled-components.js +156 -0
  37. package/es/map-marker/types.js +8 -0
  38. package/es/popover/stateful-container.js +4 -0
  39. package/es/rating/emoticon-rating.js +3 -1
  40. package/es/rating/star-rating.js +3 -1
  41. package/es/select/select-component.js +20 -6
  42. package/es/select/styled-components.js +34 -4
  43. package/es/snackbar/snackbar-context.js +16 -4
  44. package/es/spinner/styled-components.js +1 -1
  45. package/es/table-semantic/styled-components.js +6 -4
  46. package/es/table-semantic/table-builder.js +3 -0
  47. package/es/themes/dark-theme/color-component-tokens.js +1 -1
  48. package/es/themes/dark-theme/color-semantic-tokens.js +8 -7
  49. package/es/themes/light-theme/color-component-tokens.js +9 -9
  50. package/es/themes/light-theme/color-semantic-tokens.js +3 -2
  51. package/es/tokens/colors.js +2 -2
  52. package/es/tooltip/styled-components.js +8 -0
  53. package/esm/button/styled-components.js +1 -1
  54. package/esm/data-table/data-table.js +13 -3
  55. package/esm/datepicker/calendar-header.js +226 -95
  56. package/esm/datepicker/constants.js +2 -1
  57. package/esm/datepicker/day.js +1 -0
  58. package/esm/datepicker/utils/calendar-header-helpers.js +45 -0
  59. package/esm/dnd-list/index.js +2 -1
  60. package/esm/drawer/close-icon.js +3 -2
  61. package/esm/drawer/drawer.js +5 -2
  62. package/esm/list/list-heading.js +17 -6
  63. package/esm/map-marker/constants.js +62 -0
  64. package/esm/map-marker/fixed-marker.js +137 -0
  65. package/esm/map-marker/floating-marker.js +94 -0
  66. package/esm/map-marker/index.js +9 -0
  67. package/esm/map-marker/pin-head.js +144 -0
  68. package/esm/map-marker/styled-components.js +168 -0
  69. package/esm/map-marker/types.js +8 -0
  70. package/esm/popover/stateful-container.js +4 -0
  71. package/esm/rating/emoticon-rating.js +2 -2
  72. package/esm/rating/star-rating.js +2 -2
  73. package/esm/select/select-component.js +19 -6
  74. package/esm/select/styled-components.js +28 -4
  75. package/esm/snackbar/snackbar-context.js +16 -4
  76. package/esm/spinner/styled-components.js +1 -1
  77. package/esm/table-semantic/styled-components.js +6 -4
  78. package/esm/table-semantic/table-builder.js +3 -0
  79. package/esm/themes/dark-theme/color-component-tokens.js +1 -1
  80. package/esm/themes/dark-theme/color-semantic-tokens.js +8 -7
  81. package/esm/themes/light-theme/color-component-tokens.js +9 -9
  82. package/esm/themes/light-theme/color-semantic-tokens.js +3 -2
  83. package/esm/tokens/colors.js +2 -2
  84. package/esm/tooltip/styled-components.js +8 -0
  85. package/index.d.ts +1 -0
  86. package/link/index.d.ts +1 -0
  87. package/list/index.d.ts +36 -0
  88. package/list/list-heading.js +24 -7
  89. package/list/list-heading.js.flow +17 -8
  90. package/map-marker/constants.js +82 -0
  91. package/map-marker/constants.js.flow +74 -0
  92. package/map-marker/fixed-marker.js +152 -0
  93. package/map-marker/fixed-marker.js.flow +137 -0
  94. package/map-marker/floating-marker.js +109 -0
  95. package/map-marker/floating-marker.js.flow +102 -0
  96. package/map-marker/index.d.ts +104 -0
  97. package/map-marker/index.js +55 -0
  98. package/map-marker/index.js.flow +23 -0
  99. package/map-marker/package.json +4 -0
  100. package/map-marker/pin-head.js +159 -0
  101. package/map-marker/pin-head.js.flow +155 -0
  102. package/map-marker/styled-components.js +184 -0
  103. package/map-marker/styled-components.js.flow +177 -0
  104. package/map-marker/types.js +11 -0
  105. package/map-marker/types.js.flow +114 -0
  106. package/menu/index.d.ts +7 -0
  107. package/menu/types.js.flow +12 -0
  108. package/package.json +3 -2
  109. package/popover/stateful-container.js +4 -0
  110. package/popover/stateful-container.js.flow +3 -0
  111. package/rating/emoticon-rating.js +2 -2
  112. package/rating/emoticon-rating.js.flow +4 -1
  113. package/rating/star-rating.js +2 -2
  114. package/rating/star-rating.js.flow +4 -1
  115. package/select/select-component.js +19 -6
  116. package/select/select-component.js.flow +19 -6
  117. package/select/styled-components.js +28 -4
  118. package/select/styled-components.js.flow +30 -2
  119. package/select/types.js.flow +9 -0
  120. package/snackbar/snackbar-context.js +15 -4
  121. package/snackbar/snackbar-context.js.flow +15 -3
  122. package/spinner/styled-components.js +1 -1
  123. package/spinner/styled-components.js.flow +1 -1
  124. package/table-semantic/index.d.ts +1 -0
  125. package/table-semantic/styled-components.js +6 -4
  126. package/table-semantic/styled-components.js.flow +6 -4
  127. package/table-semantic/table-builder.js +3 -0
  128. package/table-semantic/table-builder.js.flow +3 -0
  129. package/theme.ts +2 -0
  130. package/themes/dark-theme/color-component-tokens.js +1 -1
  131. package/themes/dark-theme/color-component-tokens.js.flow +1 -1
  132. package/themes/dark-theme/color-semantic-tokens.js +8 -7
  133. package/themes/dark-theme/color-semantic-tokens.js.flow +7 -6
  134. package/themes/light-theme/color-component-tokens.js +9 -9
  135. package/themes/light-theme/color-component-tokens.js.flow +9 -9
  136. package/themes/light-theme/color-semantic-tokens.js +3 -2
  137. package/themes/light-theme/color-semantic-tokens.js.flow +2 -1
  138. package/themes/types.js.flow +1 -0
  139. package/tokens/colors.js +2 -2
  140. package/tokens/colors.js.flow +2 -2
  141. package/tooltip/styled-components.js +8 -0
  142. package/tooltip/styled-components.js.flow +8 -0
@@ -0,0 +1,177 @@
1
+ /*
2
+ Copyright (c) Uber Technologies, Inc.
3
+
4
+ This source code is licensed under the MIT license found in the
5
+ LICENSE file in the root directory of this source tree.
6
+ */
7
+ // @flow
8
+ import {styled} from '../styles/index.js';
9
+ import {
10
+ FLOATING_MARKER_ANCHOR_POSITIONS,
11
+ xSmallPinheadDimension,
12
+ } from './constants.js';
13
+
14
+ import type {AnchorPositionsT} from './types.js';
15
+
16
+ export const getAnchorTransform = (
17
+ anchor: AnchorPositionsT,
18
+ anchorSize: number,
19
+ ) =>
20
+ ({
21
+ [FLOATING_MARKER_ANCHOR_POSITIONS.none]: ``,
22
+ [FLOATING_MARKER_ANCHOR_POSITIONS.topLeft]: `translate(${anchorSize}px, ${anchorSize}px)`,
23
+ [FLOATING_MARKER_ANCHOR_POSITIONS.topRight]: `translate(-100%, ${anchorSize}px)`,
24
+ [FLOATING_MARKER_ANCHOR_POSITIONS.bottomLeft]: `translate(${anchorSize}px, -100%)`,
25
+ [FLOATING_MARKER_ANCHOR_POSITIONS.bottomRight]: `translate(-100%, -100%)`,
26
+ }[anchor]);
27
+
28
+ export const DragShadowContainer = styled<{
29
+ $height: number,
30
+ $width: number,
31
+ $dragging: boolean,
32
+ }>('div', ({$theme, $height, $width, $dragging}) => ({
33
+ width: `${$width}px`,
34
+ height: `${$height}px`,
35
+ opacity: $dragging ? 1 : 0,
36
+ visibility: $dragging ? 'visible' : 'hidden',
37
+ transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
38
+ position: 'relative',
39
+ boxShadow: $theme.lighting.shadow600,
40
+ }));
41
+
42
+ export const DragShadow = styled<{
43
+ $background: string,
44
+ $width: number,
45
+ }>('div', ({$theme, $background, $width}) => ({
46
+ background: $background,
47
+ borderRadius: '50%',
48
+ width: `${$width}px`,
49
+ height: `${4}px`,
50
+ position: 'absolute',
51
+ bottom: 0,
52
+ }));
53
+
54
+ export const Needle = styled<{
55
+ $background?: string,
56
+ $height: number,
57
+ }>('div', ({$theme, $background, $height}) => ({
58
+ background: $background,
59
+ width: '4px',
60
+ height: `${$height}px`,
61
+ boxShadow: $theme.lighting.shadow600,
62
+ }));
63
+
64
+ export const FloatingMarkerRoot = styled<{}>('div', () => ({
65
+ position: 'relative',
66
+ height: `${xSmallPinheadDimension.height}px`,
67
+ width: `${xSmallPinheadDimension.height}px`,
68
+ }));
69
+
70
+ export const FloatingMarkerPinHeadContainer = styled<{
71
+ $anchor: AnchorPositionsT,
72
+ $anchorSize: number,
73
+ }>('div', ({$theme, $anchor, $anchorSize}) => ({
74
+ position: 'absolute',
75
+ transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
76
+ transform: getAnchorTransform($anchor, $anchorSize),
77
+ }));
78
+
79
+ export const FloatingMarkerAnchorContainer = styled<{}>('div', () => ({
80
+ position: 'absolute',
81
+ }));
82
+
83
+ export const FixedMarkerRoot = styled<{}>('div', () => ({
84
+ display: 'flex',
85
+ alignItems: 'center',
86
+ flexDirection: 'column',
87
+ }));
88
+
89
+ export const FixedMarkerDragContainer = styled<{
90
+ $translateAmount: number,
91
+ $performTranslate: boolean,
92
+ }>('div', ({$theme, $translateAmount, $performTranslate}) => {
93
+ return {
94
+ transform: `translateY(${
95
+ $performTranslate ? '0px' : `${$translateAmount}px`
96
+ })`,
97
+ transition: `${$theme.animation.timing300} ${$theme.animation.easeOutCurve} all`,
98
+ display: 'flex',
99
+ alignItems: 'center',
100
+ flexDirection: 'column',
101
+ };
102
+ });
103
+
104
+ export const OuterXSmallAnchor = styled<{
105
+ $round: boolean,
106
+ $background: string,
107
+ $size: number,
108
+ }>('div', ({$theme, $round, $background, $size}) => ({
109
+ background: $background,
110
+ display: 'flex',
111
+ alignItems: 'center',
112
+ justifyContent: 'center',
113
+ height: `${$size}px`,
114
+ width: `${$size}px`,
115
+ borderRadius: $round ? '50%' : 0,
116
+ boxShadow: $theme.lighting.shadow600,
117
+ }));
118
+
119
+ export const InnerXSmallAnchor = styled<{
120
+ $round: boolean,
121
+ $color: string,
122
+ $size: number,
123
+ }>('div', ({$round, $color, $size}) => ({
124
+ background: $color,
125
+ height: `${$size}px`,
126
+ width: `${$size}px`,
127
+ borderRadius: $round ? '50%' : 0,
128
+ }));
129
+
130
+ export const PinHead = styled<{
131
+ $height: number,
132
+ $background: string,
133
+ $gridTemplateColumns: string,
134
+ $type: string,
135
+ $forceCircle: boolean,
136
+ }>(
137
+ 'div',
138
+ ({
139
+ $theme,
140
+ $height,
141
+ $background,
142
+ $gridTemplateColumns,
143
+ $type,
144
+ $forceCircle,
145
+ }) => {
146
+ const sharedStyles = {
147
+ fixed: {
148
+ padding: '0px 12px',
149
+ borderRadius: `${$height}px`,
150
+ },
151
+ floating: {
152
+ padding: '0px 8px',
153
+ },
154
+ };
155
+
156
+ return {
157
+ background: $background,
158
+ height: `${$height}px`,
159
+ display: 'grid',
160
+ gridTemplateColumns: $gridTemplateColumns,
161
+ gap: '8px',
162
+ boxShadow: $theme.lighting.shadow600,
163
+ whiteSpace: 'nowrap',
164
+ ...sharedStyles[$type],
165
+ ...($forceCircle && {
166
+ width: `${$height}px`,
167
+ display: 'flex',
168
+ justifyContent: 'center',
169
+ boxSizing: 'border-box',
170
+ }),
171
+ };
172
+ },
173
+ );
174
+
175
+ declare var __DEV__: boolean;
176
+ declare var __NODE__: boolean;
177
+ declare var __BROWSER__: boolean;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ var React = _interopRequireWildcard(require("react"));
6
+
7
+ var _constants = require("./constants.js");
8
+
9
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
10
+
11
+ 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; }
@@ -0,0 +1,114 @@
1
+ /*
2
+ Copyright (c) Uber Technologies, Inc.
3
+
4
+ This source code is licensed under the MIT license found in the
5
+ LICENSE file in the root directory of this source tree.
6
+ */
7
+ // @flow
8
+ import * as React from 'react';
9
+ import {
10
+ FLOATING_MARKER_ANCHOR_POSITIONS,
11
+ NEEDLE_SIZES,
12
+ PINHEAD_SIZES_SHAPES,
13
+ FLOATING_MARKER_SIZES,
14
+ PINHEAD_TYPES,
15
+ FLOATING_MARKER_ANCHOR_TYPES,
16
+ } from './constants.js';
17
+ import type {OverrideT} from '../helpers/overrides.js';
18
+
19
+ export type PinHeadT = $Values<typeof PINHEAD_TYPES>;
20
+
21
+ export type AnchorPositionsT = $Values<typeof FLOATING_MARKER_ANCHOR_POSITIONS>;
22
+
23
+ export type NeedleSizeT = $Values<typeof NEEDLE_SIZES>;
24
+
25
+ export type PinHeadSizeT = $Values<typeof PINHEAD_SIZES_SHAPES>;
26
+
27
+ export type FloatingMarkerSizeT = $Values<typeof FLOATING_MARKER_SIZES>;
28
+
29
+ /* eslint-disable flowtype/generic-spacing*/
30
+ export type FloatingMarkerAnchorTypeT = $Values<
31
+ typeof FLOATING_MARKER_ANCHOR_TYPES,
32
+ >;
33
+
34
+ export type NeedlePropsT = {
35
+ size: NeedleSizeT,
36
+ background?: string,
37
+ overrides: FixedMarkerOverridesT,
38
+ };
39
+
40
+ export type ItemPropsT = {
41
+ children?: React.Node,
42
+ color?: string,
43
+ size?: number,
44
+ };
45
+
46
+ export type FixedMarkerOverridesT = {
47
+ Root?: OverrideT,
48
+ InnerAnchor?: OverrideT,
49
+ OuterAnchor?: OverrideT,
50
+ PinHead?: OverrideT,
51
+ PinHeadContent?: OverrideT,
52
+ PinHeadContainer?: OverrideT,
53
+ Needle?: OverrideT,
54
+ DragShadow?: OverrideT,
55
+ DragShadowContainer?: OverrideT,
56
+ DragContainer?: OverrideT,
57
+ };
58
+
59
+ export type FixedMarkerPropsT = {
60
+ size?: PinHeadSizeT,
61
+ needle?: NeedleSizeT,
62
+ label?: string,
63
+ startEnhancer?: React.AbstractComponent<{|size: number|}>,
64
+ endEnhancer?: React.AbstractComponent<{|size: number|}>,
65
+ color?: string,
66
+ background?: string,
67
+ dragging?: boolean,
68
+ overrides?: FixedMarkerOverridesT,
69
+ };
70
+
71
+ export type FloatingMarkerOverridesT = {
72
+ Root?: OverrideT,
73
+ InnerAnchor?: OverrideT,
74
+ OuterAnchor?: OverrideT,
75
+ PinHead?: OverrideT,
76
+ PinHeadContent?: OverrideT,
77
+ PinHeadContainer?: OverrideT,
78
+ AnchorContainer?: OverrideT,
79
+ };
80
+
81
+ export type FloatingMarkerPropsT = {
82
+ color?: string,
83
+ background?: string,
84
+ label?: string,
85
+ anchor?: AnchorPositionsT,
86
+ endEnhancer?: React.AbstractComponent<{|size: number|}>,
87
+ startEnhancer?: React.AbstractComponent<{|size: number|}>,
88
+ anchorType?: FloatingMarkerAnchorTypeT,
89
+ size?: FloatingMarkerSizeT,
90
+ overrides?: FloatingMarkerOverridesT,
91
+ };
92
+
93
+ export type PinHeadPropsT = {
94
+ size?: PinHeadSizeT,
95
+ label?: string,
96
+ endEnhancer?: React.AbstractComponent<{|size: number|}>,
97
+ startEnhancer?: React.AbstractComponent<{|size: number|}>,
98
+ color?: string,
99
+ background?: string,
100
+ type?: PinHeadT,
101
+ anchorType?: FloatingMarkerAnchorTypeT,
102
+ overrides?: FloatingMarkerOverridesT | FixedMarkerOverridesT,
103
+ };
104
+
105
+ export type DragShadowPropsT = {
106
+ background: string,
107
+ dragging: boolean,
108
+ height: number,
109
+ overrides: FixedMarkerOverridesT,
110
+ };
111
+
112
+ declare var __DEV__: boolean;
113
+ declare var __NODE__: boolean;
114
+ declare var __BROWSER__: boolean;
package/menu/index.d.ts CHANGED
@@ -123,6 +123,7 @@ export interface OptionListProps extends BaseMenuPropsT {
123
123
  item: any;
124
124
  getItemLabel: (item: any) => React.ReactNode;
125
125
  getChildMenu?: (item: any) => React.ReactNode;
126
+ onMouseDown?: (event: MouseEvent) => any;
126
127
  onMouseEnter?: (event: MouseEvent) => any;
127
128
  size?: OPTION_LIST_SIZE[keyof OPTION_LIST_SIZE];
128
129
  overrides?: {
@@ -133,6 +134,12 @@ export interface OptionListProps extends BaseMenuPropsT {
133
134
  resetMenu?: () => void;
134
135
  $isHighlighted?: boolean;
135
136
  $isFocused?: boolean;
137
+ renderAll?: boolean;
138
+ $disabled?: boolean;
139
+ 'aria-disabled'?: boolean;
140
+ 'aria-selected'?: boolean;
141
+ id?: string;
142
+ role?: string;
136
143
  }
137
144
  export const OptionList: React.FC<OptionListProps>;
138
145
 
@@ -234,6 +234,8 @@ export type OptionListPropsT = {
234
234
  getChildMenu?: (item: ItemT) => React.Node,
235
235
  onClick?: (event: MouseEvent) => mixed,
236
236
  /** Callback used to change highlighted index in stateful menu. */
237
+ onMouseDown?: (event: MouseEvent) => mixed,
238
+ /** Callback used to change highlighted index in stateful menu. */
237
239
  onMouseEnter?: (event: MouseEvent) => mixed,
238
240
  /** Renders UI in defined scale. */
239
241
  size?: $Keys<typeof OPTION_LIST_SIZE>,
@@ -251,6 +253,16 @@ export type OptionListPropsT = {
251
253
  $isFocused?: boolean,
252
254
  /** Renders all menu content for SEO purposes regardless of menu state */
253
255
  renderAll?: boolean,
256
+ /** Is the item disabled */
257
+ $disabled?: boolean,
258
+ /** Is the item disabled */
259
+ 'aria-disabled'?: boolean,
260
+ /** Is the item selected */
261
+ 'aria-selected'?: boolean,
262
+ /** Id of the item */
263
+ id?: string,
264
+ /** Accessibility role of the item */
265
+ role?: string,
254
266
  };
255
267
 
256
268
  export type OptionProfilePropsT = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseui",
3
- "version": "10.2.1",
3
+ "version": "10.6.0",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",
@@ -81,7 +81,7 @@
81
81
  "@commitlint/config-conventional": "^8.0.0",
82
82
  "@date-io/luxon": "^2.7.0",
83
83
  "@date-io/moment": "^2.7.0",
84
- "@ladle/react": "^0.2.0",
84
+ "@ladle/react": "^0.3.0",
85
85
  "@mdx-js/tag": "^0.20.0",
86
86
  "@octokit/rest": "^16.33.1",
87
87
  "@svgr/cli": "^4.3.2",
@@ -170,6 +170,7 @@
170
170
  "react-dom": "^16.9.0",
171
171
  "react-hook-form": "^7.9.0",
172
172
  "react-icons": "^3.8.0",
173
+ "react-map-gl": "^6.1.17",
173
174
  "react-markdown": "^4.0.3",
174
175
  "react-twitter-embed": "^2.0.8",
175
176
  "react-view": "^2.3.3",
@@ -70,6 +70,10 @@ var StatefulContainer = /*#__PURE__*/function (_React$Component) {
70
70
  _this.props.onBlur(e);
71
71
  }
72
72
 
73
+ if (_this.props.focusLock || _this.props.autoFocus) {
74
+ return;
75
+ }
76
+
73
77
  _this.close();
74
78
  });
75
79
 
@@ -52,6 +52,9 @@ class StatefulContainer extends React.Component<
52
52
  if (this.props.onBlur) {
53
53
  this.props.onBlur(e);
54
54
  }
55
+ if (this.props.focusLock || this.props.autoFocus) {
56
+ return;
57
+ }
55
58
  this.close();
56
59
  };
57
60
 
@@ -222,8 +222,8 @@ var EmoticonRating = /*#__PURE__*/function (_React$Component) {
222
222
  return /*#__PURE__*/React.createElement(Root, _extends({
223
223
  "data-baseweb": "emoticon-rating",
224
224
  role: "radiogroup",
225
- onBlur: function onBlur() {
226
- return _this2.updatePreview(undefined);
225
+ onBlur: function onBlur(e) {
226
+ if (!e.currentTarget.contains(e.relatedTarget)) _this2.updatePreview(undefined);
227
227
  },
228
228
  onMouseLeave: function onMouseLeave() {
229
229
  return _this2.updatePreview(undefined);
@@ -135,7 +135,10 @@ class EmoticonRating extends React.Component<
135
135
  <Root
136
136
  data-baseweb="emoticon-rating"
137
137
  role="radiogroup"
138
- onBlur={() => this.updatePreview(undefined)}
138
+ onBlur={e => {
139
+ if (!e.currentTarget.contains(e.relatedTarget))
140
+ this.updatePreview(undefined);
141
+ }}
139
142
  onMouseLeave={() => this.updatePreview(undefined)}
140
143
  {...rootProps}
141
144
  >
@@ -225,8 +225,8 @@ var StarRating = /*#__PURE__*/function (_React$Component) {
225
225
  return /*#__PURE__*/React.createElement(Root, _extends({
226
226
  "data-baseweb": "star-rating",
227
227
  role: "radiogroup",
228
- onBlur: function onBlur() {
229
- return _this2.updatePreview(undefined);
228
+ onBlur: function onBlur(e) {
229
+ if (!e.currentTarget.contains(e.relatedTarget)) _this2.updatePreview(undefined);
230
230
  },
231
231
  onMouseLeave: function onMouseLeave() {
232
232
  return _this2.updatePreview(undefined);
@@ -133,7 +133,10 @@ class StarRating extends React.Component<StarRatingPropsT, RatingStateT> {
133
133
  <Root
134
134
  data-baseweb="star-rating"
135
135
  role="radiogroup"
136
- onBlur={() => this.updatePreview(undefined)}
136
+ onBlur={e => {
137
+ if (!e.currentTarget.contains(e.relatedTarget))
138
+ this.updatePreview(undefined);
139
+ }}
137
140
  onMouseLeave={() => this.updatePreview(undefined)}
138
141
  {...rootProps}
139
142
  >
@@ -180,7 +180,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
180
180
  isPseudoFocused: false
181
181
  });
182
182
 
183
- _defineProperty(_assertThisInitialized(_this), "isMounted", false);
183
+ _defineProperty(_assertThisInitialized(_this), "isItMounted", false);
184
184
 
185
185
  _defineProperty(_assertThisInitialized(_this), "handleTouchOutside", function (event) {
186
186
  if (containsNode(_this.dropdown.current, event.target)) return;
@@ -328,7 +328,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
328
328
  _this.props.onBlur(event);
329
329
  }
330
330
 
331
- if (_this.isMounted) {
331
+ if (_this.isItMounted) {
332
332
  _this.setState({
333
333
  isFocused: false,
334
334
  isOpen: false,
@@ -682,7 +682,14 @@ var Select = /*#__PURE__*/function (_React$Component) {
682
682
  this.focus();
683
683
  }
684
684
 
685
- this.isMounted = true;
685
+ this.isItMounted = true;
686
+
687
+ if (this.props.methodsRef) {
688
+ var methodsRef = this.props.methodsRef;
689
+ methodsRef.current = {
690
+ setDropdownOpen: this.handleDropdownOpen.bind(this)
691
+ };
692
+ }
686
693
  }
687
694
  }, {
688
695
  key: "componentDidUpdate",
@@ -711,13 +718,20 @@ var Select = /*#__PURE__*/function (_React$Component) {
711
718
  document.removeEventListener('click', this.handleClickOutside);
712
719
  }
713
720
 
714
- this.isMounted = false;
721
+ this.isItMounted = false;
715
722
  }
716
723
  }, {
717
724
  key: "focus",
718
725
  value: function focus() {
719
726
  if (!this.input) return;
720
727
  this.input.focus();
728
+ }
729
+ }, {
730
+ key: "handleDropdownOpen",
731
+ value: function handleDropdownOpen(nextOpenState) {
732
+ this.setState({
733
+ isOpen: nextOpenState
734
+ });
721
735
  } // Handle touch outside on mobile to dismiss menu, ensures that the
722
736
  // touch target is not within the anchor DOM node.
723
737
 
@@ -933,7 +947,6 @@ var Select = /*#__PURE__*/function (_React$Component) {
933
947
 
934
948
  var ariaLabel = this.props.multi ? 'Clear all' : 'Clear value';
935
949
  return /*#__PURE__*/React.createElement(ClearIcon, _extends({
936
- size: 16,
937
950
  title: ariaLabel,
938
951
  "aria-label": ariaLabel,
939
952
  onClick: this.clearValue,
@@ -1013,7 +1026,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
1013
1026
  value: function filterOptions(excludeOptions) {
1014
1027
  var _this5 = this;
1015
1028
 
1016
- var filterValue = this.state.inputValue; // apply filter function
1029
+ var filterValue = this.state.inputValue.trim(); // apply filter function
1017
1030
 
1018
1031
  if (this.props.filterOptions) {
1019
1032
  this.options = this.props.filterOptions(this.options, filterValue, excludeOptions, {
@@ -117,13 +117,21 @@ class Select extends React.Component<PropsT, SelectStateT> {
117
117
  isPseudoFocused: false,
118
118
  };
119
119
 
120
- isMounted: boolean = false;
120
+ isItMounted: boolean = false;
121
121
 
122
122
  componentDidMount() {
123
123
  if (this.props.autoFocus) {
124
124
  this.focus();
125
125
  }
126
- this.isMounted = true;
126
+ this.isItMounted = true;
127
+
128
+ if (this.props.methodsRef) {
129
+ const {methodsRef} = this.props;
130
+
131
+ methodsRef.current = {
132
+ setDropdownOpen: this.handleDropdownOpen.bind(this),
133
+ };
134
+ }
127
135
  }
128
136
 
129
137
  componentDidUpdate(prevProps: PropsT, prevState: SelectStateT) {
@@ -149,7 +157,7 @@ class Select extends React.Component<PropsT, SelectStateT> {
149
157
  document.removeEventListener('touchstart', this.handleTouchOutside);
150
158
  document.removeEventListener('click', this.handleClickOutside);
151
159
  }
152
- this.isMounted = false;
160
+ this.isItMounted = false;
153
161
  }
154
162
 
155
163
  focus() {
@@ -157,6 +165,12 @@ class Select extends React.Component<PropsT, SelectStateT> {
157
165
  this.input.focus();
158
166
  }
159
167
 
168
+ handleDropdownOpen(nextOpenState: boolean) {
169
+ this.setState({
170
+ isOpen: nextOpenState,
171
+ });
172
+ }
173
+
160
174
  // Handle touch outside on mobile to dismiss menu, ensures that the
161
175
  // touch target is not within the anchor DOM node.
162
176
  handleTouchOutside = (event: TouchEvent) => {
@@ -305,7 +319,7 @@ class Select extends React.Component<PropsT, SelectStateT> {
305
319
  this.props.onBlur(event);
306
320
  }
307
321
 
308
- if (this.isMounted) {
322
+ if (this.isItMounted) {
309
323
  this.setState({
310
324
  isFocused: false,
311
325
  isOpen: false,
@@ -779,7 +793,6 @@ class Select extends React.Component<PropsT, SelectStateT> {
779
793
 
780
794
  return (
781
795
  <ClearIcon
782
- size={16}
783
796
  title={ariaLabel}
784
797
  aria-label={ariaLabel}
785
798
  onClick={this.clearValue}
@@ -867,7 +880,7 @@ class Select extends React.Component<PropsT, SelectStateT> {
867
880
  }
868
881
 
869
882
  filterOptions(excludeOptions: ?ValueT) {
870
- const filterValue = this.state.inputValue;
883
+ const filterValue = this.state.inputValue.trim();
871
884
  // apply filter function
872
885
  if (this.props.filterOptions) {
873
886
  this.options = this.props.filterOptions(
@@ -342,26 +342,50 @@ function getSvgStyles(_ref4) {
342
342
  }
343
343
 
344
344
  var StyledSelectArrow = (0, _index.styled)('svg', function (props) {
345
+ var _sizes;
346
+
345
347
  var $theme = props.$theme,
346
- $disabled = props.$disabled;
348
+ $disabled = props.$disabled,
349
+ $size = props.$size;
347
350
  var colors = $theme.colors;
351
+ var sizes = (_sizes = {}, _defineProperty(_sizes, _constants.SIZE.mini, 16), _defineProperty(_sizes, _constants.SIZE.compact, 16), _defineProperty(_sizes, _constants.SIZE.default, 20), _defineProperty(_sizes, _constants.SIZE.large, 24), _sizes);
352
+ var size = sizes[_constants.SIZE.default];
353
+
354
+ if ($size) {
355
+ size = sizes[$size];
356
+ }
357
+
348
358
  return _objectSpread(_objectSpread({}, getSvgStyles({
349
359
  $theme: $theme
350
360
  })), {}, {
351
361
  color: $disabled ? colors.inputTextDisabled : colors.contentPrimary,
352
- cursor: $disabled ? 'not-allowed' : 'pointer'
362
+ cursor: $disabled ? 'not-allowed' : 'pointer',
363
+ height: "".concat(size, "px"),
364
+ width: "".concat(size, "px")
353
365
  });
354
366
  });
355
367
  exports.StyledSelectArrow = StyledSelectArrow;
356
368
  StyledSelectArrow.displayName = "StyledSelectArrow";
357
369
  var StyledClearIcon = (0, _index.styled)('svg', function (props) {
358
- var $theme = props.$theme;
370
+ var _sizes2;
371
+
372
+ var $theme = props.$theme,
373
+ $size = props.$size;
359
374
  var colors = $theme.colors;
375
+ var sizes = (_sizes2 = {}, _defineProperty(_sizes2, _constants.SIZE.mini, 15), _defineProperty(_sizes2, _constants.SIZE.compact, 15), _defineProperty(_sizes2, _constants.SIZE.default, 18), _defineProperty(_sizes2, _constants.SIZE.large, 22), _sizes2);
376
+ var size = sizes[_constants.SIZE.default];
377
+
378
+ if ($size) {
379
+ size = sizes[$size];
380
+ }
381
+
360
382
  return _objectSpread(_objectSpread({}, getSvgStyles({
361
383
  $theme: $theme
362
384
  })), {}, {
363
385
  color: colors.contentPrimary,
364
- cursor: 'pointer'
386
+ cursor: 'pointer',
387
+ height: "".concat(size, "px"),
388
+ width: "".concat(size, "px")
365
389
  });
366
390
  });
367
391
  exports.StyledClearIcon = StyledClearIcon;