no-frills-ui 0.0.14-alpha.8 → 0.0.14-rc.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/README.md +3 -3
- package/dist/index.js +847 -718
- package/dist/index.js.map +1 -1
- package/lib-esm/components/Accordion/Accordion.d.ts +9 -13
- package/lib-esm/components/Accordion/Accordion.js +13 -11
- package/lib-esm/components/Accordion/Accordion.js.map +1 -1
- package/lib-esm/components/Accordion/AccordionStep.d.ts +22 -22
- package/lib-esm/components/Accordion/AccordionStep.js +34 -29
- package/lib-esm/components/Accordion/AccordionStep.js.map +1 -1
- package/lib-esm/components/Badge/Badge.d.ts +13 -16
- package/lib-esm/components/Badge/Badge.js +10 -20
- package/lib-esm/components/Badge/Badge.js.map +1 -1
- package/lib-esm/components/Button/ActionButton.d.ts +9 -5
- package/lib-esm/components/Button/ActionButton.js +18 -3
- package/lib-esm/components/Button/ActionButton.js.map +1 -1
- package/lib-esm/components/Button/Button.d.ts +9 -5
- package/lib-esm/components/Button/Button.js +17 -5
- package/lib-esm/components/Button/Button.js.map +1 -1
- package/lib-esm/components/Button/IconButton.d.ts +9 -5
- package/lib-esm/components/Button/IconButton.js +18 -3
- package/lib-esm/components/Button/IconButton.js.map +1 -1
- package/lib-esm/components/Button/LinkButton.d.ts +9 -5
- package/lib-esm/components/Button/LinkButton.js +18 -3
- package/lib-esm/components/Button/LinkButton.js.map +1 -1
- package/lib-esm/components/Button/RaisedButton.d.ts +9 -5
- package/lib-esm/components/Button/RaisedButton.js +18 -3
- package/lib-esm/components/Button/RaisedButton.js.map +1 -1
- package/lib-esm/components/Card/Card.d.ts +4 -6
- package/lib-esm/components/Card/Card.js +16 -3
- package/lib-esm/components/Card/Card.js.map +1 -1
- package/lib-esm/components/Chip/Chip.d.ts +2 -2
- package/lib-esm/components/Chip/Chip.js +14 -8
- package/lib-esm/components/Chip/Chip.js.map +1 -1
- package/lib-esm/components/ChipInput/ChipInput.d.ts +28 -39
- package/lib-esm/components/ChipInput/ChipInput.js +37 -37
- package/lib-esm/components/ChipInput/ChipInput.js.map +1 -1
- package/lib-esm/components/Dialog/AlertDialog.d.ts +11 -12
- package/lib-esm/components/Dialog/AlertDialog.js +4 -11
- package/lib-esm/components/Dialog/AlertDialog.js.map +1 -1
- package/lib-esm/components/Dialog/ConfirmDialog.d.ts +13 -14
- package/lib-esm/components/Dialog/ConfirmDialog.js +4 -12
- package/lib-esm/components/Dialog/ConfirmDialog.js.map +1 -1
- package/lib-esm/components/Dialog/Dialog.d.ts +8 -14
- package/lib-esm/components/Dialog/Dialog.js +11 -9
- package/lib-esm/components/Dialog/Dialog.js.map +1 -1
- package/lib-esm/components/Dialog/PromptDialog.d.ts +18 -19
- package/lib-esm/components/Dialog/PromptDialog.js +10 -18
- package/lib-esm/components/Dialog/PromptDialog.js.map +1 -1
- package/lib-esm/components/DragAndDrop/DragAndDrop.d.ts +37 -59
- package/lib-esm/components/DragAndDrop/DragAndDrop.js +23 -26
- package/lib-esm/components/DragAndDrop/DragAndDrop.js.map +1 -1
- package/lib-esm/components/DragAndDrop/DragItem.d.ts +2 -2
- package/lib-esm/components/DragAndDrop/DragItem.js +40 -38
- package/lib-esm/components/DragAndDrop/DragItem.js.map +1 -1
- package/lib-esm/components/DragAndDrop/types.d.ts +3 -3
- package/lib-esm/components/DragAndDrop/types.js.map +1 -1
- package/lib-esm/components/Drawer/Drawer.d.ts +24 -31
- package/lib-esm/components/Drawer/Drawer.js +49 -45
- package/lib-esm/components/Drawer/Drawer.js.map +1 -1
- package/lib-esm/components/Groups/Group.d.ts +6 -8
- package/lib-esm/components/Groups/Group.js +12 -10
- package/lib-esm/components/Groups/Group.js.map +1 -1
- package/lib-esm/components/Input/Checkbox.d.ts +12 -15
- package/lib-esm/components/Input/Checkbox.js +30 -26
- package/lib-esm/components/Input/Checkbox.js.map +1 -1
- package/lib-esm/components/Input/Dropdown.d.ts +8 -18
- package/lib-esm/components/Input/Dropdown.js +42 -17
- package/lib-esm/components/Input/Dropdown.js.map +1 -1
- package/lib-esm/components/Input/Input.d.ts +8 -3
- package/lib-esm/components/Input/Input.js +20 -19
- package/lib-esm/components/Input/Input.js.map +1 -1
- package/lib-esm/components/Input/Radio.d.ts +4 -8
- package/lib-esm/components/Input/Radio.js +16 -13
- package/lib-esm/components/Input/Radio.js.map +1 -1
- package/lib-esm/components/Input/RadioButton.d.ts +4 -8
- package/lib-esm/components/Input/RadioButton.js +15 -12
- package/lib-esm/components/Input/RadioButton.js.map +1 -1
- package/lib-esm/components/Input/Select.d.ts +6 -13
- package/lib-esm/components/Input/Select.js +21 -18
- package/lib-esm/components/Input/Select.js.map +1 -1
- package/lib-esm/components/Input/TextArea.d.ts +6 -13
- package/lib-esm/components/Input/TextArea.js +29 -24
- package/lib-esm/components/Input/TextArea.js.map +1 -1
- package/lib-esm/components/Input/Toggle.d.ts +4 -9
- package/lib-esm/components/Input/Toggle.js +12 -10
- package/lib-esm/components/Input/Toggle.js.map +1 -1
- package/lib-esm/components/Menu/Menu.d.ts +4 -14
- package/lib-esm/components/Menu/Menu.js +24 -16
- package/lib-esm/components/Menu/Menu.js.map +1 -1
- package/lib-esm/components/Menu/MenuContext.d.ts +4 -4
- package/lib-esm/components/Menu/MenuContext.js +1 -0
- package/lib-esm/components/Menu/MenuContext.js.map +1 -1
- package/lib-esm/components/Menu/MenuItem.d.ts +10 -4
- package/lib-esm/components/Menu/MenuItem.js +19 -5
- package/lib-esm/components/Menu/MenuItem.js.map +1 -1
- package/lib-esm/components/Modal/Modal.d.ts +17 -23
- package/lib-esm/components/Modal/Modal.js +37 -34
- package/lib-esm/components/Modal/Modal.js.map +1 -1
- package/lib-esm/components/Notification/Notification.d.ts +39 -34
- package/lib-esm/components/Notification/Notification.js +16 -39
- package/lib-esm/components/Notification/Notification.js.map +1 -1
- package/lib-esm/components/Notification/NotificationManager.d.ts +4 -4
- package/lib-esm/components/Notification/NotificationManager.js +18 -14
- package/lib-esm/components/Notification/NotificationManager.js.map +1 -1
- package/lib-esm/components/Notification/index.d.ts +1 -0
- package/lib-esm/components/Notification/style.d.ts +2 -3
- package/lib-esm/components/Notification/style.js +11 -11
- package/lib-esm/components/Notification/style.js.map +1 -1
- package/lib-esm/components/Popover/Popover.d.ts +21 -20
- package/lib-esm/components/Popover/Popover.js +42 -44
- package/lib-esm/components/Popover/Popover.js.map +1 -1
- package/lib-esm/components/Spinner/Spinner.d.ts +14 -15
- package/lib-esm/components/Spinner/Spinner.js +12 -13
- package/lib-esm/components/Spinner/Spinner.js.map +1 -1
- package/lib-esm/components/Stepper/Step.d.ts +15 -12
- package/lib-esm/components/Stepper/Step.js +10 -8
- package/lib-esm/components/Stepper/Step.js.map +1 -1
- package/lib-esm/components/Stepper/Stepper.d.ts +11 -17
- package/lib-esm/components/Stepper/Stepper.js +25 -23
- package/lib-esm/components/Stepper/Stepper.js.map +1 -1
- package/lib-esm/components/Tabs/Tab.d.ts +10 -16
- package/lib-esm/components/Tabs/Tab.js +0 -8
- package/lib-esm/components/Tabs/Tab.js.map +1 -1
- package/lib-esm/components/Tabs/Tabs.d.ts +11 -22
- package/lib-esm/components/Tabs/Tabs.js +39 -31
- package/lib-esm/components/Tabs/Tabs.js.map +1 -1
- package/lib-esm/components/Toast/Toast.d.ts +7 -7
- package/lib-esm/components/Toast/Toast.js +13 -12
- package/lib-esm/components/Toast/Toast.js.map +1 -1
- package/lib-esm/components/Toast/ToastStory.d.ts +21 -24
- package/lib-esm/components/Tooltip/Tooltip.d.ts +11 -14
- package/lib-esm/components/Tooltip/Tooltip.js +11 -21
- package/lib-esm/components/Tooltip/Tooltip.js.map +1 -1
- package/lib-esm/icons/CheckCircle.js +2 -2
- package/lib-esm/icons/CheckCircle.js.map +1 -1
- package/lib-esm/icons/ErrorOutline.js +2 -2
- package/lib-esm/icons/ErrorOutline.js.map +1 -1
- package/lib-esm/icons/Info.js +2 -2
- package/lib-esm/icons/Info.js.map +1 -1
- package/lib-esm/icons/ReportProblem.js +2 -2
- package/lib-esm/icons/ReportProblem.js.map +1 -1
- package/lib-esm/index.js +43 -0
- package/lib-esm/shared/LayerManager.d.ts +5 -4
- package/lib-esm/shared/LayerManager.js +111 -111
- package/lib-esm/shared/LayerManager.js.map +1 -1
- package/lib-esm/shared/styles.d.ts +1 -1
- package/lib-esm/shared/styles.js +9 -9
- package/lib-esm/shared/styles.js.map +1 -1
- package/package.json +66 -31
- package/lib-esm/components/index.js +0 -43
- /package/lib-esm/{components/index.js.map → index.js.map} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import React, { useId } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import styled from '@emotion/styled';
|
|
5
4
|
import { getThemeValue, THEME_NAME } from '../../shared/constants.js';
|
|
6
5
|
|
|
@@ -44,15 +43,19 @@ const positionHoverStyle = {
|
|
|
44
43
|
`
|
|
45
44
|
};
|
|
46
45
|
const TooltipDiv = /*#__PURE__*/ styled("div", {
|
|
47
|
-
target: "
|
|
46
|
+
target: "e1dfj1r70",
|
|
48
47
|
label: "TooltipDiv"
|
|
49
48
|
})("position:absolute;background-color:", getThemeValue(THEME_NAME.TOOLTIP_COLOR), ";padding:5px;color:", getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT), ";border-radius:3px;transition:transform 0.3s ease;font-size:12px;z-index:1;", (props)=>positionStyle[props.position]);
|
|
50
49
|
const TooltipContainer = /*#__PURE__*/ styled("div", {
|
|
51
|
-
target: "
|
|
50
|
+
target: "e1dfj1r71",
|
|
52
51
|
label: "TooltipContainer"
|
|
53
52
|
})("position:relative;display:inline-flex;justify-content:center;align-items:center;&:hover ", TooltipDiv, ",&:focus-within ", TooltipDiv, "{", (props)=>positionHoverStyle[props.position], "}");
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Tooltip Component
|
|
55
|
+
* @param props - Component props
|
|
56
|
+
* @param ref - Ref forwarded to the underlying HTMLDivElement
|
|
57
|
+
*/ function TooltipComponent(props, ref) {
|
|
58
|
+
const { children, position = "BOTTOM", ...rest } = props;
|
|
56
59
|
const tooltipId = useId();
|
|
57
60
|
// Clone the child to inject aria-describedby and tabIndex if possible
|
|
58
61
|
const trigger = /*#__PURE__*/ React.isValidElement(children) ? /*#__PURE__*/ React.cloneElement(children, {
|
|
@@ -60,8 +63,9 @@ function Tooltip(props) {
|
|
|
60
63
|
tabIndex: children.props && typeof children.props.tabIndex !== 'undefined' ? children.props.tabIndex : 0
|
|
61
64
|
}) : children;
|
|
62
65
|
return /*#__PURE__*/ jsxs(TooltipContainer, {
|
|
63
|
-
position: position,
|
|
64
66
|
...rest,
|
|
67
|
+
ref: ref,
|
|
68
|
+
position: position,
|
|
65
69
|
children: [
|
|
66
70
|
trigger,
|
|
67
71
|
/*#__PURE__*/ jsx(TooltipDiv, {
|
|
@@ -74,21 +78,7 @@ function Tooltip(props) {
|
|
|
74
78
|
]
|
|
75
79
|
});
|
|
76
80
|
}
|
|
77
|
-
Tooltip
|
|
78
|
-
/** Text to show in the tooltip */ tooltipText: PropTypes.oneOfType([
|
|
79
|
-
PropTypes.string,
|
|
80
|
-
PropTypes.node
|
|
81
|
-
]).isRequired,
|
|
82
|
-
/** Position of the tooltip */ position: PropTypes.oneOf([
|
|
83
|
-
"TOP",
|
|
84
|
-
"LEFT",
|
|
85
|
-
"RIGHT",
|
|
86
|
-
"BOTTOM"
|
|
87
|
-
])
|
|
88
|
-
};
|
|
89
|
-
Tooltip.defaultProps = {
|
|
90
|
-
position: "BOTTOM"
|
|
91
|
-
};
|
|
81
|
+
const Tooltip = /*#__PURE__*/ React.forwardRef(TooltipComponent);
|
|
92
82
|
|
|
93
83
|
export { TOOLTIP_POSITION, Tooltip as default };
|
|
94
84
|
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import React, { useId } from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import React, { useId } from 'react';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nexport enum TOOLTIP_POSITION {\n TOP = 'TOP',\n BOTTOM = 'BOTTOM',\n LEFT = 'LEFT',\n RIGHT = 'RIGHT',\n}\n\nconst positionStyle = {\n [TOOLTIP_POSITION.LEFT]: `\n left: 0;\n transform: translateX(-50%) scale(0);\n `,\n [TOOLTIP_POSITION.RIGHT]: `\n right: 0;\n transform: translateX(50%) scale(0);\n `,\n [TOOLTIP_POSITION.TOP]: `\n top: 0;\n transform: translateY(-10px) scale(0);\n `,\n [TOOLTIP_POSITION.BOTTOM]: `\n bottom: 0;\n transform: translateY(10px) scale(0);\n `,\n};\n\nconst positionHoverStyle = {\n [TOOLTIP_POSITION.LEFT]: `\n transform: translateX(-100%) scale(1);\n `,\n [TOOLTIP_POSITION.RIGHT]: `\n transform: translateX(100%) scale(1);\n `,\n [TOOLTIP_POSITION.TOP]: `\n transform: translateY(-25px) scale(1);\n `,\n [TOOLTIP_POSITION.BOTTOM]: `\n transform: translateY(25px) scale(1);\n `,\n};\n\nconst TooltipDiv = styled.div<{ position: TOOLTIP_POSITION }>`\n position: absolute;\n background-color: ${getThemeValue(THEME_NAME.TOOLTIP_COLOR)};\n padding: 5px;\n color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};\n border-radius: 3px;\n transition: transform 0.3s ease;\n font-size: 12px;\n z-index: 1;\n ${(props) => positionStyle[props.position]}\n`;\n\nconst TooltipContainer = styled.div<{ position: TOOLTIP_POSITION }>`\n position: relative;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n\n &:hover ${TooltipDiv}, &:focus-within ${TooltipDiv} {\n ${(props) => positionHoverStyle[props.position]}\n }\n`;\n\ntype TooltipProps = React.PropsWithChildren<{\n /** Text to show in the tooltip */\n tooltipText: string | React.ReactNode;\n /**\n * Position of the tooltip\n * @default TOOLTIP_POSITION.BOTTOM\n */\n position?: TOOLTIP_POSITION;\n}> &\n React.HTMLAttributes<HTMLDivElement>;\n\n/**\n * Tooltip Component\n * @param props - Component props\n * @param ref - Ref forwarded to the underlying HTMLDivElement\n */\nfunction TooltipComponent(props: TooltipProps, ref: React.Ref<HTMLDivElement>) {\n const { children, position = TOOLTIP_POSITION.BOTTOM, ...rest } = props;\n const tooltipId = useId();\n\n // Clone the child to inject aria-describedby and tabIndex if possible\n const trigger = React.isValidElement(children)\n ? React.cloneElement(\n children as React.ReactElement<{ tabIndex?: number; 'aria-describedby'?: string }>,\n {\n 'aria-describedby': tooltipId,\n tabIndex:\n (\n children as React.ReactElement<{\n tabIndex?: number;\n 'aria-describedby'?: string;\n }>\n ).props &&\n typeof (\n children as React.ReactElement<{\n tabIndex?: number;\n 'aria-describedby'?: string;\n }>\n ).props.tabIndex !== 'undefined'\n ? (\n children as React.ReactElement<{\n tabIndex?: number;\n 'aria-describedby'?: string;\n }>\n ).props.tabIndex\n : 0,\n },\n )\n : children;\n\n return (\n <TooltipContainer {...rest} ref={ref} position={position}>\n {trigger}\n <TooltipDiv id={tooltipId} aria-hidden=\"true\" role=\"tooltip\" position={position}>\n {rest.tooltipText as React.ReactNode}\n </TooltipDiv>\n </TooltipContainer>\n );\n}\n\nconst Tooltip = React.forwardRef<HTMLDivElement, TooltipProps>(TooltipComponent);\nexport default Tooltip;\n"],"names":["TOOLTIP_POSITION","positionStyle","positionHoverStyle","TooltipDiv","styled","getThemeValue","THEME_NAME","TOOLTIP_COLOR","TEXT_COLOR_LIGHT","props","position","TooltipContainer","TooltipComponent","ref","children","rest","tooltipId","useId","trigger","React","isValidElement","cloneElement","tabIndex","_jsxs","_jsx","id","aria-hidden","role","tooltipText","Tooltip","forwardRef"],"mappings":";;;;;AAIO,IAAA,gBAAKA,iBAAAA,SAAAA,gBAAAA,EAAAA;;;;;AAAAA,IAAAA,OAAAA,gBAAAA;AAKX,CAAA,CAAA,EAAA;AAED,MAAMC,aAAAA,GAAgB;AAClB,IAAA,CAAA,MAAA,GAAyB;;;IAGzB,CAAC;AACD,IAAA,CAAA,OAAA,GAA0B;;;IAG1B,CAAC;AACD,IAAA,CAAA,KAAA,GAAwB;;;IAGxB,CAAC;AACD,IAAA,CAAA,QAAA,GAA2B;;;IAG3B;AACJ,CAAA;AAEA,MAAMC,kBAAAA,GAAqB;AACvB,IAAA,CAAA,MAAA,GAAyB;;IAEzB,CAAC;AACD,IAAA,CAAA,OAAA,GAA0B;;IAE1B,CAAC;AACD,IAAA,CAAA,KAAA,GAAwB;;IAExB,CAAC;AACD,IAAA,CAAA,QAAA,GAA2B;;IAE3B;AACJ,CAAA;AAEA,MAAMC,UAAAA,iBAAaC,MAAAA,CAAAA,KAAAA,EAAAA;;;AAEKC,CAAAA,CAAAA,CAAAA,qCAAAA,EAAAA,aAAAA,CAAcC,UAAAA,CAAWC,aAAa,CAAA,EAAA,qBAAA,EAEjDF,aAAAA,CAAcC,UAAAA,CAAWE,gBAAgB,CAAA,EAAA,6EAAA,EAKhD,CAACC,KAAAA,GAAUR,aAAa,CAACQ,KAAAA,CAAMC,QAAQ,CAAC,CAAA;AAG9C,MAAMC,gBAAAA,iBAAmBP,MAAAA,CAAAA,KAAAA,EAAAA;;;AAMXD,CAAAA,CAAAA,CAAAA,0FAAAA,EAAAA,UAAAA,EAAAA,kBAAAA,EAA8BA,iBAClC,CAACM,KAAAA,GAAUP,kBAAkB,CAACO,KAAAA,CAAMC,QAAQ,CAAC,EAAA,GAAA,CAAA;AAevD;;;;AAIC,IACD,SAASE,gBAAAA,CAAiBH,KAAmB,EAAEI,GAA8B,EAAA;AACzE,IAAA,MAAM,EAAEC,QAAQ,EAAEJ,mBAAkC,EAAE,GAAGK,MAAM,GAAGN,KAAAA;AAClE,IAAA,MAAMO,SAAAA,GAAYC,KAAAA,EAAAA;;IAGlB,MAAMC,OAAAA,iBAAUC,MAAMC,cAAc,CAACN,0BAC/BK,KAAAA,CAAME,YAAY,CACdP,QAAAA,EACA;QACI,kBAAA,EAAoBE,SAAAA;AACpBM,QAAAA,QAAAA,EACI,QACIR,CAIFL,KAAK,IACP,OAAO,QACHK,CAIFL,KAAK,CAACa,QAAQ,KAAK,WAAA,GAEXR,SAIFL,KAAK,CAACa,QAAQ,GAChB;KACd,CAAA,GAEJR,QAAAA;AAEN,IAAA,qBACIS,IAAA,CAACZ,gBAAAA,EAAAA;AAAkB,QAAA,GAAGI,IAAI;QAAEF,GAAAA,EAAKA,GAAAA;QAAKH,QAAAA,EAAUA,QAAAA;;AAC3CQ,YAAAA,OAAAA;0BACDM,GAAA,CAACrB,UAAAA,EAAAA;gBAAWsB,EAAAA,EAAIT,SAAAA;gBAAWU,aAAAA,EAAY,MAAA;gBAAOC,IAAAA,EAAK,SAAA;gBAAUjB,QAAAA,EAAUA,QAAAA;AAClEK,gBAAAA,QAAAA,EAAAA,IAAAA,CAAKa;;;;AAItB;AAEA,MAAMC,OAAAA,iBAAUV,KAAAA,CAAMW,UAAU,CAA+BlB,gBAAAA;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
function CheckCircle(props) {
|
|
3
|
+
function CheckCircle$4(props) {
|
|
4
4
|
return /*#__PURE__*/ jsxs("svg", {
|
|
5
5
|
height: "24",
|
|
6
6
|
viewBox: "0 0 24 24",
|
|
@@ -19,5 +19,5 @@ function CheckCircle(props) {
|
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export { CheckCircle as default };
|
|
22
|
+
export { CheckCircle$4 as default };
|
|
23
23
|
//# sourceMappingURL=CheckCircle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckCircle.js","sources":["../../src/icons/CheckCircle.tsx"],"sourcesContent":["export default function CheckCircle(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" fill=\"currentColor\" {...props}>\n <path d=\"M0 0h24v24H0V0zm0 0h24v24H0V0z\" fill=\"none\" />\n <path d=\"M16.59 7.58L10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z\" />\n </svg>\n );\n}\n"],"names":["CheckCircle","props","_jsxs","svg","height","viewBox","width","fill","_jsx","path","d"],"mappings":";;AAAe,SAASA,
|
|
1
|
+
{"version":3,"file":"CheckCircle.js","sources":["../../src/icons/CheckCircle.tsx"],"sourcesContent":["export default function CheckCircle(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" fill=\"currentColor\" {...props}>\n <path d=\"M0 0h24v24H0V0zm0 0h24v24H0V0z\" fill=\"none\" />\n <path d=\"M16.59 7.58L10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z\" />\n </svg>\n );\n}\n"],"names":["CheckCircle","props","_jsxs","svg","height","viewBox","width","fill","_jsx","path","d"],"mappings":";;AAAe,SAASA,cAAYC,KAAoC,EAAA;AACpE,IAAA,qBACIC,IAAA,CAACC,KAAAA,EAAAA;QAAIC,MAAAA,EAAO,IAAA;QAAKC,OAAAA,EAAQ,WAAA;QAAYC,KAAAA,EAAM,IAAA;QAAKC,IAAAA,EAAK,cAAA;AAAgB,QAAA,GAAGN,KAAK;;0BACzEO,GAAA,CAACC,MAAAA,EAAAA;gBAAKC,CAAAA,EAAE,gCAAA;gBAAiCH,IAAAA,EAAK;;0BAC9CC,GAAA,CAACC,MAAAA,EAAAA;gBAAKC,CAAAA,EAAE;;;;AAGpB;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
function CheckCircle(props) {
|
|
3
|
+
function CheckCircle$1(props) {
|
|
4
4
|
return /*#__PURE__*/ jsx("svg", {
|
|
5
5
|
height: "24",
|
|
6
6
|
viewBox: "0 0 24 24",
|
|
@@ -13,5 +13,5 @@ function CheckCircle(props) {
|
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export { CheckCircle as default };
|
|
16
|
+
export { CheckCircle$1 as default };
|
|
17
17
|
//# sourceMappingURL=ErrorOutline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorOutline.js","sources":["../../src/icons/ErrorOutline.tsx"],"sourcesContent":["export default function CheckCircle(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" fill=\"currentColor\" {...props}>\n <path d=\"M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z\" />\n </svg>\n );\n}\n"],"names":["CheckCircle","props","_jsx","svg","height","viewBox","width","fill","path","d"],"mappings":";;AAAe,SAASA,
|
|
1
|
+
{"version":3,"file":"ErrorOutline.js","sources":["../../src/icons/ErrorOutline.tsx"],"sourcesContent":["export default function CheckCircle(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" fill=\"currentColor\" {...props}>\n <path d=\"M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z\" />\n </svg>\n );\n}\n"],"names":["CheckCircle","props","_jsx","svg","height","viewBox","width","fill","path","d"],"mappings":";;AAAe,SAASA,cAAYC,KAAoC,EAAA;AACpE,IAAA,qBACIC,GAAA,CAACC,KAAAA,EAAAA;QAAIC,MAAAA,EAAO,IAAA;QAAKC,OAAAA,EAAQ,WAAA;QAAYC,KAAAA,EAAM,IAAA;QAAKC,IAAAA,EAAK,cAAA;AAAgB,QAAA,GAAGN,KAAK;AACzE,QAAA,QAAA,gBAAAC,GAAA,CAACM,MAAAA,EAAAA;YAAKC,CAAAA,EAAE;;;AAGpB;;;;"}
|
package/lib-esm/icons/Info.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
function CheckCircle(props) {
|
|
3
|
+
function CheckCircle$3(props) {
|
|
4
4
|
return /*#__PURE__*/ jsxs("svg", {
|
|
5
5
|
height: "24",
|
|
6
6
|
viewBox: "0 0 24 24",
|
|
@@ -19,5 +19,5 @@ function CheckCircle(props) {
|
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export { CheckCircle as default };
|
|
22
|
+
export { CheckCircle$3 as default };
|
|
23
23
|
//# sourceMappingURL=Info.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Info.js","sources":["../../src/icons/Info.tsx"],"sourcesContent":["export default function CheckCircle(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" fill=\"currentColor\" {...props}>\n <path d=\"M0 0h24v24H0V0z\" fill=\"none\" />\n <path d=\"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z\" />\n </svg>\n );\n}\n"],"names":["CheckCircle","props","_jsxs","svg","height","viewBox","width","fill","_jsx","path","d"],"mappings":";;AAAe,SAASA,
|
|
1
|
+
{"version":3,"file":"Info.js","sources":["../../src/icons/Info.tsx"],"sourcesContent":["export default function CheckCircle(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" fill=\"currentColor\" {...props}>\n <path d=\"M0 0h24v24H0V0z\" fill=\"none\" />\n <path d=\"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z\" />\n </svg>\n );\n}\n"],"names":["CheckCircle","props","_jsxs","svg","height","viewBox","width","fill","_jsx","path","d"],"mappings":";;AAAe,SAASA,cAAYC,KAAoC,EAAA;AACpE,IAAA,qBACIC,IAAA,CAACC,KAAAA,EAAAA;QAAIC,MAAAA,EAAO,IAAA;QAAKC,OAAAA,EAAQ,WAAA;QAAYC,KAAAA,EAAM,IAAA;QAAKC,IAAAA,EAAK,cAAA;AAAgB,QAAA,GAAGN,KAAK;;0BACzEO,GAAA,CAACC,MAAAA,EAAAA;gBAAKC,CAAAA,EAAE,iBAAA;gBAAkBH,IAAAA,EAAK;;0BAC/BC,GAAA,CAACC,MAAAA,EAAAA;gBAAKC,CAAAA,EAAE;;;;AAGpB;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
function CheckCircle(props) {
|
|
3
|
+
function CheckCircle$2(props) {
|
|
4
4
|
return /*#__PURE__*/ jsxs("svg", {
|
|
5
5
|
height: "24",
|
|
6
6
|
viewBox: "0 0 24 24",
|
|
@@ -19,5 +19,5 @@ function CheckCircle(props) {
|
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export { CheckCircle as default };
|
|
22
|
+
export { CheckCircle$2 as default };
|
|
23
23
|
//# sourceMappingURL=ReportProblem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReportProblem.js","sources":["../../src/icons/ReportProblem.tsx"],"sourcesContent":["export default function CheckCircle(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" fill=\"currentColor\" {...props}>\n <path d=\"M0 0h24v24H0V0z\" fill=\"none\" />\n <path d=\"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z\" />\n </svg>\n );\n}\n"],"names":["CheckCircle","props","_jsxs","svg","height","viewBox","width","fill","_jsx","path","d"],"mappings":";;AAAe,SAASA,
|
|
1
|
+
{"version":3,"file":"ReportProblem.js","sources":["../../src/icons/ReportProblem.tsx"],"sourcesContent":["export default function CheckCircle(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\" fill=\"currentColor\" {...props}>\n <path d=\"M0 0h24v24H0V0z\" fill=\"none\" />\n <path d=\"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z\" />\n </svg>\n );\n}\n"],"names":["CheckCircle","props","_jsxs","svg","height","viewBox","width","fill","_jsx","path","d"],"mappings":";;AAAe,SAASA,cAAYC,KAAoC,EAAA;AACpE,IAAA,qBACIC,IAAA,CAACC,KAAAA,EAAAA;QAAIC,MAAAA,EAAO,IAAA;QAAKC,OAAAA,EAAQ,WAAA;QAAYC,KAAAA,EAAM,IAAA;QAAKC,IAAAA,EAAK,cAAA;AAAgB,QAAA,GAAGN,KAAK;;0BACzEO,GAAA,CAACC,MAAAA,EAAAA;gBAAKC,CAAAA,EAAE,iBAAA;gBAAkBH,IAAAA,EAAK;;0BAC/BC,GAAA,CAACC,MAAAA,EAAAA;gBAAKC,CAAAA,EAAE;;;;AAGpB;;;;"}
|
package/lib-esm/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export { default as Accordion } from './components/Accordion/Accordion.js';
|
|
2
|
+
export { default as AccordionStep, AccordionStepBody, AccordionStepFooter } from './components/Accordion/AccordionStep.js';
|
|
3
|
+
export { BADGE_TYPE, default as Badge } from './components/Badge/Badge.js';
|
|
4
|
+
export { default as Button } from './components/Button/Button.js';
|
|
5
|
+
export { default as LinkButton } from './components/Button/LinkButton.js';
|
|
6
|
+
export { default as RaisedButton } from './components/Button/RaisedButton.js';
|
|
7
|
+
export { default as ActionButton } from './components/Button/ActionButton.js';
|
|
8
|
+
export { default as IconButton } from './components/Button/IconButton.js';
|
|
9
|
+
export { default as Card } from './components/Card/Card.js';
|
|
10
|
+
export { default as Chip } from './components/Chip/Chip.js';
|
|
11
|
+
export { default as ChipInput } from './components/ChipInput/ChipInput.js';
|
|
12
|
+
export { default as Dialog } from './components/Dialog/Dialog.js';
|
|
13
|
+
export { default as DragAndDrop } from './components/DragAndDrop/DragAndDrop.js';
|
|
14
|
+
export { default as Group } from './components/Groups/Group.js';
|
|
15
|
+
export { default as Input } from './components/Input/Input.js';
|
|
16
|
+
export { default as TextArea } from './components/Input/TextArea.js';
|
|
17
|
+
export { default as Select } from './components/Input/Select.js';
|
|
18
|
+
export { default as Checkbox } from './components/Input/Checkbox.js';
|
|
19
|
+
export { default as Toggle } from './components/Input/Toggle.js';
|
|
20
|
+
export { default as Radio } from './components/Input/Radio.js';
|
|
21
|
+
export { default as RadioButton, RadioGroup } from './components/Input/RadioButton.js';
|
|
22
|
+
export { default as Dropdown } from './components/Input/Dropdown.js';
|
|
23
|
+
export { default as Menu } from './components/Menu/Menu.js';
|
|
24
|
+
export { default as MenuItem } from './components/Menu/MenuItem.js';
|
|
25
|
+
export { POPOVER_POSITION, default as Popover } from './components/Popover/Popover.js';
|
|
26
|
+
export { default as Spinner } from './components/Spinner/Spinner.js';
|
|
27
|
+
export { default as Stepper } from './components/Stepper/Stepper.js';
|
|
28
|
+
export { default as Step } from './components/Stepper/Step.js';
|
|
29
|
+
export { default as Tabs } from './components/Tabs/Tabs.js';
|
|
30
|
+
export { default as Tab } from './components/Tabs/Tab.js';
|
|
31
|
+
export { TOOLTIP_POSITION, default as Tooltip } from './components/Tooltip/Tooltip.js';
|
|
32
|
+
export { Body as CardBody, Footer as CardFooter, Header as CardHeader, Body as DialogBody, Footer as DialogFooter, Header as DialogHeader, Body as DrawerBody, Footer as DrawerFooter, Header as DrawerHeader, Body as ModalBody, Footer as ModalFooter, Header as ModalHeader, Body as StepBody, Footer as StepFooter } from './shared/styles.js';
|
|
33
|
+
export { default as AlertDialog } from './components/Dialog/AlertDialog.js';
|
|
34
|
+
export { default as ConfirmDialog } from './components/Dialog/ConfirmDialog.js';
|
|
35
|
+
export { default as PromptDialog } from './components/Dialog/PromptDialog.js';
|
|
36
|
+
export { ORIENTATION } from './components/DragAndDrop/types.js';
|
|
37
|
+
export { DRAWER_POSITION, default as Drawer } from './components/Drawer/Drawer.js';
|
|
38
|
+
export { default as GroupLabel } from './components/Groups/GroupLabel.js';
|
|
39
|
+
export { default as Modal } from './components/Modal/Modal.js';
|
|
40
|
+
export { default as Notification } from './components/Notification/Notification.js';
|
|
41
|
+
export { NOTIFICATION_POSITION, NOTIFICATION_TYPE } from './components/Notification/types.js';
|
|
42
|
+
export { TOAST_TYPE, default as Toast } from './components/Toast/Toast.js';
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
2
|
/** Enums for layer position on screen. */
|
|
3
3
|
export declare enum LAYER_POSITION {
|
|
4
4
|
TOP_LEFT = 0,
|
|
@@ -13,7 +13,7 @@ interface LayerConfig {
|
|
|
13
13
|
/** Show an overlay */
|
|
14
14
|
overlay?: boolean;
|
|
15
15
|
/** Element to render inside the layer. */
|
|
16
|
-
component: JSX.Element;
|
|
16
|
+
component: React.JSX.Element | null;
|
|
17
17
|
/** Position of the layer */
|
|
18
18
|
position?: LAYER_POSITION;
|
|
19
19
|
/** Delay for exit */
|
|
@@ -23,7 +23,7 @@ interface LayerConfig {
|
|
|
23
23
|
/** Close layer overlay is clicked. */
|
|
24
24
|
closeOnOverlayClick?: boolean;
|
|
25
25
|
/** Callback called when modal closes */
|
|
26
|
-
closeCallback?:
|
|
26
|
+
closeCallback?: (resp?: unknown) => void;
|
|
27
27
|
/** Layer is created with max z-index */
|
|
28
28
|
alwaysOnTop?: boolean;
|
|
29
29
|
}
|
|
@@ -86,11 +86,12 @@ declare class LayerManager {
|
|
|
86
86
|
* @param layer
|
|
87
87
|
*/
|
|
88
88
|
private unmount;
|
|
89
|
+
private Empty;
|
|
89
90
|
/**
|
|
90
91
|
* Renders a layer.
|
|
91
92
|
* @param config
|
|
92
93
|
*/
|
|
93
|
-
renderLayer: (config: LayerConfig) => [
|
|
94
|
+
renderLayer: (config: LayerConfig) => [ForwardRefExoticComponent<RefAttributes<HTMLDivElement>>, (resp?: unknown) => void];
|
|
94
95
|
}
|
|
95
96
|
declare const _default: LayerManager;
|
|
96
97
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import React, { useEffect } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
4
|
import styled from '@emotion/styled';
|
|
5
5
|
import { getThemeValue, THEME_NAME } from './constants.js';
|
|
6
6
|
|
|
@@ -32,8 +32,8 @@ import { getThemeValue, THEME_NAME } from './constants.js';
|
|
|
32
32
|
[5]: 'bottom: 0; right: 0; justify-content: flex-end;',
|
|
33
33
|
[6]: 'top: 0; left: 0; justify-content: center; align-items: center;'
|
|
34
34
|
};
|
|
35
|
-
/** Layer container component. */ const Container = /*#__PURE__*/ styled("div", {
|
|
36
|
-
target: "
|
|
35
|
+
/** Layer container component. */ const Container$5 = /*#__PURE__*/ styled("div", {
|
|
36
|
+
target: "e1at2bda0",
|
|
37
37
|
label: "Container"
|
|
38
38
|
})("position:fixed;display:flex;opacity:0;transition:opacity 0.3s ease;", (props)=>POSITION_STYLE[props.position], " ", (props)=>props.overlay && `
|
|
39
39
|
width: 100%;
|
|
@@ -44,7 +44,7 @@ import { getThemeValue, THEME_NAME } from './constants.js';
|
|
|
44
44
|
`, " z-index:", (props)=>props.zIndex, ";.nf-layer-enter &{opacity:1;", (props)=>props.overlay && `
|
|
45
45
|
backdrop-filter: blur(3px);
|
|
46
46
|
`, "}");
|
|
47
|
-
/** Key code for different keys. */ const KEY_CODES = {
|
|
47
|
+
/** Key code for different keys. */ const KEY_CODES$1 = {
|
|
48
48
|
ESC: 27
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
@@ -82,13 +82,13 @@ import { getThemeValue, THEME_NAME } from './constants.js';
|
|
|
82
82
|
* const { LayerComponent } = this.state;
|
|
83
83
|
* return LayerComponent ? <LayerComponent /> : null;
|
|
84
84
|
* }
|
|
85
|
-
*/ class LayerManager {
|
|
85
|
+
*/ let LayerManager$1 = class LayerManager {
|
|
86
86
|
/**
|
|
87
87
|
* Constructor simply registers a event listener on body to
|
|
88
88
|
* react to esc key press.
|
|
89
89
|
*/ constructor(){
|
|
90
90
|
/** Layer stack */ this.layers = [];
|
|
91
|
-
/** z-index of the next layer */ this.nextIndex =
|
|
91
|
+
/** z-index of the next layer */ this.nextIndex = 0;
|
|
92
92
|
this.timeoutIds = new Map(); // Track timeouts
|
|
93
93
|
// Add cleanup method
|
|
94
94
|
this.destroy = ()=>{
|
|
@@ -124,14 +124,21 @@ import { getThemeValue, THEME_NAME } from './constants.js';
|
|
|
124
124
|
this.timeoutIds.delete(layer.id);
|
|
125
125
|
try {
|
|
126
126
|
layer.config.closeCallback?.(resp);
|
|
127
|
-
} catch (
|
|
128
|
-
|
|
127
|
+
} catch (err) {
|
|
128
|
+
if (err instanceof Error) {
|
|
129
|
+
console.warn(err.message);
|
|
130
|
+
} else {
|
|
131
|
+
console.warn(err);
|
|
132
|
+
}
|
|
129
133
|
}
|
|
130
134
|
// Clear reference to help GC
|
|
131
135
|
layer.config.component = null;
|
|
132
136
|
}, layer.config.exitDelay);
|
|
133
137
|
this.timeoutIds.set(layer.id, timeoutId);
|
|
134
138
|
};
|
|
139
|
+
this.Empty = ()=>{
|
|
140
|
+
return null;
|
|
141
|
+
};
|
|
135
142
|
/**
|
|
136
143
|
* Renders a layer.
|
|
137
144
|
* @param config
|
|
@@ -139,7 +146,7 @@ import { getThemeValue, THEME_NAME } from './constants.js';
|
|
|
139
146
|
// SSR guard
|
|
140
147
|
if (typeof document === 'undefined') {
|
|
141
148
|
return [
|
|
142
|
-
()
|
|
149
|
+
/*#__PURE__*/ React.forwardRef(this.Empty),
|
|
143
150
|
()=>{}
|
|
144
151
|
];
|
|
145
152
|
}
|
|
@@ -149,10 +156,12 @@ import { getThemeValue, THEME_NAME } from './constants.js';
|
|
|
149
156
|
...config
|
|
150
157
|
};
|
|
151
158
|
// Get the z-index for the new layer
|
|
152
|
-
const currentIndex = layerConfig.alwaysOnTop ? 2147483647 : this.nextIndex
|
|
159
|
+
const currentIndex = layerConfig.alwaysOnTop ? 2147483647 : 10000 + this.nextIndex;
|
|
153
160
|
const className = layerConfig.alwaysOnTop ? 'nf-layer-manager-top' : 'nf-layer-manager';
|
|
154
161
|
// Create a unique ID for tracking this layer
|
|
155
|
-
const layerId =
|
|
162
|
+
const layerId = `${className}-${currentIndex + this.nextIndex}`;
|
|
163
|
+
// Always increment for next layer
|
|
164
|
+
this.nextIndex += 1;
|
|
156
165
|
const overlayClickHandler = ()=>{
|
|
157
166
|
const layer = this.layers.find((l)=>l.id === layerId);
|
|
158
167
|
if (layer && layer.config.closeOnOverlayClick !== false) {
|
|
@@ -165,112 +174,103 @@ import { getThemeValue, THEME_NAME } from './constants.js';
|
|
|
165
174
|
this.unmount(layer, resp);
|
|
166
175
|
}
|
|
167
176
|
};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
()=>{
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
modifiedElements.push({
|
|
209
|
-
element: child,
|
|
210
|
-
hadAriaHidden,
|
|
211
|
-
previousValue
|
|
212
|
-
});
|
|
213
|
-
}
|
|
177
|
+
const LayerContainer = (props, ref)=>{
|
|
178
|
+
const [divElement, setDivElement] = React.useState(null);
|
|
179
|
+
useEffect(()=>{
|
|
180
|
+
// Create the div element only once when component mounts
|
|
181
|
+
const div = document.createElement('div');
|
|
182
|
+
div.setAttribute('class', className);
|
|
183
|
+
div.setAttribute('id', layerId);
|
|
184
|
+
document.body.appendChild(div);
|
|
185
|
+
// Add layer to stack
|
|
186
|
+
const currentLayer = {
|
|
187
|
+
id: layerId,
|
|
188
|
+
config: layerConfig,
|
|
189
|
+
element: div
|
|
190
|
+
};
|
|
191
|
+
this.layers.push(currentLayer);
|
|
192
|
+
setDivElement(div);
|
|
193
|
+
// Add entry animation class after a short delay
|
|
194
|
+
setTimeout(()=>{
|
|
195
|
+
div.setAttribute('class', 'nf-layer-enter');
|
|
196
|
+
}, 10);
|
|
197
|
+
// Track elements modified for accessibility
|
|
198
|
+
const modifiedElements = [];
|
|
199
|
+
let originalBodyOverflow = null;
|
|
200
|
+
let scrollY = 0;
|
|
201
|
+
// Apply aria-hidden to siblings and body scroll lock for overlay modals
|
|
202
|
+
if (layerConfig.overlay) {
|
|
203
|
+
// Hide all body children except this layer portal, scripts, and styles
|
|
204
|
+
const bodyChildren = Array.from(document.body.children);
|
|
205
|
+
bodyChildren.forEach((child)=>{
|
|
206
|
+
if (child !== div && child.className !== 'nf-layer-manager-top' && child.tagName !== 'SCRIPT' && child.tagName !== 'STYLE') {
|
|
207
|
+
const hadAriaHidden = child.hasAttribute('aria-hidden');
|
|
208
|
+
const previousValue = child.getAttribute('aria-hidden');
|
|
209
|
+
// Only set aria-hidden if not already hidden
|
|
210
|
+
if (previousValue !== 'true') {
|
|
211
|
+
child.setAttribute('aria-hidden', 'true');
|
|
212
|
+
modifiedElements.push({
|
|
213
|
+
element: child,
|
|
214
|
+
hadAriaHidden,
|
|
215
|
+
previousValue
|
|
216
|
+
});
|
|
214
217
|
}
|
|
215
|
-
});
|
|
216
|
-
// Prevent body scroll on iOS
|
|
217
|
-
scrollY = window.scrollY;
|
|
218
|
-
originalBodyOverflow = document.body.style.overflow;
|
|
219
|
-
originalBodyPosition = document.body.style.position;
|
|
220
|
-
originalBodyWidth = document.body.style.width;
|
|
221
|
-
originalBodyTop = document.body.style.top;
|
|
222
|
-
document.body.style.overflow = 'hidden';
|
|
223
|
-
document.body.style.position = 'fixed';
|
|
224
|
-
document.body.style.width = '100%';
|
|
225
|
-
document.body.style.top = `-${scrollY}px`;
|
|
226
|
-
}
|
|
227
|
-
// Cleanup function - remove div when component unmounts
|
|
228
|
-
return ()=>{
|
|
229
|
-
// Restore aria-hidden attributes
|
|
230
|
-
modifiedElements.forEach(({ element, hadAriaHidden, previousValue })=>{
|
|
231
|
-
if (document.body.contains(element)) {
|
|
232
|
-
if (hadAriaHidden && previousValue !== null) {
|
|
233
|
-
element.setAttribute('aria-hidden', previousValue);
|
|
234
|
-
} else {
|
|
235
|
-
element.removeAttribute('aria-hidden');
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
// Restore body scroll
|
|
240
|
-
if (layerConfig.overlay) {
|
|
241
|
-
document.body.style.overflow = originalBodyOverflow || '';
|
|
242
|
-
document.body.style.position = originalBodyPosition || '';
|
|
243
|
-
document.body.style.width = originalBodyWidth || '';
|
|
244
|
-
document.body.style.top = originalBodyTop || '';
|
|
245
|
-
window.scrollTo(0, scrollY);
|
|
246
|
-
}
|
|
247
|
-
if (document.body.contains(div)) {
|
|
248
|
-
document.body.removeChild(div);
|
|
249
218
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
};
|
|
256
|
-
}, []); // Empty dependency array - run only once
|
|
257
|
-
if (!divElement) {
|
|
258
|
-
return null;
|
|
219
|
+
});
|
|
220
|
+
// Prevent body scroll on iOS
|
|
221
|
+
scrollY = window.scrollY;
|
|
222
|
+
originalBodyOverflow = document.body.style.overflow;
|
|
223
|
+
document.body.style.overflow = 'hidden';
|
|
259
224
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
225
|
+
// Cleanup function - remove div when component unmounts
|
|
226
|
+
return ()=>{
|
|
227
|
+
// Restore aria-hidden attributes
|
|
228
|
+
modifiedElements.forEach(({ element, hadAriaHidden, previousValue })=>{
|
|
229
|
+
if (document.body.contains(element)) {
|
|
230
|
+
if (hadAriaHidden && previousValue !== null) {
|
|
231
|
+
element.setAttribute('aria-hidden', previousValue);
|
|
232
|
+
} else {
|
|
233
|
+
element.removeAttribute('aria-hidden');
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
// Restore body scroll
|
|
238
|
+
if (layerConfig.overlay) {
|
|
239
|
+
document.body.style.overflow = originalBodyOverflow || '';
|
|
240
|
+
window.scrollTo(0, scrollY);
|
|
241
|
+
}
|
|
242
|
+
if (document.body.contains(div)) {
|
|
243
|
+
document.body.removeChild(div);
|
|
244
|
+
}
|
|
245
|
+
// Remove from layers array
|
|
246
|
+
const index = this.layers.findIndex((layer)=>layer.id === layerId);
|
|
247
|
+
if (index !== -1) {
|
|
248
|
+
this.layers.splice(index, 1);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}, []); // Empty dependency array - run only once
|
|
252
|
+
if (!divElement) {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
return /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx(Container$5, {
|
|
256
|
+
...props,
|
|
257
|
+
ref: ref,
|
|
258
|
+
onClick: overlayClickHandler,
|
|
259
|
+
zIndex: currentIndex,
|
|
260
|
+
...layerConfig,
|
|
261
|
+
children: layerConfig.component
|
|
262
|
+
}), divElement);
|
|
263
|
+
};
|
|
264
|
+
// Return callback which will trigger the un-mount.
|
|
265
|
+
return [
|
|
266
|
+
/*#__PURE__*/ React.forwardRef(LayerContainer),
|
|
267
267
|
closeFn
|
|
268
268
|
];
|
|
269
269
|
};
|
|
270
270
|
if (typeof document !== 'undefined') {
|
|
271
271
|
// Store handler reference for cleanup
|
|
272
272
|
this.keyupHandler = (e)=>{
|
|
273
|
-
if (this.layers.length && e.keyCode === KEY_CODES.ESC) {
|
|
273
|
+
if (this.layers.length && e.keyCode === KEY_CODES$1.ESC) {
|
|
274
274
|
const lastLayer = this.layers.slice(-1)[0];
|
|
275
275
|
if (lastLayer.config.closeOnEsc !== false) {
|
|
276
276
|
this.unmount(lastLayer);
|
|
@@ -280,9 +280,9 @@ import { getThemeValue, THEME_NAME } from './constants.js';
|
|
|
280
280
|
document.body.addEventListener('keyup', this.keyupHandler);
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
|
-
}
|
|
283
|
+
};
|
|
284
284
|
// Return the instance of the class to create a Singleton.
|
|
285
|
-
var LayerManager
|
|
285
|
+
var LayerManager = new LayerManager$1();
|
|
286
286
|
|
|
287
|
-
export { LAYER_POSITION, LayerManager
|
|
287
|
+
export { LAYER_POSITION, LayerManager as default };
|
|
288
288
|
//# sourceMappingURL=LayerManager.js.map
|