@muraldevkit/ui-toolkit 4.70.1 → 4.70.3-dev-kmM6.1
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/components/form/select/components/MrlSelectContainer.js +6 -1
- package/dist/cjs/components/form/select/components/MrlSelectContainer.js.map +1 -1
- package/dist/cjs/components/form/select/utils/useMenuEscapeContainment.js +59 -0
- package/dist/cjs/components/form/select/utils/useMenuEscapeContainment.js.map +1 -0
- package/dist/cjs/components/notification/MrlBlockNotification/MrlBlockNotification.module.scss.js +1 -1
- package/dist/cjs/hooks/useAutoClose/useAutoClose.js.map +1 -1
- package/dist/components/breadcrumb/MrlBreadcrumbSeparator/MrlBreadcrumbSeparator.d.ts +0 -1
- package/dist/components/divider/MrlDivider/MrlDivider.d.ts +0 -1
- package/dist/components/empty/default/MrlEmpty.d.ts +0 -1
- package/dist/components/empty/large/MrlEmptyLarge.d.ts +0 -1
- package/dist/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.d.ts +0 -1
- package/dist/components/form/legacy-select/MrlLegacySelectMenu/MrlLegacySelectMenu.d.ts +0 -1
- package/dist/components/form/select/MrlCreatableSelect/MrlCreatableSelect.d.ts +1 -2
- package/dist/components/form/select/MrlMultiCreatableSelect/MrlMultiCreatableSelect.d.ts +1 -2
- package/dist/components/form/select/MrlMultiSelect/MrlMultiSelect.d.ts +1 -2
- package/dist/components/form/select/MrlSelect/MrlSelect.d.ts +1 -2
- package/dist/components/form/select/components/MrlSelectClearIndicator.d.ts +0 -1
- package/dist/components/form/select/components/MrlSelectContainer.d.ts +3 -1
- package/dist/components/form/select/components/MrlSelectDropdownIndicator.d.ts +0 -1
- package/dist/components/form/select/components/MrlSelectMultiValue.d.ts +0 -1
- package/dist/components/form/select/components/MrlSelectMultiValueRemove.d.ts +0 -1
- package/dist/components/form/select/components/MrlSelectOption.d.ts +0 -1
- package/dist/components/form/select/components/MrlSelectValueContainer.d.ts +0 -1
- package/dist/components/form/select/utils/useMenuEscapeContainment.d.ts +21 -0
- package/dist/components/form/textarea/MrlTextarea/MrlTextarea.d.ts +0 -1
- package/dist/components/grid/MrlCol/MrlCol.d.ts +0 -1
- package/dist/components/grid/MrlGrid/MrlGrid.d.ts +0 -1
- package/dist/components/grid/MrlRow/MrlRow.d.ts +0 -1
- package/dist/components/layout/MrlMain/MrlMain.d.ts +0 -1
- package/dist/components/layout/MrlPage/MrlPage.d.ts +0 -1
- package/dist/components/layout/MrlPage/index.d.ts +0 -1
- package/dist/components/layout/MrlSidebar/demo/MrlSidebarDemo.d.ts +0 -1
- package/dist/components/layout/MrlTopbar/MrlTopbar.d.ts +0 -1
- package/dist/components/layout/constants.d.ts +0 -1
- package/dist/components/live-region/demo/LiveRegionDemo.d.ts +0 -1
- package/dist/components/loader/MrlProgressBar/MrlProgressBar.d.ts +0 -1
- package/dist/components/loader/MrlSpinner/MrlSpinner.d.ts +0 -1
- package/dist/components/loader/constants.d.ts +0 -1
- package/dist/components/menu/constants.d.ts +0 -1
- package/dist/components/menu/demo/MenuByConfig.d.ts +0 -1
- package/dist/components/menu/demo/MenuWithPopover.d.ts +0 -1
- package/dist/components/menu/demo/MenuWithSubmenu.d.ts +0 -1
- package/dist/components/menu/demo/MenuWithTrigger.d.ts +0 -1
- package/dist/components/modal/demo/ModalWithTriggerDemo.d.ts +0 -1
- package/dist/components/pagination/MrlPaginationText/MrlPaginationText.d.ts +0 -1
- package/dist/components/popover/demo/PopoverWithIconButton.d.ts +0 -1
- package/dist/components/popover/demo/PopoverWithSelect.d.ts +0 -1
- package/dist/components/popover/demo/PopoverWithTrigger.d.ts +0 -1
- package/dist/components/table/MrlSmartTable/storybook-utils.d.ts +9 -10
- package/dist/components/table/MrlTableEmptyState/MrlTableEmptyState.d.ts +0 -1
- package/dist/components/table/utils.d.ts +1 -1
- package/dist/components/toolbar/MrlToolbarItem/MrlToolbarItem.d.ts +0 -1
- package/dist/esm/components/form/select/components/MrlSelectContainer.js +6 -1
- package/dist/esm/components/form/select/components/MrlSelectContainer.js.map +1 -1
- package/dist/esm/components/form/select/utils/useMenuEscapeContainment.js +37 -0
- package/dist/esm/components/form/select/utils/useMenuEscapeContainment.js.map +1 -0
- package/dist/esm/components/notification/MrlBlockNotification/MrlBlockNotification.module.scss.js +1 -1
- package/dist/esm/hooks/useAutoClose/useAutoClose.js.map +1 -1
- package/dist/hooks/useBreakpoint/useBreakpointDemo.d.ts +0 -1
- package/dist/hooks/useClickOutside/index.d.ts +1 -1
- package/dist/styles/MrlBlockNotification/module.scss +7 -12
- package/dist/styles.css +1 -1
- package/dist/types/components/breadcrumb/MrlBreadcrumbSeparator/MrlBreadcrumbSeparator.d.ts +0 -1
- package/dist/types/components/divider/MrlDivider/MrlDivider.d.ts +0 -1
- package/dist/types/components/empty/default/MrlEmpty.d.ts +0 -1
- package/dist/types/components/empty/large/MrlEmptyLarge.d.ts +0 -1
- package/dist/types/components/form/checkbox/MrlCheckboxStandalone/MrlCheckboxStandalone.d.ts +0 -1
- package/dist/types/components/form/legacy-select/MrlLegacySelectMenu/MrlLegacySelectMenu.d.ts +0 -1
- package/dist/types/components/form/select/MrlCreatableSelect/MrlCreatableSelect.d.ts +1 -2
- package/dist/types/components/form/select/MrlMultiCreatableSelect/MrlMultiCreatableSelect.d.ts +1 -2
- package/dist/types/components/form/select/MrlMultiSelect/MrlMultiSelect.d.ts +1 -2
- package/dist/types/components/form/select/MrlSelect/MrlSelect.d.ts +1 -2
- package/dist/types/components/form/select/components/MrlSelectClearIndicator.d.ts +0 -1
- package/dist/types/components/form/select/components/MrlSelectContainer.d.ts +3 -1
- package/dist/types/components/form/select/components/MrlSelectDropdownIndicator.d.ts +0 -1
- package/dist/types/components/form/select/components/MrlSelectMultiValue.d.ts +0 -1
- package/dist/types/components/form/select/components/MrlSelectMultiValueRemove.d.ts +0 -1
- package/dist/types/components/form/select/components/MrlSelectOption.d.ts +0 -1
- package/dist/types/components/form/select/components/MrlSelectValueContainer.d.ts +0 -1
- package/dist/types/components/form/select/utils/useMenuEscapeContainment.d.ts +21 -0
- package/dist/types/components/form/textarea/MrlTextarea/MrlTextarea.d.ts +0 -1
- package/dist/types/components/grid/MrlCol/MrlCol.d.ts +0 -1
- package/dist/types/components/grid/MrlGrid/MrlGrid.d.ts +0 -1
- package/dist/types/components/grid/MrlRow/MrlRow.d.ts +0 -1
- package/dist/types/components/layout/MrlMain/MrlMain.d.ts +0 -1
- package/dist/types/components/layout/MrlPage/MrlPage.d.ts +0 -1
- package/dist/types/components/layout/MrlPage/index.d.ts +0 -1
- package/dist/types/components/layout/MrlSidebar/demo/MrlSidebarDemo.d.ts +0 -1
- package/dist/types/components/layout/MrlTopbar/MrlTopbar.d.ts +0 -1
- package/dist/types/components/layout/constants.d.ts +0 -1
- package/dist/types/components/layout/error-page/MrlBrandColors/MrlBrandColors.d.ts +0 -1
- package/dist/types/components/live-region/demo/LiveRegionDemo.d.ts +0 -1
- package/dist/types/components/loader/MrlProgressBar/MrlProgressBar.d.ts +0 -1
- package/dist/types/components/loader/MrlSpinner/MrlSpinner.d.ts +0 -1
- package/dist/types/components/loader/constants.d.ts +0 -1
- package/dist/types/components/menu/constants.d.ts +0 -1
- package/dist/types/components/menu/demo/MenuByConfig.d.ts +0 -1
- package/dist/types/components/menu/demo/MenuWithPopover.d.ts +0 -1
- package/dist/types/components/menu/demo/MenuWithSubmenu.d.ts +0 -1
- package/dist/types/components/menu/demo/MenuWithTrigger.d.ts +0 -1
- package/dist/types/components/modal/demo/ModalWithTriggerDemo.d.ts +0 -1
- package/dist/types/components/pagination/MrlPaginationText/MrlPaginationText.d.ts +0 -1
- package/dist/types/components/popover/demo/PopoverWithIconButton.d.ts +0 -1
- package/dist/types/components/popover/demo/PopoverWithSelect.d.ts +0 -1
- package/dist/types/components/popover/demo/PopoverWithTrigger.d.ts +0 -1
- package/dist/types/components/table/MrlSmartTable/storybook-utils.d.ts +9 -10
- package/dist/types/components/table/MrlTableEmptyState/MrlTableEmptyState.d.ts +0 -1
- package/dist/types/components/table/utils.d.ts +1 -1
- package/dist/types/components/toolbar/MrlToolbarItem/MrlToolbarItem.d.ts +0 -1
- package/dist/types/hooks/useBreakpoint/useBreakpointDemo.d.ts +0 -1
- package/dist/types/hooks/useClickOutside/index.d.ts +1 -1
- package/dist/types/utils/findAdjacentInteractiveElement/findAdjacentInteractiveElement.d.ts +1 -1
- package/dist/utils/findAdjacentInteractiveElement/findAdjacentInteractiveElement.d.ts +1 -1
- package/package.json +7 -6
- package/dist/types/utils/getCamelCase/getCamelCase.test.d.ts +0 -1
- package/dist/types/utils/isElementAriaDisabled/isElementAriaDisabled.test.d.ts +0 -1
- package/dist/types/utils/isObject/isObject.test.d.ts +0 -1
- package/dist/types/utils/setAttributes/setAttributes.test.d.ts +0 -1
- package/dist/utils/getCamelCase/getCamelCase.test.d.ts +0 -1
- package/dist/utils/isElementAriaDisabled/isElementAriaDisabled.test.d.ts +0 -1
- package/dist/utils/isObject/isObject.test.d.ts +0 -1
- package/dist/utils/setAttributes/setAttributes.test.d.ts +0 -1
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var Select = require('react-select');
|
|
6
|
+
var useMenuEscapeContainment = require('../utils/useMenuEscapeContainment.js');
|
|
6
7
|
|
|
7
8
|
function _interopNamespace(e) {
|
|
8
9
|
if (e && e.__esModule) return e;
|
|
@@ -27,13 +28,17 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
27
28
|
/**
|
|
28
29
|
* MrlSelectContainer component
|
|
29
30
|
*
|
|
31
|
+
* Adds `data-qa` support and keeps the `Escape` press that dismisses an open menu
|
|
32
|
+
* from also closing an outer dismissible surface (e.g. a select inside MrlModal).
|
|
33
|
+
*
|
|
30
34
|
* @param props - the react-select container props
|
|
31
35
|
* @returns a select container
|
|
32
36
|
*/
|
|
33
37
|
function MrlSelectContainer(props) {
|
|
34
38
|
var dataQa = props.selectProps['data-qa'];
|
|
39
|
+
var escapeContainment = useMenuEscapeContainment.useMenuEscapeContainment(props.selectProps.menuIsOpen, props.innerProps.onKeyDown);
|
|
35
40
|
return /*#__PURE__*/React__namespace.createElement(Select.components.SelectContainer, _rollupPluginBabelHelpers.extends({}, props, {
|
|
36
|
-
innerProps: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, props.innerProps), dataQa && {
|
|
41
|
+
innerProps: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, props.innerProps), escapeContainment), dataQa && {
|
|
37
42
|
'data-qa': "".concat(dataQa, "-container")
|
|
38
43
|
})
|
|
39
44
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MrlSelectContainer.js","sources":["../../../../../../src/components/form/select/components/MrlSelectContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { GroupBase, components, ContainerProps } from 'react-select';\n\n/**\n * MrlSelectContainer component\n *\n * @param props - the react-select container props\n * @returns a select container\n */\nexport function MrlSelectContainer<\n\tT,\n\tIsMulti extends boolean = false,\n\tGroup extends GroupBase<T> = GroupBase<T>\n>(props: ContainerProps<T, IsMulti, Group>): JSX.Element {\n\tconst dataQa = props.selectProps['data-qa'];\n\treturn (\n\t\t<components.SelectContainer\n\t\t\t{...props}\n\t\t\tinnerProps={{\n\t\t\t\t...props.innerProps,\n\t\t\t\t...(dataQa && { 'data-qa': `${dataQa}-container` })\n\t\t\t}}\n\t\t/>\n\t);\n}\n"],"names":["MrlSelectContainer","props","dataQa","selectProps","React","createElement","components","SelectContainer","_extends","
|
|
1
|
+
{"version":3,"file":"MrlSelectContainer.js","sources":["../../../../../../src/components/form/select/components/MrlSelectContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { GroupBase, components, ContainerProps } from 'react-select';\nimport { useMenuEscapeContainment } from '../utils/useMenuEscapeContainment';\n\n/**\n * MrlSelectContainer component\n *\n * Adds `data-qa` support and keeps the `Escape` press that dismisses an open menu\n * from also closing an outer dismissible surface (e.g. a select inside MrlModal).\n *\n * @param props - the react-select container props\n * @returns a select container\n */\nexport function MrlSelectContainer<\n\tT,\n\tIsMulti extends boolean = false,\n\tGroup extends GroupBase<T> = GroupBase<T>\n>(props: ContainerProps<T, IsMulti, Group>): JSX.Element {\n\tconst dataQa = props.selectProps['data-qa'];\n\tconst escapeContainment = useMenuEscapeContainment(\n\t\tprops.selectProps.menuIsOpen,\n\t\tprops.innerProps.onKeyDown\n\t);\n\n\treturn (\n\t\t<components.SelectContainer\n\t\t\t{...props}\n\t\t\tinnerProps={{\n\t\t\t\t...props.innerProps,\n\t\t\t\t...escapeContainment,\n\t\t\t\t...(dataQa && { 'data-qa': `${dataQa}-container` })\n\t\t\t}}\n\t\t/>\n\t);\n}\n"],"names":["MrlSelectContainer","props","dataQa","selectProps","escapeContainment","useMenuEscapeContainment","menuIsOpen","innerProps","onKeyDown","React","createElement","components","SelectContainer","_extends","_objectSpread","concat"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAkBA,CAIhCC,KAAwC,EAAe;AACxD,EAAA,IAAMC,MAAM,GAAGD,KAAK,CAACE,WAAW,CAAC,SAAS,CAAC;AAC3C,EAAA,IAAMC,iBAAiB,GAAGC,iDAAwB,CACjDJ,KAAK,CAACE,WAAW,CAACG,UAAU,EAC5BL,KAAK,CAACM,UAAU,CAACC,SAClB,CAAC;EAED,oBACCC,gBAAA,CAAAC,aAAA,CAACC,iBAAU,CAACC,eAAe,EAAAC,iCAAA,CAAA,EAAA,EACtBZ,KAAK,EAAA;AACTM,IAAAA,UAAU,EAAAO,uCAAA,CAAAA,uCAAA,CAAAA,uCAAA,CAAA,EAAA,EACNb,KAAK,CAACM,UAAU,CAAA,EAChBH,iBAAiB,CAAA,EAChBF,MAAM,IAAI;MAAE,SAAS,EAAA,EAAA,CAAAa,MAAA,CAAKb,MAAM,EAAA,YAAA;KAAc;AACjD,GAAA,CACF,CAAC;AAEJ;;;;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
function _interopNamespace(e) {
|
|
6
|
+
if (e && e.__esModule) return e;
|
|
7
|
+
var n = Object.create(null);
|
|
8
|
+
if (e) {
|
|
9
|
+
Object.keys(e).forEach(function (k) {
|
|
10
|
+
if (k !== 'default') {
|
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return e[k]; }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Keeps the `Escape` press that dismisses an open select menu from reaching outer
|
|
27
|
+
* dismissible surfaces. MrlModal, MrlPanel and MrlPopover close on `Escape` keydown
|
|
28
|
+
* and MrlSidebar on keyup, so without containment a single press would close the
|
|
29
|
+
* menu and the surface behind it at the same time.
|
|
30
|
+
*
|
|
31
|
+
* While the menu is open, the `Escape` keydown and its paired keyup stop propagating
|
|
32
|
+
* after react-select handles them. Once the menu is closed, `Escape` bubbles as
|
|
33
|
+
* usual so the outer surface can respond to the next press.
|
|
34
|
+
*
|
|
35
|
+
* @param menuIsOpen - the resolved react-select menu state
|
|
36
|
+
* @param onKeyDown - react-select's container keydown handler to wrap
|
|
37
|
+
* @returns key event handlers to spread into the select container's `innerProps`
|
|
38
|
+
*/
|
|
39
|
+
function useMenuEscapeContainment(menuIsOpen, onKeyDown) {
|
|
40
|
+
var escapeDismissedTheMenu = React__namespace.useRef(false);
|
|
41
|
+
var handleKeyDown = event => {
|
|
42
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
43
|
+
if (event.key !== 'Escape') return;
|
|
44
|
+
escapeDismissedTheMenu.current = menuIsOpen;
|
|
45
|
+
if (menuIsOpen) event.stopPropagation();
|
|
46
|
+
};
|
|
47
|
+
var handleKeyUp = event => {
|
|
48
|
+
if (event.key !== 'Escape') return;
|
|
49
|
+
if (escapeDismissedTheMenu.current) event.stopPropagation();
|
|
50
|
+
escapeDismissedTheMenu.current = false;
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
onKeyDown: handleKeyDown,
|
|
54
|
+
onKeyUp: handleKeyUp
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
exports.useMenuEscapeContainment = useMenuEscapeContainment;
|
|
59
|
+
//# sourceMappingURL=useMenuEscapeContainment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMenuEscapeContainment.js","sources":["../../../../../../src/components/form/select/utils/useMenuEscapeContainment.ts"],"sourcesContent":["import * as React from 'react';\n\ninterface MenuEscapeContainmentHandlers {\n\tonKeyDown: React.KeyboardEventHandler<HTMLDivElement>;\n\tonKeyUp: React.KeyboardEventHandler<HTMLDivElement>;\n}\n\n/**\n * Keeps the `Escape` press that dismisses an open select menu from reaching outer\n * dismissible surfaces. MrlModal, MrlPanel and MrlPopover close on `Escape` keydown\n * and MrlSidebar on keyup, so without containment a single press would close the\n * menu and the surface behind it at the same time.\n *\n * While the menu is open, the `Escape` keydown and its paired keyup stop propagating\n * after react-select handles them. Once the menu is closed, `Escape` bubbles as\n * usual so the outer surface can respond to the next press.\n *\n * @param menuIsOpen - the resolved react-select menu state\n * @param onKeyDown - react-select's container keydown handler to wrap\n * @returns key event handlers to spread into the select container's `innerProps`\n */\nexport function useMenuEscapeContainment(\n\tmenuIsOpen: boolean,\n\tonKeyDown: React.KeyboardEventHandler<HTMLDivElement> | undefined\n): MenuEscapeContainmentHandlers {\n\tconst escapeDismissedTheMenu = React.useRef(false);\n\n\tconst handleKeyDown: React.KeyboardEventHandler<HTMLDivElement> = (event) => {\n\t\tonKeyDown?.(event);\n\n\t\tif (event.key !== 'Escape') return;\n\n\t\tescapeDismissedTheMenu.current = menuIsOpen;\n\t\tif (menuIsOpen) event.stopPropagation();\n\t};\n\n\tconst handleKeyUp: React.KeyboardEventHandler<HTMLDivElement> = (event) => {\n\t\tif (event.key !== 'Escape') return;\n\n\t\tif (escapeDismissedTheMenu.current) event.stopPropagation();\n\t\tescapeDismissedTheMenu.current = false;\n\t};\n\n\treturn { onKeyDown: handleKeyDown, onKeyUp: handleKeyUp };\n}\n"],"names":["useMenuEscapeContainment","menuIsOpen","onKeyDown","escapeDismissedTheMenu","React","useRef","handleKeyDown","event","key","current","stopPropagation","handleKeyUp","onKeyUp"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,wBAAwBA,CACvCC,UAAmB,EACnBC,SAAiE,EACjC;AAChC,EAAA,IAAMC,sBAAsB,GAAGC,gBAAK,CAACC,MAAM,CAAC,KAAK,CAAC;EAElD,IAAMC,aAAyD,GAAIC,KAAK,IAAK;AAC5EL,IAAAA,SAAS,aAATA,SAAS,KAAA,MAAA,GAAA,MAAA,GAATA,SAAS,CAAGK,KAAK,CAAC;AAElB,IAAA,IAAIA,KAAK,CAACC,GAAG,KAAK,QAAQ,EAAE;IAE5BL,sBAAsB,CAACM,OAAO,GAAGR,UAAU;AAC3C,IAAA,IAAIA,UAAU,EAAEM,KAAK,CAACG,eAAe,EAAE;EACxC,CAAC;EAED,IAAMC,WAAuD,GAAIJ,KAAK,IAAK;AAC1E,IAAA,IAAIA,KAAK,CAACC,GAAG,KAAK,QAAQ,EAAE;IAE5B,IAAIL,sBAAsB,CAACM,OAAO,EAAEF,KAAK,CAACG,eAAe,EAAE;IAC3DP,sBAAsB,CAACM,OAAO,GAAG,KAAK;EACvC,CAAC;EAED,OAAO;AAAEP,IAAAA,SAAS,EAAEI,aAAa;AAAEM,IAAAA,OAAO,EAAED;GAAa;AAC1D;;;;"}
|
package/dist/cjs/components/notification/MrlBlockNotification/MrlBlockNotification.module.scss.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var styles = {"mrl-blockNotification":"mrl-blockNotification--xbhrd","mrl-blockNotification-icon":"mrl-blockNotification-icon--CAq04","mrl-blockNotification-close-wrapper":"mrl-blockNotification-close-wrapper--yODTH","cta":"cta--gnyoO","mrl-blockNotification--dismissible":"mrl-blockNotification--dismissible--ZlIID","mrl-blockNotification-
|
|
5
|
+
var styles = {"mrl-blockNotification":"mrl-blockNotification--xbhrd","mrl-blockNotification-icon":"mrl-blockNotification-icon--CAq04","mrl-blockNotification-close-wrapper":"mrl-blockNotification-close-wrapper--yODTH","cta":"cta--gnyoO","mrl-blockNotification--dismissible":"mrl-blockNotification--dismissible--ZlIID","mrl-blockNotification-heading":"mrl-blockNotification-heading--WGPWE","mrl-blockNotification-message":"mrl-blockNotification-message--MdtXZ"};
|
|
6
6
|
|
|
7
7
|
exports.default = styles;
|
|
8
8
|
//# sourceMappingURL=MrlBlockNotification.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAutoClose.js","sources":["../../../../src/hooks/useAutoClose/useAutoClose.ts"],"sourcesContent":["import * as React from 'react';\n\nexport type useAutoClose = (\n\tshouldAutoClose?: boolean,\n\tcloseAfterMs?: number,\n\tonClose?: () => unknown\n) => [boolean, React.Dispatch<React.SetStateAction<boolean>>];\n\n/**\n * Hook that exposes a piece of state that allows components to close themselves after a delay\n *\n * @param shouldAutoClose - When false prevents automated close (e.g. can be used to prevent auto-dismissal of interactive elements, an accessibility anti-pattern)\n * @param closeAfterMs - Delay in milliseconds before the component closes\n * @param onClose - Callback to be called when component closes\n * @returns [closed, setClosed] - a boolean tracking closed state, and a setter for that same state\n */\nexport const useAutoClose: useAutoClose = function (\n\tshouldAutoClose = true,\n\tcloseAfterMs = 3000,\n\tonClose\n) {\n\tconst [closed, setClosed] = React.useState<boolean>(false);\n\tconst currentTimeout = React.useRef<
|
|
1
|
+
{"version":3,"file":"useAutoClose.js","sources":["../../../../src/hooks/useAutoClose/useAutoClose.ts"],"sourcesContent":["import * as React from 'react';\n\nexport type useAutoClose = (\n\tshouldAutoClose?: boolean,\n\tcloseAfterMs?: number,\n\tonClose?: () => unknown\n) => [boolean, React.Dispatch<React.SetStateAction<boolean>>];\n\n/**\n * Hook that exposes a piece of state that allows components to close themselves after a delay\n *\n * @param shouldAutoClose - When false prevents automated close (e.g. can be used to prevent auto-dismissal of interactive elements, an accessibility anti-pattern)\n * @param closeAfterMs - Delay in milliseconds before the component closes\n * @param onClose - Callback to be called when component closes\n * @returns [closed, setClosed] - a boolean tracking closed state, and a setter for that same state\n */\nexport const useAutoClose: useAutoClose = function (\n\tshouldAutoClose = true,\n\tcloseAfterMs = 3000,\n\tonClose\n) {\n\tconst [closed, setClosed] = React.useState<boolean>(false);\n\tconst currentTimeout = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n\tReact.useEffect(() => {\n\t\t// Reset current timeout when component mounts or when notification changes\n\t\tif (currentTimeout.current) {\n\t\t\tresetTimeout();\n\t\t}\n\n\t\t// Allowing autoClose when there are interactive elements in the toast is an anti-pattern\n\t\t// and should be avoided. If autoClose is set to true and interactive elements exist, the\n\t\t// toast will not close automatically.\n\t\tif (shouldAutoClose) {\n\t\t\tsetClosed(false);\n\n\t\t\tcurrentTimeout.current = setTimeout(() => {\n\t\t\t\tsetClosed(true);\n\n\t\t\t\t// Handle onClose after the timeout is elapsed\n\t\t\t\tif (onClose) onClose();\n\t\t\t}, closeAfterMs);\n\t\t}\n\n\t\treturn () => {\n\t\t\t// Clear timeout when component unmounts\n\t\t\tresetTimeout();\n\t\t};\n\t}, [shouldAutoClose, closeAfterMs, onClose]);\n\n\t/** Resets the current timeout and `closed` to its initial value */\n\tconst resetTimeout = (): void => {\n\t\tif (currentTimeout.current !== null) {\n\t\t\tclearTimeout(currentTimeout.current);\n\t\t}\n\t\tsetClosed(false);\n\t};\n\n\treturn [closed, setClosed];\n};\n"],"names":["useAutoClose","shouldAutoClose","arguments","length","undefined","closeAfterMs","onClose","_React$useState","React","useState","_React$useState2","_slicedToArray","closed","setClosed","currentTimeout","useRef","useEffect","current","resetTimeout","setTimeout","clearTimeout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACaA,YAA0B,GAAG,SAA7BA,YAA0BA,GAIrC;AAAA,EAAA,IAHDC,eAAe,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,IAAI;AAAA,EAAA,IACtBG,YAAY,GAAAH,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,IAAI;EAAA,IACnBI,OAAO,GAAAJ,SAAA,CAAAC,MAAA,GAAA,CAAA,GAAAD,SAAA,MAAAE,SAAA;AAEP,EAAA,IAAAG,eAAA,GAA4BC,gBAAK,CAACC,QAAQ,CAAU,KAAK,CAAC;IAAAC,gBAAA,GAAAC,uCAAA,CAAAJ,eAAA,EAAA,CAAA,CAAA;AAAnDK,IAAAA,MAAM,GAAAF,gBAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,SAAS,GAAAH,gBAAA,CAAA,CAAA,CAAA;AACxB,EAAA,IAAMI,cAAc,GAAGN,gBAAK,CAACO,MAAM,CAAuC,IAAI,CAAC;EAE/EP,gBAAK,CAACQ,SAAS,CAAC,MAAM;AACrB;IACA,IAAIF,cAAc,CAACG,OAAO,EAAE;AAC3BC,MAAAA,YAAY,EAAE;AACf,IAAA;;AAEA;AACA;AACA;AACA,IAAA,IAAIjB,eAAe,EAAE;MACpBY,SAAS,CAAC,KAAK,CAAC;AAEhBC,MAAAA,cAAc,CAACG,OAAO,GAAGE,UAAU,CAAC,MAAM;QACzCN,SAAS,CAAC,IAAI,CAAC;;AAEf;AACA,QAAA,IAAIP,OAAO,EAAEA,OAAO,EAAE;MACvB,CAAC,EAAED,YAAY,CAAC;AACjB,IAAA;AAEA,IAAA,OAAO,MAAM;AACZ;AACAa,MAAAA,YAAY,EAAE;IACf,CAAC;EACF,CAAC,EAAE,CAACjB,eAAe,EAAEI,YAAY,EAAEC,OAAO,CAAC,CAAC;;AAE5C;EACA,IAAMY,YAAY,GAAGA,MAAY;AAChC,IAAA,IAAIJ,cAAc,CAACG,OAAO,KAAK,IAAI,EAAE;AACpCG,MAAAA,YAAY,CAACN,cAAc,CAACG,OAAO,CAAC;AACrC,IAAA;IACAJ,SAAS,CAAC,KAAK,CAAC;EACjB,CAAC;AAED,EAAA,OAAO,CAACD,MAAM,EAAEC,SAAS,CAAC;AAC3B;;;;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
3
2
|
import { SelectMenuPositions } from '../../constants';
|
|
4
3
|
import { AttrsObject } from '../../../../utils';
|
|
5
4
|
export interface MrlLegacySelectMenuProptypes extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { CreatableProps } from 'react-select/creatable';
|
|
3
2
|
import { GroupBase } from 'react-select';
|
|
4
3
|
import { SelectKind } from '../types';
|
|
@@ -17,7 +16,7 @@ export interface MrlCreatableSelectProps<Option, IsMulti extends boolean = false
|
|
|
17
16
|
showClearIndicatorIcon?: boolean;
|
|
18
17
|
}
|
|
19
18
|
export declare const CREATABLE_SELECT_CLASS_NAME_PREFIX = "MrlCreatableSelect";
|
|
20
|
-
export declare const CREATABLE_SELECT_MENU_LIST_CLASS_NAME
|
|
19
|
+
export declare const CREATABLE_SELECT_MENU_LIST_CLASS_NAME = "MrlCreatableSelect__menu-list";
|
|
21
20
|
/**
|
|
22
21
|
* MrlCreatableSelect component that supports creating extra options with user input. Option creating could be async too.
|
|
23
22
|
* @param props - the component props
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { CreatableProps } from 'react-select/creatable';
|
|
3
2
|
import { GroupBase } from 'react-select';
|
|
4
3
|
import { DefaultOption, SelectKind } from '../types';
|
|
@@ -17,7 +16,7 @@ export interface MrlMultiCreatableSelectProps<Option, IsMulti extends boolean =
|
|
|
17
16
|
showClearIndicatorIcon?: boolean;
|
|
18
17
|
}
|
|
19
18
|
export declare const MULTI_CREATABLE_SELECT_CLASS_NAME_PREFIX = "MrlMultiCreatableSelect";
|
|
20
|
-
export declare const MULTI_CREATABLE_SELECT_MENU_LIST_CLASS_NAME
|
|
19
|
+
export declare const MULTI_CREATABLE_SELECT_MENU_LIST_CLASS_NAME = "MrlMultiCreatableSelect__menu-list";
|
|
21
20
|
/**
|
|
22
21
|
* MrlMultiCreatableSelect component that supports creating extra options with user input. Option creating could be async too.
|
|
23
22
|
* @param props - the component props
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { GroupBase, Props } from 'react-select';
|
|
3
2
|
import { DefaultOption, SelectKind } from '../types';
|
|
4
3
|
export interface MrlMultiSelectProps<T, IsMulti extends boolean = false, Group extends GroupBase<T> = GroupBase<T>> extends Omit<Props<T, IsMulti, Group>, 'isMulti' | 'hideSelectedOptions'> {
|
|
@@ -15,7 +14,7 @@ export interface MrlMultiSelectProps<T, IsMulti extends boolean = false, Group e
|
|
|
15
14
|
['data-qa']?: string;
|
|
16
15
|
}
|
|
17
16
|
export declare const MULTI_SELECT_CLASS_NAME_PREFIX = "MrlMultiSelect";
|
|
18
|
-
export declare const MULTI_SELECT_MENU_LIST_CLASS_NAME
|
|
17
|
+
export declare const MULTI_SELECT_MENU_LIST_CLASS_NAME = "MrlMultiSelect__menu-list";
|
|
19
18
|
/**
|
|
20
19
|
* MrlSelect component
|
|
21
20
|
* @param props - the component props
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { GroupBase, Props } from 'react-select';
|
|
3
2
|
import { SelectKind } from '../types';
|
|
4
3
|
export interface MrlSelectProps<Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>> extends Props<Option, IsMulti, Group> {
|
|
@@ -15,7 +14,7 @@ export interface MrlSelectProps<Option, IsMulti extends boolean = false, Group e
|
|
|
15
14
|
['data-qa']?: string;
|
|
16
15
|
}
|
|
17
16
|
export declare const SELECT_CLASS_NAME_PREFIX = "MrlSelect";
|
|
18
|
-
export declare const SELECT_MENU_LIST_CLASS_NAME
|
|
17
|
+
export declare const SELECT_MENU_LIST_CLASS_NAME = "MrlSelect__menu-list";
|
|
19
18
|
/**
|
|
20
19
|
* MrlSelect component
|
|
21
20
|
* @param props - the component props
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { GroupBase, ContainerProps } from 'react-select';
|
|
3
2
|
/**
|
|
4
3
|
* MrlSelectContainer component
|
|
5
4
|
*
|
|
5
|
+
* Adds `data-qa` support and keeps the `Escape` press that dismisses an open menu
|
|
6
|
+
* from also closing an outer dismissible surface (e.g. a select inside MrlModal).
|
|
7
|
+
*
|
|
6
8
|
* @param props - the react-select container props
|
|
7
9
|
* @returns a select container
|
|
8
10
|
*/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface MenuEscapeContainmentHandlers {
|
|
3
|
+
onKeyDown: React.KeyboardEventHandler<HTMLDivElement>;
|
|
4
|
+
onKeyUp: React.KeyboardEventHandler<HTMLDivElement>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Keeps the `Escape` press that dismisses an open select menu from reaching outer
|
|
8
|
+
* dismissible surfaces. MrlModal, MrlPanel and MrlPopover close on `Escape` keydown
|
|
9
|
+
* and MrlSidebar on keyup, so without containment a single press would close the
|
|
10
|
+
* menu and the surface behind it at the same time.
|
|
11
|
+
*
|
|
12
|
+
* While the menu is open, the `Escape` keydown and its paired keyup stop propagating
|
|
13
|
+
* after react-select handles them. Once the menu is closed, `Escape` bubbles as
|
|
14
|
+
* usual so the outer surface can respond to the next press.
|
|
15
|
+
*
|
|
16
|
+
* @param menuIsOpen - the resolved react-select menu state
|
|
17
|
+
* @param onKeyDown - react-select's container keydown handler to wrap
|
|
18
|
+
* @returns key event handlers to spread into the select container's `innerProps`
|
|
19
|
+
*/
|
|
20
|
+
export declare function useMenuEscapeContainment(menuIsOpen: boolean, onKeyDown: React.KeyboardEventHandler<HTMLDivElement> | undefined): MenuEscapeContainmentHandlers;
|
|
21
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
type CreateArrayWithLengthX<LENGTH extends number, ACC extends unknown[] = []> = ACC['length'] extends LENGTH ? ACC : CreateArrayWithLengthX<LENGTH, [...ACC, 1]>;
|
|
3
2
|
type NumericRange<START_ARR extends number[], END extends number, ACC extends number = never> = START_ARR['length'] extends END ? ACC | END : NumericRange<[...START_ARR, 1], END, ACC | START_ARR['length']>;
|
|
4
3
|
export type ProgressRange = NumericRange<CreateArrayWithLengthX<0>, 100>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const ActionsCell: ((props: MrlSmartCellRendererProps) => JSX.Element) | undefined;
|
|
1
|
+
import { MrlSmartTableColumn } from './MrlSmartTable';
|
|
2
|
+
export declare const LicenseCell: MrlSmartTableColumn["renderCell"];
|
|
3
|
+
export declare const MemberSinceCell: MrlSmartTableColumn["renderCell"];
|
|
4
|
+
export declare const LastSeenCell: MrlSmartTableColumn["renderCell"];
|
|
5
|
+
export declare const CreateRoomCell: MrlSmartTableColumn["renderCell"];
|
|
6
|
+
export declare const SeeOpenRoomsCell: MrlSmartTableColumn["renderCell"];
|
|
7
|
+
export declare const PublishTemplatesCell: MrlSmartTableColumn["renderCell"];
|
|
8
|
+
export declare const WorkspaceAdminCell: MrlSmartTableColumn["renderCell"];
|
|
9
|
+
export declare const ActionsCell: MrlSmartTableColumn["renderCell"];
|
|
11
10
|
export declare const SAMPLE_COLUMNS_WITH_EDIT_ICON_BUTTON: MrlSmartTableColumn[];
|
|
@@ -19,7 +19,7 @@ export declare const sortAlphabeticallyAsCoercedStrings: (a: unknown, b: unknown
|
|
|
19
19
|
* @param {string[]} keys a set of properties to uniquely identify the element
|
|
20
20
|
* @returns {string} the generated key
|
|
21
21
|
*/
|
|
22
|
-
export declare const keyFor: (prefix: string, elementType:
|
|
22
|
+
export declare const keyFor: (prefix: string, elementType: "header" | "column" | "body" | "row" | "row-cell", ...keys: string[]) => string;
|
|
23
23
|
/**
|
|
24
24
|
* Provides sort icon based on direction.
|
|
25
25
|
*
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { extends as _extends, objectSpread2 as _objectSpread2 } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { components } from 'react-select';
|
|
4
|
+
import { useMenuEscapeContainment } from '../utils/useMenuEscapeContainment.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* MrlSelectContainer component
|
|
7
8
|
*
|
|
9
|
+
* Adds `data-qa` support and keeps the `Escape` press that dismisses an open menu
|
|
10
|
+
* from also closing an outer dismissible surface (e.g. a select inside MrlModal).
|
|
11
|
+
*
|
|
8
12
|
* @param props - the react-select container props
|
|
9
13
|
* @returns a select container
|
|
10
14
|
*/
|
|
11
15
|
function MrlSelectContainer(props) {
|
|
12
16
|
var dataQa = props.selectProps['data-qa'];
|
|
17
|
+
var escapeContainment = useMenuEscapeContainment(props.selectProps.menuIsOpen, props.innerProps.onKeyDown);
|
|
13
18
|
return /*#__PURE__*/React.createElement(components.SelectContainer, _extends({}, props, {
|
|
14
|
-
innerProps: _objectSpread2(_objectSpread2({}, props.innerProps), dataQa && {
|
|
19
|
+
innerProps: _objectSpread2(_objectSpread2(_objectSpread2({}, props.innerProps), escapeContainment), dataQa && {
|
|
15
20
|
'data-qa': "".concat(dataQa, "-container")
|
|
16
21
|
})
|
|
17
22
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MrlSelectContainer.js","sources":["../../../../../../src/components/form/select/components/MrlSelectContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { GroupBase, components, ContainerProps } from 'react-select';\n\n/**\n * MrlSelectContainer component\n *\n * @param props - the react-select container props\n * @returns a select container\n */\nexport function MrlSelectContainer<\n\tT,\n\tIsMulti extends boolean = false,\n\tGroup extends GroupBase<T> = GroupBase<T>\n>(props: ContainerProps<T, IsMulti, Group>): JSX.Element {\n\tconst dataQa = props.selectProps['data-qa'];\n\treturn (\n\t\t<components.SelectContainer\n\t\t\t{...props}\n\t\t\tinnerProps={{\n\t\t\t\t...props.innerProps,\n\t\t\t\t...(dataQa && { 'data-qa': `${dataQa}-container` })\n\t\t\t}}\n\t\t/>\n\t);\n}\n"],"names":["MrlSelectContainer","props","dataQa","selectProps","React","createElement","components","SelectContainer","_extends","
|
|
1
|
+
{"version":3,"file":"MrlSelectContainer.js","sources":["../../../../../../src/components/form/select/components/MrlSelectContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { GroupBase, components, ContainerProps } from 'react-select';\nimport { useMenuEscapeContainment } from '../utils/useMenuEscapeContainment';\n\n/**\n * MrlSelectContainer component\n *\n * Adds `data-qa` support and keeps the `Escape` press that dismisses an open menu\n * from also closing an outer dismissible surface (e.g. a select inside MrlModal).\n *\n * @param props - the react-select container props\n * @returns a select container\n */\nexport function MrlSelectContainer<\n\tT,\n\tIsMulti extends boolean = false,\n\tGroup extends GroupBase<T> = GroupBase<T>\n>(props: ContainerProps<T, IsMulti, Group>): JSX.Element {\n\tconst dataQa = props.selectProps['data-qa'];\n\tconst escapeContainment = useMenuEscapeContainment(\n\t\tprops.selectProps.menuIsOpen,\n\t\tprops.innerProps.onKeyDown\n\t);\n\n\treturn (\n\t\t<components.SelectContainer\n\t\t\t{...props}\n\t\t\tinnerProps={{\n\t\t\t\t...props.innerProps,\n\t\t\t\t...escapeContainment,\n\t\t\t\t...(dataQa && { 'data-qa': `${dataQa}-container` })\n\t\t\t}}\n\t\t/>\n\t);\n}\n"],"names":["MrlSelectContainer","props","dataQa","selectProps","escapeContainment","useMenuEscapeContainment","menuIsOpen","innerProps","onKeyDown","React","createElement","components","SelectContainer","_extends","_objectSpread","concat"],"mappings":";;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAkBA,CAIhCC,KAAwC,EAAe;AACxD,EAAA,IAAMC,MAAM,GAAGD,KAAK,CAACE,WAAW,CAAC,SAAS,CAAC;AAC3C,EAAA,IAAMC,iBAAiB,GAAGC,wBAAwB,CACjDJ,KAAK,CAACE,WAAW,CAACG,UAAU,EAC5BL,KAAK,CAACM,UAAU,CAACC,SAClB,CAAC;EAED,oBACCC,KAAA,CAAAC,aAAA,CAACC,UAAU,CAACC,eAAe,EAAAC,QAAA,CAAA,EAAA,EACtBZ,KAAK,EAAA;AACTM,IAAAA,UAAU,EAAAO,cAAA,CAAAA,cAAA,CAAAA,cAAA,CAAA,EAAA,EACNb,KAAK,CAACM,UAAU,CAAA,EAChBH,iBAAiB,CAAA,EAChBF,MAAM,IAAI;MAAE,SAAS,EAAA,EAAA,CAAAa,MAAA,CAAKb,MAAM,EAAA,YAAA;KAAc;AACjD,GAAA,CACF,CAAC;AAEJ;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Keeps the `Escape` press that dismisses an open select menu from reaching outer
|
|
5
|
+
* dismissible surfaces. MrlModal, MrlPanel and MrlPopover close on `Escape` keydown
|
|
6
|
+
* and MrlSidebar on keyup, so without containment a single press would close the
|
|
7
|
+
* menu and the surface behind it at the same time.
|
|
8
|
+
*
|
|
9
|
+
* While the menu is open, the `Escape` keydown and its paired keyup stop propagating
|
|
10
|
+
* after react-select handles them. Once the menu is closed, `Escape` bubbles as
|
|
11
|
+
* usual so the outer surface can respond to the next press.
|
|
12
|
+
*
|
|
13
|
+
* @param menuIsOpen - the resolved react-select menu state
|
|
14
|
+
* @param onKeyDown - react-select's container keydown handler to wrap
|
|
15
|
+
* @returns key event handlers to spread into the select container's `innerProps`
|
|
16
|
+
*/
|
|
17
|
+
function useMenuEscapeContainment(menuIsOpen, onKeyDown) {
|
|
18
|
+
var escapeDismissedTheMenu = React.useRef(false);
|
|
19
|
+
var handleKeyDown = event => {
|
|
20
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
21
|
+
if (event.key !== 'Escape') return;
|
|
22
|
+
escapeDismissedTheMenu.current = menuIsOpen;
|
|
23
|
+
if (menuIsOpen) event.stopPropagation();
|
|
24
|
+
};
|
|
25
|
+
var handleKeyUp = event => {
|
|
26
|
+
if (event.key !== 'Escape') return;
|
|
27
|
+
if (escapeDismissedTheMenu.current) event.stopPropagation();
|
|
28
|
+
escapeDismissedTheMenu.current = false;
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
onKeyDown: handleKeyDown,
|
|
32
|
+
onKeyUp: handleKeyUp
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { useMenuEscapeContainment };
|
|
37
|
+
//# sourceMappingURL=useMenuEscapeContainment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMenuEscapeContainment.js","sources":["../../../../../../src/components/form/select/utils/useMenuEscapeContainment.ts"],"sourcesContent":["import * as React from 'react';\n\ninterface MenuEscapeContainmentHandlers {\n\tonKeyDown: React.KeyboardEventHandler<HTMLDivElement>;\n\tonKeyUp: React.KeyboardEventHandler<HTMLDivElement>;\n}\n\n/**\n * Keeps the `Escape` press that dismisses an open select menu from reaching outer\n * dismissible surfaces. MrlModal, MrlPanel and MrlPopover close on `Escape` keydown\n * and MrlSidebar on keyup, so without containment a single press would close the\n * menu and the surface behind it at the same time.\n *\n * While the menu is open, the `Escape` keydown and its paired keyup stop propagating\n * after react-select handles them. Once the menu is closed, `Escape` bubbles as\n * usual so the outer surface can respond to the next press.\n *\n * @param menuIsOpen - the resolved react-select menu state\n * @param onKeyDown - react-select's container keydown handler to wrap\n * @returns key event handlers to spread into the select container's `innerProps`\n */\nexport function useMenuEscapeContainment(\n\tmenuIsOpen: boolean,\n\tonKeyDown: React.KeyboardEventHandler<HTMLDivElement> | undefined\n): MenuEscapeContainmentHandlers {\n\tconst escapeDismissedTheMenu = React.useRef(false);\n\n\tconst handleKeyDown: React.KeyboardEventHandler<HTMLDivElement> = (event) => {\n\t\tonKeyDown?.(event);\n\n\t\tif (event.key !== 'Escape') return;\n\n\t\tescapeDismissedTheMenu.current = menuIsOpen;\n\t\tif (menuIsOpen) event.stopPropagation();\n\t};\n\n\tconst handleKeyUp: React.KeyboardEventHandler<HTMLDivElement> = (event) => {\n\t\tif (event.key !== 'Escape') return;\n\n\t\tif (escapeDismissedTheMenu.current) event.stopPropagation();\n\t\tescapeDismissedTheMenu.current = false;\n\t};\n\n\treturn { onKeyDown: handleKeyDown, onKeyUp: handleKeyUp };\n}\n"],"names":["useMenuEscapeContainment","menuIsOpen","onKeyDown","escapeDismissedTheMenu","React","useRef","handleKeyDown","event","key","current","stopPropagation","handleKeyUp","onKeyUp"],"mappings":";;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,wBAAwBA,CACvCC,UAAmB,EACnBC,SAAiE,EACjC;AAChC,EAAA,IAAMC,sBAAsB,GAAGC,KAAK,CAACC,MAAM,CAAC,KAAK,CAAC;EAElD,IAAMC,aAAyD,GAAIC,KAAK,IAAK;AAC5EL,IAAAA,SAAS,aAATA,SAAS,KAAA,MAAA,GAAA,MAAA,GAATA,SAAS,CAAGK,KAAK,CAAC;AAElB,IAAA,IAAIA,KAAK,CAACC,GAAG,KAAK,QAAQ,EAAE;IAE5BL,sBAAsB,CAACM,OAAO,GAAGR,UAAU;AAC3C,IAAA,IAAIA,UAAU,EAAEM,KAAK,CAACG,eAAe,EAAE;EACxC,CAAC;EAED,IAAMC,WAAuD,GAAIJ,KAAK,IAAK;AAC1E,IAAA,IAAIA,KAAK,CAACC,GAAG,KAAK,QAAQ,EAAE;IAE5B,IAAIL,sBAAsB,CAACM,OAAO,EAAEF,KAAK,CAACG,eAAe,EAAE;IAC3DP,sBAAsB,CAACM,OAAO,GAAG,KAAK;EACvC,CAAC;EAED,OAAO;AAAEP,IAAAA,SAAS,EAAEI,aAAa;AAAEM,IAAAA,OAAO,EAAED;GAAa;AAC1D;;;;"}
|
package/dist/esm/components/notification/MrlBlockNotification/MrlBlockNotification.module.scss.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var styles = {"mrl-blockNotification":"mrl-blockNotification--xbhrd","mrl-blockNotification-icon":"mrl-blockNotification-icon--CAq04","mrl-blockNotification-close-wrapper":"mrl-blockNotification-close-wrapper--yODTH","cta":"cta--gnyoO","mrl-blockNotification--dismissible":"mrl-blockNotification--dismissible--ZlIID","mrl-blockNotification-
|
|
1
|
+
var styles = {"mrl-blockNotification":"mrl-blockNotification--xbhrd","mrl-blockNotification-icon":"mrl-blockNotification-icon--CAq04","mrl-blockNotification-close-wrapper":"mrl-blockNotification-close-wrapper--yODTH","cta":"cta--gnyoO","mrl-blockNotification--dismissible":"mrl-blockNotification--dismissible--ZlIID","mrl-blockNotification-heading":"mrl-blockNotification-heading--WGPWE","mrl-blockNotification-message":"mrl-blockNotification-message--MdtXZ"};
|
|
2
2
|
|
|
3
3
|
export { styles as default };
|
|
4
4
|
//# sourceMappingURL=MrlBlockNotification.module.scss.js.map
|