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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["drop", "options"];
|
|
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
2
|
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; }
|
|
3
|
+
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); }
|
|
4
4
|
import React, { useContext, useMemo, useState } from 'react';
|
|
5
5
|
import { Descend } from 'grommet-icons/icons/Descend';
|
|
6
6
|
import { DataContext } from '../../contexts/DataContext';
|
|
@@ -29,11 +29,44 @@ var Content = function Content(_ref) {
|
|
|
29
29
|
properties = _useContext.properties;
|
|
30
30
|
var _useContext2 = useContext(MessageContext),
|
|
31
31
|
format = _useContext2.format;
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
var selectProps = useMemo(function () {
|
|
33
|
+
var props = {};
|
|
34
|
+
if (optionsArg) {
|
|
35
|
+
props = {
|
|
36
|
+
options: optionsArg
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (properties && Array.isArray(properties)) {
|
|
40
|
+
props = {
|
|
41
|
+
options: properties
|
|
42
|
+
};
|
|
43
|
+
} else if (properties && typeof properties === 'object') {
|
|
44
|
+
props = {
|
|
45
|
+
options: Object.entries(properties).filter(function (_ref2) {
|
|
46
|
+
var sort = _ref2[1].sort;
|
|
47
|
+
return !(sort === false);
|
|
48
|
+
}).map(function (_ref3) {
|
|
49
|
+
var key = _ref3[0],
|
|
50
|
+
label = _ref3[1].label;
|
|
51
|
+
return {
|
|
52
|
+
key: key,
|
|
53
|
+
label: label || key
|
|
54
|
+
};
|
|
55
|
+
}).sort(function (a, b) {
|
|
56
|
+
return a.label.localeCompare(b.label);
|
|
57
|
+
}),
|
|
58
|
+
valueKey: {
|
|
59
|
+
key: 'key',
|
|
60
|
+
reduce: true
|
|
61
|
+
},
|
|
62
|
+
labelKey: 'label'
|
|
63
|
+
};
|
|
64
|
+
} else {
|
|
65
|
+
props = {
|
|
66
|
+
options: data.length > 0 && Object.keys(data[0]).sort() || data
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return props;
|
|
37
70
|
}, [data, optionsArg, properties]);
|
|
38
71
|
var directionOptions = [{
|
|
39
72
|
label: format({
|
|
@@ -57,11 +90,10 @@ var Content = function Content(_ref) {
|
|
|
57
90
|
id: 'dataSort.by',
|
|
58
91
|
messages: messages == null ? void 0 : messages.dataSort
|
|
59
92
|
})
|
|
60
|
-
}, /*#__PURE__*/React.createElement(Select, {
|
|
93
|
+
}, /*#__PURE__*/React.createElement(Select, _extends({
|
|
61
94
|
id: sortPropertyId,
|
|
62
|
-
name: "_sort.property"
|
|
63
|
-
|
|
64
|
-
})), /*#__PURE__*/React.createElement(FormField, {
|
|
95
|
+
name: "_sort.property"
|
|
96
|
+
}, selectProps))), /*#__PURE__*/React.createElement(FormField, {
|
|
65
97
|
key: "dir",
|
|
66
98
|
htmlFor: sortDirectionId,
|
|
67
99
|
label: format({
|
|
@@ -74,11 +106,11 @@ var Content = function Content(_ref) {
|
|
|
74
106
|
options: directionOptions
|
|
75
107
|
}))];
|
|
76
108
|
};
|
|
77
|
-
export var DataSort = function DataSort(
|
|
109
|
+
export var DataSort = function DataSort(_ref4) {
|
|
78
110
|
var _theme$data$button;
|
|
79
|
-
var drop =
|
|
80
|
-
options =
|
|
81
|
-
rest = _objectWithoutPropertiesLoose(
|
|
111
|
+
var drop = _ref4.drop,
|
|
112
|
+
options = _ref4.options,
|
|
113
|
+
rest = _objectWithoutPropertiesLoose(_ref4, _excluded);
|
|
82
114
|
var _useContext3 = useContext(DataContext),
|
|
83
115
|
dataId = _useContext3.id,
|
|
84
116
|
messages = _useContext3.messages;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Box, Data, DataSort, DataTable } from 'grommet';
|
|
3
3
|
import { columns, DATA } from '../../DataTable/stories/data';
|
|
4
|
+
var properties = {};
|
|
5
|
+
columns.forEach(function (_ref) {
|
|
6
|
+
var property = _ref.property,
|
|
7
|
+
header = _ref.header;
|
|
8
|
+
properties[property] = {
|
|
9
|
+
label: typeof header === 'string' ? header : property
|
|
10
|
+
};
|
|
11
|
+
});
|
|
4
12
|
export var Simple = function Simple() {
|
|
5
13
|
return (
|
|
6
14
|
/*#__PURE__*/
|
|
@@ -12,7 +20,8 @@ export var Simple = function Simple() {
|
|
|
12
20
|
pad: "large",
|
|
13
21
|
gap: "medium"
|
|
14
22
|
}, /*#__PURE__*/React.createElement(Data, {
|
|
15
|
-
data: DATA
|
|
23
|
+
data: DATA,
|
|
24
|
+
properties: properties
|
|
16
25
|
}, /*#__PURE__*/React.createElement(DataSort, null), /*#__PURE__*/React.createElement(DataTable, {
|
|
17
26
|
columns: columns
|
|
18
27
|
})))
|
|
@@ -67,7 +67,7 @@ var Row = /*#__PURE__*/memo(function (_ref) {
|
|
|
67
67
|
return setActive(undefined);
|
|
68
68
|
} : undefined
|
|
69
69
|
}, (selected || onSelect) && /*#__PURE__*/React.createElement(Cell, {
|
|
70
|
-
background: (pinnedOffset == null ? void 0 : pinnedOffset._grommetDataTableSelect) && cellProps.pinned.background || cellProps.background,
|
|
70
|
+
background: isSelected && cellProps.selected.background || (pinnedOffset == null ? void 0 : pinnedOffset._grommetDataTableSelect) && cellProps.pinned.background || cellProps.background,
|
|
71
71
|
border: cellProps.pinned.border || cellProps.border,
|
|
72
72
|
pinnedOffset: pinnedOffset == null ? void 0 : pinnedOffset._grommetDataTableSelect,
|
|
73
73
|
"aria-disabled": isDisabled || !onSelect || undefined,
|
|
@@ -94,6 +94,7 @@ var Row = /*#__PURE__*/memo(function (_ref) {
|
|
|
94
94
|
},
|
|
95
95
|
verticalAlign: verticalAlign
|
|
96
96
|
}), rowDetails && /*#__PURE__*/React.createElement(ExpanderCell, {
|
|
97
|
+
background: isSelected && cellProps.selected.background,
|
|
97
98
|
context: isRowExpanded ? 'groupHeader' : 'body',
|
|
98
99
|
expanded: isRowExpanded,
|
|
99
100
|
onToggle: function onToggle() {
|
|
@@ -110,11 +111,12 @@ var Row = /*#__PURE__*/memo(function (_ref) {
|
|
|
110
111
|
}), columns.map(function (column) {
|
|
111
112
|
return /*#__PURE__*/React.createElement(Cell, {
|
|
112
113
|
key: column.property,
|
|
113
|
-
background: column.pin && cellProps.pinned.background || cellProps.background,
|
|
114
|
+
background: isSelected && cellProps.selected.background || column.pin && cellProps.pinned.background || cellProps.background,
|
|
114
115
|
border: column.pin && cellProps.pinned.border || cellProps.border,
|
|
115
116
|
context: "body",
|
|
116
117
|
column: column,
|
|
117
118
|
datum: datum,
|
|
119
|
+
isSelected: isSelected,
|
|
118
120
|
pad: column.pin && cellProps.pinned.pad || cellProps.pad,
|
|
119
121
|
pinnedOffset: pinnedOffset && pinnedOffset[column.property],
|
|
120
122
|
primaryProperty: primaryProperty,
|
|
@@ -188,13 +190,17 @@ var Body = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
188
190
|
} : undefined
|
|
189
191
|
// The WCAG recommendation for checkboxes is to select them with "Space"
|
|
190
192
|
,
|
|
191
|
-
onSpace: function
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
onSpace: clickableRow ? function (event) {
|
|
194
|
+
event.preventDefault();
|
|
195
|
+
if (typeof onClickRow === 'function') {
|
|
196
|
+
event.persist();
|
|
197
|
+
var adjustedEvent = event;
|
|
198
|
+
adjustedEvent.datum = data == null ? void 0 : data[active];
|
|
199
|
+
onClickRow(adjustedEvent);
|
|
200
|
+
} else if (onClickRow === 'select') {
|
|
201
|
+
selectRow();
|
|
196
202
|
}
|
|
197
|
-
},
|
|
203
|
+
} : undefined,
|
|
198
204
|
onUp: onClickRow && active ? function () {
|
|
199
205
|
return setActive(active - 1);
|
|
200
206
|
} : undefined,
|
|
@@ -133,7 +133,7 @@ export var GroupedBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
133
133
|
key: key,
|
|
134
134
|
size: size
|
|
135
135
|
}, /*#__PURE__*/React.createElement(ExpanderCell, {
|
|
136
|
-
background: cellProps.background,
|
|
136
|
+
background: isSelected && cellProps.selected.background || cellProps.background,
|
|
137
137
|
border: cellProps.border,
|
|
138
138
|
context: context,
|
|
139
139
|
pad: cellProps.pad,
|
|
@@ -141,7 +141,7 @@ export var GroupedBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
141
141
|
expanded: expanded,
|
|
142
142
|
verticalAlign: verticalAlign
|
|
143
143
|
}), (selected || onSelect) && /*#__PURE__*/React.createElement(TableCell, {
|
|
144
|
-
background: cellProps.background,
|
|
144
|
+
background: isSelected && cellProps.selected.background || cellProps.background,
|
|
145
145
|
border: cellProps.pinned.border || cellProps.border,
|
|
146
146
|
plain: "noPad",
|
|
147
147
|
size: "auto",
|
|
@@ -163,7 +163,7 @@ export var GroupedBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
163
163
|
}
|
|
164
164
|
return /*#__PURE__*/React.createElement(Cell, {
|
|
165
165
|
key: column.property,
|
|
166
|
-
background: cellProps.background,
|
|
166
|
+
background: isSelected && cellProps.selected.background || cellProps.background,
|
|
167
167
|
border: cellProps.border,
|
|
168
168
|
context: context,
|
|
169
169
|
column: column,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
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); }
|
|
1
2
|
// This file contains helper functions for DataTable, to keep the component
|
|
2
3
|
// files simpler.
|
|
3
4
|
|
|
@@ -262,6 +263,7 @@ var cellPropertyNames = ['background', 'border', 'pad'];
|
|
|
262
263
|
// For example, background={{ header: { background } }}
|
|
263
264
|
// will become cellProps.header.background
|
|
264
265
|
export var normalizeCellProps = function normalizeCellProps(props, theme) {
|
|
266
|
+
var _theme$dataTable3;
|
|
265
267
|
var result = {};
|
|
266
268
|
tableContextNames.forEach(function (context) {
|
|
267
269
|
result[context] = {
|
|
@@ -297,11 +299,13 @@ export var normalizeCellProps = function normalizeCellProps(props, theme) {
|
|
|
297
299
|
}
|
|
298
300
|
});
|
|
299
301
|
});
|
|
302
|
+
result.body.selected = _extends({}, theme == null || (_theme$dataTable3 = theme.dataTable) == null || (_theme$dataTable3 = _theme$dataTable3.body) == null ? void 0 : _theme$dataTable3.selected);
|
|
300
303
|
return result;
|
|
301
304
|
};
|
|
302
305
|
export var normalizeRowCellProps = function normalizeRowCellProps(rowProps, cellProps, primaryKey, index) {
|
|
303
306
|
var result = {
|
|
304
|
-
pinned: {}
|
|
307
|
+
pinned: {},
|
|
308
|
+
selected: cellProps.selected
|
|
305
309
|
};
|
|
306
310
|
['background', 'border', 'pad'].forEach(function (propName) {
|
|
307
311
|
var _rowProps$primaryKey;
|
|
@@ -114,7 +114,7 @@ export var SpaceX = function SpaceX() {
|
|
|
114
114
|
}, [groups]);
|
|
115
115
|
useEffect(function () {
|
|
116
116
|
var fetchData = /*#__PURE__*/function () {
|
|
117
|
-
var _ref5 = _asyncToGenerator(
|
|
117
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
118
118
|
var query;
|
|
119
119
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
120
120
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -151,7 +151,7 @@ export var SpaceX = function SpaceX() {
|
|
|
151
151
|
}, []);
|
|
152
152
|
useEffect(function () {
|
|
153
153
|
var fetchData = /*#__PURE__*/function () {
|
|
154
|
-
var _ref6 = _asyncToGenerator(
|
|
154
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
155
155
|
var _sort;
|
|
156
156
|
var query;
|
|
157
157
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -64,7 +64,7 @@ export var SpaceXUngrouped = function SpaceXUngrouped() {
|
|
|
64
64
|
setLimit = _useState3[1];
|
|
65
65
|
useEffect(function () {
|
|
66
66
|
var fetchData = /*#__PURE__*/function () {
|
|
67
|
-
var _ref2 = _asyncToGenerator(
|
|
67
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
68
68
|
var _sort;
|
|
69
69
|
var query;
|
|
70
70
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -23,9 +23,8 @@ export interface FileInputProps {
|
|
|
23
23
|
multiple?: boolean | { aggregateThreshold?: number; max?: number };
|
|
24
24
|
name?: string;
|
|
25
25
|
onChange?: (
|
|
26
|
-
event
|
|
27
|
-
{ files }
|
|
28
|
-
{ target }?: { target: { files: FileList } },
|
|
26
|
+
event: React.ChangeEvent<HTMLInputElement>,
|
|
27
|
+
{ files }: { files: File[] },
|
|
29
28
|
) => void;
|
|
30
29
|
renderFile?: (...args: any[]) => void;
|
|
31
30
|
}
|
|
@@ -68,7 +68,7 @@ var Layer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}, [animate, animation, containerTarget, layerContainer, originalFocusedElement]);
|
|
71
|
-
return layerContainer ? /*#__PURE__*/createPortal(
|
|
71
|
+
return layerContainer ? /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement(LayerContainer, _extends({
|
|
72
72
|
ref: ref
|
|
73
73
|
}, props)), layerContainer) : null;
|
|
74
74
|
});
|
|
@@ -258,22 +258,28 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
258
258
|
return /*#__PURE__*/React.createElement(Container, containterProps, /*#__PURE__*/React.createElement(Keyboard, {
|
|
259
259
|
onEnter: onSelectOption,
|
|
260
260
|
onSpace: function onSpace(event) {
|
|
261
|
-
|
|
261
|
+
if (onClickItem || onOrder) {
|
|
262
|
+
event.preventDefault();
|
|
263
|
+
}
|
|
262
264
|
onSelectOption(event);
|
|
263
265
|
},
|
|
264
266
|
onUp: function onUp(event) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
if (onClickItem || onOrder) {
|
|
268
|
+
event.preventDefault();
|
|
269
|
+
if (active) {
|
|
270
|
+
var min = onOrder ? 1 : 0;
|
|
271
|
+
updateActive(Math.max(active - 1, min));
|
|
272
|
+
}
|
|
269
273
|
}
|
|
270
274
|
},
|
|
271
275
|
onDown: function onDown(event) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
276
|
+
if (onClickItem || onOrder) {
|
|
277
|
+
event.preventDefault();
|
|
278
|
+
if (orderableData && orderableData.length) {
|
|
279
|
+
var min = onOrder ? 1 : 0;
|
|
280
|
+
var max = onOrder ? orderableData.length * 2 - 2 : data.length - 1;
|
|
281
|
+
updateActive(active >= min ? Math.min(active + 1, max) : min);
|
|
282
|
+
}
|
|
277
283
|
}
|
|
278
284
|
},
|
|
279
285
|
onKeyDown: onKeyDown
|
|
@@ -315,7 +321,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
315
321
|
var isPinned;
|
|
316
322
|
if (Array.isArray(pinned) && pinned.length > 0 || Array.isArray(pinned == null ? void 0 : pinned.items) && (pinned == null || (_pinned$items2 = pinned.items) == null ? void 0 : _pinned$items2.length) > 0) {
|
|
317
323
|
if (typeof item === 'object' && !itemKey) {
|
|
318
|
-
console.error(
|
|
324
|
+
console.error(// eslint-disable-next-line max-len
|
|
319
325
|
"Warning: Missing prop itemKey. Prop pin requires itemKey to be specified when data is of type 'object'.");
|
|
320
326
|
}
|
|
321
327
|
isPinned = Array.isArray(pinned) ? pinned == null ? void 0 : pinned.includes(key) : pinned.items.some(function (pinnedItem) {
|
|
@@ -367,7 +373,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
367
373
|
var isDisabled;
|
|
368
374
|
if (disabledItems) {
|
|
369
375
|
if (typeof item === 'object' && !itemKey) {
|
|
370
|
-
console.error(
|
|
376
|
+
console.error(// eslint-disable-next-line max-len
|
|
371
377
|
"Warning: Missing prop itemKey. Prop disabled requires itemKey to be specified when data is of type 'object'.");
|
|
372
378
|
}
|
|
373
379
|
isDisabled = disabledItems == null ? void 0 : disabledItems.includes(key);
|
|
@@ -69,7 +69,7 @@ var Circle = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
69
69
|
var stroke = strokeProps(someHighlight && !highlight ? background : colorName, theme);
|
|
70
70
|
if (round) {
|
|
71
71
|
var d1 = arcCommands(centerX, centerY, radius, startAngle, endAngle);
|
|
72
|
-
paths.unshift(
|
|
72
|
+
paths.unshift(/*#__PURE__*/React.createElement("path", _extends({
|
|
73
73
|
key: key,
|
|
74
74
|
d: d1,
|
|
75
75
|
fill: "none"
|
|
@@ -98,7 +98,7 @@ var Circle = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
98
98
|
pathCaps.unshift(pathCap);
|
|
99
99
|
} else {
|
|
100
100
|
var d = arcCommands(centerX, centerY, radius, startAngle, endAngle);
|
|
101
|
-
paths.push(
|
|
101
|
+
paths.push(/*#__PURE__*/React.createElement("path", _extends({
|
|
102
102
|
key: key,
|
|
103
103
|
d: d,
|
|
104
104
|
fill: "none"
|
|
@@ -45,12 +45,18 @@ var adaptThemeStyle = function adaptThemeStyle(value, theme) {
|
|
|
45
45
|
}
|
|
46
46
|
return [textStyle, closeButtonStyle];
|
|
47
47
|
};
|
|
48
|
+
var getTextColor = function getTextColor(part, status, kind, theme) {
|
|
49
|
+
var _theme$notification, _theme$notification2, _theme$notification3, _theme$notification4, _theme$notification5;
|
|
50
|
+
var color;
|
|
51
|
+
if ((_theme$notification = theme.notification) != null && (_theme$notification = _theme$notification[status]) != null && (_theme$notification = _theme$notification[kind]) != null && (_theme$notification = _theme$notification[part]) != null && _theme$notification.color) color = (_theme$notification2 = theme.notification) == null || (_theme$notification2 = _theme$notification2[status]) == null || (_theme$notification2 = _theme$notification2[kind]) == null || (_theme$notification2 = _theme$notification2[part]) == null ? void 0 : _theme$notification2.color;else if ((_theme$notification3 = theme.notification) != null && (_theme$notification3 = _theme$notification3[status]) != null && (_theme$notification3 = _theme$notification3[part]) != null && _theme$notification3.color) color = (_theme$notification4 = theme.notification) == null || (_theme$notification4 = _theme$notification4[status]) == null || (_theme$notification4 = _theme$notification4[part]) == null ? void 0 : _theme$notification4.color;else color = (_theme$notification5 = theme.notification) == null || (_theme$notification5 = _theme$notification5[part]) == null ? void 0 : _theme$notification5.color;
|
|
52
|
+
return color;
|
|
53
|
+
};
|
|
48
54
|
var NotificationAnchor = styled(Anchor).withConfig({
|
|
49
55
|
displayName: "Notification__NotificationAnchor",
|
|
50
56
|
componentId: "sc-1yq09yz-0"
|
|
51
57
|
})(["white-space:nowrap;"]);
|
|
52
58
|
var Notification = function Notification(_ref) {
|
|
53
|
-
var _theme$
|
|
59
|
+
var _theme$notification6, _theme$notification7, _theme$notification8, _theme$notification9, _theme$notification10;
|
|
54
60
|
var actionsProp = _ref.actions,
|
|
55
61
|
messageProp = _ref.message,
|
|
56
62
|
onClose = _ref.onClose,
|
|
@@ -87,7 +93,7 @@ var Notification = function Notification(_ref) {
|
|
|
87
93
|
return undefined;
|
|
88
94
|
}, [autoClose, close, theme.notification.toast.time, theme.notification.time, time]);
|
|
89
95
|
var CloseIcon = theme.notification.close.icon;
|
|
90
|
-
var _ref2 = ((_theme$
|
|
96
|
+
var _ref2 = ((_theme$notification6 = theme.notification) == null ? void 0 : _theme$notification6[status]) || theme.notification.unknown,
|
|
91
97
|
StatusIcon = _ref2.icon,
|
|
92
98
|
color = _ref2.color;
|
|
93
99
|
var closeIconColor = theme.notification.close.color;
|
|
@@ -99,7 +105,7 @@ var Notification = function Notification(_ref) {
|
|
|
99
105
|
var direction;
|
|
100
106
|
if (kind && theme.notification[kind].direction) direction = theme.notification[kind].direction;else direction = theme.notification.direction;
|
|
101
107
|
var background;
|
|
102
|
-
if (kind && (_theme$
|
|
108
|
+
if (kind && (_theme$notification7 = theme.notification) != null && (_theme$notification7 = _theme$notification7[status]) != null && (_theme$notification7 = _theme$notification7[kind]) != null && _theme$notification7.background) background = theme.notification[status][kind].background;else if ((_theme$notification8 = theme.notification) != null && (_theme$notification8 = _theme$notification8[status]) != null && _theme$notification8.background) background = theme.notification[status].background;else background = ((_theme$notification9 = theme.notification) == null || (_theme$notification9 = _theme$notification9[kind]) == null || (_theme$notification9 = _theme$notification9.container) == null ? void 0 : _theme$notification9.background) || theme.notification.container.background;
|
|
103
109
|
var TextWrapper = direction === 'row' ? Text : Fragment;
|
|
104
110
|
|
|
105
111
|
// notification is built with two child boxes that contain:
|
|
@@ -118,6 +124,8 @@ var Notification = function Notification(_ref) {
|
|
|
118
124
|
} else textPad = pad;
|
|
119
125
|
var actions;
|
|
120
126
|
var message = messageProp;
|
|
127
|
+
var messageColor = getTextColor('message', status, kind, theme);
|
|
128
|
+
var titleColor = getTextColor('title', status, kind, theme);
|
|
121
129
|
if (actionsProp) actions = actionsProp.map(function (action) {
|
|
122
130
|
return /*#__PURE__*/React.createElement(Fragment, {
|
|
123
131
|
key: action.label
|
|
@@ -131,12 +139,14 @@ var Notification = function Notification(_ref) {
|
|
|
131
139
|
}, action, theme.notification.actions)), ' ');
|
|
132
140
|
});
|
|
133
141
|
var Message = direction !== 'row' ? Paragraph : Text;
|
|
134
|
-
if (message || actions) message = typeof message === 'string' ? /*#__PURE__*/React.createElement(Message, theme.notification.message,
|
|
142
|
+
if (message || actions) message = typeof message === 'string' ? /*#__PURE__*/React.createElement(Message, _extends({}, theme.notification.message, {
|
|
143
|
+
color: messageColor
|
|
144
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
135
145
|
margin: {
|
|
136
146
|
right: 'xsmall'
|
|
137
147
|
}
|
|
138
148
|
}, message), actions) : message;
|
|
139
|
-
var iconDimension = ((_theme$
|
|
149
|
+
var iconDimension = ((_theme$notification10 = theme.notification) == null || (_theme$notification10 = _theme$notification10.message) == null ? void 0 : _theme$notification10.size) || 'medium';
|
|
140
150
|
var content = /*#__PURE__*/React.createElement(Box, _extends({}, theme.notification.container, global ? _extends({}, theme.notification.global.container) : {}, toast ? _extends({}, theme.notification.toast.container) : {}, {
|
|
141
151
|
background: background
|
|
142
152
|
// let internal box control pad
|
|
@@ -152,7 +162,9 @@ var Notification = function Notification(_ref) {
|
|
|
152
162
|
}, /*#__PURE__*/React.createElement(Box, theme.notification.iconContainer, icon || /*#__PURE__*/React.createElement(StatusIcon, {
|
|
153
163
|
color: color,
|
|
154
164
|
height: iconDimension
|
|
155
|
-
})), /*#__PURE__*/React.createElement(Box, theme.notification.textContainer, /*#__PURE__*/React.createElement(TextWrapper, null, title && /*#__PURE__*/React.createElement(Text, theme.notification.title,
|
|
165
|
+
})), /*#__PURE__*/React.createElement(Box, theme.notification.textContainer, /*#__PURE__*/React.createElement(TextWrapper, null, title && /*#__PURE__*/React.createElement(Text, _extends({}, theme.notification.title, {
|
|
166
|
+
color: titleColor
|
|
167
|
+
}), title), message && title && direction === 'row' && /*#__PURE__*/React.createElement(React.Fragment, null, "\xA0"), message))), onClose &&
|
|
156
168
|
/*#__PURE__*/
|
|
157
169
|
// theme.notification.container and textContainer may both have pad,
|
|
158
170
|
// account for both
|
|
@@ -3,6 +3,7 @@ import { AnchorPropTypes } from '../Anchor/propTypes';
|
|
|
3
3
|
var PropType = {};
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
PropType = {
|
|
6
|
+
id: PropTypes.string,
|
|
6
7
|
actions: PropTypes.arrayOf(PropTypes.shape(AnchorPropTypes)),
|
|
7
8
|
global: PropTypes.bool,
|
|
8
9
|
title: PropTypes.string,
|
|
@@ -82,7 +82,7 @@ var Pagination = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
82
82
|
var numberMiddlePages;
|
|
83
83
|
if (numberMiddlePagesProp < 1) {
|
|
84
84
|
numberMiddlePages = 1;
|
|
85
|
-
console.warn(
|
|
85
|
+
console.warn(// eslint-disable-next-line max-len
|
|
86
86
|
"Property \"numberMiddlePages\" should not be < 1. One middle page button will be shown. Set \"numberMiddlePages\" >= 1 to remove this warning.");
|
|
87
87
|
} else numberMiddlePages = numberMiddlePagesProp;
|
|
88
88
|
var startingMiddlePages;
|
|
@@ -181,7 +181,9 @@ var Pagination = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
181
181
|
ref: ref
|
|
182
182
|
}, /*#__PURE__*/React.createElement(Box, _extends({
|
|
183
183
|
as: "ul"
|
|
184
|
-
}, theme.pagination.controls
|
|
184
|
+
}, theme.pagination.controls, {
|
|
185
|
+
cssGap: true
|
|
186
|
+
}), controls.map(function (control, index) {
|
|
185
187
|
return (
|
|
186
188
|
/*#__PURE__*/
|
|
187
189
|
/* Using index as key (as opposed to a unique id) seems to
|
|
@@ -122,7 +122,7 @@ var RadioButtonGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
122
122
|
// on the first radiobutton
|
|
123
123
|
value === '' && index === 0;
|
|
124
124
|
if (optionRest.checked) {
|
|
125
|
-
console.warn(
|
|
125
|
+
console.warn(// eslint-disable-next-line max-len
|
|
126
126
|
"'checked' prop of an individual RadioButton shouldn't be used in a RadioButtonGroup component. Use the RadioButtonGroup 'value' prop instead.");
|
|
127
127
|
}
|
|
128
128
|
return /*#__PURE__*/React.createElement(RadioButton, _extends({
|
|
@@ -8,7 +8,7 @@ import { Keyboard } from '../Keyboard';
|
|
|
8
8
|
import { FormContext } from '../Form/FormContext';
|
|
9
9
|
import { SelectContainer } from './SelectContainer';
|
|
10
10
|
import { HiddenInput, StyledSelectDropButton } from './StyledSelect';
|
|
11
|
-
import { applyKey, getNormalizedValue, changeEvent, getSelectIcon, getDisplayLabelKey, getIconColor } from './utils';
|
|
11
|
+
import { applyKey, getNormalizedValue, changeEvent, getSelectIcon, getDisplayLabelKey, getIconColor, formatValueForA11y } from './utils';
|
|
12
12
|
import { DefaultSelectTextInput } from './DefaultSelectTextInput';
|
|
13
13
|
import { MessageContext } from '../../contexts/MessageContext';
|
|
14
14
|
import { SelectPropTypes } from './propTypes';
|
|
@@ -223,7 +223,7 @@ var Select = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
223
223
|
var selectValue = useMemo(function () {
|
|
224
224
|
if (valueLabel instanceof Function) {
|
|
225
225
|
if (value || value === 0 || value === false) return valueLabel(value);
|
|
226
|
-
} else if (valueLabel) return valueLabel;else if (
|
|
226
|
+
} else if (valueLabel) return valueLabel;else if (/*#__PURE__*/React.isValidElement(value)) return value; // deprecated
|
|
227
227
|
return undefined;
|
|
228
228
|
}, [value, valueLabel]);
|
|
229
229
|
var displayLabelKey = useMemo(function () {
|
|
@@ -260,7 +260,7 @@ var Select = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
260
260
|
id: 'select.selected',
|
|
261
261
|
messages: messages,
|
|
262
262
|
values: {
|
|
263
|
-
currentSelectedValue: value
|
|
263
|
+
currentSelectedValue: formatValueForA11y(value, labelKey)
|
|
264
264
|
}
|
|
265
265
|
}) : ''),
|
|
266
266
|
"aria-expanded": Boolean(open),
|
|
@@ -271,7 +271,7 @@ var Select = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
271
271
|
dropTarget: dropTarget,
|
|
272
272
|
open: open,
|
|
273
273
|
alignSelf: alignSelf,
|
|
274
|
-
focusIndicator: focusIndicator,
|
|
274
|
+
focusIndicator: plain ? focusIndicator : true,
|
|
275
275
|
onFocus: onFocus,
|
|
276
276
|
onBlur: onBlur,
|
|
277
277
|
gridArea: gridArea,
|
|
@@ -325,6 +325,8 @@ var Select = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
325
325
|
type: "text",
|
|
326
326
|
name: name,
|
|
327
327
|
id: id ? id + "__input" : undefined,
|
|
328
|
+
inert: "" // revisit for React 19
|
|
329
|
+
,
|
|
328
330
|
value: inputValue,
|
|
329
331
|
ref: inputRef,
|
|
330
332
|
readOnly: true
|
|
@@ -332,6 +334,8 @@ var Select = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
332
334
|
a11yTitle: (ariaLabel || a11yTitle) && "" + (ariaLabel || a11yTitle) + (value && typeof value === 'string' ? ", " + value : ''),
|
|
333
335
|
disabled: disabled,
|
|
334
336
|
id: id,
|
|
337
|
+
inert: "" // revisit for React 19
|
|
338
|
+
,
|
|
335
339
|
name: name,
|
|
336
340
|
ref: inputRef,
|
|
337
341
|
placeholder: placeholder,
|
|
@@ -39,41 +39,48 @@ var ClearButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
39
39
|
fill: "horizontal",
|
|
40
40
|
ref: ref,
|
|
41
41
|
onClick: onClear,
|
|
42
|
-
focusIndicator: false
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
focusIndicator: false,
|
|
43
|
+
plain: true
|
|
44
|
+
}, passThemeFlag, rest), function (_ref2) {
|
|
45
|
+
var _theme$select$clear;
|
|
46
|
+
var hover = _ref2.hover;
|
|
47
|
+
var boxProps = _extends({}, theme.select.clear.container);
|
|
48
|
+
delete boxProps.hover; // avoid passing hover object to Box
|
|
49
|
+
return /*#__PURE__*/React.createElement(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 : {}, {
|
|
50
|
+
align: align
|
|
51
|
+
}), /*#__PURE__*/React.createElement(Text, theme.select.clear.text, buttonLabel));
|
|
52
|
+
});
|
|
46
53
|
});
|
|
47
|
-
var SelectContainer = /*#__PURE__*/forwardRef(function (
|
|
48
|
-
var clear =
|
|
49
|
-
|
|
50
|
-
children =
|
|
51
|
-
disabled =
|
|
52
|
-
disabledKey =
|
|
53
|
-
dropHeight =
|
|
54
|
-
|
|
55
|
-
emptySearchMessage =
|
|
56
|
-
id =
|
|
57
|
-
labelKey =
|
|
58
|
-
multiple =
|
|
59
|
-
name =
|
|
60
|
-
onChange =
|
|
61
|
-
onKeyDown =
|
|
62
|
-
onMore =
|
|
63
|
-
onSearch =
|
|
64
|
-
optionIndexesInValue =
|
|
65
|
-
options =
|
|
66
|
-
allOptions =
|
|
67
|
-
searchPlaceholder =
|
|
68
|
-
search =
|
|
69
|
-
setSearch =
|
|
70
|
-
selected =
|
|
71
|
-
usingKeyboard =
|
|
72
|
-
|
|
73
|
-
value =
|
|
74
|
-
valueKey =
|
|
75
|
-
|
|
76
|
-
replace =
|
|
54
|
+
var SelectContainer = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
55
|
+
var clear = _ref3.clear,
|
|
56
|
+
_ref3$children = _ref3.children,
|
|
57
|
+
children = _ref3$children === void 0 ? null : _ref3$children,
|
|
58
|
+
disabled = _ref3.disabled,
|
|
59
|
+
disabledKey = _ref3.disabledKey,
|
|
60
|
+
dropHeight = _ref3.dropHeight,
|
|
61
|
+
_ref3$emptySearchMess = _ref3.emptySearchMessage,
|
|
62
|
+
emptySearchMessage = _ref3$emptySearchMess === void 0 ? 'No matches found' : _ref3$emptySearchMess,
|
|
63
|
+
id = _ref3.id,
|
|
64
|
+
labelKey = _ref3.labelKey,
|
|
65
|
+
multiple = _ref3.multiple,
|
|
66
|
+
name = _ref3.name,
|
|
67
|
+
onChange = _ref3.onChange,
|
|
68
|
+
onKeyDown = _ref3.onKeyDown,
|
|
69
|
+
onMore = _ref3.onMore,
|
|
70
|
+
onSearch = _ref3.onSearch,
|
|
71
|
+
optionIndexesInValue = _ref3.optionIndexesInValue,
|
|
72
|
+
options = _ref3.options,
|
|
73
|
+
allOptions = _ref3.allOptions,
|
|
74
|
+
searchPlaceholder = _ref3.searchPlaceholder,
|
|
75
|
+
search = _ref3.search,
|
|
76
|
+
setSearch = _ref3.setSearch,
|
|
77
|
+
selected = _ref3.selected,
|
|
78
|
+
usingKeyboard = _ref3.usingKeyboard,
|
|
79
|
+
_ref3$value = _ref3.value,
|
|
80
|
+
value = _ref3$value === void 0 ? '' : _ref3$value,
|
|
81
|
+
valueKey = _ref3.valueKey,
|
|
82
|
+
_ref3$replace = _ref3.replace,
|
|
83
|
+
replace = _ref3$replace === void 0 ? true : _ref3$replace;
|
|
77
84
|
var _useThemeValue2 = useThemeValue(),
|
|
78
85
|
theme = _useThemeValue2.theme,
|
|
79
86
|
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)[];
|