no-frills-ui 0.0.14-alpha.1 → 0.0.14-alpha.2
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 +828 -495
- package/dist/index.js.map +1 -1
- package/lib-esm/components/Accordion/Accordion.d.ts +2 -3
- 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 +2 -2
- 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.js.map +1 -1
- package/lib-esm/components/Badge/Badge.js +5 -6
- package/lib-esm/components/Badge/Badge.js.map +1 -1
- package/lib-esm/components/Button/LinkButton.js +2 -1
- package/lib-esm/components/Button/LinkButton.js.map +1 -1
- package/lib-esm/components/Card/Card.js +1 -1
- package/lib-esm/components/Card/Card.js.map +1 -1
- package/lib-esm/components/Chip/Chip.js +1 -1
- package/lib-esm/components/Chip/Chip.js.map +1 -1
- package/lib-esm/components/ChipInput/ChipInput.js +21 -12
- package/lib-esm/components/ChipInput/ChipInput.js.map +1 -1
- package/lib-esm/components/Dialog/AlertDialog.js +3 -3
- package/lib-esm/components/Dialog/AlertDialog.js.map +1 -1
- 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 +2 -2
- package/lib-esm/components/Dialog/Dialog.js +6 -4
- package/lib-esm/components/Dialog/Dialog.js.map +1 -1
- package/lib-esm/components/Dialog/PromptDialog.js +2 -2
- package/lib-esm/components/Dialog/PromptDialog.js.map +1 -1
- package/lib-esm/components/DragAndDrop/DragAndDrop.d.ts +1 -1
- 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.js +25 -17
- package/lib-esm/components/DragAndDrop/DragItem.js.map +1 -1
- 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.js +10 -8
- package/lib-esm/components/Drawer/Drawer.js.map +1 -1
- package/lib-esm/components/Drawer/index.d.ts +1 -1
- 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.js +26 -14
- package/lib-esm/components/Groups/Group.js.map +1 -1
- 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 +2 -2
- 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.js +19 -10
- package/lib-esm/components/Input/Input.js.map +1 -1
- 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.js +1 -1
- package/lib-esm/components/Input/RadioButton.js.map +1 -1
- 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.js +17 -9
- package/lib-esm/components/Input/TextArea.js.map +1 -1
- package/lib-esm/components/Input/Toggle.js +5 -5
- package/lib-esm/components/Input/Toggle.js.map +1 -1
- package/lib-esm/components/Menu/Menu.d.ts +1 -1
- 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 +11 -5
- package/lib-esm/components/Menu/MenuContext.js.map +1 -1
- package/lib-esm/components/Menu/MenuItem.d.ts +2 -2
- package/lib-esm/components/Menu/MenuItem.js +9 -5
- package/lib-esm/components/Menu/MenuItem.js.map +1 -1
- package/lib-esm/components/Modal/Modal.js +6 -4
- package/lib-esm/components/Modal/Modal.js.map +1 -1
- 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.js +11 -9
- package/lib-esm/components/Notification/NotificationManager.js.map +1 -1
- 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.js +0 -1
- package/lib-esm/components/Notification/types.js.map +1 -1
- 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.js.map +1 -1
- package/lib-esm/components/Spinner/Spinner.js +10 -6
- package/lib-esm/components/Spinner/Spinner.js.map +1 -1
- 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 +3 -3
- 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.js.map +1 -1
- package/lib-esm/components/Tabs/Tab.js.map +1 -1
- package/lib-esm/components/Tabs/Tabs.d.ts +5 -5
- package/lib-esm/components/Tabs/Tabs.js +12 -9
- package/lib-esm/components/Tabs/Tabs.js.map +1 -1
- package/lib-esm/components/Toast/Toast.d.ts +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.js +1 -1
- package/lib-esm/components/Toast/ToastStory.js.map +1 -1
- package/lib-esm/components/Tooltip/Tooltip.js +5 -6
- package/lib-esm/components/Tooltip/Tooltip.js.map +1 -1
- package/lib-esm/components/index.d.ts +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 +1 -1
- package/lib-esm/icons/CheckCircle.js +1 -1
- package/lib-esm/icons/CheckCircle.js.map +1 -1
- package/lib-esm/icons/Close.d.ts +1 -1
- package/lib-esm/icons/Close.js +1 -1
- package/lib-esm/icons/Close.js.map +1 -1
- package/lib-esm/icons/DragIndicator.d.ts +1 -1
- package/lib-esm/icons/DragIndicator.js +1 -1
- package/lib-esm/icons/DragIndicator.js.map +1 -1
- package/lib-esm/icons/ErrorOutline.d.ts +1 -1
- package/lib-esm/icons/ErrorOutline.js +1 -1
- package/lib-esm/icons/ErrorOutline.js.map +1 -1
- package/lib-esm/icons/ExpandMore.d.ts +1 -1
- package/lib-esm/icons/ExpandMore.js +1 -1
- package/lib-esm/icons/ExpandMore.js.map +1 -1
- package/lib-esm/icons/FiberManualRecord.d.ts +1 -1
- package/lib-esm/icons/FiberManualRecord.js +1 -1
- package/lib-esm/icons/FiberManualRecord.js.map +1 -1
- package/lib-esm/icons/Info.d.ts +1 -1
- package/lib-esm/icons/Info.js +1 -1
- package/lib-esm/icons/Info.js.map +1 -1
- package/lib-esm/icons/ReportProblem.d.ts +1 -1
- package/lib-esm/icons/ReportProblem.js +1 -1
- package/lib-esm/icons/ReportProblem.js.map +1 -1
- package/lib-esm/shared/LayerManager.d.ts +2 -2
- package/lib-esm/shared/LayerManager.js +18 -14
- package/lib-esm/shared/LayerManager.js.map +1 -1
- package/lib-esm/shared/constants.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.
|
|
@@ -649,10 +1137,11 @@ class LayerManager {
|
|
|
649
1137
|
*/
|
|
650
1138
|
this.unmount = (layer, resp) => {
|
|
651
1139
|
layer.element.setAttribute('class', 'nf-layer-exit');
|
|
652
|
-
this.layers.splice(this.layers.findIndex(item => item === layer), 1);
|
|
1140
|
+
this.layers.splice(this.layers.findIndex((item) => item === layer), 1);
|
|
653
1141
|
setTimeout(() => {
|
|
1142
|
+
var _a, _b;
|
|
654
1143
|
try {
|
|
655
|
-
layer.config.closeCallback
|
|
1144
|
+
(_b = (_a = layer.config).closeCallback) === null || _b === void 0 ? void 0 : _b.call(_a, resp);
|
|
656
1145
|
}
|
|
657
1146
|
catch (e) {
|
|
658
1147
|
// Error in callback function. Ignore and proceed.
|
|
@@ -677,11 +1166,13 @@ class LayerManager {
|
|
|
677
1166
|
const currentLayer = {
|
|
678
1167
|
id: `nf-layer-manager-${currentIndex}`,
|
|
679
1168
|
config: layerConfig,
|
|
680
|
-
element: divElement
|
|
1169
|
+
element: divElement,
|
|
681
1170
|
};
|
|
682
1171
|
this.layers.push(currentLayer);
|
|
683
1172
|
const overlayClickHandler = (layer) => () => {
|
|
684
|
-
layer.config.closeOnOverlayClick !== false
|
|
1173
|
+
if (layer.config.closeOnOverlayClick !== false) {
|
|
1174
|
+
this.unmount(layer);
|
|
1175
|
+
}
|
|
685
1176
|
};
|
|
686
1177
|
// Return callback which will trigger the un-mount.
|
|
687
1178
|
return [
|
|
@@ -701,14 +1192,14 @@ class LayerManager {
|
|
|
701
1192
|
document.body.removeChild(divElement);
|
|
702
1193
|
};
|
|
703
1194
|
}, []);
|
|
704
|
-
return ReactDOM.createPortal(jsxRuntime.jsx(Container$
|
|
1195
|
+
return ReactDOM.createPortal(jsxRuntime.jsx(Container$5, Object.assign({ onClick: overlayClickHandler(currentLayer), zIndex: currentIndex }, layerConfig, { children: layerConfig.component })), divElement);
|
|
705
1196
|
},
|
|
706
1197
|
(resp) => {
|
|
707
1198
|
this.unmount(currentLayer, resp);
|
|
708
|
-
}
|
|
1199
|
+
},
|
|
709
1200
|
];
|
|
710
1201
|
};
|
|
711
|
-
document.body.addEventListener('keyup', (e) => {
|
|
1202
|
+
document === null || document === void 0 ? void 0 : document.body.addEventListener('keyup', (e) => {
|
|
712
1203
|
if (this.layers.length && e.keyCode === KEY_CODES$1.ESC) {
|
|
713
1204
|
const lastLayer = this.layers.slice(-1)[0];
|
|
714
1205
|
if (lastLayer.config.closeOnEsc !== false) {
|
|
@@ -726,7 +1217,7 @@ const DialogContainer = styled(Card) `
|
|
|
726
1217
|
max-height: 80vh;
|
|
727
1218
|
transform: scale(0);
|
|
728
1219
|
opacity: 0;
|
|
729
|
-
transition: all .3s ease;
|
|
1220
|
+
transition: all 0.3s ease;
|
|
730
1221
|
|
|
731
1222
|
.nf-layer-enter & {
|
|
732
1223
|
opacity: 1;
|
|
@@ -751,13 +1242,15 @@ class Dialog extends React.Component {
|
|
|
751
1242
|
this.onCloseFn = closeCallback;
|
|
752
1243
|
};
|
|
753
1244
|
this.close = (resp) => {
|
|
754
|
-
|
|
1245
|
+
var _a;
|
|
1246
|
+
(_a = this.closeDialog) === null || _a === void 0 ? void 0 : _a.call(this, resp);
|
|
755
1247
|
};
|
|
756
1248
|
this.closeCallback = (resp) => {
|
|
1249
|
+
var _a;
|
|
757
1250
|
this.setState({
|
|
758
1251
|
show: false,
|
|
759
1252
|
});
|
|
760
|
-
this.onCloseFn
|
|
1253
|
+
(_a = this.onCloseFn) === null || _a === void 0 ? void 0 : _a.call(this, resp);
|
|
761
1254
|
};
|
|
762
1255
|
}
|
|
763
1256
|
shouldComponentUpdate(nextProps, nextState) {
|
|
@@ -773,7 +1266,7 @@ class Dialog extends React.Component {
|
|
|
773
1266
|
closeCallback: this.closeCallback,
|
|
774
1267
|
closeOnOverlayClick,
|
|
775
1268
|
position: LAYER_POSITION.DIALOG,
|
|
776
|
-
component: (jsxRuntime.jsx(DialogContainer, Object.assign({}, rest, { onClick: e => e.stopPropagation(), elevated: true, children: children })))
|
|
1269
|
+
component: (jsxRuntime.jsx(DialogContainer, Object.assign({}, rest, { onClick: (e) => e.stopPropagation(), elevated: true, children: children }))),
|
|
777
1270
|
});
|
|
778
1271
|
this.closeDialog = closeFn;
|
|
779
1272
|
return jsxRuntime.jsx(Component, {});
|
|
@@ -799,7 +1292,7 @@ class AlertDialog extends React.Component {
|
|
|
799
1292
|
super(...arguments);
|
|
800
1293
|
this.dialog = React.createRef();
|
|
801
1294
|
this.show = () => {
|
|
802
|
-
return new Promise(resolve => {
|
|
1295
|
+
return new Promise((resolve) => {
|
|
803
1296
|
const onClose = () => resolve(null);
|
|
804
1297
|
this.dialog.current.open(onClose);
|
|
805
1298
|
});
|
|
@@ -821,7 +1314,7 @@ AlertDialog.propTypes = {
|
|
|
821
1314
|
dialogProps: PropTypes.object,
|
|
822
1315
|
};
|
|
823
1316
|
AlertDialog.defaultProps = {
|
|
824
|
-
buttonText: 'OK'
|
|
1317
|
+
buttonText: 'OK',
|
|
825
1318
|
};
|
|
826
1319
|
|
|
827
1320
|
class ConfirmDialog extends React.Component {
|
|
@@ -831,7 +1324,12 @@ class ConfirmDialog extends React.Component {
|
|
|
831
1324
|
this.show = () => {
|
|
832
1325
|
return new Promise((resolve, reject) => {
|
|
833
1326
|
const onClose = (resp) => {
|
|
834
|
-
|
|
1327
|
+
if (resp) {
|
|
1328
|
+
resolve(null);
|
|
1329
|
+
}
|
|
1330
|
+
else {
|
|
1331
|
+
reject();
|
|
1332
|
+
}
|
|
835
1333
|
};
|
|
836
1334
|
this.dialog.current.open(onClose);
|
|
837
1335
|
});
|
|
@@ -858,7 +1356,7 @@ ConfirmDialog.propTypes = {
|
|
|
858
1356
|
};
|
|
859
1357
|
ConfirmDialog.defaultProps = {
|
|
860
1358
|
yesText: 'Yes',
|
|
861
|
-
noText: 'No'
|
|
1359
|
+
noText: 'No',
|
|
862
1360
|
};
|
|
863
1361
|
|
|
864
1362
|
const Label$5 = styled.label `
|
|
@@ -881,12 +1379,14 @@ const TextField$1 = styled.input `
|
|
|
881
1379
|
background-color: var(--background, ${constants.BACKGROUND});
|
|
882
1380
|
|
|
883
1381
|
/** Focused */
|
|
884
|
-
&:focus,
|
|
1382
|
+
&:focus,
|
|
1383
|
+
&:active {
|
|
885
1384
|
border-color: var(--primary, ${constants.PRIMARY});
|
|
886
1385
|
box-shadow: 0 0 0 4px var(--primary-light, ${constants.PRIMARY_LIGHT});
|
|
887
1386
|
}
|
|
888
1387
|
|
|
889
|
-
&:focus + span,
|
|
1388
|
+
&:focus + span,
|
|
1389
|
+
&:active + span {
|
|
890
1390
|
color: var(--primary, ${constants.PRIMARY});
|
|
891
1391
|
}
|
|
892
1392
|
|
|
@@ -895,7 +1395,7 @@ const TextField$1 = styled.input `
|
|
|
895
1395
|
border-color: var(--disabled-border, ${constants.DISABLED_BORDER});
|
|
896
1396
|
background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});
|
|
897
1397
|
}
|
|
898
|
-
|
|
1398
|
+
|
|
899
1399
|
&:disabled + span {
|
|
900
1400
|
color: #777;
|
|
901
1401
|
}
|
|
@@ -906,7 +1406,8 @@ const TextField$1 = styled.input `
|
|
|
906
1406
|
box-shadow: 0 0 0 4px var(--error-light, ${constants.ERROR_LIGHT});
|
|
907
1407
|
}
|
|
908
1408
|
|
|
909
|
-
${props => props.touched
|
|
1409
|
+
${(props) => props.touched
|
|
1410
|
+
? `
|
|
910
1411
|
&:invalid {
|
|
911
1412
|
border-color: var(--error, ${constants.ERROR});
|
|
912
1413
|
}
|
|
@@ -914,16 +1415,19 @@ const TextField$1 = styled.input `
|
|
|
914
1415
|
&:invalid + span {
|
|
915
1416
|
color: var(--error, ${constants.ERROR});
|
|
916
1417
|
}
|
|
917
|
-
`
|
|
1418
|
+
`
|
|
1419
|
+
: ''}
|
|
918
1420
|
|
|
919
1421
|
/** Error */
|
|
920
|
-
${props => props.errorText
|
|
1422
|
+
${(props) => props.errorText
|
|
1423
|
+
? `
|
|
921
1424
|
border-color: var(--error, ${constants.ERROR});
|
|
922
1425
|
|
|
923
1426
|
& + span {
|
|
924
1427
|
color: var(--error, ${constants.ERROR});
|
|
925
1428
|
}
|
|
926
|
-
`
|
|
1429
|
+
`
|
|
1430
|
+
: ''}
|
|
927
1431
|
|
|
928
1432
|
/** Required */
|
|
929
1433
|
&:required + span:after {
|
|
@@ -943,14 +1447,16 @@ const TextField$1 = styled.input `
|
|
|
943
1447
|
transition: all 300ms ease;
|
|
944
1448
|
}
|
|
945
1449
|
|
|
946
|
-
${props => props.value !== ''
|
|
1450
|
+
${(props) => props.value !== ''
|
|
1451
|
+
? `
|
|
947
1452
|
& + span {
|
|
948
1453
|
top: -8px;
|
|
949
1454
|
background: var(--background, ${constants.BACKGROUND});
|
|
950
1455
|
font-size: 12px;
|
|
951
1456
|
line-height: 14px;
|
|
952
1457
|
}
|
|
953
|
-
`
|
|
1458
|
+
`
|
|
1459
|
+
: ''}
|
|
954
1460
|
|
|
955
1461
|
&:focus + span, &:placeholder-shown + span {
|
|
956
1462
|
top: -8px;
|
|
@@ -963,7 +1469,7 @@ const ErrorContainer$3 = styled.div `
|
|
|
963
1469
|
color: var(--error, ${constants.ERROR});
|
|
964
1470
|
padding-top: 3px;
|
|
965
1471
|
font-size: 12px;
|
|
966
|
-
|
|
1472
|
+
line-height: 14px;
|
|
967
1473
|
margin-left: 3px;
|
|
968
1474
|
`;
|
|
969
1475
|
const Input$4 = React.forwardRef((props, ref) => {
|
|
@@ -986,6 +1492,7 @@ const Input$4 = React.forwardRef((props, ref) => {
|
|
|
986
1492
|
};
|
|
987
1493
|
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
1494
|
});
|
|
1495
|
+
Input$4.displayName = 'Input';
|
|
989
1496
|
Input$4.propTypes = {
|
|
990
1497
|
/** Label for the field */
|
|
991
1498
|
label: PropTypes.string,
|
|
@@ -1012,12 +1519,14 @@ const TextField = styled.textarea `
|
|
|
1012
1519
|
background-color: var(--background, ${constants.BACKGROUND});
|
|
1013
1520
|
|
|
1014
1521
|
/** Focused */
|
|
1015
|
-
&:focus,
|
|
1522
|
+
&:focus,
|
|
1523
|
+
&:active {
|
|
1016
1524
|
border-color: var(--primary, ${constants.PRIMARY});
|
|
1017
1525
|
box-shadow: 0 0 0 4px var(--primary, ${constants.PRIMARY_LIGHT});
|
|
1018
1526
|
}
|
|
1019
1527
|
|
|
1020
|
-
&:focus + span,
|
|
1528
|
+
&:focus + span,
|
|
1529
|
+
&:active + span {
|
|
1021
1530
|
color: var(--primary, ${constants.PRIMARY});
|
|
1022
1531
|
}
|
|
1023
1532
|
|
|
@@ -1026,7 +1535,7 @@ const TextField = styled.textarea `
|
|
|
1026
1535
|
border-color: var(--disabled-border, ${constants.DISABLED_BORDER});
|
|
1027
1536
|
background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});
|
|
1028
1537
|
}
|
|
1029
|
-
|
|
1538
|
+
|
|
1030
1539
|
&:disabled + span {
|
|
1031
1540
|
color: var(--disabled, ${constants.DISABLED});
|
|
1032
1541
|
}
|
|
@@ -1037,7 +1546,8 @@ const TextField = styled.textarea `
|
|
|
1037
1546
|
box-shadow: 0 0 0 4px var(--error-light, ${constants.ERROR_LIGHT});
|
|
1038
1547
|
}
|
|
1039
1548
|
|
|
1040
|
-
${props => props.touched
|
|
1549
|
+
${(props) => props.touched
|
|
1550
|
+
? `
|
|
1041
1551
|
&:invalid {
|
|
1042
1552
|
border-color: var(--error, ${constants.ERROR});
|
|
1043
1553
|
}
|
|
@@ -1045,16 +1555,19 @@ const TextField = styled.textarea `
|
|
|
1045
1555
|
&:invalid + span {
|
|
1046
1556
|
color: var(--error, ${constants.ERROR});
|
|
1047
1557
|
}
|
|
1048
|
-
`
|
|
1558
|
+
`
|
|
1559
|
+
: ''}
|
|
1049
1560
|
|
|
1050
1561
|
/** Error */
|
|
1051
|
-
${props => props.errorText
|
|
1562
|
+
${(props) => props.errorText
|
|
1563
|
+
? `
|
|
1052
1564
|
border-color: var(--error, ${constants.ERROR});
|
|
1053
1565
|
|
|
1054
1566
|
& + span {
|
|
1055
1567
|
color: var(--error, ${constants.ERROR});
|
|
1056
1568
|
}
|
|
1057
|
-
`
|
|
1569
|
+
`
|
|
1570
|
+
: ''}
|
|
1058
1571
|
|
|
1059
1572
|
/** Required */
|
|
1060
1573
|
&:required + span:after {
|
|
@@ -1074,14 +1587,16 @@ const TextField = styled.textarea `
|
|
|
1074
1587
|
transition: all 300ms ease;
|
|
1075
1588
|
}
|
|
1076
1589
|
|
|
1077
|
-
${props => props.value !== ''
|
|
1590
|
+
${(props) => props.value !== ''
|
|
1591
|
+
? `
|
|
1078
1592
|
& + span {
|
|
1079
1593
|
top: -8px;
|
|
1080
1594
|
background: var(--background, ${constants.BACKGROUND});
|
|
1081
1595
|
font-size: 12px;
|
|
1082
1596
|
line-height: 14px;
|
|
1083
1597
|
}
|
|
1084
|
-
`
|
|
1598
|
+
`
|
|
1599
|
+
: ''}
|
|
1085
1600
|
|
|
1086
1601
|
&:focus + span, &:placeholder-shown + span {
|
|
1087
1602
|
top: -8px;
|
|
@@ -1152,12 +1667,14 @@ const SelectField = styled.select `
|
|
|
1152
1667
|
appearance: none;
|
|
1153
1668
|
|
|
1154
1669
|
/** Focused */
|
|
1155
|
-
&:focus,
|
|
1670
|
+
&:focus,
|
|
1671
|
+
&:active {
|
|
1156
1672
|
border-color: var(--primary, ${constants.PRIMARY});
|
|
1157
1673
|
box-shadow: 0 0 0 4px var(--primary, ${constants.PRIMARY_LIGHT});
|
|
1158
1674
|
}
|
|
1159
1675
|
|
|
1160
|
-
&:focus ~ span,
|
|
1676
|
+
&:focus ~ span,
|
|
1677
|
+
&:active ~ span {
|
|
1161
1678
|
color: var(--primary, ${constants.PRIMARY});
|
|
1162
1679
|
}
|
|
1163
1680
|
|
|
@@ -1166,7 +1683,7 @@ const SelectField = styled.select `
|
|
|
1166
1683
|
border-color: var(--disabled-border, ${constants.DISABLED_BORDER});
|
|
1167
1684
|
background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});
|
|
1168
1685
|
}
|
|
1169
|
-
|
|
1686
|
+
|
|
1170
1687
|
&:disabled ~ span {
|
|
1171
1688
|
color: var(--disabled, ${constants.DISABLED});
|
|
1172
1689
|
}
|
|
@@ -1177,7 +1694,8 @@ const SelectField = styled.select `
|
|
|
1177
1694
|
box-shadow: 0 0 0 4px var(--error-light, ${constants.ERROR_LIGHT});
|
|
1178
1695
|
}
|
|
1179
1696
|
|
|
1180
|
-
${props => props.touched
|
|
1697
|
+
${(props) => props.touched
|
|
1698
|
+
? `
|
|
1181
1699
|
&:invalid {
|
|
1182
1700
|
border-color: var(--error, ${constants.ERROR});
|
|
1183
1701
|
}
|
|
@@ -1185,16 +1703,19 @@ const SelectField = styled.select `
|
|
|
1185
1703
|
&:invalid ~ span {
|
|
1186
1704
|
color: var(--error, ${constants.ERROR});
|
|
1187
1705
|
}
|
|
1188
|
-
`
|
|
1706
|
+
`
|
|
1707
|
+
: ''}
|
|
1189
1708
|
|
|
1190
1709
|
/** Error */
|
|
1191
|
-
${props => props.errorText
|
|
1710
|
+
${(props) => props.errorText
|
|
1711
|
+
? `
|
|
1192
1712
|
border-color: var(--error, ${constants.ERROR});
|
|
1193
1713
|
|
|
1194
1714
|
& ~ span {
|
|
1195
1715
|
color: var(--error, ${constants.ERROR});
|
|
1196
1716
|
}
|
|
1197
|
-
`
|
|
1717
|
+
`
|
|
1718
|
+
: ''}
|
|
1198
1719
|
|
|
1199
1720
|
/** Required */
|
|
1200
1721
|
&:required + span:after {
|
|
@@ -1214,14 +1735,16 @@ const SelectField = styled.select `
|
|
|
1214
1735
|
transition: all 300ms ease;
|
|
1215
1736
|
}
|
|
1216
1737
|
|
|
1217
|
-
${props => props.value !== ''
|
|
1738
|
+
${(props) => props.value !== ''
|
|
1739
|
+
? `
|
|
1218
1740
|
& + span {
|
|
1219
1741
|
top: -8px;
|
|
1220
1742
|
background: var(--background, ${constants.BACKGROUND});
|
|
1221
1743
|
font-size: 12px;
|
|
1222
1744
|
line-height: 14px;
|
|
1223
1745
|
}
|
|
1224
|
-
`
|
|
1746
|
+
`
|
|
1747
|
+
: ''}
|
|
1225
1748
|
|
|
1226
1749
|
&:focus + span, &:placeholder-shown + span {
|
|
1227
1750
|
top: -8px;
|
|
@@ -1290,7 +1813,7 @@ const Input$3 = styled.input `
|
|
|
1290
1813
|
text-align: center;
|
|
1291
1814
|
line-height: 16px;
|
|
1292
1815
|
background-color: var(--background, ${constants.BACKGROUND});
|
|
1293
|
-
transition: background-color .3s ease;
|
|
1816
|
+
transition: background-color 0.3s ease;
|
|
1294
1817
|
}
|
|
1295
1818
|
|
|
1296
1819
|
&::after {
|
|
@@ -1301,7 +1824,7 @@ const Input$3 = styled.input `
|
|
|
1301
1824
|
border-bottom: 2px solid #fff;
|
|
1302
1825
|
transform: translate(-16px, 1px);
|
|
1303
1826
|
opacity: 0;
|
|
1304
|
-
transition: transform .3s ease;
|
|
1827
|
+
transition: transform 0.3s ease;
|
|
1305
1828
|
position: absolute;
|
|
1306
1829
|
}
|
|
1307
1830
|
|
|
@@ -1333,12 +1856,14 @@ const Input$3 = styled.input `
|
|
|
1333
1856
|
}
|
|
1334
1857
|
|
|
1335
1858
|
/** active and focus */
|
|
1336
|
-
&:enabled:active::before,
|
|
1859
|
+
&:enabled:active::before,
|
|
1860
|
+
&:focus::before {
|
|
1337
1861
|
border-color: var(--primary, ${constants.PRIMARY});
|
|
1338
|
-
box-shadow: 0 0 0 3px var(--primary, ${constants.PRIMARY_LIGHT});
|
|
1862
|
+
box-shadow: 0 0 0 3px var(--primary, ${constants.PRIMARY_LIGHT});
|
|
1339
1863
|
}
|
|
1340
1864
|
|
|
1341
|
-
&:enabled:active + span,
|
|
1865
|
+
&:enabled:active + span,
|
|
1866
|
+
&:focus + span {
|
|
1342
1867
|
color: var(--primary, ${constants.PRIMARY});
|
|
1343
1868
|
}
|
|
1344
1869
|
|
|
@@ -1360,7 +1885,8 @@ const Input$3 = styled.input `
|
|
|
1360
1885
|
color: #aaa;
|
|
1361
1886
|
}
|
|
1362
1887
|
|
|
1363
|
-
&:checked:disabled::before,
|
|
1888
|
+
&:checked:disabled::before,
|
|
1889
|
+
&:indeterminate:disabled::before {
|
|
1364
1890
|
background-color: #aaa;
|
|
1365
1891
|
}
|
|
1366
1892
|
`;
|
|
@@ -1371,7 +1897,7 @@ function Checkbox(props) {
|
|
|
1371
1897
|
node.indeterminate = true;
|
|
1372
1898
|
}
|
|
1373
1899
|
}
|
|
1374
|
-
}, []);
|
|
1900
|
+
}, [props.indeterminate]);
|
|
1375
1901
|
return (jsxRuntime.jsxs(Label$2, { children: [jsxRuntime.jsx(Input$3, Object.assign({}, props, { ref: ref, type: "checkbox" })), jsxRuntime.jsx("span", { children: props.label })] }));
|
|
1376
1902
|
}
|
|
1377
1903
|
Checkbox.propTypes = {
|
|
@@ -1382,7 +1908,7 @@ Checkbox.propTypes = {
|
|
|
1382
1908
|
};
|
|
1383
1909
|
Checkbox.defaultProps = {
|
|
1384
1910
|
indeterminate: false,
|
|
1385
|
-
label: ''
|
|
1911
|
+
label: '',
|
|
1386
1912
|
};
|
|
1387
1913
|
|
|
1388
1914
|
const Switch = styled.label `
|
|
@@ -1400,14 +1926,14 @@ const Input$2 = styled.input `
|
|
|
1400
1926
|
width: 30px;
|
|
1401
1927
|
height: 18px;
|
|
1402
1928
|
background-color: ${constants.LIGHT_GREY};
|
|
1403
|
-
transition: .4s;
|
|
1929
|
+
transition: 0.4s;
|
|
1404
1930
|
border-radius: 10px;
|
|
1405
1931
|
padding: 0 3px;
|
|
1406
1932
|
margin: 0 10px 0 5px;
|
|
1407
1933
|
}
|
|
1408
1934
|
& + span:before {
|
|
1409
1935
|
position: absolute;
|
|
1410
|
-
content:
|
|
1936
|
+
content: '';
|
|
1411
1937
|
height: 14px;
|
|
1412
1938
|
width: 14px;
|
|
1413
1939
|
left: 1px;
|
|
@@ -1415,7 +1941,7 @@ const Input$2 = styled.input `
|
|
|
1415
1941
|
border: 1px solid var(--disabled-border, ${constants.DISABLED_BORDER});
|
|
1416
1942
|
border-radius: 50%;
|
|
1417
1943
|
background-color: var(--background, ${constants.BACKGROUND});
|
|
1418
|
-
transition: .4s;
|
|
1944
|
+
transition: 0.4s;
|
|
1419
1945
|
}
|
|
1420
1946
|
|
|
1421
1947
|
/* checked */
|
|
@@ -1449,14 +1975,14 @@ const Input$2 = styled.input `
|
|
|
1449
1975
|
background-color: ${constants.LIGHT_GREY};
|
|
1450
1976
|
cursor: not-allowed;
|
|
1451
1977
|
}
|
|
1452
|
-
|
|
1978
|
+
|
|
1453
1979
|
&:disabled + span:before {
|
|
1454
1980
|
background-color: var(--border-light-color, ${constants.BORDER_LIGHT_COLOR});
|
|
1455
1981
|
border-color: var(--disabled-border, ${constants.DISABLED_BORDER});
|
|
1456
1982
|
}
|
|
1457
1983
|
`;
|
|
1458
1984
|
function Toggle(props) {
|
|
1459
|
-
return (jsxRuntime.jsxs(Switch, { children: [jsxRuntime.jsx(Input$2, Object.assign({}, props, { type:
|
|
1985
|
+
return (jsxRuntime.jsxs(Switch, { children: [jsxRuntime.jsx(Input$2, Object.assign({}, props, { type: "checkbox" })), jsxRuntime.jsx("span", {}), jsxRuntime.jsx("span", { children: props.label })] }));
|
|
1460
1986
|
}
|
|
1461
1987
|
Toggle.propTypes = {
|
|
1462
1988
|
/** Label for the field */
|
|
@@ -1480,7 +2006,7 @@ const Input$1 = styled.input `
|
|
|
1480
2006
|
border: 1px solid var(--border-color, ${constants.BORDER_COLOR});
|
|
1481
2007
|
border-radius: 50%;
|
|
1482
2008
|
display: block;
|
|
1483
|
-
transition: background-color .3s ease;
|
|
2009
|
+
transition: background-color 0.3s ease;
|
|
1484
2010
|
}
|
|
1485
2011
|
|
|
1486
2012
|
/* checked */
|
|
@@ -1499,7 +2025,8 @@ const Input$1 = styled.input `
|
|
|
1499
2025
|
|
|
1500
2026
|
&:enabled:checked:focus::before {
|
|
1501
2027
|
border: 1px solid var(--primary, ${constants.PRIMARY});
|
|
1502
|
-
box-shadow:
|
|
2028
|
+
box-shadow:
|
|
2029
|
+
0 0 0 3px var(--primary, ${constants.PRIMARY_LIGHT}),
|
|
1503
2030
|
inset 0 0 0 3px var(--background, ${constants.BACKGROUND});
|
|
1504
2031
|
cursor: pointer;
|
|
1505
2032
|
}
|
|
@@ -1532,7 +2059,7 @@ const Input$1 = styled.input `
|
|
|
1532
2059
|
}
|
|
1533
2060
|
`;
|
|
1534
2061
|
function Radio(props) {
|
|
1535
|
-
return (jsxRuntime.jsxs(Label$1, { children: [jsxRuntime.jsx(Input$1, Object.assign({}, props, { type:
|
|
2062
|
+
return (jsxRuntime.jsxs(Label$1, { children: [jsxRuntime.jsx(Input$1, Object.assign({}, props, { type: "radio" })), jsxRuntime.jsx("span", { children: props.label })] }));
|
|
1536
2063
|
}
|
|
1537
2064
|
Radio.propTypes = {
|
|
1538
2065
|
/** Label for the field */
|
|
@@ -1600,7 +2127,7 @@ const RadioGroup = styled.div `
|
|
|
1600
2127
|
}
|
|
1601
2128
|
`;
|
|
1602
2129
|
function RadioButton(props) {
|
|
1603
|
-
return (jsxRuntime.jsxs(Label, { children: [jsxRuntime.jsx(Input, Object.assign({}, props, { type:
|
|
2130
|
+
return (jsxRuntime.jsxs(Label, { children: [jsxRuntime.jsx(Input, Object.assign({}, props, { type: "radio" })), jsxRuntime.jsx("span", { children: props.label })] }));
|
|
1604
2131
|
}
|
|
1605
2132
|
RadioButton.propTypes = {
|
|
1606
2133
|
/** Label for the field */
|
|
@@ -1626,7 +2153,7 @@ const Menu = React.forwardRef(function (props, ref) {
|
|
|
1626
2153
|
if (multiSelect) {
|
|
1627
2154
|
if (Array.isArray(value)) {
|
|
1628
2155
|
if (value.includes(val)) {
|
|
1629
|
-
newVal = value.filter(item => item !== val);
|
|
2156
|
+
newVal = value.filter((item) => item !== val);
|
|
1630
2157
|
}
|
|
1631
2158
|
else {
|
|
1632
2159
|
newVal = [...value, val];
|
|
@@ -1642,15 +2169,16 @@ const Menu = React.forwardRef(function (props, ref) {
|
|
|
1642
2169
|
return (jsxRuntime.jsx(MenuContext.Provider, { value: {
|
|
1643
2170
|
value,
|
|
1644
2171
|
multiSelect,
|
|
1645
|
-
updateValue
|
|
2172
|
+
updateValue,
|
|
1646
2173
|
}, children: jsxRuntime.jsx(MenuContainer, { ref: ref, children: props.children }) }));
|
|
1647
2174
|
});
|
|
2175
|
+
Menu.displayName = 'Menu';
|
|
1648
2176
|
Menu.defaultProps = {
|
|
1649
2177
|
multiSelect: false,
|
|
1650
2178
|
};
|
|
1651
2179
|
|
|
1652
|
-
const Container$
|
|
1653
|
-
font-weight: ${props => props.selected ? 'bold' : 'normal'};
|
|
2180
|
+
const Container$4 = styled.button `
|
|
2181
|
+
font-weight: ${(props) => (props.selected ? 'bold' : 'normal')};
|
|
1654
2182
|
padding: 8px 6px;
|
|
1655
2183
|
border: none;
|
|
1656
2184
|
background-color: transparent;
|
|
@@ -1662,7 +2190,9 @@ const Container$6 = styled.button `
|
|
|
1662
2190
|
cursor: pointer;
|
|
1663
2191
|
position: relative;
|
|
1664
2192
|
|
|
1665
|
-
&:hover,
|
|
2193
|
+
&:hover,
|
|
2194
|
+
&:focus,
|
|
2195
|
+
&:focus-within {
|
|
1666
2196
|
background-color: var(--border-light-color, ${constants.BORDER_LIGHT_COLOR});
|
|
1667
2197
|
}
|
|
1668
2198
|
|
|
@@ -1681,8 +2211,10 @@ function MenuItem(props) {
|
|
|
1681
2211
|
}
|
|
1682
2212
|
context.updateValue(value);
|
|
1683
2213
|
};
|
|
1684
|
-
const selected = context.multiSelect
|
|
1685
|
-
|
|
2214
|
+
const selected = context.multiSelect
|
|
2215
|
+
? (_b = (_a = context.value) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, value)
|
|
2216
|
+
: context.value === value;
|
|
2217
|
+
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
2218
|
}
|
|
1687
2219
|
|
|
1688
2220
|
exports.POPOVER_POSITION = void 0;
|
|
@@ -1708,7 +2240,7 @@ const positionMap$2 = {
|
|
|
1708
2240
|
[exports.POPOVER_POSITION.BOTTOM_LEFT]: `
|
|
1709
2241
|
top: calc(100% - 10px);
|
|
1710
2242
|
left: 0;
|
|
1711
|
-
|
|
2243
|
+
`,
|
|
1712
2244
|
};
|
|
1713
2245
|
const PopoverDiv = styled.div `
|
|
1714
2246
|
position: relative;
|
|
@@ -1719,17 +2251,17 @@ const Popper = styled(Card) `
|
|
|
1719
2251
|
width: 100%;
|
|
1720
2252
|
min-width: 200px;
|
|
1721
2253
|
overflow: auto;
|
|
1722
|
-
animation: enter .3s linear;
|
|
2254
|
+
animation: enter 0.3s linear;
|
|
1723
2255
|
border-radius: 3px;
|
|
1724
2256
|
z-index: 1;
|
|
1725
|
-
transform: translate(${props => props.translateX}px, ${props => props.translateY}px);
|
|
1726
|
-
${props => positionMap$2[props.position]}
|
|
2257
|
+
transform: translate(${(props) => props.translateX}px, ${(props) => props.translateY}px);
|
|
2258
|
+
${(props) => positionMap$2[props.position]}
|
|
1727
2259
|
|
|
1728
2260
|
&.closing {
|
|
1729
2261
|
/* max-height: 0px;
|
|
1730
2262
|
opacity: 0;
|
|
1731
2263
|
overflow: hidden; */
|
|
1732
|
-
animation: exit .3s linear;
|
|
2264
|
+
animation: exit 0.3s linear;
|
|
1733
2265
|
}
|
|
1734
2266
|
|
|
1735
2267
|
@keyframes enter {
|
|
@@ -1759,7 +2291,7 @@ const Popper = styled(Card) `
|
|
|
1759
2291
|
}
|
|
1760
2292
|
`;
|
|
1761
2293
|
const KEY_CODES = {
|
|
1762
|
-
ESC: 27
|
|
2294
|
+
ESC: 27,
|
|
1763
2295
|
};
|
|
1764
2296
|
function Popover(props) {
|
|
1765
2297
|
const [open, setOpen] = React.useState(props.open);
|
|
@@ -1767,7 +2299,7 @@ function Popover(props) {
|
|
|
1767
2299
|
const [translate, setTranslate] = React.useState({ x: 0, y: 0 });
|
|
1768
2300
|
const popperRef = React.useRef();
|
|
1769
2301
|
const containerRef = React.useRef();
|
|
1770
|
-
const close = () => {
|
|
2302
|
+
const close = React.useCallback(() => {
|
|
1771
2303
|
setClosing(true);
|
|
1772
2304
|
setTimeout(() => {
|
|
1773
2305
|
setOpen(false);
|
|
@@ -1777,17 +2309,17 @@ function Popover(props) {
|
|
|
1777
2309
|
}
|
|
1778
2310
|
setClosing(false);
|
|
1779
2311
|
}, 280);
|
|
1780
|
-
};
|
|
1781
|
-
const keyupEventHandler = (e) => {
|
|
2312
|
+
}, [props]);
|
|
2313
|
+
const keyupEventHandler = React.useCallback((e) => {
|
|
1782
2314
|
if (props.closeOnEsc && e.keyCode === KEY_CODES.ESC) {
|
|
1783
2315
|
close();
|
|
1784
2316
|
}
|
|
1785
|
-
};
|
|
1786
|
-
const clickOutsideHandler = (e) => {
|
|
2317
|
+
}, [close, props.closeOnEsc]);
|
|
2318
|
+
const clickOutsideHandler = React.useCallback((e) => {
|
|
1787
2319
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
1788
2320
|
close();
|
|
1789
2321
|
}
|
|
1790
|
-
};
|
|
2322
|
+
}, [close]);
|
|
1791
2323
|
/**
|
|
1792
2324
|
* Get called on popover mount.
|
|
1793
2325
|
*/
|
|
@@ -1797,7 +2329,7 @@ function Popover(props) {
|
|
|
1797
2329
|
document.removeEventListener('keyup', keyupEventHandler);
|
|
1798
2330
|
document.removeEventListener('click', clickOutsideHandler);
|
|
1799
2331
|
};
|
|
1800
|
-
}, []);
|
|
2332
|
+
}, [clickOutsideHandler, close, keyupEventHandler]);
|
|
1801
2333
|
React.useEffect(() => {
|
|
1802
2334
|
if (props.open) {
|
|
1803
2335
|
setOpen(true);
|
|
@@ -1814,7 +2346,7 @@ function Popover(props) {
|
|
|
1814
2346
|
return () => {
|
|
1815
2347
|
document.removeEventListener('click', clickOutsideHandler);
|
|
1816
2348
|
};
|
|
1817
|
-
}, [props.open]);
|
|
2349
|
+
}, [props.open, open, clickOutsideHandler, close]);
|
|
1818
2350
|
React.useEffect(() => {
|
|
1819
2351
|
if (open) {
|
|
1820
2352
|
const { top, left, right } = popperRef.current.getBoundingClientRect();
|
|
@@ -1863,8 +2395,11 @@ function Popover(props) {
|
|
|
1863
2395
|
setTranslate(translation);
|
|
1864
2396
|
popperRef.current.focus();
|
|
1865
2397
|
}
|
|
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 => {
|
|
2398
|
+
}, [open, props.position]);
|
|
2399
|
+
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) => {
|
|
2400
|
+
e.stopPropagation();
|
|
2401
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
2402
|
+
}, children: props.children }))] }));
|
|
1868
2403
|
}
|
|
1869
2404
|
Popover.propTypes = {
|
|
1870
2405
|
/** Opens the popover */
|
|
@@ -1898,30 +2433,30 @@ function Dropdown(props) {
|
|
|
1898
2433
|
const { multiSelect, onChange } = props;
|
|
1899
2434
|
const [open, setOpen] = React.useState(false);
|
|
1900
2435
|
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();
|
|
2436
|
+
React.useEffect(() => {
|
|
2437
|
+
const focusHandler = (e) => {
|
|
2438
|
+
var _a, _b;
|
|
2439
|
+
if (open && (e.keyCode === 38 || e.keyCode === 40)) {
|
|
2440
|
+
e.preventDefault();
|
|
2441
|
+
const current = document.querySelector(':focus');
|
|
2442
|
+
if (current.tagName === 'DIV') {
|
|
2443
|
+
const firstBtn = current.querySelector('button');
|
|
2444
|
+
firstBtn === null || firstBtn === void 0 ? void 0 : firstBtn.focus();
|
|
1915
2445
|
}
|
|
1916
2446
|
else {
|
|
1917
|
-
const
|
|
1918
|
-
|
|
2447
|
+
const currentBtn = current.closest('button');
|
|
2448
|
+
if (e.keyCode === 38) {
|
|
2449
|
+
const prev = (_a = currentBtn === null || currentBtn === void 0 ? void 0 : currentBtn.previousElementSibling) === null || _a === void 0 ? void 0 : _a.closest('button');
|
|
2450
|
+
prev === null || prev === void 0 ? void 0 : prev.focus();
|
|
2451
|
+
}
|
|
2452
|
+
else {
|
|
2453
|
+
const next = (_b = currentBtn === null || currentBtn === void 0 ? void 0 : currentBtn.nextElementSibling) === null || _b === void 0 ? void 0 : _b.closest('button');
|
|
2454
|
+
next === null || next === void 0 ? void 0 : next.focus();
|
|
2455
|
+
}
|
|
1919
2456
|
}
|
|
2457
|
+
return false;
|
|
1920
2458
|
}
|
|
1921
|
-
|
|
1922
|
-
}
|
|
1923
|
-
};
|
|
1924
|
-
React.useEffect(() => {
|
|
2459
|
+
};
|
|
1925
2460
|
document.addEventListener('keydown', focusHandler);
|
|
1926
2461
|
return () => {
|
|
1927
2462
|
document.removeEventListener('keydown', focusHandler);
|
|
@@ -1941,7 +2476,7 @@ function Dropdown(props) {
|
|
|
1941
2476
|
setOpen(false);
|
|
1942
2477
|
}
|
|
1943
2478
|
};
|
|
1944
|
-
return (jsxRuntime.jsx(Popover, { position: exports.POPOVER_POSITION.BOTTOM_LEFT, open: open, element: () => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Input$4, { type:
|
|
2479
|
+
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
2480
|
}
|
|
1946
2481
|
Dropdown.defaultProps = {
|
|
1947
2482
|
multiSelect: false,
|
|
@@ -1986,7 +2521,7 @@ class PromptDialog extends React.Component {
|
|
|
1986
2521
|
}
|
|
1987
2522
|
render() {
|
|
1988
2523
|
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
|
|
2524
|
+
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
2525
|
}
|
|
1991
2526
|
}
|
|
1992
2527
|
PromptDialog.propTypes = {
|
|
@@ -2011,250 +2546,6 @@ PromptDialog.defaultProps = {
|
|
|
2011
2546
|
defaultValue: '',
|
|
2012
2547
|
};
|
|
2013
2548
|
|
|
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
2549
|
exports.DRAWER_POSITION = void 0;
|
|
2259
2550
|
(function (DRAWER_POSITION) {
|
|
2260
2551
|
DRAWER_POSITION["LEFT"] = "LEFT";
|
|
@@ -2286,13 +2577,13 @@ const DrawerDiv = styled.div `
|
|
|
2286
2577
|
display: flex;
|
|
2287
2578
|
flex-direction: column;
|
|
2288
2579
|
background-color: #fff;
|
|
2289
|
-
transition: transform .3s ease;
|
|
2580
|
+
transition: transform 0.3s ease;
|
|
2290
2581
|
box-shadow: var(--modal-shadow, ${constants.MODAL_SHADOW});
|
|
2291
|
-
${props => positionStyle$1(props.size)[props.position].before}
|
|
2582
|
+
${(props) => positionStyle$1(props.size)[props.position].before}
|
|
2292
2583
|
|
|
2293
2584
|
.nf-layer-enter & {
|
|
2294
2585
|
transform: translateX(0%);
|
|
2295
|
-
${props => positionStyle$1(props.size)[props.position].after}
|
|
2586
|
+
${(props) => positionStyle$1(props.size)[props.position].after}
|
|
2296
2587
|
}
|
|
2297
2588
|
`;
|
|
2298
2589
|
const positionMap$1 = {
|
|
@@ -2307,10 +2598,11 @@ class Drawer extends React.Component {
|
|
|
2307
2598
|
open: false,
|
|
2308
2599
|
};
|
|
2309
2600
|
this.onClose = () => {
|
|
2601
|
+
var _a, _b;
|
|
2310
2602
|
this.setState({
|
|
2311
2603
|
open: false,
|
|
2312
2604
|
});
|
|
2313
|
-
this.props.onClose
|
|
2605
|
+
(_b = (_a = this.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
2314
2606
|
this.closeCallback = null;
|
|
2315
2607
|
this.layer = null;
|
|
2316
2608
|
};
|
|
@@ -2324,9 +2616,10 @@ class Drawer extends React.Component {
|
|
|
2324
2616
|
return null;
|
|
2325
2617
|
}
|
|
2326
2618
|
getSnapshotBeforeUpdate(prevProps) {
|
|
2327
|
-
|
|
2619
|
+
var _a;
|
|
2620
|
+
const _b = this.props, { open, closeOnEsc, closeOnOverlayClick, overlay, position, children, size } = _b, rest = __rest(_b, ["open", "closeOnEsc", "closeOnOverlayClick", "overlay", "position", "children", "size"]);
|
|
2328
2621
|
if (prevProps.open && !open) {
|
|
2329
|
-
this.closeCallback
|
|
2622
|
+
(_a = this.closeCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2330
2623
|
}
|
|
2331
2624
|
if (!prevProps.open && open) {
|
|
2332
2625
|
this.layer = LayerManager$1.renderLayer({
|
|
@@ -2336,7 +2629,7 @@ class Drawer extends React.Component {
|
|
|
2336
2629
|
closeCallback: this.onClose,
|
|
2337
2630
|
closeOnEsc,
|
|
2338
2631
|
closeOnOverlayClick,
|
|
2339
|
-
component: (jsxRuntime.jsx(DrawerDiv, Object.assign({}, rest, { position: position, size: size, onClick: e => e.stopPropagation(), children: children })))
|
|
2632
|
+
component: (jsxRuntime.jsx(DrawerDiv, Object.assign({}, rest, { position: position, size: size, onClick: (e) => e.stopPropagation(), children: children }))),
|
|
2340
2633
|
});
|
|
2341
2634
|
this.closeCallback = this.layer[1];
|
|
2342
2635
|
this.forceUpdate();
|
|
@@ -2384,7 +2677,8 @@ const Container$3 = styled.div `
|
|
|
2384
2677
|
margin: 5px;
|
|
2385
2678
|
|
|
2386
2679
|
/* overrides */
|
|
2387
|
-
& button,
|
|
2680
|
+
& button,
|
|
2681
|
+
& label {
|
|
2388
2682
|
margin: 0;
|
|
2389
2683
|
border: none;
|
|
2390
2684
|
border-radius: 0;
|
|
@@ -2397,16 +2691,19 @@ const Container$3 = styled.div `
|
|
|
2397
2691
|
border-left: none;
|
|
2398
2692
|
}
|
|
2399
2693
|
|
|
2400
|
-
& input,
|
|
2694
|
+
& input,
|
|
2695
|
+
& select {
|
|
2401
2696
|
border: none;
|
|
2402
2697
|
height: 32px;
|
|
2403
2698
|
}
|
|
2404
2699
|
|
|
2405
|
-
& input,
|
|
2700
|
+
& input,
|
|
2701
|
+
& select {
|
|
2406
2702
|
border-radius: 0;
|
|
2407
2703
|
}
|
|
2408
2704
|
|
|
2409
|
-
& input:active,
|
|
2705
|
+
& input:active,
|
|
2706
|
+
& select:active {
|
|
2410
2707
|
box-shadow: none;
|
|
2411
2708
|
}
|
|
2412
2709
|
|
|
@@ -2415,35 +2712,43 @@ const Container$3 = styled.div `
|
|
|
2415
2712
|
}
|
|
2416
2713
|
|
|
2417
2714
|
/* Handling for first and last child */
|
|
2418
|
-
& > *:first-child,
|
|
2419
|
-
& > label:first-child
|
|
2420
|
-
& >
|
|
2715
|
+
& > *:first-child,
|
|
2716
|
+
& > label:first-child input,
|
|
2717
|
+
& > label:first-child select,
|
|
2718
|
+
& > *:first-child label,
|
|
2719
|
+
& > *:first-child input {
|
|
2421
2720
|
border-left: none;
|
|
2422
|
-
border-radius: 2px 0 0
|
|
2721
|
+
border-radius: 2px 0 0 2px;
|
|
2423
2722
|
}
|
|
2424
2723
|
|
|
2425
|
-
& > *:last-child,
|
|
2426
|
-
& > label:last-child
|
|
2724
|
+
& > *:last-child,
|
|
2725
|
+
& > label:last-child input,
|
|
2726
|
+
& > label:last-child select,
|
|
2727
|
+
& > *:last-child label,
|
|
2427
2728
|
& > *:last-child input {
|
|
2428
2729
|
border-radius: 0 2px 2px 0;
|
|
2429
2730
|
}
|
|
2430
2731
|
|
|
2431
2732
|
/* focus */
|
|
2432
|
-
& *:focus,
|
|
2733
|
+
& *:focus,
|
|
2734
|
+
& *:focus + span {
|
|
2433
2735
|
z-index: 1;
|
|
2434
2736
|
}
|
|
2435
2737
|
|
|
2436
|
-
&:focus-within,
|
|
2738
|
+
&:focus-within,
|
|
2739
|
+
&:hover {
|
|
2437
2740
|
box-shadow: var(--hover-shadow, ${constants.HOVER_SHADOW});
|
|
2438
2741
|
}
|
|
2439
2742
|
|
|
2440
|
-
${props => props.errorText
|
|
2743
|
+
${(props) => props.errorText
|
|
2744
|
+
? `
|
|
2441
2745
|
border-color: var(--error, ${constants.ERROR});
|
|
2442
2746
|
|
|
2443
2747
|
& > button, & > label {
|
|
2444
2748
|
border-color: var(--error, ${constants.ERROR});
|
|
2445
2749
|
}
|
|
2446
|
-
`
|
|
2750
|
+
`
|
|
2751
|
+
: ''}
|
|
2447
2752
|
`;
|
|
2448
2753
|
const ErrorContainer = styled.div `
|
|
2449
2754
|
color: var(--error, ${constants.ERROR});
|
|
@@ -2482,10 +2787,11 @@ class Modal extends React.Component {
|
|
|
2482
2787
|
open: false,
|
|
2483
2788
|
};
|
|
2484
2789
|
this.onClose = () => {
|
|
2790
|
+
var _a, _b;
|
|
2485
2791
|
this.setState({
|
|
2486
2792
|
open: false,
|
|
2487
2793
|
});
|
|
2488
|
-
this.props.onClose
|
|
2794
|
+
(_b = (_a = this.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
2489
2795
|
this.closeCallback = null;
|
|
2490
2796
|
this.layer = null;
|
|
2491
2797
|
};
|
|
@@ -2499,9 +2805,10 @@ class Modal extends React.Component {
|
|
|
2499
2805
|
return null;
|
|
2500
2806
|
}
|
|
2501
2807
|
getSnapshotBeforeUpdate(prevProps) {
|
|
2502
|
-
|
|
2808
|
+
var _a;
|
|
2809
|
+
const _b = this.props, { open, closeOnEsc, closeOnOverlayClick, children } = _b, rest = __rest(_b, ["open", "closeOnEsc", "closeOnOverlayClick", "children"]);
|
|
2503
2810
|
if (prevProps.open && !open) {
|
|
2504
|
-
this.closeCallback
|
|
2811
|
+
(_a = this.closeCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2505
2812
|
}
|
|
2506
2813
|
if (!prevProps.open && open) {
|
|
2507
2814
|
this.layer = LayerManager$1.renderLayer({
|
|
@@ -2511,7 +2818,7 @@ class Modal extends React.Component {
|
|
|
2511
2818
|
closeCallback: this.onClose,
|
|
2512
2819
|
closeOnEsc: closeOnEsc,
|
|
2513
2820
|
closeOnOverlayClick: closeOnOverlayClick,
|
|
2514
|
-
component: (jsxRuntime.jsx(DialogContainer, Object.assign({}, rest, { onClick: e => e.stopPropagation(), elevated: true, children: children })))
|
|
2821
|
+
component: (jsxRuntime.jsx(DialogContainer, Object.assign({}, rest, { onClick: (e) => e.stopPropagation(), elevated: true, children: children }))),
|
|
2515
2822
|
});
|
|
2516
2823
|
this.closeCallback = this.layer[1];
|
|
2517
2824
|
this.forceUpdate();
|
|
@@ -2613,18 +2920,20 @@ const getTypeStyle = (type) => {
|
|
|
2613
2920
|
};
|
|
2614
2921
|
const Container$2 = styled.div `
|
|
2615
2922
|
display: flex;
|
|
2616
|
-
flex-direction: ${props =>
|
|
2617
|
-
props.position === exports.NOTIFICATION_POSITION.TOP_RIGHT
|
|
2923
|
+
flex-direction: ${(props) => props.position === exports.NOTIFICATION_POSITION.TOP_LEFT ||
|
|
2924
|
+
props.position === exports.NOTIFICATION_POSITION.TOP_RIGHT
|
|
2925
|
+
? 'column'
|
|
2926
|
+
: 'column-reverse'};
|
|
2618
2927
|
`;
|
|
2619
2928
|
const Notice = styled(Card) `
|
|
2620
2929
|
border-radius: 3px;
|
|
2621
|
-
border-left: 4px solid ${props => getBorderColor(props.type)};
|
|
2930
|
+
border-left: 4px solid ${(props) => getBorderColor(props.type)};
|
|
2622
2931
|
width: 300px;
|
|
2623
2932
|
display: flex;
|
|
2624
2933
|
padding: 0 5px 5px 0;
|
|
2625
2934
|
overflow: hidden;
|
|
2626
|
-
animation: ${props => getEntryAnimation(props.position)} .6s ease;
|
|
2627
|
-
|
|
2935
|
+
animation: ${(props) => getEntryAnimation(props.position)} 0.6s ease;
|
|
2936
|
+
|
|
2628
2937
|
& svg {
|
|
2629
2938
|
fill: currentColor;
|
|
2630
2939
|
vertical-align: middle;
|
|
@@ -2633,7 +2942,7 @@ const Notice = styled(Card) `
|
|
|
2633
2942
|
}
|
|
2634
2943
|
|
|
2635
2944
|
&.leave {
|
|
2636
|
-
animation: ${props => getExitAnimation(props.position)} .6s;
|
|
2945
|
+
animation: ${(props) => getExitAnimation(props.position)} 0.6s;
|
|
2637
2946
|
}
|
|
2638
2947
|
|
|
2639
2948
|
@keyframes in-right {
|
|
@@ -2695,7 +3004,7 @@ const Notice = styled(Card) `
|
|
|
2695
3004
|
const Title = styled.div `
|
|
2696
3005
|
padding: 5px 0;
|
|
2697
3006
|
font-size: 14px;
|
|
2698
|
-
color: ${props => getTitleColor(props.type)};
|
|
3007
|
+
color: ${(props) => getTitleColor(props.type)};
|
|
2699
3008
|
display: flex;
|
|
2700
3009
|
align-items: center;
|
|
2701
3010
|
`;
|
|
@@ -2719,7 +3028,7 @@ const Body = styled.div `
|
|
|
2719
3028
|
`;
|
|
2720
3029
|
const IconContainer = styled.div `
|
|
2721
3030
|
padding: 6px 10px;
|
|
2722
|
-
${props => getTypeStyle(props.type)};
|
|
3031
|
+
${(props) => getTypeStyle(props.type)};
|
|
2723
3032
|
`;
|
|
2724
3033
|
const Footer = styled.div `
|
|
2725
3034
|
display: flex;
|
|
@@ -2749,12 +3058,12 @@ class NotificationManager extends React.Component {
|
|
|
2749
3058
|
this.remove = (id) => {
|
|
2750
3059
|
// Trigger leaving animation.
|
|
2751
3060
|
this.setState({
|
|
2752
|
-
notices: this.state.notices.map(notice => (Object.assign(Object.assign({}, notice), { leaving: notice.id === id ? true : notice.leaving })))
|
|
3061
|
+
notices: this.state.notices.map((notice) => (Object.assign(Object.assign({}, notice), { leaving: notice.id === id ? true : notice.leaving }))),
|
|
2753
3062
|
});
|
|
2754
3063
|
this.set.delete(id);
|
|
2755
3064
|
// Remove notification on animation completion.
|
|
2756
3065
|
setTimeout(() => {
|
|
2757
|
-
const notice = this.state.notices.find(notice => notice.id === id);
|
|
3066
|
+
const notice = this.state.notices.find((notice) => notice.id === id);
|
|
2758
3067
|
if (notice) {
|
|
2759
3068
|
// call close callback, ignore any errors in callback.
|
|
2760
3069
|
if (notice.onClose) {
|
|
@@ -2767,9 +3076,9 @@ class NotificationManager extends React.Component {
|
|
|
2767
3076
|
}
|
|
2768
3077
|
// Remove the notification
|
|
2769
3078
|
this.setState({
|
|
2770
|
-
notices: this.state.notices.filter(notice => notice.id !== id),
|
|
3079
|
+
notices: this.state.notices.filter((notice) => notice.id !== id),
|
|
2771
3080
|
}, () => {
|
|
2772
|
-
// Check if the stack is empty and then call the
|
|
3081
|
+
// Check if the stack is empty and then call the
|
|
2773
3082
|
// empty callback function.
|
|
2774
3083
|
if (this.state.notices.length === 0) {
|
|
2775
3084
|
this.props.onEmpty();
|
|
@@ -2826,16 +3135,18 @@ class NotificationManager extends React.Component {
|
|
|
2826
3135
|
* @param id
|
|
2827
3136
|
*/
|
|
2828
3137
|
this.resume = (id) => () => {
|
|
2829
|
-
const notice = this.state.notices.find(notice => notice.id === id);
|
|
3138
|
+
const notice = this.state.notices.find((notice) => notice.id === id);
|
|
2830
3139
|
if (!notice.sticky) {
|
|
2831
3140
|
this.timeouts[id] = setTimeout(() => this.remove(id), DEFAULT_DURATION$1);
|
|
2832
3141
|
}
|
|
2833
3142
|
};
|
|
2834
3143
|
}
|
|
2835
3144
|
render() {
|
|
2836
|
-
return (jsxRuntime.jsx(Container$2, { position: this.props.position, children: this.state.notices.map(notice => {
|
|
3145
|
+
return (jsxRuntime.jsx(Container$2, { position: this.props.position, children: this.state.notices.map((notice) => {
|
|
2837
3146
|
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: () => {
|
|
3147
|
+
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: () => {
|
|
3148
|
+
buttonClick === null || buttonClick === void 0 ? void 0 : buttonClick();
|
|
3149
|
+
}, children: buttonText }) }))] })] }), id));
|
|
2839
3150
|
}) }));
|
|
2840
3151
|
}
|
|
2841
3152
|
}
|
|
@@ -2904,13 +3215,16 @@ class Notification {
|
|
|
2904
3215
|
closeOnOverlayClick: false,
|
|
2905
3216
|
position: positionMap[position],
|
|
2906
3217
|
alwaysOnTop: true,
|
|
2907
|
-
component: (jsxRuntime.jsx(NotificationManager, { ref: ref, position: position, onEmpty: () => this.destroy(position) }))
|
|
3218
|
+
component: (jsxRuntime.jsx(NotificationManager, { ref: ref, position: position, onEmpty: () => this.destroy(position) })),
|
|
2908
3219
|
});
|
|
2909
3220
|
this.containers.set(position, {
|
|
2910
3221
|
ref,
|
|
2911
3222
|
element: div,
|
|
3223
|
+
root: client.createRoot(div),
|
|
3224
|
+
});
|
|
3225
|
+
ReactDOM.flushSync(() => {
|
|
3226
|
+
this.containers.get(position).root.render(jsxRuntime.jsx(Component, {}));
|
|
2912
3227
|
});
|
|
2913
|
-
ReactDOM.render(jsxRuntime.jsx(Component, {}), div);
|
|
2914
3228
|
notification = ref;
|
|
2915
3229
|
}
|
|
2916
3230
|
else {
|
|
@@ -2936,7 +3250,7 @@ class Notification {
|
|
|
2936
3250
|
*/
|
|
2937
3251
|
this.destroy = (position) => {
|
|
2938
3252
|
const notification = this.containers.get(position);
|
|
2939
|
-
|
|
3253
|
+
notification.root.unmount();
|
|
2940
3254
|
this.containers.delete(position);
|
|
2941
3255
|
};
|
|
2942
3256
|
}
|
|
@@ -2948,14 +3262,18 @@ const SpinnerDiv = styled.div `
|
|
|
2948
3262
|
border: 4px solid var(--primary, ${constants.PRIMARY});
|
|
2949
3263
|
border-top: 4px solid var(--border-light-color, ${constants.BORDER_LIGHT_COLOR});
|
|
2950
3264
|
border-radius: 50%;
|
|
2951
|
-
width: ${props => props.size}px;
|
|
2952
|
-
height: ${props => props.size}px;
|
|
3265
|
+
width: ${(props) => props.size}px;
|
|
3266
|
+
height: ${(props) => props.size}px;
|
|
2953
3267
|
margin: 0 auto;
|
|
2954
3268
|
animation: spin 1s linear infinite;
|
|
2955
3269
|
|
|
2956
3270
|
@keyframes spin {
|
|
2957
|
-
0% {
|
|
2958
|
-
|
|
3271
|
+
0% {
|
|
3272
|
+
transform: rotate(0deg);
|
|
3273
|
+
}
|
|
3274
|
+
100% {
|
|
3275
|
+
transform: rotate(360deg);
|
|
3276
|
+
}
|
|
2959
3277
|
}
|
|
2960
3278
|
`;
|
|
2961
3279
|
function Spinner(props) {
|
|
@@ -2963,7 +3281,7 @@ function Spinner(props) {
|
|
|
2963
3281
|
}
|
|
2964
3282
|
Spinner.propTypes = {
|
|
2965
3283
|
/** Spinner's size */
|
|
2966
|
-
size: PropTypes.number
|
|
3284
|
+
size: PropTypes.number,
|
|
2967
3285
|
};
|
|
2968
3286
|
Spinner.defaultProps = {
|
|
2969
3287
|
size: 30,
|
|
@@ -2993,7 +3311,7 @@ const Header = styled.div `
|
|
|
2993
3311
|
z-index: 0;
|
|
2994
3312
|
}
|
|
2995
3313
|
}
|
|
2996
|
-
|
|
3314
|
+
|
|
2997
3315
|
& > * {
|
|
2998
3316
|
z-index: 1;
|
|
2999
3317
|
}
|
|
@@ -3003,12 +3321,12 @@ const HeaderButton = styled.button `
|
|
|
3003
3321
|
padding: 16px 24px 16px 16px;
|
|
3004
3322
|
font-size: 16px;
|
|
3005
3323
|
cursor: pointer;
|
|
3006
|
-
background-color: ${props => props.active
|
|
3324
|
+
background-color: ${(props) => props.active
|
|
3007
3325
|
? `var(--border-light-color, ${constants.BORDER_LIGHT_COLOR})`
|
|
3008
3326
|
: `var(--background, ${constants.BACKGROUND})`};
|
|
3009
|
-
font-weight: ${props => props.active ? 'bold' : 'normal'};
|
|
3327
|
+
font-weight: ${(props) => (props.active ? 'bold' : 'normal')};
|
|
3010
3328
|
overflow: hidden;
|
|
3011
|
-
display:flex;
|
|
3329
|
+
display: flex;
|
|
3012
3330
|
align-items: center;
|
|
3013
3331
|
|
|
3014
3332
|
&:disabled {
|
|
@@ -3016,7 +3334,8 @@ const HeaderButton = styled.button `
|
|
|
3016
3334
|
background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});
|
|
3017
3335
|
}
|
|
3018
3336
|
|
|
3019
|
-
&:enabled:hover,
|
|
3337
|
+
&:enabled:hover,
|
|
3338
|
+
&:focus {
|
|
3020
3339
|
background-color: var(--primary-light, ${constants.PRIMARY_LIGHTER});
|
|
3021
3340
|
}
|
|
3022
3341
|
|
|
@@ -3046,6 +3365,7 @@ const MobileHeader = styled.div `
|
|
|
3046
3365
|
function Stepper(props) {
|
|
3047
3366
|
const [active, setActive] = React.useState(props.active);
|
|
3048
3367
|
const { children, onStepClick } = props;
|
|
3368
|
+
const childrenArray = React.Children.toArray(children);
|
|
3049
3369
|
const stepClickHandler = (index) => () => {
|
|
3050
3370
|
setActive(index);
|
|
3051
3371
|
onStepClick === null || onStepClick === void 0 ? void 0 : onStepClick(index);
|
|
@@ -3062,7 +3382,13 @@ function Stepper(props) {
|
|
|
3062
3382
|
}
|
|
3063
3383
|
return exports.BADGE_TYPE.DISABLED;
|
|
3064
3384
|
};
|
|
3065
|
-
return (jsxRuntime.jsxs(Container$1, { children: [jsxRuntime.jsxs(Header, { children: [React.Children.map(children, (child, index) =>
|
|
3385
|
+
return (jsxRuntime.jsxs(Container$1, { children: [jsxRuntime.jsxs(Header, { children: [React.Children.map(children, (child, index) => {
|
|
3386
|
+
if (!React.isValidElement(child))
|
|
3387
|
+
return null;
|
|
3388
|
+
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 })] }) }));
|
|
3389
|
+
}), jsxRuntime.jsxs(MobileHeader, { children: [jsxRuntime.jsx("span", { children: React.isValidElement(childrenArray[active])
|
|
3390
|
+
? childrenArray[active].props.name
|
|
3391
|
+
: '' }), jsxRuntime.jsxs(Badge, { inline: true, type: exports.BADGE_TYPE.PRIMARY, children: [active + 1, " of ", React.Children.count(children)] })] })] }), childrenArray[active]] }));
|
|
3066
3392
|
}
|
|
3067
3393
|
Stepper.propTypes = {
|
|
3068
3394
|
/** Index of currently active step */
|
|
@@ -3080,6 +3406,7 @@ const Container = styled.div `
|
|
|
3080
3406
|
flex-direction: column;
|
|
3081
3407
|
`;
|
|
3082
3408
|
function Step(props) {
|
|
3409
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3083
3410
|
const { name, disabled, completed } = props, rest = __rest(props, ["name", "disabled", "completed"]);
|
|
3084
3411
|
return jsxRuntime.jsx(Container, Object.assign({}, rest));
|
|
3085
3412
|
}
|
|
@@ -3094,13 +3421,16 @@ const Button = styled.button `
|
|
|
3094
3421
|
padding: 8px 12px;
|
|
3095
3422
|
font-size: 14px;
|
|
3096
3423
|
border-radius: 3px 3px 0 0;
|
|
3097
|
-
border-bottom: ${(props) =>
|
|
3424
|
+
border-bottom: ${(props) => props.active ? `3px solid var(--primary, ${constants.PRIMARY})` : 'none'};
|
|
3098
3425
|
color: ${(props) => (props.active ? `var(--primary, ${constants.PRIMARY})` : '#000')};
|
|
3099
3426
|
cursor: pointer;
|
|
3100
3427
|
|
|
3101
|
-
&:hover,
|
|
3428
|
+
&:hover,
|
|
3429
|
+
&:focus {
|
|
3102
3430
|
background-color: var(--primary-lighter, #cfe9ff);
|
|
3103
|
-
border-bottom: ${(props) =>
|
|
3431
|
+
border-bottom: ${(props) => props.active
|
|
3432
|
+
? `3px solid var(--primary, ${constants.PRIMARY})`
|
|
3433
|
+
: `3px solid var(--primary, ${constants.PRIMARY})`};
|
|
3104
3434
|
}
|
|
3105
3435
|
|
|
3106
3436
|
&[disabled] {
|
|
@@ -3122,10 +3452,11 @@ function Tabs(props) {
|
|
|
3122
3452
|
const switchTab = (index) => () => setActive(index);
|
|
3123
3453
|
const { children } = props;
|
|
3124
3454
|
React.useEffect(() => {
|
|
3455
|
+
var _a;
|
|
3125
3456
|
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] }))] }));
|
|
3457
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, props.active);
|
|
3458
|
+
}, [props]);
|
|
3459
|
+
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
3460
|
}
|
|
3130
3461
|
Tabs.propTypes = {
|
|
3131
3462
|
/** Active Tab Index */
|
|
@@ -3181,13 +3512,13 @@ const ToastContainer = styled(Card) `
|
|
|
3181
3512
|
box-sizing: border-box;
|
|
3182
3513
|
border-radius: 3px;
|
|
3183
3514
|
padding: 12px;
|
|
3184
|
-
background-color: ${props => getBackgroundColor(props.type)};
|
|
3515
|
+
background-color: ${(props) => getBackgroundColor(props.type)};
|
|
3185
3516
|
color: #fff;
|
|
3186
3517
|
margin: 20px;
|
|
3187
3518
|
font-size: 14px;
|
|
3188
3519
|
line-height: 20px;
|
|
3189
3520
|
transform: translateY(100%);
|
|
3190
|
-
transition: transform .3s ease;
|
|
3521
|
+
transition: transform 0.3s ease;
|
|
3191
3522
|
width: 344px;
|
|
3192
3523
|
display: flex;
|
|
3193
3524
|
align-items: center;
|
|
@@ -3238,7 +3569,7 @@ class Toast {
|
|
|
3238
3569
|
this.toast = null;
|
|
3239
3570
|
setTimeout(() => {
|
|
3240
3571
|
if (!this.toast) {
|
|
3241
|
-
|
|
3572
|
+
this.root.unmount();
|
|
3242
3573
|
}
|
|
3243
3574
|
}, 300);
|
|
3244
3575
|
};
|
|
@@ -3271,10 +3602,11 @@ class Toast {
|
|
|
3271
3602
|
closeOnOverlayClick: false,
|
|
3272
3603
|
alwaysOnTop: true,
|
|
3273
3604
|
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:
|
|
3605
|
+
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
3606
|
});
|
|
3276
3607
|
const Component = this.toast[0];
|
|
3277
|
-
|
|
3608
|
+
this.root = client.createRoot(this.element);
|
|
3609
|
+
this.root.render(jsxRuntime.jsx(Component, {}));
|
|
3278
3610
|
this.timeout = setTimeout(() => {
|
|
3279
3611
|
this.remove();
|
|
3280
3612
|
}, duration || DEFAULT_DURATION);
|
|
@@ -3327,10 +3659,10 @@ const TooltipDiv = styled.div `
|
|
|
3327
3659
|
padding: 5px;
|
|
3328
3660
|
color: #fff;
|
|
3329
3661
|
border-radius: 3px;
|
|
3330
|
-
transition: transform .3s ease;
|
|
3662
|
+
transition: transform 0.3s ease;
|
|
3331
3663
|
font-size: 12px;
|
|
3332
3664
|
z-index: 1;
|
|
3333
|
-
${props => positionStyle[props.position]}
|
|
3665
|
+
${(props) => positionStyle[props.position]}
|
|
3334
3666
|
`;
|
|
3335
3667
|
const TooltipContainer = styled.div `
|
|
3336
3668
|
position: relative;
|
|
@@ -3339,7 +3671,7 @@ const TooltipContainer = styled.div `
|
|
|
3339
3671
|
align-items: center;
|
|
3340
3672
|
|
|
3341
3673
|
&:hover ${TooltipDiv} {
|
|
3342
|
-
${props => positionHoverStyle[props.position]}
|
|
3674
|
+
${(props) => positionHoverStyle[props.position]}
|
|
3343
3675
|
}
|
|
3344
3676
|
`;
|
|
3345
3677
|
function Tooltip(props) {
|
|
@@ -3354,11 +3686,11 @@ Tooltip.propTypes = {
|
|
|
3354
3686
|
exports.TOOLTIP_POSITION.TOP,
|
|
3355
3687
|
exports.TOOLTIP_POSITION.LEFT,
|
|
3356
3688
|
exports.TOOLTIP_POSITION.RIGHT,
|
|
3357
|
-
exports.TOOLTIP_POSITION.BOTTOM
|
|
3689
|
+
exports.TOOLTIP_POSITION.BOTTOM,
|
|
3358
3690
|
]),
|
|
3359
3691
|
};
|
|
3360
3692
|
Tooltip.defaultProps = {
|
|
3361
|
-
position: exports.TOOLTIP_POSITION.BOTTOM
|
|
3693
|
+
position: exports.TOOLTIP_POSITION.BOTTOM,
|
|
3362
3694
|
};
|
|
3363
3695
|
|
|
3364
3696
|
exports.Accordion = Accordion;
|
|
@@ -3375,6 +3707,7 @@ exports.CardFooter = Footer$1;
|
|
|
3375
3707
|
exports.CardHeader = Header$1;
|
|
3376
3708
|
exports.Checkbox = Checkbox;
|
|
3377
3709
|
exports.Chip = Chip;
|
|
3710
|
+
exports.ChipInput = ChipInput;
|
|
3378
3711
|
exports.ConfirmDialog = ConfirmDialog;
|
|
3379
3712
|
exports.Dialog = Dialog;
|
|
3380
3713
|
exports.DialogBody = Body$1;
|