no-frills-ui 0.0.14-alpha.1 → 0.0.14-alpha.3
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 +28 -22
- package/dist/index.js +920 -537
- package/dist/index.js.map +1 -1
- package/lib-esm/components/Accordion/Accordion.d.ts +3 -3
- package/lib-esm/components/Accordion/Accordion.d.ts.map +1 -0
- package/lib-esm/components/Accordion/Accordion.js +6 -3
- package/lib-esm/components/Accordion/Accordion.js.map +1 -1
- package/lib-esm/components/Accordion/AccordionStep.d.ts +3 -2
- package/lib-esm/components/Accordion/AccordionStep.d.ts.map +1 -0
- package/lib-esm/components/Accordion/AccordionStep.js +31 -22
- package/lib-esm/components/Accordion/AccordionStep.js.map +1 -1
- package/lib-esm/components/Accordion/index.d.ts +1 -0
- package/lib-esm/components/Accordion/index.d.ts.map +1 -0
- package/lib-esm/components/Accordion/index.js.map +1 -1
- package/lib-esm/components/Badge/Badge.d.ts +1 -0
- package/lib-esm/components/Badge/Badge.d.ts.map +1 -0
- package/lib-esm/components/Badge/Badge.js +5 -6
- package/lib-esm/components/Badge/Badge.js.map +1 -1
- package/lib-esm/components/Badge/index.d.ts +1 -0
- package/lib-esm/components/Badge/index.d.ts.map +1 -0
- package/lib-esm/components/Badge/index.js.map +1 -1
- package/lib-esm/components/Button/ActionButton.d.ts +1 -0
- package/lib-esm/components/Button/ActionButton.d.ts.map +1 -0
- package/lib-esm/components/Button/ActionButton.js.map +1 -1
- package/lib-esm/components/Button/Button.d.ts +1 -0
- package/lib-esm/components/Button/Button.d.ts.map +1 -0
- package/lib-esm/components/Button/Button.js.map +1 -1
- package/lib-esm/components/Button/IconButton.d.ts +1 -0
- package/lib-esm/components/Button/IconButton.d.ts.map +1 -0
- package/lib-esm/components/Button/IconButton.js.map +1 -1
- package/lib-esm/components/Button/LinkButton.d.ts +1 -0
- package/lib-esm/components/Button/LinkButton.d.ts.map +1 -0
- package/lib-esm/components/Button/LinkButton.js +2 -1
- package/lib-esm/components/Button/LinkButton.js.map +1 -1
- package/lib-esm/components/Button/RaisedButton.d.ts +1 -0
- package/lib-esm/components/Button/RaisedButton.d.ts.map +1 -0
- package/lib-esm/components/Button/RaisedButton.js.map +1 -1
- package/lib-esm/components/Button/index.d.ts +1 -0
- package/lib-esm/components/Button/index.d.ts.map +1 -0
- package/lib-esm/components/Button/index.js.map +1 -1
- package/lib-esm/components/Card/Card.d.ts +1 -0
- package/lib-esm/components/Card/Card.d.ts.map +1 -0
- package/lib-esm/components/Card/Card.js +1 -1
- package/lib-esm/components/Card/Card.js.map +1 -1
- package/lib-esm/components/Card/index.d.ts +1 -0
- package/lib-esm/components/Card/index.d.ts.map +1 -0
- package/lib-esm/components/Card/index.js.map +1 -1
- package/lib-esm/components/Chip/Chip.d.ts +1 -0
- package/lib-esm/components/Chip/Chip.d.ts.map +1 -0
- package/lib-esm/components/Chip/Chip.js +1 -1
- package/lib-esm/components/Chip/Chip.js.map +1 -1
- package/lib-esm/components/Chip/index.d.ts +1 -0
- package/lib-esm/components/Chip/index.d.ts.map +1 -0
- package/lib-esm/components/Chip/index.js.map +1 -1
- package/lib-esm/components/ChipInput/ChipInput.d.ts +1 -0
- package/lib-esm/components/ChipInput/ChipInput.d.ts.map +1 -0
- package/lib-esm/components/ChipInput/ChipInput.js +21 -12
- package/lib-esm/components/ChipInput/ChipInput.js.map +1 -1
- package/lib-esm/components/ChipInput/index.d.ts +1 -0
- package/lib-esm/components/ChipInput/index.d.ts.map +1 -0
- package/lib-esm/components/ChipInput/index.js.map +1 -1
- package/lib-esm/components/Dialog/AlertDialog.d.ts +1 -0
- package/lib-esm/components/Dialog/AlertDialog.d.ts.map +1 -0
- package/lib-esm/components/Dialog/AlertDialog.js +4 -4
- package/lib-esm/components/Dialog/AlertDialog.js.map +1 -1
- package/lib-esm/components/Dialog/ConfirmDialog.d.ts +1 -0
- package/lib-esm/components/Dialog/ConfirmDialog.d.ts.map +1 -0
- package/lib-esm/components/Dialog/ConfirmDialog.js +8 -3
- package/lib-esm/components/Dialog/ConfirmDialog.js.map +1 -1
- package/lib-esm/components/Dialog/Dialog.d.ts +5 -5
- package/lib-esm/components/Dialog/Dialog.d.ts.map +1 -0
- package/lib-esm/components/Dialog/Dialog.js +22 -16
- package/lib-esm/components/Dialog/Dialog.js.map +1 -1
- package/lib-esm/components/Dialog/PromptDialog.d.ts +1 -0
- package/lib-esm/components/Dialog/PromptDialog.d.ts.map +1 -0
- package/lib-esm/components/Dialog/PromptDialog.js +2 -2
- package/lib-esm/components/Dialog/PromptDialog.js.map +1 -1
- package/lib-esm/components/Dialog/index.d.ts +1 -0
- package/lib-esm/components/Dialog/index.d.ts.map +1 -0
- package/lib-esm/components/Dialog/index.js.map +1 -1
- package/lib-esm/components/DragAndDrop/DragAndDrop.d.ts +2 -1
- package/lib-esm/components/DragAndDrop/DragAndDrop.d.ts.map +1 -0
- package/lib-esm/components/DragAndDrop/DragAndDrop.js +4 -2
- package/lib-esm/components/DragAndDrop/DragAndDrop.js.map +1 -1
- package/lib-esm/components/DragAndDrop/DragItem.d.ts +1 -0
- package/lib-esm/components/DragAndDrop/DragItem.d.ts.map +1 -0
- package/lib-esm/components/DragAndDrop/DragItem.js +25 -17
- package/lib-esm/components/DragAndDrop/DragItem.js.map +1 -1
- package/lib-esm/components/DragAndDrop/index.d.ts +1 -0
- package/lib-esm/components/DragAndDrop/index.d.ts.map +1 -0
- package/lib-esm/components/DragAndDrop/index.js.map +1 -1
- package/lib-esm/components/DragAndDrop/types.d.ts +1 -0
- package/lib-esm/components/DragAndDrop/types.d.ts.map +1 -0
- package/lib-esm/components/DragAndDrop/types.js +1 -1
- package/lib-esm/components/DragAndDrop/types.js.map +1 -1
- package/lib-esm/components/Drawer/Drawer.d.ts +1 -0
- package/lib-esm/components/Drawer/Drawer.d.ts.map +1 -0
- package/lib-esm/components/Drawer/Drawer.js +10 -8
- package/lib-esm/components/Drawer/Drawer.js.map +1 -1
- package/lib-esm/components/Drawer/index.d.ts +2 -1
- package/lib-esm/components/Drawer/index.d.ts.map +1 -0
- package/lib-esm/components/Drawer/index.js +1 -1
- package/lib-esm/components/Drawer/index.js.map +1 -1
- package/lib-esm/components/Groups/Group.d.ts +1 -0
- package/lib-esm/components/Groups/Group.d.ts.map +1 -0
- package/lib-esm/components/Groups/Group.js +26 -14
- package/lib-esm/components/Groups/Group.js.map +1 -1
- package/lib-esm/components/Groups/GroupLabel.d.ts +1 -0
- package/lib-esm/components/Groups/GroupLabel.d.ts.map +1 -0
- package/lib-esm/components/Groups/GroupLabel.js.map +1 -1
- package/lib-esm/components/Groups/index.d.ts +1 -0
- package/lib-esm/components/Groups/index.d.ts.map +1 -0
- package/lib-esm/components/Groups/index.js.map +1 -1
- package/lib-esm/components/Input/Checkbox.d.ts +1 -0
- package/lib-esm/components/Input/Checkbox.d.ts.map +1 -0
- package/lib-esm/components/Input/Checkbox.js +11 -8
- package/lib-esm/components/Input/Checkbox.js.map +1 -1
- package/lib-esm/components/Input/Dropdown.d.ts +3 -2
- package/lib-esm/components/Input/Dropdown.d.ts.map +1 -0
- package/lib-esm/components/Input/Dropdown.js +22 -22
- package/lib-esm/components/Input/Dropdown.js.map +1 -1
- package/lib-esm/components/Input/Input.d.ts +1 -0
- package/lib-esm/components/Input/Input.d.ts.map +1 -0
- package/lib-esm/components/Input/Input.js +19 -10
- package/lib-esm/components/Input/Input.js.map +1 -1
- package/lib-esm/components/Input/Radio.d.ts +1 -0
- package/lib-esm/components/Input/Radio.d.ts.map +1 -0
- package/lib-esm/components/Input/Radio.js +4 -3
- package/lib-esm/components/Input/Radio.js.map +1 -1
- package/lib-esm/components/Input/RadioButton.d.ts +1 -0
- package/lib-esm/components/Input/RadioButton.d.ts.map +1 -0
- package/lib-esm/components/Input/RadioButton.js +1 -1
- package/lib-esm/components/Input/RadioButton.js.map +1 -1
- package/lib-esm/components/Input/Select.d.ts +1 -0
- package/lib-esm/components/Input/Select.d.ts.map +1 -0
- package/lib-esm/components/Input/Select.js +17 -9
- package/lib-esm/components/Input/Select.js.map +1 -1
- package/lib-esm/components/Input/TextArea.d.ts +1 -0
- package/lib-esm/components/Input/TextArea.d.ts.map +1 -0
- package/lib-esm/components/Input/TextArea.js +17 -9
- package/lib-esm/components/Input/TextArea.js.map +1 -1
- package/lib-esm/components/Input/Toggle.d.ts +1 -0
- package/lib-esm/components/Input/Toggle.d.ts.map +1 -0
- package/lib-esm/components/Input/Toggle.js +5 -5
- package/lib-esm/components/Input/Toggle.js.map +1 -1
- package/lib-esm/components/Input/index.d.ts +1 -0
- package/lib-esm/components/Input/index.d.ts.map +1 -0
- package/lib-esm/components/Input/index.js.map +1 -1
- package/lib-esm/components/Menu/Menu.d.ts +2 -1
- package/lib-esm/components/Menu/Menu.d.ts.map +1 -0
- package/lib-esm/components/Menu/Menu.js +3 -2
- package/lib-esm/components/Menu/Menu.js.map +1 -1
- package/lib-esm/components/Menu/MenuContext.d.ts +12 -5
- package/lib-esm/components/Menu/MenuContext.d.ts.map +1 -0
- package/lib-esm/components/Menu/MenuContext.js.map +1 -1
- package/lib-esm/components/Menu/MenuItem.d.ts +3 -2
- package/lib-esm/components/Menu/MenuItem.d.ts.map +1 -0
- package/lib-esm/components/Menu/MenuItem.js +9 -5
- package/lib-esm/components/Menu/MenuItem.js.map +1 -1
- package/lib-esm/components/Menu/index.d.ts +1 -0
- package/lib-esm/components/Menu/index.d.ts.map +1 -0
- package/lib-esm/components/Menu/index.js.map +1 -1
- package/lib-esm/components/Modal/Modal.d.ts +1 -0
- package/lib-esm/components/Modal/Modal.d.ts.map +1 -0
- package/lib-esm/components/Modal/Modal.js +6 -4
- package/lib-esm/components/Modal/Modal.js.map +1 -1
- package/lib-esm/components/Modal/index.d.ts +1 -0
- package/lib-esm/components/Modal/index.d.ts.map +1 -0
- package/lib-esm/components/Modal/index.js.map +1 -1
- package/lib-esm/components/Notification/Notification.d.ts +1 -0
- package/lib-esm/components/Notification/Notification.d.ts.map +1 -0
- package/lib-esm/components/Notification/Notification.js +8 -4
- package/lib-esm/components/Notification/Notification.js.map +1 -1
- package/lib-esm/components/Notification/NotificationManager.d.ts +1 -0
- package/lib-esm/components/Notification/NotificationManager.d.ts.map +1 -0
- package/lib-esm/components/Notification/NotificationManager.js +11 -9
- 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/index.d.ts.map +1 -0
- package/lib-esm/components/Notification/index.js.map +1 -1
- package/lib-esm/components/Notification/style.d.ts +1 -0
- package/lib-esm/components/Notification/style.d.ts.map +1 -0
- package/lib-esm/components/Notification/style.js +10 -8
- package/lib-esm/components/Notification/style.js.map +1 -1
- package/lib-esm/components/Notification/types.d.ts +1 -0
- package/lib-esm/components/Notification/types.d.ts.map +1 -0
- package/lib-esm/components/Notification/types.js +0 -1
- package/lib-esm/components/Notification/types.js.map +1 -1
- package/lib-esm/components/Popover/Popover.d.ts +1 -0
- package/lib-esm/components/Popover/Popover.d.ts.map +1 -0
- package/lib-esm/components/Popover/Popover.js +20 -17
- package/lib-esm/components/Popover/Popover.js.map +1 -1
- package/lib-esm/components/Popover/index.d.ts +1 -0
- package/lib-esm/components/Popover/index.d.ts.map +1 -0
- package/lib-esm/components/Popover/index.js.map +1 -1
- package/lib-esm/components/Spinner/Spinner.d.ts +1 -0
- package/lib-esm/components/Spinner/Spinner.d.ts.map +1 -0
- package/lib-esm/components/Spinner/Spinner.js +10 -6
- package/lib-esm/components/Spinner/Spinner.js.map +1 -1
- package/lib-esm/components/Spinner/index.d.ts +1 -0
- package/lib-esm/components/Spinner/index.d.ts.map +1 -0
- package/lib-esm/components/Spinner/index.js.map +1 -1
- package/lib-esm/components/Stepper/Step.d.ts +1 -0
- package/lib-esm/components/Stepper/Step.d.ts.map +1 -0
- package/lib-esm/components/Stepper/Step.js +1 -0
- package/lib-esm/components/Stepper/Step.js.map +1 -1
- package/lib-esm/components/Stepper/Stepper.d.ts +4 -3
- package/lib-esm/components/Stepper/Stepper.d.ts.map +1 -0
- package/lib-esm/components/Stepper/Stepper.js +17 -9
- package/lib-esm/components/Stepper/Stepper.js.map +1 -1
- package/lib-esm/components/Stepper/index.d.ts +1 -0
- package/lib-esm/components/Stepper/index.d.ts.map +1 -0
- package/lib-esm/components/Stepper/index.js.map +1 -1
- package/lib-esm/components/Tabs/Tab.d.ts +1 -0
- package/lib-esm/components/Tabs/Tab.d.ts.map +1 -0
- package/lib-esm/components/Tabs/Tab.js.map +1 -1
- package/lib-esm/components/Tabs/Tabs.d.ts +6 -5
- package/lib-esm/components/Tabs/Tabs.d.ts.map +1 -0
- package/lib-esm/components/Tabs/Tabs.js +12 -9
- package/lib-esm/components/Tabs/Tabs.js.map +1 -1
- package/lib-esm/components/Tabs/index.d.ts +1 -0
- package/lib-esm/components/Tabs/index.d.ts.map +1 -0
- package/lib-esm/components/Tabs/index.js.map +1 -1
- package/lib-esm/components/Toast/Toast.d.ts +2 -0
- package/lib-esm/components/Toast/Toast.d.ts.map +1 -0
- package/lib-esm/components/Toast/Toast.js +9 -8
- package/lib-esm/components/Toast/Toast.js.map +1 -1
- package/lib-esm/components/Toast/ToastStory.d.ts +1 -0
- package/lib-esm/components/Toast/ToastStory.d.ts.map +1 -0
- package/lib-esm/components/Toast/ToastStory.js +1 -1
- package/lib-esm/components/Toast/ToastStory.js.map +1 -1
- package/lib-esm/components/Toast/index.d.ts +1 -0
- package/lib-esm/components/Toast/index.d.ts.map +1 -0
- package/lib-esm/components/Toast/index.js.map +1 -1
- package/lib-esm/components/Tooltip/Tooltip.d.ts +1 -0
- package/lib-esm/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/lib-esm/components/Tooltip/Tooltip.js +5 -6
- package/lib-esm/components/Tooltip/Tooltip.js.map +1 -1
- package/lib-esm/components/Tooltip/index.d.ts +1 -0
- package/lib-esm/components/Tooltip/index.d.ts.map +1 -0
- package/lib-esm/components/Tooltip/index.js.map +1 -1
- package/lib-esm/components/index.d.ts +2 -0
- package/lib-esm/components/index.d.ts.map +1 -0
- package/lib-esm/components/index.js +1 -0
- package/lib-esm/components/index.js.map +1 -1
- package/lib-esm/icons/CheckCircle.d.ts +2 -1
- package/lib-esm/icons/CheckCircle.d.ts.map +1 -0
- package/lib-esm/icons/CheckCircle.js +1 -1
- package/lib-esm/icons/CheckCircle.js.map +1 -1
- package/lib-esm/icons/Close.d.ts +2 -1
- package/lib-esm/icons/Close.d.ts.map +1 -0
- package/lib-esm/icons/Close.js +1 -1
- package/lib-esm/icons/Close.js.map +1 -1
- package/lib-esm/icons/DragIndicator.d.ts +2 -1
- package/lib-esm/icons/DragIndicator.d.ts.map +1 -0
- package/lib-esm/icons/DragIndicator.js +1 -1
- package/lib-esm/icons/DragIndicator.js.map +1 -1
- package/lib-esm/icons/ErrorOutline.d.ts +2 -1
- package/lib-esm/icons/ErrorOutline.d.ts.map +1 -0
- package/lib-esm/icons/ErrorOutline.js +1 -1
- package/lib-esm/icons/ErrorOutline.js.map +1 -1
- package/lib-esm/icons/ExpandMore.d.ts +2 -1
- package/lib-esm/icons/ExpandMore.d.ts.map +1 -0
- package/lib-esm/icons/ExpandMore.js +1 -1
- package/lib-esm/icons/ExpandMore.js.map +1 -1
- package/lib-esm/icons/FiberManualRecord.d.ts +2 -1
- package/lib-esm/icons/FiberManualRecord.d.ts.map +1 -0
- package/lib-esm/icons/FiberManualRecord.js +1 -1
- package/lib-esm/icons/FiberManualRecord.js.map +1 -1
- package/lib-esm/icons/Info.d.ts +2 -1
- package/lib-esm/icons/Info.d.ts.map +1 -0
- package/lib-esm/icons/Info.js +1 -1
- package/lib-esm/icons/Info.js.map +1 -1
- package/lib-esm/icons/ReportProblem.d.ts +2 -1
- package/lib-esm/icons/ReportProblem.d.ts.map +1 -0
- package/lib-esm/icons/ReportProblem.js +1 -1
- package/lib-esm/icons/ReportProblem.js.map +1 -1
- package/lib-esm/icons/index.d.ts +1 -0
- package/lib-esm/icons/index.d.ts.map +1 -0
- package/lib-esm/icons/index.js.map +1 -1
- package/lib-esm/index.d.ts +1 -0
- package/lib-esm/index.d.ts.map +1 -0
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/shared/LayerManager.d.ts +29 -2
- package/lib-esm/shared/LayerManager.d.ts.map +1 -0
- package/lib-esm/shared/LayerManager.js +95 -45
- package/lib-esm/shared/LayerManager.js.map +1 -1
- package/lib-esm/shared/constants.d.ts +1 -0
- package/lib-esm/shared/constants.d.ts.map +1 -0
- package/lib-esm/shared/constants.js.map +1 -1
- package/lib-esm/shared/styles.d.ts +1 -0
- package/lib-esm/shared/styles.d.ts.map +1 -0
- package/lib-esm/shared/styles.js.map +1 -1
- package/package.json +93 -74
package/dist/index.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var PropTypes = require('prop-types');
|
|
6
|
-
var styled = require('@emotion/styled');
|
|
7
6
|
var react = require('@emotion/react');
|
|
7
|
+
var styled = require('@emotion/styled');
|
|
8
8
|
var ReactDOM = require('react-dom');
|
|
9
|
+
var client = require('react-dom/client');
|
|
9
10
|
|
|
10
11
|
function Accordion(props) {
|
|
11
12
|
const [active, setActive] = React.useState(props.active);
|
|
@@ -22,9 +23,12 @@ function Accordion(props) {
|
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
25
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: React.Children.map(props.children, (child, index) => {
|
|
26
|
+
if (!React.isValidElement(child)) {
|
|
27
|
+
return child;
|
|
28
|
+
}
|
|
25
29
|
return React.cloneElement(child, {
|
|
26
30
|
open: active === index,
|
|
27
|
-
onStepClick: onStepClick(index, child.props.disabled)
|
|
31
|
+
onStepClick: onStepClick(index, child.props.disabled),
|
|
28
32
|
});
|
|
29
33
|
}) }));
|
|
30
34
|
}
|
|
@@ -32,12 +36,44 @@ Accordion.propTypes = {
|
|
|
32
36
|
/** Currently opened step */
|
|
33
37
|
active: PropTypes.number,
|
|
34
38
|
/** Handler for click event on a step */
|
|
35
|
-
onStepClick: PropTypes.func
|
|
39
|
+
onStepClick: PropTypes.func,
|
|
36
40
|
};
|
|
37
41
|
Accordion.defaultProps = {
|
|
38
42
|
active: -1,
|
|
39
43
|
};
|
|
40
44
|
|
|
45
|
+
function CheckCircle$4(props) {
|
|
46
|
+
return (jsxRuntime.jsxs("svg", Object.assign({ height: "24", viewBox: "0 0 24 24", width: "24", fill: "currentColor" }, props, { children: [jsxRuntime.jsx("path", { d: "M0 0h24v24H0V0zm0 0h24v24H0V0z", fill: "none" }), jsxRuntime.jsx("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" })] })));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function ExpandMore(props) {
|
|
50
|
+
return (jsxRuntime.jsxs("svg", Object.assign({ viewBox: "0 0 24 24", width: "18px", height: "18px", fill: "currentColor" }, props, { children: [jsxRuntime.jsx("path", { d: "M0 0h24v24H0z", fill: "none" }), jsxRuntime.jsx("path", { d: "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" })] })));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function FiberManualRecord(props) {
|
|
54
|
+
return (jsxRuntime.jsxs("svg", Object.assign({ height: "24", viewBox: "0 0 24 24", width: "24", fill: "currentColor" }, props, { children: [jsxRuntime.jsx("path", { d: "M24 24H0V0h24v24z", fill: "none" }), jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "8" })] })));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function Close(props) {
|
|
58
|
+
return (jsxRuntime.jsxs("svg", Object.assign({ height: "24", viewBox: "0 0 24 24", width: "24", fill: "currentColor" }, props, { children: [jsxRuntime.jsx("path", { d: "M0 0h24v24H0V0z", fill: "none" }), jsxRuntime.jsx("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" })] })));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function CheckCircle$3(props) {
|
|
62
|
+
return (jsxRuntime.jsxs("svg", Object.assign({ height: "24", viewBox: "0 0 24 24", width: "24", fill: "currentColor" }, props, { children: [jsxRuntime.jsx("path", { d: "M0 0h24v24H0V0z", fill: "none" }), jsxRuntime.jsx("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" })] })));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function CheckCircle$2(props) {
|
|
66
|
+
return (jsxRuntime.jsxs("svg", Object.assign({ height: "24", viewBox: "0 0 24 24", width: "24", fill: "currentColor" }, props, { children: [jsxRuntime.jsx("path", { d: "M0 0h24v24H0V0z", fill: "none" }), jsxRuntime.jsx("path", { d: "M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z" })] })));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function CheckCircle$1(props) {
|
|
70
|
+
return (jsxRuntime.jsx("svg", Object.assign({ height: "24", viewBox: "0 0 24 24", width: "24", fill: "currentColor" }, props, { children: jsxRuntime.jsx("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" }) })));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function CheckCircle(props) {
|
|
74
|
+
return (jsxRuntime.jsxs("svg", Object.assign({ height: "24", viewBox: "0 0 24 24", width: "24", fill: "currentColor" }, props, { children: [jsxRuntime.jsx("path", { d: "M0 0h24v24H0V0z", fill: "none" }), jsxRuntime.jsx("path", { d: "M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" })] })));
|
|
75
|
+
}
|
|
76
|
+
|
|
41
77
|
var constants = {
|
|
42
78
|
PRIMARY: '#2283d2',
|
|
43
79
|
PRIMARY_LIGHT: '#64baff',
|
|
@@ -65,17 +101,6 @@ var constants = {
|
|
|
65
101
|
MODAL_SHADOW: '0px 8px 17px 2px rgba(0,0,0,0.14), 0px 3px 14px 2px rgba(0,0,0,0.12), 0px 5px 5px -3px rgba(0,0,0,0.2)',
|
|
66
102
|
};
|
|
67
103
|
|
|
68
|
-
const Card = styled.div `
|
|
69
|
-
border-radius: 10px;
|
|
70
|
-
background-color: var(--background, ${constants.BACKGROUND});
|
|
71
|
-
${props => props.elevated
|
|
72
|
-
? `box-shadow: var(--modal-shadow, ${constants.MODAL_SHADOW});`
|
|
73
|
-
: `box-shadow: var(--shadow, ${constants.SHADOW});`}
|
|
74
|
-
margin: 5px;
|
|
75
|
-
overflow: auto;
|
|
76
|
-
position: relative;
|
|
77
|
-
`;
|
|
78
|
-
|
|
79
104
|
const Ellipsis = styled.span `
|
|
80
105
|
white-space: nowrap;
|
|
81
106
|
text-overflow: ellipsis;
|
|
@@ -100,38 +125,6 @@ const Footer$1 = styled.div `
|
|
|
100
125
|
justify-content: flex-end;
|
|
101
126
|
`;
|
|
102
127
|
|
|
103
|
-
function CheckCircle$4(props) {
|
|
104
|
-
return (jsxRuntime.jsxs("svg", Object.assign({ height: "24", viewBox: "0 0 24 24", width: "24", fill: 'currentColor' }, props, { children: [jsxRuntime.jsx("path", { d: "M0 0h24v24H0V0zm0 0h24v24H0V0z", fill: "none" }), jsxRuntime.jsx("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" })] })));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function ExpandMore(props) {
|
|
108
|
-
return (jsxRuntime.jsxs("svg", Object.assign({ viewBox: "0 0 24 24", width: "18px", height: "18px", fill: 'currentColor' }, props, { children: [jsxRuntime.jsx("path", { d: "M0 0h24v24H0z", fill: "none" }), jsxRuntime.jsx("path", { d: "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" })] })));
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function FiberManualRecord(props) {
|
|
112
|
-
return (jsxRuntime.jsxs("svg", Object.assign({ height: "24", viewBox: "0 0 24 24", width: "24", fill: 'currentColor' }, props, { children: [jsxRuntime.jsx("path", { d: "M24 24H0V0h24v24z", fill: "none" }), jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "8" })] })));
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function Close(props) {
|
|
116
|
-
return (jsxRuntime.jsxs("svg", Object.assign({ height: "24", viewBox: "0 0 24 24", width: "24", fill: 'currentColor' }, props, { children: [jsxRuntime.jsx("path", { d: "M0 0h24v24H0V0z", fill: "none" }), jsxRuntime.jsx("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" })] })));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function CheckCircle$3(props) {
|
|
120
|
-
return (jsxRuntime.jsxs("svg", Object.assign({ height: "24", viewBox: "0 0 24 24", width: "24", fill: 'currentColor' }, props, { children: [jsxRuntime.jsx("path", { d: "M0 0h24v24H0V0z", fill: "none" }), jsxRuntime.jsx("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" })] })));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function CheckCircle$2(props) {
|
|
124
|
-
return (jsxRuntime.jsxs("svg", Object.assign({ height: "24", viewBox: "0 0 24 24", width: "24", fill: 'currentColor' }, props, { children: [jsxRuntime.jsx("path", { d: "M0 0h24v24H0V0z", fill: "none" }), jsxRuntime.jsx("path", { d: "M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z" })] })));
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function CheckCircle$1(props) {
|
|
128
|
-
return (jsxRuntime.jsx("svg", Object.assign({ height: "24", viewBox: "0 0 24 24", width: "24", fill: 'currentColor' }, props, { children: jsxRuntime.jsx("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" }) })));
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function CheckCircle(props) {
|
|
132
|
-
return (jsxRuntime.jsxs("svg", Object.assign({ height: "24", viewBox: "0 0 24 24", width: "24", fill: 'currentColor' }, props, { children: [jsxRuntime.jsx("path", { d: "M0 0h24v24H0V0z", fill: "none" }), jsxRuntime.jsx("path", { d: "M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" })] })));
|
|
133
|
-
}
|
|
134
|
-
|
|
135
128
|
exports.BADGE_TYPE = void 0;
|
|
136
129
|
(function (BADGE_TYPE) {
|
|
137
130
|
BADGE_TYPE["PRIMARY"] = "primary";
|
|
@@ -141,7 +134,7 @@ exports.BADGE_TYPE = void 0;
|
|
|
141
134
|
BADGE_TYPE["DISABLED"] = "disabled";
|
|
142
135
|
})(exports.BADGE_TYPE || (exports.BADGE_TYPE = {}));
|
|
143
136
|
const BadgeSpan = styled.span `
|
|
144
|
-
background-color: ${props => {
|
|
137
|
+
background-color: ${(props) => {
|
|
145
138
|
switch (props.type) {
|
|
146
139
|
case exports.BADGE_TYPE.SUCCESS:
|
|
147
140
|
return `var(--success, ${constants.SUCCESS})`;
|
|
@@ -157,14 +150,14 @@ const BadgeSpan = styled.span `
|
|
|
157
150
|
}};
|
|
158
151
|
color: #fff;
|
|
159
152
|
border-radius: 10px;
|
|
160
|
-
padding: ${props => props.children ? '3px 10px' : '4px'};
|
|
153
|
+
padding: ${(props) => (props.children ? '3px 10px' : '4px')};
|
|
161
154
|
display: inline-block;
|
|
162
155
|
min-height: 4px;
|
|
163
156
|
min-width: 4px;
|
|
164
157
|
font-size: 12px;
|
|
165
|
-
margin: ${props => props.inline ? '0 5px' : '0'};
|
|
158
|
+
margin: ${(props) => (props.inline ? '0 5px' : '0')};
|
|
166
159
|
|
|
167
|
-
${props => !props.inline && 'position: absolute; top: 0; right: 0; transform: translate(50%, -50%);'};
|
|
160
|
+
${(props) => !props.inline && 'position: absolute; top: 0; right: 0; transform: translate(50%, -50%);'};
|
|
168
161
|
`;
|
|
169
162
|
function Badge(props) {
|
|
170
163
|
return jsxRuntime.jsx(BadgeSpan, Object.assign({}, props));
|
|
@@ -187,32 +180,48 @@ Badge.defaultProps = {
|
|
|
187
180
|
type: exports.BADGE_TYPE.PRIMARY,
|
|
188
181
|
};
|
|
189
182
|
|
|
183
|
+
const Card = styled.div `
|
|
184
|
+
border-radius: 10px;
|
|
185
|
+
background-color: var(--background, ${constants.BACKGROUND});
|
|
186
|
+
${(props) => props.elevated
|
|
187
|
+
? `box-shadow: var(--modal-shadow, ${constants.MODAL_SHADOW});`
|
|
188
|
+
: `box-shadow: var(--shadow, ${constants.SHADOW});`}
|
|
189
|
+
margin: 5px;
|
|
190
|
+
overflow: auto;
|
|
191
|
+
position: relative;
|
|
192
|
+
`;
|
|
193
|
+
|
|
190
194
|
const Step$1 = styled(Card) `
|
|
191
|
-
transition: all .6s ease;
|
|
195
|
+
transition: all 0.6s ease;
|
|
192
196
|
|
|
193
|
-
${props => props.open &&
|
|
197
|
+
${(props) => props.open &&
|
|
198
|
+
`
|
|
194
199
|
margin: 20px 5px;
|
|
195
200
|
`}
|
|
196
201
|
|
|
197
|
-
${props => props.focused && `box-shadow: 0 0 0 4px var(--primary-light, ${constants.PRIMARY_LIGHT});`}
|
|
202
|
+
${(props) => props.focused && `box-shadow: 0 0 0 4px var(--primary-light, ${constants.PRIMARY_LIGHT});`}
|
|
198
203
|
`;
|
|
199
204
|
const StepHeader = styled.div `
|
|
200
205
|
padding: 20px 15px;
|
|
201
206
|
display: flex;
|
|
202
207
|
justify-content: space-between;
|
|
203
|
-
|
|
208
|
+
|
|
204
209
|
& input {
|
|
205
210
|
appearance: none;
|
|
206
211
|
margin: 0;
|
|
207
212
|
}
|
|
208
213
|
|
|
209
|
-
${props => props.open
|
|
214
|
+
${(props) => props.open
|
|
215
|
+
? `
|
|
210
216
|
border-bottom: 1px solid var(--border-light-color, ${constants.BORDER_LIGHT_COLOR});
|
|
211
|
-
`
|
|
217
|
+
`
|
|
218
|
+
: ''}
|
|
212
219
|
|
|
213
|
-
${props => props.disabled
|
|
220
|
+
${(props) => props.disabled
|
|
221
|
+
? `
|
|
214
222
|
color: ${constants.LIGHT_GREY};
|
|
215
|
-
`
|
|
223
|
+
`
|
|
224
|
+
: `
|
|
216
225
|
cursor: pointer;
|
|
217
226
|
`}
|
|
218
227
|
`;
|
|
@@ -224,13 +233,13 @@ const HeaderContainer = styled.div `
|
|
|
224
233
|
& svg {
|
|
225
234
|
vertical-align: top;
|
|
226
235
|
margin-right: 10px;
|
|
227
|
-
fill: ${props => props.open
|
|
236
|
+
fill: ${(props) => props.open
|
|
228
237
|
? `var(--primary, ${constants.PRIMARY})`
|
|
229
238
|
: props.completed
|
|
230
239
|
? `var(--success, ${constants.SUCCESS})`
|
|
231
240
|
: constants.LIGHT_GREY};
|
|
232
|
-
transform: ${props => props.open ? 'scale(0.8)' : 'scale(0.6)'};
|
|
233
|
-
transition: all .3s ease;
|
|
241
|
+
transform: ${(props) => (props.open ? 'scale(0.8)' : 'scale(0.6)')};
|
|
242
|
+
transition: all 0.3s ease;
|
|
234
243
|
min-width: 24px;
|
|
235
244
|
}
|
|
236
245
|
`;
|
|
@@ -241,20 +250,22 @@ const ExpandContainer = styled.div `
|
|
|
241
250
|
& svg {
|
|
242
251
|
vertical-align: top;
|
|
243
252
|
margin-right: 10px;
|
|
244
|
-
transition: all .6s ease;
|
|
253
|
+
transition: all 0.6s ease;
|
|
245
254
|
fill: currentColor;
|
|
246
255
|
}
|
|
247
256
|
|
|
248
|
-
${props => props.open
|
|
257
|
+
${(props) => props.open
|
|
258
|
+
? `
|
|
249
259
|
& svg {
|
|
250
260
|
transform: rotate(180deg);
|
|
251
261
|
}
|
|
252
|
-
`
|
|
262
|
+
`
|
|
263
|
+
: ''}
|
|
253
264
|
`;
|
|
254
265
|
const StepBody = styled.div `
|
|
255
|
-
transition: all .6s ease;
|
|
266
|
+
transition: all 0.6s ease;
|
|
256
267
|
overflow: hidden;
|
|
257
|
-
height: ${props => props.height || 0}px;
|
|
268
|
+
height: ${(props) => props.height || 0}px;
|
|
258
269
|
`;
|
|
259
270
|
const AccordionStepBody = styled.div `
|
|
260
271
|
padding: 20px 15px;
|
|
@@ -273,7 +284,9 @@ function AccordionStep(props) {
|
|
|
273
284
|
const toggleFocus = () => {
|
|
274
285
|
setFocused(!focused);
|
|
275
286
|
};
|
|
276
|
-
return (jsxRuntime.jsxs(Step$1, Object.assign({}, props, { focused: focused, elevated: props.open, children: [jsxRuntime.jsxs(StepHeader, { open: open, disabled: disabled, onClick: onStepClick, children: [jsxRuntime.jsxs(HeaderContainer, { open: open, completed: completed, children: [jsxRuntime.jsx("input", { type:
|
|
287
|
+
return (jsxRuntime.jsxs(Step$1, Object.assign({}, props, { focused: focused, elevated: props.open, children: [jsxRuntime.jsxs(StepHeader, { open: open, disabled: disabled, onClick: onStepClick, children: [jsxRuntime.jsxs(HeaderContainer, { open: open, completed: completed, children: [jsxRuntime.jsx("input", { type: "checkbox", checked: open, disabled: disabled, onFocus: toggleFocus, onBlur: toggleFocus }), jsxRuntime.jsx(FiberManualRecord, {}), jsxRuntime.jsx(Ellipsis, { children: header })] }), jsxRuntime.jsxs(ExpandContainer, { open: open, children: [errorText && (jsxRuntime.jsx(Badge, { css: react.css `
|
|
288
|
+
margin-right: 15px;
|
|
289
|
+
`, inline: true, type: exports.BADGE_TYPE.DANGER, children: errorText })), jsxRuntime.jsx(ExpandMore, {})] })] }), jsxRuntime.jsx(StepBody, { ref: ref, height: open ? height : 0, children: open && props.children })] })));
|
|
277
290
|
}
|
|
278
291
|
AccordionStep.propTypes = {
|
|
279
292
|
/** Header text for the step */
|
|
@@ -287,7 +300,7 @@ AccordionStep.propTypes = {
|
|
|
287
300
|
};
|
|
288
301
|
AccordionStep.defaultProps = {
|
|
289
302
|
completed: false,
|
|
290
|
-
disabled: false
|
|
303
|
+
disabled: false,
|
|
291
304
|
};
|
|
292
305
|
|
|
293
306
|
var Button$2 = styled.button `
|
|
@@ -354,7 +367,8 @@ var LinkButton = styled.button `
|
|
|
354
367
|
margin-left: -6px;
|
|
355
368
|
}
|
|
356
369
|
|
|
357
|
-
&:enabled:hover,
|
|
370
|
+
&:enabled:hover,
|
|
371
|
+
&:focus {
|
|
358
372
|
text-decoration: underline;
|
|
359
373
|
}
|
|
360
374
|
|
|
@@ -560,6 +574,478 @@ function Chip(props) {
|
|
|
560
574
|
return (jsxRuntime.jsxs(Container$8, Object.assign({}, rest, { onKeyUp: keyUpHandler, children: [label, jsxRuntime.jsx(Button$1, { onClick: onCloseClick, "aria-label": `Remove ${label}`, children: jsxRuntime.jsx(Close, { height: 20, width: 20 }) })] })));
|
|
561
575
|
}
|
|
562
576
|
|
|
577
|
+
exports.ORIENTATION = void 0;
|
|
578
|
+
(function (ORIENTATION) {
|
|
579
|
+
ORIENTATION["HORIZONTAL"] = "horizontal";
|
|
580
|
+
ORIENTATION["VERTICAL"] = "vertical";
|
|
581
|
+
})(exports.ORIENTATION || (exports.ORIENTATION = {}));
|
|
582
|
+
const DragContext = React.createContext(null);
|
|
583
|
+
|
|
584
|
+
/** Styled component for the draggable item container */
|
|
585
|
+
const Item = styled.div `
|
|
586
|
+
cursor: ${(props) => (props.showIndicator ? 'default' : 'move')};
|
|
587
|
+
display: flex;
|
|
588
|
+
user-select: ${(props) => (props.showIndicator ? 'auto' : 'none')};
|
|
589
|
+
border-top: 2px solid
|
|
590
|
+
${(props) => props.orientation === exports.ORIENTATION.VERTICAL && props.active > 0
|
|
591
|
+
? constants.PRIMARY
|
|
592
|
+
: 'transparent'};
|
|
593
|
+
border-bottom: 2px solid
|
|
594
|
+
${(props) => props.orientation === exports.ORIENTATION.VERTICAL && props.active < 0
|
|
595
|
+
? constants.PRIMARY
|
|
596
|
+
: 'transparent'};
|
|
597
|
+
border-left: 2px solid
|
|
598
|
+
${(props) => props.orientation === exports.ORIENTATION.HORIZONTAL && props.active > 0
|
|
599
|
+
? constants.PRIMARY
|
|
600
|
+
: 'transparent'};
|
|
601
|
+
border-right: 2px solid
|
|
602
|
+
${(props) => props.orientation === exports.ORIENTATION.HORIZONTAL && props.active < 0
|
|
603
|
+
? constants.PRIMARY
|
|
604
|
+
: 'transparent'};
|
|
605
|
+
opacity: ${(props) => (props.dragging ? 0.5 : 1)};
|
|
606
|
+
`;
|
|
607
|
+
/** Styled component for the drag handle indicator */
|
|
608
|
+
const DragKnob = styled.div `
|
|
609
|
+
padding-top: 8px;
|
|
610
|
+
cursor: move;
|
|
611
|
+
touch-action: none;
|
|
612
|
+
color: var(--disabled, ${constants.DISABLED});
|
|
613
|
+
`;
|
|
614
|
+
/** Container for the children */
|
|
615
|
+
const Container$7 = styled.div `
|
|
616
|
+
flex: 1;
|
|
617
|
+
`;
|
|
618
|
+
/**
|
|
619
|
+
* A draggable item component that supports both mouse and touch interactions for drag-and-drop functionality.
|
|
620
|
+
*
|
|
621
|
+
* @component
|
|
622
|
+
* @example
|
|
623
|
+
* ```tsx
|
|
624
|
+
* <DragItem
|
|
625
|
+
* index={0}
|
|
626
|
+
* orientation={ORIENTATION.VERTICAL}
|
|
627
|
+
* showIndicator={true}
|
|
628
|
+
* dragOver={-1}
|
|
629
|
+
* >
|
|
630
|
+
* <div>Draggable content</div>
|
|
631
|
+
* </DragItem>
|
|
632
|
+
* ```
|
|
633
|
+
*
|
|
634
|
+
* @param props - The component props
|
|
635
|
+
* @param props.index - The position index of this item in the draggable list
|
|
636
|
+
* @param props.orientation - The orientation of the drag operation (VERTICAL or HORIZONTAL)
|
|
637
|
+
* @param props.showIndicator - Whether to show a drag handle indicator instead of making the entire item draggable
|
|
638
|
+
* @param props.dragOver - The index of the item currently being dragged over
|
|
639
|
+
* @param props.children - The content to be rendered inside the draggable item
|
|
640
|
+
*
|
|
641
|
+
* @remarks
|
|
642
|
+
* - Uses the DragContext to manage drag state across items
|
|
643
|
+
* - Provides visual feedback with borders during drag operations
|
|
644
|
+
* - Supports haptic feedback (vibration) on touch devices
|
|
645
|
+
* - For touch devices, requires a 200ms hold before drag starts
|
|
646
|
+
* - When showIndicator is true, only the drag handle can initiate drag operations
|
|
647
|
+
*
|
|
648
|
+
* @returns A draggable item with optional drag indicator and visual feedback
|
|
649
|
+
*/
|
|
650
|
+
function DragItem(props) {
|
|
651
|
+
const { index, orientation, children, showIndicator, dragOver } = props;
|
|
652
|
+
const [active, setActive] = React.useState(0);
|
|
653
|
+
const [touchTimer, setTouchTimer] = React.useState(null);
|
|
654
|
+
const context = React.useContext(DragContext);
|
|
655
|
+
/**
|
|
656
|
+
* Vibrate the device for haptic feedback
|
|
657
|
+
* @param duration Duration of the vibration in milliseconds
|
|
658
|
+
*/
|
|
659
|
+
const vibrate = (duration) => {
|
|
660
|
+
if (navigator.vibrate) {
|
|
661
|
+
navigator.vibrate(duration);
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
/**
|
|
665
|
+
* Drag start event handler
|
|
666
|
+
* @param e Event
|
|
667
|
+
*/
|
|
668
|
+
const dragStartHandler = () => {
|
|
669
|
+
context.setStartIndex(index);
|
|
670
|
+
context.setIsDragging(true);
|
|
671
|
+
};
|
|
672
|
+
/**
|
|
673
|
+
* Drag over event handler
|
|
674
|
+
* @param e Event
|
|
675
|
+
*/
|
|
676
|
+
const dragOverHandler = (e) => {
|
|
677
|
+
e.preventDefault();
|
|
678
|
+
e.stopPropagation();
|
|
679
|
+
setActive(context.startIndex - index);
|
|
680
|
+
};
|
|
681
|
+
/**
|
|
682
|
+
* Drag leave event handler
|
|
683
|
+
*/
|
|
684
|
+
const dragExitHandler = () => {
|
|
685
|
+
setActive(0);
|
|
686
|
+
};
|
|
687
|
+
/**
|
|
688
|
+
* Drop event handler
|
|
689
|
+
* @param e Event
|
|
690
|
+
*/
|
|
691
|
+
const dropHandler = (e) => {
|
|
692
|
+
e.preventDefault();
|
|
693
|
+
setActive(0);
|
|
694
|
+
context.drop(index);
|
|
695
|
+
context.setIsDragging(false);
|
|
696
|
+
};
|
|
697
|
+
/**
|
|
698
|
+
* Touch start event handler
|
|
699
|
+
* @param e Event
|
|
700
|
+
*/
|
|
701
|
+
const touchStartHandler = () => {
|
|
702
|
+
const timer = setTimeout(() => {
|
|
703
|
+
context.setStartIndex(index);
|
|
704
|
+
context.setIsDragging(true);
|
|
705
|
+
context.setDragOver(index);
|
|
706
|
+
document.body.style.overflow = 'hidden';
|
|
707
|
+
vibrate(50);
|
|
708
|
+
}, 200);
|
|
709
|
+
setTouchTimer(timer);
|
|
710
|
+
};
|
|
711
|
+
/**
|
|
712
|
+
* Touch move event handler
|
|
713
|
+
* @param e Event
|
|
714
|
+
* @returns void
|
|
715
|
+
*/
|
|
716
|
+
const touchMoveHandler = (e) => {
|
|
717
|
+
var _a;
|
|
718
|
+
const touch = e.touches[0];
|
|
719
|
+
if (!touch)
|
|
720
|
+
return;
|
|
721
|
+
if (context.isDragging) {
|
|
722
|
+
e.preventDefault();
|
|
723
|
+
// get the element under the touch point
|
|
724
|
+
const el = document.elementFromPoint(touch.clientX, touch.clientY);
|
|
725
|
+
const overAttr = (_a = el === null || el === void 0 ? void 0 : el.closest('[data-drag-index]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-drag-index');
|
|
726
|
+
const overIndex = overAttr != null ? parseInt(overAttr, 10) : null;
|
|
727
|
+
// if we know which index we're over, update visual state
|
|
728
|
+
if (overIndex !== null) {
|
|
729
|
+
context.setDragOver(overIndex);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
else if (touchTimer) {
|
|
733
|
+
clearTimeout(touchTimer);
|
|
734
|
+
setTouchTimer(null);
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
/**
|
|
738
|
+
* Touch end event handler
|
|
739
|
+
* @param e Event
|
|
740
|
+
*/
|
|
741
|
+
const touchEndHandler = () => {
|
|
742
|
+
if (touchTimer) {
|
|
743
|
+
clearTimeout(touchTimer);
|
|
744
|
+
setTouchTimer(null);
|
|
745
|
+
}
|
|
746
|
+
if (context.isDragging) {
|
|
747
|
+
context.drop(dragOver);
|
|
748
|
+
vibrate(50);
|
|
749
|
+
context.setIsDragging(false);
|
|
750
|
+
document.body.style.overflow = 'auto';
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
/** Cleanup touch timer on unmount */
|
|
754
|
+
React.useEffect(() => {
|
|
755
|
+
return () => {
|
|
756
|
+
if (touchTimer)
|
|
757
|
+
clearTimeout(touchTimer);
|
|
758
|
+
document.body.style.overflow = 'auto';
|
|
759
|
+
};
|
|
760
|
+
}, [touchTimer]);
|
|
761
|
+
/** Update active state based on dragOver changes */
|
|
762
|
+
React.useEffect(() => {
|
|
763
|
+
if (context.isDragging && dragOver === index) {
|
|
764
|
+
setActive(context.startIndex - index);
|
|
765
|
+
}
|
|
766
|
+
else {
|
|
767
|
+
setActive(0);
|
|
768
|
+
}
|
|
769
|
+
}, [dragOver, context.startIndex, index, context.isDragging]);
|
|
770
|
+
return (jsxRuntime.jsxs(Item, { draggable: !showIndicator, showIndicator: showIndicator, active: active, dragging: context.isDragging && context.startIndex === index, orientation: orientation, "data-drag-index": index, onDragStart: !showIndicator ? dragStartHandler : undefined, onDragOver: dragOverHandler, onDragLeave: dragExitHandler, onDrop: dropHandler, onTouchStart: !showIndicator ? touchStartHandler : undefined, onTouchMove: touchMoveHandler, onTouchEnd: touchEndHandler, onTouchCancel: touchEndHandler, children: [showIndicator && (jsxRuntime.jsx(DragKnob, { draggable: true, onDragStart: dragStartHandler, onTouchStart: touchStartHandler, children: jsxRuntime.jsx(CheckCircle, {}) })), jsxRuntime.jsx(Container$7, { children: children })] }));
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/** Container Component */
|
|
774
|
+
const Container$6 = styled.div `
|
|
775
|
+
flex: 1;
|
|
776
|
+
display: flex;
|
|
777
|
+
position: relative;
|
|
778
|
+
flex-wrap: wrap;
|
|
779
|
+
flex-direction: ${(props) => (props.orientation === exports.ORIENTATION.HORIZONTAL ? 'row' : 'column')};
|
|
780
|
+
`;
|
|
781
|
+
/**
|
|
782
|
+
* A drag and drop container component that enables reordering of child elements.
|
|
783
|
+
*
|
|
784
|
+
* @component
|
|
785
|
+
* @example
|
|
786
|
+
* ```tsx
|
|
787
|
+
* <DragAndDrop
|
|
788
|
+
* orientation={ORIENTATION.VERTICAL}
|
|
789
|
+
* onDrop={(start, end) => handleReorder(start, end)}
|
|
790
|
+
* showIndicator={true}
|
|
791
|
+
* >
|
|
792
|
+
* <div>Item 1</div>
|
|
793
|
+
* <div>Item 2</div>
|
|
794
|
+
* <div>Item 3</div>
|
|
795
|
+
* </DragAndDrop>
|
|
796
|
+
* ```
|
|
797
|
+
*
|
|
798
|
+
* @param {DragAndDropProps} props - The component props
|
|
799
|
+
* @param {ORIENTATION} props.orientation - Determines the layout direction (horizontal or vertical). Defaults to VERTICAL.
|
|
800
|
+
* @param {(start: number, end: number) => void} props.onDrop - Callback fired when an item is dropped, receives the start and end indices
|
|
801
|
+
* @param {boolean} props.showIndicator - Whether to display drag indicators for each list item. Defaults to false.
|
|
802
|
+
* @param {React.ReactNode} props.children - Child elements to be rendered as draggable items
|
|
803
|
+
*
|
|
804
|
+
* @returns {JSX.Element} A draggable container with reorderable items
|
|
805
|
+
*/
|
|
806
|
+
function DragAndDrop(props) {
|
|
807
|
+
const { orientation, children, onDrop, showIndicator } = props;
|
|
808
|
+
const [startIndex, setStartIndex] = React.useState(null);
|
|
809
|
+
const [isDragging, setIsDragging] = React.useState(false);
|
|
810
|
+
const [dragOver, setDragOver] = React.useState(null);
|
|
811
|
+
/**
|
|
812
|
+
* Drop handler invoked when a draggable item is released.
|
|
813
|
+
* @param index
|
|
814
|
+
*/
|
|
815
|
+
const drop = (index) => {
|
|
816
|
+
if (startIndex !== null) {
|
|
817
|
+
onDrop === null || onDrop === void 0 ? void 0 : onDrop(startIndex, index);
|
|
818
|
+
}
|
|
819
|
+
setStartIndex(null);
|
|
820
|
+
setIsDragging(false);
|
|
821
|
+
};
|
|
822
|
+
return (jsxRuntime.jsx(DragContext.Provider, { value: { startIndex, setStartIndex, drop, isDragging, setIsDragging, setDragOver }, children: jsxRuntime.jsx(Container$6, { orientation: orientation, children: React.Children.map(children, (child, index) => (jsxRuntime.jsx(DragItem, { index: index, orientation: orientation, showIndicator: showIndicator, dragOver: dragOver, children: child }))) }) }));
|
|
823
|
+
}
|
|
824
|
+
DragAndDrop.defaultProps = {
|
|
825
|
+
/** Orientation of the list layout */
|
|
826
|
+
orientation: exports.ORIENTATION.VERTICAL,
|
|
827
|
+
/** Whether to display drag indicators for each list item */
|
|
828
|
+
showIndicator: false,
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
// Label component for the ChipInput
|
|
832
|
+
const Label$6 = styled.label `
|
|
833
|
+
display: inline-flex;
|
|
834
|
+
flex-direction: column;
|
|
835
|
+
flex: 1;
|
|
836
|
+
position: relative;
|
|
837
|
+
margin: 10px 5px;
|
|
838
|
+
color: inherit;
|
|
839
|
+
padding: 0 8px;
|
|
840
|
+
width: 250px;
|
|
841
|
+
border-radius: 3px;
|
|
842
|
+
border: 1px solid var(--border-color, ${constants.BORDER_COLOR});
|
|
843
|
+
background-color: var(--background, ${constants.BACKGROUND});
|
|
844
|
+
|
|
845
|
+
/** Focused */
|
|
846
|
+
&:has(:focus),
|
|
847
|
+
&:has(:active) {
|
|
848
|
+
border-color: var(--primary, ${constants.PRIMARY});
|
|
849
|
+
box-shadow: 0 0 0 4px var(--primary-light, ${constants.PRIMARY_LIGHT});
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
&:has(:focus) > span,
|
|
853
|
+
&:has(:active) > span {
|
|
854
|
+
color: var(--primary, ${constants.PRIMARY});
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/** Disabled */
|
|
858
|
+
&:has(:disabled) {
|
|
859
|
+
border-color: var(--disabled-border, ${constants.DISABLED_BORDER});
|
|
860
|
+
background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
&:has(:disabled) > span {
|
|
864
|
+
color: #777;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/** Invalid */
|
|
868
|
+
&:has(:focus:invalid) {
|
|
869
|
+
border-color: var(--error, ${constants.ERROR});
|
|
870
|
+
box-shadow: 0 0 0 4px var(--error-light, ${constants.ERROR_LIGHT});
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
${(props) => props.touched
|
|
874
|
+
? `
|
|
875
|
+
&:has(:invalid) {
|
|
876
|
+
border-color: var(--error, ${constants.ERROR});
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
&:has(:invalid) > span {
|
|
880
|
+
color: var(--error, ${constants.ERROR});
|
|
881
|
+
}
|
|
882
|
+
`
|
|
883
|
+
: ''}
|
|
884
|
+
|
|
885
|
+
/** Error */
|
|
886
|
+
${(props) => props.errorText
|
|
887
|
+
? `
|
|
888
|
+
border-color: var(--error, ${constants.ERROR});
|
|
889
|
+
|
|
890
|
+
& > span {
|
|
891
|
+
color: var(--error, ${constants.ERROR});
|
|
892
|
+
}
|
|
893
|
+
`
|
|
894
|
+
: ''}
|
|
895
|
+
|
|
896
|
+
/** Required */
|
|
897
|
+
&:has(:required) > span:after {
|
|
898
|
+
content: '*';
|
|
899
|
+
margin-left: 2px;
|
|
900
|
+
color: var(--error, ${constants.ERROR});
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
& > input {
|
|
904
|
+
border: none;
|
|
905
|
+
outline: none;
|
|
906
|
+
width: 100%;
|
|
907
|
+
line-height: 30px;
|
|
908
|
+
min-height: 30px;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
/** Label Animation */
|
|
912
|
+
& > span {
|
|
913
|
+
position: absolute;
|
|
914
|
+
padding: 0 5px;
|
|
915
|
+
top: 0px;
|
|
916
|
+
left: 4px;
|
|
917
|
+
font-size: 14px;
|
|
918
|
+
line-height: 32px;
|
|
919
|
+
transition: all 300ms ease;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
&:has(:focus) > span,
|
|
923
|
+
&:has(:placeholder-shown) > span {
|
|
924
|
+
top: -8px;
|
|
925
|
+
background: var(--background, ${constants.BACKGROUND});
|
|
926
|
+
font-size: 12px;
|
|
927
|
+
line-height: 14px;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
${(props) => props.text !== ''
|
|
931
|
+
? `
|
|
932
|
+
& > span {
|
|
933
|
+
top: -8px;
|
|
934
|
+
background: var(--background, ${constants.BACKGROUND});
|
|
935
|
+
font-size: 12px;
|
|
936
|
+
line-height: 14px;
|
|
937
|
+
}
|
|
938
|
+
`
|
|
939
|
+
: ''}
|
|
940
|
+
`;
|
|
941
|
+
// Error message container
|
|
942
|
+
const ErrorContainer$4 = styled.div `
|
|
943
|
+
color: var(--error, ${constants.ERROR});
|
|
944
|
+
padding-top: 3px;
|
|
945
|
+
font-size: 12px;
|
|
946
|
+
line-height: 14px;
|
|
947
|
+
margin-left: 3px;
|
|
948
|
+
`;
|
|
949
|
+
/**
|
|
950
|
+
* A chip input component that allows users to add and remove chips (tags) by typing and pressing Enter.
|
|
951
|
+
* @component
|
|
952
|
+
* @example
|
|
953
|
+
* ```tsx
|
|
954
|
+
* <ChipInput
|
|
955
|
+
* value={['tag1', 'tag2']}
|
|
956
|
+
* onChange={(newTags) => console.log(newTags)}
|
|
957
|
+
* label="Add tags"
|
|
958
|
+
* errorText="At least one tag is required"
|
|
959
|
+
* />
|
|
960
|
+
* ```
|
|
961
|
+
*/
|
|
962
|
+
function ChipInput(props) {
|
|
963
|
+
const [text, setText] = React.useState('');
|
|
964
|
+
const [touched, setTouched] = React.useState(false);
|
|
965
|
+
const [value, setValue] = React.useState(props.value);
|
|
966
|
+
const InputRef = React.useRef(null);
|
|
967
|
+
// Sync internal value with props.value
|
|
968
|
+
React.useEffect(() => {
|
|
969
|
+
setValue(props.value);
|
|
970
|
+
}, [props.value]);
|
|
971
|
+
/**
|
|
972
|
+
* Update the chip values and notify changes.
|
|
973
|
+
* @param newValue The new array of chip values
|
|
974
|
+
*/
|
|
975
|
+
const updateValue = (newValue) => {
|
|
976
|
+
var _a;
|
|
977
|
+
const deduped = Array.from(new Set(newValue));
|
|
978
|
+
setValue(deduped);
|
|
979
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, deduped);
|
|
980
|
+
};
|
|
981
|
+
/**
|
|
982
|
+
* Marks the input as touched on focus.
|
|
983
|
+
* @param e React focus event
|
|
984
|
+
*/
|
|
985
|
+
const handleFocus = (e) => {
|
|
986
|
+
setTouched(true);
|
|
987
|
+
if (props.onFocus) {
|
|
988
|
+
props.onFocus(e);
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
/**
|
|
992
|
+
* Change handler for the input field.
|
|
993
|
+
* @param e React change event
|
|
994
|
+
*/
|
|
995
|
+
const handleChange = (e) => {
|
|
996
|
+
setText(e.target.value);
|
|
997
|
+
};
|
|
998
|
+
/**
|
|
999
|
+
* Adds a new chip on Enter key press.
|
|
1000
|
+
* @param e React keyboard event
|
|
1001
|
+
*/
|
|
1002
|
+
const handleKeyUp = (e) => {
|
|
1003
|
+
if (e.key === 'Enter' && text.trim() !== '') {
|
|
1004
|
+
const newValue = [...value, text.trim()];
|
|
1005
|
+
updateValue(newValue);
|
|
1006
|
+
setText('');
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
/**
|
|
1010
|
+
* Removes a chip from the list.
|
|
1011
|
+
* @param chipToRemove The chip value to remove
|
|
1012
|
+
*/
|
|
1013
|
+
const removeChip = (chipToRemove) => {
|
|
1014
|
+
const newValue = value.filter((chip) => chip !== chipToRemove);
|
|
1015
|
+
updateValue(newValue);
|
|
1016
|
+
};
|
|
1017
|
+
/**
|
|
1018
|
+
* Moves a chip from one position to another.
|
|
1019
|
+
* @param start The starting index of the item to move
|
|
1020
|
+
* @param end The ending index where the item should be placed
|
|
1021
|
+
*/
|
|
1022
|
+
const onDrop = (start, end) => {
|
|
1023
|
+
// Clone existing elements
|
|
1024
|
+
const newItems = [...value];
|
|
1025
|
+
// Remove the element to be moved
|
|
1026
|
+
const item = newItems.splice(start, 1);
|
|
1027
|
+
// Add it back at the required position
|
|
1028
|
+
newItems.splice(end, 0, item[0]);
|
|
1029
|
+
// Update
|
|
1030
|
+
updateValue(newItems);
|
|
1031
|
+
};
|
|
1032
|
+
// Render the component
|
|
1033
|
+
return (jsxRuntime.jsxs(Label$6, { text: text, touched: touched, errorText: props.errorText, children: [jsxRuntime.jsx("input", Object.assign({}, props, { ref: InputRef, type: "text", value: text, onChange: handleChange, onFocus: handleFocus, onKeyUp: handleKeyUp, required: props.required && value.length === 0 })), jsxRuntime.jsx("div", { children: (value === null || value === void 0 ? void 0 : value.length) > 0 && (jsxRuntime.jsx(DragAndDrop, { orientation: exports.ORIENTATION.HORIZONTAL, onDrop: onDrop, children: value.map((chip) => (jsxRuntime.jsx(Chip, { label: chip, onCloseClick: () => removeChip(chip) }, chip))) })) }), jsxRuntime.jsx("span", { children: props.label }), props.errorText && jsxRuntime.jsx(ErrorContainer$4, { children: props.errorText })] }));
|
|
1034
|
+
}
|
|
1035
|
+
ChipInput.propTypes = {
|
|
1036
|
+
/** Label for the field */
|
|
1037
|
+
label: PropTypes.string.isRequired,
|
|
1038
|
+
/** Error message for the field */
|
|
1039
|
+
errorText: PropTypes.string,
|
|
1040
|
+
/** Values to display as chips */
|
|
1041
|
+
value: PropTypes.arrayOf(PropTypes.string),
|
|
1042
|
+
/** Callback when chips change */
|
|
1043
|
+
onChange: PropTypes.func,
|
|
1044
|
+
};
|
|
1045
|
+
ChipInput.defaultProps = {
|
|
1046
|
+
value: [],
|
|
1047
|
+
};
|
|
1048
|
+
|
|
563
1049
|
/** Enums for layer position on screen. */
|
|
564
1050
|
var LAYER_POSITION;
|
|
565
1051
|
(function (LAYER_POSITION) {
|
|
@@ -592,31 +1078,33 @@ const POSITION_STYLE = {
|
|
|
592
1078
|
[LAYER_POSITION.DIALOG]: 'top: 0; left: 0; justify-content: center; align-items: center;',
|
|
593
1079
|
};
|
|
594
1080
|
/** Layer container component. */
|
|
595
|
-
const Container$
|
|
1081
|
+
const Container$5 = styled.div `
|
|
596
1082
|
position: fixed;
|
|
597
1083
|
display: flex;
|
|
598
1084
|
opacity: 0;
|
|
599
|
-
transition: opacity .3s ease;
|
|
600
|
-
${props => POSITION_STYLE[props.position]}
|
|
601
|
-
${props => props.overlay &&
|
|
1085
|
+
transition: opacity 0.3s ease;
|
|
1086
|
+
${(props) => POSITION_STYLE[props.position]}
|
|
1087
|
+
${(props) => props.overlay &&
|
|
1088
|
+
`
|
|
602
1089
|
width: 100%;
|
|
603
1090
|
height: 100vh;
|
|
604
1091
|
background-color: var(--backdrop-color, #2681da80);
|
|
605
1092
|
backdrop-filter: blur(0px);
|
|
606
1093
|
pointer-events: all;
|
|
607
1094
|
`}
|
|
608
|
-
z-index: ${props => props.zIndex};
|
|
1095
|
+
z-index: ${(props) => props.zIndex};
|
|
609
1096
|
|
|
610
1097
|
.nf-layer-enter & {
|
|
611
1098
|
opacity: 1;
|
|
612
|
-
${props => props.overlay &&
|
|
1099
|
+
${(props) => props.overlay &&
|
|
1100
|
+
`
|
|
613
1101
|
backdrop-filter: blur(3px);
|
|
614
1102
|
`}
|
|
615
1103
|
}
|
|
616
1104
|
`;
|
|
617
1105
|
/** Key code for different keys. */
|
|
618
1106
|
const KEY_CODES$1 = {
|
|
619
|
-
ESC: 27
|
|
1107
|
+
ESC: 27,
|
|
620
1108
|
};
|
|
621
1109
|
/**
|
|
622
1110
|
* This is a shared helper class which manages the z-index of each layer.
|
|
@@ -627,6 +1115,32 @@ const KEY_CODES$1 = {
|
|
|
627
1115
|
* This way we need not worry about the z-index and can freely keep on creating
|
|
628
1116
|
* new layers. The staring layer z-index is 10000. Leaving enough z-index for the
|
|
629
1117
|
* user if they desires so.
|
|
1118
|
+
*
|
|
1119
|
+
* @important Usage Pattern
|
|
1120
|
+
* To avoid creating duplicate layers (especially in React Strict Mode or Next.js),
|
|
1121
|
+
* always call `renderLayer` only once - either in a lifecycle method (like `componentDidUpdate`)
|
|
1122
|
+
* or in an imperative method (like `open()`).
|
|
1123
|
+
*
|
|
1124
|
+
* @example
|
|
1125
|
+
* // ❌ Don't call renderLayer in render() method
|
|
1126
|
+
* render() {
|
|
1127
|
+
* if (this.state.show) {
|
|
1128
|
+
* const [Component, closeFn] = LayerManager.renderLayer({ ... }); // Creates new layer on every render
|
|
1129
|
+
* return <Component />;
|
|
1130
|
+
* }
|
|
1131
|
+
* }
|
|
1132
|
+
*
|
|
1133
|
+
* @example
|
|
1134
|
+
* // ✅ Do call renderLayer once in a method and store the component
|
|
1135
|
+
* open() {
|
|
1136
|
+
* const [Component, closeFn] = LayerManager.renderLayer({ ... });
|
|
1137
|
+
* this.setState({ LayerComponent: Component });
|
|
1138
|
+
* }
|
|
1139
|
+
*
|
|
1140
|
+
* render() {
|
|
1141
|
+
* const { LayerComponent } = this.state;
|
|
1142
|
+
* return LayerComponent ? <LayerComponent /> : null;
|
|
1143
|
+
* }
|
|
630
1144
|
*/
|
|
631
1145
|
class LayerManager {
|
|
632
1146
|
/**
|
|
@@ -649,10 +1163,11 @@ class LayerManager {
|
|
|
649
1163
|
*/
|
|
650
1164
|
this.unmount = (layer, resp) => {
|
|
651
1165
|
layer.element.setAttribute('class', 'nf-layer-exit');
|
|
652
|
-
this.layers.splice(this.layers.findIndex(item => item === layer), 1);
|
|
1166
|
+
this.layers.splice(this.layers.findIndex((item) => item === layer), 1);
|
|
653
1167
|
setTimeout(() => {
|
|
1168
|
+
var _a, _b;
|
|
654
1169
|
try {
|
|
655
|
-
layer.config.closeCallback
|
|
1170
|
+
(_b = (_a = layer.config).closeCallback) === null || _b === void 0 ? void 0 : _b.call(_a, resp);
|
|
656
1171
|
}
|
|
657
1172
|
catch (e) {
|
|
658
1173
|
// Error in callback function. Ignore and proceed.
|
|
@@ -665,57 +1180,79 @@ class LayerManager {
|
|
|
665
1180
|
* @param config
|
|
666
1181
|
*/
|
|
667
1182
|
this.renderLayer = (config) => {
|
|
1183
|
+
// SSR guard
|
|
1184
|
+
if (typeof document === 'undefined') {
|
|
1185
|
+
return [() => null, () => { }];
|
|
1186
|
+
}
|
|
668
1187
|
// Merge default config with the provided config.
|
|
669
1188
|
const layerConfig = Object.assign(Object.assign({}, defaultConfig), config);
|
|
670
1189
|
// Get the z-index for the new layer
|
|
671
1190
|
const currentIndex = layerConfig.alwaysOnTop ? 2147483647 : this.nextIndex++;
|
|
672
|
-
//
|
|
673
|
-
const
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
config: layerConfig,
|
|
680
|
-
element: divElement
|
|
1191
|
+
// Create a unique ID for tracking this layer
|
|
1192
|
+
const layerId = `nf-layer-manager-${currentIndex}`;
|
|
1193
|
+
const overlayClickHandler = () => {
|
|
1194
|
+
const layer = this.layers.find((l) => l.id === layerId);
|
|
1195
|
+
if (layer && layer.config.closeOnOverlayClick !== false) {
|
|
1196
|
+
this.unmount(layer);
|
|
1197
|
+
}
|
|
681
1198
|
};
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
1199
|
+
const closeFn = (resp) => {
|
|
1200
|
+
const layer = this.layers.find((l) => l.id === layerId);
|
|
1201
|
+
if (layer) {
|
|
1202
|
+
this.unmount(layer, resp);
|
|
1203
|
+
}
|
|
685
1204
|
};
|
|
686
1205
|
// Return callback which will trigger the un-mount.
|
|
687
1206
|
return [
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
// This class will help component in triggering the entry animation.
|
|
691
|
-
function TestLayer() {
|
|
1207
|
+
() => {
|
|
1208
|
+
const [divElement, setDivElement] = React.useState(null);
|
|
692
1209
|
React.useEffect(() => {
|
|
693
|
-
//
|
|
694
|
-
|
|
695
|
-
|
|
1210
|
+
// Create the div element only once when component mounts
|
|
1211
|
+
const div = document.createElement('div');
|
|
1212
|
+
div.setAttribute('id', layerId);
|
|
1213
|
+
document.body.appendChild(div);
|
|
1214
|
+
// Add layer to stack
|
|
1215
|
+
const currentLayer = {
|
|
1216
|
+
id: layerId,
|
|
1217
|
+
config: layerConfig,
|
|
1218
|
+
element: div,
|
|
1219
|
+
};
|
|
1220
|
+
this.layers.push(currentLayer);
|
|
1221
|
+
setDivElement(div);
|
|
1222
|
+
// Add entry animation class after a short delay
|
|
696
1223
|
setTimeout(() => {
|
|
697
|
-
|
|
1224
|
+
div.setAttribute('class', 'nf-layer-enter');
|
|
698
1225
|
}, 10);
|
|
699
|
-
// Cleanup function
|
|
1226
|
+
// Cleanup function - remove div when component unmounts
|
|
700
1227
|
return () => {
|
|
701
|
-
document.body.
|
|
1228
|
+
if (document.body.contains(div)) {
|
|
1229
|
+
document.body.removeChild(div);
|
|
1230
|
+
}
|
|
1231
|
+
// Remove from layers array
|
|
1232
|
+
const index = this.layers.findIndex((layer) => layer.id === layerId);
|
|
1233
|
+
if (index !== -1) {
|
|
1234
|
+
this.layers.splice(index, 1);
|
|
1235
|
+
}
|
|
702
1236
|
};
|
|
703
|
-
}, []);
|
|
704
|
-
|
|
1237
|
+
}, []); // Empty dependency array - run only once
|
|
1238
|
+
if (!divElement) {
|
|
1239
|
+
return null;
|
|
1240
|
+
}
|
|
1241
|
+
return ReactDOM.createPortal(jsxRuntime.jsx(Container$5, Object.assign({ onClick: overlayClickHandler, zIndex: currentIndex }, layerConfig, { children: layerConfig.component })), divElement);
|
|
705
1242
|
},
|
|
706
|
-
|
|
707
|
-
this.unmount(currentLayer, resp);
|
|
708
|
-
}
|
|
1243
|
+
closeFn,
|
|
709
1244
|
];
|
|
710
1245
|
};
|
|
711
|
-
document
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
1246
|
+
if (typeof document !== 'undefined') {
|
|
1247
|
+
document.body.addEventListener('keyup', (e) => {
|
|
1248
|
+
if (this.layers.length && e.keyCode === KEY_CODES$1.ESC) {
|
|
1249
|
+
const lastLayer = this.layers.slice(-1)[0];
|
|
1250
|
+
if (lastLayer.config.closeOnEsc !== false) {
|
|
1251
|
+
this.unmount(lastLayer);
|
|
1252
|
+
}
|
|
716
1253
|
}
|
|
717
|
-
}
|
|
718
|
-
}
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
719
1256
|
}
|
|
720
1257
|
}
|
|
721
1258
|
// Return the instance of the class to create a Singleton.
|
|
@@ -726,7 +1263,7 @@ const DialogContainer = styled(Card) `
|
|
|
726
1263
|
max-height: 80vh;
|
|
727
1264
|
transform: scale(0);
|
|
728
1265
|
opacity: 0;
|
|
729
|
-
transition: all .3s ease;
|
|
1266
|
+
transition: all 0.3s ease;
|
|
730
1267
|
|
|
731
1268
|
.nf-layer-enter & {
|
|
732
1269
|
opacity: 1;
|
|
@@ -743,40 +1280,46 @@ class Dialog extends React.Component {
|
|
|
743
1280
|
super(...arguments);
|
|
744
1281
|
this.state = {
|
|
745
1282
|
show: false,
|
|
1283
|
+
LayerComponent: undefined,
|
|
746
1284
|
};
|
|
747
1285
|
this.open = (closeCallback) => {
|
|
1286
|
+
const _a = this.props, { closeOnEsc, closeOnOverlayClick, children } = _a, rest = __rest(_a, ["closeOnEsc", "closeOnOverlayClick", "children"]);
|
|
1287
|
+
const [Component, closeFn] = LayerManager$1.renderLayer({
|
|
1288
|
+
exitDelay: 300,
|
|
1289
|
+
overlay: true,
|
|
1290
|
+
closeOnEsc,
|
|
1291
|
+
closeCallback: this.closeCallback,
|
|
1292
|
+
closeOnOverlayClick,
|
|
1293
|
+
position: LAYER_POSITION.DIALOG,
|
|
1294
|
+
component: (jsxRuntime.jsx(DialogContainer, Object.assign({}, rest, { onClick: (e) => e.stopPropagation(), elevated: true, children: children }))),
|
|
1295
|
+
});
|
|
1296
|
+
this.closeDialog = closeFn;
|
|
748
1297
|
this.setState({
|
|
749
1298
|
show: true,
|
|
1299
|
+
LayerComponent: Component,
|
|
750
1300
|
});
|
|
751
1301
|
this.onCloseFn = closeCallback;
|
|
752
1302
|
};
|
|
753
1303
|
this.close = (resp) => {
|
|
754
|
-
|
|
1304
|
+
var _a;
|
|
1305
|
+
(_a = this.closeDialog) === null || _a === void 0 ? void 0 : _a.call(this, resp);
|
|
755
1306
|
};
|
|
756
1307
|
this.closeCallback = (resp) => {
|
|
1308
|
+
var _a;
|
|
757
1309
|
this.setState({
|
|
758
1310
|
show: false,
|
|
1311
|
+
LayerComponent: undefined,
|
|
759
1312
|
});
|
|
760
|
-
this.onCloseFn
|
|
1313
|
+
(_a = this.onCloseFn) === null || _a === void 0 ? void 0 : _a.call(this, resp);
|
|
761
1314
|
};
|
|
762
1315
|
}
|
|
763
1316
|
shouldComponentUpdate(nextProps, nextState) {
|
|
764
1317
|
return this.state.show !== nextState.show;
|
|
765
1318
|
}
|
|
766
1319
|
render() {
|
|
767
|
-
const
|
|
768
|
-
if (this.state.show) {
|
|
769
|
-
|
|
770
|
-
exitDelay: 300,
|
|
771
|
-
overlay: true,
|
|
772
|
-
closeOnEsc,
|
|
773
|
-
closeCallback: this.closeCallback,
|
|
774
|
-
closeOnOverlayClick,
|
|
775
|
-
position: LAYER_POSITION.DIALOG,
|
|
776
|
-
component: (jsxRuntime.jsx(DialogContainer, Object.assign({}, rest, { onClick: e => e.stopPropagation(), elevated: true, children: children })))
|
|
777
|
-
});
|
|
778
|
-
this.closeDialog = closeFn;
|
|
779
|
-
return jsxRuntime.jsx(Component, {});
|
|
1320
|
+
const { LayerComponent } = this.state;
|
|
1321
|
+
if (this.state.show && LayerComponent) {
|
|
1322
|
+
return jsxRuntime.jsx(LayerComponent, {});
|
|
780
1323
|
}
|
|
781
1324
|
else {
|
|
782
1325
|
return null;
|
|
@@ -799,7 +1342,7 @@ class AlertDialog extends React.Component {
|
|
|
799
1342
|
super(...arguments);
|
|
800
1343
|
this.dialog = React.createRef();
|
|
801
1344
|
this.show = () => {
|
|
802
|
-
return new Promise(resolve => {
|
|
1345
|
+
return new Promise((resolve) => {
|
|
803
1346
|
const onClose = () => resolve(null);
|
|
804
1347
|
this.dialog.current.open(onClose);
|
|
805
1348
|
});
|
|
@@ -807,7 +1350,7 @@ class AlertDialog extends React.Component {
|
|
|
807
1350
|
this.close = () => this.dialog.current.close();
|
|
808
1351
|
}
|
|
809
1352
|
render() {
|
|
810
|
-
return (jsxRuntime.jsxs(Dialog, Object.assign({}, this.props.dialogProps, { ref: this.dialog, closeOnEsc: false, closeOnOverlayClick:
|
|
1353
|
+
return (jsxRuntime.jsxs(Dialog, Object.assign({}, this.props.dialogProps, { ref: this.dialog, closeOnEsc: false, closeOnOverlayClick: true, children: [this.props.header && jsxRuntime.jsx(Header$1, { children: this.props.header }), jsxRuntime.jsx(Body$1, { children: this.props.body }), jsxRuntime.jsx(Footer$1, { children: jsxRuntime.jsx(Button$2, { onClick: this.close, children: this.props.buttonText }) })] })));
|
|
811
1354
|
}
|
|
812
1355
|
}
|
|
813
1356
|
AlertDialog.propTypes = {
|
|
@@ -821,7 +1364,7 @@ AlertDialog.propTypes = {
|
|
|
821
1364
|
dialogProps: PropTypes.object,
|
|
822
1365
|
};
|
|
823
1366
|
AlertDialog.defaultProps = {
|
|
824
|
-
buttonText: 'OK'
|
|
1367
|
+
buttonText: 'OK',
|
|
825
1368
|
};
|
|
826
1369
|
|
|
827
1370
|
class ConfirmDialog extends React.Component {
|
|
@@ -831,7 +1374,12 @@ class ConfirmDialog extends React.Component {
|
|
|
831
1374
|
this.show = () => {
|
|
832
1375
|
return new Promise((resolve, reject) => {
|
|
833
1376
|
const onClose = (resp) => {
|
|
834
|
-
|
|
1377
|
+
if (resp) {
|
|
1378
|
+
resolve(null);
|
|
1379
|
+
}
|
|
1380
|
+
else {
|
|
1381
|
+
reject();
|
|
1382
|
+
}
|
|
835
1383
|
};
|
|
836
1384
|
this.dialog.current.open(onClose);
|
|
837
1385
|
});
|
|
@@ -858,7 +1406,7 @@ ConfirmDialog.propTypes = {
|
|
|
858
1406
|
};
|
|
859
1407
|
ConfirmDialog.defaultProps = {
|
|
860
1408
|
yesText: 'Yes',
|
|
861
|
-
noText: 'No'
|
|
1409
|
+
noText: 'No',
|
|
862
1410
|
};
|
|
863
1411
|
|
|
864
1412
|
const Label$5 = styled.label `
|
|
@@ -881,12 +1429,14 @@ const TextField$1 = styled.input `
|
|
|
881
1429
|
background-color: var(--background, ${constants.BACKGROUND});
|
|
882
1430
|
|
|
883
1431
|
/** Focused */
|
|
884
|
-
&:focus,
|
|
1432
|
+
&:focus,
|
|
1433
|
+
&:active {
|
|
885
1434
|
border-color: var(--primary, ${constants.PRIMARY});
|
|
886
1435
|
box-shadow: 0 0 0 4px var(--primary-light, ${constants.PRIMARY_LIGHT});
|
|
887
1436
|
}
|
|
888
1437
|
|
|
889
|
-
&:focus + span,
|
|
1438
|
+
&:focus + span,
|
|
1439
|
+
&:active + span {
|
|
890
1440
|
color: var(--primary, ${constants.PRIMARY});
|
|
891
1441
|
}
|
|
892
1442
|
|
|
@@ -895,7 +1445,7 @@ const TextField$1 = styled.input `
|
|
|
895
1445
|
border-color: var(--disabled-border, ${constants.DISABLED_BORDER});
|
|
896
1446
|
background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});
|
|
897
1447
|
}
|
|
898
|
-
|
|
1448
|
+
|
|
899
1449
|
&:disabled + span {
|
|
900
1450
|
color: #777;
|
|
901
1451
|
}
|
|
@@ -906,7 +1456,8 @@ const TextField$1 = styled.input `
|
|
|
906
1456
|
box-shadow: 0 0 0 4px var(--error-light, ${constants.ERROR_LIGHT});
|
|
907
1457
|
}
|
|
908
1458
|
|
|
909
|
-
${props => props.touched
|
|
1459
|
+
${(props) => props.touched
|
|
1460
|
+
? `
|
|
910
1461
|
&:invalid {
|
|
911
1462
|
border-color: var(--error, ${constants.ERROR});
|
|
912
1463
|
}
|
|
@@ -914,16 +1465,19 @@ const TextField$1 = styled.input `
|
|
|
914
1465
|
&:invalid + span {
|
|
915
1466
|
color: var(--error, ${constants.ERROR});
|
|
916
1467
|
}
|
|
917
|
-
`
|
|
1468
|
+
`
|
|
1469
|
+
: ''}
|
|
918
1470
|
|
|
919
1471
|
/** Error */
|
|
920
|
-
${props => props.errorText
|
|
1472
|
+
${(props) => props.errorText
|
|
1473
|
+
? `
|
|
921
1474
|
border-color: var(--error, ${constants.ERROR});
|
|
922
1475
|
|
|
923
1476
|
& + span {
|
|
924
1477
|
color: var(--error, ${constants.ERROR});
|
|
925
1478
|
}
|
|
926
|
-
`
|
|
1479
|
+
`
|
|
1480
|
+
: ''}
|
|
927
1481
|
|
|
928
1482
|
/** Required */
|
|
929
1483
|
&:required + span:after {
|
|
@@ -943,14 +1497,16 @@ const TextField$1 = styled.input `
|
|
|
943
1497
|
transition: all 300ms ease;
|
|
944
1498
|
}
|
|
945
1499
|
|
|
946
|
-
${props => props.value !== ''
|
|
1500
|
+
${(props) => props.value !== ''
|
|
1501
|
+
? `
|
|
947
1502
|
& + span {
|
|
948
1503
|
top: -8px;
|
|
949
1504
|
background: var(--background, ${constants.BACKGROUND});
|
|
950
1505
|
font-size: 12px;
|
|
951
1506
|
line-height: 14px;
|
|
952
1507
|
}
|
|
953
|
-
`
|
|
1508
|
+
`
|
|
1509
|
+
: ''}
|
|
954
1510
|
|
|
955
1511
|
&:focus + span, &:placeholder-shown + span {
|
|
956
1512
|
top: -8px;
|
|
@@ -963,7 +1519,7 @@ const ErrorContainer$3 = styled.div `
|
|
|
963
1519
|
color: var(--error, ${constants.ERROR});
|
|
964
1520
|
padding-top: 3px;
|
|
965
1521
|
font-size: 12px;
|
|
966
|
-
|
|
1522
|
+
line-height: 14px;
|
|
967
1523
|
margin-left: 3px;
|
|
968
1524
|
`;
|
|
969
1525
|
const Input$4 = React.forwardRef((props, ref) => {
|
|
@@ -986,6 +1542,7 @@ const Input$4 = React.forwardRef((props, ref) => {
|
|
|
986
1542
|
};
|
|
987
1543
|
return (jsxRuntime.jsxs(Label$5, { children: [jsxRuntime.jsx(TextField$1, Object.assign({}, props, { ref: ref, value: value, onChange: onChangeHandler, onFocus: handleFocus, touched: touched })), jsxRuntime.jsx("span", { children: props.label }), props.errorText && jsxRuntime.jsx(ErrorContainer$3, { children: props.errorText })] }));
|
|
988
1544
|
});
|
|
1545
|
+
Input$4.displayName = 'Input';
|
|
989
1546
|
Input$4.propTypes = {
|
|
990
1547
|
/** Label for the field */
|
|
991
1548
|
label: PropTypes.string,
|
|
@@ -1012,12 +1569,14 @@ const TextField = styled.textarea `
|
|
|
1012
1569
|
background-color: var(--background, ${constants.BACKGROUND});
|
|
1013
1570
|
|
|
1014
1571
|
/** Focused */
|
|
1015
|
-
&:focus,
|
|
1572
|
+
&:focus,
|
|
1573
|
+
&:active {
|
|
1016
1574
|
border-color: var(--primary, ${constants.PRIMARY});
|
|
1017
1575
|
box-shadow: 0 0 0 4px var(--primary, ${constants.PRIMARY_LIGHT});
|
|
1018
1576
|
}
|
|
1019
1577
|
|
|
1020
|
-
&:focus + span,
|
|
1578
|
+
&:focus + span,
|
|
1579
|
+
&:active + span {
|
|
1021
1580
|
color: var(--primary, ${constants.PRIMARY});
|
|
1022
1581
|
}
|
|
1023
1582
|
|
|
@@ -1026,7 +1585,7 @@ const TextField = styled.textarea `
|
|
|
1026
1585
|
border-color: var(--disabled-border, ${constants.DISABLED_BORDER});
|
|
1027
1586
|
background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});
|
|
1028
1587
|
}
|
|
1029
|
-
|
|
1588
|
+
|
|
1030
1589
|
&:disabled + span {
|
|
1031
1590
|
color: var(--disabled, ${constants.DISABLED});
|
|
1032
1591
|
}
|
|
@@ -1037,7 +1596,8 @@ const TextField = styled.textarea `
|
|
|
1037
1596
|
box-shadow: 0 0 0 4px var(--error-light, ${constants.ERROR_LIGHT});
|
|
1038
1597
|
}
|
|
1039
1598
|
|
|
1040
|
-
${props => props.touched
|
|
1599
|
+
${(props) => props.touched
|
|
1600
|
+
? `
|
|
1041
1601
|
&:invalid {
|
|
1042
1602
|
border-color: var(--error, ${constants.ERROR});
|
|
1043
1603
|
}
|
|
@@ -1045,16 +1605,19 @@ const TextField = styled.textarea `
|
|
|
1045
1605
|
&:invalid + span {
|
|
1046
1606
|
color: var(--error, ${constants.ERROR});
|
|
1047
1607
|
}
|
|
1048
|
-
`
|
|
1608
|
+
`
|
|
1609
|
+
: ''}
|
|
1049
1610
|
|
|
1050
1611
|
/** Error */
|
|
1051
|
-
${props => props.errorText
|
|
1612
|
+
${(props) => props.errorText
|
|
1613
|
+
? `
|
|
1052
1614
|
border-color: var(--error, ${constants.ERROR});
|
|
1053
1615
|
|
|
1054
1616
|
& + span {
|
|
1055
1617
|
color: var(--error, ${constants.ERROR});
|
|
1056
1618
|
}
|
|
1057
|
-
`
|
|
1619
|
+
`
|
|
1620
|
+
: ''}
|
|
1058
1621
|
|
|
1059
1622
|
/** Required */
|
|
1060
1623
|
&:required + span:after {
|
|
@@ -1074,14 +1637,16 @@ const TextField = styled.textarea `
|
|
|
1074
1637
|
transition: all 300ms ease;
|
|
1075
1638
|
}
|
|
1076
1639
|
|
|
1077
|
-
${props => props.value !== ''
|
|
1640
|
+
${(props) => props.value !== ''
|
|
1641
|
+
? `
|
|
1078
1642
|
& + span {
|
|
1079
1643
|
top: -8px;
|
|
1080
1644
|
background: var(--background, ${constants.BACKGROUND});
|
|
1081
1645
|
font-size: 12px;
|
|
1082
1646
|
line-height: 14px;
|
|
1083
1647
|
}
|
|
1084
|
-
`
|
|
1648
|
+
`
|
|
1649
|
+
: ''}
|
|
1085
1650
|
|
|
1086
1651
|
&:focus + span, &:placeholder-shown + span {
|
|
1087
1652
|
top: -8px;
|
|
@@ -1152,12 +1717,14 @@ const SelectField = styled.select `
|
|
|
1152
1717
|
appearance: none;
|
|
1153
1718
|
|
|
1154
1719
|
/** Focused */
|
|
1155
|
-
&:focus,
|
|
1720
|
+
&:focus,
|
|
1721
|
+
&:active {
|
|
1156
1722
|
border-color: var(--primary, ${constants.PRIMARY});
|
|
1157
1723
|
box-shadow: 0 0 0 4px var(--primary, ${constants.PRIMARY_LIGHT});
|
|
1158
1724
|
}
|
|
1159
1725
|
|
|
1160
|
-
&:focus ~ span,
|
|
1726
|
+
&:focus ~ span,
|
|
1727
|
+
&:active ~ span {
|
|
1161
1728
|
color: var(--primary, ${constants.PRIMARY});
|
|
1162
1729
|
}
|
|
1163
1730
|
|
|
@@ -1166,7 +1733,7 @@ const SelectField = styled.select `
|
|
|
1166
1733
|
border-color: var(--disabled-border, ${constants.DISABLED_BORDER});
|
|
1167
1734
|
background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});
|
|
1168
1735
|
}
|
|
1169
|
-
|
|
1736
|
+
|
|
1170
1737
|
&:disabled ~ span {
|
|
1171
1738
|
color: var(--disabled, ${constants.DISABLED});
|
|
1172
1739
|
}
|
|
@@ -1177,7 +1744,8 @@ const SelectField = styled.select `
|
|
|
1177
1744
|
box-shadow: 0 0 0 4px var(--error-light, ${constants.ERROR_LIGHT});
|
|
1178
1745
|
}
|
|
1179
1746
|
|
|
1180
|
-
${props => props.touched
|
|
1747
|
+
${(props) => props.touched
|
|
1748
|
+
? `
|
|
1181
1749
|
&:invalid {
|
|
1182
1750
|
border-color: var(--error, ${constants.ERROR});
|
|
1183
1751
|
}
|
|
@@ -1185,16 +1753,19 @@ const SelectField = styled.select `
|
|
|
1185
1753
|
&:invalid ~ span {
|
|
1186
1754
|
color: var(--error, ${constants.ERROR});
|
|
1187
1755
|
}
|
|
1188
|
-
`
|
|
1756
|
+
`
|
|
1757
|
+
: ''}
|
|
1189
1758
|
|
|
1190
1759
|
/** Error */
|
|
1191
|
-
${props => props.errorText
|
|
1760
|
+
${(props) => props.errorText
|
|
1761
|
+
? `
|
|
1192
1762
|
border-color: var(--error, ${constants.ERROR});
|
|
1193
1763
|
|
|
1194
1764
|
& ~ span {
|
|
1195
1765
|
color: var(--error, ${constants.ERROR});
|
|
1196
1766
|
}
|
|
1197
|
-
`
|
|
1767
|
+
`
|
|
1768
|
+
: ''}
|
|
1198
1769
|
|
|
1199
1770
|
/** Required */
|
|
1200
1771
|
&:required + span:after {
|
|
@@ -1214,14 +1785,16 @@ const SelectField = styled.select `
|
|
|
1214
1785
|
transition: all 300ms ease;
|
|
1215
1786
|
}
|
|
1216
1787
|
|
|
1217
|
-
${props => props.value !== ''
|
|
1788
|
+
${(props) => props.value !== ''
|
|
1789
|
+
? `
|
|
1218
1790
|
& + span {
|
|
1219
1791
|
top: -8px;
|
|
1220
1792
|
background: var(--background, ${constants.BACKGROUND});
|
|
1221
1793
|
font-size: 12px;
|
|
1222
1794
|
line-height: 14px;
|
|
1223
1795
|
}
|
|
1224
|
-
`
|
|
1796
|
+
`
|
|
1797
|
+
: ''}
|
|
1225
1798
|
|
|
1226
1799
|
&:focus + span, &:placeholder-shown + span {
|
|
1227
1800
|
top: -8px;
|
|
@@ -1290,7 +1863,7 @@ const Input$3 = styled.input `
|
|
|
1290
1863
|
text-align: center;
|
|
1291
1864
|
line-height: 16px;
|
|
1292
1865
|
background-color: var(--background, ${constants.BACKGROUND});
|
|
1293
|
-
transition: background-color .3s ease;
|
|
1866
|
+
transition: background-color 0.3s ease;
|
|
1294
1867
|
}
|
|
1295
1868
|
|
|
1296
1869
|
&::after {
|
|
@@ -1301,7 +1874,7 @@ const Input$3 = styled.input `
|
|
|
1301
1874
|
border-bottom: 2px solid #fff;
|
|
1302
1875
|
transform: translate(-16px, 1px);
|
|
1303
1876
|
opacity: 0;
|
|
1304
|
-
transition: transform .3s ease;
|
|
1877
|
+
transition: transform 0.3s ease;
|
|
1305
1878
|
position: absolute;
|
|
1306
1879
|
}
|
|
1307
1880
|
|
|
@@ -1333,12 +1906,14 @@ const Input$3 = styled.input `
|
|
|
1333
1906
|
}
|
|
1334
1907
|
|
|
1335
1908
|
/** active and focus */
|
|
1336
|
-
&:enabled:active::before,
|
|
1909
|
+
&:enabled:active::before,
|
|
1910
|
+
&:focus::before {
|
|
1337
1911
|
border-color: var(--primary, ${constants.PRIMARY});
|
|
1338
|
-
box-shadow: 0 0 0 3px var(--primary, ${constants.PRIMARY_LIGHT});
|
|
1912
|
+
box-shadow: 0 0 0 3px var(--primary, ${constants.PRIMARY_LIGHT});
|
|
1339
1913
|
}
|
|
1340
1914
|
|
|
1341
|
-
&:enabled:active + span,
|
|
1915
|
+
&:enabled:active + span,
|
|
1916
|
+
&:focus + span {
|
|
1342
1917
|
color: var(--primary, ${constants.PRIMARY});
|
|
1343
1918
|
}
|
|
1344
1919
|
|
|
@@ -1360,7 +1935,8 @@ const Input$3 = styled.input `
|
|
|
1360
1935
|
color: #aaa;
|
|
1361
1936
|
}
|
|
1362
1937
|
|
|
1363
|
-
&:checked:disabled::before,
|
|
1938
|
+
&:checked:disabled::before,
|
|
1939
|
+
&:indeterminate:disabled::before {
|
|
1364
1940
|
background-color: #aaa;
|
|
1365
1941
|
}
|
|
1366
1942
|
`;
|
|
@@ -1371,7 +1947,7 @@ function Checkbox(props) {
|
|
|
1371
1947
|
node.indeterminate = true;
|
|
1372
1948
|
}
|
|
1373
1949
|
}
|
|
1374
|
-
}, []);
|
|
1950
|
+
}, [props.indeterminate]);
|
|
1375
1951
|
return (jsxRuntime.jsxs(Label$2, { children: [jsxRuntime.jsx(Input$3, Object.assign({}, props, { ref: ref, type: "checkbox" })), jsxRuntime.jsx("span", { children: props.label })] }));
|
|
1376
1952
|
}
|
|
1377
1953
|
Checkbox.propTypes = {
|
|
@@ -1382,7 +1958,7 @@ Checkbox.propTypes = {
|
|
|
1382
1958
|
};
|
|
1383
1959
|
Checkbox.defaultProps = {
|
|
1384
1960
|
indeterminate: false,
|
|
1385
|
-
label: ''
|
|
1961
|
+
label: '',
|
|
1386
1962
|
};
|
|
1387
1963
|
|
|
1388
1964
|
const Switch = styled.label `
|
|
@@ -1400,14 +1976,14 @@ const Input$2 = styled.input `
|
|
|
1400
1976
|
width: 30px;
|
|
1401
1977
|
height: 18px;
|
|
1402
1978
|
background-color: ${constants.LIGHT_GREY};
|
|
1403
|
-
transition: .4s;
|
|
1979
|
+
transition: 0.4s;
|
|
1404
1980
|
border-radius: 10px;
|
|
1405
1981
|
padding: 0 3px;
|
|
1406
1982
|
margin: 0 10px 0 5px;
|
|
1407
1983
|
}
|
|
1408
1984
|
& + span:before {
|
|
1409
1985
|
position: absolute;
|
|
1410
|
-
content:
|
|
1986
|
+
content: '';
|
|
1411
1987
|
height: 14px;
|
|
1412
1988
|
width: 14px;
|
|
1413
1989
|
left: 1px;
|
|
@@ -1415,7 +1991,7 @@ const Input$2 = styled.input `
|
|
|
1415
1991
|
border: 1px solid var(--disabled-border, ${constants.DISABLED_BORDER});
|
|
1416
1992
|
border-radius: 50%;
|
|
1417
1993
|
background-color: var(--background, ${constants.BACKGROUND});
|
|
1418
|
-
transition: .4s;
|
|
1994
|
+
transition: 0.4s;
|
|
1419
1995
|
}
|
|
1420
1996
|
|
|
1421
1997
|
/* checked */
|
|
@@ -1449,14 +2025,14 @@ const Input$2 = styled.input `
|
|
|
1449
2025
|
background-color: ${constants.LIGHT_GREY};
|
|
1450
2026
|
cursor: not-allowed;
|
|
1451
2027
|
}
|
|
1452
|
-
|
|
2028
|
+
|
|
1453
2029
|
&:disabled + span:before {
|
|
1454
2030
|
background-color: var(--border-light-color, ${constants.BORDER_LIGHT_COLOR});
|
|
1455
2031
|
border-color: var(--disabled-border, ${constants.DISABLED_BORDER});
|
|
1456
2032
|
}
|
|
1457
2033
|
`;
|
|
1458
2034
|
function Toggle(props) {
|
|
1459
|
-
return (jsxRuntime.jsxs(Switch, { children: [jsxRuntime.jsx(Input$2, Object.assign({}, props, { type:
|
|
2035
|
+
return (jsxRuntime.jsxs(Switch, { children: [jsxRuntime.jsx(Input$2, Object.assign({}, props, { type: "checkbox" })), jsxRuntime.jsx("span", {}), jsxRuntime.jsx("span", { children: props.label })] }));
|
|
1460
2036
|
}
|
|
1461
2037
|
Toggle.propTypes = {
|
|
1462
2038
|
/** Label for the field */
|
|
@@ -1480,7 +2056,7 @@ const Input$1 = styled.input `
|
|
|
1480
2056
|
border: 1px solid var(--border-color, ${constants.BORDER_COLOR});
|
|
1481
2057
|
border-radius: 50%;
|
|
1482
2058
|
display: block;
|
|
1483
|
-
transition: background-color .3s ease;
|
|
2059
|
+
transition: background-color 0.3s ease;
|
|
1484
2060
|
}
|
|
1485
2061
|
|
|
1486
2062
|
/* checked */
|
|
@@ -1499,7 +2075,8 @@ const Input$1 = styled.input `
|
|
|
1499
2075
|
|
|
1500
2076
|
&:enabled:checked:focus::before {
|
|
1501
2077
|
border: 1px solid var(--primary, ${constants.PRIMARY});
|
|
1502
|
-
box-shadow:
|
|
2078
|
+
box-shadow:
|
|
2079
|
+
0 0 0 3px var(--primary, ${constants.PRIMARY_LIGHT}),
|
|
1503
2080
|
inset 0 0 0 3px var(--background, ${constants.BACKGROUND});
|
|
1504
2081
|
cursor: pointer;
|
|
1505
2082
|
}
|
|
@@ -1532,7 +2109,7 @@ const Input$1 = styled.input `
|
|
|
1532
2109
|
}
|
|
1533
2110
|
`;
|
|
1534
2111
|
function Radio(props) {
|
|
1535
|
-
return (jsxRuntime.jsxs(Label$1, { children: [jsxRuntime.jsx(Input$1, Object.assign({}, props, { type:
|
|
2112
|
+
return (jsxRuntime.jsxs(Label$1, { children: [jsxRuntime.jsx(Input$1, Object.assign({}, props, { type: "radio" })), jsxRuntime.jsx("span", { children: props.label })] }));
|
|
1536
2113
|
}
|
|
1537
2114
|
Radio.propTypes = {
|
|
1538
2115
|
/** Label for the field */
|
|
@@ -1600,7 +2177,7 @@ const RadioGroup = styled.div `
|
|
|
1600
2177
|
}
|
|
1601
2178
|
`;
|
|
1602
2179
|
function RadioButton(props) {
|
|
1603
|
-
return (jsxRuntime.jsxs(Label, { children: [jsxRuntime.jsx(Input, Object.assign({}, props, { type:
|
|
2180
|
+
return (jsxRuntime.jsxs(Label, { children: [jsxRuntime.jsx(Input, Object.assign({}, props, { type: "radio" })), jsxRuntime.jsx("span", { children: props.label })] }));
|
|
1604
2181
|
}
|
|
1605
2182
|
RadioButton.propTypes = {
|
|
1606
2183
|
/** Label for the field */
|
|
@@ -1626,7 +2203,7 @@ const Menu = React.forwardRef(function (props, ref) {
|
|
|
1626
2203
|
if (multiSelect) {
|
|
1627
2204
|
if (Array.isArray(value)) {
|
|
1628
2205
|
if (value.includes(val)) {
|
|
1629
|
-
newVal = value.filter(item => item !== val);
|
|
2206
|
+
newVal = value.filter((item) => item !== val);
|
|
1630
2207
|
}
|
|
1631
2208
|
else {
|
|
1632
2209
|
newVal = [...value, val];
|
|
@@ -1642,15 +2219,16 @@ const Menu = React.forwardRef(function (props, ref) {
|
|
|
1642
2219
|
return (jsxRuntime.jsx(MenuContext.Provider, { value: {
|
|
1643
2220
|
value,
|
|
1644
2221
|
multiSelect,
|
|
1645
|
-
updateValue
|
|
2222
|
+
updateValue,
|
|
1646
2223
|
}, children: jsxRuntime.jsx(MenuContainer, { ref: ref, children: props.children }) }));
|
|
1647
2224
|
});
|
|
2225
|
+
Menu.displayName = 'Menu';
|
|
1648
2226
|
Menu.defaultProps = {
|
|
1649
2227
|
multiSelect: false,
|
|
1650
2228
|
};
|
|
1651
2229
|
|
|
1652
|
-
const Container$
|
|
1653
|
-
font-weight: ${props => props.selected ? 'bold' : 'normal'};
|
|
2230
|
+
const Container$4 = styled.button `
|
|
2231
|
+
font-weight: ${(props) => (props.selected ? 'bold' : 'normal')};
|
|
1654
2232
|
padding: 8px 6px;
|
|
1655
2233
|
border: none;
|
|
1656
2234
|
background-color: transparent;
|
|
@@ -1662,7 +2240,9 @@ const Container$6 = styled.button `
|
|
|
1662
2240
|
cursor: pointer;
|
|
1663
2241
|
position: relative;
|
|
1664
2242
|
|
|
1665
|
-
&:hover,
|
|
2243
|
+
&:hover,
|
|
2244
|
+
&:focus,
|
|
2245
|
+
&:focus-within {
|
|
1666
2246
|
background-color: var(--border-light-color, ${constants.BORDER_LIGHT_COLOR});
|
|
1667
2247
|
}
|
|
1668
2248
|
|
|
@@ -1681,8 +2261,10 @@ function MenuItem(props) {
|
|
|
1681
2261
|
}
|
|
1682
2262
|
context.updateValue(value);
|
|
1683
2263
|
};
|
|
1684
|
-
const selected = context.multiSelect
|
|
1685
|
-
|
|
2264
|
+
const selected = context.multiSelect
|
|
2265
|
+
? (_b = (_a = context.value) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, value)
|
|
2266
|
+
: context.value === value;
|
|
2267
|
+
return (jsxRuntime.jsxs(Container$4, Object.assign({}, rest, { type: "button", tabIndex: context.multiSelect ? -1 : 0, selected: selected, onClick: clickHandler, children: [context.multiSelect && jsxRuntime.jsx(Checkbox, { checked: selected }), children] })));
|
|
1686
2268
|
}
|
|
1687
2269
|
|
|
1688
2270
|
exports.POPOVER_POSITION = void 0;
|
|
@@ -1708,7 +2290,7 @@ const positionMap$2 = {
|
|
|
1708
2290
|
[exports.POPOVER_POSITION.BOTTOM_LEFT]: `
|
|
1709
2291
|
top: calc(100% - 10px);
|
|
1710
2292
|
left: 0;
|
|
1711
|
-
|
|
2293
|
+
`,
|
|
1712
2294
|
};
|
|
1713
2295
|
const PopoverDiv = styled.div `
|
|
1714
2296
|
position: relative;
|
|
@@ -1719,17 +2301,17 @@ const Popper = styled(Card) `
|
|
|
1719
2301
|
width: 100%;
|
|
1720
2302
|
min-width: 200px;
|
|
1721
2303
|
overflow: auto;
|
|
1722
|
-
animation: enter .3s linear;
|
|
2304
|
+
animation: enter 0.3s linear;
|
|
1723
2305
|
border-radius: 3px;
|
|
1724
2306
|
z-index: 1;
|
|
1725
|
-
transform: translate(${props => props.translateX}px, ${props => props.translateY}px);
|
|
1726
|
-
${props => positionMap$2[props.position]}
|
|
2307
|
+
transform: translate(${(props) => props.translateX}px, ${(props) => props.translateY}px);
|
|
2308
|
+
${(props) => positionMap$2[props.position]}
|
|
1727
2309
|
|
|
1728
2310
|
&.closing {
|
|
1729
2311
|
/* max-height: 0px;
|
|
1730
2312
|
opacity: 0;
|
|
1731
2313
|
overflow: hidden; */
|
|
1732
|
-
animation: exit .3s linear;
|
|
2314
|
+
animation: exit 0.3s linear;
|
|
1733
2315
|
}
|
|
1734
2316
|
|
|
1735
2317
|
@keyframes enter {
|
|
@@ -1759,7 +2341,7 @@ const Popper = styled(Card) `
|
|
|
1759
2341
|
}
|
|
1760
2342
|
`;
|
|
1761
2343
|
const KEY_CODES = {
|
|
1762
|
-
ESC: 27
|
|
2344
|
+
ESC: 27,
|
|
1763
2345
|
};
|
|
1764
2346
|
function Popover(props) {
|
|
1765
2347
|
const [open, setOpen] = React.useState(props.open);
|
|
@@ -1767,7 +2349,7 @@ function Popover(props) {
|
|
|
1767
2349
|
const [translate, setTranslate] = React.useState({ x: 0, y: 0 });
|
|
1768
2350
|
const popperRef = React.useRef();
|
|
1769
2351
|
const containerRef = React.useRef();
|
|
1770
|
-
const close = () => {
|
|
2352
|
+
const close = React.useCallback(() => {
|
|
1771
2353
|
setClosing(true);
|
|
1772
2354
|
setTimeout(() => {
|
|
1773
2355
|
setOpen(false);
|
|
@@ -1777,17 +2359,17 @@ function Popover(props) {
|
|
|
1777
2359
|
}
|
|
1778
2360
|
setClosing(false);
|
|
1779
2361
|
}, 280);
|
|
1780
|
-
};
|
|
1781
|
-
const keyupEventHandler = (e) => {
|
|
2362
|
+
}, [props]);
|
|
2363
|
+
const keyupEventHandler = React.useCallback((e) => {
|
|
1782
2364
|
if (props.closeOnEsc && e.keyCode === KEY_CODES.ESC) {
|
|
1783
2365
|
close();
|
|
1784
2366
|
}
|
|
1785
|
-
};
|
|
1786
|
-
const clickOutsideHandler = (e) => {
|
|
2367
|
+
}, [close, props.closeOnEsc]);
|
|
2368
|
+
const clickOutsideHandler = React.useCallback((e) => {
|
|
1787
2369
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
1788
2370
|
close();
|
|
1789
2371
|
}
|
|
1790
|
-
};
|
|
2372
|
+
}, [close]);
|
|
1791
2373
|
/**
|
|
1792
2374
|
* Get called on popover mount.
|
|
1793
2375
|
*/
|
|
@@ -1797,7 +2379,7 @@ function Popover(props) {
|
|
|
1797
2379
|
document.removeEventListener('keyup', keyupEventHandler);
|
|
1798
2380
|
document.removeEventListener('click', clickOutsideHandler);
|
|
1799
2381
|
};
|
|
1800
|
-
}, []);
|
|
2382
|
+
}, [clickOutsideHandler, close, keyupEventHandler]);
|
|
1801
2383
|
React.useEffect(() => {
|
|
1802
2384
|
if (props.open) {
|
|
1803
2385
|
setOpen(true);
|
|
@@ -1814,7 +2396,7 @@ function Popover(props) {
|
|
|
1814
2396
|
return () => {
|
|
1815
2397
|
document.removeEventListener('click', clickOutsideHandler);
|
|
1816
2398
|
};
|
|
1817
|
-
}, [props.open]);
|
|
2399
|
+
}, [props.open, open, clickOutsideHandler, close]);
|
|
1818
2400
|
React.useEffect(() => {
|
|
1819
2401
|
if (open) {
|
|
1820
2402
|
const { top, left, right } = popperRef.current.getBoundingClientRect();
|
|
@@ -1863,8 +2445,11 @@ function Popover(props) {
|
|
|
1863
2445
|
setTranslate(translation);
|
|
1864
2446
|
popperRef.current.focus();
|
|
1865
2447
|
}
|
|
1866
|
-
}, [open]);
|
|
1867
|
-
return (jsxRuntime.jsxs(PopoverDiv, { ref: containerRef, children: [jsxRuntime.jsx(props.element, {}), open && (jsxRuntime.jsx(Popper, { elevated: true, tabIndex: 0, position: props.position, translateX: translate.x, translateY: translate.y, className: closing && 'closing', ref: popperRef, onClick: e => {
|
|
2448
|
+
}, [open, props.position]);
|
|
2449
|
+
return (jsxRuntime.jsxs(PopoverDiv, { ref: containerRef, children: [jsxRuntime.jsx(props.element, {}), open && (jsxRuntime.jsx(Popper, { elevated: true, tabIndex: 0, position: props.position, translateX: translate.x, translateY: translate.y, className: closing && 'closing', ref: popperRef, onClick: (e) => {
|
|
2450
|
+
e.stopPropagation();
|
|
2451
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
2452
|
+
}, children: props.children }))] }));
|
|
1868
2453
|
}
|
|
1869
2454
|
Popover.propTypes = {
|
|
1870
2455
|
/** Opens the popover */
|
|
@@ -1898,30 +2483,30 @@ function Dropdown(props) {
|
|
|
1898
2483
|
const { multiSelect, onChange } = props;
|
|
1899
2484
|
const [open, setOpen] = React.useState(false);
|
|
1900
2485
|
const [value, setValue] = React.useState(props.value);
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
e.
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
else {
|
|
1911
|
-
const currentBtn = current.closest('button');
|
|
1912
|
-
if (e.keyCode === 38) {
|
|
1913
|
-
const prev = (_a = currentBtn === null || currentBtn === void 0 ? void 0 : currentBtn.previousElementSibling) === null || _a === void 0 ? void 0 : _a.closest('button');
|
|
1914
|
-
prev === null || prev === void 0 ? void 0 : prev.focus();
|
|
2486
|
+
React.useEffect(() => {
|
|
2487
|
+
const focusHandler = (e) => {
|
|
2488
|
+
var _a, _b;
|
|
2489
|
+
if (open && (e.keyCode === 38 || e.keyCode === 40)) {
|
|
2490
|
+
e.preventDefault();
|
|
2491
|
+
const current = document.querySelector(':focus');
|
|
2492
|
+
if (current.tagName === 'DIV') {
|
|
2493
|
+
const firstBtn = current.querySelector('button');
|
|
2494
|
+
firstBtn === null || firstBtn === void 0 ? void 0 : firstBtn.focus();
|
|
1915
2495
|
}
|
|
1916
2496
|
else {
|
|
1917
|
-
const
|
|
1918
|
-
|
|
2497
|
+
const currentBtn = current.closest('button');
|
|
2498
|
+
if (e.keyCode === 38) {
|
|
2499
|
+
const prev = (_a = currentBtn === null || currentBtn === void 0 ? void 0 : currentBtn.previousElementSibling) === null || _a === void 0 ? void 0 : _a.closest('button');
|
|
2500
|
+
prev === null || prev === void 0 ? void 0 : prev.focus();
|
|
2501
|
+
}
|
|
2502
|
+
else {
|
|
2503
|
+
const next = (_b = currentBtn === null || currentBtn === void 0 ? void 0 : currentBtn.nextElementSibling) === null || _b === void 0 ? void 0 : _b.closest('button');
|
|
2504
|
+
next === null || next === void 0 ? void 0 : next.focus();
|
|
2505
|
+
}
|
|
1919
2506
|
}
|
|
2507
|
+
return false;
|
|
1920
2508
|
}
|
|
1921
|
-
|
|
1922
|
-
}
|
|
1923
|
-
};
|
|
1924
|
-
React.useEffect(() => {
|
|
2509
|
+
};
|
|
1925
2510
|
document.addEventListener('keydown', focusHandler);
|
|
1926
2511
|
return () => {
|
|
1927
2512
|
document.removeEventListener('keydown', focusHandler);
|
|
@@ -1941,7 +2526,7 @@ function Dropdown(props) {
|
|
|
1941
2526
|
setOpen(false);
|
|
1942
2527
|
}
|
|
1943
2528
|
};
|
|
1944
|
-
return (jsxRuntime.jsx(Popover, { position: exports.POPOVER_POSITION.BOTTOM_LEFT, open: open, element: () => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Input$4, { type:
|
|
2529
|
+
return (jsxRuntime.jsx(Popover, { position: exports.POPOVER_POSITION.BOTTOM_LEFT, open: open, element: () => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Input$4, { type: "text", value: value && String(value), label: props.label, errorText: props.errorText, onClick: clickHandler, onKeyUp: keyUp, required: props.required, disabled: props.disabled }), jsxRuntime.jsx(ArrowContainer, { children: jsxRuntime.jsx(ExpandMore, {}) })] })), onClose: () => setOpen(false), children: jsxRuntime.jsx(Menu, { value: value, multiSelect: multiSelect, onChange: changeHandler, children: props.children }) }));
|
|
1945
2530
|
}
|
|
1946
2531
|
Dropdown.defaultProps = {
|
|
1947
2532
|
multiSelect: false,
|
|
@@ -1986,7 +2571,7 @@ class PromptDialog extends React.Component {
|
|
|
1986
2571
|
}
|
|
1987
2572
|
render() {
|
|
1988
2573
|
const { header, body, inputProps, submitText, cancelText, dialogProps } = this.props;
|
|
1989
|
-
return (jsxRuntime.jsx(Dialog, Object.assign({}, dialogProps, { ref: this.dialog, closeOnEsc: false, closeOnOverlayClick: false, children: jsxRuntime.jsxs("form", { onSubmit: this.submit, children: [header && jsxRuntime.jsx(Header$1, { children: header }), jsxRuntime.jsxs(Body$1, { children: [jsxRuntime.jsx(BodyText, { children: body }), jsxRuntime.jsx("div", { style: { display: 'flex' }, children: jsxRuntime.jsx(Input$4, Object.assign({ style: { width: 'auto', flex: '1' }, value: this.state.value, onChange: this.valueChange
|
|
2574
|
+
return (jsxRuntime.jsx(Dialog, Object.assign({}, dialogProps, { ref: this.dialog, closeOnEsc: false, closeOnOverlayClick: false, children: jsxRuntime.jsxs("form", { onSubmit: this.submit, children: [header && jsxRuntime.jsx(Header$1, { children: header }), jsxRuntime.jsxs(Body$1, { children: [jsxRuntime.jsx(BodyText, { children: body }), jsxRuntime.jsx("div", { style: { display: 'flex' }, children: jsxRuntime.jsx(Input$4, Object.assign({ style: { width: 'auto', flex: '1' }, value: this.state.value, onChange: this.valueChange }, inputProps)) })] }), jsxRuntime.jsxs(Footer$1, { children: [jsxRuntime.jsx(Button$2, { type: "button", onClick: this.cancel, children: cancelText }), jsxRuntime.jsx(ActionButton, { children: submitText })] })] }) })));
|
|
1990
2575
|
}
|
|
1991
2576
|
}
|
|
1992
2577
|
PromptDialog.propTypes = {
|
|
@@ -2011,250 +2596,6 @@ PromptDialog.defaultProps = {
|
|
|
2011
2596
|
defaultValue: '',
|
|
2012
2597
|
};
|
|
2013
2598
|
|
|
2014
|
-
exports.ORIENTATION = void 0;
|
|
2015
|
-
(function (ORIENTATION) {
|
|
2016
|
-
ORIENTATION["HORIZONTAL"] = "horizontal";
|
|
2017
|
-
ORIENTATION["VERTICAL"] = "vertical";
|
|
2018
|
-
})(exports.ORIENTATION || (exports.ORIENTATION = {}));
|
|
2019
|
-
const DragContext = React.createContext(null);
|
|
2020
|
-
|
|
2021
|
-
/** Styled component for the draggable item container */
|
|
2022
|
-
const Item = styled.div `
|
|
2023
|
-
cursor: ${props => props.showIndicator ? 'default' : 'move'};
|
|
2024
|
-
display: flex;
|
|
2025
|
-
user-select: ${props => props.showIndicator ? 'auto' : 'none'};
|
|
2026
|
-
border-top: 2px solid ${props => props.orientation === exports.ORIENTATION.VERTICAL && props.active > 0
|
|
2027
|
-
? constants.PRIMARY : 'transparent'};
|
|
2028
|
-
border-bottom: 2px solid ${props => props.orientation === exports.ORIENTATION.VERTICAL && props.active < 0
|
|
2029
|
-
? constants.PRIMARY : 'transparent'};
|
|
2030
|
-
border-left: 2px solid ${props => props.orientation === exports.ORIENTATION.HORIZONTAL && props.active > 0
|
|
2031
|
-
? constants.PRIMARY : 'transparent'};
|
|
2032
|
-
border-right: 2px solid ${props => props.orientation === exports.ORIENTATION.HORIZONTAL && props.active < 0
|
|
2033
|
-
? constants.PRIMARY : 'transparent'};
|
|
2034
|
-
opacity: ${props => props.dragging ? 0.5 : 1};
|
|
2035
|
-
`;
|
|
2036
|
-
/** Styled component for the drag handle indicator */
|
|
2037
|
-
const DragKnob = styled.div `
|
|
2038
|
-
padding-top: 8px;
|
|
2039
|
-
cursor: move;
|
|
2040
|
-
touch-action: none;
|
|
2041
|
-
color: var(--disabled, ${constants.DISABLED});
|
|
2042
|
-
`;
|
|
2043
|
-
/** Container for the children */
|
|
2044
|
-
const Container$5 = styled.div `
|
|
2045
|
-
flex: 1;
|
|
2046
|
-
`;
|
|
2047
|
-
/**
|
|
2048
|
-
* A draggable item component that supports both mouse and touch interactions for drag-and-drop functionality.
|
|
2049
|
-
*
|
|
2050
|
-
* @component
|
|
2051
|
-
* @example
|
|
2052
|
-
* ```tsx
|
|
2053
|
-
* <DragItem
|
|
2054
|
-
* index={0}
|
|
2055
|
-
* orientation={ORIENTATION.VERTICAL}
|
|
2056
|
-
* showIndicator={true}
|
|
2057
|
-
* dragOver={-1}
|
|
2058
|
-
* >
|
|
2059
|
-
* <div>Draggable content</div>
|
|
2060
|
-
* </DragItem>
|
|
2061
|
-
* ```
|
|
2062
|
-
*
|
|
2063
|
-
* @param props - The component props
|
|
2064
|
-
* @param props.index - The position index of this item in the draggable list
|
|
2065
|
-
* @param props.orientation - The orientation of the drag operation (VERTICAL or HORIZONTAL)
|
|
2066
|
-
* @param props.showIndicator - Whether to show a drag handle indicator instead of making the entire item draggable
|
|
2067
|
-
* @param props.dragOver - The index of the item currently being dragged over
|
|
2068
|
-
* @param props.children - The content to be rendered inside the draggable item
|
|
2069
|
-
*
|
|
2070
|
-
* @remarks
|
|
2071
|
-
* - Uses the DragContext to manage drag state across items
|
|
2072
|
-
* - Provides visual feedback with borders during drag operations
|
|
2073
|
-
* - Supports haptic feedback (vibration) on touch devices
|
|
2074
|
-
* - For touch devices, requires a 200ms hold before drag starts
|
|
2075
|
-
* - When showIndicator is true, only the drag handle can initiate drag operations
|
|
2076
|
-
*
|
|
2077
|
-
* @returns A draggable item with optional drag indicator and visual feedback
|
|
2078
|
-
*/
|
|
2079
|
-
function DragItem(props) {
|
|
2080
|
-
const { index, orientation, children, showIndicator, dragOver } = props;
|
|
2081
|
-
const [active, setActive] = React.useState(0);
|
|
2082
|
-
const [touchTimer, setTouchTimer] = React.useState(null);
|
|
2083
|
-
const context = React.useContext(DragContext);
|
|
2084
|
-
/**
|
|
2085
|
-
* Vibrate the device for haptic feedback
|
|
2086
|
-
* @param duration Duration of the vibration in milliseconds
|
|
2087
|
-
*/
|
|
2088
|
-
const vibrate = (duration) => {
|
|
2089
|
-
if (navigator.vibrate) {
|
|
2090
|
-
navigator.vibrate(duration);
|
|
2091
|
-
}
|
|
2092
|
-
};
|
|
2093
|
-
/**
|
|
2094
|
-
* Drag start event handler
|
|
2095
|
-
* @param e Event
|
|
2096
|
-
*/
|
|
2097
|
-
const dragStartHandler = (e) => {
|
|
2098
|
-
context.setStartIndex(index);
|
|
2099
|
-
context.setIsDragging(true);
|
|
2100
|
-
};
|
|
2101
|
-
/**
|
|
2102
|
-
* Drag over event handler
|
|
2103
|
-
* @param e Event
|
|
2104
|
-
*/
|
|
2105
|
-
const dragOverHandler = (e) => {
|
|
2106
|
-
e.preventDefault();
|
|
2107
|
-
e.stopPropagation();
|
|
2108
|
-
setActive(context.startIndex - index);
|
|
2109
|
-
};
|
|
2110
|
-
/**
|
|
2111
|
-
* Drag leave event handler
|
|
2112
|
-
*/
|
|
2113
|
-
const dragExitHandler = () => {
|
|
2114
|
-
setActive(0);
|
|
2115
|
-
};
|
|
2116
|
-
/**
|
|
2117
|
-
* Drop event handler
|
|
2118
|
-
* @param e Event
|
|
2119
|
-
*/
|
|
2120
|
-
const dropHandler = (e) => {
|
|
2121
|
-
e.preventDefault();
|
|
2122
|
-
setActive(0);
|
|
2123
|
-
context.drop(index);
|
|
2124
|
-
context.setIsDragging(false);
|
|
2125
|
-
};
|
|
2126
|
-
/**
|
|
2127
|
-
* Touch start event handler
|
|
2128
|
-
* @param e Event
|
|
2129
|
-
*/
|
|
2130
|
-
const touchStartHandler = (e) => {
|
|
2131
|
-
const timer = setTimeout(() => {
|
|
2132
|
-
context.setStartIndex(index);
|
|
2133
|
-
context.setIsDragging(true);
|
|
2134
|
-
context.setDragOver(index);
|
|
2135
|
-
document.body.style.overflow = 'hidden';
|
|
2136
|
-
vibrate(50);
|
|
2137
|
-
}, 200);
|
|
2138
|
-
setTouchTimer(timer);
|
|
2139
|
-
};
|
|
2140
|
-
/**
|
|
2141
|
-
* Touch move event handler
|
|
2142
|
-
* @param e Event
|
|
2143
|
-
* @returns void
|
|
2144
|
-
*/
|
|
2145
|
-
const touchMoveHandler = (e) => {
|
|
2146
|
-
var _a;
|
|
2147
|
-
const touch = e.touches[0];
|
|
2148
|
-
if (!touch)
|
|
2149
|
-
return;
|
|
2150
|
-
if (context.isDragging) {
|
|
2151
|
-
e.preventDefault();
|
|
2152
|
-
// get the element under the touch point
|
|
2153
|
-
const el = document.elementFromPoint(touch.clientX, touch.clientY);
|
|
2154
|
-
const overAttr = (_a = el === null || el === void 0 ? void 0 : el.closest('[data-drag-index]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-drag-index');
|
|
2155
|
-
const overIndex = overAttr != null ? parseInt(overAttr, 10) : null;
|
|
2156
|
-
// if we know which index we're over, update visual state
|
|
2157
|
-
if (overIndex !== null) {
|
|
2158
|
-
context.setDragOver(overIndex);
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
else if (touchTimer) {
|
|
2162
|
-
clearTimeout(touchTimer);
|
|
2163
|
-
setTouchTimer(null);
|
|
2164
|
-
}
|
|
2165
|
-
};
|
|
2166
|
-
/**
|
|
2167
|
-
* Touch end event handler
|
|
2168
|
-
* @param e Event
|
|
2169
|
-
*/
|
|
2170
|
-
const touchEndHandler = (e) => {
|
|
2171
|
-
if (touchTimer) {
|
|
2172
|
-
clearTimeout(touchTimer);
|
|
2173
|
-
setTouchTimer(null);
|
|
2174
|
-
}
|
|
2175
|
-
if (context.isDragging) {
|
|
2176
|
-
context.drop(dragOver);
|
|
2177
|
-
vibrate(50);
|
|
2178
|
-
context.setIsDragging(false);
|
|
2179
|
-
document.body.style.overflow = 'auto';
|
|
2180
|
-
}
|
|
2181
|
-
};
|
|
2182
|
-
/** Cleanup touch timer on unmount */
|
|
2183
|
-
React.useEffect(() => {
|
|
2184
|
-
return () => {
|
|
2185
|
-
if (touchTimer)
|
|
2186
|
-
clearTimeout(touchTimer);
|
|
2187
|
-
document.body.style.overflow = 'auto';
|
|
2188
|
-
};
|
|
2189
|
-
}, [touchTimer]);
|
|
2190
|
-
/** Update active state based on dragOver changes */
|
|
2191
|
-
React.useEffect(() => {
|
|
2192
|
-
if (context.isDragging && dragOver === index) {
|
|
2193
|
-
setActive(context.startIndex - index);
|
|
2194
|
-
}
|
|
2195
|
-
else {
|
|
2196
|
-
setActive(0);
|
|
2197
|
-
}
|
|
2198
|
-
}, [dragOver, context.startIndex, index, context.isDragging]);
|
|
2199
|
-
return jsxRuntime.jsxs(Item, { draggable: !showIndicator, showIndicator: showIndicator, active: active, dragging: context.isDragging && context.startIndex === index, orientation: orientation, "data-drag-index": index, onDragStart: !showIndicator ? dragStartHandler : undefined, onDragOver: dragOverHandler, onDragLeave: dragExitHandler, onDrop: dropHandler, onTouchStart: !showIndicator ? touchStartHandler : undefined, onTouchMove: touchMoveHandler, onTouchEnd: touchEndHandler, onTouchCancel: touchEndHandler, children: [showIndicator && jsxRuntime.jsx(DragKnob, { draggable: true, onDragStart: dragStartHandler, onTouchStart: touchStartHandler, children: jsxRuntime.jsx(CheckCircle, {}) }), jsxRuntime.jsx(Container$5, { children: children })] });
|
|
2200
|
-
}
|
|
2201
|
-
|
|
2202
|
-
/** Container Component */
|
|
2203
|
-
const Container$4 = styled.div `
|
|
2204
|
-
flex: 1;
|
|
2205
|
-
display: flex;
|
|
2206
|
-
position: relative;
|
|
2207
|
-
flex-wrap: wrap;
|
|
2208
|
-
flex-direction: ${props => props.orientation === exports.ORIENTATION.HORIZONTAL ? 'row' : 'column'};
|
|
2209
|
-
`;
|
|
2210
|
-
/**
|
|
2211
|
-
* A drag and drop container component that enables reordering of child elements.
|
|
2212
|
-
*
|
|
2213
|
-
* @component
|
|
2214
|
-
* @example
|
|
2215
|
-
* ```tsx
|
|
2216
|
-
* <DragAndDrop
|
|
2217
|
-
* orientation={ORIENTATION.VERTICAL}
|
|
2218
|
-
* onDrop={(start, end) => handleReorder(start, end)}
|
|
2219
|
-
* showIndicator={true}
|
|
2220
|
-
* >
|
|
2221
|
-
* <div>Item 1</div>
|
|
2222
|
-
* <div>Item 2</div>
|
|
2223
|
-
* <div>Item 3</div>
|
|
2224
|
-
* </DragAndDrop>
|
|
2225
|
-
* ```
|
|
2226
|
-
*
|
|
2227
|
-
* @param {DragAndDropProps} props - The component props
|
|
2228
|
-
* @param {ORIENTATION} props.orientation - Determines the layout direction (horizontal or vertical). Defaults to VERTICAL.
|
|
2229
|
-
* @param {(start: number, end: number) => void} props.onDrop - Callback fired when an item is dropped, receives the start and end indices
|
|
2230
|
-
* @param {boolean} props.showIndicator - Whether to display drag indicators for each list item. Defaults to false.
|
|
2231
|
-
* @param {React.ReactNode} props.children - Child elements to be rendered as draggable items
|
|
2232
|
-
*
|
|
2233
|
-
* @returns {JSX.Element} A draggable container with reorderable items
|
|
2234
|
-
*/
|
|
2235
|
-
function DragAndDrop(props) {
|
|
2236
|
-
const { orientation, children, onDrop, showIndicator } = props;
|
|
2237
|
-
const [startIndex, setStartIndex] = React.useState(null);
|
|
2238
|
-
const [isDragging, setIsDragging] = React.useState(false);
|
|
2239
|
-
const [dragOver, setDragOver] = React.useState(null);
|
|
2240
|
-
/**
|
|
2241
|
-
* Drop handler invoked when a draggable item is released.
|
|
2242
|
-
* @param index
|
|
2243
|
-
*/
|
|
2244
|
-
const drop = (index) => {
|
|
2245
|
-
startIndex !== null && (onDrop === null || onDrop === void 0 ? void 0 : onDrop(startIndex, index));
|
|
2246
|
-
setStartIndex(null);
|
|
2247
|
-
setIsDragging(false);
|
|
2248
|
-
};
|
|
2249
|
-
return (jsxRuntime.jsx(DragContext.Provider, { value: { startIndex, setStartIndex, drop, isDragging, setIsDragging, setDragOver }, children: jsxRuntime.jsx(Container$4, { orientation: orientation, children: React.Children.map(children, (child, index) => (jsxRuntime.jsx(DragItem, { index: index, orientation: orientation, showIndicator: showIndicator, dragOver: dragOver, children: child }))) }) }));
|
|
2250
|
-
}
|
|
2251
|
-
DragAndDrop.defaultProps = {
|
|
2252
|
-
/** Orientation of the list layout */
|
|
2253
|
-
orientation: exports.ORIENTATION.VERTICAL,
|
|
2254
|
-
/** Whether to display drag indicators for each list item */
|
|
2255
|
-
showIndicator: false,
|
|
2256
|
-
};
|
|
2257
|
-
|
|
2258
2599
|
exports.DRAWER_POSITION = void 0;
|
|
2259
2600
|
(function (DRAWER_POSITION) {
|
|
2260
2601
|
DRAWER_POSITION["LEFT"] = "LEFT";
|
|
@@ -2286,13 +2627,13 @@ const DrawerDiv = styled.div `
|
|
|
2286
2627
|
display: flex;
|
|
2287
2628
|
flex-direction: column;
|
|
2288
2629
|
background-color: #fff;
|
|
2289
|
-
transition: transform .3s ease;
|
|
2630
|
+
transition: transform 0.3s ease;
|
|
2290
2631
|
box-shadow: var(--modal-shadow, ${constants.MODAL_SHADOW});
|
|
2291
|
-
${props => positionStyle$1(props.size)[props.position].before}
|
|
2632
|
+
${(props) => positionStyle$1(props.size)[props.position].before}
|
|
2292
2633
|
|
|
2293
2634
|
.nf-layer-enter & {
|
|
2294
2635
|
transform: translateX(0%);
|
|
2295
|
-
${props => positionStyle$1(props.size)[props.position].after}
|
|
2636
|
+
${(props) => positionStyle$1(props.size)[props.position].after}
|
|
2296
2637
|
}
|
|
2297
2638
|
`;
|
|
2298
2639
|
const positionMap$1 = {
|
|
@@ -2307,10 +2648,11 @@ class Drawer extends React.Component {
|
|
|
2307
2648
|
open: false,
|
|
2308
2649
|
};
|
|
2309
2650
|
this.onClose = () => {
|
|
2651
|
+
var _a, _b;
|
|
2310
2652
|
this.setState({
|
|
2311
2653
|
open: false,
|
|
2312
2654
|
});
|
|
2313
|
-
this.props.onClose
|
|
2655
|
+
(_b = (_a = this.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
2314
2656
|
this.closeCallback = null;
|
|
2315
2657
|
this.layer = null;
|
|
2316
2658
|
};
|
|
@@ -2324,9 +2666,10 @@ class Drawer extends React.Component {
|
|
|
2324
2666
|
return null;
|
|
2325
2667
|
}
|
|
2326
2668
|
getSnapshotBeforeUpdate(prevProps) {
|
|
2327
|
-
|
|
2669
|
+
var _a;
|
|
2670
|
+
const _b = this.props, { open, closeOnEsc, closeOnOverlayClick, overlay, position, children, size } = _b, rest = __rest(_b, ["open", "closeOnEsc", "closeOnOverlayClick", "overlay", "position", "children", "size"]);
|
|
2328
2671
|
if (prevProps.open && !open) {
|
|
2329
|
-
this.closeCallback
|
|
2672
|
+
(_a = this.closeCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2330
2673
|
}
|
|
2331
2674
|
if (!prevProps.open && open) {
|
|
2332
2675
|
this.layer = LayerManager$1.renderLayer({
|
|
@@ -2336,7 +2679,7 @@ class Drawer extends React.Component {
|
|
|
2336
2679
|
closeCallback: this.onClose,
|
|
2337
2680
|
closeOnEsc,
|
|
2338
2681
|
closeOnOverlayClick,
|
|
2339
|
-
component: (jsxRuntime.jsx(DrawerDiv, Object.assign({}, rest, { position: position, size: size, onClick: e => e.stopPropagation(), children: children })))
|
|
2682
|
+
component: (jsxRuntime.jsx(DrawerDiv, Object.assign({}, rest, { position: position, size: size, onClick: (e) => e.stopPropagation(), children: children }))),
|
|
2340
2683
|
});
|
|
2341
2684
|
this.closeCallback = this.layer[1];
|
|
2342
2685
|
this.forceUpdate();
|
|
@@ -2384,7 +2727,8 @@ const Container$3 = styled.div `
|
|
|
2384
2727
|
margin: 5px;
|
|
2385
2728
|
|
|
2386
2729
|
/* overrides */
|
|
2387
|
-
& button,
|
|
2730
|
+
& button,
|
|
2731
|
+
& label {
|
|
2388
2732
|
margin: 0;
|
|
2389
2733
|
border: none;
|
|
2390
2734
|
border-radius: 0;
|
|
@@ -2397,16 +2741,19 @@ const Container$3 = styled.div `
|
|
|
2397
2741
|
border-left: none;
|
|
2398
2742
|
}
|
|
2399
2743
|
|
|
2400
|
-
& input,
|
|
2744
|
+
& input,
|
|
2745
|
+
& select {
|
|
2401
2746
|
border: none;
|
|
2402
2747
|
height: 32px;
|
|
2403
2748
|
}
|
|
2404
2749
|
|
|
2405
|
-
& input,
|
|
2750
|
+
& input,
|
|
2751
|
+
& select {
|
|
2406
2752
|
border-radius: 0;
|
|
2407
2753
|
}
|
|
2408
2754
|
|
|
2409
|
-
& input:active,
|
|
2755
|
+
& input:active,
|
|
2756
|
+
& select:active {
|
|
2410
2757
|
box-shadow: none;
|
|
2411
2758
|
}
|
|
2412
2759
|
|
|
@@ -2415,35 +2762,43 @@ const Container$3 = styled.div `
|
|
|
2415
2762
|
}
|
|
2416
2763
|
|
|
2417
2764
|
/* Handling for first and last child */
|
|
2418
|
-
& > *:first-child,
|
|
2419
|
-
& > label:first-child
|
|
2420
|
-
& >
|
|
2765
|
+
& > *:first-child,
|
|
2766
|
+
& > label:first-child input,
|
|
2767
|
+
& > label:first-child select,
|
|
2768
|
+
& > *:first-child label,
|
|
2769
|
+
& > *:first-child input {
|
|
2421
2770
|
border-left: none;
|
|
2422
|
-
border-radius: 2px 0 0
|
|
2771
|
+
border-radius: 2px 0 0 2px;
|
|
2423
2772
|
}
|
|
2424
2773
|
|
|
2425
|
-
& > *:last-child,
|
|
2426
|
-
& > label:last-child
|
|
2774
|
+
& > *:last-child,
|
|
2775
|
+
& > label:last-child input,
|
|
2776
|
+
& > label:last-child select,
|
|
2777
|
+
& > *:last-child label,
|
|
2427
2778
|
& > *:last-child input {
|
|
2428
2779
|
border-radius: 0 2px 2px 0;
|
|
2429
2780
|
}
|
|
2430
2781
|
|
|
2431
2782
|
/* focus */
|
|
2432
|
-
& *:focus,
|
|
2783
|
+
& *:focus,
|
|
2784
|
+
& *:focus + span {
|
|
2433
2785
|
z-index: 1;
|
|
2434
2786
|
}
|
|
2435
2787
|
|
|
2436
|
-
&:focus-within,
|
|
2788
|
+
&:focus-within,
|
|
2789
|
+
&:hover {
|
|
2437
2790
|
box-shadow: var(--hover-shadow, ${constants.HOVER_SHADOW});
|
|
2438
2791
|
}
|
|
2439
2792
|
|
|
2440
|
-
${props => props.errorText
|
|
2793
|
+
${(props) => props.errorText
|
|
2794
|
+
? `
|
|
2441
2795
|
border-color: var(--error, ${constants.ERROR});
|
|
2442
2796
|
|
|
2443
2797
|
& > button, & > label {
|
|
2444
2798
|
border-color: var(--error, ${constants.ERROR});
|
|
2445
2799
|
}
|
|
2446
|
-
`
|
|
2800
|
+
`
|
|
2801
|
+
: ''}
|
|
2447
2802
|
`;
|
|
2448
2803
|
const ErrorContainer = styled.div `
|
|
2449
2804
|
color: var(--error, ${constants.ERROR});
|
|
@@ -2482,10 +2837,11 @@ class Modal extends React.Component {
|
|
|
2482
2837
|
open: false,
|
|
2483
2838
|
};
|
|
2484
2839
|
this.onClose = () => {
|
|
2840
|
+
var _a, _b;
|
|
2485
2841
|
this.setState({
|
|
2486
2842
|
open: false,
|
|
2487
2843
|
});
|
|
2488
|
-
this.props.onClose
|
|
2844
|
+
(_b = (_a = this.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
2489
2845
|
this.closeCallback = null;
|
|
2490
2846
|
this.layer = null;
|
|
2491
2847
|
};
|
|
@@ -2499,9 +2855,10 @@ class Modal extends React.Component {
|
|
|
2499
2855
|
return null;
|
|
2500
2856
|
}
|
|
2501
2857
|
getSnapshotBeforeUpdate(prevProps) {
|
|
2502
|
-
|
|
2858
|
+
var _a;
|
|
2859
|
+
const _b = this.props, { open, closeOnEsc, closeOnOverlayClick, children } = _b, rest = __rest(_b, ["open", "closeOnEsc", "closeOnOverlayClick", "children"]);
|
|
2503
2860
|
if (prevProps.open && !open) {
|
|
2504
|
-
this.closeCallback
|
|
2861
|
+
(_a = this.closeCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2505
2862
|
}
|
|
2506
2863
|
if (!prevProps.open && open) {
|
|
2507
2864
|
this.layer = LayerManager$1.renderLayer({
|
|
@@ -2511,7 +2868,7 @@ class Modal extends React.Component {
|
|
|
2511
2868
|
closeCallback: this.onClose,
|
|
2512
2869
|
closeOnEsc: closeOnEsc,
|
|
2513
2870
|
closeOnOverlayClick: closeOnOverlayClick,
|
|
2514
|
-
component: (jsxRuntime.jsx(DialogContainer, Object.assign({}, rest, { onClick: e => e.stopPropagation(), elevated: true, children: children })))
|
|
2871
|
+
component: (jsxRuntime.jsx(DialogContainer, Object.assign({}, rest, { onClick: (e) => e.stopPropagation(), elevated: true, children: children }))),
|
|
2515
2872
|
});
|
|
2516
2873
|
this.closeCallback = this.layer[1];
|
|
2517
2874
|
this.forceUpdate();
|
|
@@ -2613,18 +2970,20 @@ const getTypeStyle = (type) => {
|
|
|
2613
2970
|
};
|
|
2614
2971
|
const Container$2 = styled.div `
|
|
2615
2972
|
display: flex;
|
|
2616
|
-
flex-direction: ${props =>
|
|
2617
|
-
props.position === exports.NOTIFICATION_POSITION.TOP_RIGHT
|
|
2973
|
+
flex-direction: ${(props) => props.position === exports.NOTIFICATION_POSITION.TOP_LEFT ||
|
|
2974
|
+
props.position === exports.NOTIFICATION_POSITION.TOP_RIGHT
|
|
2975
|
+
? 'column'
|
|
2976
|
+
: 'column-reverse'};
|
|
2618
2977
|
`;
|
|
2619
2978
|
const Notice = styled(Card) `
|
|
2620
2979
|
border-radius: 3px;
|
|
2621
|
-
border-left: 4px solid ${props => getBorderColor(props.type)};
|
|
2980
|
+
border-left: 4px solid ${(props) => getBorderColor(props.type)};
|
|
2622
2981
|
width: 300px;
|
|
2623
2982
|
display: flex;
|
|
2624
2983
|
padding: 0 5px 5px 0;
|
|
2625
2984
|
overflow: hidden;
|
|
2626
|
-
animation: ${props => getEntryAnimation(props.position)} .6s ease;
|
|
2627
|
-
|
|
2985
|
+
animation: ${(props) => getEntryAnimation(props.position)} 0.6s ease;
|
|
2986
|
+
|
|
2628
2987
|
& svg {
|
|
2629
2988
|
fill: currentColor;
|
|
2630
2989
|
vertical-align: middle;
|
|
@@ -2633,7 +2992,7 @@ const Notice = styled(Card) `
|
|
|
2633
2992
|
}
|
|
2634
2993
|
|
|
2635
2994
|
&.leave {
|
|
2636
|
-
animation: ${props => getExitAnimation(props.position)} .6s;
|
|
2995
|
+
animation: ${(props) => getExitAnimation(props.position)} 0.6s;
|
|
2637
2996
|
}
|
|
2638
2997
|
|
|
2639
2998
|
@keyframes in-right {
|
|
@@ -2695,7 +3054,7 @@ const Notice = styled(Card) `
|
|
|
2695
3054
|
const Title = styled.div `
|
|
2696
3055
|
padding: 5px 0;
|
|
2697
3056
|
font-size: 14px;
|
|
2698
|
-
color: ${props => getTitleColor(props.type)};
|
|
3057
|
+
color: ${(props) => getTitleColor(props.type)};
|
|
2699
3058
|
display: flex;
|
|
2700
3059
|
align-items: center;
|
|
2701
3060
|
`;
|
|
@@ -2719,7 +3078,7 @@ const Body = styled.div `
|
|
|
2719
3078
|
`;
|
|
2720
3079
|
const IconContainer = styled.div `
|
|
2721
3080
|
padding: 6px 10px;
|
|
2722
|
-
${props => getTypeStyle(props.type)};
|
|
3081
|
+
${(props) => getTypeStyle(props.type)};
|
|
2723
3082
|
`;
|
|
2724
3083
|
const Footer = styled.div `
|
|
2725
3084
|
display: flex;
|
|
@@ -2749,12 +3108,12 @@ class NotificationManager extends React.Component {
|
|
|
2749
3108
|
this.remove = (id) => {
|
|
2750
3109
|
// Trigger leaving animation.
|
|
2751
3110
|
this.setState({
|
|
2752
|
-
notices: this.state.notices.map(notice => (Object.assign(Object.assign({}, notice), { leaving: notice.id === id ? true : notice.leaving })))
|
|
3111
|
+
notices: this.state.notices.map((notice) => (Object.assign(Object.assign({}, notice), { leaving: notice.id === id ? true : notice.leaving }))),
|
|
2753
3112
|
});
|
|
2754
3113
|
this.set.delete(id);
|
|
2755
3114
|
// Remove notification on animation completion.
|
|
2756
3115
|
setTimeout(() => {
|
|
2757
|
-
const notice = this.state.notices.find(notice => notice.id === id);
|
|
3116
|
+
const notice = this.state.notices.find((notice) => notice.id === id);
|
|
2758
3117
|
if (notice) {
|
|
2759
3118
|
// call close callback, ignore any errors in callback.
|
|
2760
3119
|
if (notice.onClose) {
|
|
@@ -2767,9 +3126,9 @@ class NotificationManager extends React.Component {
|
|
|
2767
3126
|
}
|
|
2768
3127
|
// Remove the notification
|
|
2769
3128
|
this.setState({
|
|
2770
|
-
notices: this.state.notices.filter(notice => notice.id !== id),
|
|
3129
|
+
notices: this.state.notices.filter((notice) => notice.id !== id),
|
|
2771
3130
|
}, () => {
|
|
2772
|
-
// Check if the stack is empty and then call the
|
|
3131
|
+
// Check if the stack is empty and then call the
|
|
2773
3132
|
// empty callback function.
|
|
2774
3133
|
if (this.state.notices.length === 0) {
|
|
2775
3134
|
this.props.onEmpty();
|
|
@@ -2826,16 +3185,18 @@ class NotificationManager extends React.Component {
|
|
|
2826
3185
|
* @param id
|
|
2827
3186
|
*/
|
|
2828
3187
|
this.resume = (id) => () => {
|
|
2829
|
-
const notice = this.state.notices.find(notice => notice.id === id);
|
|
3188
|
+
const notice = this.state.notices.find((notice) => notice.id === id);
|
|
2830
3189
|
if (!notice.sticky) {
|
|
2831
3190
|
this.timeouts[id] = setTimeout(() => this.remove(id), DEFAULT_DURATION$1);
|
|
2832
3191
|
}
|
|
2833
3192
|
};
|
|
2834
3193
|
}
|
|
2835
3194
|
render() {
|
|
2836
|
-
return (jsxRuntime.jsx(Container$2, { position: this.props.position, children: this.state.notices.map(notice => {
|
|
3195
|
+
return (jsxRuntime.jsx(Container$2, { position: this.props.position, children: this.state.notices.map((notice) => {
|
|
2837
3196
|
const { id, title, description, leaving, type = exports.NOTIFICATION_TYPE.INFO, buttonText, buttonClick, } = notice;
|
|
2838
|
-
return (jsxRuntime.jsxs(Notice, Object.assign({}, notice, { position: this.props.position, className: leaving ? 'leave' : '', onMouseEnter: this.pause(id), onMouseLeave: this.resume(id), children: [jsxRuntime.jsxs(IconContainer, { type: type, children: [type === exports.NOTIFICATION_TYPE.INFO && jsxRuntime.jsx(CheckCircle$3, {}), type === exports.NOTIFICATION_TYPE.SUCCESS && jsxRuntime.jsx(CheckCircle$4, {}), type === exports.NOTIFICATION_TYPE.WARNING && jsxRuntime.jsx(CheckCircle$2, {}), type === exports.NOTIFICATION_TYPE.DANGER && jsxRuntime.jsx(CheckCircle$1, {})] }), jsxRuntime.jsxs(FillParent, { children: [jsxRuntime.jsxs(Title, { type: type, children: [jsxRuntime.jsx(FillParent, { children: title }), jsxRuntime.jsx(CloseButton, { onClick: this.closeClickHandler(id), children: jsxRuntime.jsx(Close, {}) })] }), jsxRuntime.jsx(Body, { children: description }), buttonText && (jsxRuntime.jsx(Footer, { children: jsxRuntime.jsx(ActionButton, { onClick: () => {
|
|
3197
|
+
return (jsxRuntime.jsxs(Notice, Object.assign({}, notice, { position: this.props.position, className: leaving ? 'leave' : '', onMouseEnter: this.pause(id), onMouseLeave: this.resume(id), children: [jsxRuntime.jsxs(IconContainer, { type: type, children: [type === exports.NOTIFICATION_TYPE.INFO && jsxRuntime.jsx(CheckCircle$3, {}), type === exports.NOTIFICATION_TYPE.SUCCESS && jsxRuntime.jsx(CheckCircle$4, {}), type === exports.NOTIFICATION_TYPE.WARNING && jsxRuntime.jsx(CheckCircle$2, {}), type === exports.NOTIFICATION_TYPE.DANGER && jsxRuntime.jsx(CheckCircle$1, {})] }), jsxRuntime.jsxs(FillParent, { children: [jsxRuntime.jsxs(Title, { type: type, children: [jsxRuntime.jsx(FillParent, { children: title }), jsxRuntime.jsx(CloseButton, { onClick: this.closeClickHandler(id), children: jsxRuntime.jsx(Close, {}) })] }), jsxRuntime.jsx(Body, { children: description }), buttonText && (jsxRuntime.jsx(Footer, { children: jsxRuntime.jsx(ActionButton, { onClick: () => {
|
|
3198
|
+
buttonClick === null || buttonClick === void 0 ? void 0 : buttonClick();
|
|
3199
|
+
}, children: buttonText }) }))] })] }), id));
|
|
2839
3200
|
}) }));
|
|
2840
3201
|
}
|
|
2841
3202
|
}
|
|
@@ -2904,13 +3265,16 @@ class Notification {
|
|
|
2904
3265
|
closeOnOverlayClick: false,
|
|
2905
3266
|
position: positionMap[position],
|
|
2906
3267
|
alwaysOnTop: true,
|
|
2907
|
-
component: (jsxRuntime.jsx(NotificationManager, { ref: ref, position: position, onEmpty: () => this.destroy(position) }))
|
|
3268
|
+
component: (jsxRuntime.jsx(NotificationManager, { ref: ref, position: position, onEmpty: () => this.destroy(position) })),
|
|
2908
3269
|
});
|
|
2909
3270
|
this.containers.set(position, {
|
|
2910
3271
|
ref,
|
|
2911
3272
|
element: div,
|
|
3273
|
+
root: client.createRoot(div),
|
|
3274
|
+
});
|
|
3275
|
+
ReactDOM.flushSync(() => {
|
|
3276
|
+
this.containers.get(position).root.render(jsxRuntime.jsx(Component, {}));
|
|
2912
3277
|
});
|
|
2913
|
-
ReactDOM.render(jsxRuntime.jsx(Component, {}), div);
|
|
2914
3278
|
notification = ref;
|
|
2915
3279
|
}
|
|
2916
3280
|
else {
|
|
@@ -2936,7 +3300,7 @@ class Notification {
|
|
|
2936
3300
|
*/
|
|
2937
3301
|
this.destroy = (position) => {
|
|
2938
3302
|
const notification = this.containers.get(position);
|
|
2939
|
-
|
|
3303
|
+
notification.root.unmount();
|
|
2940
3304
|
this.containers.delete(position);
|
|
2941
3305
|
};
|
|
2942
3306
|
}
|
|
@@ -2948,14 +3312,18 @@ const SpinnerDiv = styled.div `
|
|
|
2948
3312
|
border: 4px solid var(--primary, ${constants.PRIMARY});
|
|
2949
3313
|
border-top: 4px solid var(--border-light-color, ${constants.BORDER_LIGHT_COLOR});
|
|
2950
3314
|
border-radius: 50%;
|
|
2951
|
-
width: ${props => props.size}px;
|
|
2952
|
-
height: ${props => props.size}px;
|
|
3315
|
+
width: ${(props) => props.size}px;
|
|
3316
|
+
height: ${(props) => props.size}px;
|
|
2953
3317
|
margin: 0 auto;
|
|
2954
3318
|
animation: spin 1s linear infinite;
|
|
2955
3319
|
|
|
2956
3320
|
@keyframes spin {
|
|
2957
|
-
0% {
|
|
2958
|
-
|
|
3321
|
+
0% {
|
|
3322
|
+
transform: rotate(0deg);
|
|
3323
|
+
}
|
|
3324
|
+
100% {
|
|
3325
|
+
transform: rotate(360deg);
|
|
3326
|
+
}
|
|
2959
3327
|
}
|
|
2960
3328
|
`;
|
|
2961
3329
|
function Spinner(props) {
|
|
@@ -2963,7 +3331,7 @@ function Spinner(props) {
|
|
|
2963
3331
|
}
|
|
2964
3332
|
Spinner.propTypes = {
|
|
2965
3333
|
/** Spinner's size */
|
|
2966
|
-
size: PropTypes.number
|
|
3334
|
+
size: PropTypes.number,
|
|
2967
3335
|
};
|
|
2968
3336
|
Spinner.defaultProps = {
|
|
2969
3337
|
size: 30,
|
|
@@ -2993,7 +3361,7 @@ const Header = styled.div `
|
|
|
2993
3361
|
z-index: 0;
|
|
2994
3362
|
}
|
|
2995
3363
|
}
|
|
2996
|
-
|
|
3364
|
+
|
|
2997
3365
|
& > * {
|
|
2998
3366
|
z-index: 1;
|
|
2999
3367
|
}
|
|
@@ -3003,12 +3371,12 @@ const HeaderButton = styled.button `
|
|
|
3003
3371
|
padding: 16px 24px 16px 16px;
|
|
3004
3372
|
font-size: 16px;
|
|
3005
3373
|
cursor: pointer;
|
|
3006
|
-
background-color: ${props => props.active
|
|
3374
|
+
background-color: ${(props) => props.active
|
|
3007
3375
|
? `var(--border-light-color, ${constants.BORDER_LIGHT_COLOR})`
|
|
3008
3376
|
: `var(--background, ${constants.BACKGROUND})`};
|
|
3009
|
-
font-weight: ${props => props.active ? 'bold' : 'normal'};
|
|
3377
|
+
font-weight: ${(props) => (props.active ? 'bold' : 'normal')};
|
|
3010
3378
|
overflow: hidden;
|
|
3011
|
-
display:flex;
|
|
3379
|
+
display: flex;
|
|
3012
3380
|
align-items: center;
|
|
3013
3381
|
|
|
3014
3382
|
&:disabled {
|
|
@@ -3016,7 +3384,8 @@ const HeaderButton = styled.button `
|
|
|
3016
3384
|
background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});
|
|
3017
3385
|
}
|
|
3018
3386
|
|
|
3019
|
-
&:enabled:hover,
|
|
3387
|
+
&:enabled:hover,
|
|
3388
|
+
&:focus {
|
|
3020
3389
|
background-color: var(--primary-light, ${constants.PRIMARY_LIGHTER});
|
|
3021
3390
|
}
|
|
3022
3391
|
|
|
@@ -3046,6 +3415,7 @@ const MobileHeader = styled.div `
|
|
|
3046
3415
|
function Stepper(props) {
|
|
3047
3416
|
const [active, setActive] = React.useState(props.active);
|
|
3048
3417
|
const { children, onStepClick } = props;
|
|
3418
|
+
const childrenArray = React.Children.toArray(children);
|
|
3049
3419
|
const stepClickHandler = (index) => () => {
|
|
3050
3420
|
setActive(index);
|
|
3051
3421
|
onStepClick === null || onStepClick === void 0 ? void 0 : onStepClick(index);
|
|
@@ -3062,7 +3432,13 @@ function Stepper(props) {
|
|
|
3062
3432
|
}
|
|
3063
3433
|
return exports.BADGE_TYPE.DISABLED;
|
|
3064
3434
|
};
|
|
3065
|
-
return (jsxRuntime.jsxs(Container$1, { children: [jsxRuntime.jsxs(Header, { children: [React.Children.map(children, (child, index) =>
|
|
3435
|
+
return (jsxRuntime.jsxs(Container$1, { children: [jsxRuntime.jsxs(Header, { children: [React.Children.map(children, (child, index) => {
|
|
3436
|
+
if (!React.isValidElement(child))
|
|
3437
|
+
return null;
|
|
3438
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(HeaderButton, { active: index === active, type: "button", disabled: child.props.disabled, onClick: stepClickHandler(index), children: [jsxRuntime.jsx(Badge, { inline: true, type: getBadgeType(index, child.props.completed, child.props.disabled) }), jsxRuntime.jsx(Ellipsis, { children: child.props.name })] }) }));
|
|
3439
|
+
}), jsxRuntime.jsxs(MobileHeader, { children: [jsxRuntime.jsx("span", { children: React.isValidElement(childrenArray[active])
|
|
3440
|
+
? childrenArray[active].props.name
|
|
3441
|
+
: '' }), jsxRuntime.jsxs(Badge, { inline: true, type: exports.BADGE_TYPE.PRIMARY, children: [active + 1, " of ", React.Children.count(children)] })] })] }), childrenArray[active]] }));
|
|
3066
3442
|
}
|
|
3067
3443
|
Stepper.propTypes = {
|
|
3068
3444
|
/** Index of currently active step */
|
|
@@ -3080,6 +3456,7 @@ const Container = styled.div `
|
|
|
3080
3456
|
flex-direction: column;
|
|
3081
3457
|
`;
|
|
3082
3458
|
function Step(props) {
|
|
3459
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3083
3460
|
const { name, disabled, completed } = props, rest = __rest(props, ["name", "disabled", "completed"]);
|
|
3084
3461
|
return jsxRuntime.jsx(Container, Object.assign({}, rest));
|
|
3085
3462
|
}
|
|
@@ -3094,13 +3471,16 @@ const Button = styled.button `
|
|
|
3094
3471
|
padding: 8px 12px;
|
|
3095
3472
|
font-size: 14px;
|
|
3096
3473
|
border-radius: 3px 3px 0 0;
|
|
3097
|
-
border-bottom: ${(props) =>
|
|
3474
|
+
border-bottom: ${(props) => props.active ? `3px solid var(--primary, ${constants.PRIMARY})` : 'none'};
|
|
3098
3475
|
color: ${(props) => (props.active ? `var(--primary, ${constants.PRIMARY})` : '#000')};
|
|
3099
3476
|
cursor: pointer;
|
|
3100
3477
|
|
|
3101
|
-
&:hover,
|
|
3478
|
+
&:hover,
|
|
3479
|
+
&:focus {
|
|
3102
3480
|
background-color: var(--primary-lighter, #cfe9ff);
|
|
3103
|
-
border-bottom: ${(props) =>
|
|
3481
|
+
border-bottom: ${(props) => props.active
|
|
3482
|
+
? `3px solid var(--primary, ${constants.PRIMARY})`
|
|
3483
|
+
: `3px solid var(--primary, ${constants.PRIMARY})`};
|
|
3104
3484
|
}
|
|
3105
3485
|
|
|
3106
3486
|
&[disabled] {
|
|
@@ -3122,10 +3502,11 @@ function Tabs(props) {
|
|
|
3122
3502
|
const switchTab = (index) => () => setActive(index);
|
|
3123
3503
|
const { children } = props;
|
|
3124
3504
|
React.useEffect(() => {
|
|
3505
|
+
var _a;
|
|
3125
3506
|
setActive(props.active);
|
|
3126
|
-
props.onChange
|
|
3127
|
-
}, [props
|
|
3128
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ButtonContainer, Object.assign({}, props.props, { children: React.Children.map(children, (child, index) => (jsxRuntime.jsx(Button, { type: "button", active: active === index, onClick: switchTab(index), disabled: child.props.disabled, children: child.props.name }))) })), jsxRuntime.jsx(TabBody, Object.assign({}, props.bodyProps, { children: children[active] }))] }));
|
|
3507
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, props.active);
|
|
3508
|
+
}, [props]);
|
|
3509
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ButtonContainer, Object.assign({}, props.props, { children: React.Children.map(children, (child, index) => (jsxRuntime.jsx(Button, { type: "button", active: active === index, onClick: switchTab(index), disabled: React.isValidElement(child) ? child.props.disabled : false, children: React.isValidElement(child) ? child.props.name : '' }))) })), jsxRuntime.jsx(TabBody, Object.assign({}, props.bodyProps, { children: React.Children.toArray(children)[active] }))] }));
|
|
3129
3510
|
}
|
|
3130
3511
|
Tabs.propTypes = {
|
|
3131
3512
|
/** Active Tab Index */
|
|
@@ -3181,13 +3562,13 @@ const ToastContainer = styled(Card) `
|
|
|
3181
3562
|
box-sizing: border-box;
|
|
3182
3563
|
border-radius: 3px;
|
|
3183
3564
|
padding: 12px;
|
|
3184
|
-
background-color: ${props => getBackgroundColor(props.type)};
|
|
3565
|
+
background-color: ${(props) => getBackgroundColor(props.type)};
|
|
3185
3566
|
color: #fff;
|
|
3186
3567
|
margin: 20px;
|
|
3187
3568
|
font-size: 14px;
|
|
3188
3569
|
line-height: 20px;
|
|
3189
3570
|
transform: translateY(100%);
|
|
3190
|
-
transition: transform .3s ease;
|
|
3571
|
+
transition: transform 0.3s ease;
|
|
3191
3572
|
width: 344px;
|
|
3192
3573
|
display: flex;
|
|
3193
3574
|
align-items: center;
|
|
@@ -3238,7 +3619,7 @@ class Toast {
|
|
|
3238
3619
|
this.toast = null;
|
|
3239
3620
|
setTimeout(() => {
|
|
3240
3621
|
if (!this.toast) {
|
|
3241
|
-
|
|
3622
|
+
this.root.unmount();
|
|
3242
3623
|
}
|
|
3243
3624
|
}, 300);
|
|
3244
3625
|
};
|
|
@@ -3271,10 +3652,11 @@ class Toast {
|
|
|
3271
3652
|
closeOnOverlayClick: false,
|
|
3272
3653
|
alwaysOnTop: true,
|
|
3273
3654
|
position: LAYER_POSITION.BOTTOM_LEFT,
|
|
3274
|
-
component: (jsxRuntime.jsxs(ToastContainer, Object.assign({}, options, { type: type, elevated: true, onMouseEnter: this.pause, onMouseLeave: this.resume(options), children: [jsxRuntime.jsx(TextContainer, { children: text }), buttonText && (jsxRuntime.jsx(CloseContainer, { onClick: buttonClick, type:
|
|
3655
|
+
component: (jsxRuntime.jsxs(ToastContainer, Object.assign({}, options, { type: type, elevated: true, onMouseEnter: this.pause, onMouseLeave: this.resume(options), children: [jsxRuntime.jsx(TextContainer, { children: text }), buttonText && (jsxRuntime.jsx(CloseContainer, { onClick: buttonClick, type: "button", children: buttonText }))] }))),
|
|
3275
3656
|
});
|
|
3276
3657
|
const Component = this.toast[0];
|
|
3277
|
-
|
|
3658
|
+
this.root = client.createRoot(this.element);
|
|
3659
|
+
this.root.render(jsxRuntime.jsx(Component, {}));
|
|
3278
3660
|
this.timeout = setTimeout(() => {
|
|
3279
3661
|
this.remove();
|
|
3280
3662
|
}, duration || DEFAULT_DURATION);
|
|
@@ -3327,10 +3709,10 @@ const TooltipDiv = styled.div `
|
|
|
3327
3709
|
padding: 5px;
|
|
3328
3710
|
color: #fff;
|
|
3329
3711
|
border-radius: 3px;
|
|
3330
|
-
transition: transform .3s ease;
|
|
3712
|
+
transition: transform 0.3s ease;
|
|
3331
3713
|
font-size: 12px;
|
|
3332
3714
|
z-index: 1;
|
|
3333
|
-
${props => positionStyle[props.position]}
|
|
3715
|
+
${(props) => positionStyle[props.position]}
|
|
3334
3716
|
`;
|
|
3335
3717
|
const TooltipContainer = styled.div `
|
|
3336
3718
|
position: relative;
|
|
@@ -3339,7 +3721,7 @@ const TooltipContainer = styled.div `
|
|
|
3339
3721
|
align-items: center;
|
|
3340
3722
|
|
|
3341
3723
|
&:hover ${TooltipDiv} {
|
|
3342
|
-
${props => positionHoverStyle[props.position]}
|
|
3724
|
+
${(props) => positionHoverStyle[props.position]}
|
|
3343
3725
|
}
|
|
3344
3726
|
`;
|
|
3345
3727
|
function Tooltip(props) {
|
|
@@ -3354,11 +3736,11 @@ Tooltip.propTypes = {
|
|
|
3354
3736
|
exports.TOOLTIP_POSITION.TOP,
|
|
3355
3737
|
exports.TOOLTIP_POSITION.LEFT,
|
|
3356
3738
|
exports.TOOLTIP_POSITION.RIGHT,
|
|
3357
|
-
exports.TOOLTIP_POSITION.BOTTOM
|
|
3739
|
+
exports.TOOLTIP_POSITION.BOTTOM,
|
|
3358
3740
|
]),
|
|
3359
3741
|
};
|
|
3360
3742
|
Tooltip.defaultProps = {
|
|
3361
|
-
position: exports.TOOLTIP_POSITION.BOTTOM
|
|
3743
|
+
position: exports.TOOLTIP_POSITION.BOTTOM,
|
|
3362
3744
|
};
|
|
3363
3745
|
|
|
3364
3746
|
exports.Accordion = Accordion;
|
|
@@ -3375,6 +3757,7 @@ exports.CardFooter = Footer$1;
|
|
|
3375
3757
|
exports.CardHeader = Header$1;
|
|
3376
3758
|
exports.Checkbox = Checkbox;
|
|
3377
3759
|
exports.Chip = Chip;
|
|
3760
|
+
exports.ChipInput = ChipInput;
|
|
3378
3761
|
exports.ConfirmDialog = ConfirmDialog;
|
|
3379
3762
|
exports.Dialog = Dialog;
|
|
3380
3763
|
exports.DialogBody = Body$1;
|