@mmb-digital/ds-lilly 0.0.1-alpha.357 → 0.0.1-alpha.360
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 +240 -167
- 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/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));
|
|
@@ -96156,10 +96164,10 @@ var Dropdown = function (_a) {
|
|
|
96156
96164
|
|
|
96157
96165
|
var DropdownMenu = function (_a) {
|
|
96158
96166
|
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;
|
|
96167
|
+
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
96168
|
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
96169
|
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)));
|
|
96170
|
+
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
96171
|
};
|
|
96164
96172
|
|
|
96165
96173
|
// CONCATENATED MODULE: ./src/components/Components/Dropdown/_elements_/DropdownItem.tsx
|
|
@@ -96253,13 +96261,13 @@ var CompactButtons = function (_a) {
|
|
|
96253
96261
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { name: "other" }),
|
|
96254
96262
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("span", { className: "c-compact-buttons__dropdowm__opener" })), onVisibleChange: function (state) { return setIsDropdownVisible(state); } },
|
|
96255
96263
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(DropdownMenu, { ariaHidden: true }, buttons.map(function (_a, i) {
|
|
96256
|
-
var icon = _a.icon, isDisabled = _a.isDisabled, isLoading = _a.isLoading, key = _a.key, label = _a.label, onClick = _a.onClick;
|
|
96264
|
+
var icon = _a.icon, isDisabled = _a.isDisabled, isLoading = _a.isLoading, key = _a.key, label = _a.label, onClick = _a.onClick, testId = _a.testId;
|
|
96257
96265
|
if (isButtonVisible(i))
|
|
96258
96266
|
return;
|
|
96259
96267
|
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(DropdownItem, { key: key, iconName: icon, isDisabled: isDisabled, theme: classBinder_cx('c-compact-buttons__dropdowm-item', {
|
|
96260
96268
|
'c-compact-buttons__dropdowm-item--disabled': isDisabled || isLoading
|
|
96261
96269
|
}), onClick: onClick },
|
|
96262
|
-
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Button, { isDisabled: isDisabled, isLoading: isLoading, theme: "c-compact-buttons__dropdowm-item-button", type: "border", onClick: onClick }, label)));
|
|
96270
|
+
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Button, { isDisabled: isDisabled, isLoading: isLoading, testId: testId + "-dropdown", theme: "c-compact-buttons__dropdowm-item-button", type: "border", onClick: onClick }, label)));
|
|
96263
96271
|
})))))));
|
|
96264
96272
|
};
|
|
96265
96273
|
|
|
@@ -97581,21 +97589,31 @@ var Select2CategorisedOptions_assign = (undefined && undefined.__assign) || func
|
|
|
97581
97589
|
|
|
97582
97590
|
|
|
97583
97591
|
|
|
97592
|
+
|
|
97584
97593
|
var Select2CategorisedOptions = function (_a) {
|
|
97585
97594
|
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,
|
|
97595
|
+
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
97596
|
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
|
-
|
|
97597
|
+
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,
|
|
97598
|
+
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),
|
|
97599
|
+
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 () {
|
|
97600
|
+
setFocusedItemIndex(-1);
|
|
97601
|
+
setValue('');
|
|
97602
|
+
emptyOptionClick();
|
|
97603
|
+
}, onMouseOver: function () {
|
|
97604
|
+
setFocusedItemIndex(-1, -1);
|
|
97605
|
+
} }, emptyValueLabel))),
|
|
97606
|
+
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) {
|
|
97607
|
+
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 () {
|
|
97608
|
+
setFocusedCategoryIndex(categoryIndex);
|
|
97609
|
+
setValue(item.value);
|
|
97610
|
+
setFocusedItemIndex(itemIndex, categoryIndex);
|
|
97611
|
+
optionClick(item);
|
|
97612
|
+
}, onMouseOver: function () {
|
|
97613
|
+
setFocusedCategoryIndex(categoryIndex);
|
|
97614
|
+
setFocusedItemIndex(itemIndex, categoryIndex);
|
|
97615
|
+
} }, item.label));
|
|
97616
|
+
}))); })));
|
|
97599
97617
|
};
|
|
97600
97618
|
|
|
97601
97619
|
// CONCATENATED MODULE: ./src/components/Form/Select2/_elements_/Select2Options.tsx
|
|
@@ -97613,17 +97631,26 @@ var Select2Options_assign = (undefined && undefined.__assign) || function () {
|
|
|
97613
97631
|
|
|
97614
97632
|
|
|
97615
97633
|
|
|
97634
|
+
|
|
97616
97635
|
var Select2Options = function (_a) {
|
|
97617
97636
|
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,
|
|
97637
|
+
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
97638
|
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
|
-
|
|
97639
|
+
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),
|
|
97640
|
+
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 () {
|
|
97641
|
+
setFocusedItemIndex(-1);
|
|
97642
|
+
setValue('');
|
|
97643
|
+
emptyOptionClick();
|
|
97644
|
+
}, onMouseOver: function () {
|
|
97645
|
+
setFocusedItemIndex(-1);
|
|
97646
|
+
} }, emptyValueLabel)),
|
|
97647
|
+
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 () {
|
|
97648
|
+
setFocusedItemIndex(index);
|
|
97649
|
+
setValue(item.value);
|
|
97650
|
+
optionClick(item);
|
|
97651
|
+
}, onMouseOver: function () {
|
|
97652
|
+
setFocusedItemIndex(index);
|
|
97653
|
+
} }, item.label)); })));
|
|
97627
97654
|
};
|
|
97628
97655
|
|
|
97629
97656
|
// CONCATENATED MODULE: ./src/components/Form/Autocomplete/Autocomplete.tsx
|
|
@@ -106075,6 +106102,11 @@ var Select2_assign = (undefined && undefined.__assign) || function () {
|
|
|
106075
106102
|
};
|
|
106076
106103
|
return Select2_assign.apply(this, arguments);
|
|
106077
106104
|
};
|
|
106105
|
+
var Select2_spreadArray = (undefined && undefined.__spreadArray) || function (to, from) {
|
|
106106
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
106107
|
+
to[j] = from[i];
|
|
106108
|
+
return to;
|
|
106109
|
+
};
|
|
106078
106110
|
|
|
106079
106111
|
|
|
106080
106112
|
|
|
@@ -106083,143 +106115,195 @@ var Select2_assign = (undefined && undefined.__assign) || function () {
|
|
|
106083
106115
|
|
|
106084
106116
|
var Select2 = function (_a) {
|
|
106085
106117
|
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,
|
|
106118
|
+
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
106119
|
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 = {};
|
|
106120
|
+
var _f = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(null), buttonValue = _f[0], setButtonValue = _f[1];
|
|
106121
|
+
var _g = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(-1), currentItemPosition = _g[0], setCurrentItemPosition = _g[1];
|
|
106122
|
+
var isCategorised = !!(items && ((_b = items[0]) === null || _b === void 0 ? void 0 : _b.items));
|
|
106123
|
+
var itemsIndex = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useMemo"])(function () {
|
|
106124
|
+
var map;
|
|
106100
106125
|
if (isCategorised) {
|
|
106101
|
-
|
|
106102
|
-
|
|
106126
|
+
map = items.reduce(function (acc, category, categoryIndex) {
|
|
106127
|
+
return acc.concat(category.items
|
|
106128
|
+
.map(function (item, index) { return (!item.isDisabled ? { category: categoryIndex, item: index } : undefined); })
|
|
106129
|
+
.filter(Boolean));
|
|
106130
|
+
}, []);
|
|
106103
106131
|
}
|
|
106104
106132
|
else {
|
|
106105
|
-
|
|
106133
|
+
map = items
|
|
106134
|
+
.map(function (item, index) { return (!item.isDisabled ? { category: -1, item: index } : undefined); })
|
|
106135
|
+
.filter(Boolean);
|
|
106136
|
+
}
|
|
106137
|
+
if (emptyValueLabel) {
|
|
106138
|
+
return Select2_spreadArray([{ item: -1, category: -1 }], map);
|
|
106106
106139
|
}
|
|
106107
|
-
|
|
106108
|
-
|
|
106109
|
-
|
|
106140
|
+
return map;
|
|
106141
|
+
}, [items, isCategorised]);
|
|
106142
|
+
var getItemIndexByValue = function (val) {
|
|
106143
|
+
if (val === '' || val === undefined) {
|
|
106144
|
+
return { item: -1, category: -1 };
|
|
106145
|
+
}
|
|
106146
|
+
if (isCategorised) {
|
|
106147
|
+
var index = items
|
|
106148
|
+
.map(function (category, categoryIndex) {
|
|
106149
|
+
var item = category.items.findIndex(function (item) { return item.value === val && !item.isDisabled; });
|
|
106150
|
+
return { item: item, category: categoryIndex };
|
|
106151
|
+
})
|
|
106152
|
+
.find(function (_a) {
|
|
106153
|
+
var item = _a.item;
|
|
106154
|
+
return item !== -1;
|
|
106155
|
+
});
|
|
106156
|
+
return index || { item: -1, category: -1 };
|
|
106157
|
+
}
|
|
106158
|
+
var item = items.findIndex(function (item) { return item.value === val && !item.isDisabled; });
|
|
106159
|
+
return { item: item, category: -1 };
|
|
106160
|
+
};
|
|
106161
|
+
var getItemIndexPosition = function (index) {
|
|
106162
|
+
return itemsIndex.findIndex(function (_a) {
|
|
106163
|
+
var category = _a.category, item = _a.item;
|
|
106164
|
+
return index.item === item && index.category === category;
|
|
106165
|
+
});
|
|
106166
|
+
};
|
|
106110
106167
|
Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useEffect"])(function () {
|
|
106111
|
-
|
|
106112
|
-
|
|
106113
|
-
|
|
106114
|
-
|
|
106115
|
-
|
|
106116
|
-
|
|
106168
|
+
var itemIndex = getItemIndexByValue(value);
|
|
106169
|
+
var itemIndexPosition = getItemIndexPosition(itemIndex);
|
|
106170
|
+
setCurrentItemPosition(itemIndexPosition);
|
|
106171
|
+
var category = itemIndex.category, item = itemIndex.item;
|
|
106172
|
+
if (item > -1) {
|
|
106173
|
+
var selectedItem = isCategorised
|
|
106174
|
+
? items[category].items[item]
|
|
106175
|
+
: items[item];
|
|
106176
|
+
selectedItem && setButtonValue(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(SelectedOption, Select2_assign({ displayDetails: displayDetails }, selectedItem)));
|
|
106177
|
+
}
|
|
106178
|
+
}, [value, items]);
|
|
106179
|
+
Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useEffect"])(function () {
|
|
106180
|
+
var itemIndex = getItemIndexByValue(value);
|
|
106181
|
+
var itemIndexPosition = getItemIndexPosition(itemIndex);
|
|
106182
|
+
setCurrentItemPosition(itemIndexPosition);
|
|
106183
|
+
}, [isDropdownVisible]);
|
|
106184
|
+
var scrollToItem = function (item, category) {
|
|
106185
|
+
var _a;
|
|
106186
|
+
if (category === void 0) { category = -1; }
|
|
106187
|
+
var itemElementId = isCategorised ? name + "_option-" + category + "-" + item : name + "_option-" + item;
|
|
106188
|
+
(_a = document.getElementById(itemElementId)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: 'nearest' });
|
|
106117
106189
|
};
|
|
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);
|
|
106190
|
+
var handleComboBoxClick = function () {
|
|
106191
|
+
if (!isDropdownVisible) {
|
|
106192
|
+
setTimeout(function () {
|
|
106193
|
+
var _a;
|
|
106194
|
+
var listElementId;
|
|
106195
|
+
if (currentItemPosition > -1) {
|
|
106196
|
+
var _b = itemsIndex[currentItemPosition], category = _b.category, item = _b.item;
|
|
106197
|
+
scrollToItem(item, category);
|
|
106198
|
+
listElementId = isCategorised ? name + "_list-" + category : name + "_list";
|
|
106171
106199
|
}
|
|
106172
106200
|
else {
|
|
106173
|
-
|
|
106174
|
-
if (focusedCategoryIndex > 0) {
|
|
106175
|
-
var prevCategoryIndex_1 = focusedCategoryIndex - 1;
|
|
106176
|
-
setFocusedItemIdAndScrollToIt(prevCategoryLastItemIndex);
|
|
106177
|
-
setFocusedCategoryIndex(prevCategoryIndex_1);
|
|
106178
|
-
}
|
|
106201
|
+
listElementId = isCategorised ? name + "_list-0" : name + "_list";
|
|
106179
106202
|
}
|
|
106180
|
-
|
|
106181
|
-
|
|
106182
|
-
|
|
106183
|
-
|
|
106203
|
+
(_a = document.getElementById(listElementId)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
106204
|
+
}, 100);
|
|
106205
|
+
}
|
|
106206
|
+
if (isDropdownVisible) {
|
|
106207
|
+
setTimeout(function () { var _a; return (_a = document.getElementById(name + "_button")) === null || _a === void 0 ? void 0 : _a.focus(); }, 100);
|
|
106184
106208
|
}
|
|
106209
|
+
setIsDropdownVisible(!isDropdownVisible);
|
|
106185
106210
|
};
|
|
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);
|
|
106211
|
+
var propagateChange = function (item) {
|
|
106212
|
+
if (item) {
|
|
106213
|
+
setButtonValue(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(SelectedOption, Select2_assign({ displayDetails: displayDetails }, item)));
|
|
106190
106214
|
}
|
|
106191
106215
|
else {
|
|
106192
|
-
setButtonValue(
|
|
106193
|
-
setValue(items[focusedItemIndex].value);
|
|
106216
|
+
setButtonValue(null);
|
|
106194
106217
|
}
|
|
106218
|
+
onChange && onChange((item === null || item === void 0 ? void 0 : item.value) || '');
|
|
106219
|
+
};
|
|
106220
|
+
var handleOptionClick = function (item) {
|
|
106221
|
+
propagateChange(item);
|
|
106222
|
+
setIsDropdownVisible(false);
|
|
106223
|
+
};
|
|
106224
|
+
var handleEmptyOptionClick = function () {
|
|
106225
|
+
propagateChange();
|
|
106226
|
+
setIsDropdownVisible(false);
|
|
106227
|
+
};
|
|
106228
|
+
var selectFocusedItem = function () {
|
|
106229
|
+
var itemIndex = itemsIndex[currentItemPosition];
|
|
106230
|
+
if (!itemIndex)
|
|
106231
|
+
return;
|
|
106232
|
+
var category = itemIndex.category, item = itemIndex.item;
|
|
106233
|
+
if (item === -1) {
|
|
106234
|
+
propagateChange();
|
|
106235
|
+
return undefined;
|
|
106236
|
+
}
|
|
106237
|
+
var selectedItem = isCategorised
|
|
106238
|
+
? items[category].items[item]
|
|
106239
|
+
: items[item];
|
|
106240
|
+
if (selectedItem) {
|
|
106241
|
+
propagateChange(selectedItem);
|
|
106242
|
+
}
|
|
106243
|
+
else if (emptyValueLabel) {
|
|
106244
|
+
propagateChange();
|
|
106245
|
+
}
|
|
106246
|
+
return selectedItem;
|
|
106247
|
+
};
|
|
106248
|
+
var handleDropdownBlur = function () {
|
|
106249
|
+
var focusedItem = selectFocusedItem();
|
|
106250
|
+
setIsDropdownVisible(false);
|
|
106251
|
+
onBlur && onBlur((focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.value) || '');
|
|
106252
|
+
};
|
|
106253
|
+
var handleFocusedItem = function (item, category) {
|
|
106254
|
+
if (category === void 0) { category = -1; }
|
|
106255
|
+
var position = getItemIndexPosition({ item: item, category: category });
|
|
106256
|
+
setCurrentItemPosition(position);
|
|
106257
|
+
scrollToItem(item, category);
|
|
106195
106258
|
};
|
|
106196
106259
|
var handleOptionKeyPress = function (event) {
|
|
106197
106260
|
var key = event.key;
|
|
106198
106261
|
switch (key) {
|
|
106199
106262
|
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
|
-
}
|
|
106263
|
+
selectFocusedItem();
|
|
106264
|
+
handleComboBoxClick();
|
|
106265
|
+
event.preventDefault();
|
|
106205
106266
|
break;
|
|
106206
106267
|
case KEYS.ArrowDown:
|
|
106207
|
-
|
|
106208
|
-
|
|
106268
|
+
{
|
|
106269
|
+
var itemIndex = itemsIndex[currentItemPosition + 1];
|
|
106270
|
+
if (itemIndex) {
|
|
106271
|
+
handleFocusedItem(itemIndex.item, itemIndex.category);
|
|
106272
|
+
}
|
|
106273
|
+
event.preventDefault();
|
|
106274
|
+
}
|
|
106209
106275
|
break;
|
|
106210
106276
|
case KEYS.ArrowUp:
|
|
106211
|
-
|
|
106212
|
-
|
|
106277
|
+
{
|
|
106278
|
+
var itemIndex = itemsIndex[currentItemPosition - 1];
|
|
106279
|
+
if (itemIndex) {
|
|
106280
|
+
handleFocusedItem(itemIndex.item, itemIndex.category);
|
|
106281
|
+
}
|
|
106282
|
+
event.preventDefault();
|
|
106283
|
+
}
|
|
106213
106284
|
break;
|
|
106214
106285
|
case KEYS.Escape:
|
|
106215
106286
|
setIsDropdownVisible(false);
|
|
106216
|
-
|
|
106287
|
+
handleComboBoxClick();
|
|
106288
|
+
event.preventDefault();
|
|
106217
106289
|
break;
|
|
106218
106290
|
case KEYS.Home:
|
|
106219
|
-
|
|
106291
|
+
{
|
|
106292
|
+
var itemIndex = itemsIndex[0];
|
|
106293
|
+
if (itemIndex) {
|
|
106294
|
+
handleFocusedItem(itemIndex.item, itemIndex.category);
|
|
106295
|
+
}
|
|
106296
|
+
event.preventDefault();
|
|
106297
|
+
}
|
|
106220
106298
|
break;
|
|
106221
106299
|
case KEYS.End:
|
|
106222
|
-
|
|
106300
|
+
{
|
|
106301
|
+
var itemIndex = itemsIndex[itemsIndex.length - 1];
|
|
106302
|
+
if (itemIndex) {
|
|
106303
|
+
handleFocusedItem(itemIndex.item, itemIndex.category);
|
|
106304
|
+
}
|
|
106305
|
+
event.preventDefault();
|
|
106306
|
+
}
|
|
106223
106307
|
break;
|
|
106224
106308
|
case KEYS.Space:
|
|
106225
106309
|
selectFocusedItem();
|
|
@@ -106233,33 +106317,26 @@ var Select2 = function (_a) {
|
|
|
106233
106317
|
var key = event.key;
|
|
106234
106318
|
if ([KEYS.ArrowDown, KEYS.ArrowUp, KEYS.Enter].includes(key)) {
|
|
106235
106319
|
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);
|
|
106320
|
+
handleComboBoxClick();
|
|
106249
106321
|
event.preventDefault();
|
|
106250
106322
|
}
|
|
106251
106323
|
}
|
|
106324
|
+
if (key === KEYS.Escape && isDropdownVisible) {
|
|
106325
|
+
setIsDropdownVisible(false);
|
|
106326
|
+
}
|
|
106252
106327
|
};
|
|
106328
|
+
var focusedItem = itemsIndex[currentItemPosition];
|
|
106253
106329
|
var select2context = {
|
|
106254
|
-
|
|
106255
|
-
|
|
106330
|
+
emptyValueLabel: emptyValueLabel,
|
|
106331
|
+
focusedCategoryIndex: focusedItem ? focusedItem.category : -1,
|
|
106332
|
+
focusedItemIndex: focusedItem ? focusedItem.item : -1,
|
|
106256
106333
|
items: items,
|
|
106257
106334
|
name: name,
|
|
106335
|
+
onBlur: handleDropdownBlur,
|
|
106258
106336
|
optionClick: handleOptionClick,
|
|
106337
|
+
emptyOptionClick: handleEmptyOptionClick,
|
|
106259
106338
|
optionKeyPress: handleOptionKeyPress,
|
|
106260
|
-
|
|
106261
|
-
setFocusedItemIndex: setFocusedItemIndex,
|
|
106262
|
-
setValue: setValue,
|
|
106339
|
+
setFocusedItemIndex: handleFocusedItem,
|
|
106263
106340
|
value: value
|
|
106264
106341
|
};
|
|
106265
106342
|
var fromGroupProps = {
|
|
@@ -106271,17 +106348,10 @@ var Select2 = function (_a) {
|
|
|
106271
106348
|
labelTooltip: labelTooltip,
|
|
106272
106349
|
name: name
|
|
106273
106350
|
};
|
|
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
106351
|
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
106352
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(contexts_Select2Context.Provider, { value: select2context },
|
|
106283
106353
|
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",
|
|
106354
|
+
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
106355
|
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
106356
|
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
106357
|
};
|
|
@@ -110338,6 +110408,7 @@ var Header = function (_a) {
|
|
|
110338
110408
|
var MobilePanelContext_noop = function () { return null; };
|
|
110339
110409
|
var MobilePanelContext = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["createContext"])({
|
|
110340
110410
|
close: MobilePanelContext_noop,
|
|
110411
|
+
closeOnClick: false,
|
|
110341
110412
|
identification: '',
|
|
110342
110413
|
isFocused: false,
|
|
110343
110414
|
isOpen: false,
|
|
@@ -110357,7 +110428,7 @@ MobilePanelContext.displayName = 'ModalContext';
|
|
|
110357
110428
|
|
|
110358
110429
|
|
|
110359
110430
|
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;
|
|
110431
|
+
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
110432
|
var width = useWindowWidth();
|
|
110362
110433
|
var isLeft = position === 'left';
|
|
110363
110434
|
var panelWidth = width <= BREAKPOINTS_VALUES.sm ? '100%' : '320px';
|
|
@@ -110377,6 +110448,7 @@ var MobilePanel = function (_a) {
|
|
|
110377
110448
|
};
|
|
110378
110449
|
var mobilePanelContext = {
|
|
110379
110450
|
close: close,
|
|
110451
|
+
closeOnClick: closeOnClick,
|
|
110380
110452
|
identification: identification,
|
|
110381
110453
|
isFocused: isFocused,
|
|
110382
110454
|
isOpen: isOpen,
|
|
@@ -110386,7 +110458,7 @@ var MobilePanel = function (_a) {
|
|
|
110386
110458
|
setIsScrolled: setIsScrolled,
|
|
110387
110459
|
toggle: toggle
|
|
110388
110460
|
};
|
|
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 },
|
|
110461
|
+
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
110462
|
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
110463
|
};
|
|
110392
110464
|
|
|
@@ -110448,7 +110520,8 @@ var Header_content = {
|
|
|
110448
110520
|
var MobilePanelHeader = function (_a) {
|
|
110449
110521
|
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;
|
|
110450
110522
|
var close = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useContext"])(contexts_MobilePanelContext).close;
|
|
110451
|
-
|
|
110523
|
+
var handleHeaderClick = function (event) { return event.stopPropagation(); };
|
|
110524
|
+
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
110525
|
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
110526
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("span", { className: "u-vHide" }, closeAria),
|
|
110454
110527
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { name: "close" }))),
|
|
@@ -13,6 +13,7 @@ export interface DropdownMenuPropsType extends ComponentPropsType {
|
|
|
13
13
|
activeDescendant?: string;
|
|
14
14
|
id?: string;
|
|
15
15
|
onKeyDown?: (event: React.KeyboardEvent<HTMLUListElement>) => void;
|
|
16
|
+
onBlur?: () => void;
|
|
16
17
|
}
|
|
17
|
-
export declare const DropdownMenu: ({ activeDescendant, ariaHidden, children, id, labelledBy, onKeyDown, role, tabIndex, testId, theme, title }: DropdownMenuPropsType) => JSX.Element;
|
|
18
|
+
export declare const DropdownMenu: ({ activeDescendant, ariaHidden, children, id, labelledBy, onBlur, onKeyDown, role, tabIndex, testId, theme, title }: DropdownMenuPropsType) => JSX.Element;
|
|
18
19
|
//# sourceMappingURL=DropdownMenu.d.ts.map
|