@kaizen/components 1.20.5 → 1.22.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/dist/cjs/{SuccessIcon-562c344e.js → SuccessIcon-0162523d.js} +8 -3
- package/dist/cjs/SuccessIcon-0162523d.js.map +1 -0
- package/dist/cjs/SuccessIcon-4263d4c3.js +145 -0
- package/dist/cjs/SuccessIcon-4263d4c3.js.map +1 -0
- package/dist/cjs/dts/BrandMoment/_docs/ExampleHeaders.d.ts +4 -0
- package/dist/cjs/dts/Button/Button.d.ts +1 -15
- package/dist/cjs/dts/Button/components/GenericButton.d.ts +23 -10
- package/dist/cjs/dts/Button/index.d.ts +1 -0
- package/dist/cjs/dts/FilterBar/context/FilterBarContext.d.ts +5 -0
- package/dist/cjs/dts/FilterBar/context/reducer/filterBarStateReducer.d.ts +2 -0
- package/dist/cjs/dts/FilterBar/context/reducer/setupFilterBarState.d.ts +1 -1
- package/dist/cjs/dts/FilterBar/context/types.d.ts +3 -2
- package/dist/cjs/dts/FilterMultiSelect/FilterMultiSelect.d.ts +3 -6
- package/dist/cjs/dts/FilterMultiSelect/_docs/FilterBarExample/DemographicMenu.d.ts +13 -0
- package/dist/cjs/dts/FilterMultiSelect/_docs/FilterBarExample/DemographicValueSelect.d.ts +9 -0
- package/dist/cjs/dts/FilterMultiSelect/_docs/FilterBarExample/useDemographicData.d.ts +16 -0
- package/dist/cjs/dts/FilterMultiSelect/_docs/MockData.d.ts +10 -0
- package/dist/cjs/dts/FilterMultiSelect/subcomponents/ListBoxSection/ListBoxSection.d.ts +20 -5
- package/dist/cjs/dts/FilterMultiSelect/subcomponents/LoadMoreButton/LoadMoreButton.d.ts +1 -1
- package/dist/cjs/dts/FilterMultiSelect/subcomponents/SectionDivider/SectionDivider.d.ts +1 -4
- package/dist/cjs/dts/Workflow/subcomponents/Header/Header.d.ts +1 -1
- package/dist/cjs/dts/__future__/Workflow/subcomponents/Header/Header.d.ts +1 -1
- package/dist/cjs/future.js +1 -1
- package/dist/cjs/future.js.map +1 -1
- package/dist/cjs/index.css +14 -14
- package/dist/cjs/index.js +143 -112
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/{SuccessIcon-30b83808.js → SuccessIcon-2a676737.js} +8 -3
- package/dist/esm/SuccessIcon-2a676737.js.map +1 -0
- package/dist/esm/SuccessIcon-a903453a.js +138 -0
- package/dist/esm/SuccessIcon-a903453a.js.map +1 -0
- package/dist/esm/dts/BrandMoment/_docs/ExampleHeaders.d.ts +4 -0
- package/dist/esm/dts/Button/Button.d.ts +1 -15
- package/dist/esm/dts/Button/components/GenericButton.d.ts +23 -10
- package/dist/esm/dts/Button/index.d.ts +1 -0
- package/dist/esm/dts/FilterBar/context/FilterBarContext.d.ts +5 -0
- package/dist/esm/dts/FilterBar/context/reducer/filterBarStateReducer.d.ts +2 -0
- package/dist/esm/dts/FilterBar/context/reducer/setupFilterBarState.d.ts +1 -1
- package/dist/esm/dts/FilterBar/context/types.d.ts +3 -2
- package/dist/esm/dts/FilterMultiSelect/FilterMultiSelect.d.ts +3 -6
- package/dist/esm/dts/FilterMultiSelect/_docs/FilterBarExample/DemographicMenu.d.ts +13 -0
- package/dist/esm/dts/FilterMultiSelect/_docs/FilterBarExample/DemographicValueSelect.d.ts +9 -0
- package/dist/esm/dts/FilterMultiSelect/_docs/FilterBarExample/useDemographicData.d.ts +16 -0
- package/dist/esm/dts/FilterMultiSelect/_docs/MockData.d.ts +10 -0
- package/dist/esm/dts/FilterMultiSelect/subcomponents/ListBoxSection/ListBoxSection.d.ts +20 -5
- package/dist/esm/dts/FilterMultiSelect/subcomponents/LoadMoreButton/LoadMoreButton.d.ts +1 -1
- package/dist/esm/dts/FilterMultiSelect/subcomponents/SectionDivider/SectionDivider.d.ts +1 -4
- package/dist/esm/dts/Workflow/subcomponents/Header/Header.d.ts +1 -1
- package/dist/esm/dts/__future__/Workflow/subcomponents/Header/Header.d.ts +1 -1
- package/dist/esm/future.js +1 -1
- package/dist/esm/future.js.map +1 -1
- package/dist/esm/index.css +15 -15
- package/dist/esm/index.js +143 -112
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +42 -19
- package/dist/styles.css +1 -1
- package/icons/chevron-down.icon.svg +15 -2
- package/icons/chevron-up.icon.svg +15 -3
- package/icons/clear.icon.svg +15 -2
- package/icons/comment-bank.icon.svg +18 -0
- package/icons/connect-line.icon.svg +5 -0
- package/icons/empty.icon.svg +14 -4
- package/icons/insights.icon.svg +5 -0
- package/icons/live.icon.svg +8 -0
- package/icons/success.icon.svg +15 -7
- package/package.json +17 -18
- package/dist/cjs/SuccessIcon-562c344e.js.map +0 -1
- package/dist/esm/SuccessIcon-30b83808.js.map +0 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as __rest, a as __assign, S as SVG, b as __spreadArray, c as SuccessIcon, I as IndicatorActiveIcon, d as IndicatorInactiveIcon } from './SuccessIcon-
|
|
1
|
+
import { _ as __rest, a as __assign, S as SVG, b as __spreadArray, c as SuccessIcon, I as IndicatorActiveIcon, d as IndicatorInactiveIcon } from './SuccessIcon-a903453a.js';
|
|
2
2
|
import React, { forwardRef, useRef, useImperativeHandle, useState, useEffect, useContext, useMemo, useReducer, useCallback, createContext } from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { BadgeAnimated, Badge } from '@kaizen/draft-badge';
|
|
@@ -7,6 +7,7 @@ import { FocusOn } from 'react-focus-on';
|
|
|
7
7
|
import { usePopper } from 'react-popper';
|
|
8
8
|
import { formatDateAsText, isInvalidDate, DateInput, getLocale, CalendarSingle } from '@kaizen/date-picker';
|
|
9
9
|
import { v4 } from 'uuid';
|
|
10
|
+
import { validateDate as validateDate$1 } from '@kaizen/date-picker/src/utils/validateDate';
|
|
10
11
|
import { formatDateAsNumeral } from '@kaizen/date-picker/src/utils/formatDateAsNumeral';
|
|
11
12
|
import { isDisabledDate } from '@kaizen/date-picker/src/utils/isDisabledDate';
|
|
12
13
|
import { isSelectingDayInCalendar } from '@kaizen/date-picker/src/utils/isSelectingDayInCalendar';
|
|
@@ -14,7 +15,6 @@ import { parseDateFromNumeralFormatValue } from '@kaizen/date-picker/src/utils/p
|
|
|
14
15
|
import { parseDateFromTextFormatValue } from '@kaizen/date-picker/src/utils/parseDateFromTextFormatValue';
|
|
15
16
|
import { FieldMessage } from '@kaizen/draft-form';
|
|
16
17
|
import { useIntl, StaticIntlProvider, FormattedMessage } from '@cultureamp/i18n-react-intl';
|
|
17
|
-
import { validateDate as validateDate$1 } from '@kaizen/date-picker/src/utils/validateDate';
|
|
18
18
|
import { Tooltip } from '@kaizen/draft-tooltip';
|
|
19
19
|
import { getLocale as getLocale$1 } from '@kaizen/date-picker/src/utils/getLocale';
|
|
20
20
|
import { formatDateAsText as formatDateAsText$1 } from '@kaizen/date-picker/src/utils/formatDateAsText';
|
|
@@ -28,7 +28,6 @@ import { useListState } from '@react-stately/list';
|
|
|
28
28
|
import { useButton } from '@react-aria/button';
|
|
29
29
|
import { useMenuTrigger } from '@react-aria/menu';
|
|
30
30
|
import { useMenuTriggerState } from '@react-stately/menu';
|
|
31
|
-
import { Button as Button$1 } from '@kaizen/button';
|
|
32
31
|
import { LoadingInput, LoadingParagraph } from '@kaizen/loading-skeleton';
|
|
33
32
|
import { useFocusRing, FocusScope } from '@react-aria/focus';
|
|
34
33
|
import { mergeProps } from '@react-aria/utils';
|
|
@@ -321,6 +320,7 @@ var updateDependentFilters = function(state) {
|
|
|
321
320
|
if (!isUsable) {
|
|
322
321
|
state.activeFilterIds["delete"](id);
|
|
323
322
|
state.values[id] = void 0;
|
|
323
|
+
state.hasUpdatedValues = true;
|
|
324
324
|
return;
|
|
325
325
|
}
|
|
326
326
|
if (!state.filters[id].isRemovable || state.values[id] !== void 0) {
|
|
@@ -344,13 +344,15 @@ var updateValues = function(state, values) {
|
|
|
344
344
|
state.activeFilterIds.add(id);
|
|
345
345
|
}
|
|
346
346
|
});
|
|
347
|
-
return updateDependentFilters(__assign(__assign({}, state), { values }));
|
|
347
|
+
return updateDependentFilters(__assign(__assign({}, state), { hasUpdatedValues: true, values }));
|
|
348
348
|
};
|
|
349
349
|
|
|
350
350
|
var filterBarStateReducer = function(state, action) {
|
|
351
351
|
switch (action.type) {
|
|
352
352
|
case "update_values":
|
|
353
353
|
return __assign({}, updateValues(state, action.values));
|
|
354
|
+
case "complete_update_values":
|
|
355
|
+
return __assign(__assign({}, state), { hasUpdatedValues: false });
|
|
354
356
|
case "update_single_filter":
|
|
355
357
|
return __assign(__assign({}, state), { filters: updateSingleFilter(state, action.id, action.data) });
|
|
356
358
|
case "activate_filter":
|
|
@@ -359,11 +361,11 @@ var filterBarStateReducer = function(state, action) {
|
|
|
359
361
|
case "deactivate_filter":
|
|
360
362
|
state.activeFilterIds["delete"](action.id);
|
|
361
363
|
state.values[action.id] = void 0;
|
|
362
|
-
return __assign({}, updateDependentFilters(state));
|
|
364
|
+
return __assign(__assign({}, updateDependentFilters(state)), { hasUpdatedValues: true });
|
|
363
365
|
}
|
|
364
366
|
};
|
|
365
367
|
|
|
366
|
-
var setupFilterBarState = function(filters) {
|
|
368
|
+
var setupFilterBarState = function(filters, values) {
|
|
367
369
|
var state = filters.reduce(function(baseState, _a) {
|
|
368
370
|
var id = _a.id, name = _a.name, isRemovable = _a.isRemovable, isUsableWhen = _a.isUsableWhen;
|
|
369
371
|
var hasDependency = isUsableWhen !== void 0;
|
|
@@ -373,25 +375,23 @@ var setupFilterBarState = function(filters) {
|
|
|
373
375
|
isRemovable: isRemovable !== null && isRemovable !== void 0 ? isRemovable : false,
|
|
374
376
|
isUsableWhen,
|
|
375
377
|
isOpen: false,
|
|
376
|
-
|
|
377
|
-
// will be re-evaluated in the `update_values` dispatch action.
|
|
378
|
-
isUsable: hasDependency ? null : true
|
|
378
|
+
isUsable: true
|
|
379
379
|
};
|
|
380
380
|
if (hasDependency) {
|
|
381
381
|
baseState.dependentFilterIds.add(id);
|
|
382
382
|
}
|
|
383
|
+
if (!isRemovable || values[id] !== void 0) {
|
|
384
|
+
baseState.activeFilterIds.add(id);
|
|
385
|
+
}
|
|
383
386
|
return baseState;
|
|
384
387
|
}, {
|
|
385
388
|
filters: {},
|
|
386
|
-
// These will be set by the `update_values` dispatch action.
|
|
387
389
|
activeFilterIds: /* @__PURE__ */ new Set(),
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
values: null,
|
|
392
|
-
dependentFilterIds: /* @__PURE__ */ new Set()
|
|
390
|
+
values,
|
|
391
|
+
dependentFilterIds: /* @__PURE__ */ new Set(),
|
|
392
|
+
hasUpdatedValues: false
|
|
393
393
|
});
|
|
394
|
-
return state;
|
|
394
|
+
return updateDependentFilters(state);
|
|
395
395
|
};
|
|
396
396
|
|
|
397
397
|
var checkArraysMatch$1 = function(a1, a2) {
|
|
@@ -449,7 +449,7 @@ var FilterBarProvider = function(_a) {
|
|
|
449
449
|
var mappedFilters = useMemo(function() {
|
|
450
450
|
return getMappedFilters(filters);
|
|
451
451
|
}, [filters]);
|
|
452
|
-
var _b = useReducer(filterBarStateReducer, setupFilterBarState(filters)), state = _b[0], dispatch = _b[1];
|
|
452
|
+
var _b = useReducer(filterBarStateReducer, setupFilterBarState(filters, values)), state = _b[0], dispatch = _b[1];
|
|
453
453
|
var value = {
|
|
454
454
|
getFilterState: function(id) {
|
|
455
455
|
return __assign(__assign({}, state.filters[id]), { isActive: state.activeFilterIds.has(id), value: values[id] });
|
|
@@ -460,6 +460,12 @@ var FilterBarProvider = function(_a) {
|
|
|
460
460
|
toggleOpenFilter: function(id, isOpen) {
|
|
461
461
|
dispatch({ type: "update_single_filter", id, data: { isOpen } });
|
|
462
462
|
},
|
|
463
|
+
setFilterOpenState: function(id, isOpen) {
|
|
464
|
+
dispatch({ type: "update_single_filter", id, data: { isOpen } });
|
|
465
|
+
},
|
|
466
|
+
openFilter: function(id) {
|
|
467
|
+
dispatch({ type: "update_single_filter", id, data: { isOpen: true } });
|
|
468
|
+
},
|
|
463
469
|
updateValue: function(id, newValue) {
|
|
464
470
|
var _a2;
|
|
465
471
|
dispatch({
|
|
@@ -485,14 +491,15 @@ var FilterBarProvider = function(_a) {
|
|
|
485
491
|
}
|
|
486
492
|
};
|
|
487
493
|
useEffect(function() {
|
|
488
|
-
var shouldUpdate =
|
|
494
|
+
var shouldUpdate = checkShouldUpdateValues(state, values);
|
|
489
495
|
if (shouldUpdate)
|
|
490
496
|
dispatch({ type: "update_values", values: __assign({}, values) });
|
|
491
497
|
}, [values]);
|
|
492
498
|
useEffect(function() {
|
|
493
|
-
|
|
494
|
-
if (shouldUpdate)
|
|
499
|
+
if (state.hasUpdatedValues) {
|
|
495
500
|
onValuesChange(__assign({}, state.values));
|
|
501
|
+
dispatch({ type: "complete_update_values" });
|
|
502
|
+
}
|
|
496
503
|
}, [state]);
|
|
497
504
|
var activeFilters = Array.from(state.activeFilterIds, function(id) {
|
|
498
505
|
return mappedFilters[id];
|
|
@@ -507,6 +514,79 @@ var FilterBarProvider = function(_a) {
|
|
|
507
514
|
);
|
|
508
515
|
};
|
|
509
516
|
|
|
517
|
+
var styles$E = {"labelledMessage":"LabelledMessage-module_labelledMessage__8hqzY","labelSeparator":"LabelledMessage-module_labelSeparator__f3zFN"};
|
|
518
|
+
|
|
519
|
+
var LabelledMessage = function(_a) {
|
|
520
|
+
var label = _a.label, message = _a.message;
|
|
521
|
+
return React.createElement(
|
|
522
|
+
"span",
|
|
523
|
+
{ className: styles$E.labelledMessage },
|
|
524
|
+
React.createElement("span", null, label),
|
|
525
|
+
React.createElement("span", { className: styles$E.labelSeparator }, ":"),
|
|
526
|
+
React.createElement("span", null, message)
|
|
527
|
+
);
|
|
528
|
+
};
|
|
529
|
+
LabelledMessage.displayName = "LabelledMessage";
|
|
530
|
+
|
|
531
|
+
var getNodeText = function(node) {
|
|
532
|
+
if (!node)
|
|
533
|
+
return "";
|
|
534
|
+
if (typeof node === "string" || typeof node === "number")
|
|
535
|
+
return node;
|
|
536
|
+
if (node instanceof Array)
|
|
537
|
+
return node.map(getNodeText).join("");
|
|
538
|
+
if (React.isValidElement(node))
|
|
539
|
+
return getNodeText(node.props.children);
|
|
540
|
+
return "";
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
var getDateValidationHandler = function(_a) {
|
|
544
|
+
var onValidate = _a.onValidate, setInbuiltValidationMessage = _a.setInbuiltValidationMessage, inputLabel = _a.inputLabel;
|
|
545
|
+
return function(validationResponse) {
|
|
546
|
+
if (onValidate)
|
|
547
|
+
return onValidate(validationResponse);
|
|
548
|
+
var validationMessage = validationResponse.validationMessage;
|
|
549
|
+
if (!validationMessage) {
|
|
550
|
+
setInbuiltValidationMessage(void 0);
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
setInbuiltValidationMessage({
|
|
554
|
+
status: validationMessage.status,
|
|
555
|
+
message: inputLabel ? React.createElement(LabelledMessage, { label: "".concat(getNodeText(inputLabel)), message: validationMessage.message }) : validationMessage.message
|
|
556
|
+
});
|
|
557
|
+
};
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
var validateDate = function(args) {
|
|
561
|
+
var response = validateDate$1(args);
|
|
562
|
+
var _a = response.validationResponse, status = _a.status, validationMessage = _a.validationMessage, rest = __rest(_a, ["status", "validationMessage"]);
|
|
563
|
+
return __assign(__assign({}, response), { validationResponse: __assign(__assign({}, rest), { validationMessage: status && validationMessage ? { status, message: validationMessage } : void 0 }) });
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
var useDateValidation = function(_a) {
|
|
567
|
+
var inputLabel = _a.inputLabel, disabledDays = _a.disabledDays, validationMessage = _a.validationMessage, onValidate = _a.onValidate;
|
|
568
|
+
var _b = useState(), inbuiltValidationMessage = _b[0], setInbuiltValidationMessage = _b[1];
|
|
569
|
+
var shouldUseInbuiltDateValidation = onValidate === void 0;
|
|
570
|
+
var updateValidation = getDateValidationHandler({
|
|
571
|
+
onValidate,
|
|
572
|
+
setInbuiltValidationMessage,
|
|
573
|
+
inputLabel
|
|
574
|
+
});
|
|
575
|
+
var validateSingleDate = function(_a2) {
|
|
576
|
+
var date = _a2.date, inputValue = _a2.inputValue;
|
|
577
|
+
return validateDate({
|
|
578
|
+
date,
|
|
579
|
+
inputValue,
|
|
580
|
+
disabledDays
|
|
581
|
+
});
|
|
582
|
+
};
|
|
583
|
+
return {
|
|
584
|
+
validationMessage: shouldUseInbuiltDateValidation ? inbuiltValidationMessage : validationMessage,
|
|
585
|
+
validateDate: validateSingleDate,
|
|
586
|
+
updateValidation
|
|
587
|
+
};
|
|
588
|
+
};
|
|
589
|
+
|
|
510
590
|
var transformDateToInputValue = function(date, disabledDays, locale) {
|
|
511
591
|
return date ? formatDateAsText(date, disabledDays, locale) : "";
|
|
512
592
|
};
|
|
@@ -561,20 +641,6 @@ var useDateInputHandlers = function(_a) {
|
|
|
561
641
|
};
|
|
562
642
|
};
|
|
563
643
|
|
|
564
|
-
var styles$E = {"labelledMessage":"LabelledMessage-module_labelledMessage__8hqzY","labelSeparator":"LabelledMessage-module_labelSeparator__f3zFN"};
|
|
565
|
-
|
|
566
|
-
var LabelledMessage = function(_a) {
|
|
567
|
-
var label = _a.label, message = _a.message;
|
|
568
|
-
return React.createElement(
|
|
569
|
-
"span",
|
|
570
|
-
{ className: styles$E.labelledMessage },
|
|
571
|
-
React.createElement("span", null, label),
|
|
572
|
-
React.createElement("span", { className: styles$E.labelSeparator }, ":"),
|
|
573
|
-
React.createElement("span", null, message)
|
|
574
|
-
);
|
|
575
|
-
};
|
|
576
|
-
LabelledMessage.displayName = "LabelledMessage";
|
|
577
|
-
|
|
578
644
|
var formatDescriptionInputFormat = function(locale) {
|
|
579
645
|
var _a;
|
|
580
646
|
return (_a = locale.formatLong) === null || _a === void 0 ? void 0 : _a.date({ width: "short" }).toLowerCase();
|
|
@@ -728,65 +794,6 @@ var FilterDatePicker = function(_a) {
|
|
|
728
794
|
};
|
|
729
795
|
FilterDatePicker.displayName = "FilterDatePicker";
|
|
730
796
|
|
|
731
|
-
var getNodeText = function(node) {
|
|
732
|
-
if (!node)
|
|
733
|
-
return "";
|
|
734
|
-
if (typeof node === "string" || typeof node === "number")
|
|
735
|
-
return node;
|
|
736
|
-
if (node instanceof Array)
|
|
737
|
-
return node.map(getNodeText).join("");
|
|
738
|
-
if (React.isValidElement(node))
|
|
739
|
-
return getNodeText(node.props.children);
|
|
740
|
-
return "";
|
|
741
|
-
};
|
|
742
|
-
|
|
743
|
-
var getDateValidationHandler = function(_a) {
|
|
744
|
-
var onValidate = _a.onValidate, setInbuiltValidationMessage = _a.setInbuiltValidationMessage, inputLabel = _a.inputLabel;
|
|
745
|
-
return function(validationResponse) {
|
|
746
|
-
if (onValidate)
|
|
747
|
-
return onValidate(validationResponse);
|
|
748
|
-
var validationMessage = validationResponse.validationMessage;
|
|
749
|
-
if (!validationMessage) {
|
|
750
|
-
setInbuiltValidationMessage(void 0);
|
|
751
|
-
return;
|
|
752
|
-
}
|
|
753
|
-
setInbuiltValidationMessage({
|
|
754
|
-
status: validationMessage.status,
|
|
755
|
-
message: inputLabel ? React.createElement(LabelledMessage, { label: "".concat(getNodeText(inputLabel)), message: validationMessage.message }) : validationMessage.message
|
|
756
|
-
});
|
|
757
|
-
};
|
|
758
|
-
};
|
|
759
|
-
|
|
760
|
-
var validateDate = function(args) {
|
|
761
|
-
var response = validateDate$1(args);
|
|
762
|
-
var _a = response.validationResponse, status = _a.status, validationMessage = _a.validationMessage, rest = __rest(_a, ["status", "validationMessage"]);
|
|
763
|
-
return __assign(__assign({}, response), { validationResponse: __assign(__assign({}, rest), { validationMessage: status && validationMessage ? { status, message: validationMessage } : void 0 }) });
|
|
764
|
-
};
|
|
765
|
-
|
|
766
|
-
var useDateValidation = function(_a) {
|
|
767
|
-
var inputLabel = _a.inputLabel, disabledDays = _a.disabledDays, validationMessage = _a.validationMessage, onValidate = _a.onValidate;
|
|
768
|
-
var _b = useState(), inbuiltValidationMessage = _b[0], setInbuiltValidationMessage = _b[1];
|
|
769
|
-
var shouldUseInbuiltDateValidation = onValidate === void 0;
|
|
770
|
-
var updateValidation = getDateValidationHandler({
|
|
771
|
-
onValidate,
|
|
772
|
-
setInbuiltValidationMessage,
|
|
773
|
-
inputLabel
|
|
774
|
-
});
|
|
775
|
-
var validateSingleDate = function(_a2) {
|
|
776
|
-
var date = _a2.date, inputValue = _a2.inputValue;
|
|
777
|
-
return validateDate({
|
|
778
|
-
date,
|
|
779
|
-
inputValue,
|
|
780
|
-
disabledDays
|
|
781
|
-
});
|
|
782
|
-
};
|
|
783
|
-
return {
|
|
784
|
-
validationMessage: shouldUseInbuiltDateValidation ? inbuiltValidationMessage : validationMessage,
|
|
785
|
-
validateDate: validateSingleDate,
|
|
786
|
-
updateValidation
|
|
787
|
-
};
|
|
788
|
-
};
|
|
789
|
-
|
|
790
797
|
var ChevronDownIcon = function(props) {
|
|
791
798
|
return React.createElement(
|
|
792
799
|
SVG,
|
|
@@ -906,7 +913,7 @@ FilterBarButton.displayName = "FilterBar.Button";
|
|
|
906
913
|
|
|
907
914
|
var FilterBarDatePicker = function(_a) {
|
|
908
915
|
var id = _a.id, onDateChange = _a.onDateChange, _b = _a.locale, locale = _b === void 0 ? "en-AU" : _b, props = __rest(_a, ["id", "onDateChange", "locale"]);
|
|
909
|
-
var _c = useFilterBarContext(), getFilterState = _c.getFilterState,
|
|
916
|
+
var _c = useFilterBarContext(), getFilterState = _c.getFilterState, setFilterOpenState = _c.setFilterOpenState, updateValue = _c.updateValue;
|
|
910
917
|
if (!id)
|
|
911
918
|
throw Error("Missing `id` prop in FilterBarDatePicker");
|
|
912
919
|
var filterState = getFilterState(id);
|
|
@@ -916,7 +923,7 @@ var FilterBarDatePicker = function(_a) {
|
|
|
916
923
|
updateValue(id, key);
|
|
917
924
|
onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange(key);
|
|
918
925
|
}, isOpen: filterState.isOpen, setIsOpen: function(open) {
|
|
919
|
-
return
|
|
926
|
+
return setFilterOpenState(id, open);
|
|
920
927
|
} }));
|
|
921
928
|
};
|
|
922
929
|
FilterBarDatePicker.displayName = "FilterBar.DatePicker";
|
|
@@ -1273,14 +1280,14 @@ FilterDateRangePicker.displayName = "FilterDateRangePicker";
|
|
|
1273
1280
|
|
|
1274
1281
|
var FilterBarDateRangePicker = function(_a) {
|
|
1275
1282
|
var id = _a.id, onRangeChange = _a.onRangeChange, _b = _a.locale, locale = _b === void 0 ? "en-AU" : _b, props = __rest(_a, ["id", "onRangeChange", "locale"]);
|
|
1276
|
-
var _c = useFilterBarContext(), getFilterState = _c.getFilterState,
|
|
1283
|
+
var _c = useFilterBarContext(), getFilterState = _c.getFilterState, setFilterOpenState = _c.setFilterOpenState, updateValue = _c.updateValue;
|
|
1277
1284
|
if (!id)
|
|
1278
1285
|
throw Error("Missing `id` prop in FilterBarDateRangePicker");
|
|
1279
1286
|
var filterState = getFilterState(id);
|
|
1280
1287
|
return React.createElement(FilterDateRangePicker, __assign({}, props, { id, label: filterState.name, renderTrigger: function(triggerProps) {
|
|
1281
1288
|
return React.createElement(FilterBarButton, __assign({}, triggerProps, { id, isRemovable: filterState.isRemovable }));
|
|
1282
1289
|
}, isOpen: filterState.isOpen, setIsOpen: function(open) {
|
|
1283
|
-
return
|
|
1290
|
+
return setFilterOpenState(id, open);
|
|
1284
1291
|
}, selectedRange: filterState.value, onRangeChange: function(range) {
|
|
1285
1292
|
updateValue(id, range);
|
|
1286
1293
|
onRangeChange === null || onRangeChange === void 0 ? void 0 : onRangeChange(range);
|
|
@@ -1349,7 +1356,7 @@ var useSelectionContext = function() {
|
|
|
1349
1356
|
var SelectionConsumer = SelectionContext.Consumer;
|
|
1350
1357
|
SelectionProvider.displayName = "SelectionProvider";
|
|
1351
1358
|
|
|
1352
|
-
var styles$t = {"listBox":"ListBox-module_listBox__UNOzJ","overflown":"ListBox-module_overflown__ATtxj","hidden":"ListBox-module_hidden__tQP6S"};
|
|
1359
|
+
var styles$t = {"listBox":"ListBox-module_listBox__UNOzJ","overflown":"ListBox-module_overflown__ATtxj","hidden":"ListBox-module_hidden__tQP6S","noResultsWrapper":"ListBox-module_noResultsWrapper__iJ-x6"};
|
|
1353
1360
|
|
|
1354
1361
|
var getItemsFromKeys = function(items, keys) {
|
|
1355
1362
|
var itemKeys = Array.from(keys);
|
|
@@ -1397,7 +1404,7 @@ var ListBox$1 = function(_a) {
|
|
|
1397
1404
|
return React.createElement(
|
|
1398
1405
|
React.Fragment,
|
|
1399
1406
|
null,
|
|
1400
|
-
React.createElement("div",
|
|
1407
|
+
React.createElement("div", { className: styles$t.noResultsWrapper }, children(itemsState)),
|
|
1401
1408
|
React.createElement("ul", { ref: listRef, className: styles$t.hidden })
|
|
1402
1409
|
);
|
|
1403
1410
|
}
|
|
@@ -1405,15 +1412,36 @@ var ListBox$1 = function(_a) {
|
|
|
1405
1412
|
};
|
|
1406
1413
|
ListBox$1.displayName = "FilterMultiSelect.ListBox";
|
|
1407
1414
|
|
|
1408
|
-
var styles$s = {"listBoxSection":"ListBoxSection-module_listBoxSection__zH8wd"};
|
|
1415
|
+
var styles$s = {"listBoxSection":"ListBoxSection-module_listBoxSection__zH8wd","listBoxSectionHeader":"ListBoxSection-module_listBoxSectionHeader__NcTZR"};
|
|
1409
1416
|
|
|
1410
1417
|
var ListBoxSection$1 = function(_a) {
|
|
1411
|
-
var items = _a.items, sectionName = _a.sectionName,
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1418
|
+
var items = _a.items, children = _a.children, sectionName = _a.sectionName, restProps = __rest(_a, ["items", "children", "sectionName"]);
|
|
1419
|
+
var listSectionId = useState(v4())[0];
|
|
1420
|
+
var hasSectionHeader = "sectionHeader" in restProps;
|
|
1421
|
+
return React.createElement(
|
|
1422
|
+
"li",
|
|
1423
|
+
{ role: "presentation" },
|
|
1424
|
+
React.createElement(
|
|
1425
|
+
"ul",
|
|
1426
|
+
{ className: styles$s.listBoxSection, "aria-label": !hasSectionHeader ? sectionName : void 0, "aria-labelledby": hasSectionHeader ? listSectionId : void 0, role: "group" },
|
|
1427
|
+
hasSectionHeader && React.createElement(
|
|
1428
|
+
"li",
|
|
1429
|
+
{ className: styles$s.listBoxSectionHeader, id: listSectionId, role: "presentation" },
|
|
1430
|
+
sectionName && React.createElement(
|
|
1431
|
+
VisuallyHidden,
|
|
1432
|
+
null,
|
|
1433
|
+
sectionName,
|
|
1434
|
+
". "
|
|
1435
|
+
),
|
|
1436
|
+
restProps.sectionHeader
|
|
1437
|
+
),
|
|
1438
|
+
Array.from(items).map(function(node) {
|
|
1439
|
+
return node != void 0 && children(node);
|
|
1440
|
+
})
|
|
1441
|
+
)
|
|
1442
|
+
);
|
|
1415
1443
|
};
|
|
1416
|
-
ListBoxSection$1.displayName = "
|
|
1444
|
+
ListBoxSection$1.displayName = "ListBoxSection";
|
|
1417
1445
|
|
|
1418
1446
|
var styles$r = {"container":"LoadMoreButton-module_container__5VoUY"};
|
|
1419
1447
|
|
|
@@ -1421,7 +1449,7 @@ var LoadMoreButton = function(props) {
|
|
|
1421
1449
|
return React.createElement(
|
|
1422
1450
|
"div",
|
|
1423
1451
|
{ className: styles$r.container },
|
|
1424
|
-
React.createElement(Button
|
|
1452
|
+
React.createElement(Button, __assign({}, props, { fullWidth: true }))
|
|
1425
1453
|
);
|
|
1426
1454
|
};
|
|
1427
1455
|
LoadMoreButton.displayName = "FilterMultiSelect.LoadMoreButton";
|
|
@@ -1637,9 +1665,12 @@ SearchInput.displayName = "FilterMultiSelect.SearchInput";
|
|
|
1637
1665
|
var styles$j = {"divider":"SectionDivider-module_divider__zlsWs"};
|
|
1638
1666
|
|
|
1639
1667
|
var SectionDivider$1 = function() {
|
|
1640
|
-
return React.createElement(
|
|
1668
|
+
return React.createElement(
|
|
1669
|
+
"li",
|
|
1670
|
+
{ className: styles$j.divider, "aria-hidden": "true" },
|
|
1671
|
+
React.createElement(Divider, { variant: "canvas" })
|
|
1672
|
+
);
|
|
1641
1673
|
};
|
|
1642
|
-
SectionDivider$1.displayName = "FilterMultiSelect.SectionDivider";
|
|
1643
1674
|
|
|
1644
1675
|
var styles$i = {"button":"SelectionControlButton-module_button__F6wec","isDisabled":"SelectionControlButton-module_isDisabled__lYOrG"};
|
|
1645
1676
|
|
|
@@ -1776,7 +1807,7 @@ var convertConsumableFormatIntoSelection = function(value) {
|
|
|
1776
1807
|
};
|
|
1777
1808
|
var FilterBarMultiSelect = function(_a) {
|
|
1778
1809
|
var id = _a.id, propsItems = _a.items, children = _a.children, onSelectionChange = _a.onSelectionChange, props = __rest(_a, ["id", "items", "children", "onSelectionChange"]);
|
|
1779
|
-
var _b = useFilterBarContext(), getFilterState = _b.getFilterState,
|
|
1810
|
+
var _b = useFilterBarContext(), getFilterState = _b.getFilterState, setFilterOpenState = _b.setFilterOpenState, updateValue = _b.updateValue, hideFilter = _b.hideFilter;
|
|
1780
1811
|
var _c = useState(propsItems), items = _c[0], setItems = _c[1];
|
|
1781
1812
|
if (!id)
|
|
1782
1813
|
throw Error("Missing `id` prop in FilterBarMultiSelect");
|
|
@@ -1811,7 +1842,7 @@ var FilterBarMultiSelect = function(_a) {
|
|
|
1811
1842
|
items,
|
|
1812
1843
|
isOpen: filterState.isOpen,
|
|
1813
1844
|
onOpenChange: function(open) {
|
|
1814
|
-
return
|
|
1845
|
+
return setFilterOpenState(id, open);
|
|
1815
1846
|
},
|
|
1816
1847
|
trigger: function() {
|
|
1817
1848
|
var triggerProps = {
|
|
@@ -1995,7 +2026,7 @@ FilterSelect.ItemDefaultRender = ListItem;
|
|
|
1995
2026
|
|
|
1996
2027
|
var FilterBarSelect = function(_a) {
|
|
1997
2028
|
var id = _a.id, propsItems = _a.items, onSelectionChange = _a.onSelectionChange, props = __rest(_a, ["id", "items", "onSelectionChange"]);
|
|
1998
|
-
var _b = useFilterBarContext(), getFilterState = _b.getFilterState,
|
|
2029
|
+
var _b = useFilterBarContext(), getFilterState = _b.getFilterState, setFilterOpenState = _b.setFilterOpenState, updateValue = _b.updateValue;
|
|
1999
2030
|
var _c = useState(propsItems), items = _c[0], setItems = _c[1];
|
|
2000
2031
|
if (!id)
|
|
2001
2032
|
throw Error("Missing `id` prop in FilterBarSelect");
|
|
@@ -2021,7 +2052,7 @@ var FilterBarSelect = function(_a) {
|
|
|
2021
2052
|
updateValue(id, key);
|
|
2022
2053
|
onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(key);
|
|
2023
2054
|
}, isOpen: filterState.isOpen, setIsOpen: function(open) {
|
|
2024
|
-
return
|
|
2055
|
+
return setFilterOpenState(id, open);
|
|
2025
2056
|
} }));
|
|
2026
2057
|
};
|
|
2027
2058
|
FilterBarSelect.displayName = "FilterBarSelect";
|