no-frills-ui 0.0.14-alpha.1 → 0.0.14-alpha.10
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 +3419 -2768
- package/dist/index.js.map +1 -1
- package/lib-esm/components/Accordion/Accordion.d.ts +11 -16
- package/lib-esm/components/Accordion/Accordion.js +25 -29
- package/lib-esm/components/Accordion/Accordion.js.map +1 -1
- package/lib-esm/components/Accordion/AccordionStep.d.ts +22 -22
- package/lib-esm/components/Accordion/AccordionStep.js +111 -109
- package/lib-esm/components/Accordion/AccordionStep.js.map +1 -1
- package/lib-esm/components/Badge/Badge.d.ts +13 -16
- package/lib-esm/components/Badge/Badge.js +31 -51
- package/lib-esm/components/Badge/Badge.js.map +1 -1
- package/lib-esm/components/Button/ActionButton.d.ts +9 -5
- package/lib-esm/components/Button/ActionButton.js +18 -38
- package/lib-esm/components/Button/ActionButton.js.map +1 -1
- package/lib-esm/components/Button/Button.d.ts +9 -5
- package/lib-esm/components/Button/Button.js +18 -40
- package/lib-esm/components/Button/Button.js.map +1 -1
- package/lib-esm/components/Button/IconButton.d.ts +9 -5
- package/lib-esm/components/Button/IconButton.js +18 -42
- package/lib-esm/components/Button/IconButton.js.map +1 -1
- package/lib-esm/components/Button/LinkButton.d.ts +9 -5
- package/lib-esm/components/Button/LinkButton.js +18 -32
- package/lib-esm/components/Button/LinkButton.js.map +1 -1
- package/lib-esm/components/Button/RaisedButton.d.ts +9 -5
- package/lib-esm/components/Button/RaisedButton.js +18 -46
- package/lib-esm/components/Button/RaisedButton.js.map +1 -1
- package/lib-esm/components/Card/Card.d.ts +4 -6
- package/lib-esm/components/Card/Card.js +18 -13
- package/lib-esm/components/Card/Card.js.map +1 -1
- package/lib-esm/components/Chip/Chip.d.ts +6 -3
- package/lib-esm/components/Chip/Chip.js +44 -43
- package/lib-esm/components/Chip/Chip.js.map +1 -1
- package/lib-esm/components/ChipInput/ChipInput.d.ts +28 -30
- package/lib-esm/components/ChipInput/ChipInput.js +121 -139
- package/lib-esm/components/ChipInput/ChipInput.js.map +1 -1
- package/lib-esm/components/Dialog/AlertDialog.d.ts +11 -12
- package/lib-esm/components/Dialog/AlertDialog.js +44 -28
- package/lib-esm/components/Dialog/AlertDialog.js.map +1 -1
- package/lib-esm/components/Dialog/ConfirmDialog.d.ts +13 -14
- package/lib-esm/components/Dialog/ConfirmDialog.js +49 -33
- package/lib-esm/components/Dialog/ConfirmDialog.js.map +1 -1
- package/lib-esm/components/Dialog/Dialog.d.ts +40 -18
- package/lib-esm/components/Dialog/Dialog.js +125 -70
- package/lib-esm/components/Dialog/Dialog.js.map +1 -1
- package/lib-esm/components/Dialog/PromptDialog.d.ts +18 -19
- package/lib-esm/components/Dialog/PromptDialog.js +78 -49
- package/lib-esm/components/Dialog/PromptDialog.js.map +1 -1
- package/lib-esm/components/DragAndDrop/DragAndDrop.d.ts +43 -41
- package/lib-esm/components/DragAndDrop/DragAndDrop.js +104 -31
- package/lib-esm/components/DragAndDrop/DragAndDrop.js.map +1 -1
- package/lib-esm/components/DragAndDrop/DragItem.d.ts +5 -1
- package/lib-esm/components/DragAndDrop/DragItem.js +171 -92
- package/lib-esm/components/DragAndDrop/DragItem.js.map +1 -1
- package/lib-esm/components/DragAndDrop/types.d.ts +22 -3
- package/lib-esm/components/DragAndDrop/types.js +9 -6
- package/lib-esm/components/DragAndDrop/types.js.map +1 -1
- package/lib-esm/components/Drawer/Drawer.d.ts +86 -22
- package/lib-esm/components/Drawer/Drawer.js +176 -97
- package/lib-esm/components/Drawer/Drawer.js.map +1 -1
- package/lib-esm/components/Drawer/index.d.ts +1 -1
- package/lib-esm/components/Groups/Group.d.ts +5 -8
- package/lib-esm/components/Groups/Group.js +34 -79
- package/lib-esm/components/Groups/Group.js.map +1 -1
- package/lib-esm/components/Groups/GroupLabel.js +8 -17
- package/lib-esm/components/Groups/GroupLabel.js.map +1 -1
- package/lib-esm/components/Input/Checkbox.d.ts +12 -15
- package/lib-esm/components/Input/Checkbox.js +51 -118
- package/lib-esm/components/Input/Checkbox.js.map +1 -1
- package/lib-esm/components/Input/Dropdown.d.ts +11 -12
- package/lib-esm/components/Input/Dropdown.js +133 -52
- package/lib-esm/components/Input/Dropdown.js.map +1 -1
- package/lib-esm/components/Input/Input.d.ts +3 -3
- package/lib-esm/components/Input/Input.js +61 -109
- package/lib-esm/components/Input/Input.js.map +1 -1
- package/lib-esm/components/Input/Radio.d.ts +4 -8
- package/lib-esm/components/Input/Radio.js +35 -79
- package/lib-esm/components/Input/Radio.js.map +1 -1
- package/lib-esm/components/Input/RadioButton.d.ts +4 -8
- package/lib-esm/components/Input/RadioButton.js +34 -71
- package/lib-esm/components/Input/RadioButton.js.map +1 -1
- package/lib-esm/components/Input/Select.d.ts +6 -13
- package/lib-esm/components/Input/Select.js +75 -122
- package/lib-esm/components/Input/Select.js.map +1 -1
- package/lib-esm/components/Input/TextArea.d.ts +6 -13
- package/lib-esm/components/Input/TextArea.js +64 -108
- package/lib-esm/components/Input/TextArea.js.map +1 -1
- package/lib-esm/components/Input/Toggle.d.ts +4 -9
- package/lib-esm/components/Input/Toggle.js +31 -80
- package/lib-esm/components/Input/Toggle.js.map +1 -1
- package/lib-esm/components/Menu/Menu.d.ts +8 -6
- package/lib-esm/components/Menu/Menu.js +116 -31
- 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 +6 -2
- package/lib-esm/components/Menu/MenuContext.js.map +1 -1
- package/lib-esm/components/Menu/MenuItem.d.ts +7 -4
- package/lib-esm/components/Menu/MenuItem.js +46 -47
- package/lib-esm/components/Menu/MenuItem.js.map +1 -1
- package/lib-esm/components/Modal/Modal.d.ts +75 -16
- package/lib-esm/components/Modal/Modal.js +150 -51
- package/lib-esm/components/Modal/Modal.js.map +1 -1
- package/lib-esm/components/Notification/Notification.d.ts +46 -39
- package/lib-esm/components/Notification/Notification.js +80 -87
- package/lib-esm/components/Notification/Notification.js.map +1 -1
- package/lib-esm/components/Notification/NotificationManager.d.ts +19 -5
- package/lib-esm/components/Notification/NotificationManager.js +177 -79
- package/lib-esm/components/Notification/NotificationManager.js.map +1 -1
- package/lib-esm/components/Notification/style.d.ts +6 -3
- package/lib-esm/components/Notification/style.js +64 -140
- package/lib-esm/components/Notification/style.js.map +1 -1
- package/lib-esm/components/Notification/types.d.ts +2 -0
- package/lib-esm/components/Notification/types.js +9 -10
- package/lib-esm/components/Notification/types.js.map +1 -1
- package/lib-esm/components/Popover/Popover.d.ts +21 -20
- package/lib-esm/components/Popover/Popover.js +159 -126
- package/lib-esm/components/Popover/Popover.js.map +1 -1
- package/lib-esm/components/Spinner/Spinner.d.ts +14 -12
- package/lib-esm/components/Spinner/Spinner.js +22 -27
- package/lib-esm/components/Spinner/Spinner.js.map +1 -1
- package/lib-esm/components/Stepper/Step.d.ts +15 -12
- package/lib-esm/components/Stepper/Step.js +18 -25
- package/lib-esm/components/Stepper/Step.js.map +1 -1
- package/lib-esm/components/Stepper/Stepper.d.ts +11 -17
- package/lib-esm/components/Stepper/Stepper.js +104 -102
- package/lib-esm/components/Stepper/Stepper.js.map +1 -1
- package/lib-esm/components/Tabs/Tab.d.ts +10 -16
- package/lib-esm/components/Tabs/Tab.js +9 -15
- package/lib-esm/components/Tabs/Tab.js.map +1 -1
- package/lib-esm/components/Tabs/Tabs.d.ts +11 -22
- package/lib-esm/components/Tabs/Tabs.js +97 -55
- package/lib-esm/components/Tabs/Tabs.js.map +1 -1
- package/lib-esm/components/Toast/Toast.d.ts +34 -7
- package/lib-esm/components/Toast/Toast.js +200 -109
- package/lib-esm/components/Toast/Toast.js.map +1 -1
- package/lib-esm/components/Toast/ToastStory.d.ts +21 -24
- package/lib-esm/components/Tooltip/Tooltip.d.ts +11 -14
- package/lib-esm/components/Tooltip/Tooltip.js +52 -67
- 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 +43 -20
- package/lib-esm/components/index.js.map +1 -1
- package/lib-esm/icons/CheckCircle.d.ts +1 -1
- package/lib-esm/icons/CheckCircle.js +22 -4
- package/lib-esm/icons/CheckCircle.js.map +1 -1
- package/lib-esm/icons/Close.d.ts +1 -1
- package/lib-esm/icons/Close.js +22 -4
- package/lib-esm/icons/Close.js.map +1 -1
- package/lib-esm/icons/DragIndicator.d.ts +1 -1
- package/lib-esm/icons/DragIndicator.js +22 -4
- package/lib-esm/icons/DragIndicator.js.map +1 -1
- package/lib-esm/icons/ErrorOutline.d.ts +1 -1
- package/lib-esm/icons/ErrorOutline.js +16 -4
- package/lib-esm/icons/ErrorOutline.js.map +1 -1
- package/lib-esm/icons/ExpandMore.d.ts +1 -1
- package/lib-esm/icons/ExpandMore.js +22 -4
- package/lib-esm/icons/ExpandMore.js.map +1 -1
- package/lib-esm/icons/FiberManualRecord.d.ts +1 -1
- package/lib-esm/icons/FiberManualRecord.js +24 -4
- package/lib-esm/icons/FiberManualRecord.js.map +1 -1
- package/lib-esm/icons/Info.d.ts +1 -1
- package/lib-esm/icons/Info.js +22 -4
- package/lib-esm/icons/Info.js.map +1 -1
- package/lib-esm/icons/ReportProblem.d.ts +1 -1
- package/lib-esm/icons/ReportProblem.js +22 -4
- package/lib-esm/icons/ReportProblem.js.map +1 -1
- package/lib-esm/shared/LayerManager.d.ts +34 -4
- package/lib-esm/shared/LayerManager.js +248 -114
- package/lib-esm/shared/LayerManager.js.map +1 -1
- package/lib-esm/shared/constants.d.ts +58 -27
- package/lib-esm/shared/constants.js +62 -26
- package/lib-esm/shared/constants.js.map +1 -1
- package/lib-esm/shared/styles.d.ts +1 -1
- package/lib-esm/shared/styles.js +21 -24
- package/lib-esm/shared/styles.js.map +1 -1
- package/package.json +130 -74
- package/lib-esm/components/Accordion/index.js +0 -3
- package/lib-esm/components/Accordion/index.js.map +0 -1
- package/lib-esm/components/Badge/index.js +0 -2
- package/lib-esm/components/Badge/index.js.map +0 -1
- package/lib-esm/components/Button/index.js +0 -6
- package/lib-esm/components/Button/index.js.map +0 -1
- package/lib-esm/components/Card/index.js +0 -3
- package/lib-esm/components/Card/index.js.map +0 -1
- package/lib-esm/components/Chip/index.js +0 -2
- package/lib-esm/components/Chip/index.js.map +0 -1
- package/lib-esm/components/ChipInput/index.js +0 -2
- package/lib-esm/components/ChipInput/index.js.map +0 -1
- package/lib-esm/components/Dialog/index.js +0 -5
- package/lib-esm/components/Dialog/index.js.map +0 -1
- package/lib-esm/components/DragAndDrop/index.js +0 -3
- package/lib-esm/components/DragAndDrop/index.js.map +0 -1
- package/lib-esm/components/Drawer/index.js +0 -2
- package/lib-esm/components/Drawer/index.js.map +0 -1
- package/lib-esm/components/Groups/index.js +0 -3
- package/lib-esm/components/Groups/index.js.map +0 -1
- package/lib-esm/components/Input/index.js +0 -9
- package/lib-esm/components/Input/index.js.map +0 -1
- package/lib-esm/components/Menu/index.js +0 -3
- package/lib-esm/components/Menu/index.js.map +0 -1
- package/lib-esm/components/Modal/index.js +0 -2
- package/lib-esm/components/Modal/index.js.map +0 -1
- package/lib-esm/components/Notification/index.js +0 -3
- package/lib-esm/components/Notification/index.js.map +0 -1
- package/lib-esm/components/Popover/index.js +0 -2
- package/lib-esm/components/Popover/index.js.map +0 -1
- package/lib-esm/components/Spinner/index.js +0 -2
- package/lib-esm/components/Spinner/index.js.map +0 -1
- package/lib-esm/components/Stepper/index.js +0 -4
- package/lib-esm/components/Stepper/index.js.map +0 -1
- package/lib-esm/components/Tabs/index.js +0 -3
- package/lib-esm/components/Tabs/index.js.map +0 -1
- package/lib-esm/components/Toast/ToastStory.js +0 -35
- package/lib-esm/components/Toast/ToastStory.js.map +0 -1
- package/lib-esm/components/Toast/index.js +0 -2
- package/lib-esm/components/Toast/index.js.map +0 -1
- package/lib-esm/components/Tooltip/index.js +0 -2
- package/lib-esm/components/Tooltip/index.js.map +0 -1
- package/lib-esm/icons/index.js +0 -9
- package/lib-esm/icons/index.js.map +0 -1
- package/lib-esm/index.js +0 -2
- package/lib-esm/index.js.map +0 -1
|
@@ -1,38 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
1
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
13
2
|
import React from 'react';
|
|
14
|
-
import PropTypes from 'prop-types';
|
|
15
3
|
import styled from '@emotion/styled';
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
(function (DRAWER_POSITION) {
|
|
4
|
+
import { getThemeValue, THEME_NAME } from '../../shared/constants.js';
|
|
5
|
+
import LayerManager, { LAYER_POSITION } from '../../shared/LayerManager.js';
|
|
6
|
+
|
|
7
|
+
var DRAWER_POSITION = /*#__PURE__*/ function(DRAWER_POSITION) {
|
|
21
8
|
DRAWER_POSITION["LEFT"] = "LEFT";
|
|
22
9
|
DRAWER_POSITION["RIGHT"] = "RIGHT";
|
|
23
10
|
DRAWER_POSITION["BOTTOM"] = "BOTTOM";
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
11
|
+
return DRAWER_POSITION;
|
|
12
|
+
}({});
|
|
13
|
+
const positionStyle$1 = (size)=>({
|
|
14
|
+
["LEFT"]: {
|
|
15
|
+
before: `height: 100vh; min-width: ${size || '300px'}; transform: translateX(-100%);`,
|
|
16
|
+
after: 'transform: translateX(0%);'
|
|
17
|
+
},
|
|
18
|
+
["RIGHT"]: {
|
|
19
|
+
before: `height: 100vh; min-width: ${size || '300px'}; transform: translateX(100%);`,
|
|
20
|
+
after: 'transform: translateX(0%);'
|
|
21
|
+
},
|
|
22
|
+
["BOTTOM"]: {
|
|
23
|
+
before: `
|
|
36
24
|
position: absolute;
|
|
37
25
|
bottom: 0;
|
|
38
26
|
width: 100%;
|
|
@@ -40,102 +28,193 @@ const positionStyle = (size) => ({
|
|
|
40
28
|
transform: translateY(100%);
|
|
41
29
|
border-radius: 15px 15px 0 0;
|
|
42
30
|
`,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
const DrawerDiv = styled
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
.nf-layer-enter & {
|
|
55
|
-
transform: translateX(0%);
|
|
56
|
-
${props => positionStyle(props.size)[props.position].after}
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
const positionMap = {
|
|
60
|
-
[DRAWER_POSITION.LEFT]: LAYER_POSITION.TOP_LEFT,
|
|
61
|
-
[DRAWER_POSITION.RIGHT]: LAYER_POSITION.TOP_RIGHT,
|
|
62
|
-
[DRAWER_POSITION.BOTTOM]: LAYER_POSITION.BOTTOM_LEFT,
|
|
31
|
+
after: 'transform: translateX(0%);'
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const DrawerDiv = /*#__PURE__*/ styled("div", {
|
|
35
|
+
target: "egs35xi0",
|
|
36
|
+
label: "DrawerDiv"
|
|
37
|
+
})("display:flex;flex-direction:column;background-color:", getThemeValue(THEME_NAME.BACKGROUND), ";transition:transform 0.3s ease;box-shadow:", getThemeValue(THEME_NAME.MODAL_SHADOW), ";", (props)=>positionStyle$1(props.size)[props.position].before, " .nf-layer-enter &{transform:translateX(0%);", (props)=>positionStyle$1(props.size)[props.position].after, "}");
|
|
38
|
+
const positionMap$1 = {
|
|
39
|
+
["LEFT"]: LAYER_POSITION.TOP_LEFT,
|
|
40
|
+
["RIGHT"]: LAYER_POSITION.TOP_RIGHT,
|
|
41
|
+
["BOTTOM"]: LAYER_POSITION.BOTTOM_LEFT
|
|
63
42
|
};
|
|
64
43
|
class Drawer extends React.Component {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
open: false,
|
|
69
|
-
};
|
|
70
|
-
this.onClose = () => {
|
|
71
|
-
this.setState({
|
|
72
|
-
open: false,
|
|
73
|
-
});
|
|
74
|
-
this.props.onClose && this.props.onClose();
|
|
75
|
-
this.closeCallback = null;
|
|
76
|
-
this.layer = null;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
static getDerivedStateFromProps(props) {
|
|
44
|
+
/**
|
|
45
|
+
* Syncs state with props.
|
|
46
|
+
*/ static getDerivedStateFromProps(props) {
|
|
80
47
|
if (props.open) {
|
|
81
48
|
return {
|
|
82
|
-
open: true
|
|
49
|
+
open: true
|
|
83
50
|
};
|
|
84
51
|
}
|
|
85
52
|
return null;
|
|
86
53
|
}
|
|
87
|
-
|
|
88
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Lifecycle method to save the currently focused element when the drawer mounts while open.
|
|
56
|
+
*/ componentDidMount() {
|
|
57
|
+
if (this.props.open) {
|
|
58
|
+
this.lastFocusedElement = document.activeElement;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Lifecycle method to restore focus when the drawer unmounts.
|
|
63
|
+
*/ componentWillUnmount() {
|
|
64
|
+
if (this.props.open) {
|
|
65
|
+
this.restoreFocus();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Lifecycle method to handle Drawer updates.
|
|
70
|
+
* Manages opening/closing logic via LayerManager and focus preservation.
|
|
71
|
+
*/ getSnapshotBeforeUpdate(prevProps) {
|
|
72
|
+
const { open, closeOnEsc, closeOnOverlayClick, overlay, position, children, size, ...rest } = this.props;
|
|
89
73
|
if (prevProps.open && !open) {
|
|
90
|
-
this.closeCallback
|
|
74
|
+
this.closeCallback?.();
|
|
75
|
+
this.restoreFocus();
|
|
91
76
|
}
|
|
92
77
|
if (!prevProps.open && open) {
|
|
78
|
+
// Save current focus
|
|
79
|
+
this.lastFocusedElement = document.activeElement;
|
|
93
80
|
this.layer = LayerManager.renderLayer({
|
|
94
81
|
overlay,
|
|
95
82
|
exitDelay: 300,
|
|
96
|
-
position: positionMap[position],
|
|
83
|
+
position: positionMap$1[position],
|
|
97
84
|
closeCallback: this.onClose,
|
|
98
85
|
closeOnEsc,
|
|
99
86
|
closeOnOverlayClick,
|
|
100
|
-
component: (
|
|
87
|
+
component: /*#__PURE__*/ jsx(DrawerDiv, {
|
|
88
|
+
...rest,
|
|
89
|
+
ref: this.setDrawerRef,
|
|
90
|
+
role: "dialog",
|
|
91
|
+
"aria-modal": "true",
|
|
92
|
+
tabIndex: -1,
|
|
93
|
+
onKeyDown: this.handleKeyDown,
|
|
94
|
+
position: position,
|
|
95
|
+
size: size,
|
|
96
|
+
onClick: (e)=>e.stopPropagation(),
|
|
97
|
+
children: children
|
|
98
|
+
})
|
|
101
99
|
});
|
|
102
100
|
this.closeCallback = this.layer[1];
|
|
103
101
|
this.forceUpdate();
|
|
104
102
|
}
|
|
105
103
|
}
|
|
106
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Renders the Drawer component via the LayerManager portal.
|
|
106
|
+
*/ render() {
|
|
107
107
|
if (this.state.open && this.layer) {
|
|
108
108
|
const [Component] = this.layer;
|
|
109
|
-
return
|
|
109
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
110
|
+
ref: this.setRefProp
|
|
111
|
+
});
|
|
110
112
|
}
|
|
111
113
|
return null;
|
|
112
114
|
}
|
|
115
|
+
constructor(...args){
|
|
116
|
+
super(...args), this.state = {
|
|
117
|
+
open: false
|
|
118
|
+
}, /**
|
|
119
|
+
* Internal close handler.
|
|
120
|
+
* Restores focus and calls the external onClose callback.
|
|
121
|
+
*/ this.onClose = ()=>{
|
|
122
|
+
this.restoreFocus();
|
|
123
|
+
this.setState({
|
|
124
|
+
open: false
|
|
125
|
+
});
|
|
126
|
+
this.props.onClose?.();
|
|
127
|
+
this.closeCallback = undefined;
|
|
128
|
+
this.layer = undefined;
|
|
129
|
+
}, this.lastFocusedElement = null, this.drawerRef = /*#__PURE__*/ React.createRef(), /**
|
|
130
|
+
* Retrieves all focusable elements within the drawer.
|
|
131
|
+
*/ this.getFocusableElements = ()=>{
|
|
132
|
+
if (!this.drawerRef.current) return [];
|
|
133
|
+
return Array.from(this.drawerRef.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));
|
|
134
|
+
}, /**
|
|
135
|
+
* Handles keydown events to implement the focus trap.
|
|
136
|
+
* Traps Tab and Shift+Tab within the drawer.
|
|
137
|
+
*/ this.handleKeyDown = (e)=>{
|
|
138
|
+
if (e.key === 'Tab') {
|
|
139
|
+
const focusableElements = this.getFocusableElements();
|
|
140
|
+
if (focusableElements.length === 0) return;
|
|
141
|
+
const firstElement = focusableElements[0];
|
|
142
|
+
const lastElement = focusableElements[focusableElements.length - 1];
|
|
143
|
+
if (e.shiftKey) {
|
|
144
|
+
if (document.activeElement === firstElement) {
|
|
145
|
+
lastElement.focus();
|
|
146
|
+
e.preventDefault();
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
if (document.activeElement === lastElement) {
|
|
150
|
+
firstElement.focus();
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}, /**
|
|
156
|
+
* Restores focus to the element that was focused before the drawer opened.
|
|
157
|
+
*/ this.restoreFocus = ()=>{
|
|
158
|
+
if (this.lastFocusedElement) {
|
|
159
|
+
// Check if the element is still in the document
|
|
160
|
+
const elementToBeFocused = this.lastFocusedElement;
|
|
161
|
+
this.lastFocusedElement = null;
|
|
162
|
+
setTimeout(()=>{
|
|
163
|
+
if (document.body.contains(elementToBeFocused)) {
|
|
164
|
+
elementToBeFocused.focus();
|
|
165
|
+
}
|
|
166
|
+
}, 100);
|
|
167
|
+
}
|
|
168
|
+
}, /**
|
|
169
|
+
* Callback ref to capture the Drawer DOM element.
|
|
170
|
+
* Triggers initial focus setting when the element mounts.
|
|
171
|
+
*/ this.setDrawerRef = (node)=>{
|
|
172
|
+
// Update ref
|
|
173
|
+
this.drawerRef.current = node;
|
|
174
|
+
if (node) {
|
|
175
|
+
// Set initial focus when the node is mounted
|
|
176
|
+
this.setInitialFocus(node);
|
|
177
|
+
}
|
|
178
|
+
}, /**
|
|
179
|
+
* Sets initial focus within the drawer.
|
|
180
|
+
* Tries to focus the header first, then the first interactive element, or falls back to the container.
|
|
181
|
+
*/ this.setInitialFocus = (root)=>{
|
|
182
|
+
// Try to find the header (assumed to be the first child)
|
|
183
|
+
const firstChild = root.firstElementChild;
|
|
184
|
+
if (firstChild) {
|
|
185
|
+
// Ensure it's focusable
|
|
186
|
+
if (firstChild.getAttribute('tabindex') === null) {
|
|
187
|
+
firstChild.setAttribute('tabindex', '-1');
|
|
188
|
+
}
|
|
189
|
+
firstChild.focus();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
// Fallback to focusable elements
|
|
193
|
+
const focusableElements = this.getFocusableElements();
|
|
194
|
+
if (focusableElements.length > 0) {
|
|
195
|
+
focusableElements[0].focus();
|
|
196
|
+
} else {
|
|
197
|
+
// Fallback to container
|
|
198
|
+
root.focus();
|
|
199
|
+
}
|
|
200
|
+
}, /**
|
|
201
|
+
* Sets the ref prop passed to the Drawer Container component.
|
|
202
|
+
* @param node
|
|
203
|
+
*/ this.setRefProp = (node)=>{
|
|
204
|
+
if (this.props.forwardRef && typeof this.props.forwardRef === 'function') {
|
|
205
|
+
this.props.forwardRef(node);
|
|
206
|
+
} else if (this.props.forwardRef && typeof this.props.forwardRef === 'object') {
|
|
207
|
+
this.props.forwardRef.current = node;
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
113
211
|
}
|
|
114
|
-
Drawer.propTypes = {
|
|
115
|
-
/** Opens the drawer */
|
|
116
|
-
open: PropTypes.bool.isRequired,
|
|
117
|
-
/** position of the drawer */
|
|
118
|
-
position: PropTypes.oneOf([
|
|
119
|
-
DRAWER_POSITION.LEFT,
|
|
120
|
-
DRAWER_POSITION.RIGHT,
|
|
121
|
-
DRAWER_POSITION.BOTTOM,
|
|
122
|
-
]),
|
|
123
|
-
/** size of the drawer */
|
|
124
|
-
size: PropTypes.string,
|
|
125
|
-
/** Shows an overlay behind the drawer. */
|
|
126
|
-
overlay: PropTypes.bool,
|
|
127
|
-
/** Closes the drawer on esc */
|
|
128
|
-
closeOnEsc: PropTypes.bool,
|
|
129
|
-
/** Closes the drawer on overlay click */
|
|
130
|
-
closeOnOverlayClick: PropTypes.bool,
|
|
131
|
-
/** Call back function called when the drawer closes. */
|
|
132
|
-
onClose: PropTypes.func,
|
|
133
|
-
};
|
|
134
212
|
Drawer.defaultProps = {
|
|
135
213
|
overlay: true,
|
|
136
|
-
position:
|
|
214
|
+
position: "LEFT",
|
|
137
215
|
closeOnEsc: true,
|
|
138
|
-
closeOnOverlayClick: true
|
|
216
|
+
closeOnOverlayClick: true
|
|
139
217
|
};
|
|
140
|
-
|
|
141
|
-
|
|
218
|
+
|
|
219
|
+
export { DRAWER_POSITION, Drawer as default };
|
|
220
|
+
//# sourceMappingURL=Drawer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,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AAQ,EAAE,eAAe,CAAC,IAAI;IAC9B,UAAU,EAAE,IAAI;IAChB,mBAAmB,EAAE,IAAI;CAC5B,AALkB,CAKlB;eA/BgB,MAAM"}
|
|
1
|
+
{"version":3,"file":"Drawer.js","sources":["../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\nimport LayerManager, { LAYER_POSITION } from '../../shared/LayerManager';\n\nexport {\n Header as DrawerHeader,\n Body as DrawerBody,\n Footer as DrawerFooter,\n} from '../../shared/styles';\n\nexport enum DRAWER_POSITION {\n LEFT = 'LEFT',\n RIGHT = 'RIGHT',\n BOTTOM = 'BOTTOM',\n}\n\nconst positionStyle = (size?: string) => ({\n [DRAWER_POSITION.LEFT]: {\n before: `height: 100vh; min-width: ${size || '300px'}; transform: translateX(-100%);`,\n after: 'transform: translateX(0%);',\n },\n [DRAWER_POSITION.RIGHT]: {\n before: `height: 100vh; min-width: ${size || '300px'}; transform: translateX(100%);`,\n after: 'transform: translateX(0%);',\n },\n [DRAWER_POSITION.BOTTOM]: {\n before: `\n position: absolute;\n bottom: 0;\n width: 100%;\n height: ${size || '90vh'};\n transform: translateY(100%);\n border-radius: 15px 15px 0 0; \n `,\n after: 'transform: translateX(0%);',\n },\n});\n\nconst DrawerDiv = styled.div<{ position: DRAWER_POSITION; size?: string }>`\n display: flex;\n flex-direction: column;\n background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n transition: transform 0.3s ease;\n box-shadow: ${getThemeValue(THEME_NAME.MODAL_SHADOW)};\n ${(props) => positionStyle(props.size)[props.position].before}\n\n .nf-layer-enter & {\n transform: translateX(0%);\n ${(props) => positionStyle(props.size)[props.position].after}\n }\n`;\n\ntype DrawerProps = {\n /** Opens the drawer */\n open: boolean;\n /** position of the drawer */\n position: DRAWER_POSITION;\n /** size of the drawer */\n size?: string;\n /** Shows an overlay behind the drawer. */\n overlay?: boolean;\n /** Closes the drawer on esc */\n closeOnEsc?: boolean;\n /** Closes the drawer on overlay click */\n closeOnOverlayClick?: boolean;\n /** Call back function called when the drawer closes. */\n onClose?: () => void;\n /** Ref to the drawer element */\n forwardRef?: React.Ref<HTMLDivElement> | React.MutableRefObject<HTMLDivElement | null>;\n};\n\ninterface DrawerState {\n open: boolean;\n}\n\nconst positionMap = {\n [DRAWER_POSITION.LEFT]: LAYER_POSITION.TOP_LEFT,\n [DRAWER_POSITION.RIGHT]: LAYER_POSITION.TOP_RIGHT,\n [DRAWER_POSITION.BOTTOM]: LAYER_POSITION.BOTTOM_LEFT,\n};\n\n/**\n * Drawer component\n *\n * A panel that slides in from the edge of the screen.\n * It sits on top of the application content and is often used for navigation or details.\n *\n * Accessibility:\n * - Implements ARIA `role=\"dialog\"` and `aria-modal=\"true\"`.\n * - Traps focus effectively within the drawer while open.\n * - Restores focus to the triggering element upon closure.\n * - Supports closing via ESC key and overlay click.\n */\nexport default class Drawer extends React.Component<\n React.PropsWithChildren<DrawerProps>,\n DrawerState\n> {\n state = {\n open: false,\n };\n\n static defaultProps = {\n overlay: true,\n position: DRAWER_POSITION.LEFT,\n closeOnEsc: true,\n closeOnOverlayClick: true,\n };\n\n /**\n * Syncs state with props.\n */\n static getDerivedStateFromProps(props: DrawerProps) {\n if (props.open) {\n return {\n open: true,\n };\n }\n return null;\n }\n\n private layer?: ReturnType<typeof LayerManager.renderLayer>;\n\n private closeCallback?: (resp?: unknown) => void;\n\n /**\n * Internal close handler.\n * Restores focus and calls the external onClose callback.\n */\n private onClose = () => {\n this.restoreFocus();\n this.setState({\n open: false,\n });\n this.props.onClose?.();\n this.closeCallback = undefined;\n this.layer = undefined;\n };\n\n private lastFocusedElement: HTMLElement | null = null;\n private drawerRef = React.createRef<HTMLDivElement>();\n\n /**\n * Retrieves all focusable elements within the drawer.\n */\n private getFocusableElements = (): HTMLElement[] => {\n if (!this.drawerRef.current) return [];\n return Array.from(\n this.drawerRef.current.querySelectorAll(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n ),\n ) as HTMLElement[];\n };\n\n /**\n * Handles keydown events to implement the focus trap.\n * Traps Tab and Shift+Tab within the drawer.\n */\n private handleKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === 'Tab') {\n const focusableElements = this.getFocusableElements();\n if (focusableElements.length === 0) return;\n\n const firstElement = focusableElements[0];\n const lastElement = focusableElements[focusableElements.length - 1];\n\n if (e.shiftKey) {\n if (document.activeElement === firstElement) {\n lastElement.focus();\n e.preventDefault();\n }\n } else {\n if (document.activeElement === lastElement) {\n firstElement.focus();\n e.preventDefault();\n }\n }\n }\n };\n\n /**\n * Lifecycle method to save the currently focused element when the drawer mounts while open.\n */\n componentDidMount() {\n if (this.props.open) {\n this.lastFocusedElement = document.activeElement as HTMLElement;\n }\n }\n\n /**\n * Lifecycle method to restore focus when the drawer unmounts.\n */\n componentWillUnmount() {\n if (this.props.open) {\n this.restoreFocus();\n }\n }\n\n /**\n * Restores focus to the element that was focused before the drawer opened.\n */\n private restoreFocus = () => {\n if (this.lastFocusedElement) {\n // Check if the element is still in the document\n const elementToBeFocused = this.lastFocusedElement;\n this.lastFocusedElement = null;\n setTimeout(() => {\n if (document.body.contains(elementToBeFocused)) {\n elementToBeFocused.focus();\n }\n }, 100);\n }\n };\n\n /**\n * Callback ref to capture the Drawer DOM element.\n * Triggers initial focus setting when the element mounts.\n */\n private setDrawerRef = (node: HTMLDivElement | null) => {\n // Update ref\n (this.drawerRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n\n if (node) {\n // Set initial focus when the node is mounted\n this.setInitialFocus(node);\n }\n };\n\n /**\n * Sets initial focus within the drawer.\n * Tries to focus the header first, then the first interactive element, or falls back to the container.\n */\n private setInitialFocus = (root: HTMLElement) => {\n // Try to find the header (assumed to be the first child)\n const firstChild = root.firstElementChild as HTMLElement;\n if (firstChild) {\n // Ensure it's focusable\n if (firstChild.getAttribute('tabindex') === null) {\n firstChild.setAttribute('tabindex', '-1');\n }\n firstChild.focus();\n return;\n }\n\n // Fallback to focusable elements\n const focusableElements = this.getFocusableElements();\n if (focusableElements.length > 0) {\n focusableElements[0].focus();\n } else {\n // Fallback to container\n root.focus();\n }\n };\n\n /**\n * Lifecycle method to handle Drawer updates.\n * Manages opening/closing logic via LayerManager and focus preservation.\n */\n getSnapshotBeforeUpdate(prevProps: DrawerProps) {\n const {\n open,\n closeOnEsc,\n closeOnOverlayClick,\n overlay,\n position,\n children,\n size,\n ...rest\n } = this.props;\n\n if (prevProps.open && !open) {\n this.closeCallback?.();\n this.restoreFocus();\n }\n\n if (!prevProps.open && open) {\n // Save current focus\n this.lastFocusedElement = document.activeElement as HTMLElement;\n\n this.layer = LayerManager.renderLayer({\n overlay,\n exitDelay: 300,\n position: positionMap[position],\n closeCallback: this.onClose,\n closeOnEsc,\n closeOnOverlayClick,\n component: (\n <DrawerDiv\n {...rest}\n ref={this.setDrawerRef}\n role=\"dialog\"\n aria-modal=\"true\"\n tabIndex={-1}\n onKeyDown={this.handleKeyDown}\n position={position}\n size={size}\n onClick={(e) => e.stopPropagation()}\n >\n {children}\n </DrawerDiv>\n ),\n });\n this.closeCallback = this.layer[1];\n this.forceUpdate();\n }\n }\n\n /**\n * Sets the ref prop passed to the Drawer Container component.\n * @param node\n */\n setRefProp = (node: HTMLDivElement | null) => {\n if (this.props.forwardRef && typeof this.props.forwardRef === 'function') {\n this.props.forwardRef(node);\n } else if (this.props.forwardRef && typeof this.props.forwardRef === 'object') {\n (this.props.forwardRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n };\n\n /**\n * Renders the Drawer component via the LayerManager portal.\n */\n render() {\n if (this.state.open && this.layer) {\n const [Component] = this.layer;\n return <Component ref={this.setRefProp} />;\n }\n\n return null;\n }\n}\n"],"names":["DRAWER_POSITION","positionStyle","size","before","after","DrawerDiv","styled","getThemeValue","THEME_NAME","BACKGROUND","MODAL_SHADOW","props","position","positionMap","LAYER_POSITION","TOP_LEFT","TOP_RIGHT","BOTTOM_LEFT","Drawer","React","Component","getDerivedStateFromProps","open","componentDidMount","lastFocusedElement","document","activeElement","componentWillUnmount","restoreFocus","getSnapshotBeforeUpdate","prevProps","closeOnEsc","closeOnOverlayClick","overlay","children","rest","closeCallback","layer","LayerManager","renderLayer","exitDelay","onClose","component","_jsx","ref","setDrawerRef","role","aria-modal","tabIndex","onKeyDown","handleKeyDown","onClick","e","stopPropagation","forceUpdate","render","state","setRefProp","setState","undefined","drawerRef","createRef","getFocusableElements","current","Array","from","querySelectorAll","key","focusableElements","length","firstElement","lastElement","shiftKey","focus","preventDefault","elementToBeFocused","setTimeout","body","contains","node","setInitialFocus","root","firstChild","firstElementChild","getAttribute","setAttribute","forwardRef","defaultProps"],"mappings":";;;;;;AAWO,IAAA,eAAKA,iBAAAA,SAAAA,eAAAA,EAAAA;;;;AAAAA,IAAAA,OAAAA,eAAAA;AAIX,CAAA,CAAA,EAAA;AAED,MAAMC,eAAAA,GAAgB,CAACC,IAAAA,IAAmB;AACtC,QAAA,CAAA,MAAA,GAAwB;AACpBC,YAAAA,MAAAA,EAAQ,CAAC,0BAA0B,EAAED,IAAAA,IAAQ,OAAA,CAAQ,+BAA+B,CAAC;YACrFE,KAAAA,EAAO;AACX,SAAA;AACA,QAAA,CAAA,OAAA,GAAyB;AACrBD,YAAAA,MAAAA,EAAQ,CAAC,0BAA0B,EAAED,IAAAA,IAAQ,OAAA,CAAQ,8BAA8B,CAAC;YACpFE,KAAAA,EAAO;AACX,SAAA;AACA,QAAA,CAAA,QAAA,GAA0B;AACtBD,YAAAA,MAAAA,EAAQ;;;;AAII,oBAAA,EAAED,QAAQ,MAAA,CAAO;;;QAG7B,CAAC;YACDE,KAAAA,EAAO;AACX;KACJ,CAAA;AAEA,MAAMC,SAAAA,iBAAYC,MAAAA,CAAAA,KAAAA,EAAAA;;;AAGMC,CAAAA,CAAAA,CAAAA,sDAAAA,EAAAA,aAAAA,CAAcC,UAAAA,CAAWC,UAAU,CAAA,EAAA,6CAAA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AAC,UAAA,CAAA,KAAgB,IAAA,EAAM;oBAC9CF,UAAAA,CAAWG,YAAY,CAAC,UAAA,EAAY,IAAA,CAAA;AACxC,gBAAA;AACAH,gBAAAA,UAAAA,CAAWT,KAAK,EAAA;AAChB,gBAAA;AACJ,YAAA;;YAGA,MAAML,iBAAAA,GAAoB,IAAI,CAACN,oBAAoB,EAAA;YACnD,IAAIM,iBAAAA,CAAkBC,MAAM,GAAG,CAAA,EAAG;gBAC9BD,iBAAiB,CAAC,CAAA,CAAE,CAACK,KAAK,EAAA;YAC9B,CAAA,MAAO;;AAEHQ,gBAAAA,IAAAA,CAAKR,KAAK,EAAA;AACd,YAAA;QACJ,CAAA;;;AA0DC,QAAA,IAAA,CACDhB,aAAa,CAACsB,IAAAA,GAAAA;AACV,YAAA,IAAI,IAAI,CAACpE,KAAK,CAAC2E,UAAU,IAAI,OAAO,IAAI,CAAC3E,KAAK,CAAC2E,UAAU,KAAK,UAAA,EAAY;AACtE,gBAAA,IAAI,CAAC3E,KAAK,CAAC2E,UAAU,CAACP,IAAAA,CAAAA;AAC1B,YAAA,CAAA,MAAO,IAAI,IAAI,CAACpE,KAAK,CAAC2E,UAAU,IAAI,OAAO,IAAI,CAAC3E,KAAK,CAAC2E,UAAU,KAAK,QAAA,EAAU;AAC1E,gBAAA,IAAI,CAAC3E,KAAK,CAAC2E,UAAU,CAAmDvB,OAAO,GAAGgB,IAAAA;AACvF,YAAA;AACJ,QAAA,CAAA;;AAaJ;AA5OqB7D,MAAAA,CAQVqE,YAAAA,GAAe;IAClBtD,OAAAA,EAAS,IAAA;IACTrB,QAAQ,EAAA,MAAA;IACRmB,UAAAA,EAAY,IAAA;IACZC,mBAAAA,EAAqB;AACzB,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Drawer, DrawerHeader, DrawerBody, DrawerFooter, DRAWER_POSITION } from './Drawer';
|
|
1
|
+
export { default as Drawer, DrawerHeader, DrawerBody, DrawerFooter, DRAWER_POSITION, } from './Drawer';
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
errorText: PropTypes.Requireable<string>;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
2
|
+
type GroupProps = {
|
|
3
|
+
/** Error Message for the group */
|
|
4
|
+
errorText?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const Group: React.ForwardRefExoticComponent<GroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
7
|
export default Group;
|
|
@@ -1,85 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { jsxs, Fragment, jsx } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import React, { useId } from 'react';
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
|
-
import
|
|
5
|
-
const Container = styled.div `
|
|
6
|
-
display: inline-flex;
|
|
7
|
-
border: 1px solid var(--border-color, ${constants.BORDER_COLOR});
|
|
8
|
-
border-radius: 3px;
|
|
9
|
-
margin: 5px;
|
|
4
|
+
import { getThemeValue, THEME_NAME } from '../../shared/constants.js';
|
|
10
5
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
border-
|
|
16
|
-
border-left: 1px solid var(--border-color, ${constants.BORDER_COLOR});
|
|
17
|
-
box-shadow: none;
|
|
18
|
-
height: 32px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
& > div button {
|
|
22
|
-
border-left: none;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
& input, & select {
|
|
26
|
-
border: none;
|
|
27
|
-
height: 32px;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
& input, & select {
|
|
31
|
-
border-radius: 0;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
& input:active, & select:active {
|
|
35
|
-
box-shadow: none;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
& > div > span {
|
|
39
|
-
top: 8px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/* Handling for first and last child */
|
|
43
|
-
& > *:first-child, & > label:first-child input,
|
|
44
|
-
& > label:first-child select, & > *:first-child label,
|
|
45
|
-
& > *:first-child input {
|
|
46
|
-
border-left: none;
|
|
47
|
-
border-radius: 2px 0 0 2px;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
& > *:last-child, & > label:last-child input,
|
|
51
|
-
& > label:last-child select, & > *:last-child label,
|
|
52
|
-
& > *:last-child input {
|
|
53
|
-
border-radius: 0 2px 2px 0;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/* focus */
|
|
57
|
-
& *:focus, & *:focus + span {
|
|
58
|
-
z-index: 1;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
&:focus-within, &:hover {
|
|
62
|
-
box-shadow: var(--hover-shadow, ${constants.HOVER_SHADOW});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
${props => props.errorText ? `
|
|
66
|
-
border-color: var(--error, ${constants.ERROR});
|
|
6
|
+
const Container$3 = /*#__PURE__*/ styled("div", {
|
|
7
|
+
target: "eqhpibl0",
|
|
8
|
+
label: "Container"
|
|
9
|
+
})("display:inline-flex;border:1px solid ", getThemeValue(THEME_NAME.BORDER_COLOR), ";border-radius:3px;margin:5px;& button,& label{margin:0;border:none;border-radius:0;border-left:1px solid ", getThemeValue(THEME_NAME.BORDER_COLOR), ";box-shadow:none;height:32px;}& > div button{border-left:none;}& input,& select{border:none;height:32px;}& input,& select{border-radius:0;}& input:active,& select:active{box-shadow:none;}& > div > span{top:8px;}& > *:first-child,& > label:first-child input,& > label:first-child select,& > *:first-child label,& > *:first-child input{border-left:none;border-radius:2px 0 0 2px;}& > *:last-child,& > label:last-child input,& > label:last-child select,& > *:last-child label,& > *:last-child input{border-radius:0 2px 2px 0;}& *:focus,& *:focus + span{z-index:1;}&:focus-within,&:hover{box-shadow:", getThemeValue(THEME_NAME.HOVER_SHADOW), ";}", (props)=>props.errorText ? `
|
|
10
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
67
11
|
|
|
68
12
|
& > button, & > label {
|
|
69
|
-
border-color:
|
|
13
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
70
14
|
}
|
|
71
|
-
` : ''
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
15
|
+
` : '');
|
|
16
|
+
const ErrorContainer = /*#__PURE__*/ styled("div", {
|
|
17
|
+
target: "eqhpibl1",
|
|
18
|
+
label: "ErrorContainer"
|
|
19
|
+
})("color:", getThemeValue(THEME_NAME.ERROR), ";margin-left:8px;font-size:12px;");
|
|
20
|
+
function GroupComponent(props, ref) {
|
|
21
|
+
const errorId = useId();
|
|
22
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
23
|
+
children: [
|
|
24
|
+
/*#__PURE__*/ jsx(Container$3, {
|
|
25
|
+
...props,
|
|
26
|
+
ref: ref,
|
|
27
|
+
"aria-describedby": props.errorText ? errorId : undefined,
|
|
28
|
+
children: props.children
|
|
29
|
+
}),
|
|
30
|
+
props.errorText && /*#__PURE__*/ jsx(ErrorContainer, {
|
|
31
|
+
id: errorId,
|
|
32
|
+
children: props.errorText
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
});
|
|
80
36
|
}
|
|
81
|
-
Group
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
//# sourceMappingURL=Group.js.map
|
|
37
|
+
const Group = /*#__PURE__*/ React.forwardRef(GroupComponent);
|
|
38
|
+
|
|
39
|
+
export { Group as default };
|
|
40
|
+
//# sourceMappingURL=Group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Group.js","
|
|
1
|
+
{"version":3,"file":"Group.js","sources":["../../../src/components/Groups/Group.tsx"],"sourcesContent":["import React, { useId } from 'react';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nconst Container = styled.div<GroupProps>`\n display: inline-flex;\n border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n border-radius: 3px;\n margin: 5px;\n\n /* overrides */\n & button,\n & label {\n margin: 0;\n border: none;\n border-radius: 0;\n border-left: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n box-shadow: none;\n height: 32px;\n }\n\n & > div button {\n border-left: none;\n }\n\n & input,\n & select {\n border: none;\n height: 32px;\n }\n\n & input,\n & select {\n border-radius: 0;\n }\n\n & input:active,\n & select:active {\n box-shadow: none;\n }\n\n & > div > span {\n top: 8px;\n }\n\n /* Handling for first and last child */\n & > *:first-child,\n & > label:first-child input,\n & > label:first-child select,\n & > *:first-child label,\n & > *:first-child input {\n border-left: none;\n border-radius: 2px 0 0 2px;\n }\n\n & > *:last-child,\n & > label:last-child input,\n & > label:last-child select,\n & > *:last-child label,\n & > *:last-child input {\n border-radius: 0 2px 2px 0;\n }\n\n /* focus */\n & *:focus,\n & *:focus + span {\n z-index: 1;\n }\n\n &:focus-within,\n &:hover {\n box-shadow: ${getThemeValue(THEME_NAME.HOVER_SHADOW)};\n }\n\n ${(props) =>\n props.errorText\n ? `\n border-color: ${getThemeValue(THEME_NAME.ERROR)};\n\n & > button, & > label {\n border-color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n `\n : ''}\n`;\n\nconst ErrorContainer = styled.div`\n color: ${getThemeValue(THEME_NAME.ERROR)};\n margin-left: 8px;\n font-size: 12px;\n`;\n\ntype GroupProps = {\n /** Error Message for the group */\n errorText?: string;\n};\n\nfunction GroupComponent(\n props: React.PropsWithChildren<GroupProps>,\n ref: React.Ref<HTMLDivElement>,\n) {\n const errorId = useId();\n\n return (\n <>\n <Container\n {...props}\n ref={ref}\n aria-describedby={props.errorText ? errorId : undefined}\n >\n {props.children}\n </Container>\n {props.errorText && <ErrorContainer id={errorId}>{props.errorText}</ErrorContainer>}\n </>\n );\n}\n\nconst Group = React.forwardRef<HTMLDivElement, GroupProps>(GroupComponent);\nexport default Group;\n"],"names":["Container","styled","getThemeValue","THEME_NAME","BORDER_COLOR","HOVER_SHADOW","props","errorText","ERROR","ErrorContainer","GroupComponent","ref","errorId","useId","_jsxs","_Fragment","_jsx","aria-describedby","undefined","children","id","Group","React","forwardRef"],"mappings":";;;;;AAIA,MAAMA,WAAAA,iBAAYC,MAAAA,CAAAA,KAAAA,EAAAA;;;AAEMC,CAAAA,CAAAA,CAAAA,uCAAAA,EAAAA,aAAAA,CAAcC,WAAWC,YAAY,CAAA,EAAA,4GAAA,EAU5BF,aAAAA,CAAcC,UAAAA,CAAWC,YAAY,CAAA,EAAA,qlBAAA,EAuDhDF,aAAAA,CAAcC,UAAAA,CAAWE,YAAY,SAGrD,CAACC,KAAAA,GACCA,KAAAA,CAAMC,SAAS,GACT;sBACQ,EAAEL,aAAAA,CAAcC,UAAAA,CAAWK,KAAK,CAAA,CAAE;;;0BAG9B,EAAEN,aAAAA,CAAcC,UAAAA,CAAWK,KAAK,CAAA,CAAE;;AAExD,IAAA,CAAC,GACS,EAAA,CAAA;AAGd,MAAMC,cAAAA,iBAAiBR,MAAAA,CAAAA,KAAAA,EAAAA;;;AACVC,CAAAA,CAAAA,CAAAA,QAAAA,EAAAA,aAAAA,CAAcC,WAAWK,KAAK,CAAA,EAAA,kCAAA,CAAA;AAU3C,SAASE,cAAAA,CACLJ,KAA0C,EAC1CK,GAA8B,EAAA;AAE9B,IAAA,MAAMC,OAAAA,GAAUC,KAAAA,EAAAA;IAEhB,qBACIC,IAAA,CAAAC,QAAA,EAAA;;0BACIC,GAAA,CAAChB,WAAAA,EAAAA;AACI,gBAAA,GAAGM,KAAK;gBACTK,GAAAA,EAAKA,GAAAA;gBACLM,kBAAAA,EAAkBX,KAAAA,CAAMC,SAAS,GAAGK,OAAAA,GAAUM,SAAAA;AAE7CZ,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMa;;YAEVb,KAAAA,CAAMC,SAAS,kBAAIS,GAAA,CAACP,cAAAA,EAAAA;gBAAeW,EAAAA,EAAIR,OAAAA;AAAUN,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMC;;;;AAGpE;AAEA,MAAMc,KAAAA,iBAAQC,KAAAA,CAAMC,UAAU,CAA6Bb,cAAAA;;;;"}
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
-
import
|
|
3
|
-
export default styled.label `
|
|
4
|
-
height: 32px;
|
|
5
|
-
background-color: ${constants.DISABLED_BACKGROUND};
|
|
6
|
-
padding: 0 4px;
|
|
7
|
-
line-height: 32px;
|
|
8
|
-
min-width: 24px;
|
|
9
|
-
text-align: center;
|
|
10
|
-
color: ${constants.BORDER_COLOR};
|
|
2
|
+
import { getThemeValue, THEME_NAME } from '../../shared/constants.js';
|
|
11
3
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=GroupLabel.js.map
|
|
4
|
+
var GroupLabel = /*#__PURE__*/ styled("label", {
|
|
5
|
+
target: "e1kv3eb90",
|
|
6
|
+
label: ""
|
|
7
|
+
})("height:32px;background-color:", getThemeValue(THEME_NAME.DISABLED_BACKGROUND), ";padding:0 4px;line-height:32px;min-width:24px;text-align:center;color:", getThemeValue(THEME_NAME.BORDER_COLOR), ";& > svg{height:24px;width:24px;vertical-align:middle;fill:currentColor;}");
|
|
8
|
+
|
|
9
|
+
export { GroupLabel as default };
|
|
10
|
+
//# sourceMappingURL=GroupLabel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupLabel.js","
|
|
1
|
+
{"version":3,"file":"GroupLabel.js","sources":["../../../src/components/Groups/GroupLabel.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\nexport default styled.label`\n height: 32px;\n background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};\n padding: 0 4px;\n line-height: 32px;\n min-width: 24px;\n text-align: center;\n color: ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n\n & > svg {\n height: 24px;\n width: 24px;\n vertical-align: middle;\n fill: currentColor;\n }\n`;\n"],"names":["styled","getThemeValue","THEME_NAME","DISABLED_BACKGROUND","BORDER_COLOR"],"mappings":";;;AAGA,iBAAA,cAAeA,MAAAA,CAAAA,OAAAA,EAAAA;;;AAESC,CAAAA,CAAAA,CAAAA,+BAAAA,EAAAA,aAAAA,CAAcC,WAAWC,mBAAmB,CAAA,EAAA,yEAAA,EAKvDF,aAAAA,CAAcC,UAAAA,CAAWE,YAAY,CAAA,EAAA,2EAAA,CAAA;;;;"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
label: string;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
2
|
+
declare const Checkbox: React.ForwardRefExoticComponent<{
|
|
3
|
+
/**
|
|
4
|
+
* Label for the field
|
|
5
|
+
* @default ''
|
|
6
|
+
*/
|
|
7
|
+
label?: string;
|
|
8
|
+
/**
|
|
9
|
+
* If the field is in indeterminate state
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
indeterminate?: boolean;
|
|
13
|
+
} & React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
|
|
17
14
|
export default Checkbox;
|