baseui 10.5.0 → 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.
- package/button/styled-components.js +1 -1
- package/button/styled-components.js.flow +4 -1
- package/datepicker/calendar-header.js +227 -95
- package/datepicker/calendar-header.js.flow +270 -139
- package/datepicker/constants.js +4 -2
- package/datepicker/constants.js.flow +2 -0
- package/datepicker/day.js +1 -0
- package/datepicker/day.js.flow +1 -0
- package/datepicker/index.d.ts +1 -0
- package/datepicker/types.js.flow +1 -0
- package/datepicker/utils/calendar-header-helpers.js +51 -0
- package/datepicker/utils/calendar-header-helpers.js.flow +53 -0
- package/dnd-list/index.js.flow +2 -1
- package/drawer/drawer.js +2 -1
- package/drawer/drawer.js.flow +1 -1
- package/es/button/styled-components.js +1 -1
- package/es/datepicker/calendar-header.js +184 -84
- package/es/datepicker/constants.js +2 -1
- package/es/datepicker/day.js +1 -0
- package/es/datepicker/utils/calendar-header-helpers.js +34 -0
- package/es/dnd-list/index.js +2 -1
- package/es/drawer/drawer.js +2 -1
- package/es/popover/stateful-container.js +4 -0
- package/es/rating/emoticon-rating.js +3 -1
- package/es/rating/star-rating.js +3 -1
- package/es/select/select-component.js +4 -5
- package/es/select/styled-components.js +34 -4
- package/es/snackbar/snackbar-context.js +16 -4
- package/es/table-semantic/styled-components.js +6 -4
- package/es/table-semantic/table-builder.js +3 -0
- package/es/themes/dark-theme/color-component-tokens.js +1 -1
- package/es/themes/light-theme/color-component-tokens.js +9 -9
- package/es/tooltip/styled-components.js +8 -0
- package/esm/button/styled-components.js +1 -1
- package/esm/datepicker/calendar-header.js +226 -95
- package/esm/datepicker/constants.js +2 -1
- package/esm/datepicker/day.js +1 -0
- package/esm/datepicker/utils/calendar-header-helpers.js +45 -0
- package/esm/dnd-list/index.js +2 -1
- package/esm/drawer/drawer.js +2 -1
- package/esm/popover/stateful-container.js +4 -0
- package/esm/rating/emoticon-rating.js +2 -2
- package/esm/rating/star-rating.js +2 -2
- package/esm/select/select-component.js +4 -5
- package/esm/select/styled-components.js +28 -4
- package/esm/snackbar/snackbar-context.js +16 -4
- package/esm/table-semantic/styled-components.js +6 -4
- package/esm/table-semantic/table-builder.js +3 -0
- package/esm/themes/dark-theme/color-component-tokens.js +1 -1
- package/esm/themes/light-theme/color-component-tokens.js +9 -9
- package/esm/tooltip/styled-components.js +8 -0
- package/link/index.d.ts +1 -0
- package/menu/index.d.ts +7 -0
- package/menu/types.js.flow +12 -0
- package/package.json +2 -2
- package/popover/stateful-container.js +4 -0
- package/popover/stateful-container.js.flow +3 -0
- package/rating/emoticon-rating.js +2 -2
- package/rating/emoticon-rating.js.flow +4 -1
- package/rating/star-rating.js +2 -2
- package/rating/star-rating.js.flow +4 -1
- package/select/select-component.js +4 -5
- package/select/select-component.js.flow +4 -5
- package/select/styled-components.js +28 -4
- package/select/styled-components.js.flow +30 -2
- package/snackbar/snackbar-context.js +15 -4
- package/snackbar/snackbar-context.js.flow +15 -3
- package/table-semantic/styled-components.js +6 -4
- package/table-semantic/styled-components.js.flow +6 -4
- package/table-semantic/table-builder.js +3 -0
- package/table-semantic/table-builder.js.flow +3 -0
- package/themes/dark-theme/color-component-tokens.js +1 -1
- package/themes/dark-theme/color-component-tokens.js.flow +1 -1
- package/themes/light-theme/color-component-tokens.js +9 -9
- package/themes/light-theme/color-component-tokens.js.flow +9 -9
- package/tooltip/styled-components.js +8 -0
- package/tooltip/styled-components.js.flow +8 -0
|
@@ -326,25 +326,49 @@ function getSvgStyles(_ref4) {
|
|
|
326
326
|
}
|
|
327
327
|
|
|
328
328
|
export var StyledSelectArrow = styled('svg', function (props) {
|
|
329
|
+
var _sizes;
|
|
330
|
+
|
|
329
331
|
var $theme = props.$theme,
|
|
330
|
-
$disabled = props.$disabled
|
|
332
|
+
$disabled = props.$disabled,
|
|
333
|
+
$size = props.$size;
|
|
331
334
|
var colors = $theme.colors;
|
|
335
|
+
var sizes = (_sizes = {}, _defineProperty(_sizes, SIZE.mini, 16), _defineProperty(_sizes, SIZE.compact, 16), _defineProperty(_sizes, SIZE.default, 20), _defineProperty(_sizes, SIZE.large, 24), _sizes);
|
|
336
|
+
var size = sizes[SIZE.default];
|
|
337
|
+
|
|
338
|
+
if ($size) {
|
|
339
|
+
size = sizes[$size];
|
|
340
|
+
}
|
|
341
|
+
|
|
332
342
|
return _objectSpread(_objectSpread({}, getSvgStyles({
|
|
333
343
|
$theme: $theme
|
|
334
344
|
})), {}, {
|
|
335
345
|
color: $disabled ? colors.inputTextDisabled : colors.contentPrimary,
|
|
336
|
-
cursor: $disabled ? 'not-allowed' : 'pointer'
|
|
346
|
+
cursor: $disabled ? 'not-allowed' : 'pointer',
|
|
347
|
+
height: "".concat(size, "px"),
|
|
348
|
+
width: "".concat(size, "px")
|
|
337
349
|
});
|
|
338
350
|
});
|
|
339
351
|
StyledSelectArrow.displayName = "StyledSelectArrow";
|
|
340
352
|
export var StyledClearIcon = styled('svg', function (props) {
|
|
341
|
-
var
|
|
353
|
+
var _sizes2;
|
|
354
|
+
|
|
355
|
+
var $theme = props.$theme,
|
|
356
|
+
$size = props.$size;
|
|
342
357
|
var colors = $theme.colors;
|
|
358
|
+
var sizes = (_sizes2 = {}, _defineProperty(_sizes2, SIZE.mini, 15), _defineProperty(_sizes2, SIZE.compact, 15), _defineProperty(_sizes2, SIZE.default, 18), _defineProperty(_sizes2, SIZE.large, 22), _sizes2);
|
|
359
|
+
var size = sizes[SIZE.default];
|
|
360
|
+
|
|
361
|
+
if ($size) {
|
|
362
|
+
size = sizes[$size];
|
|
363
|
+
}
|
|
364
|
+
|
|
343
365
|
return _objectSpread(_objectSpread({}, getSvgStyles({
|
|
344
366
|
$theme: $theme
|
|
345
367
|
})), {}, {
|
|
346
368
|
color: colors.contentPrimary,
|
|
347
|
-
cursor: 'pointer'
|
|
369
|
+
cursor: 'pointer',
|
|
370
|
+
height: "".concat(size, "px"),
|
|
371
|
+
width: "".concat(size, "px")
|
|
348
372
|
});
|
|
349
373
|
});
|
|
350
374
|
StyledClearIcon.displayName = "StyledClearIcon";
|
|
@@ -61,6 +61,15 @@ export function useSnackbar() {
|
|
|
61
61
|
dequeue: context.dequeue
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
+
|
|
65
|
+
function usePrevious(value) {
|
|
66
|
+
var ref = React.useRef();
|
|
67
|
+
React.useEffect(function () {
|
|
68
|
+
ref.current = value;
|
|
69
|
+
});
|
|
70
|
+
return ref.current;
|
|
71
|
+
}
|
|
72
|
+
|
|
64
73
|
export default function SnackbarProvider(_ref) {
|
|
65
74
|
var children = _ref.children,
|
|
66
75
|
_ref$overrides = _ref.overrides,
|
|
@@ -95,10 +104,6 @@ export default function SnackbarProvider(_ref) {
|
|
|
95
104
|
function enqueue(elementProps) {
|
|
96
105
|
var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultDuration;
|
|
97
106
|
setSnackbars(function (prev) {
|
|
98
|
-
if (prev.length === 0) {
|
|
99
|
-
enter(duration);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
107
|
return [].concat(_toConsumableArray(prev), [{
|
|
103
108
|
elementProps: elementProps,
|
|
104
109
|
duration: duration
|
|
@@ -106,6 +111,13 @@ export default function SnackbarProvider(_ref) {
|
|
|
106
111
|
});
|
|
107
112
|
}
|
|
108
113
|
|
|
114
|
+
var prevSnackbars = usePrevious(snackbars) || [];
|
|
115
|
+
React.useEffect(function () {
|
|
116
|
+
if (prevSnackbars.length === 0 && snackbars.length >= 1) {
|
|
117
|
+
enter(snackbars[0].duration);
|
|
118
|
+
}
|
|
119
|
+
}, [snackbars, prevSnackbars]);
|
|
120
|
+
|
|
109
121
|
function dequeue() {
|
|
110
122
|
setContainerHeight(0);
|
|
111
123
|
setSnackbars(function (prev) {
|
|
@@ -70,7 +70,8 @@ export var StyledTableHeadCell = styled('th', function (_ref5) {
|
|
|
70
70
|
|
|
71
71
|
var $theme = _ref5.$theme,
|
|
72
72
|
$size = _ref5.$size,
|
|
73
|
-
$divider = _ref5.$divider
|
|
73
|
+
$divider = _ref5.$divider,
|
|
74
|
+
$isNumeric = _ref5.$isNumeric;
|
|
74
75
|
var borderDir = $theme.direction === 'rtl' ? 'Left' : 'Right';
|
|
75
76
|
var borderVertical = $divider === DIVIDER.grid || $divider === DIVIDER.vertical;
|
|
76
77
|
var padding = sizeToCellPadding($theme, $size);
|
|
@@ -83,7 +84,7 @@ export var StyledTableHeadCell = styled('th', function (_ref5) {
|
|
|
83
84
|
paddingLeft: padding,
|
|
84
85
|
backgroundColor: $theme.colors.tableHeadBackgroundColor,
|
|
85
86
|
color: $theme.colors.contentPrimary,
|
|
86
|
-
textAlign: $theme.direction === 'rtl' ? 'right' : 'left',
|
|
87
|
+
textAlign: $theme.direction === 'rtl' || $isNumeric ? 'right' : 'left',
|
|
87
88
|
verticalAlign: 'top',
|
|
88
89
|
whiteSpace: 'nowrap',
|
|
89
90
|
zIndex: 1
|
|
@@ -164,14 +165,15 @@ export var StyledTableBodyCell = styled('td', function (_ref12) {
|
|
|
164
165
|
$size = _ref12.$size,
|
|
165
166
|
$divider = _ref12.$divider,
|
|
166
167
|
$isNumeric = _ref12.$isNumeric,
|
|
167
|
-
$isLastRow = _ref12.$isLastRow
|
|
168
|
+
$isLastRow = _ref12.$isLastRow,
|
|
169
|
+
$isSortable = _ref12.$isSortable;
|
|
168
170
|
var borderDir = $theme.direction === 'rtl' ? 'Left' : 'Right';
|
|
169
171
|
var borderVertical = $divider === DIVIDER.vertical || $divider === DIVIDER.grid;
|
|
170
172
|
var borderHorizontal = $divider === undefined || $divider === DIVIDER.horizontal || $divider === DIVIDER.grid;
|
|
171
173
|
var padding = sizeToCellPadding($theme, $size);
|
|
172
174
|
return _objectSpread(_objectSpread({}, $theme.typography.font200), {}, {
|
|
173
175
|
paddingTop: padding,
|
|
174
|
-
paddingRight: padding,
|
|
176
|
+
paddingRight: !$isSortable ? padding : $theme.sizing.scale1000,
|
|
175
177
|
paddingBottom: padding,
|
|
176
178
|
paddingLeft: padding,
|
|
177
179
|
color: $theme.colors.contentPrimary,
|
|
@@ -200,6 +200,7 @@ var TableBuilder = /*#__PURE__*/function (_React$Component) {
|
|
|
200
200
|
$col: col,
|
|
201
201
|
$colIndex: colIndex,
|
|
202
202
|
$divider: divider,
|
|
203
|
+
$isNumeric: col.numeric,
|
|
203
204
|
$size: size
|
|
204
205
|
}, tableHeadCellProps, colTableHeadCellProps), col.header);
|
|
205
206
|
}
|
|
@@ -242,6 +243,7 @@ var TableBuilder = /*#__PURE__*/function (_React$Component) {
|
|
|
242
243
|
$col: col,
|
|
243
244
|
$colIndex: colIndex,
|
|
244
245
|
$divider: divider,
|
|
246
|
+
$isNumeric: col.numeric,
|
|
245
247
|
role: "button",
|
|
246
248
|
tabIndex: "0",
|
|
247
249
|
"aria-label": "".concat(col.tableHeadAriaLabel || col.header, ", ").concat(sortLabel),
|
|
@@ -275,6 +277,7 @@ var TableBuilder = /*#__PURE__*/function (_React$Component) {
|
|
|
275
277
|
$rowIndex: rowIndex,
|
|
276
278
|
$isNumeric: col.numeric,
|
|
277
279
|
$isLastRow: rowIndex === lastRowindex,
|
|
280
|
+
$isSortable: col.sortable,
|
|
278
281
|
$size: size
|
|
279
282
|
}, tableBodyCellProps, colTableBodyCellProps), col.children(row, rowIndex));
|
|
280
283
|
}
|
|
@@ -93,7 +93,7 @@ export default (function () {
|
|
|
93
93
|
linkActive: themePrimitives.primary300,
|
|
94
94
|
// List
|
|
95
95
|
listHeaderFill: themePrimitives.mono600,
|
|
96
|
-
listBodyFill: themePrimitives.
|
|
96
|
+
listBodyFill: themePrimitives.mono800,
|
|
97
97
|
listIconFill: themePrimitives.mono100,
|
|
98
98
|
listBorder: themePrimitives.mono500,
|
|
99
99
|
// ProgressSteps
|
|
@@ -22,32 +22,32 @@ export default (function () {
|
|
|
22
22
|
buttonPrimaryActive: themePrimitives.primary600,
|
|
23
23
|
buttonPrimarySelectedFill: themePrimitives.primary600,
|
|
24
24
|
buttonPrimarySelectedText: themePrimitives.white,
|
|
25
|
-
buttonPrimarySpinnerForeground: themePrimitives.
|
|
26
|
-
buttonPrimarySpinnerBackground: themePrimitives.
|
|
25
|
+
buttonPrimarySpinnerForeground: themePrimitives.accent,
|
|
26
|
+
buttonPrimarySpinnerBackground: themePrimitives.primaryB,
|
|
27
27
|
buttonSecondaryFill: themePrimitives.primary100,
|
|
28
28
|
buttonSecondaryText: themePrimitives.primary,
|
|
29
29
|
buttonSecondaryHover: themePrimitives.primary200,
|
|
30
30
|
buttonSecondaryActive: themePrimitives.primary300,
|
|
31
31
|
buttonSecondarySelectedFill: themePrimitives.primary300,
|
|
32
32
|
buttonSecondarySelectedText: themePrimitives.primary,
|
|
33
|
-
buttonSecondarySpinnerForeground: themePrimitives.
|
|
34
|
-
buttonSecondarySpinnerBackground: themePrimitives.
|
|
33
|
+
buttonSecondarySpinnerForeground: themePrimitives.accent,
|
|
34
|
+
buttonSecondarySpinnerBackground: themePrimitives.primaryB,
|
|
35
35
|
buttonTertiaryFill: 'transparent',
|
|
36
36
|
buttonTertiaryText: themePrimitives.primary,
|
|
37
37
|
buttonTertiaryHover: themePrimitives.primary50,
|
|
38
38
|
buttonTertiaryActive: themePrimitives.primary100,
|
|
39
39
|
buttonTertiarySelectedFill: themePrimitives.primary100,
|
|
40
40
|
buttonTertiarySelectedText: themePrimitives.primary,
|
|
41
|
-
buttonTertiarySpinnerForeground: themePrimitives.
|
|
42
|
-
buttonTertiarySpinnerBackground: themePrimitives.
|
|
41
|
+
buttonTertiarySpinnerForeground: themePrimitives.accent,
|
|
42
|
+
buttonTertiarySpinnerBackground: themePrimitives.primary100,
|
|
43
43
|
buttonMinimalFill: 'transparent',
|
|
44
44
|
buttonMinimalText: themePrimitives.primary,
|
|
45
45
|
buttonMinimalHover: themePrimitives.primary50,
|
|
46
46
|
buttonMinimalActive: themePrimitives.primary100,
|
|
47
47
|
buttonMinimalSelectedFill: themePrimitives.primary100,
|
|
48
48
|
buttonMinimalSelectedText: themePrimitives.primary,
|
|
49
|
-
buttonMinimalSpinnerForeground: themePrimitives.
|
|
50
|
-
buttonMinimalSpinnerBackground: themePrimitives.
|
|
49
|
+
buttonMinimalSpinnerForeground: themePrimitives.accent,
|
|
50
|
+
buttonMinimalSpinnerBackground: themePrimitives.primary100,
|
|
51
51
|
buttonDisabledFill: themePrimitives.mono200,
|
|
52
52
|
buttonDisabledText: themePrimitives.mono600,
|
|
53
53
|
buttonDisabledSpinnerForeground: themePrimitives.mono600,
|
|
@@ -93,7 +93,7 @@ export default (function () {
|
|
|
93
93
|
linkActive: themePrimitives.primary500,
|
|
94
94
|
// List
|
|
95
95
|
listHeaderFill: themePrimitives.white,
|
|
96
|
-
listBodyFill: themePrimitives.
|
|
96
|
+
listBodyFill: themePrimitives.white,
|
|
97
97
|
listIconFill: themePrimitives.mono500,
|
|
98
98
|
listBorder: themePrimitives.mono500,
|
|
99
99
|
// ProgressSteps
|
|
@@ -28,6 +28,10 @@ import { getEndPosition } from '../popover/utils.js';
|
|
|
28
28
|
export var Body = styled('div', function (props) {
|
|
29
29
|
return _objectSpread(_objectSpread({}, getBodyStyles(props)), {}, {
|
|
30
30
|
backgroundColor: props.$theme.colors.tooltipBackground,
|
|
31
|
+
borderTopLeftRadius: props.$theme.borders.radius300,
|
|
32
|
+
borderTopRightRadius: props.$theme.borders.radius300,
|
|
33
|
+
borderBottomRightRadius: props.$theme.borders.radius300,
|
|
34
|
+
borderBottomLeftRadius: props.$theme.borders.radius300,
|
|
31
35
|
boxShadow: props.$theme.lighting.shadow400,
|
|
32
36
|
color: props.$theme.colors.tooltipText,
|
|
33
37
|
// Reset transition property to opacity only, and static transform
|
|
@@ -39,6 +43,10 @@ Body.displayName = "Body";
|
|
|
39
43
|
export var Inner = styled('div', function (props) {
|
|
40
44
|
return _objectSpread(_objectSpread(_objectSpread({}, getInnerStyles(props)), {}, {
|
|
41
45
|
backgroundColor: props.$theme.colors.tooltipBackground,
|
|
46
|
+
borderTopLeftRadius: props.$theme.borders.radius300,
|
|
47
|
+
borderTopRightRadius: props.$theme.borders.radius300,
|
|
48
|
+
borderBottomRightRadius: props.$theme.borders.radius300,
|
|
49
|
+
borderBottomLeftRadius: props.$theme.borders.radius300,
|
|
42
50
|
paddingTop: props.$theme.sizing.scale300,
|
|
43
51
|
paddingBottom: props.$theme.sizing.scale300,
|
|
44
52
|
paddingLeft: props.$theme.sizing.scale600,
|
package/link/index.d.ts
CHANGED
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
|
|
package/menu/types.js.flow
CHANGED
|
@@ -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.
|
|
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.
|
|
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",
|
|
@@ -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
|
-
|
|
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={
|
|
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
|
>
|
package/rating/star-rating.js
CHANGED
|
@@ -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
|
-
|
|
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={
|
|
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), "
|
|
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.
|
|
331
|
+
if (_this.isItMounted) {
|
|
332
332
|
_this.setState({
|
|
333
333
|
isFocused: false,
|
|
334
334
|
isOpen: false,
|
|
@@ -682,7 +682,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
682
682
|
this.focus();
|
|
683
683
|
}
|
|
684
684
|
|
|
685
|
-
this.
|
|
685
|
+
this.isItMounted = true;
|
|
686
686
|
|
|
687
687
|
if (this.props.methodsRef) {
|
|
688
688
|
var methodsRef = this.props.methodsRef;
|
|
@@ -718,7 +718,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
718
718
|
document.removeEventListener('click', this.handleClickOutside);
|
|
719
719
|
}
|
|
720
720
|
|
|
721
|
-
this.
|
|
721
|
+
this.isItMounted = false;
|
|
722
722
|
}
|
|
723
723
|
}, {
|
|
724
724
|
key: "focus",
|
|
@@ -947,7 +947,6 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
947
947
|
|
|
948
948
|
var ariaLabel = this.props.multi ? 'Clear all' : 'Clear value';
|
|
949
949
|
return /*#__PURE__*/React.createElement(ClearIcon, _extends({
|
|
950
|
-
size: 16,
|
|
951
950
|
title: ariaLabel,
|
|
952
951
|
"aria-label": ariaLabel,
|
|
953
952
|
onClick: this.clearValue,
|
|
@@ -117,13 +117,13 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
117
117
|
isPseudoFocused: false,
|
|
118
118
|
};
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
isItMounted: boolean = false;
|
|
121
121
|
|
|
122
122
|
componentDidMount() {
|
|
123
123
|
if (this.props.autoFocus) {
|
|
124
124
|
this.focus();
|
|
125
125
|
}
|
|
126
|
-
this.
|
|
126
|
+
this.isItMounted = true;
|
|
127
127
|
|
|
128
128
|
if (this.props.methodsRef) {
|
|
129
129
|
const {methodsRef} = this.props;
|
|
@@ -157,7 +157,7 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
157
157
|
document.removeEventListener('touchstart', this.handleTouchOutside);
|
|
158
158
|
document.removeEventListener('click', this.handleClickOutside);
|
|
159
159
|
}
|
|
160
|
-
this.
|
|
160
|
+
this.isItMounted = false;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
focus() {
|
|
@@ -319,7 +319,7 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
319
319
|
this.props.onBlur(event);
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
if (this.
|
|
322
|
+
if (this.isItMounted) {
|
|
323
323
|
this.setState({
|
|
324
324
|
isFocused: false,
|
|
325
325
|
isOpen: false,
|
|
@@ -793,7 +793,6 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
793
793
|
|
|
794
794
|
return (
|
|
795
795
|
<ClearIcon
|
|
796
|
-
size={16}
|
|
797
796
|
title={ariaLabel}
|
|
798
797
|
aria-label={ariaLabel}
|
|
799
798
|
onClick={this.clearValue}
|
|
@@ -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
|
|
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;
|
|
@@ -425,22 +425,50 @@ function getSvgStyles({$theme}) {
|
|
|
425
425
|
}
|
|
426
426
|
|
|
427
427
|
export const StyledSelectArrow = styled<SharedStylePropsArgT>('svg', props => {
|
|
428
|
-
const {$theme, $disabled} = props;
|
|
428
|
+
const {$theme, $disabled, $size} = props;
|
|
429
429
|
const {colors} = $theme;
|
|
430
|
+
|
|
431
|
+
const sizes = {
|
|
432
|
+
[SIZE.mini]: 16,
|
|
433
|
+
[SIZE.compact]: 16,
|
|
434
|
+
[SIZE.default]: 20,
|
|
435
|
+
[SIZE.large]: 24,
|
|
436
|
+
};
|
|
437
|
+
let size = sizes[SIZE.default];
|
|
438
|
+
if ($size) {
|
|
439
|
+
size = sizes[$size];
|
|
440
|
+
}
|
|
441
|
+
|
|
430
442
|
return {
|
|
431
443
|
...getSvgStyles({$theme}),
|
|
432
444
|
color: $disabled ? colors.inputTextDisabled : colors.contentPrimary,
|
|
433
445
|
cursor: $disabled ? 'not-allowed' : 'pointer',
|
|
446
|
+
height: `${size}px`,
|
|
447
|
+
width: `${size}px`,
|
|
434
448
|
};
|
|
435
449
|
});
|
|
436
450
|
|
|
437
451
|
export const StyledClearIcon = styled<SharedStylePropsArgT>('svg', props => {
|
|
438
|
-
const {$theme} = props;
|
|
452
|
+
const {$theme, $size} = props;
|
|
439
453
|
const {colors} = $theme;
|
|
454
|
+
|
|
455
|
+
const sizes = {
|
|
456
|
+
[SIZE.mini]: 15,
|
|
457
|
+
[SIZE.compact]: 15,
|
|
458
|
+
[SIZE.default]: 18,
|
|
459
|
+
[SIZE.large]: 22,
|
|
460
|
+
};
|
|
461
|
+
let size = sizes[SIZE.default];
|
|
462
|
+
if ($size) {
|
|
463
|
+
size = sizes[$size];
|
|
464
|
+
}
|
|
465
|
+
|
|
440
466
|
return {
|
|
441
467
|
...getSvgStyles({$theme}),
|
|
442
468
|
color: colors.contentPrimary,
|
|
443
469
|
cursor: 'pointer',
|
|
470
|
+
height: `${size}px`,
|
|
471
|
+
width: `${size}px`,
|
|
444
472
|
};
|
|
445
473
|
});
|
|
446
474
|
|
|
@@ -81,6 +81,14 @@ function useSnackbar() {
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
function usePrevious(value) {
|
|
85
|
+
var ref = React.useRef();
|
|
86
|
+
React.useEffect(function () {
|
|
87
|
+
ref.current = value;
|
|
88
|
+
});
|
|
89
|
+
return ref.current;
|
|
90
|
+
}
|
|
91
|
+
|
|
84
92
|
function SnackbarProvider(_ref) {
|
|
85
93
|
var children = _ref.children,
|
|
86
94
|
_ref$overrides = _ref.overrides,
|
|
@@ -115,10 +123,6 @@ function SnackbarProvider(_ref) {
|
|
|
115
123
|
function enqueue(elementProps) {
|
|
116
124
|
var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultDuration;
|
|
117
125
|
setSnackbars(function (prev) {
|
|
118
|
-
if (prev.length === 0) {
|
|
119
|
-
enter(duration);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
126
|
return [].concat(_toConsumableArray(prev), [{
|
|
123
127
|
elementProps: elementProps,
|
|
124
128
|
duration: duration
|
|
@@ -126,6 +130,13 @@ function SnackbarProvider(_ref) {
|
|
|
126
130
|
});
|
|
127
131
|
}
|
|
128
132
|
|
|
133
|
+
var prevSnackbars = usePrevious(snackbars) || [];
|
|
134
|
+
React.useEffect(function () {
|
|
135
|
+
if (prevSnackbars.length === 0 && snackbars.length >= 1) {
|
|
136
|
+
enter(snackbars[0].duration);
|
|
137
|
+
}
|
|
138
|
+
}, [snackbars, prevSnackbars]);
|
|
139
|
+
|
|
129
140
|
function dequeue() {
|
|
130
141
|
setContainerHeight(0);
|
|
131
142
|
setSnackbars(function (prev) {
|
|
@@ -43,6 +43,14 @@ export function useSnackbar() {
|
|
|
43
43
|
return {enqueue: context.enqueue, dequeue: context.dequeue};
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
function usePrevious(value) {
|
|
47
|
+
const ref = React.useRef();
|
|
48
|
+
React.useEffect(() => {
|
|
49
|
+
ref.current = value;
|
|
50
|
+
});
|
|
51
|
+
return ref.current;
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
export default function SnackbarProvider({
|
|
47
55
|
children,
|
|
48
56
|
overrides = {},
|
|
@@ -61,13 +69,17 @@ export default function SnackbarProvider({
|
|
|
61
69
|
|
|
62
70
|
function enqueue(elementProps, duration = defaultDuration) {
|
|
63
71
|
setSnackbars(prev => {
|
|
64
|
-
if (prev.length === 0) {
|
|
65
|
-
enter(duration);
|
|
66
|
-
}
|
|
67
72
|
return [...prev, {elementProps, duration}];
|
|
68
73
|
});
|
|
69
74
|
}
|
|
70
75
|
|
|
76
|
+
const prevSnackbars = usePrevious(snackbars) || [];
|
|
77
|
+
React.useEffect(() => {
|
|
78
|
+
if (prevSnackbars.length === 0 && snackbars.length >= 1) {
|
|
79
|
+
enter(snackbars[0].duration);
|
|
80
|
+
}
|
|
81
|
+
}, [snackbars, prevSnackbars]);
|
|
82
|
+
|
|
71
83
|
function dequeue() {
|
|
72
84
|
setContainerHeight(0);
|
|
73
85
|
|