no-frills-ui 0.0.14-alpha.4 → 0.0.14-alpha.6
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/index.js +2841 -2786
- package/dist/index.js.map +1 -1
- package/lib-esm/components/Accordion/Accordion.d.ts +0 -1
- package/lib-esm/components/Accordion/Accordion.js +26 -26
- package/lib-esm/components/Accordion/AccordionStep.d.ts +0 -1
- package/lib-esm/components/Accordion/AccordionStep.js +98 -114
- package/lib-esm/components/Accordion/index.d.ts +0 -1
- package/lib-esm/components/Badge/Badge.d.ts +0 -1
- package/lib-esm/components/Badge/Badge.js +37 -43
- package/lib-esm/components/Badge/index.d.ts +0 -1
- package/lib-esm/components/Button/ActionButton.d.ts +0 -1
- package/lib-esm/components/Button/ActionButton.js +6 -38
- package/lib-esm/components/Button/Button.d.ts +0 -1
- package/lib-esm/components/Button/Button.js +8 -43
- package/lib-esm/components/Button/IconButton.d.ts +0 -1
- package/lib-esm/components/Button/IconButton.js +6 -42
- package/lib-esm/components/Button/LinkButton.d.ts +0 -1
- package/lib-esm/components/Button/LinkButton.js +6 -33
- package/lib-esm/components/Button/RaisedButton.d.ts +0 -1
- package/lib-esm/components/Button/RaisedButton.js +6 -46
- package/lib-esm/components/Button/index.d.ts +0 -1
- package/lib-esm/components/Card/Card.d.ts +0 -1
- package/lib-esm/components/Card/Card.js +8 -13
- package/lib-esm/components/Card/index.d.ts +0 -1
- package/lib-esm/components/Chip/Chip.d.ts +0 -1
- package/lib-esm/components/Chip/Chip.js +35 -43
- package/lib-esm/components/Chip/index.d.ts +0 -1
- package/lib-esm/components/ChipInput/ChipInput.d.ts +0 -1
- package/lib-esm/components/ChipInput/ChipInput.js +107 -167
- package/lib-esm/components/ChipInput/index.d.ts +0 -1
- package/lib-esm/components/Dialog/AlertDialog.d.ts +0 -1
- package/lib-esm/components/Dialog/AlertDialog.js +47 -25
- package/lib-esm/components/Dialog/ConfirmDialog.d.ts +0 -1
- package/lib-esm/components/Dialog/ConfirmDialog.js +49 -31
- package/lib-esm/components/Dialog/Dialog.d.ts +27 -2
- package/lib-esm/components/Dialog/Dialog.js +120 -67
- package/lib-esm/components/Dialog/PromptDialog.d.ts +0 -1
- package/lib-esm/components/Dialog/PromptDialog.js +82 -44
- package/lib-esm/components/Dialog/index.d.ts +0 -1
- package/lib-esm/components/DragAndDrop/DragAndDrop.d.ts +0 -1
- package/lib-esm/components/DragAndDrop/DragAndDrop.js +66 -71
- package/lib-esm/components/DragAndDrop/DragItem.d.ts +0 -1
- package/lib-esm/components/DragAndDrop/DragItem.js +106 -118
- package/lib-esm/components/DragAndDrop/index.d.ts +0 -1
- package/lib-esm/components/DragAndDrop/types.d.ts +0 -1
- package/lib-esm/components/DragAndDrop/types.js +7 -5
- package/lib-esm/components/Drawer/Drawer.d.ts +76 -2
- package/lib-esm/components/Drawer/Drawer.js +176 -96
- package/lib-esm/components/Drawer/index.d.ts +0 -1
- package/lib-esm/components/Groups/Group.d.ts +0 -1
- package/lib-esm/components/Groups/Group.js +32 -88
- package/lib-esm/components/Groups/GroupLabel.d.ts +0 -1
- package/lib-esm/components/Groups/GroupLabel.js +7 -17
- package/lib-esm/components/Groups/index.d.ts +0 -1
- package/lib-esm/components/Input/Checkbox.d.ts +0 -1
- package/lib-esm/components/Input/Checkbox.js +39 -110
- package/lib-esm/components/Input/Dropdown.d.ts +8 -1
- package/lib-esm/components/Input/Dropdown.js +109 -49
- package/lib-esm/components/Input/Input.d.ts +0 -1
- package/lib-esm/components/Input/Input.js +61 -113
- package/lib-esm/components/Input/Radio.d.ts +0 -1
- package/lib-esm/components/Input/Radio.js +31 -76
- package/lib-esm/components/Input/RadioButton.d.ts +0 -1
- package/lib-esm/components/Input/RadioButton.js +30 -67
- package/lib-esm/components/Input/Select.d.ts +0 -1
- package/lib-esm/components/Input/Select.js +74 -126
- package/lib-esm/components/Input/TextArea.d.ts +0 -1
- package/lib-esm/components/Input/TextArea.js +60 -111
- package/lib-esm/components/Input/Toggle.d.ts +0 -1
- package/lib-esm/components/Input/Toggle.js +29 -77
- package/lib-esm/components/Input/index.d.ts +0 -1
- package/lib-esm/components/Menu/Menu.d.ts +13 -2
- package/lib-esm/components/Menu/Menu.js +107 -27
- package/lib-esm/components/Menu/MenuContext.d.ts +0 -1
- package/lib-esm/components/Menu/MenuContext.js +4 -2
- package/lib-esm/components/Menu/MenuItem.d.ts +6 -4
- package/lib-esm/components/Menu/MenuItem.js +36 -51
- package/lib-esm/components/Menu/index.d.ts +0 -1
- package/lib-esm/components/Modal/Modal.d.ts +70 -2
- package/lib-esm/components/Modal/Modal.js +149 -52
- package/lib-esm/components/Modal/index.d.ts +0 -1
- package/lib-esm/components/Notification/Notification.d.ts +3 -2
- package/lib-esm/components/Notification/Notification.js +54 -64
- package/lib-esm/components/Notification/NotificationManager.d.ts +15 -2
- package/lib-esm/components/Notification/NotificationManager.js +169 -77
- package/lib-esm/components/Notification/index.d.ts +0 -1
- package/lib-esm/components/Notification/style.d.ts +4 -1
- package/lib-esm/components/Notification/style.js +63 -142
- package/lib-esm/components/Notification/types.d.ts +2 -1
- package/lib-esm/components/Notification/types.js +8 -9
- package/lib-esm/components/Popover/Popover.d.ts +0 -1
- package/lib-esm/components/Popover/Popover.js +146 -111
- package/lib-esm/components/Popover/index.d.ts +0 -1
- package/lib-esm/components/Spinner/Spinner.d.ts +3 -1
- package/lib-esm/components/Spinner/Spinner.js +19 -24
- package/lib-esm/components/Spinner/index.d.ts +0 -1
- package/lib-esm/components/Stepper/Step.d.ts +0 -1
- package/lib-esm/components/Stepper/Step.js +15 -22
- package/lib-esm/components/Stepper/Stepper.d.ts +0 -1
- package/lib-esm/components/Stepper/Stepper.js +100 -102
- package/lib-esm/components/Stepper/index.d.ts +0 -1
- package/lib-esm/components/Tabs/Tab.d.ts +0 -1
- package/lib-esm/components/Tabs/Tab.js +11 -10
- package/lib-esm/components/Tabs/Tabs.d.ts +0 -1
- package/lib-esm/components/Tabs/Tabs.js +88 -50
- package/lib-esm/components/Tabs/index.d.ts +0 -1
- package/lib-esm/components/Toast/Toast.d.ts +30 -5
- package/lib-esm/components/Toast/Toast.js +196 -108
- package/lib-esm/components/Toast/ToastStory.d.ts +0 -1
- package/lib-esm/components/Toast/index.d.ts +0 -1
- package/lib-esm/components/Tooltip/Tooltip.d.ts +0 -1
- package/lib-esm/components/Tooltip/Tooltip.js +60 -61
- package/lib-esm/components/Tooltip/index.d.ts +0 -1
- package/lib-esm/components/index.d.ts +0 -1
- package/lib-esm/components/index.js +42 -21
- package/lib-esm/icons/CheckCircle.d.ts +0 -1
- package/lib-esm/icons/CheckCircle.js +21 -4
- package/lib-esm/icons/Close.d.ts +0 -1
- package/lib-esm/icons/Close.js +21 -4
- package/lib-esm/icons/DragIndicator.d.ts +0 -1
- package/lib-esm/icons/DragIndicator.js +21 -4
- package/lib-esm/icons/ErrorOutline.d.ts +0 -1
- package/lib-esm/icons/ErrorOutline.js +15 -4
- package/lib-esm/icons/ExpandMore.d.ts +0 -1
- package/lib-esm/icons/ExpandMore.js +21 -4
- package/lib-esm/icons/FiberManualRecord.d.ts +0 -1
- package/lib-esm/icons/FiberManualRecord.js +23 -4
- package/lib-esm/icons/Info.d.ts +0 -1
- package/lib-esm/icons/Info.js +21 -4
- package/lib-esm/icons/ReportProblem.d.ts +0 -1
- package/lib-esm/icons/ReportProblem.js +21 -4
- package/lib-esm/icons/index.d.ts +0 -1
- package/lib-esm/index.d.ts +0 -1
- package/lib-esm/shared/LayerManager.d.ts +3 -1
- package/lib-esm/shared/LayerManager.js +158 -87
- package/lib-esm/shared/constants.d.ts +58 -28
- package/lib-esm/shared/constants.js +61 -26
- package/lib-esm/shared/styles.d.ts +1 -2
- package/lib-esm/shared/styles.js +20 -24
- package/package.json +15 -5
- package/lib-esm/components/Accordion/Accordion.d.ts.map +0 -1
- package/lib-esm/components/Accordion/Accordion.js.map +0 -1
- package/lib-esm/components/Accordion/AccordionStep.d.ts.map +0 -1
- package/lib-esm/components/Accordion/AccordionStep.js.map +0 -1
- package/lib-esm/components/Accordion/index.d.ts.map +0 -1
- package/lib-esm/components/Accordion/index.js +0 -3
- package/lib-esm/components/Accordion/index.js.map +0 -1
- package/lib-esm/components/Badge/Badge.d.ts.map +0 -1
- package/lib-esm/components/Badge/Badge.js.map +0 -1
- package/lib-esm/components/Badge/index.d.ts.map +0 -1
- package/lib-esm/components/Badge/index.js +0 -2
- package/lib-esm/components/Badge/index.js.map +0 -1
- package/lib-esm/components/Button/ActionButton.d.ts.map +0 -1
- package/lib-esm/components/Button/ActionButton.js.map +0 -1
- package/lib-esm/components/Button/Button.d.ts.map +0 -1
- package/lib-esm/components/Button/Button.js.map +0 -1
- package/lib-esm/components/Button/IconButton.d.ts.map +0 -1
- package/lib-esm/components/Button/IconButton.js.map +0 -1
- package/lib-esm/components/Button/LinkButton.d.ts.map +0 -1
- package/lib-esm/components/Button/LinkButton.js.map +0 -1
- package/lib-esm/components/Button/RaisedButton.d.ts.map +0 -1
- package/lib-esm/components/Button/RaisedButton.js.map +0 -1
- package/lib-esm/components/Button/index.d.ts.map +0 -1
- package/lib-esm/components/Button/index.js +0 -6
- package/lib-esm/components/Button/index.js.map +0 -1
- package/lib-esm/components/Card/Card.d.ts.map +0 -1
- package/lib-esm/components/Card/Card.js.map +0 -1
- package/lib-esm/components/Card/index.d.ts.map +0 -1
- package/lib-esm/components/Card/index.js +0 -3
- package/lib-esm/components/Card/index.js.map +0 -1
- package/lib-esm/components/Chip/Chip.d.ts.map +0 -1
- package/lib-esm/components/Chip/Chip.js.map +0 -1
- package/lib-esm/components/Chip/index.d.ts.map +0 -1
- package/lib-esm/components/Chip/index.js +0 -2
- package/lib-esm/components/Chip/index.js.map +0 -1
- package/lib-esm/components/ChipInput/ChipInput.d.ts.map +0 -1
- package/lib-esm/components/ChipInput/ChipInput.js.map +0 -1
- package/lib-esm/components/ChipInput/index.d.ts.map +0 -1
- package/lib-esm/components/ChipInput/index.js +0 -2
- package/lib-esm/components/ChipInput/index.js.map +0 -1
- package/lib-esm/components/Dialog/AlertDialog.d.ts.map +0 -1
- package/lib-esm/components/Dialog/AlertDialog.js.map +0 -1
- package/lib-esm/components/Dialog/ConfirmDialog.d.ts.map +0 -1
- package/lib-esm/components/Dialog/ConfirmDialog.js.map +0 -1
- package/lib-esm/components/Dialog/Dialog.d.ts.map +0 -1
- package/lib-esm/components/Dialog/Dialog.js.map +0 -1
- package/lib-esm/components/Dialog/PromptDialog.d.ts.map +0 -1
- package/lib-esm/components/Dialog/PromptDialog.js.map +0 -1
- package/lib-esm/components/Dialog/index.d.ts.map +0 -1
- package/lib-esm/components/Dialog/index.js +0 -5
- package/lib-esm/components/Dialog/index.js.map +0 -1
- package/lib-esm/components/DragAndDrop/DragAndDrop.d.ts.map +0 -1
- package/lib-esm/components/DragAndDrop/DragAndDrop.js.map +0 -1
- package/lib-esm/components/DragAndDrop/DragItem.d.ts.map +0 -1
- package/lib-esm/components/DragAndDrop/DragItem.js.map +0 -1
- package/lib-esm/components/DragAndDrop/index.d.ts.map +0 -1
- package/lib-esm/components/DragAndDrop/index.js +0 -3
- package/lib-esm/components/DragAndDrop/index.js.map +0 -1
- package/lib-esm/components/DragAndDrop/types.d.ts.map +0 -1
- package/lib-esm/components/DragAndDrop/types.js.map +0 -1
- package/lib-esm/components/Drawer/Drawer.d.ts.map +0 -1
- package/lib-esm/components/Drawer/Drawer.js.map +0 -1
- package/lib-esm/components/Drawer/index.d.ts.map +0 -1
- package/lib-esm/components/Drawer/index.js +0 -2
- package/lib-esm/components/Drawer/index.js.map +0 -1
- package/lib-esm/components/Groups/Group.d.ts.map +0 -1
- package/lib-esm/components/Groups/Group.js.map +0 -1
- package/lib-esm/components/Groups/GroupLabel.d.ts.map +0 -1
- package/lib-esm/components/Groups/GroupLabel.js.map +0 -1
- package/lib-esm/components/Groups/index.d.ts.map +0 -1
- package/lib-esm/components/Groups/index.js +0 -3
- package/lib-esm/components/Groups/index.js.map +0 -1
- package/lib-esm/components/Input/Checkbox.d.ts.map +0 -1
- package/lib-esm/components/Input/Checkbox.js.map +0 -1
- package/lib-esm/components/Input/Dropdown.d.ts.map +0 -1
- package/lib-esm/components/Input/Dropdown.js.map +0 -1
- package/lib-esm/components/Input/Input.d.ts.map +0 -1
- package/lib-esm/components/Input/Input.js.map +0 -1
- package/lib-esm/components/Input/Radio.d.ts.map +0 -1
- package/lib-esm/components/Input/Radio.js.map +0 -1
- package/lib-esm/components/Input/RadioButton.d.ts.map +0 -1
- package/lib-esm/components/Input/RadioButton.js.map +0 -1
- package/lib-esm/components/Input/Select.d.ts.map +0 -1
- package/lib-esm/components/Input/Select.js.map +0 -1
- package/lib-esm/components/Input/TextArea.d.ts.map +0 -1
- package/lib-esm/components/Input/TextArea.js.map +0 -1
- package/lib-esm/components/Input/Toggle.d.ts.map +0 -1
- package/lib-esm/components/Input/Toggle.js.map +0 -1
- package/lib-esm/components/Input/index.d.ts.map +0 -1
- package/lib-esm/components/Input/index.js +0 -9
- package/lib-esm/components/Input/index.js.map +0 -1
- package/lib-esm/components/Menu/Menu.d.ts.map +0 -1
- package/lib-esm/components/Menu/Menu.js.map +0 -1
- package/lib-esm/components/Menu/MenuContext.d.ts.map +0 -1
- package/lib-esm/components/Menu/MenuContext.js.map +0 -1
- package/lib-esm/components/Menu/MenuItem.d.ts.map +0 -1
- package/lib-esm/components/Menu/MenuItem.js.map +0 -1
- package/lib-esm/components/Menu/index.d.ts.map +0 -1
- package/lib-esm/components/Menu/index.js +0 -3
- package/lib-esm/components/Menu/index.js.map +0 -1
- package/lib-esm/components/Modal/Modal.d.ts.map +0 -1
- package/lib-esm/components/Modal/Modal.js.map +0 -1
- package/lib-esm/components/Modal/index.d.ts.map +0 -1
- package/lib-esm/components/Modal/index.js +0 -2
- package/lib-esm/components/Modal/index.js.map +0 -1
- package/lib-esm/components/Notification/Notification.d.ts.map +0 -1
- package/lib-esm/components/Notification/Notification.js.map +0 -1
- package/lib-esm/components/Notification/NotificationManager.d.ts.map +0 -1
- package/lib-esm/components/Notification/NotificationManager.js.map +0 -1
- package/lib-esm/components/Notification/index.d.ts.map +0 -1
- package/lib-esm/components/Notification/index.js +0 -3
- package/lib-esm/components/Notification/index.js.map +0 -1
- package/lib-esm/components/Notification/style.d.ts.map +0 -1
- package/lib-esm/components/Notification/style.js.map +0 -1
- package/lib-esm/components/Notification/types.d.ts.map +0 -1
- package/lib-esm/components/Notification/types.js.map +0 -1
- package/lib-esm/components/Popover/Popover.d.ts.map +0 -1
- package/lib-esm/components/Popover/Popover.js.map +0 -1
- package/lib-esm/components/Popover/index.d.ts.map +0 -1
- package/lib-esm/components/Popover/index.js +0 -2
- package/lib-esm/components/Popover/index.js.map +0 -1
- package/lib-esm/components/Spinner/Spinner.d.ts.map +0 -1
- package/lib-esm/components/Spinner/Spinner.js.map +0 -1
- package/lib-esm/components/Spinner/index.d.ts.map +0 -1
- package/lib-esm/components/Spinner/index.js +0 -2
- package/lib-esm/components/Spinner/index.js.map +0 -1
- package/lib-esm/components/Stepper/Step.d.ts.map +0 -1
- package/lib-esm/components/Stepper/Step.js.map +0 -1
- package/lib-esm/components/Stepper/Stepper.d.ts.map +0 -1
- package/lib-esm/components/Stepper/Stepper.js.map +0 -1
- package/lib-esm/components/Stepper/index.d.ts.map +0 -1
- package/lib-esm/components/Stepper/index.js +0 -4
- package/lib-esm/components/Stepper/index.js.map +0 -1
- package/lib-esm/components/Tabs/Tab.d.ts.map +0 -1
- package/lib-esm/components/Tabs/Tab.js.map +0 -1
- package/lib-esm/components/Tabs/Tabs.d.ts.map +0 -1
- package/lib-esm/components/Tabs/Tabs.js.map +0 -1
- package/lib-esm/components/Tabs/index.d.ts.map +0 -1
- package/lib-esm/components/Tabs/index.js +0 -3
- package/lib-esm/components/Tabs/index.js.map +0 -1
- package/lib-esm/components/Toast/Toast.d.ts.map +0 -1
- package/lib-esm/components/Toast/Toast.js.map +0 -1
- package/lib-esm/components/Toast/ToastStory.d.ts.map +0 -1
- package/lib-esm/components/Toast/ToastStory.js +0 -35
- package/lib-esm/components/Toast/ToastStory.js.map +0 -1
- package/lib-esm/components/Toast/index.d.ts.map +0 -1
- package/lib-esm/components/Toast/index.js +0 -2
- package/lib-esm/components/Toast/index.js.map +0 -1
- package/lib-esm/components/Tooltip/Tooltip.d.ts.map +0 -1
- package/lib-esm/components/Tooltip/Tooltip.js.map +0 -1
- package/lib-esm/components/Tooltip/index.d.ts.map +0 -1
- package/lib-esm/components/Tooltip/index.js +0 -2
- package/lib-esm/components/Tooltip/index.js.map +0 -1
- package/lib-esm/components/index.d.ts.map +0 -1
- package/lib-esm/components/index.js.map +0 -1
- package/lib-esm/icons/CheckCircle.d.ts.map +0 -1
- package/lib-esm/icons/CheckCircle.js.map +0 -1
- package/lib-esm/icons/Close.d.ts.map +0 -1
- package/lib-esm/icons/Close.js.map +0 -1
- package/lib-esm/icons/DragIndicator.d.ts.map +0 -1
- package/lib-esm/icons/DragIndicator.js.map +0 -1
- package/lib-esm/icons/ErrorOutline.d.ts.map +0 -1
- package/lib-esm/icons/ErrorOutline.js.map +0 -1
- package/lib-esm/icons/ExpandMore.d.ts.map +0 -1
- package/lib-esm/icons/ExpandMore.js.map +0 -1
- package/lib-esm/icons/FiberManualRecord.d.ts.map +0 -1
- package/lib-esm/icons/FiberManualRecord.js.map +0 -1
- package/lib-esm/icons/Info.d.ts.map +0 -1
- package/lib-esm/icons/Info.js.map +0 -1
- package/lib-esm/icons/ReportProblem.d.ts.map +0 -1
- package/lib-esm/icons/ReportProblem.js.map +0 -1
- package/lib-esm/icons/index.d.ts.map +0 -1
- package/lib-esm/icons/index.js +0 -9
- package/lib-esm/icons/index.js.map +0 -1
- package/lib-esm/index.d.ts.map +0 -1
- package/lib-esm/index.js +0 -2
- package/lib-esm/index.js.map +0 -1
- package/lib-esm/shared/LayerManager.d.ts.map +0 -1
- package/lib-esm/shared/LayerManager.js.map +0 -1
- package/lib-esm/shared/constants.d.ts.map +0 -1
- package/lib-esm/shared/constants.js.map +0 -1
- package/lib-esm/shared/styles.d.ts.map +0 -1
- package/lib-esm/shared/styles.js.map +0 -1
|
@@ -1,51 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
1
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
13
2
|
import React from 'react';
|
|
14
3
|
import PropTypes from 'prop-types';
|
|
15
|
-
import LayerManager, { LAYER_POSITION } from '../../shared/LayerManager';
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
import LayerManager, { LAYER_POSITION } from '../../shared/LayerManager.js';
|
|
5
|
+
import { DialogContainer } from '../Dialog/Dialog.js';
|
|
6
|
+
|
|
7
|
+
const modalPropTypes = {
|
|
8
|
+
/** Opens the modal */ open: PropTypes.bool.isRequired,
|
|
9
|
+
/** Closes the modal on esc */ closeOnEsc: PropTypes.bool,
|
|
10
|
+
/** Closes the modal on overlay click */ closeOnOverlayClick: PropTypes.bool,
|
|
11
|
+
/** Call back function called when the modal closes. */ onClose: PropTypes.func
|
|
12
|
+
};
|
|
18
13
|
class Modal extends React.Component {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
open: false,
|
|
23
|
-
};
|
|
24
|
-
this.onClose = () => {
|
|
25
|
-
var _a, _b;
|
|
26
|
-
this.setState({
|
|
27
|
-
open: false,
|
|
28
|
-
});
|
|
29
|
-
(_b = (_a = this.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
30
|
-
this.closeCallback = null;
|
|
31
|
-
this.layer = null;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
static getDerivedStateFromProps(props) {
|
|
14
|
+
/**
|
|
15
|
+
* Syncs state with props.
|
|
16
|
+
*/ static getDerivedStateFromProps(props) {
|
|
35
17
|
if (props.open) {
|
|
36
18
|
return {
|
|
37
|
-
open: true
|
|
19
|
+
open: true
|
|
38
20
|
};
|
|
39
21
|
}
|
|
40
22
|
return null;
|
|
41
23
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Lifecycle method to save the currently focused element when the modal mounts while open.
|
|
26
|
+
*/ componentDidMount() {
|
|
27
|
+
if (this.props.open) {
|
|
28
|
+
this.lastFocusedElement = document.activeElement;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Lifecycle method to restore focus when the modal unmounts.
|
|
33
|
+
*/ componentWillUnmount() {
|
|
34
|
+
if (this.props.open) {
|
|
35
|
+
this.restoreFocus();
|
|
36
|
+
}
|
|
37
|
+
// Clean up layer references
|
|
38
|
+
if (this.closeCallback) {
|
|
39
|
+
this.closeCallback();
|
|
40
|
+
this.closeCallback = null;
|
|
41
|
+
}
|
|
42
|
+
this.layer = null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Lifecycle method to handle Modal updates.
|
|
46
|
+
* Manages opening/closing logic via LayerManager and focus preservation.
|
|
47
|
+
*/ getSnapshotBeforeUpdate(prevProps) {
|
|
48
|
+
const { open, closeOnEsc, closeOnOverlayClick, children, ...rest } = this.props;
|
|
45
49
|
if (prevProps.open && !open) {
|
|
46
|
-
|
|
50
|
+
this.closeCallback?.();
|
|
51
|
+
this.restoreFocus();
|
|
47
52
|
}
|
|
48
53
|
if (!prevProps.open && open) {
|
|
54
|
+
// Save current focus
|
|
55
|
+
this.lastFocusedElement = document.activeElement;
|
|
49
56
|
this.layer = LayerManager.renderLayer({
|
|
50
57
|
overlay: true,
|
|
51
58
|
exitDelay: 300,
|
|
@@ -53,33 +60,123 @@ class Modal extends React.Component {
|
|
|
53
60
|
closeCallback: this.onClose,
|
|
54
61
|
closeOnEsc: closeOnEsc,
|
|
55
62
|
closeOnOverlayClick: closeOnOverlayClick,
|
|
56
|
-
component:
|
|
63
|
+
component: /*#__PURE__*/ jsx(DialogContainer, {
|
|
64
|
+
...rest,
|
|
65
|
+
ref: this.setModalRef,
|
|
66
|
+
role: "dialog",
|
|
67
|
+
"aria-modal": "true",
|
|
68
|
+
tabIndex: -1,
|
|
69
|
+
onKeyDown: this.handleKeyDown,
|
|
70
|
+
onClick: (e)=>e.stopPropagation(),
|
|
71
|
+
elevated: true,
|
|
72
|
+
children: children
|
|
73
|
+
})
|
|
57
74
|
});
|
|
58
75
|
this.closeCallback = this.layer[1];
|
|
59
76
|
this.forceUpdate();
|
|
60
77
|
}
|
|
61
78
|
}
|
|
62
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Renders the Modal component via the LayerManager portal.
|
|
81
|
+
*/ render() {
|
|
63
82
|
if (this.state.open && this.layer) {
|
|
64
83
|
const [Component] = this.layer;
|
|
65
|
-
return
|
|
84
|
+
return /*#__PURE__*/ jsx(Component, {});
|
|
66
85
|
}
|
|
67
86
|
return null;
|
|
68
87
|
}
|
|
88
|
+
constructor(...args){
|
|
89
|
+
super(...args), this.state = {
|
|
90
|
+
open: false
|
|
91
|
+
}, /**
|
|
92
|
+
* Internal close handler.
|
|
93
|
+
* Restores focus and calls the external onClose callback.
|
|
94
|
+
*/ this.onClose = ()=>{
|
|
95
|
+
this.restoreFocus();
|
|
96
|
+
this.setState({
|
|
97
|
+
open: false
|
|
98
|
+
});
|
|
99
|
+
this.props.onClose?.();
|
|
100
|
+
this.closeCallback = null;
|
|
101
|
+
this.layer = null;
|
|
102
|
+
}, this.lastFocusedElement = null, this.modalRef = /*#__PURE__*/ React.createRef(), /**
|
|
103
|
+
* Retrieves all focusable elements within the modal.
|
|
104
|
+
*/ this.getFocusableElements = ()=>{
|
|
105
|
+
if (!this.modalRef.current) return [];
|
|
106
|
+
return Array.from(this.modalRef.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));
|
|
107
|
+
}, /**
|
|
108
|
+
* Handles keydown events to implement the focus trap.
|
|
109
|
+
* Traps Tab and Shift+Tab within the modal.
|
|
110
|
+
*/ this.handleKeyDown = (e)=>{
|
|
111
|
+
if (e.key === 'Tab') {
|
|
112
|
+
const focusableElements = this.getFocusableElements();
|
|
113
|
+
if (focusableElements.length === 0) return;
|
|
114
|
+
const firstElement = focusableElements[0];
|
|
115
|
+
const lastElement = focusableElements[focusableElements.length - 1];
|
|
116
|
+
if (e.shiftKey) {
|
|
117
|
+
if (document.activeElement === firstElement) {
|
|
118
|
+
lastElement.focus();
|
|
119
|
+
e.preventDefault();
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
if (document.activeElement === lastElement) {
|
|
123
|
+
firstElement.focus();
|
|
124
|
+
e.preventDefault();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, /**
|
|
129
|
+
* Restores focus to the element that was focused before the modal opened.
|
|
130
|
+
*/ this.restoreFocus = ()=>{
|
|
131
|
+
if (this.lastFocusedElement) {
|
|
132
|
+
// Check if the element is still in the document
|
|
133
|
+
const elementToBeFocused = this.lastFocusedElement;
|
|
134
|
+
this.lastFocusedElement = null;
|
|
135
|
+
setTimeout(()=>{
|
|
136
|
+
if (document.body.contains(elementToBeFocused)) {
|
|
137
|
+
elementToBeFocused.focus();
|
|
138
|
+
}
|
|
139
|
+
}, 100);
|
|
140
|
+
}
|
|
141
|
+
}, /**
|
|
142
|
+
* Callback ref to capture the Modal DOM element.
|
|
143
|
+
* Triggers initial focus setting when the element mounts.
|
|
144
|
+
*/ this.setModalRef = (node)=>{
|
|
145
|
+
// Update ref
|
|
146
|
+
this.modalRef.current = node;
|
|
147
|
+
if (node) {
|
|
148
|
+
// Set initial focus when the node is mounted
|
|
149
|
+
this.setInitialFocus(node);
|
|
150
|
+
}
|
|
151
|
+
}, /**
|
|
152
|
+
* Sets initial focus within the modal.
|
|
153
|
+
* Tries to focus the header (first child) first, then the first interactive element, or falls back to the container.
|
|
154
|
+
*/ this.setInitialFocus = (root)=>{
|
|
155
|
+
// Try to find the header (assumed to be the first child)
|
|
156
|
+
const firstChild = root.firstElementChild;
|
|
157
|
+
if (firstChild) {
|
|
158
|
+
// Ensure it's focusable
|
|
159
|
+
if (firstChild.getAttribute('tabindex') === null) {
|
|
160
|
+
firstChild.setAttribute('tabindex', '-1');
|
|
161
|
+
}
|
|
162
|
+
firstChild.focus();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
// Fallback to focusable elements
|
|
166
|
+
const focusableElements = this.getFocusableElements();
|
|
167
|
+
if (focusableElements.length > 0) {
|
|
168
|
+
focusableElements[0].focus();
|
|
169
|
+
} else {
|
|
170
|
+
// Fallback to container
|
|
171
|
+
root.focus();
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
69
175
|
}
|
|
70
|
-
Modal.propTypes =
|
|
71
|
-
/** Opens the modal */
|
|
72
|
-
open: PropTypes.bool.isRequired,
|
|
73
|
-
/** Closes the modal on esc */
|
|
74
|
-
closeOnEsc: PropTypes.bool,
|
|
75
|
-
/** Closes the modal on overlay click */
|
|
76
|
-
closeOnOverlayClick: PropTypes.bool,
|
|
77
|
-
/** Call back function called when the modal closes. */
|
|
78
|
-
onClose: PropTypes.func,
|
|
79
|
-
};
|
|
176
|
+
Modal.propTypes = modalPropTypes;
|
|
80
177
|
Modal.defaultProps = {
|
|
81
178
|
closeOnEsc: true,
|
|
82
|
-
closeOnOverlayClick: true
|
|
179
|
+
closeOnOverlayClick: true
|
|
83
180
|
};
|
|
84
|
-
|
|
85
|
-
|
|
181
|
+
|
|
182
|
+
export { Modal as default };
|
|
@@ -23,6 +23,8 @@ export declare class StoryProps extends React.Component<NotificationProps> {
|
|
|
23
23
|
buttonClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
24
24
|
/** Notification close callback. */
|
|
25
25
|
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
26
|
+
/** Aria label for the close button on the notification. Defaults to "Close notification" */
|
|
27
|
+
closeButtonAriaLabel: PropTypes.Requireable<string>;
|
|
26
28
|
};
|
|
27
29
|
static defaultProps: {
|
|
28
30
|
duration: number;
|
|
@@ -42,7 +44,7 @@ declare class Notification {
|
|
|
42
44
|
* @param options - Configuration options for the notification
|
|
43
45
|
* @returns The notification ID or a promise that resolves to the notification ID
|
|
44
46
|
*/
|
|
45
|
-
add: (position: NOTIFICATION_POSITION, options: NotificationOptions
|
|
47
|
+
add: (position: NOTIFICATION_POSITION, options: NotificationOptions, ariaLabel?: string) => Promise<string>;
|
|
46
48
|
/**
|
|
47
49
|
* Removes a notification
|
|
48
50
|
*
|
|
@@ -61,4 +63,3 @@ declare class Notification {
|
|
|
61
63
|
/** Export a singleton instance */
|
|
62
64
|
declare const _default: Notification;
|
|
63
65
|
export default _default;
|
|
64
|
-
//# sourceMappingURL=Notification.d.ts.map
|
|
@@ -1,70 +1,57 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { flushSync } from 'react-dom';
|
|
5
5
|
import { createRoot } from 'react-dom/client';
|
|
6
|
-
import LayerManager, { LAYER_POSITION } from '../../shared/LayerManager';
|
|
7
|
-
import NotificationManager from './NotificationManager';
|
|
8
|
-
import { NOTIFICATION_POSITION, NOTIFICATION_TYPE } from './types';
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
import LayerManager, { LAYER_POSITION } from '../../shared/LayerManager.js';
|
|
7
|
+
import NotificationManager from './NotificationManager.js';
|
|
8
|
+
import { NOTIFICATION_POSITION, NOTIFICATION_TYPE } from './types.js';
|
|
9
|
+
|
|
10
|
+
/** This component is only used for storybook documentation */ class StoryProps extends React.Component {
|
|
11
11
|
render() {
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
StoryProps.propTypes = {
|
|
16
|
-
/** Title of the notification */
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
/** Duration for the notification in milliseconds */
|
|
23
|
-
duration: PropTypes.number,
|
|
24
|
-
/** Creates sticky notification */
|
|
25
|
-
sticky: PropTypes.bool,
|
|
26
|
-
/** Type of notification */
|
|
27
|
-
type: PropTypes.oneOf([
|
|
16
|
+
/** Title of the notification */ title: PropTypes.string.isRequired,
|
|
17
|
+
/** Body of the notification */ description: PropTypes.string.isRequired,
|
|
18
|
+
/** Id for the notification, helps in de-duplication. */ id: PropTypes.string,
|
|
19
|
+
/** Duration for the notification in milliseconds */ duration: PropTypes.number,
|
|
20
|
+
/** Creates sticky notification */ sticky: PropTypes.bool,
|
|
21
|
+
/** Type of notification */ type: PropTypes.oneOf([
|
|
28
22
|
NOTIFICATION_TYPE.INFO,
|
|
29
23
|
NOTIFICATION_TYPE.SUCCESS,
|
|
30
24
|
NOTIFICATION_TYPE.WARNING,
|
|
31
|
-
NOTIFICATION_TYPE.DANGER
|
|
25
|
+
NOTIFICATION_TYPE.DANGER
|
|
32
26
|
]),
|
|
33
|
-
/** Action button text */
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
/** Notification close callback. */
|
|
38
|
-
onClose: PropTypes.func,
|
|
27
|
+
/** Action button text */ buttonText: PropTypes.string,
|
|
28
|
+
/** Action button click callback */ buttonClick: PropTypes.func,
|
|
29
|
+
/** Notification close callback. */ onClose: PropTypes.func,
|
|
30
|
+
/** Aria label for the close button on the notification. Defaults to "Close notification" */ closeButtonAriaLabel: PropTypes.string
|
|
39
31
|
};
|
|
40
32
|
StoryProps.defaultProps = {
|
|
41
33
|
duration: 5000,
|
|
42
34
|
sticky: false,
|
|
43
|
-
type: NOTIFICATION_TYPE.INFO
|
|
35
|
+
type: NOTIFICATION_TYPE.INFO
|
|
44
36
|
};
|
|
45
|
-
/** Maps notification position to layer position */
|
|
46
|
-
const positionMap = {
|
|
37
|
+
/** Maps notification position to layer position */ const positionMap = {
|
|
47
38
|
[NOTIFICATION_POSITION.TOP_LEFT]: LAYER_POSITION.TOP_LEFT,
|
|
48
39
|
[NOTIFICATION_POSITION.TOP_RIGHT]: LAYER_POSITION.TOP_RIGHT,
|
|
49
40
|
[NOTIFICATION_POSITION.BOTTOM_LEFT]: LAYER_POSITION.BOTTOM_LEFT,
|
|
50
|
-
[NOTIFICATION_POSITION.BOTTOM_RIGHT]: LAYER_POSITION.BOTTOM_RIGHT
|
|
41
|
+
[NOTIFICATION_POSITION.BOTTOM_RIGHT]: LAYER_POSITION.BOTTOM_RIGHT
|
|
51
42
|
};
|
|
52
|
-
/** Notification class */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/** Helps in maintaining single instance for different positions. */
|
|
56
|
-
this.containers = new Map();
|
|
43
|
+
/** Notification class */ class Notification {
|
|
44
|
+
constructor(){
|
|
45
|
+
/** Helps in maintaining single instance for different positions. */ this.containers = new Map();
|
|
57
46
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.add = (position, options) => {
|
|
47
|
+
* Adds a notification
|
|
48
|
+
*
|
|
49
|
+
* @param position - The position where the notification should appear
|
|
50
|
+
* @param options - Configuration options for the notification
|
|
51
|
+
* @returns The notification ID or a promise that resolves to the notification ID
|
|
52
|
+
*/ this.add = (position, options, ariaLabel = 'Notifications')=>{
|
|
65
53
|
if (!this.containers.has(position)) {
|
|
66
|
-
/** Callback ref to capture the NotificationManager instance when it mounts */
|
|
67
|
-
const refCallback = (instance) => {
|
|
54
|
+
/** Callback ref to capture the NotificationManager instance when it mounts */ const refCallback = (instance)=>{
|
|
68
55
|
if (instance) {
|
|
69
56
|
const container = this.containers.get(position);
|
|
70
57
|
if (container) {
|
|
@@ -77,7 +64,12 @@ class Notification {
|
|
|
77
64
|
closeOnOverlayClick: false,
|
|
78
65
|
position: positionMap[position],
|
|
79
66
|
alwaysOnTop: true,
|
|
80
|
-
component: (
|
|
67
|
+
component: /*#__PURE__*/ jsx(NotificationManager, {
|
|
68
|
+
ref: refCallback,
|
|
69
|
+
position: position,
|
|
70
|
+
onEmpty: ()=>this.destroy(position),
|
|
71
|
+
ariaLabel: ariaLabel
|
|
72
|
+
})
|
|
81
73
|
});
|
|
82
74
|
// Create a div to mount the Component
|
|
83
75
|
const div = document.createElement('div');
|
|
@@ -86,11 +78,11 @@ class Notification {
|
|
|
86
78
|
this.containers.set(position, {
|
|
87
79
|
manager: null,
|
|
88
80
|
root,
|
|
89
|
-
div
|
|
81
|
+
div
|
|
90
82
|
});
|
|
91
83
|
// Render the Component which will trigger the LayerManager's useEffect
|
|
92
|
-
flushSync(()
|
|
93
|
-
root.render(
|
|
84
|
+
flushSync(()=>{
|
|
85
|
+
root.render(/*#__PURE__*/ jsx(Component, {}));
|
|
94
86
|
});
|
|
95
87
|
}
|
|
96
88
|
const container = this.containers.get(position);
|
|
@@ -98,8 +90,8 @@ class Notification {
|
|
|
98
90
|
return container.manager.add(options);
|
|
99
91
|
}
|
|
100
92
|
// If manager is not ready yet, wait a bit and retry
|
|
101
|
-
return new Promise((resolve)
|
|
102
|
-
setTimeout(()
|
|
93
|
+
return new Promise((resolve)=>{
|
|
94
|
+
setTimeout(()=>{
|
|
103
95
|
const container = this.containers.get(position);
|
|
104
96
|
if (container && container.manager) {
|
|
105
97
|
resolve(container.manager.add(options));
|
|
@@ -108,24 +100,22 @@ class Notification {
|
|
|
108
100
|
});
|
|
109
101
|
};
|
|
110
102
|
/**
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this.remove = (position, id) => {
|
|
103
|
+
* Removes a notification
|
|
104
|
+
*
|
|
105
|
+
* @param position - The position of the notification container
|
|
106
|
+
* @param id - The unique ID of the notification to remove
|
|
107
|
+
*/ this.remove = (position, id)=>{
|
|
117
108
|
const container = this.containers.get(position);
|
|
118
109
|
if (container && container.manager) {
|
|
119
110
|
container.manager.remove(id);
|
|
120
111
|
}
|
|
121
112
|
};
|
|
122
113
|
/**
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
this.destroy = (position) => {
|
|
114
|
+
* Destroys entire stack of notifications at a position.
|
|
115
|
+
* Unmounts the React root and cleans up DOM elements.
|
|
116
|
+
*
|
|
117
|
+
* @param position - The position of the notification container to destroy
|
|
118
|
+
*/ this.destroy = (position)=>{
|
|
129
119
|
const container = this.containers.get(position);
|
|
130
120
|
if (container) {
|
|
131
121
|
container.root.unmount();
|
|
@@ -137,6 +127,6 @@ class Notification {
|
|
|
137
127
|
};
|
|
138
128
|
}
|
|
139
129
|
}
|
|
140
|
-
/** Export a singleton instance */
|
|
141
|
-
|
|
142
|
-
|
|
130
|
+
/** Export a singleton instance */ var Notification$1 = new Notification();
|
|
131
|
+
|
|
132
|
+
export { StoryProps, Notification$1 as default };
|
|
@@ -3,6 +3,7 @@ import { NOTIFICATION_POSITION, NotificationOptions } from './types';
|
|
|
3
3
|
interface NotificationManagerProps {
|
|
4
4
|
position: NOTIFICATION_POSITION;
|
|
5
5
|
onEmpty: () => void;
|
|
6
|
+
ariaLabel?: string;
|
|
6
7
|
}
|
|
7
8
|
interface NoticeProp extends NotificationOptions {
|
|
8
9
|
leaving?: boolean;
|
|
@@ -17,6 +18,8 @@ declare class NotificationManager extends React.Component<NotificationManagerPro
|
|
|
17
18
|
state: NotificationManagerState;
|
|
18
19
|
private timeouts;
|
|
19
20
|
private set;
|
|
21
|
+
private politeRegionRef;
|
|
22
|
+
private assertiveRegionRef;
|
|
20
23
|
/**
|
|
21
24
|
* Removes a notification from stack if the notification with the given id is found.
|
|
22
25
|
*
|
|
@@ -28,7 +31,14 @@ declare class NotificationManager extends React.Component<NotificationManagerPro
|
|
|
28
31
|
*
|
|
29
32
|
* @param notice
|
|
30
33
|
*/
|
|
31
|
-
add: (notice: NotificationOptions) => string
|
|
34
|
+
add: (notice: NotificationOptions) => Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Update live region content with clear-then-set pattern for reliable VoiceOver announcements.
|
|
37
|
+
*
|
|
38
|
+
* @param content - The text content to announce
|
|
39
|
+
* @param isAssertive - Whether to use assertive (alert) or polite (log) live region
|
|
40
|
+
*/
|
|
41
|
+
private updateLiveRegion;
|
|
32
42
|
/**
|
|
33
43
|
* Handler for close button click.
|
|
34
44
|
*
|
|
@@ -47,7 +57,10 @@ declare class NotificationManager extends React.Component<NotificationManagerPro
|
|
|
47
57
|
* @param id
|
|
48
58
|
*/
|
|
49
59
|
resume: (id: string) => () => void;
|
|
60
|
+
/**
|
|
61
|
+
* Clean up all pending timeouts when component unmounts
|
|
62
|
+
*/
|
|
63
|
+
componentWillUnmount(): void;
|
|
50
64
|
render(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
51
65
|
}
|
|
52
66
|
export default NotificationManager;
|
|
53
|
-
//# sourceMappingURL=NotificationManager.d.ts.map
|