grommet 2.41.0 → 2.42.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/components/AccordionPanel/AccordionPanel.js +1 -7
- package/components/Box/Box.js +1 -1
- package/components/Box/StyledBox.js +1 -6
- package/components/Box/index.d.ts +1 -0
- package/components/Box/propTypes.js +1 -0
- package/components/Button/Button.js +1 -0
- package/components/Button/StyledButton.js +3 -2
- package/components/Calendar/Calendar.js +90 -56
- package/components/Calendar/StyledCalendar.js +89 -7
- package/components/Calendar/utils.js +16 -2
- package/components/Carousel/Carousel.js +1 -1
- package/components/Chart/Chart.js +3 -3
- package/components/CheckBox/CheckBox.js +3 -2
- package/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
- package/components/Clock/Digital.js +1 -1
- package/components/Data/stories/Infinite.js +2 -2
- package/components/Data/stories/OnSelect.js +2 -2
- package/components/Data/stories/SpaceX.js +2 -2
- package/components/Data/stories/StarWars.js +1 -1
- package/components/DataFilter/DataFilter.js +1 -1
- package/components/DataSort/DataSort.js +46 -14
- package/components/DataSort/stories/Simple.js +10 -1
- package/components/DataTable/Body.js +14 -8
- package/components/DataTable/GroupedBody.js +3 -3
- package/components/DataTable/buildState.js +5 -1
- package/components/DataTable/stories/SpaceX.js +2 -2
- package/components/DataTable/stories/SpaceXUngrouped.js +1 -1
- package/components/FileInput/index.d.ts +2 -3
- package/components/Layer/Layer.js +1 -1
- package/components/Layer/index.d.ts +2 -0
- package/components/List/List.js +18 -12
- package/components/Meter/Circle.js +2 -2
- package/components/Notification/Notification.js +18 -6
- package/components/Notification/index.d.ts +1 -0
- package/components/Notification/propTypes.js +1 -0
- package/components/Pagination/Pagination.js +4 -2
- package/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/components/Select/Select.js +7 -3
- package/components/Select/SelectContainer.js +41 -34
- package/components/Select/index.d.ts +1 -1
- package/components/Select/utils.js +13 -2
- package/components/SelectMultiple/SelectMultiple.js +10 -0
- package/components/SelectMultiple/SelectMultipleContainer.js +28 -2
- package/components/SelectMultiple/SelectMultipleValue.js +14 -1
- package/components/SkipLinks/index.d.ts +1 -0
- package/components/SkipLinks/propTypes.js +1 -0
- package/components/Tab/Tab.js +1 -1
- package/components/Tag/Tag.js +11 -7
- package/components/ToggleGroup/StyledToggleGroup.js +12 -5
- package/components/ToggleGroup/ToggleGroup.js +21 -10
- package/components/WorldMap/WorldMap.js +1 -1
- package/es6/components/AccordionPanel/AccordionPanel.js +2 -9
- package/es6/components/Box/Box.js +1 -1
- package/es6/components/Box/StyledBox.js +1 -6
- package/es6/components/Box/index.d.ts +1 -0
- package/es6/components/Box/propTypes.js +1 -0
- package/es6/components/Button/Button.js +1 -0
- package/es6/components/Button/StyledButton.js +4 -3
- package/es6/components/Calendar/Calendar.js +89 -56
- package/es6/components/Calendar/StyledCalendar.js +90 -8
- package/es6/components/Calendar/utils.js +15 -1
- package/es6/components/Carousel/Carousel.js +1 -1
- package/es6/components/Chart/Chart.js +3 -3
- package/es6/components/CheckBox/CheckBox.js +3 -2
- package/es6/components/CheckBoxGroup/CheckBoxGroup.js +1 -1
- package/es6/components/Clock/Digital.js +1 -1
- package/es6/components/Data/stories/Infinite.js +2 -2
- package/es6/components/Data/stories/OnSelect.js +2 -2
- package/es6/components/Data/stories/SpaceX.js +2 -2
- package/es6/components/Data/stories/StarWars.js +1 -1
- package/es6/components/DataFilter/DataFilter.js +1 -1
- package/es6/components/DataSort/DataSort.js +46 -14
- package/es6/components/DataSort/stories/Simple.js +10 -1
- package/es6/components/DataTable/Body.js +14 -8
- package/es6/components/DataTable/GroupedBody.js +3 -3
- package/es6/components/DataTable/buildState.js +5 -1
- package/es6/components/DataTable/stories/SpaceX.js +2 -2
- package/es6/components/DataTable/stories/SpaceXUngrouped.js +1 -1
- package/es6/components/FileInput/index.d.ts +2 -3
- package/es6/components/Layer/Layer.js +1 -1
- package/es6/components/Layer/index.d.ts +2 -0
- package/es6/components/List/List.js +18 -12
- package/es6/components/Meter/Circle.js +2 -2
- package/es6/components/Notification/Notification.js +18 -6
- package/es6/components/Notification/index.d.ts +1 -0
- package/es6/components/Notification/propTypes.js +1 -0
- package/es6/components/Pagination/Pagination.js +4 -2
- package/es6/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es6/components/Select/Select.js +8 -4
- package/es6/components/Select/SelectContainer.js +41 -34
- package/es6/components/Select/index.d.ts +1 -1
- package/es6/components/Select/utils.js +15 -3
- package/es6/components/SelectMultiple/SelectMultiple.js +10 -0
- package/es6/components/SelectMultiple/SelectMultipleContainer.js +28 -2
- package/es6/components/SelectMultiple/SelectMultipleValue.js +14 -1
- package/es6/components/SkipLinks/index.d.ts +1 -0
- package/es6/components/SkipLinks/propTypes.js +1 -0
- package/es6/components/Tab/Tab.js +1 -1
- package/es6/components/Tag/Tag.js +11 -7
- package/es6/components/ToggleGroup/StyledToggleGroup.js +12 -5
- package/es6/components/ToggleGroup/ToggleGroup.js +22 -11
- package/es6/components/WorldMap/WorldMap.js +1 -1
- package/es6/themes/base.d.ts +204 -6
- package/es6/themes/base.js +165 -1
- package/es6/utils/background.js +1 -1
- package/es6/utils/index.js +2 -1
- package/es6/utils/styles.js +8 -0
- package/es6/utils/useId.js +16 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/package.json +33 -33
- package/themes/base.d.ts +204 -6
- package/themes/base.js +165 -1
- package/utils/background.js +1 -1
- package/utils/index.js +6 -0
- package/utils/styles.js +9 -1
- package/utils/useId.js +19 -0
|
@@ -45,41 +45,48 @@ var ClearButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
45
45
|
fill: "horizontal",
|
|
46
46
|
ref: ref,
|
|
47
47
|
onClick: onClear,
|
|
48
|
-
focusIndicator: false
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
focusIndicator: false,
|
|
49
|
+
plain: true
|
|
50
|
+
}, passThemeFlag, rest), function (_ref2) {
|
|
51
|
+
var _theme$select$clear;
|
|
52
|
+
var hover = _ref2.hover;
|
|
53
|
+
var boxProps = _extends({}, theme.select.clear.container);
|
|
54
|
+
delete boxProps.hover; // avoid passing hover object to Box
|
|
55
|
+
return /*#__PURE__*/_react["default"].createElement(_Box.Box, _extends({}, boxProps, hover ? (_theme$select$clear = theme.select.clear) == null || (_theme$select$clear = _theme$select$clear.container) == null ? void 0 : _theme$select$clear.hover : {}, {
|
|
56
|
+
align: align
|
|
57
|
+
}), /*#__PURE__*/_react["default"].createElement(_Text.Text, theme.select.clear.text, buttonLabel));
|
|
58
|
+
});
|
|
52
59
|
});
|
|
53
|
-
var SelectContainer = exports.SelectContainer = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
54
|
-
var clear =
|
|
55
|
-
|
|
56
|
-
children =
|
|
57
|
-
disabled =
|
|
58
|
-
disabledKey =
|
|
59
|
-
dropHeight =
|
|
60
|
-
|
|
61
|
-
emptySearchMessage =
|
|
62
|
-
id =
|
|
63
|
-
labelKey =
|
|
64
|
-
multiple =
|
|
65
|
-
name =
|
|
66
|
-
onChange =
|
|
67
|
-
onKeyDown =
|
|
68
|
-
onMore =
|
|
69
|
-
onSearch =
|
|
70
|
-
optionIndexesInValue =
|
|
71
|
-
options =
|
|
72
|
-
allOptions =
|
|
73
|
-
searchPlaceholder =
|
|
74
|
-
search =
|
|
75
|
-
setSearch =
|
|
76
|
-
selected =
|
|
77
|
-
usingKeyboard =
|
|
78
|
-
|
|
79
|
-
value =
|
|
80
|
-
valueKey =
|
|
81
|
-
|
|
82
|
-
replace =
|
|
60
|
+
var SelectContainer = exports.SelectContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
61
|
+
var clear = _ref3.clear,
|
|
62
|
+
_ref3$children = _ref3.children,
|
|
63
|
+
children = _ref3$children === void 0 ? null : _ref3$children,
|
|
64
|
+
disabled = _ref3.disabled,
|
|
65
|
+
disabledKey = _ref3.disabledKey,
|
|
66
|
+
dropHeight = _ref3.dropHeight,
|
|
67
|
+
_ref3$emptySearchMess = _ref3.emptySearchMessage,
|
|
68
|
+
emptySearchMessage = _ref3$emptySearchMess === void 0 ? 'No matches found' : _ref3$emptySearchMess,
|
|
69
|
+
id = _ref3.id,
|
|
70
|
+
labelKey = _ref3.labelKey,
|
|
71
|
+
multiple = _ref3.multiple,
|
|
72
|
+
name = _ref3.name,
|
|
73
|
+
onChange = _ref3.onChange,
|
|
74
|
+
onKeyDown = _ref3.onKeyDown,
|
|
75
|
+
onMore = _ref3.onMore,
|
|
76
|
+
onSearch = _ref3.onSearch,
|
|
77
|
+
optionIndexesInValue = _ref3.optionIndexesInValue,
|
|
78
|
+
options = _ref3.options,
|
|
79
|
+
allOptions = _ref3.allOptions,
|
|
80
|
+
searchPlaceholder = _ref3.searchPlaceholder,
|
|
81
|
+
search = _ref3.search,
|
|
82
|
+
setSearch = _ref3.setSearch,
|
|
83
|
+
selected = _ref3.selected,
|
|
84
|
+
usingKeyboard = _ref3.usingKeyboard,
|
|
85
|
+
_ref3$value = _ref3.value,
|
|
86
|
+
value = _ref3$value === void 0 ? '' : _ref3$value,
|
|
87
|
+
valueKey = _ref3.valueKey,
|
|
88
|
+
_ref3$replace = _ref3.replace,
|
|
89
|
+
replace = _ref3$replace === void 0 ? true : _ref3$replace;
|
|
83
90
|
var _useThemeValue2 = (0, _useThemeValue3.useThemeValue)(),
|
|
84
91
|
theme = _useThemeValue2.theme,
|
|
85
92
|
passThemeFlag = _useThemeValue2.passThemeFlag;
|
|
@@ -34,7 +34,7 @@ export interface BasicSelectProps {
|
|
|
34
34
|
name?: string;
|
|
35
35
|
onChange?: (...args: any[]) => void;
|
|
36
36
|
onClose?: (...args: any[]) => any;
|
|
37
|
-
onMore?: (
|
|
37
|
+
onMore?: () => void;
|
|
38
38
|
onOpen?: (...args: any[]) => any;
|
|
39
39
|
onSearch?: (search: string) => void;
|
|
40
40
|
options: (string | boolean | number | JSX.Element | object)[];
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.useDisabled = exports.getSelectIcon = exports.getOptionValue = exports.getOptionLabel = exports.getOptionIndex = exports.getNormalizedValue = exports.getIconColor = exports.getDisplayLabelKey = exports.changeEvent = exports.arrayIncludes = exports.applyKey = void 0;
|
|
4
|
+
exports.useDisabled = exports.getSelectIcon = exports.getOptionValue = exports.getOptionLabel = exports.getOptionIndex = exports.getNormalizedValue = exports.getIconColor = exports.getDisplayLabelKey = exports.formatValueForA11y = exports.changeEvent = exports.arrayIncludes = exports.applyKey = void 0;
|
|
5
5
|
var _react = require("react");
|
|
6
6
|
var _utils = require("../../utils");
|
|
7
7
|
var _applyKey = exports.applyKey = function applyKey(option, key) {
|
|
8
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(option)) return option;
|
|
8
9
|
if (option === undefined || option === null) return undefined;
|
|
9
10
|
if (typeof key === 'object') return _applyKey(option, key.key);
|
|
10
11
|
if (typeof key === 'function') return key(option);
|
|
11
12
|
if (key !== undefined && typeof option === 'object') return option[key];
|
|
12
|
-
if (typeof option === 'object' && Object.keys(option)) return option[Object.keys(option)[0]];
|
|
13
|
+
if (typeof option === 'object' && Object.keys(option).length > 0) return option[Object.keys(option)[0]];
|
|
13
14
|
return option;
|
|
14
15
|
};
|
|
15
16
|
var getOptionLabel = exports.getOptionLabel = function getOptionLabel(index, options, labelKey) {
|
|
@@ -96,4 +97,14 @@ var getDisplayLabelKey = exports.getDisplayLabelKey = function getDisplayLabelKe
|
|
|
96
97
|
};
|
|
97
98
|
var getIconColor = exports.getIconColor = function getIconColor(theme) {
|
|
98
99
|
return (0, _utils.normalizeColor)(theme.select.icons.color || 'control', theme);
|
|
100
|
+
};
|
|
101
|
+
var _formatValueForA11y = exports.formatValueForA11y = function formatValueForA11y(value, labelKey) {
|
|
102
|
+
if (typeof value === 'string') return value;
|
|
103
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(value)) return value.toString();
|
|
104
|
+
if (Array.isArray(value)) {
|
|
105
|
+
return value.map(function (item) {
|
|
106
|
+
return _formatValueForA11y(item, labelKey);
|
|
107
|
+
}).join(', ');
|
|
108
|
+
}
|
|
109
|
+
return _applyKey(value, labelKey);
|
|
99
110
|
};
|
|
@@ -409,6 +409,8 @@ var SelectMultiple = exports.SelectMultiple = /*#__PURE__*/(0, _react.forwardRef
|
|
|
409
409
|
defaultCursor: disabled === true || undefined,
|
|
410
410
|
focusIndicator: false,
|
|
411
411
|
id: id ? id + "__input" : undefined,
|
|
412
|
+
inert: "" // revisit for React 19
|
|
413
|
+
,
|
|
412
414
|
name: name,
|
|
413
415
|
width: "100%"
|
|
414
416
|
}, rest, {
|
|
@@ -433,6 +435,8 @@ var SelectMultiple = exports.SelectMultiple = /*#__PURE__*/(0, _react.forwardRef
|
|
|
433
435
|
type: "text",
|
|
434
436
|
name: name,
|
|
435
437
|
id: id ? id + "__input" : undefined,
|
|
438
|
+
inert: "" // revisit for React 19
|
|
439
|
+
,
|
|
436
440
|
value: inputValue,
|
|
437
441
|
ref: inputRef,
|
|
438
442
|
readOnly: true
|
|
@@ -442,6 +446,8 @@ var SelectMultiple = exports.SelectMultiple = /*#__PURE__*/(0, _react.forwardRef
|
|
|
442
446
|
a11yTitle: ariaLabel || a11yTitle,
|
|
443
447
|
disabled: disabled,
|
|
444
448
|
id: id,
|
|
449
|
+
inert: "" // revisit for React 19
|
|
450
|
+
,
|
|
445
451
|
name: name,
|
|
446
452
|
ref: inputRef,
|
|
447
453
|
placeholder: placeholder || 'Select',
|
|
@@ -468,6 +474,8 @@ var SelectMultiple = exports.SelectMultiple = /*#__PURE__*/(0, _react.forwardRef
|
|
|
468
474
|
type: "text",
|
|
469
475
|
name: name,
|
|
470
476
|
id: id ? id + "__input" : undefined,
|
|
477
|
+
inert: "" // revisit for React 19
|
|
478
|
+
,
|
|
471
479
|
value: inputValue,
|
|
472
480
|
ref: inputRef,
|
|
473
481
|
readOnly: true
|
|
@@ -475,6 +483,8 @@ var SelectMultiple = exports.SelectMultiple = /*#__PURE__*/(0, _react.forwardRef
|
|
|
475
483
|
a11yTitle: ariaLabel || a11yTitle,
|
|
476
484
|
disabled: disabled,
|
|
477
485
|
id: id,
|
|
486
|
+
inert: "" // revisit for React 19
|
|
487
|
+
,
|
|
478
488
|
name: name,
|
|
479
489
|
ref: inputRef,
|
|
480
490
|
placeholder: placeholder,
|
|
@@ -370,7 +370,20 @@ var SelectMultipleContainer = exports.SelectMultipleContainer = /*#__PURE__*/(0,
|
|
|
370
370
|
pad: "xsmall",
|
|
371
371
|
tabIndex: "-1",
|
|
372
372
|
checked: optionSelected,
|
|
373
|
-
disabled: optionDisabled
|
|
373
|
+
disabled: optionDisabled,
|
|
374
|
+
inert: "" // revisit for React 19
|
|
375
|
+
,
|
|
376
|
+
containerProps: {
|
|
377
|
+
// in Firefox when we have inert set, the checkbox
|
|
378
|
+
// click event gets swallowed by the checkbox.
|
|
379
|
+
// We need the click event to go the the button
|
|
380
|
+
// around the checkbox so we use pointerEvents =
|
|
381
|
+
// none. For code clarity we decided an inline
|
|
382
|
+
// style made sense here.
|
|
383
|
+
style: {
|
|
384
|
+
pointerEvents: 'none'
|
|
385
|
+
}
|
|
386
|
+
}
|
|
374
387
|
});
|
|
375
388
|
}
|
|
376
389
|
if (!children && search) {
|
|
@@ -392,7 +405,20 @@ var SelectMultipleContainer = exports.SelectMultipleContainer = /*#__PURE__*/(0,
|
|
|
392
405
|
pad: "xsmall",
|
|
393
406
|
tabIndex: "-1",
|
|
394
407
|
checked: optionSelected,
|
|
395
|
-
disabled: optionDisabled
|
|
408
|
+
disabled: optionDisabled,
|
|
409
|
+
inert: "" // revisit for React 19
|
|
410
|
+
,
|
|
411
|
+
containerProps: {
|
|
412
|
+
// in Firefox when we have inert set, the checkbox
|
|
413
|
+
// click event gets swallowed by the checkbox.
|
|
414
|
+
// We need the click event to go the the button
|
|
415
|
+
// around the checkbox so we use pointerEvents =
|
|
416
|
+
// none. For code clarity we decided an inline
|
|
417
|
+
// style made sense here.
|
|
418
|
+
style: {
|
|
419
|
+
pointerEvents: 'none'
|
|
420
|
+
}
|
|
421
|
+
}
|
|
396
422
|
});
|
|
397
423
|
}
|
|
398
424
|
}
|
|
@@ -106,7 +106,20 @@ var SelectMultipleValue = exports.SelectMultipleValue = function SelectMultipleV
|
|
|
106
106
|
key: optionLabel,
|
|
107
107
|
pad: "xsmall",
|
|
108
108
|
tabIndex: "-1",
|
|
109
|
-
checked: optionSelected
|
|
109
|
+
checked: optionSelected,
|
|
110
|
+
inert: "" // revisit for React 19
|
|
111
|
+
,
|
|
112
|
+
containerProps: {
|
|
113
|
+
// in Firefox when we have inert set, the checkbox
|
|
114
|
+
// click event gets swallowed by the checkbox.
|
|
115
|
+
// We need the click event to go the the button
|
|
116
|
+
// around the checkbox so we use pointerEvents =
|
|
117
|
+
// none. For code clarity we decided an inline
|
|
118
|
+
// style made sense here.
|
|
119
|
+
style: {
|
|
120
|
+
pointerEvents: 'none'
|
|
121
|
+
}
|
|
122
|
+
}
|
|
110
123
|
}));
|
|
111
124
|
}
|
|
112
125
|
return undefined;
|
|
@@ -7,6 +7,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
|
|
|
7
7
|
var PropType = {};
|
|
8
8
|
if (process.env.NODE_ENV !== 'production') {
|
|
9
9
|
PropType = {
|
|
10
|
+
id: _propTypes["default"].string,
|
|
10
11
|
children: _propTypes["default"].node.isRequired,
|
|
11
12
|
messages: _propTypes["default"].shape({
|
|
12
13
|
skipTo: _propTypes["default"].string
|
package/components/Tab/Tab.js
CHANGED
|
@@ -95,7 +95,7 @@ var Tab = exports.Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
if (active && disabled) {
|
|
98
|
-
console.warn(
|
|
98
|
+
console.warn(// eslint-disable-next-line max-len
|
|
99
99
|
"Warning: Tab props 'active' and 'disabled' have both been set to TRUE on the same Tab resulting in an interesting Tab state. Is this your intent?");
|
|
100
100
|
}
|
|
101
101
|
if (!plain) {
|
package/components/Tag/Tag.js
CHANGED
|
@@ -15,10 +15,11 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
15
15
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
16
16
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
17
17
|
var Tag = exports.Tag = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
18
|
-
var _theme$tag$icons, _theme$tag$size, _theme$tag$size2, _theme$tag$size3, _theme$tag$size4;
|
|
18
|
+
var _theme$tag$icons, _theme$tag$size, _theme$tag$size2, _theme$tag$size3, _theme$tag$size4, _theme$tag$size5;
|
|
19
19
|
var name = _ref.name,
|
|
20
20
|
value = _ref.value,
|
|
21
|
-
size = _ref.size,
|
|
21
|
+
_ref$size = _ref.size,
|
|
22
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
22
23
|
onRemove = _ref.onRemove,
|
|
23
24
|
onClick = _ref.onClick,
|
|
24
25
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
@@ -50,6 +51,11 @@ var Tag = exports.Tag = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
50
51
|
if (onClick && onRemove) {
|
|
51
52
|
console.warn('Tag cannot combine "onClick" and "onRemove".');
|
|
52
53
|
}
|
|
54
|
+
var removeProps = !theme.tag.remove.kind ? {
|
|
55
|
+
plain: true,
|
|
56
|
+
hoverIndicator: true,
|
|
57
|
+
focusIndicator: true
|
|
58
|
+
} : {};
|
|
53
59
|
return onRemove || !onClick ? /*#__PURE__*/_react["default"].createElement(_Box.Box, _extends({
|
|
54
60
|
flex: false,
|
|
55
61
|
direction: "row",
|
|
@@ -57,13 +63,11 @@ var Tag = exports.Tag = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
57
63
|
min: 'min-content'
|
|
58
64
|
}
|
|
59
65
|
}, containerProps), contents, onRemove && /*#__PURE__*/_react["default"].createElement(_StyledTag.StyledRemoveButton, _extends({
|
|
60
|
-
onClick: onRemove
|
|
61
|
-
|
|
62
|
-
hoverIndicator: true,
|
|
63
|
-
focusIndicator: true,
|
|
66
|
+
onClick: onRemove
|
|
67
|
+
}, removeProps, {
|
|
64
68
|
icon: /*#__PURE__*/_react["default"].createElement(RemoveIcon, (_theme$tag$size3 = theme.tag.size) == null || (_theme$tag$size3 = _theme$tag$size3[size]) == null ? void 0 : _theme$tag$size3.icon),
|
|
65
69
|
round: ((_theme$tag$size4 = theme.tag.size) == null || (_theme$tag$size4 = _theme$tag$size4[size]) == null ? void 0 : _theme$tag$size4.round) || theme.tag.round
|
|
66
|
-
}, theme.tag.remove, passThemeFlag))) : /*#__PURE__*/_react["default"].createElement(_StyledTag.StyledTagButton, _extends({
|
|
70
|
+
}, theme.tag.remove, (_theme$tag$size5 = theme.tag.size) == null || (_theme$tag$size5 = _theme$tag$size5[size]) == null ? void 0 : _theme$tag$size5.remove, passThemeFlag))) : /*#__PURE__*/_react["default"].createElement(_StyledTag.StyledTagButton, _extends({
|
|
67
71
|
flex: false,
|
|
68
72
|
plain: true,
|
|
69
73
|
onClick: onClick,
|
|
@@ -23,14 +23,21 @@ var adjustPad = function adjustPad(value, theme) {
|
|
|
23
23
|
var StyledButton = exports.StyledButton = (0, _styledComponents["default"])(_Button.Button).withConfig({
|
|
24
24
|
displayName: "StyledToggleGroup__StyledButton",
|
|
25
25
|
componentId: "sc-13k5sx8-0"
|
|
26
|
-
})(["
|
|
27
|
-
return
|
|
26
|
+
})(["", " ", ";", " &:hover{", "}"], function (props) {
|
|
27
|
+
return !props.kind && "border: none;";
|
|
28
28
|
}, function (props) {
|
|
29
|
-
|
|
29
|
+
return !props.kind && ['border-radius: 0;', props.round && (0, _utils.roundStyle)(props.round, false, props.theme)];
|
|
30
|
+
}, function (props) {
|
|
31
|
+
var _props$theme, _props$theme2, _props$theme3, _props$theme4, _props$theme5;
|
|
30
32
|
var themePad = props.icon && !props.label && (_props$theme = props.theme) != null && (_props$theme = _props$theme.toggleGroup) != null && (_props$theme = _props$theme.button) != null && (_props$theme = _props$theme.iconOnly) != null && _props$theme.pad ? (_props$theme2 = props.theme) == null || (_props$theme2 = _props$theme2.toggleGroup) == null || (_props$theme2 = _props$theme2.button) == null || (_props$theme2 = _props$theme2.iconOnly) == null ? void 0 : _props$theme2.pad : (_props$theme3 = props.theme) == null || (_props$theme3 = _props$theme3.toggleGroup.button) == null ? void 0 : _props$theme3.pad;
|
|
31
33
|
|
|
32
34
|
// adjust pad for "kind" themes to align with how "kind" themes
|
|
33
35
|
// manages this calculation
|
|
34
|
-
var pad = (_props$theme4 = props.theme) != null && (_props$theme4 = _props$theme4.button) != null && _props$theme4["default"] ? adjustPad(themePad, props.theme) : themePad;
|
|
35
|
-
return (0, _utils.edgeStyle)('padding', pad, false, undefined, props.theme);
|
|
36
|
+
var pad = (_props$theme4 = props.theme) != null && (_props$theme4 = _props$theme4.button) != null && _props$theme4["default"] && (_props$theme5 = props.theme) != null && (_props$theme5 = _props$theme5.button) != null && _props$theme5.intelligentPad ? adjustPad(themePad, props.theme) : themePad;
|
|
37
|
+
return !props.kind && (0, _utils.edgeStyle)('padding', pad, false, undefined, props.theme);
|
|
38
|
+
}, function (props) {
|
|
39
|
+
return (
|
|
40
|
+
// remove hover style from StyledButton/StyledButtonKind theme
|
|
41
|
+
!props.kind && "border: none;\n box-shadow: none;"
|
|
42
|
+
);
|
|
36
43
|
});
|
|
@@ -99,6 +99,11 @@ var ToggleGroup = exports.ToggleGroup = function ToggleGroup(_ref2) {
|
|
|
99
99
|
adjustedEvent.value = nextValue;
|
|
100
100
|
setValue(adjustedEvent);
|
|
101
101
|
};
|
|
102
|
+
|
|
103
|
+
// if caller defines a button "kind", respect that kind style
|
|
104
|
+
var kind = (0, _react.useMemo)(function () {
|
|
105
|
+
return theme.toggleGroup.button.kind;
|
|
106
|
+
}, [theme.toggleGroup.button]);
|
|
102
107
|
return /*#__PURE__*/_react["default"].createElement(_Keyboard.Keyboard, {
|
|
103
108
|
onUp: onPrevious,
|
|
104
109
|
onDown: onNext,
|
|
@@ -133,25 +138,31 @@ var ToggleGroup = exports.ToggleGroup = function ToggleGroup(_ref2) {
|
|
|
133
138
|
optionValue = option;
|
|
134
139
|
}
|
|
135
140
|
var active = Array.isArray(value) ? !!value.includes(optionValue) : value === optionValue;
|
|
136
|
-
var round
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
var round;
|
|
142
|
+
if (!kind) {
|
|
143
|
+
var _theme$toggleGroup$bu;
|
|
144
|
+
if ((_theme$toggleGroup$bu = theme.toggleGroup.button.border) != null && _theme$toggleGroup$bu.radius) {
|
|
145
|
+
round = theme.toggleGroup.button.border.radius;
|
|
146
|
+
} else if (typeof theme.toggleGroup.container.round === 'string' && (index === 0 || index === options.length - 1)) {
|
|
147
|
+
// round corners of first and last buttons to match container
|
|
148
|
+
round = {
|
|
149
|
+
corner: index === 0 ? 'left' : 'right',
|
|
150
|
+
size: theme.toggleGroup.container.round
|
|
151
|
+
};
|
|
152
|
+
} else round = 0;
|
|
143
153
|
}
|
|
144
154
|
return /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
145
|
-
border: index < options.length - 1 ? {
|
|
155
|
+
border: index < options.length - 1 && theme.toggleGroup.divider ? {
|
|
146
156
|
side: 'right',
|
|
147
157
|
color: theme.toggleGroup.divider.color
|
|
148
158
|
} : undefined,
|
|
149
159
|
key: optionValue || index
|
|
150
160
|
}, /*#__PURE__*/_react["default"].createElement(_StyledToggleGroup.StyledButton, _extends({
|
|
151
161
|
active: active,
|
|
152
|
-
"aria-pressed": multiple
|
|
153
|
-
"aria-checked": !multiple
|
|
162
|
+
"aria-pressed": multiple ? active : undefined,
|
|
163
|
+
"aria-checked": !multiple ? active : undefined,
|
|
154
164
|
icon: icon,
|
|
165
|
+
kind: kind,
|
|
155
166
|
label: label,
|
|
156
167
|
tip: tip,
|
|
157
168
|
onClick: function onClick(event) {
|
|
@@ -326,7 +326,7 @@ var WorldMap = exports.WorldMap = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
326
326
|
}, active);
|
|
327
327
|
}
|
|
328
328
|
if (content && targets[index]) {
|
|
329
|
-
placesContent.push(
|
|
329
|
+
placesContent.push(/*#__PURE__*/_react["default"].createElement(_Drop.Drop, _extends({
|
|
330
330
|
key: key || name
|
|
331
331
|
}, dropProps, {
|
|
332
332
|
target: targets[index]
|
|
@@ -2,7 +2,7 @@ var _excluded = ["children", "header", "id", "label", "onClick", "onMouseOut", "
|
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React, { forwardRef, useContext, useMemo, useState } from 'react';
|
|
5
|
-
import { normalizeColor, parseMetricToNum } from '../../utils';
|
|
5
|
+
import { normalizeColor, parseMetricToNum, useId } from '../../utils';
|
|
6
6
|
import { Box } from '../Box';
|
|
7
7
|
import { Button } from '../Button';
|
|
8
8
|
import { Collapsible } from '../Collapsible';
|
|
@@ -10,13 +10,6 @@ import { Heading } from '../Heading';
|
|
|
10
10
|
import { AccordionContext } from '../Accordion/AccordionContext';
|
|
11
11
|
import { AccordionPanelPropTypes } from './propTypes';
|
|
12
12
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
13
|
-
|
|
14
|
-
// Ideally we should use `useId` from react but this is only available
|
|
15
|
-
// in React 18 and we want to keep compatibility with React 17 and 16.
|
|
16
|
-
function getUID() {
|
|
17
|
-
var timestamp = Date.now() + Math.random();
|
|
18
|
-
return "grommet-accordion-button-" + timestamp;
|
|
19
|
-
}
|
|
20
13
|
var AccordionPanel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
21
14
|
var children = _ref.children,
|
|
22
15
|
header = _ref.header,
|
|
@@ -28,7 +21,7 @@ var AccordionPanel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
28
21
|
_onFocus = _ref.onFocus,
|
|
29
22
|
_onBlur = _ref.onBlur,
|
|
30
23
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
31
|
-
var panelButtonId =
|
|
24
|
+
var panelButtonId = useId();
|
|
32
25
|
var _useThemeValue = useThemeValue(),
|
|
33
26
|
theme = _useThemeValue.theme;
|
|
34
27
|
var _useContext = useContext(AccordionContext),
|
|
@@ -110,7 +110,7 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
110
110
|
if (firstIndex === undefined) {
|
|
111
111
|
firstIndex = index;
|
|
112
112
|
} else {
|
|
113
|
-
contents.push(
|
|
113
|
+
contents.push(/*#__PURE__*/React.createElement(StyledBoxGap
|
|
114
114
|
// eslint-disable-next-line react/no-array-index-key
|
|
115
115
|
, _extends({
|
|
116
116
|
key: "gap-" + index,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _FLEX_MAP;
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { alignContentStyle, alignStyle, backgroundStyle, borderStyle, breakpointStyle, edgeStyle, fillStyle, focusStyle, genericStyles, getBreakpointStyle, getHoverIndicatorStyle, heightStyle, overflowStyle, parseMetricToNum, responsiveBorderStyle, widthStyle } from '../../utils';
|
|
4
|
+
import { alignContentStyle, alignStyle, backgroundStyle, borderStyle, breakpointStyle, edgeStyle, elevationStyle, fillStyle, focusStyle, genericStyles, getBreakpointStyle, getHoverIndicatorStyle, heightStyle, overflowStyle, parseMetricToNum, responsiveBorderStyle, widthStyle } from '../../utils';
|
|
5
5
|
import { roundStyle, styledComponentsConfig } from '../../utils/styles';
|
|
6
6
|
import { animationBounds, animationObjectStyle } from '../../utils/animation';
|
|
7
7
|
var BASIS_MAP = {
|
|
@@ -32,11 +32,6 @@ var directionStyle = function directionStyle(direction, theme) {
|
|
|
32
32
|
}
|
|
33
33
|
return styles;
|
|
34
34
|
};
|
|
35
|
-
var elevationStyle = function elevationStyle(elevation) {
|
|
36
|
-
return css(["box-shadow:", ";"], function (props) {
|
|
37
|
-
return props.theme.global.elevation[props.theme.dark ? 'dark' : 'light'][elevation];
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
35
|
var FLEX_MAP = (_FLEX_MAP = {}, _FLEX_MAP[true] = '1 1', _FLEX_MAP[false] = '0 0', _FLEX_MAP.grow = '1 0', _FLEX_MAP.shrink = '0 1', _FLEX_MAP);
|
|
41
36
|
var flexGrowShrinkProp = function flexGrowShrinkProp(flex) {
|
|
42
37
|
if (typeof flex === 'boolean' || typeof flex === 'string') {
|
|
@@ -33,6 +33,7 @@ export interface BoxProps {
|
|
|
33
33
|
background?: BackgroundType;
|
|
34
34
|
basis?: BasisType;
|
|
35
35
|
border?: BorderType;
|
|
36
|
+
cssGap?: boolean;
|
|
36
37
|
direction?: DirectionType;
|
|
37
38
|
elevation?: ElevationType;
|
|
38
39
|
flex?: 'grow' | 'shrink' | boolean | { grow?: number; shrink?: number };
|
|
@@ -26,6 +26,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
26
26
|
background: backgroundDoc,
|
|
27
27
|
basis: PropTypes.oneOfType([PropTypes.oneOf(['xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge', 'full', '1/2', '1/3', '2/3', '1/4', '2/4', '3/4', 'auto']), PropTypes.string]),
|
|
28
28
|
border: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['top', 'left', 'bottom', 'right', 'start', 'end', 'horizontal', 'vertical', 'all', 'between']), BORDER_SHAPE, PropTypes.arrayOf(BORDER_SHAPE)]),
|
|
29
|
+
cssGap: PropTypes.bool,
|
|
29
30
|
direction: PropTypes.oneOf(['row', 'column', 'row-responsive', 'row-reverse', 'column-reverse']),
|
|
30
31
|
elevation: elevationPropType,
|
|
31
32
|
flex: PropTypes.oneOfType([PropTypes.oneOf(['grow', 'shrink']), PropTypes.bool, PropTypes.shape({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import { activeStyle, backgroundStyle, disabledStyle, edgeStyle, focusStyle, unfocusStyle, genericStyles, getHoverIndicatorStyle, normalizeColor } from '../../utils';
|
|
3
|
-
import { styledComponentsConfig } from '../../utils/styles';
|
|
3
|
+
import { elevationStyle, styledComponentsConfig } from '../../utils/styles';
|
|
4
4
|
var radiusStyle = function radiusStyle(props) {
|
|
5
5
|
// border.radius shouldn't impact an only-icon rendering.
|
|
6
6
|
var isIconOnly = props.hasIcon && !props.hasLabel;
|
|
@@ -23,10 +23,11 @@ var padStyle = function padStyle(props) {
|
|
|
23
23
|
return css(["", " ", ""], props.theme.button.padding.vertical, props.theme.button.padding.horizontal);
|
|
24
24
|
};
|
|
25
25
|
var basicStyle = function basicStyle(props) {
|
|
26
|
-
return css(["border:", " solid ", ";border-radius:", ";color:", ";padding:", ";", ""], props.theme.button.border.width, normalizeColor(props.colorValue || props.theme.button.border.color || 'control', props.theme), radiusStyle(props), normalizeColor(props.theme.button.color || 'text', props.theme), padStyle(props), fontStyle(props));
|
|
26
|
+
return css(["border:", " solid ", ";border-radius:", ";", " color:", ";padding:", ";", ""], props.theme.button.border.width, normalizeColor(props.colorValue || props.theme.button.border.color || 'control', props.theme), radiusStyle(props), props.theme.button.elevation && elevationStyle(props.theme.button.elevation), normalizeColor(props.theme.button.color || 'text', props.theme), padStyle(props), fontStyle(props));
|
|
27
27
|
};
|
|
28
28
|
var primaryStyle = function primaryStyle(props) {
|
|
29
|
-
|
|
29
|
+
var _props$theme$button$p, _props$theme$button$p2;
|
|
30
|
+
return css(["", " border-radius:", ";", " ", ""], backgroundStyle(normalizeColor(props.colorValue || props.theme.button.primary && props.theme.button.primary.color || 'control', props.theme), props.theme, props.theme.button.color), radiusStyle(props), ((_props$theme$button$p = props.theme.button.primary) == null ? void 0 : _props$theme$button$p.elevation) && elevationStyle((_props$theme$button$p2 = props.theme.button.primary) == null ? void 0 : _props$theme$button$p2.elevation), props.theme.button.primary && props.theme.button.primary.extend);
|
|
30
31
|
};
|
|
31
32
|
function getHoverColor(props) {
|
|
32
33
|
if (props.colorValue) {
|