grommet 2.41.0 → 2.43.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/all/stories/Colors.js +6 -6
- package/components/Accordion/stories/CustomThemed/Rich.tsx +1 -1
- 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/Box/stories/Background.js +4 -10
- package/components/Button/Button.js +1 -0
- package/components/Button/StyledButton.js +3 -2
- package/components/Calendar/Calendar.js +96 -59
- package/components/Calendar/StyledCalendar.js +89 -7
- package/components/Calendar/utils.js +16 -2
- package/components/Card/stories/Simple.js +2 -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/Cards.js +3 -2
- package/components/Data/stories/Infinite.js +2 -2
- package/components/Data/stories/OnSelect.js +2 -2
- package/components/Data/stories/Properties.js +3 -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/FormField/FormField.js +9 -2
- package/components/FormField/stories/ThresholdValidation.js +5 -1
- package/components/Grommet/index.d.ts +19 -1
- package/components/Grommet/propTypes.js +18 -0
- package/components/Grommet/stories/Theme.js +1 -1
- package/components/Grommet/stories/Vars.js +2 -2
- package/components/Layer/Layer.js +1 -1
- package/components/Layer/index.d.ts +2 -0
- package/components/List/List.js +43 -13
- package/components/List/stories/RenderedList.js +1 -1
- package/components/Meter/Circle.js +2 -2
- package/components/Meter/Meter.js +36 -17
- package/components/Meter/index.d.ts +18 -0
- package/components/Meter/propTypes.js +18 -0
- 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/Pagination/stories/CustomThemed/Custom.tsx +8 -2
- package/components/Pagination/stories/NumberEdgePages.js +2 -0
- package/components/Pagination/stories/NumberMiddlePages.js +2 -0
- package/components/Pagination/stories/Simple.js +4 -2
- package/components/Pagination/stories/Size.js +3 -0
- package/components/Pagination/stories/Steps.js +3 -0
- package/components/RadioButton/RadioButton.js +14 -3
- package/components/RadioButton/stories/Children.js +16 -3
- package/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/components/RadioButtonGroup/stories/Children.js +13 -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/Tabs/stories/Scrollable.js +2 -1
- package/components/Tag/Tag.js +11 -7
- package/components/TextInput/TextInput.js +7 -2
- package/components/ToggleGroup/StyledToggleGroup.js +12 -5
- package/components/ToggleGroup/ToggleGroup.js +21 -10
- package/components/WorldMap/WorldMap.js +1 -1
- package/es6/all/stories/Colors.js +6 -6
- package/es6/components/Accordion/stories/CustomThemed/Rich.tsx +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/Box/stories/Background.js +4 -10
- package/es6/components/Button/Button.js +1 -0
- package/es6/components/Button/StyledButton.js +4 -3
- package/es6/components/Calendar/Calendar.js +95 -59
- package/es6/components/Calendar/StyledCalendar.js +90 -8
- package/es6/components/Calendar/utils.js +15 -1
- package/es6/components/Card/stories/Simple.js +3 -3
- 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/Cards.js +4 -3
- package/es6/components/Data/stories/Infinite.js +2 -2
- package/es6/components/Data/stories/OnSelect.js +2 -2
- package/es6/components/Data/stories/Properties.js +4 -3
- 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/FormField/FormField.js +10 -3
- package/es6/components/FormField/stories/ThresholdValidation.js +5 -1
- package/es6/components/Grommet/index.d.ts +19 -1
- package/es6/components/Grommet/propTypes.js +18 -0
- package/es6/components/Grommet/stories/Theme.js +1 -1
- package/es6/components/Grommet/stories/Vars.js +2 -2
- package/es6/components/Layer/Layer.js +1 -1
- package/es6/components/Layer/index.d.ts +2 -0
- package/es6/components/List/List.js +43 -13
- package/es6/components/List/stories/RenderedList.js +1 -1
- package/es6/components/Meter/Circle.js +2 -2
- package/es6/components/Meter/Meter.js +37 -18
- package/es6/components/Meter/index.d.ts +18 -0
- package/es6/components/Meter/propTypes.js +18 -0
- 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/Pagination/stories/CustomThemed/Custom.tsx +8 -2
- package/es6/components/Pagination/stories/NumberEdgePages.js +2 -0
- package/es6/components/Pagination/stories/NumberMiddlePages.js +2 -0
- package/es6/components/Pagination/stories/Simple.js +4 -2
- package/es6/components/Pagination/stories/Size.js +3 -0
- package/es6/components/Pagination/stories/Steps.js +3 -0
- package/es6/components/RadioButton/RadioButton.js +15 -4
- package/es6/components/RadioButton/stories/Children.js +16 -3
- package/es6/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es6/components/RadioButtonGroup/stories/Children.js +12 -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/Tabs/stories/Scrollable.js +2 -1
- package/es6/components/Tag/Tag.js +11 -7
- package/es6/components/TextInput/TextInput.js +7 -2
- 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/languages/default.json +18 -0
- 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 +17 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +18 -0
- package/package.json +36 -36
- 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 +22 -0
- package/components/CheckBox/stories/InsideButton.js +0 -38
- package/es6/components/CheckBox/stories/InsideButton.js +0 -32
|
@@ -18,8 +18,9 @@ var RadioButton = exports.RadioButton = /*#__PURE__*/(0, _react.forwardRef)(func
|
|
|
18
18
|
checked = _ref.checked,
|
|
19
19
|
children = _ref.children,
|
|
20
20
|
disabled = _ref.disabled,
|
|
21
|
-
|
|
22
|
-
focusIndicator = _ref.focusIndicator,
|
|
21
|
+
focusProp = _ref.focus,
|
|
22
|
+
_ref$focusIndicator = _ref.focusIndicator,
|
|
23
|
+
focusIndicator = _ref$focusIndicator === void 0 ? true : _ref$focusIndicator,
|
|
23
24
|
id = _ref.id,
|
|
24
25
|
label = _ref.label,
|
|
25
26
|
name = _ref.name,
|
|
@@ -31,6 +32,10 @@ var RadioButton = exports.RadioButton = /*#__PURE__*/(0, _react.forwardRef)(func
|
|
|
31
32
|
var _useState = (0, _react.useState)(),
|
|
32
33
|
hover = _useState[0],
|
|
33
34
|
setHover = _useState[1];
|
|
35
|
+
var _useState2 = (0, _react.useState)(focusProp),
|
|
36
|
+
focus = _useState2[0],
|
|
37
|
+
setFocus = _useState2[1];
|
|
38
|
+
var usingKeyboard = (0, _utils.useKeyboard)();
|
|
34
39
|
var normalizedLabel = typeof label === 'string' ? /*#__PURE__*/_react["default"].createElement(_StyledRadioButton.StyledRadioButtonLabel, passThemeFlag, label) : label;
|
|
35
40
|
var Icon = theme.radioButton.icons.circle;
|
|
36
41
|
var borderColor = (0, _utils.normalizeColor)(theme.radioButton.border.color, theme);
|
|
@@ -55,6 +60,12 @@ var RadioButton = exports.RadioButton = /*#__PURE__*/(0, _react.forwardRef)(func
|
|
|
55
60
|
},
|
|
56
61
|
focus: focus,
|
|
57
62
|
focusIndicator: focusIndicator,
|
|
63
|
+
onFocus: function onFocus() {
|
|
64
|
+
return setFocus(true);
|
|
65
|
+
},
|
|
66
|
+
onBlur: function onBlur() {
|
|
67
|
+
return setFocus(false);
|
|
68
|
+
},
|
|
58
69
|
onMouseEnter: function onMouseEnter() {
|
|
59
70
|
return setHover(true);
|
|
60
71
|
},
|
|
@@ -82,7 +93,7 @@ var RadioButton = exports.RadioButton = /*#__PURE__*/(0, _react.forwardRef)(func
|
|
|
82
93
|
focus: focus && focusIndicator,
|
|
83
94
|
hover: hover
|
|
84
95
|
}) : /*#__PURE__*/_react["default"].createElement(_StyledRadioButton.StyledRadioButtonBox, _extends({
|
|
85
|
-
focus: focus && focusIndicator,
|
|
96
|
+
focus: focus && focusIndicator && usingKeyboard,
|
|
86
97
|
align: "center",
|
|
87
98
|
justify: "center",
|
|
88
99
|
width: theme.radioButton.size,
|
|
@@ -5,11 +5,20 @@ exports["default"] = exports.Children = void 0;
|
|
|
5
5
|
var _react = _interopRequireDefault(require("react"));
|
|
6
6
|
var _grommet = require("grommet");
|
|
7
7
|
var _grommetIcons = require("grommet-icons");
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
var _utils = require("grommet/utils");
|
|
8
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
var StyledRadioChild = (0, _styledComponents["default"])(_grommet.Box).withConfig({
|
|
12
|
+
displayName: "Children__StyledRadioChild",
|
|
13
|
+
componentId: "sc-1occfxm-0"
|
|
14
|
+
})(["", ""], function (props) {
|
|
15
|
+
return props.focus && props.keyboard && (0, _utils.focusStyle)();
|
|
16
|
+
});
|
|
9
17
|
var Children = exports.Children = function Children() {
|
|
10
18
|
var _React$useState = _react["default"].useState(),
|
|
11
19
|
selected = _React$useState[0],
|
|
12
20
|
setSelected = _React$useState[1];
|
|
21
|
+
var usingKeyboard = (0, _utils.useKeyboard)();
|
|
13
22
|
return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
14
23
|
align: "center",
|
|
15
24
|
pad: "large",
|
|
@@ -22,10 +31,14 @@ var Children = exports.Children = function Children() {
|
|
|
22
31
|
return setSelected(event.target.value);
|
|
23
32
|
}
|
|
24
33
|
}, function (_ref) {
|
|
25
|
-
var checked = _ref.checked
|
|
26
|
-
|
|
34
|
+
var checked = _ref.checked,
|
|
35
|
+
focus = _ref.focus;
|
|
36
|
+
return /*#__PURE__*/_react["default"].createElement(StyledRadioChild, {
|
|
37
|
+
focus: focus,
|
|
38
|
+
keyboard: usingKeyboard
|
|
39
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommetIcons.Ascend, {
|
|
27
40
|
color: checked ? 'brand' : 'status-unknown'
|
|
28
|
-
});
|
|
41
|
+
}));
|
|
29
42
|
}), /*#__PURE__*/_react["default"].createElement(_grommet.Button, {
|
|
30
43
|
label: "clear",
|
|
31
44
|
onClick: function onClick() {
|
|
@@ -128,7 +128,7 @@ var RadioButtonGroup = exports.RadioButtonGroup = /*#__PURE__*/(0, _react.forwar
|
|
|
128
128
|
// on the first radiobutton
|
|
129
129
|
value === '' && index === 0;
|
|
130
130
|
if (optionRest.checked) {
|
|
131
|
-
console.warn(
|
|
131
|
+
console.warn(// eslint-disable-next-line max-len
|
|
132
132
|
"'checked' prop of an individual RadioButton shouldn't be used in a RadioButtonGroup component. Use the RadioButtonGroup 'value' prop instead.");
|
|
133
133
|
}
|
|
134
134
|
return /*#__PURE__*/_react["default"].createElement(_RadioButton.RadioButton, _extends({
|
|
@@ -5,12 +5,22 @@ exports["default"] = exports.Children = void 0;
|
|
|
5
5
|
var _react = _interopRequireWildcard(require("react"));
|
|
6
6
|
var _grommet = require("grommet");
|
|
7
7
|
var _grommetIcons = require("grommet-icons");
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
var _utils = require("grommet/utils");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
8
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
9
12
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
13
|
+
var StyledRadioChild = (0, _styledComponents["default"])(_grommet.Box).withConfig({
|
|
14
|
+
displayName: "Children__StyledRadioChild",
|
|
15
|
+
componentId: "sc-19d15gj-0"
|
|
16
|
+
})(["", ""], function (props) {
|
|
17
|
+
return props.focus && props.keyboard && (0, _utils.focusStyle)();
|
|
18
|
+
});
|
|
10
19
|
var Children = exports.Children = function Children() {
|
|
11
20
|
var _useState = (0, _react.useState)(),
|
|
12
21
|
value = _useState[0],
|
|
13
22
|
setValue = _useState[1];
|
|
23
|
+
var usingKeyboard = (0, _utils.useKeyboard)();
|
|
14
24
|
return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
15
25
|
align: "center",
|
|
16
26
|
pad: "large"
|
|
@@ -30,7 +40,9 @@ var Children = exports.Children = function Children() {
|
|
|
30
40
|
var Icon = option === 'asc' ? _grommetIcons.Ascend : _grommetIcons.Descend;
|
|
31
41
|
var background;
|
|
32
42
|
if (checked) background = 'brand';else if (hover) background = 'light-4';else if (focus) background = 'light-4';else background = 'light-2';
|
|
33
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
43
|
+
return /*#__PURE__*/_react["default"].createElement(StyledRadioChild, {
|
|
44
|
+
focus: focus,
|
|
45
|
+
keyboard: usingKeyboard,
|
|
34
46
|
background: background,
|
|
35
47
|
pad: "xsmall"
|
|
36
48
|
}, /*#__PURE__*/_react["default"].createElement(Icon, null));
|
|
@@ -229,7 +229,7 @@ var Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
229
229
|
var selectValue = (0, _react.useMemo)(function () {
|
|
230
230
|
if (valueLabel instanceof Function) {
|
|
231
231
|
if (value || value === 0 || value === false) return valueLabel(value);
|
|
232
|
-
} else if (valueLabel) return valueLabel;else if (
|
|
232
|
+
} else if (valueLabel) return valueLabel;else if (/*#__PURE__*/_react["default"].isValidElement(value)) return value; // deprecated
|
|
233
233
|
return undefined;
|
|
234
234
|
}, [value, valueLabel]);
|
|
235
235
|
var displayLabelKey = (0, _react.useMemo)(function () {
|
|
@@ -266,7 +266,7 @@ var Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
266
266
|
id: 'select.selected',
|
|
267
267
|
messages: messages,
|
|
268
268
|
values: {
|
|
269
|
-
currentSelectedValue: value
|
|
269
|
+
currentSelectedValue: (0, _utils2.formatValueForA11y)(value, labelKey)
|
|
270
270
|
}
|
|
271
271
|
}) : ''),
|
|
272
272
|
"aria-expanded": Boolean(open),
|
|
@@ -277,7 +277,7 @@ var Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
277
277
|
dropTarget: dropTarget,
|
|
278
278
|
open: open,
|
|
279
279
|
alignSelf: alignSelf,
|
|
280
|
-
focusIndicator: focusIndicator,
|
|
280
|
+
focusIndicator: plain ? focusIndicator : true,
|
|
281
281
|
onFocus: onFocus,
|
|
282
282
|
onBlur: onBlur,
|
|
283
283
|
gridArea: gridArea,
|
|
@@ -331,6 +331,8 @@ var Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
331
331
|
type: "text",
|
|
332
332
|
name: name,
|
|
333
333
|
id: id ? id + "__input" : undefined,
|
|
334
|
+
inert: "" // revisit for React 19
|
|
335
|
+
,
|
|
334
336
|
value: inputValue,
|
|
335
337
|
ref: inputRef,
|
|
336
338
|
readOnly: true
|
|
@@ -338,6 +340,8 @@ var Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
338
340
|
a11yTitle: (ariaLabel || a11yTitle) && "" + (ariaLabel || a11yTitle) + (value && typeof value === 'string' ? ", " + value : ''),
|
|
339
341
|
disabled: disabled,
|
|
340
342
|
id: id,
|
|
343
|
+
inert: "" // revisit for React 19
|
|
344
|
+
,
|
|
341
345
|
name: name,
|
|
342
346
|
ref: inputRef,
|
|
343
347
|
placeholder: placeholder,
|
|
@@ -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) {
|
|
@@ -22,7 +22,8 @@ var ScrollableTabs = function ScrollableTabs() {
|
|
|
22
22
|
overflow: "auto",
|
|
23
23
|
pad: "xlarge",
|
|
24
24
|
align: "center",
|
|
25
|
-
background: "light-2"
|
|
25
|
+
background: "light-2",
|
|
26
|
+
tabIndex: 0
|
|
26
27
|
}, /*#__PURE__*/_react["default"].createElement(_grommet.Heading, null, "Title"), /*#__PURE__*/_react["default"].createElement(_grommet.Paragraph, null, /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
|
|
27
28
|
weight: "bold"
|
|
28
29
|
}, "This is a tab with a lot of content. If you scroll down, the tabs header remains in view.")), /*#__PURE__*/_react["default"].createElement(_grommet.Paragraph, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam porttitor ipsum a ligula tincidunt, tempor posuere massa gravida. Morbi at magna lacus. Vivamus eu consequat lectus. Quisque a aliquam risus. Ut vel dignissim nunc. Etiam rhoncus pellentesque porttitor. Sed nec gravida nisl. Cras justo ex, condimentum at dolor vel, lacinia efficitur dui. Nullam pellentesque metus nec felis gravida, vel suscipit sem condimentum. Ut hendrerit varius enim. Donec congue vestibulum neque accumsan fermentum. Nulla facilisi. Praesent ornare id magna vitae malesuada. Aenean nulla enim, pretium ac est vel, tristique condimentum ex. Phasellus ante enim, pellentesque ut arcu sit amet, semper sodales dolor."), /*#__PURE__*/_react["default"].createElement(_grommet.Paragraph, null, "Proin sollicitudin dui eget diam mollis mattis eget id magna. Pellentesque tristique aliquet leo, a euismod velit molestie non. Donec lacinia, lectus quis mollis pretium, turpis erat sollicitudin mauris, vitae luctus velit lacus eu metus. Nam pulvinar mauris vitae massa faucibus, id semper sapien facilisis. Integer a congue ex. Vestibulum dapibus est fermentum felis hendrerit vulputate. Fusce libero odio, posuere sit amet mi vitae, cursus aliquam nulla. Nunc ornare augue vitae mauris ultricies gravida. In quis enim at nisi semper ultrices. Nunc posuere sed libero in facilisis."), /*#__PURE__*/_react["default"].createElement(_grommet.Paragraph, null, "Etiam sit amet ligula nunc. Pellentesque pulvinar nisl ornare dui molestie, sed faucibus elit rhoncus. In nec pellentesque enim, eget ultricies tortor. Phasellus tincidunt ultrices tortor vitae malesuada. Proin rhoncus maximus mauris, a commodo tortor blandit quis. Phasellus tincidunt luctus dapibus. Sed in imperdiet enim. Vivamus varius ut dolor non scelerisque. Praesent volutpat ligula sodales augue auctor tempor. Quisque eleifend eleifend turpis nec egestas. Nunc dapibus semper commodo. Sed volutpat arcu eleifend ipsum volutpat, eu sagittis leo hendrerit. Nulla consequat justo non erat finibus cursus. Integer porttitor ante in ultrices semper."), /*#__PURE__*/_react["default"].createElement(_grommet.Paragraph, null, "Praesent vel tellus sagittis, fringilla arcu vel, sodales turpis. Nam id accumsan nibh. Pellentesque eget diam eleifend, ultrices diam ac, suscipit ipsum. Curabitur euismod sodales sem vel ultricies. Proin euismod ipsum eros, ut efficitur felis pharetra finibus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Ut tincidunt posuere augue at porttitor. Sed venenatis iaculis est, sit amet interdum magna varius ut. In euismod scelerisque velit, vel aliquet enim. Etiam lacinia justo nec nibh aliquam, et pulvinar eros luctus. Fusce quis nisi eu tellus imperdiet bibendum ac id nulla. Proin ut tincidunt libero. Phasellus sed velit eu risus hendrerit suscipit at eget felis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus at blandit est. Phasellus fringilla nibh ac est scelerisque, id faucibus enim interdum."))), /*#__PURE__*/_react["default"].createElement(_grommet.Tab, {
|
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,
|
|
@@ -49,7 +49,7 @@ var defaultDropAlign = {
|
|
|
49
49
|
left: 'left'
|
|
50
50
|
};
|
|
51
51
|
var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
52
|
-
var _inputRef$current;
|
|
52
|
+
var _inputRef$current, _inputRef$current2;
|
|
53
53
|
var a11yTitle = _ref.a11yTitle,
|
|
54
54
|
defaultSuggestion = _ref.defaultSuggestion,
|
|
55
55
|
defaultValue = _ref.defaultValue,
|
|
@@ -238,6 +238,11 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
238
238
|
return clearTimeout(timer);
|
|
239
239
|
};
|
|
240
240
|
}, [activeSuggestionIndex, showDrop]);
|
|
241
|
+
(0, _react.useEffect)(function () {
|
|
242
|
+
if (readOnly && inputRef != null && inputRef.current && inputRef.current.scrollLeft > 0) {
|
|
243
|
+
inputRef.current.scrollLeft = 0;
|
|
244
|
+
}
|
|
245
|
+
}, [readOnly, inputRef, inputRef == null || (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.scrollLeft]);
|
|
241
246
|
var setValueFromSuggestion = function setValueFromSuggestion(event, suggestion) {
|
|
242
247
|
// if we stole the focus in the drop, perhaps by interacting with
|
|
243
248
|
// a suggestion button or the scrollbar, give it back
|
|
@@ -266,7 +271,7 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
266
271
|
}, [activeSuggestionIndex]);
|
|
267
272
|
|
|
268
273
|
// account for input value in both controlled and uncontrolled scenarios
|
|
269
|
-
var hasValue = value || ((_inputRef$
|
|
274
|
+
var hasValue = value || ((_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.value);
|
|
270
275
|
var showStyledPlaceholder = (0, _react.useMemo)(function () {
|
|
271
276
|
return placeholder && typeof placeholder !== 'string' && !hasValue;
|
|
272
277
|
}, [hasValue, placeholder]);
|
|
@@ -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]
|