@mmb-digital/ds-lilly 0.0.1-alpha.358 → 0.0.1-alpha.361
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/ds-lilly.css +1 -1
- package/dist/ds-lilly.js +247 -168
- package/dist/types/src/components/Components/Card/Card.d.ts +3 -1
- package/dist/types/src/components/Components/Dropdown/_elements_/DropdownMenu.d.ts +2 -1
- package/dist/types/src/components/Form/Select2/Select2.d.ts +3 -1
- package/dist/types/src/components/Layout/Flex/Flex.d.ts +5 -1
- package/dist/types/src/components/Layout/MobilePanel/MobilePanel.d.ts +1 -1
- package/dist/types/src/components/Layout/MobilePanel/_elements_/Header.d.ts +3 -1
- package/dist/types/src/contexts/MobilePanelContext.d.ts +2 -0
- package/dist/types/src/contexts/Select2Context.d.ts +8 -5
- package/dist/types/src/utils/index.d.ts +1 -0
- package/dist/types/src/utils/noop.d.ts +2 -0
- package/package.json +1 -1
package/dist/ds-lilly.js
CHANGED
|
@@ -80151,6 +80151,7 @@ __webpack_require__.d(__webpack_exports__, "useWindowWidth", function() { return
|
|
|
80151
80151
|
__webpack_require__.d(__webpack_exports__, "useThemeDetector", function() { return /* reexport */ useThemeDetector; });
|
|
80152
80152
|
__webpack_require__.d(__webpack_exports__, "useContainerDimensions", function() { return /* reexport */ useContainerDimensions; });
|
|
80153
80153
|
__webpack_require__.d(__webpack_exports__, "useOnScreen", function() { return /* reexport */ useOnScreen; });
|
|
80154
|
+
__webpack_require__.d(__webpack_exports__, "noop", function() { return /* reexport */ noop; });
|
|
80154
80155
|
__webpack_require__.d(__webpack_exports__, "parseDecimalValue", function() { return /* reexport */ parseDecimalValue; });
|
|
80155
80156
|
__webpack_require__.d(__webpack_exports__, "isDate", function() { return /* reexport */ isDate; });
|
|
80156
80157
|
__webpack_require__.d(__webpack_exports__, "isPartOfDate", function() { return /* reexport */ isPartOfDate; });
|
|
@@ -84133,6 +84134,9 @@ var useOnScreen = function (ref) {
|
|
|
84133
84134
|
return isIntersecting;
|
|
84134
84135
|
};
|
|
84135
84136
|
|
|
84137
|
+
// CONCATENATED MODULE: ./src/utils/noop.ts
|
|
84138
|
+
var noop = function () { return null; };
|
|
84139
|
+
|
|
84136
84140
|
// CONCATENATED MODULE: ./src/utils/parseDecimalValue.ts
|
|
84137
84141
|
|
|
84138
84142
|
|
|
@@ -84216,6 +84220,7 @@ var formatMonthDate = function (date, language) {
|
|
|
84216
84220
|
|
|
84217
84221
|
|
|
84218
84222
|
|
|
84223
|
+
|
|
84219
84224
|
// CONCATENATED MODULE: ./src/constants/global.ts
|
|
84220
84225
|
// Mobile constants
|
|
84221
84226
|
var MOBILE_PANEL_WIDTH = 320;
|
|
@@ -84232,12 +84237,12 @@ var BREAKPOINTS_VALUES = {
|
|
|
84232
84237
|
|
|
84233
84238
|
// CONCATENATED MODULE: ./src/contexts/CardContext.tsx
|
|
84234
84239
|
|
|
84235
|
-
var
|
|
84240
|
+
var CardContext_noop = function () { return null; };
|
|
84236
84241
|
var CardContext = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["createContext"])({
|
|
84237
84242
|
hasCustomTrigger: false,
|
|
84238
84243
|
identification: '',
|
|
84239
84244
|
isOpened: false,
|
|
84240
|
-
setIsOpened:
|
|
84245
|
+
setIsOpened: CardContext_noop
|
|
84241
84246
|
});
|
|
84242
84247
|
CardContext.displayName = 'CardContext';
|
|
84243
84248
|
/* harmony default export */ var contexts_CardContext = (CardContext);
|
|
@@ -84275,14 +84280,15 @@ ModalContext.displayName = 'ModalContext';
|
|
|
84275
84280
|
|
|
84276
84281
|
// CONCATENATED MODULE: ./src/contexts/Select2Context.tsx
|
|
84277
84282
|
|
|
84278
|
-
|
|
84283
|
+
|
|
84279
84284
|
var Select2Context = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["createContext"])({
|
|
84280
84285
|
items: [],
|
|
84281
84286
|
name: '',
|
|
84282
|
-
optionClick:
|
|
84283
|
-
|
|
84284
|
-
|
|
84285
|
-
|
|
84287
|
+
optionClick: noop,
|
|
84288
|
+
emptyOptionClick: noop,
|
|
84289
|
+
setFocusedCategoryIndex: noop,
|
|
84290
|
+
setFocusedItemIndex: noop,
|
|
84291
|
+
setValue: noop,
|
|
84286
84292
|
value: ''
|
|
84287
84293
|
});
|
|
84288
84294
|
Select2Context.displayName = 'Select2Context';
|
|
@@ -84500,10 +84506,12 @@ var Badge = function (_a) {
|
|
|
84500
84506
|
|
|
84501
84507
|
var Flex = function (_a) {
|
|
84502
84508
|
var _b;
|
|
84503
|
-
var _c = _a.alignItems, alignItems = _c === void 0 ? 'baseline' : _c, children = _a.children, direction = _a.direction, justifyContent = _a.justifyContent, onClick = _a.onClick, testId = _a.testId, theme = _a.theme, _d = _a.wrap, wrap = _d === void 0 ? 'nowrap' : _d;
|
|
84509
|
+
var _c = _a.alignItems, alignItems = _c === void 0 ? 'baseline' : _c, children = _a.children, direction = _a.direction, isAlignItemsResponsive = _a.isAlignItemsResponsive, isDirectionResponsive = _a.isDirectionResponsive, justifyContent = _a.justifyContent, onClick = _a.onClick, testId = _a.testId, theme = _a.theme, _d = _a.wrap, wrap = _d === void 0 ? 'nowrap' : _d;
|
|
84504
84510
|
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { className: classBinder_cx('c-flex', (_b = {},
|
|
84505
84511
|
_b["c-flex--align-items--" + alignItems] = alignItems,
|
|
84512
|
+
_b["c-flex--align-items--responsive"] = isAlignItemsResponsive,
|
|
84506
84513
|
_b["c-flex--direction--" + direction] = direction,
|
|
84514
|
+
_b['c-flex--direction--responsive'] = isDirectionResponsive,
|
|
84507
84515
|
_b["c-flex--justify-content--" + justifyContent] = justifyContent,
|
|
84508
84516
|
_b["c-flex--wrap--" + wrap] = wrap,
|
|
84509
84517
|
_b), theme), "data-testid": testId, onClick: onClick }, children));
|
|
@@ -96002,7 +96010,7 @@ var CollapseHeader = function (_a) {
|
|
|
96002
96010
|
|
|
96003
96011
|
var Card = function (_a) {
|
|
96004
96012
|
var _b;
|
|
96005
|
-
var backgroundColor = _a.backgroundColor, borderColor = _a.borderColor, children = _a.children, _c = _a.hasCustomTrigger, hasCustomTrigger = _c === void 0 ? false : _c, collapseHeader = _a.header, iconBackgroundColor = _a.iconBackgroundColor, iconName = _a.iconName, isCollapsible = _a.isCollapsible, isIconAlignTop = _a.isIconAlignTop, isInteractive = _a.isInteractive, _d = _a.isOpen, isOpen = _d === void 0 ? false : _d, isSelected = _a.isSelected, onClick = _a.onClick, onToggle = _a.onToggle, shadowSize = _a.shadowSize, size = _a.size, testId = _a.testId, theme = _a.theme, _e = _a.withoutRole, withoutRole = _e === void 0 ? false : _e;
|
|
96013
|
+
var allowEventPropagation = _a.allowEventPropagation, backgroundColor = _a.backgroundColor, borderColor = _a.borderColor, children = _a.children, _c = _a.hasCustomTrigger, hasCustomTrigger = _c === void 0 ? false : _c, collapseHeader = _a.header, iconBackgroundColor = _a.iconBackgroundColor, iconName = _a.iconName, isCollapsible = _a.isCollapsible, isIconAlignTop = _a.isIconAlignTop, isInteractive = _a.isInteractive, _d = _a.isOpen, isOpen = _d === void 0 ? false : _d, isSelected = _a.isSelected, onClick = _a.onClick, onToggle = _a.onToggle, shadowSize = _a.shadowSize, size = _a.size, testId = _a.testId, theme = _a.theme, _e = _a.withoutRole, withoutRole = _e === void 0 ? false : _e;
|
|
96006
96014
|
var identification = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useMemo"])(function () { return "card_" + cuid_default()(); }, []);
|
|
96007
96015
|
var _f = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(isOpen), isOpened = _f[0], setIsOpened = _f[1];
|
|
96008
96016
|
var cardRef = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useRef"])(null);
|
|
@@ -96016,7 +96024,9 @@ var Card = function (_a) {
|
|
|
96016
96024
|
var handleOnClick = function (event) {
|
|
96017
96025
|
if (isInteractive && onClick) {
|
|
96018
96026
|
onClick(event);
|
|
96019
|
-
|
|
96027
|
+
if (!allowEventPropagation) {
|
|
96028
|
+
event.stopPropagation();
|
|
96029
|
+
}
|
|
96020
96030
|
}
|
|
96021
96031
|
};
|
|
96022
96032
|
var handleOnToggle = function (event) {
|
|
@@ -96156,10 +96166,10 @@ var Dropdown = function (_a) {
|
|
|
96156
96166
|
|
|
96157
96167
|
var DropdownMenu = function (_a) {
|
|
96158
96168
|
var _b;
|
|
96159
|
-
var activeDescendant = _a.activeDescendant, _c = _a.ariaHidden, ariaHidden = _c === void 0 ? false : _c, children = _a.children, id = _a.id, labelledBy = _a.labelledBy, onKeyDown = _a.onKeyDown, role = _a.role, tabIndex = _a.tabIndex, testId = _a.testId, theme = _a.theme, title = _a.title;
|
|
96169
|
+
var activeDescendant = _a.activeDescendant, _c = _a.ariaHidden, ariaHidden = _c === void 0 ? false : _c, children = _a.children, id = _a.id, labelledBy = _a.labelledBy, onBlur = _a.onBlur, onKeyDown = _a.onKeyDown, role = _a.role, tabIndex = _a.tabIndex, testId = _a.testId, theme = _a.theme, title = _a.title;
|
|
96160
96170
|
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["Fragment"], null,
|
|
96161
96171
|
title && external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { className: classBinder_cx('c-dropdown__title') }, title),
|
|
96162
|
-
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("ul", { "aria-activedescendant": activeDescendant, "aria-hidden": ariaHidden, "aria-labelledby": labelledBy, className: classBinder_cx('c-dropdown__menu', (_b = {}, _b["c-dropdown__menu--categorised"] = title, _b), theme), "data-testid": testId, id: id, role: role, tabIndex: tabIndex, onKeyDown: onKeyDown }, children)));
|
|
96172
|
+
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("ul", { "aria-activedescendant": activeDescendant, "aria-hidden": ariaHidden, "aria-labelledby": labelledBy, className: classBinder_cx('c-dropdown__menu', (_b = {}, _b["c-dropdown__menu--categorised"] = title, _b), theme), "data-testid": testId, id: id, role: role, tabIndex: tabIndex, onBlur: onBlur, onKeyDown: onKeyDown }, children)));
|
|
96163
96173
|
};
|
|
96164
96174
|
|
|
96165
96175
|
// CONCATENATED MODULE: ./src/components/Components/Dropdown/_elements_/DropdownItem.tsx
|
|
@@ -97581,21 +97591,31 @@ var Select2CategorisedOptions_assign = (undefined && undefined.__assign) || func
|
|
|
97581
97591
|
|
|
97582
97592
|
|
|
97583
97593
|
|
|
97594
|
+
|
|
97584
97595
|
var Select2CategorisedOptions = function (_a) {
|
|
97585
97596
|
var _b = _a.isAutocomplete, isAutocomplete = _b === void 0 ? false : _b;
|
|
97586
|
-
var _c = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useContext"])(contexts_Select2Context), focusedCategoryIndex = _c.focusedCategoryIndex, focusedItemIndex = _c.focusedItemIndex, items = _c.items, name = _c.name, optionClick = _c.optionClick, optionKeyPress = _c.optionKeyPress,
|
|
97597
|
+
var _c = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useContext"])(contexts_Select2Context), _d = _c.emptyOptionClick, emptyOptionClick = _d === void 0 ? noop : _d, emptyValueLabel = _c.emptyValueLabel, focusedCategoryIndex = _c.focusedCategoryIndex, focusedItemIndex = _c.focusedItemIndex, items = _c.items, name = _c.name, onBlur = _c.onBlur, optionClick = _c.optionClick, optionKeyPress = _c.optionKeyPress, _e = _c.setFocusedCategoryIndex, setFocusedCategoryIndex = _e === void 0 ? noop : _e, setFocusedItemIndex = _c.setFocusedItemIndex, _f = _c.setValue, setValue = _f === void 0 ? noop : _f, value = _c.value;
|
|
97587
97598
|
var additionalProps = !isAutocomplete ? { tabIndex: -1, onKeyDown: optionKeyPress } : {};
|
|
97588
|
-
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["Fragment"], null,
|
|
97589
|
-
|
|
97590
|
-
|
|
97591
|
-
|
|
97592
|
-
|
|
97593
|
-
|
|
97594
|
-
|
|
97595
|
-
|
|
97596
|
-
|
|
97597
|
-
|
|
97598
|
-
|
|
97599
|
+
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["Fragment"], null,
|
|
97600
|
+
emptyValueLabel && (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(DropdownMenu, Select2CategorisedOptions_assign({ activeDescendant: name + "_option--1--1", id: name + "_list--1", labelledBy: name + "_label", role: "listbox", onBlur: onBlur }, additionalProps),
|
|
97601
|
+
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(DropdownItem, { id: name + "_option--1--1", isFocused: focusedItemIndex === -1, isSelected: '' === value, role: "option", onClick: function () {
|
|
97602
|
+
setFocusedItemIndex(-1);
|
|
97603
|
+
setValue('');
|
|
97604
|
+
emptyOptionClick();
|
|
97605
|
+
}, onMouseOver: function () {
|
|
97606
|
+
setFocusedItemIndex(-1, -1);
|
|
97607
|
+
} }, emptyValueLabel))),
|
|
97608
|
+
items.map(function (category, categoryIndex) { return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(DropdownMenu, Select2CategorisedOptions_assign({ key: categoryIndex, activeDescendant: name + "_option-" + categoryIndex + "-" + focusedItemIndex, id: name + "_list-" + categoryIndex, labelledBy: name + "_label", role: "listbox", title: category.label, onBlur: onBlur }, additionalProps), category.items.map(function (item, itemIndex) {
|
|
97609
|
+
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(DropdownItem, { key: itemIndex, id: name + "_option-" + categoryIndex + "-" + itemIndex, isDisabled: item.isDisabled, isFocused: itemIndex === focusedItemIndex && categoryIndex === focusedCategoryIndex, isSelected: item.value === value, perex: item.perex, role: "option", onClick: function () {
|
|
97610
|
+
setFocusedCategoryIndex(categoryIndex);
|
|
97611
|
+
setValue(item.value);
|
|
97612
|
+
setFocusedItemIndex(itemIndex, categoryIndex);
|
|
97613
|
+
optionClick(item);
|
|
97614
|
+
}, onMouseOver: function () {
|
|
97615
|
+
setFocusedCategoryIndex(categoryIndex);
|
|
97616
|
+
setFocusedItemIndex(itemIndex, categoryIndex);
|
|
97617
|
+
} }, item.label));
|
|
97618
|
+
}))); })));
|
|
97599
97619
|
};
|
|
97600
97620
|
|
|
97601
97621
|
// CONCATENATED MODULE: ./src/components/Form/Select2/_elements_/Select2Options.tsx
|
|
@@ -97613,17 +97633,26 @@ var Select2Options_assign = (undefined && undefined.__assign) || function () {
|
|
|
97613
97633
|
|
|
97614
97634
|
|
|
97615
97635
|
|
|
97636
|
+
|
|
97616
97637
|
var Select2Options = function (_a) {
|
|
97617
97638
|
var _b = _a.isAutocomplete, isAutocomplete = _b === void 0 ? false : _b;
|
|
97618
|
-
var _c = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useContext"])(contexts_Select2Context), focusedItemIndex = _c.focusedItemIndex, items = _c.items, name = _c.name, optionClick = _c.optionClick, optionKeyPress = _c.optionKeyPress, setFocusedItemIndex = _c.setFocusedItemIndex,
|
|
97639
|
+
var _c = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useContext"])(contexts_Select2Context), _d = _c.emptyOptionClick, emptyOptionClick = _d === void 0 ? noop : _d, emptyValueLabel = _c.emptyValueLabel, focusedItemIndex = _c.focusedItemIndex, items = _c.items, name = _c.name, onBlur = _c.onBlur, optionClick = _c.optionClick, optionKeyPress = _c.optionKeyPress, setFocusedItemIndex = _c.setFocusedItemIndex, _e = _c.setValue, setValue = _e === void 0 ? noop : _e, value = _c.value;
|
|
97619
97640
|
var additionalProps = !isAutocomplete ? { tabIndex: -1, onKeyDown: optionKeyPress } : {};
|
|
97620
|
-
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(DropdownMenu, Select2Options_assign({ activeDescendant: name + "_option-" + focusedItemIndex, id: name + "_list", labelledBy: name + "_label", role: "listbox"
|
|
97621
|
-
|
|
97622
|
-
|
|
97623
|
-
|
|
97624
|
-
|
|
97625
|
-
|
|
97626
|
-
|
|
97641
|
+
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(DropdownMenu, Select2Options_assign({ activeDescendant: name + "_option-" + focusedItemIndex, id: name + "_list", labelledBy: name + "_label", role: "listbox", onBlur: onBlur }, additionalProps),
|
|
97642
|
+
emptyValueLabel && (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(DropdownItem, { id: name + "_option--1", isFocused: focusedItemIndex === -1, isSelected: '' === value, role: "option", onClick: function () {
|
|
97643
|
+
setFocusedItemIndex(-1);
|
|
97644
|
+
setValue('');
|
|
97645
|
+
emptyOptionClick();
|
|
97646
|
+
}, onMouseOver: function () {
|
|
97647
|
+
setFocusedItemIndex(-1);
|
|
97648
|
+
} }, emptyValueLabel)),
|
|
97649
|
+
items.map(function (item, index) { return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(DropdownItem, { key: index, amount: item.amount, iconBackground: item.iconBackground, iconName: item.iconName, id: name + "_option-" + index.toString(), isDisabled: item.isDisabled, isFocused: index === focusedItemIndex, isSelected: item.value === value, perex: item.perex, role: "option", onClick: function () {
|
|
97650
|
+
setFocusedItemIndex(index);
|
|
97651
|
+
setValue(item.value);
|
|
97652
|
+
optionClick(item);
|
|
97653
|
+
}, onMouseOver: function () {
|
|
97654
|
+
setFocusedItemIndex(index);
|
|
97655
|
+
} }, item.label)); })));
|
|
97627
97656
|
};
|
|
97628
97657
|
|
|
97629
97658
|
// CONCATENATED MODULE: ./src/components/Form/Autocomplete/Autocomplete.tsx
|
|
@@ -106075,6 +106104,11 @@ var Select2_assign = (undefined && undefined.__assign) || function () {
|
|
|
106075
106104
|
};
|
|
106076
106105
|
return Select2_assign.apply(this, arguments);
|
|
106077
106106
|
};
|
|
106107
|
+
var Select2_spreadArray = (undefined && undefined.__spreadArray) || function (to, from) {
|
|
106108
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
106109
|
+
to[j] = from[i];
|
|
106110
|
+
return to;
|
|
106111
|
+
};
|
|
106078
106112
|
|
|
106079
106113
|
|
|
106080
106114
|
|
|
@@ -106083,143 +106117,195 @@ var Select2_assign = (undefined && undefined.__assign) || function () {
|
|
|
106083
106117
|
|
|
106084
106118
|
var Select2 = function (_a) {
|
|
106085
106119
|
var _b;
|
|
106086
|
-
var _c = _a.displayDetails, displayDetails = _c === void 0 ? false : _c, dropdownTheme = _a.dropdownTheme, error = _a.error, _d = _a.hasFullWidthOptions, hasFullWidthOptions = _d === void 0 ? true : _d, help = _a.help, isDisabled = _a.isDisabled, items = _a.items, label = _a.label, labelTooltip = _a.labelTooltip, name = _a.name, onBlur = _a.onBlur, onChange = _a.onChange, onFocus = _a.onFocus, placeholder = _a.placeholder, testId = _a.testId, theme = _a.theme,
|
|
106120
|
+
var _c = _a.displayDetails, displayDetails = _c === void 0 ? false : _c, dropdownTheme = _a.dropdownTheme, emptyValueLabel = _a.emptyValueLabel, error = _a.error, _d = _a.hasFullWidthOptions, hasFullWidthOptions = _d === void 0 ? true : _d, help = _a.help, isDisabled = _a.isDisabled, items = _a.items, label = _a.label, labelTooltip = _a.labelTooltip, name = _a.name, onBlur = _a.onBlur, onChange = _a.onChange, onFocus = _a.onFocus, placeholder = _a.placeholder, testId = _a.testId, theme = _a.theme, value = _a.value;
|
|
106087
106121
|
var _e = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(false), isDropdownVisible = _e[0], setIsDropdownVisible = _e[1];
|
|
106088
|
-
var _f = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(
|
|
106089
|
-
var _g = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(
|
|
106090
|
-
var
|
|
106091
|
-
var
|
|
106092
|
-
|
|
106093
|
-
var setFocusedItemIdAndScrollToIt = function (newItemIndex) {
|
|
106094
|
-
var _a;
|
|
106095
|
-
setFocusedItemIndex(newItemIndex);
|
|
106096
|
-
(_a = document.getElementById(name + "_option-" + newItemIndex)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: 'nearest' });
|
|
106097
|
-
};
|
|
106098
|
-
Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useEffect"])(function () {
|
|
106099
|
-
var defaultSelectItem = {};
|
|
106122
|
+
var _f = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(null), buttonValue = _f[0], setButtonValue = _f[1];
|
|
106123
|
+
var _g = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(-1), currentItemPosition = _g[0], setCurrentItemPosition = _g[1];
|
|
106124
|
+
var isCategorised = !!(items && ((_b = items[0]) === null || _b === void 0 ? void 0 : _b.items));
|
|
106125
|
+
var itemsIndex = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useMemo"])(function () {
|
|
106126
|
+
var map;
|
|
106100
106127
|
if (isCategorised) {
|
|
106101
|
-
|
|
106102
|
-
|
|
106128
|
+
map = items.reduce(function (acc, category, categoryIndex) {
|
|
106129
|
+
return acc.concat(category.items
|
|
106130
|
+
.map(function (item, index) { return (!item.isDisabled ? { category: categoryIndex, item: index } : undefined); })
|
|
106131
|
+
.filter(Boolean));
|
|
106132
|
+
}, []);
|
|
106103
106133
|
}
|
|
106104
106134
|
else {
|
|
106105
|
-
|
|
106135
|
+
map = items
|
|
106136
|
+
.map(function (item, index) { return (!item.isDisabled ? { category: -1, item: index } : undefined); })
|
|
106137
|
+
.filter(Boolean);
|
|
106106
106138
|
}
|
|
106107
|
-
|
|
106108
|
-
|
|
106109
|
-
|
|
106139
|
+
if (emptyValueLabel) {
|
|
106140
|
+
return Select2_spreadArray([{ item: -1, category: -1 }], map);
|
|
106141
|
+
}
|
|
106142
|
+
return map;
|
|
106143
|
+
}, [items, isCategorised]);
|
|
106144
|
+
var getItemIndexByValue = function (val) {
|
|
106145
|
+
if (val === '' || val === undefined) {
|
|
106146
|
+
return { item: -1, category: -1 };
|
|
106147
|
+
}
|
|
106148
|
+
if (isCategorised) {
|
|
106149
|
+
var index = items
|
|
106150
|
+
.map(function (category, categoryIndex) {
|
|
106151
|
+
var item = category.items.findIndex(function (item) { return item.value === val && !item.isDisabled; });
|
|
106152
|
+
return { item: item, category: categoryIndex };
|
|
106153
|
+
})
|
|
106154
|
+
.find(function (_a) {
|
|
106155
|
+
var item = _a.item;
|
|
106156
|
+
return item !== -1;
|
|
106157
|
+
});
|
|
106158
|
+
return index || { item: -1, category: -1 };
|
|
106159
|
+
}
|
|
106160
|
+
var item = items.findIndex(function (item) { return item.value === val && !item.isDisabled; });
|
|
106161
|
+
return { item: item, category: -1 };
|
|
106162
|
+
};
|
|
106163
|
+
var getItemIndexPosition = function (index) {
|
|
106164
|
+
return itemsIndex.findIndex(function (_a) {
|
|
106165
|
+
var category = _a.category, item = _a.item;
|
|
106166
|
+
return index.item === item && index.category === category;
|
|
106167
|
+
});
|
|
106168
|
+
};
|
|
106110
106169
|
Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useEffect"])(function () {
|
|
106111
|
-
|
|
106112
|
-
|
|
106113
|
-
|
|
106114
|
-
|
|
106115
|
-
|
|
106116
|
-
|
|
106170
|
+
var itemIndex = getItemIndexByValue(value);
|
|
106171
|
+
var itemIndexPosition = getItemIndexPosition(itemIndex);
|
|
106172
|
+
setCurrentItemPosition(itemIndexPosition);
|
|
106173
|
+
var category = itemIndex.category, item = itemIndex.item;
|
|
106174
|
+
if (item > -1) {
|
|
106175
|
+
var selectedItem = isCategorised
|
|
106176
|
+
? items[category].items[item]
|
|
106177
|
+
: items[item];
|
|
106178
|
+
selectedItem && setButtonValue(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(SelectedOption, Select2_assign({ displayDetails: displayDetails }, selectedItem)));
|
|
106179
|
+
}
|
|
106180
|
+
}, [value, items]);
|
|
106181
|
+
Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useEffect"])(function () {
|
|
106182
|
+
var itemIndex = getItemIndexByValue(value);
|
|
106183
|
+
var itemIndexPosition = getItemIndexPosition(itemIndex);
|
|
106184
|
+
setCurrentItemPosition(itemIndexPosition);
|
|
106185
|
+
}, [isDropdownVisible]);
|
|
106186
|
+
var scrollToItem = function (item, category) {
|
|
106187
|
+
var _a;
|
|
106188
|
+
if (category === void 0) { category = -1; }
|
|
106189
|
+
var itemElementId = isCategorised ? name + "_option-" + category + "-" + item : name + "_option-" + item;
|
|
106190
|
+
(_a = document.getElementById(itemElementId)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: 'nearest' });
|
|
106117
106191
|
};
|
|
106118
|
-
var
|
|
106119
|
-
|
|
106120
|
-
|
|
106121
|
-
|
|
106122
|
-
|
|
106123
|
-
|
|
106124
|
-
|
|
106125
|
-
|
|
106126
|
-
|
|
106127
|
-
},
|
|
106128
|
-
last: function () {
|
|
106129
|
-
if (isCategorised) {
|
|
106130
|
-
var lastCategoryIndex = items.length - 1;
|
|
106131
|
-
var lastItemInLastCategoryIndex = items[lastCategoryIndex].items.length - 1;
|
|
106132
|
-
setFocusedItemIdAndScrollToIt(lastItemInLastCategoryIndex);
|
|
106133
|
-
setFocusedCategoryIndex(lastCategoryIndex);
|
|
106134
|
-
}
|
|
106135
|
-
else {
|
|
106136
|
-
setFocusedItemIdAndScrollToIt(items.length - 1);
|
|
106137
|
-
}
|
|
106138
|
-
},
|
|
106139
|
-
next: function () {
|
|
106140
|
-
var newItemIndex = focusedItemIndex ? focusedItemIndex + 1 : 1;
|
|
106141
|
-
if (isCategorised) {
|
|
106142
|
-
var lastCategoryIndex = items.length - 1;
|
|
106143
|
-
var selectedCategoryLastItemIndex = items[focusedCategoryIndex].items.length - 1;
|
|
106144
|
-
// isn't last item in category
|
|
106145
|
-
if (focusedItemIndex < selectedCategoryLastItemIndex) {
|
|
106146
|
-
setFocusedItemIdAndScrollToIt(newItemIndex);
|
|
106147
|
-
}
|
|
106148
|
-
else {
|
|
106149
|
-
// isn't last category
|
|
106150
|
-
if (focusedCategoryIndex < lastCategoryIndex) {
|
|
106151
|
-
var nextCategoryIndex = focusedCategoryIndex + 1;
|
|
106152
|
-
setFocusedCategoryIndex(nextCategoryIndex);
|
|
106153
|
-
setFocusedItemIdAndScrollToIt(0);
|
|
106154
|
-
}
|
|
106155
|
-
}
|
|
106156
|
-
}
|
|
106157
|
-
else {
|
|
106158
|
-
if (newItemIndex <= items.length - 1) {
|
|
106159
|
-
setFocusedItemIdAndScrollToIt(newItemIndex);
|
|
106160
|
-
}
|
|
106161
|
-
}
|
|
106162
|
-
},
|
|
106163
|
-
prev: function () {
|
|
106164
|
-
var newItemIndex = focusedItemIndex ? focusedItemIndex - 1 : 0;
|
|
106165
|
-
if (isCategorised) {
|
|
106166
|
-
var prevCategoryIndex = focusedCategoryIndex > 0 ? focusedCategoryIndex - 1 : 0;
|
|
106167
|
-
var prevCategoryLastItemIndex = items[prevCategoryIndex].items.length - 1;
|
|
106168
|
-
// isn't first item in category
|
|
106169
|
-
if (focusedItemIndex > 0) {
|
|
106170
|
-
setFocusedItemIdAndScrollToIt(newItemIndex);
|
|
106192
|
+
var handleComboBoxClick = function () {
|
|
106193
|
+
if (!isDropdownVisible) {
|
|
106194
|
+
setTimeout(function () {
|
|
106195
|
+
var _a;
|
|
106196
|
+
var listElementId;
|
|
106197
|
+
if (currentItemPosition > -1) {
|
|
106198
|
+
var _b = itemsIndex[currentItemPosition], category = _b.category, item = _b.item;
|
|
106199
|
+
scrollToItem(item, category);
|
|
106200
|
+
listElementId = isCategorised ? name + "_list-" + category : name + "_list";
|
|
106171
106201
|
}
|
|
106172
106202
|
else {
|
|
106173
|
-
|
|
106174
|
-
if (focusedCategoryIndex > 0) {
|
|
106175
|
-
var prevCategoryIndex_1 = focusedCategoryIndex - 1;
|
|
106176
|
-
setFocusedItemIdAndScrollToIt(prevCategoryLastItemIndex);
|
|
106177
|
-
setFocusedCategoryIndex(prevCategoryIndex_1);
|
|
106178
|
-
}
|
|
106203
|
+
listElementId = isCategorised ? name + "_list-0" : name + "_list";
|
|
106179
106204
|
}
|
|
106180
|
-
|
|
106181
|
-
|
|
106182
|
-
setFocusedItemIdAndScrollToIt(newItemIndex);
|
|
106183
|
-
}
|
|
106205
|
+
(_a = document.getElementById(listElementId)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
106206
|
+
}, 100);
|
|
106184
106207
|
}
|
|
106208
|
+
if (isDropdownVisible) {
|
|
106209
|
+
setTimeout(function () { var _a; return (_a = document.getElementById(name + "_button")) === null || _a === void 0 ? void 0 : _a.focus(); }, 100);
|
|
106210
|
+
}
|
|
106211
|
+
setIsDropdownVisible(!isDropdownVisible);
|
|
106185
106212
|
};
|
|
106186
|
-
var
|
|
106187
|
-
if (
|
|
106188
|
-
setButtonValue(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(SelectedOption, Select2_assign({},
|
|
106189
|
-
setValue(items[focusedCategoryIndex].items[focusedItemIndex].value);
|
|
106213
|
+
var propagateChange = function (item) {
|
|
106214
|
+
if (item) {
|
|
106215
|
+
setButtonValue(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(SelectedOption, Select2_assign({ displayDetails: displayDetails }, item)));
|
|
106190
106216
|
}
|
|
106191
106217
|
else {
|
|
106192
|
-
setButtonValue(
|
|
106193
|
-
|
|
106218
|
+
setButtonValue(null);
|
|
106219
|
+
}
|
|
106220
|
+
onChange && onChange((item === null || item === void 0 ? void 0 : item.value) || '');
|
|
106221
|
+
};
|
|
106222
|
+
var handleOptionClick = function (item) {
|
|
106223
|
+
propagateChange(item);
|
|
106224
|
+
setIsDropdownVisible(false);
|
|
106225
|
+
};
|
|
106226
|
+
var handleEmptyOptionClick = function () {
|
|
106227
|
+
propagateChange();
|
|
106228
|
+
setIsDropdownVisible(false);
|
|
106229
|
+
};
|
|
106230
|
+
var selectFocusedItem = function () {
|
|
106231
|
+
var itemIndex = itemsIndex[currentItemPosition];
|
|
106232
|
+
if (!itemIndex)
|
|
106233
|
+
return;
|
|
106234
|
+
var category = itemIndex.category, item = itemIndex.item;
|
|
106235
|
+
if (item === -1) {
|
|
106236
|
+
propagateChange();
|
|
106237
|
+
return undefined;
|
|
106194
106238
|
}
|
|
106239
|
+
var selectedItem = isCategorised
|
|
106240
|
+
? items[category].items[item]
|
|
106241
|
+
: items[item];
|
|
106242
|
+
if (selectedItem) {
|
|
106243
|
+
propagateChange(selectedItem);
|
|
106244
|
+
}
|
|
106245
|
+
else if (emptyValueLabel) {
|
|
106246
|
+
propagateChange();
|
|
106247
|
+
}
|
|
106248
|
+
return selectedItem;
|
|
106249
|
+
};
|
|
106250
|
+
var handleDropdownBlur = function () {
|
|
106251
|
+
var focusedItem = selectFocusedItem();
|
|
106252
|
+
setIsDropdownVisible(false);
|
|
106253
|
+
onBlur && onBlur((focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.value) || '');
|
|
106254
|
+
};
|
|
106255
|
+
var handleFocusedItem = function (item, category) {
|
|
106256
|
+
if (category === void 0) { category = -1; }
|
|
106257
|
+
var position = getItemIndexPosition({ item: item, category: category });
|
|
106258
|
+
setCurrentItemPosition(position);
|
|
106259
|
+
scrollToItem(item, category);
|
|
106195
106260
|
};
|
|
106196
106261
|
var handleOptionKeyPress = function (event) {
|
|
106197
106262
|
var key = event.key;
|
|
106198
106263
|
switch (key) {
|
|
106199
106264
|
case KEYS.Enter:
|
|
106200
|
-
|
|
106201
|
-
|
|
106202
|
-
|
|
106203
|
-
setTimeout(function () { var _a; return (_a = document.getElementById(name + "_button")) === null || _a === void 0 ? void 0 : _a.focus(); }, 100);
|
|
106204
|
-
}
|
|
106265
|
+
selectFocusedItem();
|
|
106266
|
+
handleComboBoxClick();
|
|
106267
|
+
event.preventDefault();
|
|
106205
106268
|
break;
|
|
106206
106269
|
case KEYS.ArrowDown:
|
|
106207
|
-
|
|
106208
|
-
|
|
106270
|
+
{
|
|
106271
|
+
var itemIndex = itemsIndex[currentItemPosition + 1];
|
|
106272
|
+
if (itemIndex) {
|
|
106273
|
+
handleFocusedItem(itemIndex.item, itemIndex.category);
|
|
106274
|
+
}
|
|
106275
|
+
event.preventDefault();
|
|
106276
|
+
}
|
|
106209
106277
|
break;
|
|
106210
106278
|
case KEYS.ArrowUp:
|
|
106211
|
-
|
|
106212
|
-
|
|
106279
|
+
{
|
|
106280
|
+
var itemIndex = itemsIndex[currentItemPosition - 1];
|
|
106281
|
+
if (itemIndex) {
|
|
106282
|
+
handleFocusedItem(itemIndex.item, itemIndex.category);
|
|
106283
|
+
}
|
|
106284
|
+
event.preventDefault();
|
|
106285
|
+
}
|
|
106213
106286
|
break;
|
|
106214
106287
|
case KEYS.Escape:
|
|
106215
106288
|
setIsDropdownVisible(false);
|
|
106216
|
-
|
|
106289
|
+
handleComboBoxClick();
|
|
106290
|
+
event.preventDefault();
|
|
106217
106291
|
break;
|
|
106218
106292
|
case KEYS.Home:
|
|
106219
|
-
|
|
106293
|
+
{
|
|
106294
|
+
var itemIndex = itemsIndex[0];
|
|
106295
|
+
if (itemIndex) {
|
|
106296
|
+
handleFocusedItem(itemIndex.item, itemIndex.category);
|
|
106297
|
+
}
|
|
106298
|
+
event.preventDefault();
|
|
106299
|
+
}
|
|
106220
106300
|
break;
|
|
106221
106301
|
case KEYS.End:
|
|
106222
|
-
|
|
106302
|
+
{
|
|
106303
|
+
var itemIndex = itemsIndex[itemsIndex.length - 1];
|
|
106304
|
+
if (itemIndex) {
|
|
106305
|
+
handleFocusedItem(itemIndex.item, itemIndex.category);
|
|
106306
|
+
}
|
|
106307
|
+
event.preventDefault();
|
|
106308
|
+
}
|
|
106223
106309
|
break;
|
|
106224
106310
|
case KEYS.Space:
|
|
106225
106311
|
selectFocusedItem();
|
|
@@ -106233,33 +106319,26 @@ var Select2 = function (_a) {
|
|
|
106233
106319
|
var key = event.key;
|
|
106234
106320
|
if ([KEYS.ArrowDown, KEYS.ArrowUp, KEYS.Enter].includes(key)) {
|
|
106235
106321
|
if (!isDropdownVisible) {
|
|
106236
|
-
|
|
106237
|
-
if (key === KEYS.ArrowUp && focusedItemIndex && focusedItemIndex > 0) {
|
|
106238
|
-
setActiveItem.prev();
|
|
106239
|
-
}
|
|
106240
|
-
if (key === KEYS.ArrowDown && focusedItemIndex && focusedItemIndex < items.length - 1) {
|
|
106241
|
-
setActiveItem.next();
|
|
106242
|
-
}
|
|
106243
|
-
setTimeout(function () {
|
|
106244
|
-
var _a;
|
|
106245
|
-
var selectedUList = document.querySelectorAll('ul.c-dropdown__menu')[focusedCategoryIndex];
|
|
106246
|
-
selectedUList.focus();
|
|
106247
|
-
(_a = document.getElementById(name + "_option-" + focusedItemIndex)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: 'nearest' });
|
|
106248
|
-
}, 100);
|
|
106322
|
+
handleComboBoxClick();
|
|
106249
106323
|
event.preventDefault();
|
|
106250
106324
|
}
|
|
106251
106325
|
}
|
|
106326
|
+
if (key === KEYS.Escape && isDropdownVisible) {
|
|
106327
|
+
setIsDropdownVisible(false);
|
|
106328
|
+
}
|
|
106252
106329
|
};
|
|
106330
|
+
var focusedItem = itemsIndex[currentItemPosition];
|
|
106253
106331
|
var select2context = {
|
|
106254
|
-
|
|
106255
|
-
|
|
106332
|
+
emptyValueLabel: emptyValueLabel,
|
|
106333
|
+
focusedCategoryIndex: focusedItem ? focusedItem.category : -1,
|
|
106334
|
+
focusedItemIndex: focusedItem ? focusedItem.item : -1,
|
|
106256
106335
|
items: items,
|
|
106257
106336
|
name: name,
|
|
106337
|
+
onBlur: handleDropdownBlur,
|
|
106258
106338
|
optionClick: handleOptionClick,
|
|
106339
|
+
emptyOptionClick: handleEmptyOptionClick,
|
|
106259
106340
|
optionKeyPress: handleOptionKeyPress,
|
|
106260
|
-
|
|
106261
|
-
setFocusedItemIndex: setFocusedItemIndex,
|
|
106262
|
-
setValue: setValue,
|
|
106341
|
+
setFocusedItemIndex: handleFocusedItem,
|
|
106263
106342
|
value: value
|
|
106264
106343
|
};
|
|
106265
106344
|
var fromGroupProps = {
|
|
@@ -106271,17 +106350,10 @@ var Select2 = function (_a) {
|
|
|
106271
106350
|
labelTooltip: labelTooltip,
|
|
106272
106351
|
name: name
|
|
106273
106352
|
};
|
|
106274
|
-
var onComboBoxClick = function () {
|
|
106275
|
-
setIsDropdownVisible(!isDropdownVisible);
|
|
106276
|
-
setTimeout(function () {
|
|
106277
|
-
var _a;
|
|
106278
|
-
(_a = document.getElementById(name + "_option-" + focusedItemIndex)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: 'nearest' });
|
|
106279
|
-
}, 100);
|
|
106280
|
-
};
|
|
106281
106353
|
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(FormGroup2, Select2_assign({ theme: classBinder_cx({ 'f-group2--open': isDropdownVisible }, theme) }, fromGroupProps),
|
|
106282
106354
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(contexts_Select2Context.Provider, { value: select2context },
|
|
106283
106355
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Dropdown, { forceVisibility: isDropdownVisible, hasSameWidthAsTrigger: hasFullWidthOptions, placement: "bottom-start", theme: dropdownTheme, trigger: null, triggerComponent: external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { className: "f-controlWrap", "data-testid": testId, role: "combobox" },
|
|
106284
|
-
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("button", { "aria-expanded": isDropdownVisible, "aria-haspopup": "listbox", "aria-invalid": !!error, "aria-labelledby": name + "_label " + name, className: classBinder_cx('f-control2 f-control2--select', { 'f-control2--large': displayDetails }), disabled: isDisabled, id: name, name: name, type: "button",
|
|
106356
|
+
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("button", { "aria-expanded": isDropdownVisible, "aria-haspopup": "listbox", "aria-invalid": !!error, "aria-labelledby": name + "_label " + name, className: classBinder_cx('f-control2 f-control2--select', { 'f-control2--large': displayDetails }), disabled: isDisabled, id: name + "_button", name: name, type: "button", onClick: handleComboBoxClick, onFocus: onFocus, onKeyDown: handleButtonKeyPress },
|
|
106285
106357
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("span", { className: classBinder_cx("f-control2__" + (buttonValue ? 'value' : 'placeholder')) }, buttonValue ? buttonValue : placeholder),
|
|
106286
106358
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { name: "arrowDown", size: "small", theme: "f-control2__selectIcon" }))), onVisibleChange: function (state) { return setIsDropdownVisible(state); } }, isCategorised ? external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Select2CategorisedOptions, null) : external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Select2Options, null)))));
|
|
106287
106359
|
};
|
|
@@ -110338,6 +110410,7 @@ var Header = function (_a) {
|
|
|
110338
110410
|
var MobilePanelContext_noop = function () { return null; };
|
|
110339
110411
|
var MobilePanelContext = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["createContext"])({
|
|
110340
110412
|
close: MobilePanelContext_noop,
|
|
110413
|
+
closeOnClick: false,
|
|
110341
110414
|
identification: '',
|
|
110342
110415
|
isFocused: false,
|
|
110343
110416
|
isOpen: false,
|
|
@@ -110357,7 +110430,7 @@ MobilePanelContext.displayName = 'ModalContext';
|
|
|
110357
110430
|
|
|
110358
110431
|
|
|
110359
110432
|
var MobilePanel = function (_a) {
|
|
110360
|
-
var children = _a.children, close = _a.close, _b = _a.displayBreakpoint, displayBreakpoint = _b === void 0 ? 'lg' : _b, identification = _a.identification, isFocused = _a.isFocused, isMain = _a.isMain, isOpen = _a.isOpen, isScrolled = _a.isScrolled, isSecondary = _a.isSecondary, open = _a.open, _c = _a.position, position = _c === void 0 ? 'left' : _c, reference = _a.reference, setIsScrolled = _a.setIsScrolled, _d = _a.testId, testId = _d === void 0 ? 'MobilePanel' : _d, theme = _a.theme, toggle = _a.toggle;
|
|
110433
|
+
var children = _a.children, close = _a.close, closeOnClick = _a.closeOnClick, _b = _a.displayBreakpoint, displayBreakpoint = _b === void 0 ? 'lg' : _b, identification = _a.identification, isFocused = _a.isFocused, isMain = _a.isMain, isOpen = _a.isOpen, isScrolled = _a.isScrolled, isSecondary = _a.isSecondary, open = _a.open, _c = _a.position, position = _c === void 0 ? 'left' : _c, reference = _a.reference, setIsScrolled = _a.setIsScrolled, _d = _a.testId, testId = _d === void 0 ? 'MobilePanel' : _d, theme = _a.theme, toggle = _a.toggle;
|
|
110361
110434
|
var width = useWindowWidth();
|
|
110362
110435
|
var isLeft = position === 'left';
|
|
110363
110436
|
var panelWidth = width <= BREAKPOINTS_VALUES.sm ? '100%' : '320px';
|
|
@@ -110377,6 +110450,7 @@ var MobilePanel = function (_a) {
|
|
|
110377
110450
|
};
|
|
110378
110451
|
var mobilePanelContext = {
|
|
110379
110452
|
close: close,
|
|
110453
|
+
closeOnClick: closeOnClick,
|
|
110380
110454
|
identification: identification,
|
|
110381
110455
|
isFocused: isFocused,
|
|
110382
110456
|
isOpen: isOpen,
|
|
@@ -110386,7 +110460,7 @@ var MobilePanel = function (_a) {
|
|
|
110386
110460
|
setIsScrolled: setIsScrolled,
|
|
110387
110461
|
toggle: toggle
|
|
110388
110462
|
};
|
|
110389
|
-
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(contexts_MobilePanelContext.Provider, { value: mobilePanelContext }, width < BREAKPOINTS_VALUES[displayBreakpoint] && (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { ref: reference },
|
|
110463
|
+
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(contexts_MobilePanelContext.Provider, { value: mobilePanelContext }, width < BREAKPOINTS_VALUES[displayBreakpoint] && (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { ref: reference, onClick: closeOnClick ? toggle : undefined },
|
|
110390
110464
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(motion.div, { animate: isOpen ? 'open' : 'closed', className: classBinder_cx('l-mobilePanel', { 'l-mobilePanel--main': isMain }, { 'l-mobilePanel--open': isOpen }, { 'l-mobilePanel--right': !isLeft }, { 'l-mobilePanel--secondary': isSecondary }, { 'l-mobilePanel--scrolled': isScrolled }, theme), "data-testid": testId, id: identification, initial: false, transition: { type: 'spring', delay: 0, stiffness: 500, damping: 60, mass: 1 }, variants: sidebar }, children)))));
|
|
110391
110465
|
};
|
|
110392
110466
|
|
|
@@ -110446,9 +110520,14 @@ var Header_content = {
|
|
|
110446
110520
|
}
|
|
110447
110521
|
};
|
|
110448
110522
|
var MobilePanelHeader = function (_a) {
|
|
110449
|
-
var children = _a.children, closeAria = _a.closeAria, hasClose = _a.hasClose, image = _a.image, _b = _a.testId, testId = _b === void 0 ? 'MobilePanelHeader' : _b, title = _a.title, _c = _a.titleSize, titleSize = _c === void 0 ? 'h1' : _c, titleVisual = _a.titleVisual;
|
|
110523
|
+
var allowEventPropagation = _a.allowEventPropagation, children = _a.children, closeAria = _a.closeAria, hasClose = _a.hasClose, image = _a.image, _b = _a.testId, testId = _b === void 0 ? 'MobilePanelHeader' : _b, title = _a.title, _c = _a.titleSize, titleSize = _c === void 0 ? 'h1' : _c, titleVisual = _a.titleVisual;
|
|
110450
110524
|
var close = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useContext"])(contexts_MobilePanelContext).close;
|
|
110451
|
-
|
|
110525
|
+
var handleHeaderClick = function (event) {
|
|
110526
|
+
if (!allowEventPropagation) {
|
|
110527
|
+
event.stopPropagation();
|
|
110528
|
+
}
|
|
110529
|
+
};
|
|
110530
|
+
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(motion.div, { className: "l-mobilePanel__header", "data-testid": testId, variants: Header_content, onClick: handleHeaderClick },
|
|
110452
110531
|
hasClose && closeAria && (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Button, { isSmall: true, testId: "MobilePanelCloseButton", theme: "l-mobilePanel__close", type: "transparent", onClick: close },
|
|
110453
110532
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("span", { className: "u-vHide" }, closeAria),
|
|
110454
110533
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { name: "close" }))),
|