grommet 2.53.0 → 2.55.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/Calendar/Calendar.js +24 -16
- package/components/Calendar/index.d.ts +1 -1
- package/components/Calendar/stories/CustomHeader.stories.js +6 -1
- package/components/Calendar/stories/CustomThemed/CustomSizeHeading.stories.js +6 -1
- package/components/Calendar/stories/Dual.stories.js +23 -11
- package/components/Calendar/stories/HeaderLevel.stories.js +6 -1
- package/components/Calendar/stories/Multiple.stories.js +8 -3
- package/components/Calendar/stories/Simple.stories.js +6 -1
- package/components/Cards/Cards.js +164 -10
- package/components/Cards/StyledCellContainer.js +29 -0
- package/components/Cards/index.d.ts +4 -1
- package/components/Cards/propTypes.js +2 -0
- package/components/Cards/stories/Sizable.stories.js +70 -0
- package/components/Cards/stories/onOrder.stories.js +69 -0
- package/components/DataFilter/DataFilter.js +21 -28
- package/components/DataTable/stories/ResizePinned.stories.js +1 -1
- package/components/DateInput/DateInput.js +58 -25
- package/components/DateInput/index.d.ts +1 -0
- package/components/DateInput/utils.js +2 -2
- package/components/Drop/DropContainer.js +59 -3
- package/components/FileInput/FileInput.js +3 -0
- package/components/Form/stories/CustomThemed/FieldCustomStates.stories.js +7 -1
- package/components/Form/stories/FieldStates.stories.js +7 -1
- package/components/Grommet/Grommet.js +2 -1
- package/components/Grommet/index.d.ts +6 -0
- package/components/Grommet/propTypes.js +7 -1
- package/components/Header/stories/Sticky.stories.js +1 -1
- package/components/Layer/LayerContainer.d.ts +40 -0
- package/components/Menu/Menu.js +7 -5
- package/components/Select/stories/ChildrenRender.stories.js +28 -55
- package/components/SelectMultiple/stories/typescript/Children.stories.tsx +24 -48
- package/components/SelectMultiple/stories/typescript/ValueLabel.stories.tsx +88 -0
- package/components/Tab/Tab.js +1 -1
- package/components/Tag/Tag.js +4 -3
- package/components/Tag/index.d.ts +5 -4
- package/components/Tag/propTypes.js +3 -2
- package/components/TextInput/StyledTextInput.js +4 -2
- package/components/TextInput/TextInput.js +4 -3
- package/es6/components/Calendar/Calendar.js +24 -16
- package/es6/components/Calendar/index.d.ts +1 -1
- package/es6/components/Calendar/stories/CustomHeader.stories.js +6 -1
- package/es6/components/Calendar/stories/CustomThemed/CustomSizeHeading.stories.js +6 -1
- package/es6/components/Calendar/stories/Dual.stories.js +23 -11
- package/es6/components/Calendar/stories/HeaderLevel.stories.js +6 -1
- package/es6/components/Calendar/stories/Multiple.stories.js +8 -3
- package/es6/components/Calendar/stories/Simple.stories.js +6 -1
- package/es6/components/Cards/Cards.js +165 -12
- package/es6/components/Cards/StyledCellContainer.js +24 -0
- package/es6/components/Cards/index.d.ts +4 -1
- package/es6/components/Cards/propTypes.js +2 -0
- package/es6/components/Cards/stories/Sizable.stories.js +65 -0
- package/es6/components/Cards/stories/onOrder.stories.js +64 -0
- package/es6/components/DataFilter/DataFilter.js +21 -28
- package/es6/components/DataTable/stories/ResizePinned.stories.js +1 -1
- package/es6/components/DateInput/DateInput.js +58 -25
- package/es6/components/DateInput/index.d.ts +1 -0
- package/es6/components/DateInput/utils.js +2 -2
- package/es6/components/Drop/DropContainer.js +59 -3
- package/es6/components/FileInput/FileInput.js +3 -0
- package/es6/components/Form/stories/CustomThemed/FieldCustomStates.stories.js +7 -1
- package/es6/components/Form/stories/FieldStates.stories.js +7 -1
- package/es6/components/Grommet/Grommet.js +2 -1
- package/es6/components/Grommet/index.d.ts +6 -0
- package/es6/components/Grommet/propTypes.js +7 -1
- package/es6/components/Header/stories/Sticky.stories.js +1 -1
- package/es6/components/Layer/LayerContainer.d.ts +40 -0
- package/es6/components/Menu/Menu.js +7 -5
- package/es6/components/Select/stories/ChildrenRender.stories.js +29 -56
- package/es6/components/SelectMultiple/stories/typescript/Children.stories.tsx +24 -48
- package/es6/components/SelectMultiple/stories/typescript/ValueLabel.stories.tsx +88 -0
- package/es6/components/Tab/Tab.js +2 -2
- package/es6/components/Tag/Tag.js +4 -3
- package/es6/components/Tag/index.d.ts +5 -4
- package/es6/components/Tag/propTypes.js +3 -2
- package/es6/components/TextInput/StyledTextInput.js +4 -2
- package/es6/components/TextInput/TextInput.js +4 -3
- package/es6/languages/default.json +7 -1
- package/es6/themes/base.d.ts +6 -0
- package/es6/themes/base.js +5 -0
- package/es6/utils/index.d.ts +1 -0
- package/es6/utils/styles.js +23 -12
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +7 -1
- package/package.json +47 -50
- package/themes/base.d.ts +6 -0
- package/themes/base.js +5 -0
- package/utils/index.d.ts +1 -0
- package/utils/styles.js +23 -12
|
@@ -84,18 +84,45 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
84
84
|
var ref = useForwardedRef(refArg);
|
|
85
85
|
var containerRef = useRef();
|
|
86
86
|
var readOnly = readOnlyProp || readOnlyCopy;
|
|
87
|
+
var bounds = calendarProps == null ? void 0 : calendarProps.bounds;
|
|
88
|
+
var validateBoundsForForm = useCallback(function (fieldValue) {
|
|
89
|
+
if (!bounds || !fieldValue) return undefined;
|
|
90
|
+
var isValid = validateBounds(bounds, fieldValue);
|
|
91
|
+
if (!isValid) {
|
|
92
|
+
var _bounds$map = bounds.map(function (date) {
|
|
93
|
+
return setHoursWithOffset(date).toISOString();
|
|
94
|
+
}),
|
|
95
|
+
startBound = _bounds$map[0],
|
|
96
|
+
endBound = _bounds$map[1];
|
|
97
|
+
if (startBound && endBound) {
|
|
98
|
+
return formatMessage({
|
|
99
|
+
id: 'dateInput.outOfBounds',
|
|
100
|
+
messages: messages,
|
|
101
|
+
values: {
|
|
102
|
+
start: new Date(startBound).toLocaleDateString(),
|
|
103
|
+
end: new Date(endBound).toLocaleDateString()
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return undefined;
|
|
109
|
+
}, [bounds, formatMessage, messages]);
|
|
87
110
|
var _useFormInput = useFormInput({
|
|
88
111
|
name: name,
|
|
89
112
|
value: valueArg,
|
|
90
|
-
initialValue: defaultValue
|
|
113
|
+
initialValue: defaultValue,
|
|
114
|
+
validate: bounds ? validateBoundsForForm : undefined
|
|
91
115
|
}),
|
|
92
116
|
value = _useFormInput[0],
|
|
93
117
|
setValue = _useFormInput[1];
|
|
94
118
|
var usingKeyboard = useKeyboard();
|
|
95
119
|
var CalendarIcon = ((_theme$dateInput$icon2 = theme.dateInput.icon) == null ? void 0 : _theme$dateInput$icon2.calendar) || GrommetCalendarIcon;
|
|
96
|
-
var _useState = useState(
|
|
97
|
-
|
|
98
|
-
|
|
120
|
+
var _useState = useState(true),
|
|
121
|
+
withinBounds = _useState[0],
|
|
122
|
+
setWithinBounds = _useState[1];
|
|
123
|
+
var _useState2 = useState(getOutputFormat(value)),
|
|
124
|
+
outputFormat = _useState2[0],
|
|
125
|
+
setOutputFormat = _useState2[1];
|
|
99
126
|
useEffect(function () {
|
|
100
127
|
setOutputFormat(function (previousFormat) {
|
|
101
128
|
var nextFormat = getOutputFormat(value);
|
|
@@ -105,11 +132,19 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
105
132
|
return previousFormat !== nextFormat ? previousFormat : nextFormat;
|
|
106
133
|
});
|
|
107
134
|
}, [value]);
|
|
135
|
+
useEffect(function () {
|
|
136
|
+
if (value === undefined || bounds === undefined) {
|
|
137
|
+
setWithinBounds(true);
|
|
138
|
+
} else {
|
|
139
|
+
var validNextValue = validateBounds(bounds, value);
|
|
140
|
+
setWithinBounds(validNextValue);
|
|
141
|
+
}
|
|
142
|
+
}, [value, bounds]);
|
|
108
143
|
|
|
109
144
|
// keep track of timestamp from original date(s)
|
|
110
|
-
var
|
|
111
|
-
reference =
|
|
112
|
-
setReference =
|
|
145
|
+
var _useState3 = useState(getReference(value)),
|
|
146
|
+
reference = _useState3[0],
|
|
147
|
+
setReference = _useState3[1];
|
|
113
148
|
|
|
114
149
|
// do we expect multiple dates?
|
|
115
150
|
var range = Array.isArray(value) || format && format.includes('-');
|
|
@@ -125,9 +160,9 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
125
160
|
}, [schema]);
|
|
126
161
|
|
|
127
162
|
// textValue is only used when a format is provided
|
|
128
|
-
var
|
|
129
|
-
textValue =
|
|
130
|
-
setTextValue =
|
|
163
|
+
var _useState4 = useState(schema ? valueToText(value, schema) : undefined),
|
|
164
|
+
textValue = _useState4[0],
|
|
165
|
+
setTextValue = _useState4[1];
|
|
131
166
|
var readOnlyCopyValidation = formatMessage({
|
|
132
167
|
id: 'input.readOnlyCopy.validation',
|
|
133
168
|
messages: messages
|
|
@@ -136,9 +171,9 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
136
171
|
id: 'input.readOnlyCopy.prompt',
|
|
137
172
|
messages: messages
|
|
138
173
|
});
|
|
139
|
-
var
|
|
140
|
-
tip =
|
|
141
|
-
setTip =
|
|
174
|
+
var _useState5 = useState(readOnlyCopyPrompt),
|
|
175
|
+
tip = _useState5[0],
|
|
176
|
+
setTip = _useState5[1];
|
|
142
177
|
|
|
143
178
|
// Setting the icon through `inputProps` is deprecated.
|
|
144
179
|
// The `icon` prop should be used instead.
|
|
@@ -190,9 +225,9 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
190
225
|
}, [schema, ref]);
|
|
191
226
|
|
|
192
227
|
// when format and not inline, whether to show the Calendar in a Drop
|
|
193
|
-
var
|
|
194
|
-
open =
|
|
195
|
-
setOpen =
|
|
228
|
+
var _useState6 = useState(),
|
|
229
|
+
open = _useState6[0],
|
|
230
|
+
setOpen = _useState6[1];
|
|
196
231
|
var openCalendar = useCallback(function () {
|
|
197
232
|
setOpen(true);
|
|
198
233
|
announce(formatMessage({
|
|
@@ -269,7 +304,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
269
304
|
}, buttonProps));
|
|
270
305
|
}
|
|
271
306
|
var onClickCopy = function onClickCopy() {
|
|
272
|
-
|
|
307
|
+
navigator.clipboard.writeText(textValue);
|
|
273
308
|
announce(readOnlyCopyValidation, 'assertive');
|
|
274
309
|
setTip(readOnlyCopyValidation);
|
|
275
310
|
};
|
|
@@ -322,6 +357,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
322
357
|
readOnlyProp: readOnly,
|
|
323
358
|
fill: true
|
|
324
359
|
}, passThemeFlag), reverse && (!readOnly || readOnlyCopy) && DateInputButton, /*#__PURE__*/React.createElement(MaskedInput, _extends({
|
|
360
|
+
"aria-invalid": bounds && !withinBounds ? true : undefined,
|
|
325
361
|
readOnly: readOnly,
|
|
326
362
|
ref: ref,
|
|
327
363
|
id: id,
|
|
@@ -336,17 +372,15 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
336
372
|
var nextTextValue = event.target.value;
|
|
337
373
|
setTextValue(nextTextValue);
|
|
338
374
|
var nextValue = textToValue(nextTextValue, schema, range, reference, outputFormat);
|
|
339
|
-
var
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
if (validatedNextValue !== undefined) setReference(getReference(validatedNextValue));
|
|
375
|
+
var validNextValue = validateBounds(bounds, nextValue);
|
|
376
|
+
setWithinBounds(validNextValue);
|
|
377
|
+
if (nextValue !== undefined) setReference(getReference(nextValue));
|
|
344
378
|
// update value even when undefined
|
|
345
|
-
setValue(
|
|
379
|
+
setValue(nextValue);
|
|
346
380
|
if (_onChange) {
|
|
347
381
|
event.persist(); // extract from React synthetic event pool
|
|
348
382
|
var adjustedEvent = event;
|
|
349
|
-
adjustedEvent.value =
|
|
383
|
+
adjustedEvent.value = nextValue;
|
|
350
384
|
_onChange(adjustedEvent);
|
|
351
385
|
}
|
|
352
386
|
},
|
|
@@ -366,7 +400,6 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
366
400
|
if (open && !readOnly) {
|
|
367
401
|
return [input, /*#__PURE__*/React.createElement(Drop, _extends({
|
|
368
402
|
key: "drop",
|
|
369
|
-
overflow: "visible",
|
|
370
403
|
id: id ? id + "__drop" : undefined,
|
|
371
404
|
target: containerRef.current,
|
|
372
405
|
align: _extends({}, calendarDropdownAlign, dropProps),
|
|
@@ -119,7 +119,7 @@ var pullDigits = function pullDigits(text, index) {
|
|
|
119
119
|
return text.slice(index, end);
|
|
120
120
|
};
|
|
121
121
|
export var validateBounds = function validateBounds(dateBounds, selectedDate) {
|
|
122
|
-
if (!dateBounds || !selectedDate) return
|
|
122
|
+
if (!dateBounds || !selectedDate) return true;
|
|
123
123
|
var _dateBounds$map = dateBounds.map(function (date) {
|
|
124
124
|
return setHoursWithOffset(date).toISOString();
|
|
125
125
|
}),
|
|
@@ -131,7 +131,7 @@ export var validateBounds = function validateBounds(dateBounds, selectedDate) {
|
|
|
131
131
|
var validSelection = isoSelectedDates.every(function (isoSelectedDate) {
|
|
132
132
|
return !endDate && startDate === isoSelectedDate || isoSelectedDate >= startDate && isoSelectedDate <= endDate;
|
|
133
133
|
});
|
|
134
|
-
return validSelection
|
|
134
|
+
return validSelection;
|
|
135
135
|
};
|
|
136
136
|
export var textToValue = function textToValue(text, schema, range, reference, outputFormat) {
|
|
137
137
|
if (!text) return range ? [] : undefined;
|
|
@@ -174,9 +174,10 @@ var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
174
174
|
|
|
175
175
|
/* If responsive is true and the Drop doesn't have enough room
|
|
176
176
|
to be fully visible and there is more room in the other
|
|
177
|
-
direction, change the Drop to display above/below. If
|
|
178
|
-
|
|
179
|
-
|
|
177
|
+
direction, change the Drop to display above/below. If neither
|
|
178
|
+
direction has enough room for the full Drop, prefer the side
|
|
179
|
+
with more available space rather than clamping to the side
|
|
180
|
+
originally requested. */
|
|
180
181
|
if (responsive &&
|
|
181
182
|
// drop is above target
|
|
182
183
|
align.bottom === 'top' &&
|
|
@@ -221,6 +222,61 @@ var DropContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
221
222
|
// top of drop is aligned to top of target
|
|
222
223
|
top = targetRect.top;
|
|
223
224
|
maxHeight = bottom;
|
|
225
|
+
} else if (responsive &&
|
|
226
|
+
// top of drop is aligned to bottom of target (open below)
|
|
227
|
+
align.top === 'bottom' &&
|
|
228
|
+
// drop is overflowing below window
|
|
229
|
+
targetRect.bottom + containerRect.height >= windowHeight &&
|
|
230
|
+
// the flip anchor (target's top) is on-screen — otherwise
|
|
231
|
+
// flipping pins the drop's bottom off-screen
|
|
232
|
+
targetRect.top > 0 &&
|
|
233
|
+
// there is more room above the target than below it — neither
|
|
234
|
+
// side fits the full drop, so prefer the larger side rather
|
|
235
|
+
// than clamping to the smaller requested side.
|
|
236
|
+
targetRect.top > windowHeight - targetRect.bottom) {
|
|
237
|
+
// bottom of drop is aligned to top of target
|
|
238
|
+
bottom = targetRect.top;
|
|
239
|
+
maxHeight = bottom;
|
|
240
|
+
} else if (responsive &&
|
|
241
|
+
// top of drop is aligned to top of target (open below)
|
|
242
|
+
align.top === 'top' &&
|
|
243
|
+
// drop is overflowing below window
|
|
244
|
+
targetRect.top + containerRect.height >= windowHeight &&
|
|
245
|
+
// height of the drop is larger than the target — otherwise the
|
|
246
|
+
// drop already fits inside the target's vertical span and a
|
|
247
|
+
// flip would pin its bottom to a potentially off-screen
|
|
248
|
+
// target.bottom (mirrors the safety in branch #2 above).
|
|
249
|
+
targetRect.top + containerRect.height > targetRect.bottom &&
|
|
250
|
+
// there is more room above the target than below it
|
|
251
|
+
targetRect.bottom > windowHeight - targetRect.top) {
|
|
252
|
+
// bottom of drop is aligned to bottom of target
|
|
253
|
+
bottom = targetRect.bottom;
|
|
254
|
+
maxHeight = bottom;
|
|
255
|
+
} else if (responsive &&
|
|
256
|
+
// bottom of drop is aligned to top of target (open above)
|
|
257
|
+
align.bottom === 'top' &&
|
|
258
|
+
// drop is overflowing above window
|
|
259
|
+
targetRect.top - containerRect.height <= 0 &&
|
|
260
|
+
// the flip anchor (target's bottom) is on-screen
|
|
261
|
+
targetRect.bottom < windowHeight &&
|
|
262
|
+
// there is more room below the target than above it
|
|
263
|
+
windowHeight - targetRect.bottom > targetRect.top) {
|
|
264
|
+
// top of drop is aligned to bottom of target
|
|
265
|
+
top = targetRect.bottom;
|
|
266
|
+
maxHeight = windowHeight - top;
|
|
267
|
+
} else if (responsive &&
|
|
268
|
+
// bottom of drop is aligned to bottom of target (open above)
|
|
269
|
+
align.bottom === 'bottom' &&
|
|
270
|
+
// drop is overflowing above window
|
|
271
|
+
targetRect.bottom - containerRect.height <= 0 &&
|
|
272
|
+
// height of the drop is larger than the target (mirrors the
|
|
273
|
+
// safety in branch #4 above)
|
|
274
|
+
targetRect.bottom - containerRect.height < targetRect.top &&
|
|
275
|
+
// there is more room below the target than above it
|
|
276
|
+
windowHeight - targetRect.top > targetRect.bottom) {
|
|
277
|
+
// top of drop is aligned to top of target
|
|
278
|
+
top = targetRect.top;
|
|
279
|
+
maxHeight = windowHeight - top;
|
|
224
280
|
} else if (align.top === 'top') {
|
|
225
281
|
top = targetRect.top;
|
|
226
282
|
maxHeight = windowHeight - top;
|
|
@@ -287,6 +287,9 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
287
287
|
onChange: function onChange(event) {
|
|
288
288
|
event.persist();
|
|
289
289
|
var fileList = event.target.files;
|
|
290
|
+
// If the user cancelled the file picker, fileList will be empty
|
|
291
|
+
// and we should not clear any previously selected files.
|
|
292
|
+
if (!fileList.length && files.length) return;
|
|
290
293
|
var nextFiles = multiple ? [].concat(files) : [];
|
|
291
294
|
var _loop = function _loop(i) {
|
|
292
295
|
// avoid duplicates
|
|
@@ -62,7 +62,13 @@ var customTheme = deepMerge(grommet, {
|
|
|
62
62
|
export var FieldCustomStates = function FieldCustomStates() {
|
|
63
63
|
var inputRef = useRef();
|
|
64
64
|
useEffect(function () {
|
|
65
|
-
|
|
65
|
+
var focusTimeout = setTimeout(function () {
|
|
66
|
+
var _inputRef$current;
|
|
67
|
+
(_inputRef$current = inputRef.current) == null || _inputRef$current.focus();
|
|
68
|
+
});
|
|
69
|
+
return function () {
|
|
70
|
+
return clearTimeout(focusTimeout);
|
|
71
|
+
};
|
|
66
72
|
}, []);
|
|
67
73
|
return /*#__PURE__*/React.createElement(Grommet, {
|
|
68
74
|
theme: customTheme
|
|
@@ -3,7 +3,13 @@ import { Box, Form, FormField, TextInput } from 'grommet';
|
|
|
3
3
|
export var FieldStates = function FieldStates() {
|
|
4
4
|
var inputRef = useRef();
|
|
5
5
|
useEffect(function () {
|
|
6
|
-
|
|
6
|
+
var focusTimeout = setTimeout(function () {
|
|
7
|
+
var _inputRef$current;
|
|
8
|
+
(_inputRef$current = inputRef.current) == null || _inputRef$current.focus();
|
|
9
|
+
});
|
|
10
|
+
return function () {
|
|
11
|
+
return clearTimeout(focusTimeout);
|
|
12
|
+
};
|
|
7
13
|
}, []);
|
|
8
14
|
return (
|
|
9
15
|
/*#__PURE__*/
|
|
@@ -73,7 +73,8 @@ var Grommet = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
73
73
|
}, [messagesProp]);
|
|
74
74
|
useEffect(function () {
|
|
75
75
|
var onResize = function onResize() {
|
|
76
|
-
|
|
76
|
+
var _document$body$client, _document$body;
|
|
77
|
+
setResponsive(getBreakpoint((_document$body$client = (_document$body = document.body) == null ? void 0 : _document$body.clientWidth) != null ? _document$body$client : window.innerWidth, theme));
|
|
77
78
|
};
|
|
78
79
|
window.addEventListener('resize', onResize);
|
|
79
80
|
onResize();
|
|
@@ -31,6 +31,11 @@ export interface GrommetProps {
|
|
|
31
31
|
nextMove?: string;
|
|
32
32
|
next?: string;
|
|
33
33
|
};
|
|
34
|
+
cards?: {
|
|
35
|
+
moved?: string;
|
|
36
|
+
reorderHint?: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
};
|
|
34
39
|
carousel?: {
|
|
35
40
|
previous?: string;
|
|
36
41
|
next?: string;
|
|
@@ -40,6 +45,7 @@ export interface GrommetProps {
|
|
|
40
45
|
openCalendar?: string;
|
|
41
46
|
enterCalendar?: string;
|
|
42
47
|
exitCalendar?: string;
|
|
48
|
+
outOfBounds?: string;
|
|
43
49
|
};
|
|
44
50
|
dataChart?: {
|
|
45
51
|
detailTitle?: string;
|
|
@@ -33,6 +33,11 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
33
33
|
nextMove: PropTypes.string,
|
|
34
34
|
next: PropTypes.string
|
|
35
35
|
}),
|
|
36
|
+
cards: PropTypes.shape({
|
|
37
|
+
moved: PropTypes.string,
|
|
38
|
+
reorderHint: PropTypes.string,
|
|
39
|
+
description: PropTypes.string
|
|
40
|
+
}),
|
|
36
41
|
carousel: PropTypes.shape({
|
|
37
42
|
previous: PropTypes.string,
|
|
38
43
|
next: PropTypes.string,
|
|
@@ -41,7 +46,8 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
41
46
|
dateInput: PropTypes.shape({
|
|
42
47
|
openCalendar: PropTypes.string,
|
|
43
48
|
enterCalendar: PropTypes.string,
|
|
44
|
-
exitCalendar: PropTypes.string
|
|
49
|
+
exitCalendar: PropTypes.string,
|
|
50
|
+
outOfBounds: PropTypes.string
|
|
45
51
|
}),
|
|
46
52
|
dataChart: PropTypes.shape({
|
|
47
53
|
detailTitle: PropTypes.string,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AnimateType,
|
|
3
|
+
BackgroundType,
|
|
4
|
+
KeyboardType,
|
|
5
|
+
MarginType,
|
|
6
|
+
} from 'grommet/utils';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { LayerPositionType } from '.';
|
|
9
|
+
|
|
10
|
+
interface LayerContainerProps {
|
|
11
|
+
animate?: AnimateType;
|
|
12
|
+
animation?: 'none' | 'slide' | 'fadeIn' | boolean;
|
|
13
|
+
background?: BackgroundType;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
full?: boolean | 'vertical' | 'horizontal';
|
|
16
|
+
id?: string;
|
|
17
|
+
margin?: MarginType;
|
|
18
|
+
modal?: boolean;
|
|
19
|
+
onClickOutside?: (
|
|
20
|
+
event: React.MouseEvent<HTMLDivElement, MouseEvent>,
|
|
21
|
+
) => void;
|
|
22
|
+
onEsc?: KeyboardType;
|
|
23
|
+
plain?: boolean;
|
|
24
|
+
position?: LayerPositionType;
|
|
25
|
+
responsive?: boolean;
|
|
26
|
+
target?: object;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type divProps = React.DetailedHTMLProps<
|
|
30
|
+
React.HTMLAttributes<HTMLDivElement>,
|
|
31
|
+
HTMLDivElement
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
interface LayerContainerExtendedProps extends LayerContainerProps, divProps {}
|
|
35
|
+
|
|
36
|
+
declare const LayerContainer: React.ForwardRefExoticComponent<
|
|
37
|
+
LayerContainerExtendedProps & React.RefAttributes<HTMLDivElement>
|
|
38
|
+
>;
|
|
39
|
+
|
|
40
|
+
export { LayerContainer };
|
|
@@ -43,6 +43,7 @@ To make a selection:
|
|
|
43
43
|
|
|
44
44
|
var defaultItems = [];
|
|
45
45
|
var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
46
|
+
var _theme$menu$disabled;
|
|
46
47
|
var a11yTitle = props.a11yTitle,
|
|
47
48
|
ariaLabel = props['aria-label'],
|
|
48
49
|
children = props.children,
|
|
@@ -69,6 +70,7 @@ var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
69
70
|
var _useContext = useContext(MessageContext),
|
|
70
71
|
format = _useContext.format;
|
|
71
72
|
var iconColor = normalizeColor(theme.menu.icons.color || 'control', theme);
|
|
73
|
+
var iconDisabledColor = normalizeColor(((_theme$menu$disabled = theme.menu.disabled) == null || (_theme$menu$disabled = _theme$menu$disabled.icons) == null ? void 0 : _theme$menu$disabled.color) || theme.menu.icons.color || 'control', theme);
|
|
72
74
|
// need to destructure the align otherwise it will get passed through
|
|
73
75
|
// to DropButton and override prop values
|
|
74
76
|
var _theme$menu$drop = theme.menu.drop,
|
|
@@ -210,7 +212,7 @@ var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
210
212
|
}
|
|
211
213
|
};
|
|
212
214
|
var menuIcon = icon !== false ? icon !== true && icon || /*#__PURE__*/React.createElement(MenuIcon, {
|
|
213
|
-
color: iconColor,
|
|
215
|
+
color: disabled ? iconDisabledColor : iconColor,
|
|
214
216
|
size: size
|
|
215
217
|
}) : null;
|
|
216
218
|
var buttonProps = {
|
|
@@ -282,10 +284,10 @@ var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
282
284
|
var child = !theme.button.option ?
|
|
283
285
|
/*#__PURE__*/
|
|
284
286
|
/*
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
Not adding a theme object now because this code path
|
|
288
|
+
is not used in the HPE theme, but we may add theme
|
|
289
|
+
support here in the future.
|
|
290
|
+
*/
|
|
289
291
|
React.createElement(Box, {
|
|
290
292
|
align: ((_theme$menu$item = theme.menu.item) == null ? void 0 : _theme$menu$item.align) || 'start',
|
|
291
293
|
pad: "small",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Box, Button, Select, Text } from 'grommet';
|
|
2
|
+
import { Box, Select, Tag, Text } from 'grommet';
|
|
4
3
|
var allSeasons = ['S01', 'S02', 'S03', 'S04', 'S05', 'S06', 'S07', 'S08', 'S09', 'S10'];
|
|
5
4
|
export var Children = function Children() {
|
|
6
5
|
var _useState = useState([]),
|
|
@@ -11,49 +10,13 @@ export var Children = function Children() {
|
|
|
11
10
|
return selectedSeason !== season;
|
|
12
11
|
}));
|
|
13
12
|
};
|
|
14
|
-
var
|
|
15
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
16
|
-
key: "season_tag_" + season,
|
|
17
|
-
href: "#",
|
|
18
|
-
onClick: function onClick(event) {
|
|
19
|
-
event.preventDefault();
|
|
20
|
-
event.stopPropagation();
|
|
21
|
-
onRemoveSeason(season);
|
|
22
|
-
},
|
|
23
|
-
onFocus: function onFocus(event) {
|
|
24
|
-
return event.stopPropagation();
|
|
25
|
-
}
|
|
26
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
27
|
-
align: "center",
|
|
28
|
-
direction: "row",
|
|
29
|
-
gap: "xsmall",
|
|
30
|
-
pad: {
|
|
31
|
-
vertical: 'xsmall',
|
|
32
|
-
horizontal: 'small'
|
|
33
|
-
},
|
|
34
|
-
margin: "xsmall",
|
|
35
|
-
background: "brand",
|
|
36
|
-
round: "large"
|
|
37
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
38
|
-
size: "small"
|
|
39
|
-
}, season), /*#__PURE__*/React.createElement(Box, {
|
|
40
|
-
round: "full",
|
|
41
|
-
margin: {
|
|
42
|
-
left: 'xsmall'
|
|
43
|
-
}
|
|
44
|
-
}, /*#__PURE__*/React.createElement(FormClose, {
|
|
45
|
-
size: "small",
|
|
46
|
-
style: {
|
|
47
|
-
width: '12px',
|
|
48
|
-
height: '12px'
|
|
49
|
-
}
|
|
50
|
-
}))));
|
|
51
|
-
};
|
|
52
|
-
var renderOption = function renderOption(option, state) {
|
|
13
|
+
var renderOption = function renderOption(option, index, options, state) {
|
|
53
14
|
return /*#__PURE__*/React.createElement(Box, {
|
|
54
15
|
pad: "small",
|
|
55
|
-
background: state.
|
|
56
|
-
},
|
|
16
|
+
background: state.selected ? 'brand' : undefined
|
|
17
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
18
|
+
color: state.disabled ? 'text-disabled' : 'text-strong'
|
|
19
|
+
}, option));
|
|
57
20
|
};
|
|
58
21
|
return (
|
|
59
22
|
/*#__PURE__*/
|
|
@@ -66,19 +29,29 @@ export var Children = function Children() {
|
|
|
66
29
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
67
30
|
closeOnChange: false,
|
|
68
31
|
multiple: true,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
32
|
+
placeholder: "Select Season",
|
|
33
|
+
valueLabel: function valueLabel(options) {
|
|
34
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
35
|
+
wrap: true,
|
|
36
|
+
direction: "row",
|
|
37
|
+
pad: "xsmall",
|
|
38
|
+
gap: "xsmall",
|
|
39
|
+
cssGap: true,
|
|
40
|
+
width: "small"
|
|
41
|
+
}, options && options.length ? options.map(function (season) {
|
|
42
|
+
return /*#__PURE__*/React.createElement(Tag, {
|
|
43
|
+
key: "season_tag_" + season,
|
|
44
|
+
value: season,
|
|
45
|
+
onRemove: function onRemove(event) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
event.stopPropagation();
|
|
48
|
+
onRemoveSeason(season);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}) : /*#__PURE__*/React.createElement(Text, {
|
|
52
|
+
color: "text-weak"
|
|
53
|
+
}, "Select Season"));
|
|
54
|
+
},
|
|
82
55
|
options: allSeasons,
|
|
83
56
|
value: selected,
|
|
84
57
|
disabled: [2, 6],
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { Box, Button, Text } from 'grommet';
|
|
3
|
+
import { Box, Tag, Text } from 'grommet';
|
|
5
4
|
import { SelectMultiple } from '../../SelectMultiple.js';
|
|
6
5
|
|
|
7
6
|
const allSeasons = [
|
|
@@ -18,41 +17,13 @@ const allSeasons = [
|
|
|
18
17
|
];
|
|
19
18
|
|
|
20
19
|
export const Children = () => {
|
|
21
|
-
const [selected, setSelected] = useState([]);
|
|
20
|
+
const [selected, setSelected] = useState<string[]>([]);
|
|
22
21
|
|
|
23
|
-
const onRemoveSeason = (season) => {
|
|
22
|
+
const onRemoveSeason = (season: string) => {
|
|
24
23
|
setSelected(selected.filter((selectedSeason) => selectedSeason !== season));
|
|
25
24
|
};
|
|
26
25
|
|
|
27
|
-
const
|
|
28
|
-
<Button
|
|
29
|
-
key={`season_tag_${season}`}
|
|
30
|
-
onClick={(event) => {
|
|
31
|
-
event.preventDefault();
|
|
32
|
-
event.stopPropagation();
|
|
33
|
-
onRemoveSeason(season);
|
|
34
|
-
}}
|
|
35
|
-
onFocus={(event) => event.stopPropagation()}
|
|
36
|
-
a11yTitle={season}
|
|
37
|
-
>
|
|
38
|
-
<Box
|
|
39
|
-
align="center"
|
|
40
|
-
direction="row"
|
|
41
|
-
gap="xsmall"
|
|
42
|
-
pad={{ vertical: 'xsmall', horizontal: 'small' }}
|
|
43
|
-
margin="xsmall"
|
|
44
|
-
background="light-3"
|
|
45
|
-
round="large"
|
|
46
|
-
>
|
|
47
|
-
<Text size="small">{season}</Text>
|
|
48
|
-
<Box round="full" margin={{ left: 'xsmall' }}>
|
|
49
|
-
<FormClose size="small" style={{ width: '12px', height: '12px' }} />
|
|
50
|
-
</Box>
|
|
51
|
-
</Box>
|
|
52
|
-
</Button>
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
const renderOption = (option, state) => (
|
|
26
|
+
const renderOption = (option: string, _index: number, _options: string[], state: { active: boolean }) => (
|
|
56
27
|
<Box pad="small" background={state.active ? 'active' : undefined}>
|
|
57
28
|
{option}
|
|
58
29
|
</Box>
|
|
@@ -66,25 +37,30 @@ export const Children = () => {
|
|
|
66
37
|
<SelectMultiple
|
|
67
38
|
sortSelectedOnClose={false}
|
|
68
39
|
showSelectedInline
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
40
|
+
placeholder="Select Season"
|
|
41
|
+
width="medium"
|
|
42
|
+
valueLabel={(options: any[]) => (
|
|
43
|
+
<Box
|
|
44
|
+
wrap
|
|
45
|
+
direction="row"
|
|
46
|
+
pad="xsmall"
|
|
47
|
+
gap="xsmall"
|
|
48
|
+
cssGap
|
|
49
|
+
>
|
|
50
|
+
{options && options.length &&
|
|
51
|
+
options.map((season) => (
|
|
52
|
+
<Tag
|
|
53
|
+
key={`season_tag_${season}`}
|
|
54
|
+
value={season}
|
|
55
|
+
onRemove={() => onRemoveSeason(season)}
|
|
56
|
+
/>
|
|
57
|
+
))
|
|
58
|
+
}
|
|
81
59
|
</Box>
|
|
82
60
|
)}
|
|
83
61
|
options={allSeasons}
|
|
84
62
|
value={selected}
|
|
85
|
-
onChange={({ value }) =>
|
|
86
|
-
setSelected([...value]);
|
|
87
|
-
}}
|
|
63
|
+
onChange={({ value }: { value: any[] }) => setSelected([...value])}
|
|
88
64
|
>
|
|
89
65
|
{renderOption}
|
|
90
66
|
</SelectMultiple>
|