no-frills-ui 0.0.14-alpha.4 → 0.0.14-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1335 -493
- package/dist/index.js.map +1 -1
- package/lib-esm/components/Accordion/AccordionStep.d.ts.map +1 -1
- package/lib-esm/components/Accordion/AccordionStep.js +11 -29
- package/lib-esm/components/Accordion/AccordionStep.js.map +1 -1
- package/lib-esm/components/Badge/Badge.js +7 -7
- package/lib-esm/components/Badge/Badge.js.map +1 -1
- package/lib-esm/components/Button/ActionButton.d.ts.map +1 -1
- package/lib-esm/components/Button/ActionButton.js +12 -11
- package/lib-esm/components/Button/ActionButton.js.map +1 -1
- package/lib-esm/components/Button/Button.d.ts.map +1 -1
- package/lib-esm/components/Button/Button.js +14 -13
- package/lib-esm/components/Button/Button.js.map +1 -1
- package/lib-esm/components/Button/IconButton.d.ts.map +1 -1
- package/lib-esm/components/Button/IconButton.js +15 -14
- package/lib-esm/components/Button/IconButton.js.map +1 -1
- package/lib-esm/components/Button/LinkButton.d.ts.map +1 -1
- package/lib-esm/components/Button/LinkButton.js +7 -6
- package/lib-esm/components/Button/LinkButton.js.map +1 -1
- package/lib-esm/components/Button/RaisedButton.d.ts.map +1 -1
- package/lib-esm/components/Button/RaisedButton.js +15 -14
- package/lib-esm/components/Button/RaisedButton.js.map +1 -1
- package/lib-esm/components/Card/Card.d.ts.map +1 -1
- package/lib-esm/components/Card/Card.js +4 -4
- package/lib-esm/components/Card/Card.js.map +1 -1
- package/lib-esm/components/Chip/Chip.js +8 -8
- package/lib-esm/components/Chip/Chip.js.map +1 -1
- package/lib-esm/components/ChipInput/ChipInput.js +20 -20
- package/lib-esm/components/ChipInput/ChipInput.js.map +1 -1
- package/lib-esm/components/Dialog/AlertDialog.d.ts.map +1 -1
- package/lib-esm/components/Dialog/AlertDialog.js +4 -1
- package/lib-esm/components/Dialog/AlertDialog.js.map +1 -1
- package/lib-esm/components/Dialog/Dialog.d.ts +26 -1
- package/lib-esm/components/Dialog/Dialog.d.ts.map +1 -1
- package/lib-esm/components/Dialog/Dialog.js +84 -1
- package/lib-esm/components/Dialog/Dialog.js.map +1 -1
- package/lib-esm/components/DragAndDrop/DragItem.js +8 -8
- package/lib-esm/components/DragAndDrop/DragItem.js.map +1 -1
- package/lib-esm/components/Drawer/Drawer.d.ts +76 -1
- package/lib-esm/components/Drawer/Drawer.d.ts.map +1 -1
- package/lib-esm/components/Drawer/Drawer.js +158 -24
- package/lib-esm/components/Drawer/Drawer.js.map +1 -1
- package/lib-esm/components/Groups/Group.d.ts.map +1 -1
- package/lib-esm/components/Groups/Group.js +10 -8
- package/lib-esm/components/Groups/Group.js.map +1 -1
- package/lib-esm/components/Groups/GroupLabel.d.ts.map +1 -1
- package/lib-esm/components/Groups/GroupLabel.js +3 -3
- package/lib-esm/components/Groups/GroupLabel.js.map +1 -1
- package/lib-esm/components/Input/Checkbox.d.ts.map +1 -1
- package/lib-esm/components/Input/Checkbox.js +63 -58
- package/lib-esm/components/Input/Checkbox.js.map +1 -1
- package/lib-esm/components/Input/Dropdown.d.ts +8 -0
- package/lib-esm/components/Input/Dropdown.d.ts.map +1 -1
- package/lib-esm/components/Input/Dropdown.js +54 -31
- package/lib-esm/components/Input/Dropdown.js.map +1 -1
- package/lib-esm/components/Input/Input.d.ts.map +1 -1
- package/lib-esm/components/Input/Input.js +27 -21
- package/lib-esm/components/Input/Input.js.map +1 -1
- package/lib-esm/components/Input/Radio.d.ts.map +1 -1
- package/lib-esm/components/Input/Radio.js +58 -42
- package/lib-esm/components/Input/Radio.js.map +1 -1
- package/lib-esm/components/Input/RadioButton.d.ts.map +1 -1
- package/lib-esm/components/Input/RadioButton.js +12 -12
- package/lib-esm/components/Input/RadioButton.js.map +1 -1
- package/lib-esm/components/Input/Select.d.ts.map +1 -1
- package/lib-esm/components/Input/Select.js +27 -21
- package/lib-esm/components/Input/Select.js.map +1 -1
- package/lib-esm/components/Input/TextArea.d.ts.map +1 -1
- package/lib-esm/components/Input/TextArea.js +27 -21
- package/lib-esm/components/Input/TextArea.js.map +1 -1
- package/lib-esm/components/Input/Toggle.d.ts.map +1 -1
- package/lib-esm/components/Input/Toggle.js +17 -14
- package/lib-esm/components/Input/Toggle.js.map +1 -1
- package/lib-esm/components/Menu/Menu.d.ts +13 -1
- package/lib-esm/components/Menu/Menu.d.ts.map +1 -1
- package/lib-esm/components/Menu/Menu.js +98 -3
- package/lib-esm/components/Menu/Menu.js.map +1 -1
- package/lib-esm/components/Menu/MenuItem.d.ts +6 -3
- package/lib-esm/components/Menu/MenuItem.d.ts.map +1 -1
- package/lib-esm/components/Menu/MenuItem.js +10 -10
- package/lib-esm/components/Menu/MenuItem.js.map +1 -1
- package/lib-esm/components/Modal/Modal.d.ts +70 -1
- package/lib-esm/components/Modal/Modal.d.ts.map +1 -1
- package/lib-esm/components/Modal/Modal.js +145 -11
- package/lib-esm/components/Modal/Modal.js.map +1 -1
- package/lib-esm/components/Notification/Notification.d.ts +3 -1
- package/lib-esm/components/Notification/Notification.d.ts.map +1 -1
- package/lib-esm/components/Notification/Notification.js +4 -2
- package/lib-esm/components/Notification/Notification.js.map +1 -1
- package/lib-esm/components/Notification/NotificationManager.d.ts +11 -1
- package/lib-esm/components/Notification/NotificationManager.d.ts.map +1 -1
- package/lib-esm/components/Notification/NotificationManager.js +43 -8
- package/lib-esm/components/Notification/NotificationManager.js.map +1 -1
- package/lib-esm/components/Notification/style.d.ts +4 -0
- package/lib-esm/components/Notification/style.d.ts.map +1 -1
- package/lib-esm/components/Notification/style.js +30 -15
- 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.d.ts.map +1 -1
- package/lib-esm/components/Notification/types.js.map +1 -1
- package/lib-esm/components/Popover/Popover.d.ts.map +1 -1
- package/lib-esm/components/Popover/Popover.js +17 -2
- package/lib-esm/components/Popover/Popover.js.map +1 -1
- package/lib-esm/components/Spinner/Spinner.d.ts +3 -0
- package/lib-esm/components/Spinner/Spinner.d.ts.map +1 -1
- package/lib-esm/components/Spinner/Spinner.js +19 -4
- package/lib-esm/components/Spinner/Spinner.js.map +1 -1
- package/lib-esm/components/Stepper/Stepper.d.ts.map +1 -1
- package/lib-esm/components/Stepper/Stepper.js +29 -10
- package/lib-esm/components/Stepper/Stepper.js.map +1 -1
- package/lib-esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib-esm/components/Tabs/Tabs.js +45 -12
- package/lib-esm/components/Tabs/Tabs.js.map +1 -1
- package/lib-esm/components/Toast/Toast.d.ts +25 -4
- package/lib-esm/components/Toast/Toast.d.ts.map +1 -1
- package/lib-esm/components/Toast/Toast.js +114 -18
- package/lib-esm/components/Toast/Toast.js.map +1 -1
- package/lib-esm/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib-esm/components/Tooltip/Tooltip.js +16 -5
- package/lib-esm/components/Tooltip/Tooltip.js.map +1 -1
- package/lib-esm/shared/LayerManager.d.ts.map +1 -1
- package/lib-esm/shared/LayerManager.js +63 -1
- package/lib-esm/shared/LayerManager.js.map +1 -1
- package/lib-esm/shared/constants.d.ts +58 -27
- package/lib-esm/shared/constants.d.ts.map +1 -1
- package/lib-esm/shared/constants.js +88 -25
- package/lib-esm/shared/constants.js.map +1 -1
- package/lib-esm/shared/styles.d.ts +1 -1
- package/lib-esm/shared/styles.d.ts.map +1 -1
- package/lib-esm/shared/styles.js +5 -3
- package/lib-esm/shared/styles.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -74,42 +74,106 @@ function CheckCircle(props) {
|
|
|
74
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
75
|
}
|
|
76
76
|
|
|
77
|
-
var
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
77
|
+
var THEME_CONSTANTS;
|
|
78
|
+
(function (THEME_CONSTANTS) {
|
|
79
|
+
THEME_CONSTANTS["PRIMARY"] = "#1f7ac5";
|
|
80
|
+
THEME_CONSTANTS["PRIMARY_LIGHT"] = "#64baff";
|
|
81
|
+
THEME_CONSTANTS["PRIMARY_LIGHTER"] = "#cfe9ff";
|
|
82
|
+
THEME_CONSTANTS["BACKDROP_COLOR"] = "#2681da80";
|
|
83
|
+
THEME_CONSTANTS["INFO"] = "#1f7ac5ff";
|
|
84
|
+
THEME_CONSTANTS["INFO_LIGHT"] = "#64baffff";
|
|
85
|
+
THEME_CONSTANTS["SUCCESS"] = "#1a835f";
|
|
86
|
+
THEME_CONSTANTS["SUCCESS_LIGHT"] = "#80eac6";
|
|
87
|
+
THEME_CONSTANTS["WARNING"] = "#916b01";
|
|
88
|
+
THEME_CONSTANTS["WARNING_LIGHT"] = "#ffba00";
|
|
89
|
+
THEME_CONSTANTS["ERROR"] = "#bb2828";
|
|
90
|
+
THEME_CONSTANTS["ERROR_LIGHT"] = "#f1a5a5";
|
|
91
|
+
THEME_CONSTANTS["BORDER_COLOR"] = "#555555";
|
|
92
|
+
THEME_CONSTANTS["TOAST"] = "#5f5f5f";
|
|
93
|
+
THEME_CONSTANTS["TOOLTIP_COLOR"] = "rgba(0,0,0,0.6)";
|
|
94
|
+
THEME_CONSTANTS["BORDER_LIGHT_COLOR"] = "#eeeeee";
|
|
95
|
+
THEME_CONSTANTS["BACKGROUND"] = "#ffffff";
|
|
96
|
+
THEME_CONSTANTS["DISABLED_BACKGROUND"] = "#fafafa";
|
|
97
|
+
THEME_CONSTANTS["DISABLED_BORDER"] = "#aaa";
|
|
98
|
+
THEME_CONSTANTS["LIGHT_GREY"] = "#ccc";
|
|
99
|
+
THEME_CONSTANTS["DISABLED"] = "#737373";
|
|
100
|
+
THEME_CONSTANTS["TEXT_COLOR_LIGHT"] = "#fff";
|
|
101
|
+
THEME_CONSTANTS["TEXT_COLOR_DARK"] = "#000";
|
|
102
|
+
THEME_CONSTANTS["SHADOW"] = "0px 1px 3px 0px rgba(0,0,0,0.1), 0px 1px 2px 0px rgba(0,0,0,0.06)";
|
|
103
|
+
THEME_CONSTANTS["HOVER_SHADOW"] = "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)";
|
|
104
|
+
THEME_CONSTANTS["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)";
|
|
105
|
+
})(THEME_CONSTANTS || (THEME_CONSTANTS = {}));
|
|
106
|
+
var THEME_NAME;
|
|
107
|
+
(function (THEME_NAME) {
|
|
108
|
+
THEME_NAME["PRIMARY"] = "--nfui-primary";
|
|
109
|
+
THEME_NAME["PRIMARY_LIGHT"] = "--nfui-primary-light";
|
|
110
|
+
THEME_NAME["PRIMARY_LIGHTER"] = "--nfui-primary-lighter";
|
|
111
|
+
THEME_NAME["INFO"] = "--nfui-info";
|
|
112
|
+
THEME_NAME["INFO_LIGHT"] = "--nfui-info-light";
|
|
113
|
+
THEME_NAME["SUCCESS"] = "--nfui-success";
|
|
114
|
+
THEME_NAME["SUCCESS_LIGHT"] = "--nfui-success-light";
|
|
115
|
+
THEME_NAME["WARNING"] = "--nfui-warning";
|
|
116
|
+
THEME_NAME["WARNING_LIGHT"] = "--nfui-warning-light";
|
|
117
|
+
THEME_NAME["ERROR"] = "--nfui-error";
|
|
118
|
+
THEME_NAME["ERROR_LIGHT"] = "--nfui-error-light";
|
|
119
|
+
THEME_NAME["BORDER_COLOR"] = "--nfui-border-color";
|
|
120
|
+
THEME_NAME["TOAST"] = "--nfui-toast";
|
|
121
|
+
THEME_NAME["TOOLTIP_COLOR"] = "--nfui-tooltip-color";
|
|
122
|
+
THEME_NAME["BORDER_LIGHT_COLOR"] = "--nfui-border-light-color";
|
|
123
|
+
THEME_NAME["BACKGROUND"] = "--nfui-background";
|
|
124
|
+
THEME_NAME["DISABLED_BACKGROUND"] = "--nfui-disabled-background";
|
|
125
|
+
THEME_NAME["DISABLED_BORDER"] = "--nfui-disabled-border";
|
|
126
|
+
THEME_NAME["LIGHT_GREY"] = "--nfui-light-grey";
|
|
127
|
+
THEME_NAME["DISABLED"] = "--nfui-disabled";
|
|
128
|
+
THEME_NAME["TEXT_COLOR_LIGHT"] = "--nfui-text-color-light";
|
|
129
|
+
THEME_NAME["TEXT_COLOR_DARK"] = "--nfui-text-color-dark";
|
|
130
|
+
THEME_NAME["SHADOW"] = "--nfui-shadow";
|
|
131
|
+
THEME_NAME["HOVER_SHADOW"] = "--nfui-hover-shadow";
|
|
132
|
+
THEME_NAME["MODAL_SHADOW"] = "--nfui-modal-shadow";
|
|
133
|
+
THEME_NAME["BACKDROP_COLOR"] = "--nfui-backdrop-color";
|
|
134
|
+
})(THEME_NAME || (THEME_NAME = {}));
|
|
135
|
+
const themeNameMap = {
|
|
136
|
+
[THEME_NAME.PRIMARY]: THEME_CONSTANTS.PRIMARY,
|
|
137
|
+
[THEME_NAME.PRIMARY_LIGHT]: THEME_CONSTANTS.PRIMARY_LIGHT,
|
|
138
|
+
[THEME_NAME.PRIMARY_LIGHTER]: THEME_CONSTANTS.PRIMARY_LIGHTER,
|
|
139
|
+
[THEME_NAME.INFO]: THEME_CONSTANTS.INFO,
|
|
140
|
+
[THEME_NAME.INFO_LIGHT]: THEME_CONSTANTS.INFO_LIGHT,
|
|
141
|
+
[THEME_NAME.SUCCESS]: THEME_CONSTANTS.SUCCESS,
|
|
142
|
+
[THEME_NAME.SUCCESS_LIGHT]: THEME_CONSTANTS.SUCCESS_LIGHT,
|
|
143
|
+
[THEME_NAME.WARNING]: THEME_CONSTANTS.WARNING,
|
|
144
|
+
[THEME_NAME.WARNING_LIGHT]: THEME_CONSTANTS.WARNING_LIGHT,
|
|
145
|
+
[THEME_NAME.ERROR]: THEME_CONSTANTS.ERROR,
|
|
146
|
+
[THEME_NAME.ERROR_LIGHT]: THEME_CONSTANTS.ERROR_LIGHT,
|
|
147
|
+
[THEME_NAME.BACKDROP_COLOR]: THEME_CONSTANTS.BACKDROP_COLOR,
|
|
148
|
+
[THEME_NAME.BORDER_COLOR]: THEME_CONSTANTS.BORDER_COLOR,
|
|
149
|
+
[THEME_NAME.TOAST]: THEME_CONSTANTS.TOAST,
|
|
150
|
+
[THEME_NAME.TOOLTIP_COLOR]: THEME_CONSTANTS.TOOLTIP_COLOR,
|
|
151
|
+
[THEME_NAME.BORDER_LIGHT_COLOR]: THEME_CONSTANTS.BORDER_LIGHT_COLOR,
|
|
152
|
+
[THEME_NAME.BACKGROUND]: THEME_CONSTANTS.BACKGROUND,
|
|
153
|
+
[THEME_NAME.DISABLED_BACKGROUND]: THEME_CONSTANTS.DISABLED_BACKGROUND,
|
|
154
|
+
[THEME_NAME.DISABLED_BORDER]: THEME_CONSTANTS.DISABLED_BORDER,
|
|
155
|
+
[THEME_NAME.LIGHT_GREY]: THEME_CONSTANTS.LIGHT_GREY,
|
|
156
|
+
[THEME_NAME.DISABLED]: THEME_CONSTANTS.DISABLED,
|
|
157
|
+
[THEME_NAME.TEXT_COLOR_LIGHT]: THEME_CONSTANTS.TEXT_COLOR_LIGHT,
|
|
158
|
+
[THEME_NAME.TEXT_COLOR_DARK]: THEME_CONSTANTS.TEXT_COLOR_DARK,
|
|
159
|
+
[THEME_NAME.SHADOW]: THEME_CONSTANTS.SHADOW,
|
|
160
|
+
[THEME_NAME.HOVER_SHADOW]: THEME_CONSTANTS.HOVER_SHADOW,
|
|
161
|
+
[THEME_NAME.MODAL_SHADOW]: THEME_CONSTANTS.MODAL_SHADOW,
|
|
162
|
+
};
|
|
163
|
+
const getThemeValue = (key) => {
|
|
164
|
+
return `var(${key}, ${themeNameMap[key]})`;
|
|
102
165
|
};
|
|
103
166
|
|
|
104
167
|
const Ellipsis = styled.span `
|
|
105
168
|
white-space: nowrap;
|
|
106
169
|
text-overflow: ellipsis;
|
|
107
170
|
overflow: hidden;
|
|
171
|
+
flex: 1;
|
|
108
172
|
`;
|
|
109
|
-
const Header$1 = styled.
|
|
173
|
+
const Header$1 = styled.h1 `
|
|
110
174
|
padding: 10px 15px;
|
|
111
175
|
line-height: 26px;
|
|
112
|
-
border-bottom: 1px solid
|
|
176
|
+
border-bottom: 1px solid ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};
|
|
113
177
|
font-size: 16px;
|
|
114
178
|
font-weight: bold;
|
|
115
179
|
`;
|
|
@@ -120,7 +184,7 @@ const Body$1 = styled.div `
|
|
|
120
184
|
`;
|
|
121
185
|
const Footer$1 = styled.div `
|
|
122
186
|
padding: 10px 15px;
|
|
123
|
-
border-top: 1px solid
|
|
187
|
+
border-top: 1px solid ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};
|
|
124
188
|
display: flex;
|
|
125
189
|
justify-content: flex-end;
|
|
126
190
|
`;
|
|
@@ -137,18 +201,18 @@ const BadgeSpan = styled.span `
|
|
|
137
201
|
background-color: ${(props) => {
|
|
138
202
|
switch (props.type) {
|
|
139
203
|
case exports.BADGE_TYPE.SUCCESS:
|
|
140
|
-
return
|
|
204
|
+
return getThemeValue(THEME_NAME.SUCCESS);
|
|
141
205
|
case exports.BADGE_TYPE.WARNING:
|
|
142
|
-
return
|
|
206
|
+
return getThemeValue(THEME_NAME.WARNING);
|
|
143
207
|
case exports.BADGE_TYPE.DANGER:
|
|
144
|
-
return
|
|
208
|
+
return getThemeValue(THEME_NAME.ERROR);
|
|
145
209
|
case exports.BADGE_TYPE.DISABLED:
|
|
146
|
-
return
|
|
210
|
+
return getThemeValue(THEME_NAME.DISABLED);
|
|
147
211
|
default:
|
|
148
|
-
return
|
|
212
|
+
return getThemeValue(THEME_NAME.PRIMARY);
|
|
149
213
|
}
|
|
150
214
|
}};
|
|
151
|
-
color:
|
|
215
|
+
color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};
|
|
152
216
|
border-radius: 10px;
|
|
153
217
|
padding: ${(props) => (props.children ? '3px 10px' : '4px')};
|
|
154
218
|
display: inline-block;
|
|
@@ -182,10 +246,10 @@ Badge.defaultProps = {
|
|
|
182
246
|
|
|
183
247
|
const Card = styled.div `
|
|
184
248
|
border-radius: 10px;
|
|
185
|
-
background-color:
|
|
249
|
+
background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
186
250
|
${(props) => props.elevated
|
|
187
|
-
? `box-shadow:
|
|
188
|
-
: `box-shadow:
|
|
251
|
+
? `box-shadow: ${getThemeValue(THEME_NAME.MODAL_SHADOW)};`
|
|
252
|
+
: `box-shadow: ${getThemeValue(THEME_NAME.SHADOW)};`}
|
|
189
253
|
margin: 5px;
|
|
190
254
|
overflow: auto;
|
|
191
255
|
position: relative;
|
|
@@ -195,10 +259,7 @@ const Step$1 = styled(Card) `
|
|
|
195
259
|
transition: all 0.6s ease;
|
|
196
260
|
overflow: visible;
|
|
197
261
|
|
|
198
|
-
${(props) => props.open &&
|
|
199
|
-
`
|
|
200
|
-
margin: 20px 5px;
|
|
201
|
-
`}
|
|
262
|
+
${(props) => props.open && `margin: 20px 5px;`}
|
|
202
263
|
`;
|
|
203
264
|
const StepHeader = styled.button `
|
|
204
265
|
padding: 20px 15px;
|
|
@@ -209,9 +270,10 @@ const StepHeader = styled.button `
|
|
|
209
270
|
border-radius: 10px;
|
|
210
271
|
width: 100%;
|
|
211
272
|
font-size: inherit;
|
|
273
|
+
color: ${getThemeValue(THEME_NAME.TEXT_COLOR_DARK)};
|
|
212
274
|
|
|
213
275
|
&:focus-visible {
|
|
214
|
-
box-shadow: 0 0 0 4px
|
|
276
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
215
277
|
}
|
|
216
278
|
|
|
217
279
|
& input {
|
|
@@ -219,19 +281,9 @@ const StepHeader = styled.button `
|
|
|
219
281
|
margin: 0;
|
|
220
282
|
}
|
|
221
283
|
|
|
222
|
-
${(props) => props.open
|
|
223
|
-
? `
|
|
224
|
-
border-bottom: 1px solid var(--border-light-color, ${constants.BORDER_LIGHT_COLOR});
|
|
225
|
-
`
|
|
226
|
-
: ''}
|
|
284
|
+
${(props) => props.open && `border-bottom: 1px solid ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};`}
|
|
227
285
|
|
|
228
|
-
${(props) => props.disabled
|
|
229
|
-
? `
|
|
230
|
-
color: ${constants.DISABLED};
|
|
231
|
-
`
|
|
232
|
-
: `
|
|
233
|
-
cursor: pointer;
|
|
234
|
-
`}
|
|
286
|
+
${(props) => props.disabled && `color: ${getThemeValue(THEME_NAME.DISABLED)};`}
|
|
235
287
|
`;
|
|
236
288
|
const HeaderContainer = styled.div `
|
|
237
289
|
display: flex;
|
|
@@ -242,10 +294,10 @@ const HeaderContainer = styled.div `
|
|
|
242
294
|
vertical-align: top;
|
|
243
295
|
margin-right: 10px;
|
|
244
296
|
fill: ${(props) => props.open
|
|
245
|
-
?
|
|
297
|
+
? getThemeValue(THEME_NAME.PRIMARY)
|
|
246
298
|
: props.completed
|
|
247
|
-
?
|
|
248
|
-
:
|
|
299
|
+
? getThemeValue(THEME_NAME.SUCCESS)
|
|
300
|
+
: getThemeValue(THEME_NAME.LIGHT_GREY)};
|
|
249
301
|
transform: ${(props) => (props.open ? 'scale(0.8)' : 'scale(0.6)')};
|
|
250
302
|
transition: all 0.3s ease;
|
|
251
303
|
min-width: 24px;
|
|
@@ -262,13 +314,7 @@ const ExpandContainer = styled.div `
|
|
|
262
314
|
fill: currentColor;
|
|
263
315
|
}
|
|
264
316
|
|
|
265
|
-
${(props) => props.open
|
|
266
|
-
? `
|
|
267
|
-
& svg {
|
|
268
|
-
transform: rotate(180deg);
|
|
269
|
-
}
|
|
270
|
-
`
|
|
271
|
-
: ''}
|
|
317
|
+
${(props) => (props.open ? `& svg { transform: rotate(180deg); }` : '')}
|
|
272
318
|
`;
|
|
273
319
|
const StepBody = styled.div `
|
|
274
320
|
transition: all 0.6s ease;
|
|
@@ -282,7 +328,7 @@ const AccordionStepFooter = styled.div `
|
|
|
282
328
|
display: flex;
|
|
283
329
|
justify-content: flex-end;
|
|
284
330
|
padding: 10px 15px;
|
|
285
|
-
border-top: 1px solid
|
|
331
|
+
border-top: 1px solid ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};
|
|
286
332
|
`;
|
|
287
333
|
function AccordionStep(props) {
|
|
288
334
|
const [height, setHeight] = React.useState(0);
|
|
@@ -311,7 +357,7 @@ AccordionStep.defaultProps = {
|
|
|
311
357
|
};
|
|
312
358
|
|
|
313
359
|
const StyledButton = styled.button `
|
|
314
|
-
border: 1px solid
|
|
360
|
+
border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
|
|
315
361
|
border-radius: 5px;
|
|
316
362
|
height: 32px;
|
|
317
363
|
min-width: 100px;
|
|
@@ -319,12 +365,13 @@ const StyledButton = styled.button `
|
|
|
319
365
|
text-align: center;
|
|
320
366
|
padding: 0 12px;
|
|
321
367
|
cursor: pointer;
|
|
322
|
-
color:
|
|
323
|
-
background-color:
|
|
324
|
-
text-overflow: ellipsis;
|
|
325
|
-
white-space: nowrap;
|
|
368
|
+
color: ${getThemeValue(THEME_NAME.TEXT_COLOR_DARK)};
|
|
369
|
+
background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
326
370
|
margin: 5px;
|
|
327
371
|
position: relative;
|
|
372
|
+
display: inline-flex;
|
|
373
|
+
align-items: center;
|
|
374
|
+
justify-content: center;
|
|
328
375
|
|
|
329
376
|
& svg {
|
|
330
377
|
vertical-align: middle;
|
|
@@ -335,19 +382,19 @@ const StyledButton = styled.button `
|
|
|
335
382
|
}
|
|
336
383
|
|
|
337
384
|
&:enabled:hover {
|
|
338
|
-
border-color:
|
|
339
|
-
color:
|
|
385
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
386
|
+
color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
340
387
|
}
|
|
341
388
|
|
|
342
389
|
&:focus {
|
|
343
|
-
border-color:
|
|
344
|
-
box-shadow: 0 0 0 4px
|
|
390
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
391
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
345
392
|
}
|
|
346
393
|
|
|
347
394
|
&:disabled {
|
|
348
|
-
background-color:
|
|
349
|
-
border-color:
|
|
350
|
-
color:
|
|
395
|
+
background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};
|
|
396
|
+
border-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};
|
|
397
|
+
color: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
351
398
|
}
|
|
352
399
|
`;
|
|
353
400
|
StyledButton.defaultProps = {
|
|
@@ -362,12 +409,13 @@ var LinkButton = styled.button `
|
|
|
362
409
|
cursor: pointer;
|
|
363
410
|
background-color: transparent;
|
|
364
411
|
border: none;
|
|
365
|
-
color:
|
|
412
|
+
color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
366
413
|
padding: 0 12px;
|
|
367
|
-
text-overflow: ellipsis;
|
|
368
|
-
white-space: nowrap;
|
|
369
414
|
margin: 5px;
|
|
370
415
|
position: relative;
|
|
416
|
+
display: inline-flex;
|
|
417
|
+
align-items: center;
|
|
418
|
+
justify-content: center;
|
|
371
419
|
|
|
372
420
|
& svg {
|
|
373
421
|
vertical-align: middle;
|
|
@@ -383,28 +431,29 @@ var LinkButton = styled.button `
|
|
|
383
431
|
}
|
|
384
432
|
|
|
385
433
|
&:disabled {
|
|
386
|
-
border-color: ${
|
|
387
|
-
color: ${
|
|
434
|
+
border-color: ${getThemeValue(THEME_NAME.BORDER_COLOR)};
|
|
435
|
+
color: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
388
436
|
}
|
|
389
437
|
`;
|
|
390
438
|
|
|
391
439
|
var RaisedButton = styled.button `
|
|
392
|
-
border: 1px solid
|
|
440
|
+
border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
|
|
393
441
|
border-radius: 5px;
|
|
394
442
|
height: 32px;
|
|
395
443
|
min-width: 100px;
|
|
396
444
|
font-size: 14px;
|
|
397
445
|
text-align: center;
|
|
398
446
|
padding: 0 12px;
|
|
399
|
-
cursor:
|
|
447
|
+
cursor: ${getThemeValue(THEME_NAME.TEXT_COLOR_DARK)};
|
|
400
448
|
color: inherit;
|
|
401
|
-
background-color:
|
|
449
|
+
background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
402
450
|
transform: translateY(-2px);
|
|
403
|
-
box-shadow:
|
|
404
|
-
text-overflow: ellipsis;
|
|
405
|
-
white-space: nowrap;
|
|
451
|
+
box-shadow: ${getThemeValue(THEME_NAME.HOVER_SHADOW)};
|
|
406
452
|
margin: 5px;
|
|
407
453
|
position: relative;
|
|
454
|
+
display: inline-flex;
|
|
455
|
+
align-items: center;
|
|
456
|
+
justify-content: center;
|
|
408
457
|
|
|
409
458
|
& svg {
|
|
410
459
|
vertical-align: middle;
|
|
@@ -415,30 +464,30 @@ var RaisedButton = styled.button `
|
|
|
415
464
|
}
|
|
416
465
|
|
|
417
466
|
&:enabled:hover {
|
|
418
|
-
border-color:
|
|
419
|
-
color:
|
|
467
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
468
|
+
color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
420
469
|
}
|
|
421
470
|
|
|
422
471
|
&:focus {
|
|
423
|
-
border-color:
|
|
472
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
424
473
|
}
|
|
425
474
|
|
|
426
475
|
&:disabled {
|
|
427
|
-
background-color: ${
|
|
428
|
-
border-color: ${
|
|
429
|
-
color: ${
|
|
476
|
+
background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};
|
|
477
|
+
border-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};
|
|
478
|
+
color: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
430
479
|
}
|
|
431
480
|
|
|
432
481
|
&:active {
|
|
433
482
|
transform: translateY(0);
|
|
434
|
-
box-shadow:
|
|
483
|
+
box-shadow: ${getThemeValue(THEME_NAME.SHADOW)};
|
|
435
484
|
}
|
|
436
485
|
`;
|
|
437
486
|
|
|
438
487
|
var ActionButton = styled.button `
|
|
439
|
-
border: 1px solid
|
|
440
|
-
background-color:
|
|
441
|
-
color:
|
|
488
|
+
border: 1px solid ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
489
|
+
background-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
490
|
+
color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};
|
|
442
491
|
border-radius: 5px;
|
|
443
492
|
height: 32px;
|
|
444
493
|
min-width: 100px;
|
|
@@ -446,10 +495,11 @@ var ActionButton = styled.button `
|
|
|
446
495
|
text-align: center;
|
|
447
496
|
padding: 0 12px;
|
|
448
497
|
cursor: pointer;
|
|
449
|
-
text-overflow: ellipsis;
|
|
450
|
-
white-space: nowrap;
|
|
451
498
|
margin: 5px;
|
|
452
499
|
position: relative;
|
|
500
|
+
display: inline-flex;
|
|
501
|
+
align-items: center;
|
|
502
|
+
justify-content: center;
|
|
453
503
|
|
|
454
504
|
& svg {
|
|
455
505
|
vertical-align: middle;
|
|
@@ -460,34 +510,35 @@ var ActionButton = styled.button `
|
|
|
460
510
|
}
|
|
461
511
|
|
|
462
512
|
&:enabled:hover {
|
|
463
|
-
box-shadow:
|
|
513
|
+
box-shadow: ${getThemeValue(THEME_NAME.HOVER_SHADOW)};
|
|
464
514
|
}
|
|
465
515
|
|
|
466
516
|
&:focus {
|
|
467
|
-
box-shadow: 0 0 0 4px
|
|
517
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
468
518
|
}
|
|
469
519
|
|
|
470
520
|
&:disabled {
|
|
471
|
-
border: 1px solid ${
|
|
472
|
-
background-color:
|
|
473
|
-
color:
|
|
521
|
+
border: 1px solid ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};
|
|
522
|
+
background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};
|
|
523
|
+
color: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
474
524
|
}
|
|
475
525
|
`;
|
|
476
526
|
|
|
477
527
|
var IconButton = styled.button `
|
|
478
|
-
border: 1px solid
|
|
528
|
+
border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
|
|
479
529
|
border-radius: 5px;
|
|
480
530
|
height: 32px;
|
|
481
531
|
font-size: 14px;
|
|
482
532
|
text-align: center;
|
|
483
533
|
padding: 0 3px;
|
|
484
534
|
cursor: pointer;
|
|
485
|
-
color:
|
|
486
|
-
background-color:
|
|
487
|
-
text-overflow: ellipsis;
|
|
488
|
-
white-space: nowrap;
|
|
535
|
+
color: ${getThemeValue(THEME_NAME.TEXT_COLOR_DARK)};
|
|
536
|
+
background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
489
537
|
margin: 5px;
|
|
490
538
|
position: relative;
|
|
539
|
+
display: inline-flex;
|
|
540
|
+
align-items: center;
|
|
541
|
+
justify-content: center;
|
|
491
542
|
|
|
492
543
|
& svg {
|
|
493
544
|
vertical-align: middle;
|
|
@@ -497,23 +548,23 @@ var IconButton = styled.button `
|
|
|
497
548
|
}
|
|
498
549
|
|
|
499
550
|
&:enabled:hover {
|
|
500
|
-
border-color:
|
|
501
|
-
color:
|
|
551
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
552
|
+
color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
502
553
|
}
|
|
503
554
|
|
|
504
555
|
&:focus {
|
|
505
|
-
border-color:
|
|
506
|
-
box-shadow: 0 0 0 4px
|
|
556
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
557
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
507
558
|
}
|
|
508
559
|
|
|
509
560
|
&:disabled {
|
|
510
|
-
background-color: ${
|
|
511
|
-
border-color: ${
|
|
512
|
-
color: ${
|
|
561
|
+
background-color: ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};
|
|
562
|
+
border-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};
|
|
563
|
+
color: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
513
564
|
}
|
|
514
565
|
|
|
515
566
|
&:disabled > svg {
|
|
516
|
-
fill: ${
|
|
567
|
+
fill: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
517
568
|
}
|
|
518
569
|
`;
|
|
519
570
|
|
|
@@ -546,6 +597,16 @@ function __rest(s, e) {
|
|
|
546
597
|
return t;
|
|
547
598
|
}
|
|
548
599
|
|
|
600
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
601
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
602
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
603
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
604
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
605
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
606
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
|
|
549
610
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
550
611
|
var e = new Error(message);
|
|
551
612
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -555,24 +616,24 @@ const Container$8 = styled.span `
|
|
|
555
616
|
padding: 5px;
|
|
556
617
|
padding-left: 15px;
|
|
557
618
|
border-radius: 16px;
|
|
558
|
-
background-color:
|
|
619
|
+
background-color: ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};
|
|
559
620
|
display: inline-flex;
|
|
560
621
|
margin: 5px;
|
|
561
622
|
line-height: 20px;
|
|
562
623
|
align-items: center;
|
|
563
|
-
|
|
564
|
-
&:focus-within {
|
|
565
|
-
outline: 2px solid var(--primary-light, ${constants.PRIMARY_LIGHT});
|
|
566
|
-
}
|
|
567
624
|
`;
|
|
568
625
|
const Button$1 = styled.button `
|
|
569
|
-
color:
|
|
570
|
-
background-color:
|
|
626
|
+
color: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
627
|
+
background-color: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
571
628
|
border-radius: 50%;
|
|
572
629
|
border: none;
|
|
573
630
|
padding: 4px;
|
|
574
631
|
display: inline-flex;
|
|
575
632
|
margin-left: 5px;
|
|
633
|
+
|
|
634
|
+
&:focus-within {
|
|
635
|
+
outline: 4px solid ${getThemeValue(THEME_NAME.ERROR_LIGHT)};
|
|
636
|
+
}
|
|
576
637
|
`;
|
|
577
638
|
function Chip(props) {
|
|
578
639
|
const { label, onCloseClick, closeButtonAriaLabel } = props, rest = __rest(props, ["label", "onCloseClick", "closeButtonAriaLabel"]);
|
|
@@ -604,25 +665,25 @@ const Item = styled.div `
|
|
|
604
665
|
user-select: ${(props) => (props.showIndicator ? 'auto' : 'none')};
|
|
605
666
|
border-top: 2px dashed
|
|
606
667
|
${(props) => props.orientation === exports.ORIENTATION.VERTICAL && props.active > 0
|
|
607
|
-
?
|
|
668
|
+
? getThemeValue(THEME_NAME.PRIMARY)
|
|
608
669
|
: 'transparent'};
|
|
609
670
|
border-bottom: 2px dashed
|
|
610
671
|
${(props) => props.orientation === exports.ORIENTATION.VERTICAL && props.active < 0
|
|
611
|
-
?
|
|
672
|
+
? getThemeValue(THEME_NAME.PRIMARY)
|
|
612
673
|
: 'transparent'};
|
|
613
674
|
border-left: 2px dashed
|
|
614
675
|
${(props) => props.orientation === exports.ORIENTATION.HORIZONTAL && props.active > 0
|
|
615
|
-
?
|
|
676
|
+
? getThemeValue(THEME_NAME.PRIMARY)
|
|
616
677
|
: 'transparent'};
|
|
617
678
|
border-right: 2px dashed
|
|
618
679
|
${(props) => props.orientation === exports.ORIENTATION.HORIZONTAL && props.active < 0
|
|
619
|
-
?
|
|
680
|
+
? getThemeValue(THEME_NAME.PRIMARY)
|
|
620
681
|
: 'transparent'};
|
|
621
682
|
opacity: ${(props) => (props.dragging ? 0.5 : 1)};
|
|
622
683
|
border-radius: 10px;
|
|
623
684
|
|
|
624
685
|
&:focus {
|
|
625
|
-
box-shadow: 0 0 0 4px
|
|
686
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
626
687
|
}
|
|
627
688
|
|
|
628
689
|
&:focus:not(:focus-visible) {
|
|
@@ -630,7 +691,7 @@ const Item = styled.div `
|
|
|
630
691
|
}
|
|
631
692
|
|
|
632
693
|
&:focus-visible {
|
|
633
|
-
box-shadow: 0 0 0 4px
|
|
694
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
634
695
|
}
|
|
635
696
|
`;
|
|
636
697
|
/** Styled component for the drag handle indicator */
|
|
@@ -638,7 +699,7 @@ const DragKnob = styled.div `
|
|
|
638
699
|
padding-top: 8px;
|
|
639
700
|
cursor: move;
|
|
640
701
|
touch-action: none;
|
|
641
|
-
color:
|
|
702
|
+
color: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
642
703
|
`;
|
|
643
704
|
/** Container for the children */
|
|
644
705
|
const Container$7 = styled.div `
|
|
@@ -875,7 +936,7 @@ const Container$6 = styled.div `
|
|
|
875
936
|
flex-direction: ${(props) => (props.orientation === exports.ORIENTATION.HORIZONTAL ? 'row' : 'column')};
|
|
876
937
|
`;
|
|
877
938
|
/** Visually hidden but accessible to screen readers */
|
|
878
|
-
const VisuallyHidden$
|
|
939
|
+
const VisuallyHidden$2 = styled.div `
|
|
879
940
|
position: absolute;
|
|
880
941
|
width: 1px;
|
|
881
942
|
height: 1px;
|
|
@@ -985,7 +1046,7 @@ function DragAndDrop(props) {
|
|
|
985
1046
|
setIsDragging,
|
|
986
1047
|
setDragOver,
|
|
987
1048
|
i18n,
|
|
988
|
-
}, children: jsxRuntime.jsx(Container$6, { orientation: orientation, role: "list", children: React.Children.map(childrenArray, (child, index) => (jsxRuntime.jsx(DragItem, { index: index, orientation: orientation, showIndicator: showIndicator, dragOver: dragOver, totalItems: totalItems, setAnnouncement: setAnnouncement, children: child }))) }) }), jsxRuntime.jsx(VisuallyHidden$
|
|
1049
|
+
}, children: jsxRuntime.jsx(Container$6, { orientation: orientation, role: "list", children: React.Children.map(childrenArray, (child, index) => (jsxRuntime.jsx(DragItem, { index: index, orientation: orientation, showIndicator: showIndicator, dragOver: dragOver, totalItems: totalItems, setAnnouncement: setAnnouncement, children: child }))) }) }), jsxRuntime.jsx(VisuallyHidden$2, { role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement })] }));
|
|
989
1050
|
}
|
|
990
1051
|
DragAndDrop.defaultProps = {
|
|
991
1052
|
/** Orientation of the list layout */
|
|
@@ -1017,45 +1078,45 @@ const Label$6 = styled.label `
|
|
|
1017
1078
|
padding: 0 8px;
|
|
1018
1079
|
width: 250px;
|
|
1019
1080
|
border-radius: 3px;
|
|
1020
|
-
border: 1px solid
|
|
1021
|
-
background-color:
|
|
1081
|
+
border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
|
|
1082
|
+
background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
1022
1083
|
|
|
1023
1084
|
/** Focused */
|
|
1024
1085
|
&:has(:focus),
|
|
1025
1086
|
&:has(:active) {
|
|
1026
|
-
border-color:
|
|
1027
|
-
box-shadow: 0 0 0 4px
|
|
1087
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
1088
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
1028
1089
|
}
|
|
1029
1090
|
|
|
1030
1091
|
&:has(:focus) > span,
|
|
1031
1092
|
&:has(:active) > span {
|
|
1032
|
-
color:
|
|
1093
|
+
color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
1033
1094
|
}
|
|
1034
1095
|
|
|
1035
1096
|
/** Disabled */
|
|
1036
1097
|
&:has(:disabled) {
|
|
1037
|
-
border-color:
|
|
1038
|
-
background-color:
|
|
1098
|
+
border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
1099
|
+
background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};
|
|
1039
1100
|
}
|
|
1040
1101
|
|
|
1041
1102
|
&:has(:disabled) > span {
|
|
1042
|
-
color:
|
|
1103
|
+
color: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
1043
1104
|
}
|
|
1044
1105
|
|
|
1045
1106
|
/** Invalid */
|
|
1046
1107
|
&:has(:focus:invalid) {
|
|
1047
|
-
border-color:
|
|
1048
|
-
box-shadow: 0 0 0 4px
|
|
1108
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1109
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.ERROR_LIGHT)};
|
|
1049
1110
|
}
|
|
1050
1111
|
|
|
1051
1112
|
${(props) => props.touched
|
|
1052
1113
|
? `
|
|
1053
1114
|
&:has(:invalid) {
|
|
1054
|
-
border-color:
|
|
1115
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1055
1116
|
}
|
|
1056
1117
|
|
|
1057
1118
|
&:has(:invalid) > span {
|
|
1058
|
-
color:
|
|
1119
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1059
1120
|
}
|
|
1060
1121
|
`
|
|
1061
1122
|
: ''}
|
|
@@ -1063,10 +1124,10 @@ const Label$6 = styled.label `
|
|
|
1063
1124
|
/** Error */
|
|
1064
1125
|
${(props) => props.errorText
|
|
1065
1126
|
? `
|
|
1066
|
-
border-color:
|
|
1127
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1067
1128
|
|
|
1068
1129
|
& > span {
|
|
1069
|
-
color:
|
|
1130
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1070
1131
|
}
|
|
1071
1132
|
`
|
|
1072
1133
|
: ''}
|
|
@@ -1075,15 +1136,15 @@ const Label$6 = styled.label `
|
|
|
1075
1136
|
&:has(:required) > span:after {
|
|
1076
1137
|
content: '*';
|
|
1077
1138
|
margin-left: 2px;
|
|
1078
|
-
color:
|
|
1139
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1079
1140
|
}
|
|
1080
1141
|
|
|
1081
1142
|
& > input {
|
|
1082
1143
|
border: none;
|
|
1083
1144
|
outline: none;
|
|
1084
|
-
width: 100%;
|
|
1085
1145
|
line-height: 30px;
|
|
1086
1146
|
min-height: 30px;
|
|
1147
|
+
max-width: 95%;
|
|
1087
1148
|
}
|
|
1088
1149
|
|
|
1089
1150
|
/** Label Animation */
|
|
@@ -1100,7 +1161,7 @@ const Label$6 = styled.label `
|
|
|
1100
1161
|
&:has(:focus) > span,
|
|
1101
1162
|
&:has(:placeholder-shown) > span {
|
|
1102
1163
|
top: -8px;
|
|
1103
|
-
background:
|
|
1164
|
+
background: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
1104
1165
|
font-size: 12px;
|
|
1105
1166
|
line-height: 14px;
|
|
1106
1167
|
}
|
|
@@ -1109,7 +1170,7 @@ const Label$6 = styled.label `
|
|
|
1109
1170
|
? `
|
|
1110
1171
|
& > span {
|
|
1111
1172
|
top: -8px;
|
|
1112
|
-
background:
|
|
1173
|
+
background: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
1113
1174
|
font-size: 12px;
|
|
1114
1175
|
line-height: 14px;
|
|
1115
1176
|
}
|
|
@@ -1118,14 +1179,14 @@ const Label$6 = styled.label `
|
|
|
1118
1179
|
`;
|
|
1119
1180
|
// Error message container
|
|
1120
1181
|
const ErrorContainer$4 = styled.div `
|
|
1121
|
-
color:
|
|
1182
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1122
1183
|
padding-top: 3px;
|
|
1123
1184
|
font-size: 12px;
|
|
1124
1185
|
line-height: 14px;
|
|
1125
1186
|
margin-left: 3px;
|
|
1126
1187
|
`;
|
|
1127
1188
|
// Visually hidden but accessible to screen readers
|
|
1128
|
-
const VisuallyHidden = styled.ul `
|
|
1189
|
+
const VisuallyHidden$1 = styled.ul `
|
|
1129
1190
|
position: absolute;
|
|
1130
1191
|
width: 1px;
|
|
1131
1192
|
height: 1px;
|
|
@@ -1238,7 +1299,7 @@ function ChipInput(props) {
|
|
|
1238
1299
|
updateValue(newItems);
|
|
1239
1300
|
};
|
|
1240
1301
|
// Render the component
|
|
1241
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Label$6, { text: text, touched: touched, errorText: props.errorText, children: [jsxRuntime.jsx("input", Object.assign({}, props, { ref: InputRef, value: text, onChange: handleChange, onFocus: handleFocus, onKeyUp: handleKeyUp, required: props.required && value.length === 0, "aria-required": props.required, "aria-invalid": !!props.errorText, "aria-describedby": props.errorText ? errorId : undefined })), 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), closeButtonAriaLabel: replacePlaceholder(props.closeButtonAriaLabel, chip) }, chip))) })) }), jsxRuntime.jsx("span", { children: props.label }), props.errorText && jsxRuntime.jsx(ErrorContainer$4, { id: errorId, children: props.errorText })] }), jsxRuntime.jsx(VisuallyHidden, { "aria-live": "polite", "aria-atomic": "true", children: announcement })] }));
|
|
1302
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Label$6, { text: text, touched: touched, errorText: props.errorText, children: [jsxRuntime.jsx("input", Object.assign({}, props, { ref: InputRef, value: text, onChange: handleChange, onFocus: handleFocus, onKeyUp: handleKeyUp, required: props.required && value.length === 0, "aria-required": props.required, "aria-invalid": !!props.errorText, "aria-describedby": props.errorText ? errorId : undefined })), 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), closeButtonAriaLabel: replacePlaceholder(props.closeButtonAriaLabel, chip) }, chip))) })) }), jsxRuntime.jsx("span", { children: props.label }), props.errorText && jsxRuntime.jsx(ErrorContainer$4, { id: errorId, children: props.errorText })] }), jsxRuntime.jsx(VisuallyHidden$1, { "aria-live": "polite", "aria-atomic": "true", children: announcement })] }));
|
|
1242
1303
|
}
|
|
1243
1304
|
ChipInput.propTypes = {
|
|
1244
1305
|
/** Label for the field */
|
|
@@ -1305,7 +1366,7 @@ const Container$5 = styled.div `
|
|
|
1305
1366
|
`
|
|
1306
1367
|
width: 100%;
|
|
1307
1368
|
height: 100vh;
|
|
1308
|
-
background-color:
|
|
1369
|
+
background-color: ${getThemeValue(THEME_NAME.BACKDROP_COLOR)};
|
|
1309
1370
|
backdrop-filter: blur(0px);
|
|
1310
1371
|
pointer-events: all;
|
|
1311
1372
|
`}
|
|
@@ -1405,6 +1466,7 @@ class LayerManager {
|
|
|
1405
1466
|
const layerConfig = Object.assign(Object.assign({}, defaultConfig), config);
|
|
1406
1467
|
// Get the z-index for the new layer
|
|
1407
1468
|
const currentIndex = layerConfig.alwaysOnTop ? 2147483647 : this.nextIndex++;
|
|
1469
|
+
const className = layerConfig.alwaysOnTop ? 'nf-layer-manager-top' : 'nf-layer-manager';
|
|
1408
1470
|
// Create a unique ID for tracking this layer
|
|
1409
1471
|
const layerId = `nf-layer-manager-${currentIndex}`;
|
|
1410
1472
|
const overlayClickHandler = () => {
|
|
@@ -1426,6 +1488,7 @@ class LayerManager {
|
|
|
1426
1488
|
React.useEffect(() => {
|
|
1427
1489
|
// Create the div element only once when component mounts
|
|
1428
1490
|
const div = document.createElement('div');
|
|
1491
|
+
div.setAttribute('class', className);
|
|
1429
1492
|
div.setAttribute('id', layerId);
|
|
1430
1493
|
document.body.appendChild(div);
|
|
1431
1494
|
// Add layer to stack
|
|
@@ -1440,8 +1503,67 @@ class LayerManager {
|
|
|
1440
1503
|
setTimeout(() => {
|
|
1441
1504
|
div.setAttribute('class', 'nf-layer-enter');
|
|
1442
1505
|
}, 10);
|
|
1506
|
+
// Track elements modified for accessibility
|
|
1507
|
+
const modifiedElements = [];
|
|
1508
|
+
let originalBodyOverflow = null;
|
|
1509
|
+
let originalBodyPosition = null;
|
|
1510
|
+
let originalBodyWidth = null;
|
|
1511
|
+
let originalBodyTop = null;
|
|
1512
|
+
let scrollY = 0;
|
|
1513
|
+
// Apply aria-hidden to siblings and body scroll lock for overlay modals
|
|
1514
|
+
if (layerConfig.overlay) {
|
|
1515
|
+
// Hide all body children except this layer portal, scripts, and styles
|
|
1516
|
+
const bodyChildren = Array.from(document.body.children);
|
|
1517
|
+
bodyChildren.forEach((child) => {
|
|
1518
|
+
if (child !== div &&
|
|
1519
|
+
child.className !== 'nf-layer-manager-top' &&
|
|
1520
|
+
child.tagName !== 'SCRIPT' &&
|
|
1521
|
+
child.tagName !== 'STYLE') {
|
|
1522
|
+
const hadAriaHidden = child.hasAttribute('aria-hidden');
|
|
1523
|
+
const previousValue = child.getAttribute('aria-hidden');
|
|
1524
|
+
// Only set aria-hidden if not already hidden
|
|
1525
|
+
if (previousValue !== 'true') {
|
|
1526
|
+
child.setAttribute('aria-hidden', 'true');
|
|
1527
|
+
modifiedElements.push({
|
|
1528
|
+
element: child,
|
|
1529
|
+
hadAriaHidden,
|
|
1530
|
+
previousValue,
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
});
|
|
1535
|
+
// Prevent body scroll on iOS
|
|
1536
|
+
scrollY = window.scrollY;
|
|
1537
|
+
originalBodyOverflow = document.body.style.overflow;
|
|
1538
|
+
originalBodyPosition = document.body.style.position;
|
|
1539
|
+
originalBodyWidth = document.body.style.width;
|
|
1540
|
+
originalBodyTop = document.body.style.top;
|
|
1541
|
+
document.body.style.overflow = 'hidden';
|
|
1542
|
+
document.body.style.position = 'fixed';
|
|
1543
|
+
document.body.style.width = '100%';
|
|
1544
|
+
document.body.style.top = `-${scrollY}px`;
|
|
1545
|
+
}
|
|
1443
1546
|
// Cleanup function - remove div when component unmounts
|
|
1444
1547
|
return () => {
|
|
1548
|
+
// Restore aria-hidden attributes
|
|
1549
|
+
modifiedElements.forEach(({ element, hadAriaHidden, previousValue }) => {
|
|
1550
|
+
if (document.body.contains(element)) {
|
|
1551
|
+
if (hadAriaHidden && previousValue !== null) {
|
|
1552
|
+
element.setAttribute('aria-hidden', previousValue);
|
|
1553
|
+
}
|
|
1554
|
+
else {
|
|
1555
|
+
element.removeAttribute('aria-hidden');
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
// Restore body scroll
|
|
1560
|
+
if (layerConfig.overlay) {
|
|
1561
|
+
document.body.style.overflow = originalBodyOverflow || '';
|
|
1562
|
+
document.body.style.position = originalBodyPosition || '';
|
|
1563
|
+
document.body.style.width = originalBodyWidth || '';
|
|
1564
|
+
document.body.style.top = originalBodyTop || '';
|
|
1565
|
+
window.scrollTo(0, scrollY);
|
|
1566
|
+
}
|
|
1445
1567
|
if (document.body.contains(div)) {
|
|
1446
1568
|
document.body.removeChild(div);
|
|
1447
1569
|
}
|
|
@@ -1495,12 +1617,94 @@ const DialogContainer = styled(Card) `
|
|
|
1495
1617
|
class Dialog extends React.Component {
|
|
1496
1618
|
constructor() {
|
|
1497
1619
|
super(...arguments);
|
|
1620
|
+
this.lastFocusedElement = null;
|
|
1621
|
+
this.dialogRef = React.createRef();
|
|
1498
1622
|
this.state = {
|
|
1499
1623
|
show: false,
|
|
1500
1624
|
LayerComponent: undefined,
|
|
1501
1625
|
};
|
|
1626
|
+
/**
|
|
1627
|
+
* Retrieves all focusable elements within the dialog.
|
|
1628
|
+
*/
|
|
1629
|
+
this.getFocusableElements = () => {
|
|
1630
|
+
if (!this.dialogRef.current)
|
|
1631
|
+
return [];
|
|
1632
|
+
return Array.from(this.dialogRef.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));
|
|
1633
|
+
};
|
|
1634
|
+
/**
|
|
1635
|
+
* Handles keydown events to implement the focus trap.
|
|
1636
|
+
* Traps Tab and Shift+Tab within the dialog.
|
|
1637
|
+
*/
|
|
1638
|
+
this.handleKeyDown = (e) => {
|
|
1639
|
+
if (e.key === 'Tab') {
|
|
1640
|
+
const focusableElements = this.getFocusableElements();
|
|
1641
|
+
if (focusableElements.length === 0)
|
|
1642
|
+
return;
|
|
1643
|
+
const firstElement = focusableElements[0];
|
|
1644
|
+
const lastElement = focusableElements[focusableElements.length - 1];
|
|
1645
|
+
if (e.shiftKey) {
|
|
1646
|
+
if (document.activeElement === firstElement) {
|
|
1647
|
+
lastElement.focus();
|
|
1648
|
+
e.preventDefault();
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
else {
|
|
1652
|
+
if (document.activeElement === lastElement) {
|
|
1653
|
+
firstElement.focus();
|
|
1654
|
+
e.preventDefault();
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
};
|
|
1659
|
+
/**
|
|
1660
|
+
* Restores focus to the element that was focused before the dialog opened.
|
|
1661
|
+
*/
|
|
1662
|
+
this.restoreFocus = () => {
|
|
1663
|
+
if (this.lastFocusedElement) {
|
|
1664
|
+
const elementToBeFocused = this.lastFocusedElement;
|
|
1665
|
+
this.lastFocusedElement = null;
|
|
1666
|
+
setTimeout(() => {
|
|
1667
|
+
if (document.body.contains(elementToBeFocused)) {
|
|
1668
|
+
elementToBeFocused.focus();
|
|
1669
|
+
}
|
|
1670
|
+
}, 100);
|
|
1671
|
+
}
|
|
1672
|
+
};
|
|
1673
|
+
/**
|
|
1674
|
+
* Callback ref to capture the Dialog DOM element.
|
|
1675
|
+
* Triggers initial focus setting when the element mounts.
|
|
1676
|
+
*/
|
|
1677
|
+
this.setDialogRef = (node) => {
|
|
1678
|
+
this.dialogRef.current = node;
|
|
1679
|
+
if (node) {
|
|
1680
|
+
this.setInitialFocus(node);
|
|
1681
|
+
}
|
|
1682
|
+
};
|
|
1683
|
+
/**
|
|
1684
|
+
* Sets initial focus within the dialog.
|
|
1685
|
+
* Tries to focus the header first, then the first interactive element, or falls back to the container.
|
|
1686
|
+
*/
|
|
1687
|
+
this.setInitialFocus = (root) => {
|
|
1688
|
+
const firstChild = root.firstElementChild;
|
|
1689
|
+
if (firstChild) {
|
|
1690
|
+
if (firstChild.getAttribute('tabindex') === null) {
|
|
1691
|
+
firstChild.setAttribute('tabindex', '-1');
|
|
1692
|
+
}
|
|
1693
|
+
firstChild.focus();
|
|
1694
|
+
return;
|
|
1695
|
+
}
|
|
1696
|
+
const focusableElements = this.getFocusableElements();
|
|
1697
|
+
if (focusableElements.length > 0) {
|
|
1698
|
+
focusableElements[0].focus();
|
|
1699
|
+
}
|
|
1700
|
+
else {
|
|
1701
|
+
root.focus();
|
|
1702
|
+
}
|
|
1703
|
+
};
|
|
1502
1704
|
this.open = (closeCallback) => {
|
|
1503
1705
|
const _a = this.props, { closeOnEsc, closeOnOverlayClick, children } = _a, rest = __rest(_a, ["closeOnEsc", "closeOnOverlayClick", "children"]);
|
|
1706
|
+
// Save current focus
|
|
1707
|
+
this.lastFocusedElement = document.activeElement;
|
|
1504
1708
|
const [Component, closeFn] = LayerManager$1.renderLayer({
|
|
1505
1709
|
exitDelay: 300,
|
|
1506
1710
|
overlay: true,
|
|
@@ -1508,7 +1712,7 @@ class Dialog extends React.Component {
|
|
|
1508
1712
|
closeCallback: this.closeCallback,
|
|
1509
1713
|
closeOnOverlayClick,
|
|
1510
1714
|
position: LAYER_POSITION.DIALOG,
|
|
1511
|
-
component: (jsxRuntime.jsx(DialogContainer, Object.assign({}, rest, { onClick: (e) => e.stopPropagation(), elevated: true, children: children }))),
|
|
1715
|
+
component: (jsxRuntime.jsx(DialogContainer, Object.assign({}, rest, { ref: this.setDialogRef, role: "dialog", "aria-modal": "true", tabIndex: -1, onKeyDown: this.handleKeyDown, onClick: (e) => e.stopPropagation(), elevated: true, children: children }))),
|
|
1512
1716
|
});
|
|
1513
1717
|
this.closeDialog = closeFn;
|
|
1514
1718
|
this.setState({
|
|
@@ -1523,6 +1727,7 @@ class Dialog extends React.Component {
|
|
|
1523
1727
|
};
|
|
1524
1728
|
this.closeCallback = (resp) => {
|
|
1525
1729
|
var _a;
|
|
1730
|
+
this.restoreFocus();
|
|
1526
1731
|
this.setState({
|
|
1527
1732
|
show: false,
|
|
1528
1733
|
LayerComponent: undefined,
|
|
@@ -1554,6 +1759,7 @@ Dialog.defaultProps = {
|
|
|
1554
1759
|
closeOnOverlayClick: true,
|
|
1555
1760
|
};
|
|
1556
1761
|
|
|
1762
|
+
let dialogCounter = 0;
|
|
1557
1763
|
class AlertDialog extends React.Component {
|
|
1558
1764
|
constructor() {
|
|
1559
1765
|
super(...arguments);
|
|
@@ -1567,7 +1773,9 @@ class AlertDialog extends React.Component {
|
|
|
1567
1773
|
this.close = () => this.dialog.current.close();
|
|
1568
1774
|
}
|
|
1569
1775
|
render() {
|
|
1570
|
-
|
|
1776
|
+
const titleId = `nfui-alert-dialog-${dialogCounter++}-title`;
|
|
1777
|
+
const descriptionId = `nfui-alert-dialog-${dialogCounter++}-description`;
|
|
1778
|
+
return (jsxRuntime.jsxs(Dialog, Object.assign({}, this.props.dialogProps, { role: "alertdialog", "aria-labelledby": titleId, "aria-describedby": descriptionId, ref: this.dialog, closeOnEsc: false, closeOnOverlayClick: false, children: [this.props.header && jsxRuntime.jsx(Header$1, { id: titleId, children: this.props.header }), jsxRuntime.jsx(Body$1, { id: descriptionId, children: this.props.body }), jsxRuntime.jsx(Footer$1, { children: jsxRuntime.jsx(StyledButton, { onClick: this.close, children: this.props.buttonText }) })] })));
|
|
1571
1779
|
}
|
|
1572
1780
|
}
|
|
1573
1781
|
AlertDialog.propTypes = {
|
|
@@ -1640,46 +1848,46 @@ const TextField$1 = styled.input `
|
|
|
1640
1848
|
min-height: 30px;
|
|
1641
1849
|
width: 250px;
|
|
1642
1850
|
border-radius: 3px;
|
|
1643
|
-
border: 1px solid
|
|
1851
|
+
border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
|
|
1644
1852
|
display: inline-block;
|
|
1645
|
-
background-color:
|
|
1853
|
+
background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
1646
1854
|
|
|
1647
1855
|
/** Focused */
|
|
1648
1856
|
&:focus,
|
|
1649
1857
|
&:active {
|
|
1650
|
-
border-color:
|
|
1651
|
-
box-shadow: 0 0 0 4px
|
|
1858
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
1859
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
1652
1860
|
}
|
|
1653
1861
|
|
|
1654
1862
|
&:focus + span,
|
|
1655
1863
|
&:active + span {
|
|
1656
|
-
color:
|
|
1864
|
+
color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
1657
1865
|
}
|
|
1658
1866
|
|
|
1659
1867
|
/** Disabled */
|
|
1660
1868
|
&:disabled {
|
|
1661
|
-
border-color:
|
|
1662
|
-
background-color:
|
|
1869
|
+
border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
1870
|
+
background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};
|
|
1663
1871
|
}
|
|
1664
1872
|
|
|
1665
1873
|
&:disabled + span {
|
|
1666
|
-
color:
|
|
1874
|
+
color: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
1667
1875
|
}
|
|
1668
1876
|
|
|
1669
1877
|
/** Invalid */
|
|
1670
1878
|
&:focus:invalid {
|
|
1671
|
-
border-color:
|
|
1672
|
-
box-shadow: 0 0 0 4px
|
|
1879
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1880
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.ERROR_LIGHT)};
|
|
1673
1881
|
}
|
|
1674
1882
|
|
|
1675
1883
|
${(props) => props.touched
|
|
1676
1884
|
? `
|
|
1677
1885
|
&:invalid {
|
|
1678
|
-
border-color:
|
|
1886
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1679
1887
|
}
|
|
1680
1888
|
|
|
1681
1889
|
&:invalid + span {
|
|
1682
|
-
color:
|
|
1890
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1683
1891
|
}
|
|
1684
1892
|
`
|
|
1685
1893
|
: ''}
|
|
@@ -1687,10 +1895,10 @@ const TextField$1 = styled.input `
|
|
|
1687
1895
|
/** Error */
|
|
1688
1896
|
${(props) => props.errorText
|
|
1689
1897
|
? `
|
|
1690
|
-
border-color:
|
|
1898
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1691
1899
|
|
|
1692
1900
|
& + span {
|
|
1693
|
-
color:
|
|
1901
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1694
1902
|
}
|
|
1695
1903
|
`
|
|
1696
1904
|
: ''}
|
|
@@ -1699,7 +1907,7 @@ const TextField$1 = styled.input `
|
|
|
1699
1907
|
&:required + span:after {
|
|
1700
1908
|
content: '*';
|
|
1701
1909
|
margin-left: 2px;
|
|
1702
|
-
color:
|
|
1910
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1703
1911
|
}
|
|
1704
1912
|
|
|
1705
1913
|
/** Label Animation */
|
|
@@ -1717,7 +1925,7 @@ const TextField$1 = styled.input `
|
|
|
1717
1925
|
? `
|
|
1718
1926
|
& + span {
|
|
1719
1927
|
top: -8px;
|
|
1720
|
-
background:
|
|
1928
|
+
background: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
1721
1929
|
font-size: 12px;
|
|
1722
1930
|
line-height: 14px;
|
|
1723
1931
|
}
|
|
@@ -1726,21 +1934,27 @@ const TextField$1 = styled.input `
|
|
|
1726
1934
|
|
|
1727
1935
|
&:focus + span, &:placeholder-shown + span {
|
|
1728
1936
|
top: -8px;
|
|
1729
|
-
background:
|
|
1937
|
+
background: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
1730
1938
|
font-size: 12px;
|
|
1731
1939
|
line-height: 14px;
|
|
1732
1940
|
}
|
|
1733
1941
|
`;
|
|
1734
1942
|
const ErrorContainer$3 = styled.div `
|
|
1735
|
-
color:
|
|
1943
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1736
1944
|
padding-top: 3px;
|
|
1737
1945
|
font-size: 12px;
|
|
1738
1946
|
line-height: 14px;
|
|
1739
1947
|
margin-left: 3px;
|
|
1740
1948
|
`;
|
|
1741
|
-
const Input$
|
|
1949
|
+
const Input$2 = React.forwardRef((props, ref) => {
|
|
1742
1950
|
const [touched, setTouched] = React.useState(false);
|
|
1743
1951
|
const [value, setValue] = React.useState(props.value || '');
|
|
1952
|
+
const errorId = React.useId();
|
|
1953
|
+
React.useEffect(() => {
|
|
1954
|
+
if (props.value !== undefined) {
|
|
1955
|
+
setValue(props.value);
|
|
1956
|
+
}
|
|
1957
|
+
}, [props.value]);
|
|
1744
1958
|
const handleFocus = (e) => {
|
|
1745
1959
|
setTouched(true);
|
|
1746
1960
|
if (props.onFocus) {
|
|
@@ -1756,10 +1970,10 @@ const Input$4 = React.forwardRef((props, ref) => {
|
|
|
1756
1970
|
setValue(e.target.value);
|
|
1757
1971
|
}
|
|
1758
1972
|
};
|
|
1759
|
-
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 })] }));
|
|
1973
|
+
return (jsxRuntime.jsxs(Label$5, { children: [jsxRuntime.jsx(TextField$1, Object.assign({}, props, { ref: ref, value: value, onChange: onChangeHandler, onFocus: handleFocus, touched: touched, "aria-invalid": !!props.errorText, "aria-required": props.required, "aria-describedby": props.errorText ? errorId : undefined })), jsxRuntime.jsx("span", { children: props.label }), props.errorText && jsxRuntime.jsx(ErrorContainer$3, { id: errorId, children: props.errorText })] }));
|
|
1760
1974
|
});
|
|
1761
|
-
Input$
|
|
1762
|
-
Input$
|
|
1975
|
+
Input$2.displayName = 'Input';
|
|
1976
|
+
Input$2.propTypes = {
|
|
1763
1977
|
/** Label for the field */
|
|
1764
1978
|
label: PropTypes.string,
|
|
1765
1979
|
/** Error text to be shown below the field */
|
|
@@ -1779,46 +1993,46 @@ const TextField = styled.textarea `
|
|
|
1779
1993
|
min-height: 150px;
|
|
1780
1994
|
min-width: 250px;
|
|
1781
1995
|
border-radius: 3px;
|
|
1782
|
-
border: 1px solid
|
|
1996
|
+
border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
|
|
1783
1997
|
display: inline-block;
|
|
1784
|
-
background-color:
|
|
1998
|
+
background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
1785
1999
|
|
|
1786
2000
|
/** Focused */
|
|
1787
2001
|
&:focus,
|
|
1788
2002
|
&:active {
|
|
1789
|
-
border-color:
|
|
1790
|
-
box-shadow: 0 0 0 4px
|
|
2003
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2004
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
1791
2005
|
}
|
|
1792
2006
|
|
|
1793
2007
|
&:focus + span,
|
|
1794
2008
|
&:active + span {
|
|
1795
|
-
color:
|
|
2009
|
+
color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
1796
2010
|
}
|
|
1797
2011
|
|
|
1798
2012
|
/** Disabled */
|
|
1799
2013
|
&:disabled {
|
|
1800
|
-
border-color:
|
|
1801
|
-
background-color:
|
|
2014
|
+
border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
2015
|
+
background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};
|
|
1802
2016
|
}
|
|
1803
2017
|
|
|
1804
2018
|
&:disabled + span {
|
|
1805
|
-
color:
|
|
2019
|
+
color: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
1806
2020
|
}
|
|
1807
2021
|
|
|
1808
2022
|
/** Invalid */
|
|
1809
2023
|
&:focus:invalid {
|
|
1810
|
-
border-color:
|
|
1811
|
-
box-shadow: 0 0 0 4px
|
|
2024
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
2025
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.ERROR_LIGHT)};
|
|
1812
2026
|
}
|
|
1813
2027
|
|
|
1814
2028
|
${(props) => props.touched
|
|
1815
2029
|
? `
|
|
1816
2030
|
&:invalid {
|
|
1817
|
-
border-color:
|
|
2031
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1818
2032
|
}
|
|
1819
2033
|
|
|
1820
2034
|
&:invalid + span {
|
|
1821
|
-
color:
|
|
2035
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1822
2036
|
}
|
|
1823
2037
|
`
|
|
1824
2038
|
: ''}
|
|
@@ -1826,10 +2040,10 @@ const TextField = styled.textarea `
|
|
|
1826
2040
|
/** Error */
|
|
1827
2041
|
${(props) => props.errorText
|
|
1828
2042
|
? `
|
|
1829
|
-
border-color:
|
|
2043
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1830
2044
|
|
|
1831
2045
|
& + span {
|
|
1832
|
-
color:
|
|
2046
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1833
2047
|
}
|
|
1834
2048
|
`
|
|
1835
2049
|
: ''}
|
|
@@ -1838,7 +2052,7 @@ const TextField = styled.textarea `
|
|
|
1838
2052
|
&:required + span:after {
|
|
1839
2053
|
content: '*';
|
|
1840
2054
|
margin-left: 2px;
|
|
1841
|
-
color:
|
|
2055
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1842
2056
|
}
|
|
1843
2057
|
|
|
1844
2058
|
/** Label Animation */
|
|
@@ -1856,7 +2070,7 @@ const TextField = styled.textarea `
|
|
|
1856
2070
|
? `
|
|
1857
2071
|
& + span {
|
|
1858
2072
|
top: -8px;
|
|
1859
|
-
background:
|
|
2073
|
+
background: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
1860
2074
|
font-size: 12px;
|
|
1861
2075
|
line-height: 14px;
|
|
1862
2076
|
}
|
|
@@ -1865,13 +2079,13 @@ const TextField = styled.textarea `
|
|
|
1865
2079
|
|
|
1866
2080
|
&:focus + span, &:placeholder-shown + span {
|
|
1867
2081
|
top: -8px;
|
|
1868
|
-
background:
|
|
2082
|
+
background: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
1869
2083
|
font-size: 12px;
|
|
1870
2084
|
line-height: 14px;
|
|
1871
2085
|
}
|
|
1872
2086
|
`;
|
|
1873
2087
|
const ErrorContainer$2 = styled.div `
|
|
1874
|
-
color:
|
|
2088
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1875
2089
|
padding-top: 3px;
|
|
1876
2090
|
font-size: 12px;
|
|
1877
2091
|
line-height: 14px;
|
|
@@ -1880,6 +2094,12 @@ const ErrorContainer$2 = styled.div `
|
|
|
1880
2094
|
function TextArea(props) {
|
|
1881
2095
|
const [touched, setTouched] = React.useState(false);
|
|
1882
2096
|
const [value, setValue] = React.useState(props.value || '');
|
|
2097
|
+
const errorId = React.useId();
|
|
2098
|
+
React.useEffect(() => {
|
|
2099
|
+
if (props.value !== undefined) {
|
|
2100
|
+
setValue(props.value);
|
|
2101
|
+
}
|
|
2102
|
+
}, [props.value]);
|
|
1883
2103
|
const handleFocus = (e) => {
|
|
1884
2104
|
setTouched(true);
|
|
1885
2105
|
if (props.onFocus) {
|
|
@@ -1895,7 +2115,7 @@ function TextArea(props) {
|
|
|
1895
2115
|
setValue(e.target.value);
|
|
1896
2116
|
}
|
|
1897
2117
|
};
|
|
1898
|
-
return (jsxRuntime.jsxs(Label$4, { children: [jsxRuntime.jsx(TextField, Object.assign({}, props, { value: value, onChange: onChangeHandler, onFocus: handleFocus, touched: touched })), jsxRuntime.jsx("span", { children: props.label }), props.errorText && jsxRuntime.jsx(ErrorContainer$2, { children: props.errorText })] }));
|
|
2118
|
+
return (jsxRuntime.jsxs(Label$4, { children: [jsxRuntime.jsx(TextField, Object.assign({}, props, { value: value, onChange: onChangeHandler, onFocus: handleFocus, touched: touched, "aria-invalid": !!props.errorText, "aria-required": props.required, "aria-describedby": props.errorText ? errorId : undefined })), jsxRuntime.jsx("span", { children: props.label }), props.errorText && jsxRuntime.jsx(ErrorContainer$2, { id: errorId, children: props.errorText })] }));
|
|
1899
2119
|
}
|
|
1900
2120
|
TextArea.propTypes = {
|
|
1901
2121
|
/** Label for the field */
|
|
@@ -1924,48 +2144,48 @@ const SelectField = styled.select `
|
|
|
1924
2144
|
min-height: 32px;
|
|
1925
2145
|
width: 268px;
|
|
1926
2146
|
border-radius: 3px;
|
|
1927
|
-
border: 1px solid
|
|
2147
|
+
border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
|
|
1928
2148
|
display: inline-block;
|
|
1929
|
-
background-color:
|
|
2149
|
+
background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
1930
2150
|
pointer-events: auto;
|
|
1931
2151
|
appearance: none;
|
|
1932
2152
|
|
|
1933
2153
|
/** Focused */
|
|
1934
2154
|
&:focus,
|
|
1935
2155
|
&:active {
|
|
1936
|
-
border-color:
|
|
1937
|
-
box-shadow: 0 0 0 4px
|
|
2156
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2157
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
1938
2158
|
}
|
|
1939
2159
|
|
|
1940
2160
|
&:focus ~ span,
|
|
1941
2161
|
&:active ~ span {
|
|
1942
|
-
color:
|
|
2162
|
+
color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
1943
2163
|
}
|
|
1944
2164
|
|
|
1945
2165
|
/** Disabled */
|
|
1946
2166
|
&:disabled {
|
|
1947
|
-
border-color:
|
|
1948
|
-
background-color:
|
|
2167
|
+
border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
2168
|
+
background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};
|
|
1949
2169
|
}
|
|
1950
2170
|
|
|
1951
2171
|
&:disabled ~ span {
|
|
1952
|
-
color:
|
|
2172
|
+
color: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
1953
2173
|
}
|
|
1954
2174
|
|
|
1955
2175
|
/** Invalid */
|
|
1956
2176
|
&:focus:invalid {
|
|
1957
|
-
border-color:
|
|
1958
|
-
box-shadow: 0 0 0 4px
|
|
2177
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
2178
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.ERROR_LIGHT)};
|
|
1959
2179
|
}
|
|
1960
2180
|
|
|
1961
2181
|
${(props) => props.touched
|
|
1962
2182
|
? `
|
|
1963
2183
|
&:invalid {
|
|
1964
|
-
border-color:
|
|
2184
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1965
2185
|
}
|
|
1966
2186
|
|
|
1967
2187
|
&:invalid ~ span {
|
|
1968
|
-
color:
|
|
2188
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1969
2189
|
}
|
|
1970
2190
|
`
|
|
1971
2191
|
: ''}
|
|
@@ -1973,10 +2193,10 @@ const SelectField = styled.select `
|
|
|
1973
2193
|
/** Error */
|
|
1974
2194
|
${(props) => props.errorText
|
|
1975
2195
|
? `
|
|
1976
|
-
border-color:
|
|
2196
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1977
2197
|
|
|
1978
2198
|
& ~ span {
|
|
1979
|
-
color:
|
|
2199
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1980
2200
|
}
|
|
1981
2201
|
`
|
|
1982
2202
|
: ''}
|
|
@@ -1985,7 +2205,7 @@ const SelectField = styled.select `
|
|
|
1985
2205
|
&:required + span:after {
|
|
1986
2206
|
content: '*';
|
|
1987
2207
|
margin-left: 2px;
|
|
1988
|
-
color:
|
|
2208
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
1989
2209
|
}
|
|
1990
2210
|
|
|
1991
2211
|
/** Label Animation */
|
|
@@ -2003,7 +2223,7 @@ const SelectField = styled.select `
|
|
|
2003
2223
|
? `
|
|
2004
2224
|
& + span {
|
|
2005
2225
|
top: -8px;
|
|
2006
|
-
background:
|
|
2226
|
+
background: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
2007
2227
|
font-size: 12px;
|
|
2008
2228
|
line-height: 14px;
|
|
2009
2229
|
}
|
|
@@ -2012,13 +2232,13 @@ const SelectField = styled.select `
|
|
|
2012
2232
|
|
|
2013
2233
|
&:focus + span, &:placeholder-shown + span {
|
|
2014
2234
|
top: -8px;
|
|
2015
|
-
background:
|
|
2235
|
+
background: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
2016
2236
|
font-size: 12px;
|
|
2017
2237
|
line-height: 14px;
|
|
2018
2238
|
}
|
|
2019
2239
|
`;
|
|
2020
2240
|
const ErrorContainer$1 = styled.div `
|
|
2021
|
-
color:
|
|
2241
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
2022
2242
|
padding-top: 3px;
|
|
2023
2243
|
font-size: 12px;
|
|
2024
2244
|
line-height: 14px;
|
|
@@ -2032,6 +2252,12 @@ const ArrowContainer$1 = styled.span `
|
|
|
2032
2252
|
function Select(props) {
|
|
2033
2253
|
const [touched, setTouched] = React.useState(false);
|
|
2034
2254
|
const [value, setValue] = React.useState(props.value || '');
|
|
2255
|
+
const errorId = React.useId();
|
|
2256
|
+
React.useEffect(() => {
|
|
2257
|
+
if (props.value !== undefined) {
|
|
2258
|
+
setValue(props.value);
|
|
2259
|
+
}
|
|
2260
|
+
}, [props.value]);
|
|
2035
2261
|
const handleFocus = (e) => {
|
|
2036
2262
|
setTouched(true);
|
|
2037
2263
|
if (props.onFocus) {
|
|
@@ -2047,7 +2273,7 @@ function Select(props) {
|
|
|
2047
2273
|
setValue(e.target.value);
|
|
2048
2274
|
}
|
|
2049
2275
|
};
|
|
2050
|
-
return (jsxRuntime.jsxs(Label$3, { children: [jsxRuntime.jsxs(SelectField, Object.assign({}, props, { multiple: false, value: value, onChange: onChangeHandler, onFocus: handleFocus, touched: touched, children: [jsxRuntime.jsx("option", {}), props.children] })), jsxRuntime.jsx("span", { children: props.label }), jsxRuntime.jsx(ArrowContainer$1, { children: jsxRuntime.jsx(ExpandMore, {}) }), props.errorText && jsxRuntime.jsx(ErrorContainer$1, { children: props.errorText })] }));
|
|
2276
|
+
return (jsxRuntime.jsxs(Label$3, { children: [jsxRuntime.jsxs(SelectField, Object.assign({}, props, { multiple: false, value: value, onChange: onChangeHandler, onFocus: handleFocus, touched: touched, "aria-invalid": !!props.errorText, "aria-required": props.required, "aria-describedby": props.errorText ? errorId : undefined, children: [jsxRuntime.jsx("option", {}), props.children] })), jsxRuntime.jsx("span", { children: props.label }), jsxRuntime.jsx(ArrowContainer$1, { "aria-hidden": "true", children: jsxRuntime.jsx(ExpandMore, {}) }), props.errorText && jsxRuntime.jsx(ErrorContainer$1, { id: errorId, children: props.errorText })] }));
|
|
2051
2277
|
}
|
|
2052
2278
|
Select.propTypes = {
|
|
2053
2279
|
/** Label for the field */
|
|
@@ -2059,99 +2285,104 @@ Select.propTypes = {
|
|
|
2059
2285
|
const Label$2 = styled.label `
|
|
2060
2286
|
margin: 5px 0;
|
|
2061
2287
|
position: relative;
|
|
2288
|
+
display: inline-flex;
|
|
2289
|
+
align-items: center;
|
|
2290
|
+
cursor: pointer;
|
|
2062
2291
|
`;
|
|
2063
|
-
const
|
|
2064
|
-
|
|
2292
|
+
const StyledCheckmark = styled.span `
|
|
2293
|
+
width: 16px;
|
|
2294
|
+
height: 16px;
|
|
2295
|
+
border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
|
|
2296
|
+
display: inline-block;
|
|
2297
|
+
border-radius: 3px;
|
|
2298
|
+
margin-right: 5px;
|
|
2299
|
+
background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
2300
|
+
transition: all 0.3s ease;
|
|
2065
2301
|
position: relative;
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
&::before {
|
|
2069
|
-
content: '';
|
|
2070
|
-
width: 16px;
|
|
2071
|
-
height: 16px;
|
|
2072
|
-
border: 1px solid var(--border-color, ${constants.BORDER_COLOR});
|
|
2073
|
-
display: inline-block;
|
|
2074
|
-
border-radius: 3px;
|
|
2075
|
-
vertical-align: bottom;
|
|
2076
|
-
margin: 0 5px;
|
|
2077
|
-
text-align: center;
|
|
2078
|
-
line-height: 16px;
|
|
2079
|
-
background-color: var(--background, ${constants.BACKGROUND});
|
|
2080
|
-
transition: background-color 0.3s ease;
|
|
2081
|
-
}
|
|
2302
|
+
flex-shrink: 0;
|
|
2082
2303
|
|
|
2083
2304
|
&::after {
|
|
2084
2305
|
content: '';
|
|
2085
2306
|
width: 3px;
|
|
2086
2307
|
height: 10px;
|
|
2087
|
-
border-right: 2px solid
|
|
2088
|
-
border-bottom: 2px solid
|
|
2089
|
-
transform: translate(-16px, 1px);
|
|
2090
|
-
opacity: 0;
|
|
2091
|
-
transition: transform 0.3s ease;
|
|
2308
|
+
border-right: 2px solid ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};
|
|
2309
|
+
border-bottom: 2px solid ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};
|
|
2092
2310
|
position: absolute;
|
|
2311
|
+
top: 1px;
|
|
2312
|
+
left: 6px;
|
|
2313
|
+
opacity: 0;
|
|
2314
|
+
transform: rotate(45deg) scale(0);
|
|
2315
|
+
transition: all 0.2s ease;
|
|
2093
2316
|
}
|
|
2317
|
+
`;
|
|
2318
|
+
const HiddenInput$1 = styled.input `
|
|
2319
|
+
opacity: 0;
|
|
2320
|
+
width: 0;
|
|
2321
|
+
height: 0;
|
|
2322
|
+
position: absolute;
|
|
2323
|
+
margin: 0;
|
|
2094
2324
|
|
|
2095
2325
|
/** checked */
|
|
2096
|
-
&:checked
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
border-color: var(--primary, ${constants.PRIMARY});
|
|
2100
|
-
color: #fff;
|
|
2326
|
+
&:checked + ${StyledCheckmark} {
|
|
2327
|
+
background-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2328
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2101
2329
|
}
|
|
2102
2330
|
|
|
2103
|
-
&:checked::after {
|
|
2331
|
+
&:checked + ${StyledCheckmark}::after {
|
|
2104
2332
|
opacity: 1;
|
|
2105
|
-
transform:
|
|
2333
|
+
transform: rotate(45deg) scale(1);
|
|
2106
2334
|
}
|
|
2107
2335
|
|
|
2108
2336
|
/** indeterminate */
|
|
2109
|
-
&:indeterminate
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
border-color: var(--primary, ${constants});
|
|
2113
|
-
color: #fff;
|
|
2337
|
+
&:indeterminate + ${StyledCheckmark} {
|
|
2338
|
+
background-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2339
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2114
2340
|
}
|
|
2115
2341
|
|
|
2116
|
-
&:indeterminate::after {
|
|
2117
|
-
width: 0;
|
|
2342
|
+
&:indeterminate + ${StyledCheckmark}::after {
|
|
2118
2343
|
opacity: 1;
|
|
2119
|
-
|
|
2344
|
+
height: 0;
|
|
2345
|
+
width: 8px;
|
|
2346
|
+
border-right: none;
|
|
2347
|
+
border-bottom: 2px solid ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};
|
|
2348
|
+
transform: rotate(0deg) scale(1);
|
|
2349
|
+
top: 7px;
|
|
2350
|
+
left: 4px;
|
|
2120
2351
|
}
|
|
2121
2352
|
|
|
2122
2353
|
/** active and focus */
|
|
2123
|
-
&:enabled:active
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
box-shadow: 0 0 0 3px var(--primary, ${constants.PRIMARY_LIGHT});
|
|
2354
|
+
&:enabled:active + ${StyledCheckmark}, &:focus + ${StyledCheckmark} {
|
|
2355
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2356
|
+
box-shadow: 0 0 0 3px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
2127
2357
|
}
|
|
2128
2358
|
|
|
2129
|
-
&:enabled:active
|
|
2130
|
-
&:focus
|
|
2131
|
-
color:
|
|
2359
|
+
&:enabled:active ~ span,
|
|
2360
|
+
&:focus ~ span {
|
|
2361
|
+
color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2132
2362
|
}
|
|
2133
2363
|
|
|
2134
2364
|
/** hover */
|
|
2135
|
-
&:enabled:hover
|
|
2136
|
-
border-color:
|
|
2365
|
+
&:enabled:hover + ${StyledCheckmark} {
|
|
2366
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2137
2367
|
}
|
|
2138
2368
|
|
|
2139
|
-
&:enabled:hover
|
|
2140
|
-
color:
|
|
2369
|
+
&:enabled:hover ~ span {
|
|
2370
|
+
color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2141
2371
|
}
|
|
2142
2372
|
|
|
2143
2373
|
/** disabled */
|
|
2144
|
-
&:disabled
|
|
2145
|
-
border-color:
|
|
2374
|
+
&:disabled + ${StyledCheckmark} {
|
|
2375
|
+
border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
2376
|
+
cursor: not-allowed;
|
|
2146
2377
|
}
|
|
2147
2378
|
|
|
2148
|
-
&:disabled
|
|
2149
|
-
color:
|
|
2379
|
+
&:disabled ~ span {
|
|
2380
|
+
color: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
2381
|
+
cursor: not-allowed;
|
|
2150
2382
|
}
|
|
2151
2383
|
|
|
2152
|
-
&:checked:disabled
|
|
2153
|
-
|
|
2154
|
-
background-color: #aaa;
|
|
2384
|
+
&:checked:disabled + ${StyledCheckmark}, &:indeterminate:disabled + ${StyledCheckmark} {
|
|
2385
|
+
background-color: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
2155
2386
|
}
|
|
2156
2387
|
`;
|
|
2157
2388
|
function Checkbox(props) {
|
|
@@ -2162,7 +2393,7 @@ function Checkbox(props) {
|
|
|
2162
2393
|
}
|
|
2163
2394
|
}
|
|
2164
2395
|
}, [props.indeterminate]);
|
|
2165
|
-
return (jsxRuntime.jsxs(Label$2, { children: [jsxRuntime.jsx(
|
|
2396
|
+
return (jsxRuntime.jsxs(Label$2, { children: [jsxRuntime.jsx(HiddenInput$1, Object.assign({}, props, { ref: ref, type: "checkbox", "aria-checked": props.indeterminate ? 'mixed' : props.checked })), jsxRuntime.jsx(StyledCheckmark, {}), jsxRuntime.jsx("span", { children: props.label })] }));
|
|
2166
2397
|
}
|
|
2167
2398
|
Checkbox.propTypes = {
|
|
2168
2399
|
/** Label for the field */
|
|
@@ -2180,7 +2411,10 @@ const Switch = styled.label `
|
|
|
2180
2411
|
display: inline-flex;
|
|
2181
2412
|
margin: 5px 0;
|
|
2182
2413
|
`;
|
|
2183
|
-
const Input$
|
|
2414
|
+
const Input$1 = styled.input `
|
|
2415
|
+
position: absolute;
|
|
2416
|
+
width: 0;
|
|
2417
|
+
height: 0;
|
|
2184
2418
|
appearance: none;
|
|
2185
2419
|
margin: 0;
|
|
2186
2420
|
|
|
@@ -2189,7 +2423,7 @@ const Input$2 = styled.input `
|
|
|
2189
2423
|
cursor: pointer;
|
|
2190
2424
|
width: 30px;
|
|
2191
2425
|
height: 18px;
|
|
2192
|
-
background-color: ${
|
|
2426
|
+
background-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};
|
|
2193
2427
|
transition: 0.4s;
|
|
2194
2428
|
border-radius: 10px;
|
|
2195
2429
|
padding: 0 3px;
|
|
@@ -2202,51 +2436,51 @@ const Input$2 = styled.input `
|
|
|
2202
2436
|
width: 14px;
|
|
2203
2437
|
left: 1px;
|
|
2204
2438
|
top: 1px;
|
|
2205
|
-
border: 1px solid
|
|
2439
|
+
border: 1px solid ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
2206
2440
|
border-radius: 50%;
|
|
2207
|
-
background-color:
|
|
2441
|
+
background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
2208
2442
|
transition: 0.4s;
|
|
2209
2443
|
}
|
|
2210
2444
|
|
|
2211
2445
|
/* checked */
|
|
2212
2446
|
&:checked + span {
|
|
2213
|
-
background-color:
|
|
2447
|
+
background-color: ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
2214
2448
|
}
|
|
2215
2449
|
|
|
2216
2450
|
&:checked + span:before {
|
|
2217
2451
|
transform: translateX(18px);
|
|
2218
|
-
border-color:
|
|
2452
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2219
2453
|
}
|
|
2220
2454
|
|
|
2221
2455
|
/* focus */
|
|
2222
2456
|
&:enabled:focus + span:before {
|
|
2223
|
-
box-shadow: 0 0 0 3px
|
|
2224
|
-
border-color:
|
|
2457
|
+
box-shadow: 0 0 0 3px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
2458
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2225
2459
|
}
|
|
2226
2460
|
|
|
2227
2461
|
/* hover */
|
|
2228
2462
|
&:enabled:hover ~ span {
|
|
2229
2463
|
cursor: pointer;
|
|
2230
|
-
color:
|
|
2464
|
+
color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2231
2465
|
}
|
|
2232
2466
|
|
|
2233
2467
|
/* disabled */
|
|
2234
2468
|
&:disabled ~ span {
|
|
2235
|
-
color:
|
|
2469
|
+
color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
2236
2470
|
}
|
|
2237
2471
|
|
|
2238
2472
|
&:disabled + span {
|
|
2239
|
-
background-color: ${
|
|
2473
|
+
background-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};
|
|
2240
2474
|
cursor: not-allowed;
|
|
2241
2475
|
}
|
|
2242
2476
|
|
|
2243
2477
|
&:disabled + span:before {
|
|
2244
|
-
background-color:
|
|
2245
|
-
border-color:
|
|
2478
|
+
background-color: ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};
|
|
2479
|
+
border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
2246
2480
|
}
|
|
2247
2481
|
`;
|
|
2248
2482
|
function Toggle(props) {
|
|
2249
|
-
return (jsxRuntime.jsxs(Switch, { children: [jsxRuntime.jsx(Input$
|
|
2483
|
+
return (jsxRuntime.jsxs(Switch, { children: [jsxRuntime.jsx(Input$1, Object.assign({}, props, { type: "checkbox", role: "switch", "aria-checked": props.checked })), jsxRuntime.jsx("span", {}), jsxRuntime.jsx("span", { children: props.label })] }));
|
|
2250
2484
|
}
|
|
2251
2485
|
Toggle.propTypes = {
|
|
2252
2486
|
/** Label for the field */
|
|
@@ -2257,73 +2491,89 @@ const Label$1 = styled.label `
|
|
|
2257
2491
|
display: inline-flex;
|
|
2258
2492
|
align-items: center;
|
|
2259
2493
|
margin: 5px 0;
|
|
2494
|
+
cursor: pointer;
|
|
2495
|
+
position: relative;
|
|
2260
2496
|
`;
|
|
2261
|
-
const
|
|
2262
|
-
|
|
2263
|
-
|
|
2497
|
+
const StyledRadio = styled.span `
|
|
2498
|
+
width: 16px;
|
|
2499
|
+
height: 16px;
|
|
2500
|
+
margin-right: 5px;
|
|
2501
|
+
border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
|
|
2502
|
+
border-radius: 50%;
|
|
2503
|
+
display: block;
|
|
2504
|
+
transition: background-color 0.3s ease;
|
|
2505
|
+
position: relative;
|
|
2506
|
+
flex-shrink: 0;
|
|
2264
2507
|
|
|
2265
|
-
&::
|
|
2266
|
-
content: '
|
|
2267
|
-
width:
|
|
2268
|
-
height:
|
|
2269
|
-
margin: 0 5px;
|
|
2270
|
-
border: 1px solid var(--border-color, ${constants.BORDER_COLOR});
|
|
2508
|
+
&::after {
|
|
2509
|
+
content: '';
|
|
2510
|
+
width: 100%;
|
|
2511
|
+
height: 100%;
|
|
2271
2512
|
border-radius: 50%;
|
|
2272
|
-
|
|
2273
|
-
|
|
2513
|
+
position: absolute;
|
|
2514
|
+
top: 0;
|
|
2515
|
+
left: 0;
|
|
2516
|
+
box-shadow: inset 0 0 0 3px ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
2517
|
+
opacity: 0;
|
|
2518
|
+
transition: opacity 0.2s ease;
|
|
2274
2519
|
}
|
|
2520
|
+
`;
|
|
2521
|
+
const HiddenInput = styled.input `
|
|
2522
|
+
opacity: 0;
|
|
2523
|
+
width: 0;
|
|
2524
|
+
height: 0;
|
|
2525
|
+
position: absolute;
|
|
2526
|
+
margin: 0;
|
|
2275
2527
|
|
|
2276
2528
|
/* checked */
|
|
2277
|
-
&:checked
|
|
2278
|
-
border:
|
|
2279
|
-
background-color:
|
|
2280
|
-
|
|
2529
|
+
&:checked + ${StyledRadio} {
|
|
2530
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2531
|
+
background-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
&:checked + ${StyledRadio}::after {
|
|
2535
|
+
opacity: 1;
|
|
2281
2536
|
}
|
|
2282
2537
|
|
|
2283
2538
|
/* focus */
|
|
2284
|
-
&:enabled:focus
|
|
2285
|
-
border:
|
|
2286
|
-
box-shadow: 0 0 0 3px
|
|
2287
|
-
cursor: pointer;
|
|
2539
|
+
&:enabled:focus + ${StyledRadio} {
|
|
2540
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2541
|
+
box-shadow: 0 0 0 3px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
2288
2542
|
}
|
|
2289
2543
|
|
|
2290
|
-
&:enabled:checked:focus
|
|
2291
|
-
border:
|
|
2292
|
-
box-shadow:
|
|
2293
|
-
0 0 0 3px var(--primary, ${constants.PRIMARY_LIGHT}),
|
|
2294
|
-
inset 0 0 0 3px var(--background, ${constants.BACKGROUND});
|
|
2295
|
-
cursor: pointer;
|
|
2544
|
+
&:enabled:checked:focus + ${StyledRadio} {
|
|
2545
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2546
|
+
box-shadow: 0 0 0 3px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
2296
2547
|
}
|
|
2297
2548
|
|
|
2298
2549
|
/* hover */
|
|
2299
|
-
&:enabled:hover
|
|
2300
|
-
border:
|
|
2301
|
-
cursor: pointer;
|
|
2550
|
+
&:enabled:hover + ${StyledRadio} {
|
|
2551
|
+
border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2302
2552
|
}
|
|
2303
2553
|
|
|
2304
|
-
&:enabled:hover
|
|
2305
|
-
color:
|
|
2306
|
-
cursor: pointer;
|
|
2554
|
+
&:enabled:hover ~ span {
|
|
2555
|
+
color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2307
2556
|
}
|
|
2308
2557
|
|
|
2309
2558
|
/* disabled */
|
|
2310
|
-
&:disabled
|
|
2311
|
-
border:
|
|
2312
|
-
background-color:
|
|
2559
|
+
&:disabled + ${StyledRadio} {
|
|
2560
|
+
border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
2561
|
+
background-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};
|
|
2562
|
+
cursor: not-allowed;
|
|
2313
2563
|
}
|
|
2314
2564
|
|
|
2315
|
-
&:disabled:checked
|
|
2316
|
-
border:
|
|
2317
|
-
background-color:
|
|
2318
|
-
box-shadow: inset 0 0 0 3px var(--background, ${constants.BACKGROUND});
|
|
2565
|
+
&:disabled:checked + ${StyledRadio} {
|
|
2566
|
+
border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
2567
|
+
background-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
2319
2568
|
}
|
|
2320
2569
|
|
|
2321
|
-
&:disabled
|
|
2322
|
-
color:
|
|
2570
|
+
&:disabled ~ span {
|
|
2571
|
+
color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
2572
|
+
cursor: not-allowed;
|
|
2323
2573
|
}
|
|
2324
2574
|
`;
|
|
2325
2575
|
function Radio(props) {
|
|
2326
|
-
return (jsxRuntime.jsxs(Label$1, { children: [jsxRuntime.jsx(
|
|
2576
|
+
return (jsxRuntime.jsxs(Label$1, { children: [jsxRuntime.jsx(HiddenInput, Object.assign({}, props, { type: "radio" })), jsxRuntime.jsx(StyledRadio, {}), jsxRuntime.jsx("span", { children: props.label })] }));
|
|
2327
2577
|
}
|
|
2328
2578
|
Radio.propTypes = {
|
|
2329
2579
|
/** Label for the field */
|
|
@@ -2336,37 +2586,37 @@ const Input = styled.input `
|
|
|
2336
2586
|
width: 0;
|
|
2337
2587
|
|
|
2338
2588
|
& + span {
|
|
2339
|
-
color:
|
|
2589
|
+
color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2340
2590
|
padding: 6px 12px;
|
|
2341
2591
|
border: none;
|
|
2342
|
-
border: 1px solid
|
|
2592
|
+
border: 1px solid ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2343
2593
|
cursor: pointer;
|
|
2344
2594
|
margin-right: -1px;
|
|
2345
2595
|
line-height: 18px;
|
|
2346
2596
|
}
|
|
2347
2597
|
|
|
2348
2598
|
&:enabled:focus + span {
|
|
2349
|
-
box-shadow: 0 0 0 4px
|
|
2599
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
2350
2600
|
}
|
|
2351
2601
|
|
|
2352
2602
|
&:enabled:hover + span {
|
|
2353
|
-
background-color:
|
|
2354
|
-
color:
|
|
2603
|
+
background-color: ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
2604
|
+
color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};
|
|
2355
2605
|
}
|
|
2356
2606
|
|
|
2357
2607
|
&:enabled:checked + span {
|
|
2358
|
-
background-color:
|
|
2359
|
-
color:
|
|
2608
|
+
background-color: ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
2609
|
+
color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};
|
|
2360
2610
|
}
|
|
2361
2611
|
|
|
2362
2612
|
&:disabled + span {
|
|
2363
|
-
background-color:
|
|
2364
|
-
color:
|
|
2613
|
+
background-color: ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};
|
|
2614
|
+
color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
2365
2615
|
}
|
|
2366
2616
|
|
|
2367
2617
|
&:disabled:checked + span {
|
|
2368
|
-
background-color:
|
|
2369
|
-
color:
|
|
2618
|
+
background-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
2619
|
+
color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};
|
|
2370
2620
|
}
|
|
2371
2621
|
`;
|
|
2372
2622
|
const Label = styled.label `
|
|
@@ -2408,10 +2658,28 @@ const MenuContainer = styled.div `
|
|
|
2408
2658
|
& div:last-child {
|
|
2409
2659
|
border-bottom: none;
|
|
2410
2660
|
}
|
|
2661
|
+
|
|
2662
|
+
&:focus-within {
|
|
2663
|
+
box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
2664
|
+
}
|
|
2411
2665
|
`;
|
|
2666
|
+
/**
|
|
2667
|
+
* Menu component that allows selection of items from a list.
|
|
2668
|
+
* Supports single and multi-select modes and keyboard navigation.
|
|
2669
|
+
*
|
|
2670
|
+
* @template T - The type of value(s) in the menu.
|
|
2671
|
+
* @param {MenuProps<T> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>} props - The menu properties.
|
|
2672
|
+
* @param {ForwardedRef<HTMLDivElement>} ref - The ref forwarded to the menu container.
|
|
2673
|
+
*/
|
|
2412
2674
|
const Menu = React.forwardRef(function (props, ref) {
|
|
2413
|
-
const { multiSelect, onChange } = props;
|
|
2414
|
-
const [value, setValue] = React.useState(
|
|
2675
|
+
const { multiSelect, onChange, value: propValue } = props, rest = __rest(props, ["multiSelect", "onChange", "value"]);
|
|
2676
|
+
const [value, setValue] = React.useState(propValue || (multiSelect ? [] : ''));
|
|
2677
|
+
/**
|
|
2678
|
+
* Updates the selected value(s).
|
|
2679
|
+
* Handles both single and multi-select logic.
|
|
2680
|
+
*
|
|
2681
|
+
* @param {T} val - The value to select or deselect.
|
|
2682
|
+
*/
|
|
2415
2683
|
const updateValue = (val) => {
|
|
2416
2684
|
let newVal;
|
|
2417
2685
|
if (multiSelect) {
|
|
@@ -2430,11 +2698,74 @@ const Menu = React.forwardRef(function (props, ref) {
|
|
|
2430
2698
|
setValue(newVal);
|
|
2431
2699
|
onChange === null || onChange === void 0 ? void 0 : onChange(newVal);
|
|
2432
2700
|
};
|
|
2701
|
+
/**
|
|
2702
|
+
* Handles keyboard navigation within the menu.
|
|
2703
|
+
* Supports Arrow keys for navigation, and Enter/Space for selection.
|
|
2704
|
+
*
|
|
2705
|
+
* @param {React.KeyboardEvent} e - The keyboard event.
|
|
2706
|
+
*/
|
|
2707
|
+
const handleKeyDown = (e) => {
|
|
2708
|
+
var _a, _b, _c, _d;
|
|
2709
|
+
const target = e.target;
|
|
2710
|
+
const container = e.currentTarget;
|
|
2711
|
+
const items = Array.from(container.querySelectorAll('[role="option"]'));
|
|
2712
|
+
const currentIndex = items.indexOf(target);
|
|
2713
|
+
let nextIndex;
|
|
2714
|
+
switch (e.key) {
|
|
2715
|
+
case 'ArrowDown':
|
|
2716
|
+
e.preventDefault();
|
|
2717
|
+
nextIndex = currentIndex + 1;
|
|
2718
|
+
if (nextIndex >= items.length)
|
|
2719
|
+
nextIndex = 0;
|
|
2720
|
+
(_a = items[nextIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2721
|
+
break;
|
|
2722
|
+
case 'ArrowUp':
|
|
2723
|
+
e.preventDefault();
|
|
2724
|
+
nextIndex = currentIndex - 1;
|
|
2725
|
+
if (nextIndex < 0)
|
|
2726
|
+
nextIndex = items.length - 1;
|
|
2727
|
+
(_b = items[nextIndex]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
2728
|
+
break;
|
|
2729
|
+
case 'Home':
|
|
2730
|
+
e.preventDefault();
|
|
2731
|
+
(_c = items[0]) === null || _c === void 0 ? void 0 : _c.focus();
|
|
2732
|
+
break;
|
|
2733
|
+
case 'End':
|
|
2734
|
+
e.preventDefault();
|
|
2735
|
+
(_d = items[items.length - 1]) === null || _d === void 0 ? void 0 : _d.focus();
|
|
2736
|
+
break;
|
|
2737
|
+
case 'Enter':
|
|
2738
|
+
case ' ': // Space
|
|
2739
|
+
e.preventDefault();
|
|
2740
|
+
target.click();
|
|
2741
|
+
break;
|
|
2742
|
+
}
|
|
2743
|
+
};
|
|
2744
|
+
/**
|
|
2745
|
+
* Handles focus events on the menu container.
|
|
2746
|
+
* Delegates focus to the first item if the container itself receives focus.
|
|
2747
|
+
*
|
|
2748
|
+
* @param {React.FocusEvent} e - The focus event.
|
|
2749
|
+
*/
|
|
2750
|
+
const focusHandler = (e) => {
|
|
2751
|
+
// Prevent trap: If focus came from inside (Shift+Tab), do NOT auto-focus again.
|
|
2752
|
+
// This allows focus to land on the container, and the next Shift+Tab will exit.
|
|
2753
|
+
if (e.currentTarget.contains(e.relatedTarget)) {
|
|
2754
|
+
return;
|
|
2755
|
+
}
|
|
2756
|
+
// Only if focus is actually on the container (e.g. tabbing into it)
|
|
2757
|
+
// and not bubbling up from a child
|
|
2758
|
+
if (e.target === e.currentTarget) {
|
|
2759
|
+
// Prevent the container from holding focus; delegate to first item
|
|
2760
|
+
const firstItem = e.currentTarget.querySelector('[role="option"]');
|
|
2761
|
+
firstItem === null || firstItem === void 0 ? void 0 : firstItem.focus();
|
|
2762
|
+
}
|
|
2763
|
+
};
|
|
2433
2764
|
return (jsxRuntime.jsx(MenuContext.Provider, { value: {
|
|
2434
2765
|
value,
|
|
2435
2766
|
multiSelect,
|
|
2436
2767
|
updateValue,
|
|
2437
|
-
}, children: jsxRuntime.jsx(MenuContainer, { ref: ref, children: props.children }) }));
|
|
2768
|
+
}, children: jsxRuntime.jsx(MenuContainer, Object.assign({}, rest, { ref: ref, role: "listbox", "aria-multiselectable": multiSelect, tabIndex: 0, onKeyDown: handleKeyDown, onFocus: focusHandler, children: props.children })) }));
|
|
2438
2769
|
});
|
|
2439
2770
|
Menu.displayName = 'Menu';
|
|
2440
2771
|
Menu.defaultProps = {
|
|
@@ -2447,39 +2778,38 @@ const Container$4 = styled.button `
|
|
|
2447
2778
|
border: none;
|
|
2448
2779
|
background-color: transparent;
|
|
2449
2780
|
font-size: 16px;
|
|
2450
|
-
border-bottom: 1px solid
|
|
2781
|
+
border-bottom: 1px solid ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};
|
|
2451
2782
|
min-height: 41px;
|
|
2452
2783
|
display: flex;
|
|
2453
2784
|
align-items: center;
|
|
2454
2785
|
cursor: pointer;
|
|
2455
2786
|
position: relative;
|
|
2787
|
+
color: ${getThemeValue(THEME_NAME.TEXT_COLOR_DARK)};
|
|
2456
2788
|
|
|
2457
2789
|
&:hover,
|
|
2458
2790
|
&:focus,
|
|
2459
2791
|
&:focus-within {
|
|
2460
|
-
background-color:
|
|
2792
|
+
background-color: ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};
|
|
2461
2793
|
}
|
|
2462
2794
|
|
|
2463
2795
|
& > label {
|
|
2464
2796
|
margin: 0 4px 0 0;
|
|
2465
2797
|
}
|
|
2466
2798
|
`;
|
|
2467
|
-
|
|
2799
|
+
const MenuItemInner = (props, ref) => {
|
|
2468
2800
|
var _a, _b;
|
|
2469
2801
|
const context = React.useContext(MenuContext);
|
|
2470
2802
|
const { value, children } = props, rest = __rest(props, ["value", "children"]);
|
|
2471
2803
|
const clickHandler = (e) => {
|
|
2472
2804
|
e.stopPropagation();
|
|
2473
|
-
if (context.multiSelect) {
|
|
2474
|
-
e.nativeEvent.stopImmediatePropagation();
|
|
2475
|
-
}
|
|
2476
2805
|
context.updateValue(value);
|
|
2477
2806
|
};
|
|
2478
2807
|
const selected = context.multiSelect
|
|
2479
2808
|
? (_b = (_a = context.value) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, value)
|
|
2480
2809
|
: context.value === value;
|
|
2481
|
-
return (jsxRuntime.jsxs(Container$4, Object.assign({}, rest, { type: "button",
|
|
2482
|
-
}
|
|
2810
|
+
return (jsxRuntime.jsxs(Container$4, Object.assign({}, rest, { ref: ref, type: "button", role: "option", "aria-selected": selected, selected: selected, onClick: clickHandler, children: [context.multiSelect && (jsxRuntime.jsx(Checkbox, { checked: selected, readOnly: true, tabIndex: -1, onClick: (e) => e.stopPropagation() })), children] })));
|
|
2811
|
+
};
|
|
2812
|
+
const MenuItem = React.forwardRef(MenuItemInner);
|
|
2483
2813
|
|
|
2484
2814
|
exports.POPOVER_POSITION = void 0;
|
|
2485
2815
|
(function (POPOVER_POSITION) {
|
|
@@ -2563,6 +2893,9 @@ function Popover(props) {
|
|
|
2563
2893
|
const [translate, setTranslate] = React.useState({ x: 0, y: 0 });
|
|
2564
2894
|
const popperRef = React.useRef();
|
|
2565
2895
|
const containerRef = React.useRef();
|
|
2896
|
+
const triggerRef = React.useRef(null);
|
|
2897
|
+
const popperId = React.useId();
|
|
2898
|
+
const triggerId = React.useId();
|
|
2566
2899
|
const close = React.useCallback(() => {
|
|
2567
2900
|
setClosing(true);
|
|
2568
2901
|
setTimeout(() => {
|
|
@@ -2572,6 +2905,12 @@ function Popover(props) {
|
|
|
2572
2905
|
props.onClose();
|
|
2573
2906
|
}
|
|
2574
2907
|
setClosing(false);
|
|
2908
|
+
// Restore focus to the trigger element after animation completes
|
|
2909
|
+
setTimeout(() => {
|
|
2910
|
+
if (triggerRef.current) {
|
|
2911
|
+
triggerRef.current.focus();
|
|
2912
|
+
}
|
|
2913
|
+
}, 50);
|
|
2575
2914
|
}, 280);
|
|
2576
2915
|
}, [props]);
|
|
2577
2916
|
const keyupEventHandler = React.useCallback((e) => {
|
|
@@ -2660,7 +2999,13 @@ function Popover(props) {
|
|
|
2660
2999
|
popperRef.current.focus();
|
|
2661
3000
|
}
|
|
2662
3001
|
}, [open, props.position]);
|
|
2663
|
-
return (jsxRuntime.jsxs(PopoverDiv, { ref: containerRef, children: [
|
|
3002
|
+
return (jsxRuntime.jsxs(PopoverDiv, { ref: containerRef, children: [React.createElement(props.element, {
|
|
3003
|
+
ref: triggerRef,
|
|
3004
|
+
id: triggerId,
|
|
3005
|
+
'aria-expanded': open,
|
|
3006
|
+
'aria-haspopup': 'dialog',
|
|
3007
|
+
'aria-controls': popperId,
|
|
3008
|
+
}), open && (jsxRuntime.jsx(Popper, { elevated: true, tabIndex: 0, role: "dialog", "aria-labelledby": triggerId, id: popperId, position: props.position, translateX: translate.x, translateY: translate.y, className: closing && 'closing', ref: popperRef, onClick: (e) => {
|
|
2664
3009
|
e.stopPropagation();
|
|
2665
3010
|
e.nativeEvent.stopImmediatePropagation();
|
|
2666
3011
|
}, children: props.children }))] }));
|
|
@@ -2693,54 +3038,77 @@ const ArrowContainer = styled.span `
|
|
|
2693
3038
|
top: 16px;
|
|
2694
3039
|
pointer-events: none;
|
|
2695
3040
|
`;
|
|
3041
|
+
/**
|
|
3042
|
+
* Dropdown component that allows selection from a list of options.
|
|
3043
|
+
* Supports single and multi-select modes.
|
|
3044
|
+
*
|
|
3045
|
+
* @template T - The type of the value(s) in the dropdown.
|
|
3046
|
+
* @param {DropdownProps<T>} props - The properties for the Dropdown component.
|
|
3047
|
+
* @returns {JSX.Element} The rendered Dropdown component.
|
|
3048
|
+
*/
|
|
2696
3049
|
function Dropdown(props) {
|
|
2697
3050
|
const { multiSelect, onChange } = props;
|
|
2698
3051
|
const [open, setOpen] = React.useState(false);
|
|
2699
3052
|
const [value, setValue] = React.useState(props.value);
|
|
3053
|
+
const id = React.useId();
|
|
3054
|
+
const menuId = `${id}-menu`;
|
|
3055
|
+
const menuRef = React.useRef(null);
|
|
3056
|
+
const triggerRef = React.useRef(null);
|
|
3057
|
+
// Focus menu when opened
|
|
2700
3058
|
React.useEffect(() => {
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
}
|
|
2710
|
-
else {
|
|
2711
|
-
const currentBtn = current.closest('button');
|
|
2712
|
-
if (e.keyCode === 38) {
|
|
2713
|
-
const prev = (_a = currentBtn === null || currentBtn === void 0 ? void 0 : currentBtn.previousElementSibling) === null || _a === void 0 ? void 0 : _a.closest('button');
|
|
2714
|
-
prev === null || prev === void 0 ? void 0 : prev.focus();
|
|
2715
|
-
}
|
|
2716
|
-
else {
|
|
2717
|
-
const next = (_b = currentBtn === null || currentBtn === void 0 ? void 0 : currentBtn.nextElementSibling) === null || _b === void 0 ? void 0 : _b.closest('button');
|
|
2718
|
-
next === null || next === void 0 ? void 0 : next.focus();
|
|
2719
|
-
}
|
|
3059
|
+
if (open) {
|
|
3060
|
+
// Wait for Popover to fully open and focus itself first
|
|
3061
|
+
// Then move focus to the first menu item
|
|
3062
|
+
const timer = setTimeout(() => {
|
|
3063
|
+
var _a;
|
|
3064
|
+
const firstItem = (_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('[role="option"]');
|
|
3065
|
+
if (firstItem) {
|
|
3066
|
+
firstItem.focus();
|
|
2720
3067
|
}
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
}
|
|
2724
|
-
document.addEventListener('keydown', focusHandler);
|
|
2725
|
-
return () => {
|
|
2726
|
-
document.removeEventListener('keydown', focusHandler);
|
|
2727
|
-
};
|
|
3068
|
+
}, 100); // Wait after Popover has set initial focus
|
|
3069
|
+
return () => clearTimeout(timer);
|
|
3070
|
+
}
|
|
2728
3071
|
}, [open]);
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
3072
|
+
/**
|
|
3073
|
+
* Handles keydown events on the input trigger.
|
|
3074
|
+
* Opens the menu on 'Enter', 'Space', 'ArrowDown', or 'ArrowUp'.
|
|
3075
|
+
*
|
|
3076
|
+
* @param {React.KeyboardEvent<HTMLInputElement>} e - The keyboard event.
|
|
3077
|
+
*/
|
|
3078
|
+
const onKeyDown = (e) => {
|
|
3079
|
+
if (['ArrowDown', 'ArrowUp', 'Enter', ' '].includes(e.key)) {
|
|
3080
|
+
e.preventDefault();
|
|
2732
3081
|
setOpen(true);
|
|
2733
3082
|
}
|
|
2734
3083
|
};
|
|
3084
|
+
/**
|
|
3085
|
+
* Handles changes to the dropdown value.
|
|
3086
|
+
* Updates local state and calls the external onChange handler.
|
|
3087
|
+
* Closes the dropdown if not in multi-select mode.
|
|
3088
|
+
*
|
|
3089
|
+
* @param {T | T[]} val - The new value(s).
|
|
3090
|
+
*/
|
|
2735
3091
|
const changeHandler = (val) => {
|
|
3092
|
+
var _a;
|
|
2736
3093
|
setValue(val);
|
|
2737
3094
|
onChange === null || onChange === void 0 ? void 0 : onChange(val);
|
|
2738
3095
|
// Close dropdown after selection if not multiSelect
|
|
2739
3096
|
if (!multiSelect) {
|
|
2740
3097
|
setOpen(false);
|
|
3098
|
+
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2741
3099
|
}
|
|
2742
3100
|
};
|
|
2743
|
-
|
|
3101
|
+
/**
|
|
3102
|
+
* Toggles the dropdown open state on click.
|
|
3103
|
+
*/
|
|
3104
|
+
const clickHandler = () => setOpen(true);
|
|
3105
|
+
const TriggerElement = React.forwardRef((passedProps, ref) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Input$2, Object.assign({}, passedProps, { ref: ref, type: "text", value: value && String(value), label: props.label, errorText: props.errorText, onClick: clickHandler, onKeyDown: onKeyDown, required: props.required, disabled: props.disabled, readOnly: true, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": open, "aria-controls": menuId })), jsxRuntime.jsx(ArrowContainer, { "aria-hidden": "true", children: jsxRuntime.jsx(ExpandMore, {}) })] })));
|
|
3106
|
+
TriggerElement.displayName = 'DropdownTrigger';
|
|
3107
|
+
return (jsxRuntime.jsx(Popover, { position: exports.POPOVER_POSITION.BOTTOM_LEFT, open: open, element: TriggerElement, onClose: () => {
|
|
3108
|
+
var _a;
|
|
3109
|
+
setOpen(false);
|
|
3110
|
+
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
3111
|
+
}, children: jsxRuntime.jsx(Menu, { ref: menuRef, id: menuId, value: value, multiSelect: multiSelect, onChange: changeHandler, children: props.children }) }));
|
|
2744
3112
|
}
|
|
2745
3113
|
Dropdown.defaultProps = {
|
|
2746
3114
|
multiSelect: false,
|
|
@@ -2785,7 +3153,7 @@ class PromptDialog extends React.Component {
|
|
|
2785
3153
|
}
|
|
2786
3154
|
render() {
|
|
2787
3155
|
const { header, body, inputProps, submitText, cancelText, dialogProps } = this.props;
|
|
2788
|
-
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$
|
|
3156
|
+
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$2, Object.assign({ style: { width: 'auto', flex: '1' }, value: this.state.value, onChange: this.valueChange }, inputProps)) })] }), jsxRuntime.jsxs(Footer$1, { children: [jsxRuntime.jsx(StyledButton, { type: "button", onClick: this.cancel, children: cancelText }), jsxRuntime.jsx(ActionButton, { children: submitText })] })] }) })));
|
|
2789
3157
|
}
|
|
2790
3158
|
}
|
|
2791
3159
|
PromptDialog.propTypes = {
|
|
@@ -2840,9 +3208,9 @@ const positionStyle$1 = (size) => ({
|
|
|
2840
3208
|
const DrawerDiv = styled.div `
|
|
2841
3209
|
display: flex;
|
|
2842
3210
|
flex-direction: column;
|
|
2843
|
-
background-color:
|
|
3211
|
+
background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};
|
|
2844
3212
|
transition: transform 0.3s ease;
|
|
2845
|
-
box-shadow:
|
|
3213
|
+
box-shadow: ${getThemeValue(THEME_NAME.MODAL_SHADOW)};
|
|
2846
3214
|
${(props) => positionStyle$1(props.size)[props.position].before}
|
|
2847
3215
|
|
|
2848
3216
|
.nf-layer-enter & {
|
|
@@ -2850,19 +3218,56 @@ const DrawerDiv = styled.div `
|
|
|
2850
3218
|
${(props) => positionStyle$1(props.size)[props.position].after}
|
|
2851
3219
|
}
|
|
2852
3220
|
`;
|
|
3221
|
+
const drawerPropTypes = {
|
|
3222
|
+
/** Opens the drawer */
|
|
3223
|
+
open: PropTypes.bool.isRequired,
|
|
3224
|
+
/** position of the drawer */
|
|
3225
|
+
position: PropTypes.oneOf([
|
|
3226
|
+
exports.DRAWER_POSITION.LEFT,
|
|
3227
|
+
exports.DRAWER_POSITION.RIGHT,
|
|
3228
|
+
exports.DRAWER_POSITION.BOTTOM,
|
|
3229
|
+
]),
|
|
3230
|
+
/** size of the drawer */
|
|
3231
|
+
size: PropTypes.string,
|
|
3232
|
+
/** Shows an overlay behind the drawer. */
|
|
3233
|
+
overlay: PropTypes.bool,
|
|
3234
|
+
/** Closes the drawer on esc */
|
|
3235
|
+
closeOnEsc: PropTypes.bool,
|
|
3236
|
+
/** Closes the drawer on overlay click */
|
|
3237
|
+
closeOnOverlayClick: PropTypes.bool,
|
|
3238
|
+
/** Call back function called when the drawer closes. */
|
|
3239
|
+
onClose: PropTypes.func,
|
|
3240
|
+
};
|
|
2853
3241
|
const positionMap$1 = {
|
|
2854
3242
|
[exports.DRAWER_POSITION.LEFT]: LAYER_POSITION.TOP_LEFT,
|
|
2855
3243
|
[exports.DRAWER_POSITION.RIGHT]: LAYER_POSITION.TOP_RIGHT,
|
|
2856
3244
|
[exports.DRAWER_POSITION.BOTTOM]: LAYER_POSITION.BOTTOM_LEFT,
|
|
2857
3245
|
};
|
|
3246
|
+
/**
|
|
3247
|
+
* Drawer component
|
|
3248
|
+
*
|
|
3249
|
+
* A panel that slides in from the edge of the screen.
|
|
3250
|
+
* It sits on top of the application content and is often used for navigation or details.
|
|
3251
|
+
*
|
|
3252
|
+
* Accessibility:
|
|
3253
|
+
* - Implements ARIA `role="dialog"` and `aria-modal="true"`.
|
|
3254
|
+
* - Traps focus effectively within the drawer while open.
|
|
3255
|
+
* - Restores focus to the triggering element upon closure.
|
|
3256
|
+
* - Supports closing via ESC key and overlay click.
|
|
3257
|
+
*/
|
|
2858
3258
|
class Drawer extends React.Component {
|
|
2859
3259
|
constructor() {
|
|
2860
3260
|
super(...arguments);
|
|
2861
3261
|
this.state = {
|
|
2862
3262
|
open: false,
|
|
2863
3263
|
};
|
|
3264
|
+
/**
|
|
3265
|
+
* Internal close handler.
|
|
3266
|
+
* Restores focus and calls the external onClose callback.
|
|
3267
|
+
*/
|
|
2864
3268
|
this.onClose = () => {
|
|
2865
3269
|
var _a, _b;
|
|
3270
|
+
this.restoreFocus();
|
|
2866
3271
|
this.setState({
|
|
2867
3272
|
open: false,
|
|
2868
3273
|
});
|
|
@@ -2870,7 +3275,97 @@ class Drawer extends React.Component {
|
|
|
2870
3275
|
this.closeCallback = null;
|
|
2871
3276
|
this.layer = null;
|
|
2872
3277
|
};
|
|
3278
|
+
this.lastFocusedElement = null;
|
|
3279
|
+
this.drawerRef = React.createRef();
|
|
3280
|
+
/**
|
|
3281
|
+
* Retrieves all focusable elements within the drawer.
|
|
3282
|
+
*/
|
|
3283
|
+
this.getFocusableElements = () => {
|
|
3284
|
+
if (!this.drawerRef.current)
|
|
3285
|
+
return [];
|
|
3286
|
+
return Array.from(this.drawerRef.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));
|
|
3287
|
+
};
|
|
3288
|
+
/**
|
|
3289
|
+
* Handles keydown events to implement the focus trap.
|
|
3290
|
+
* Traps Tab and Shift+Tab within the drawer.
|
|
3291
|
+
*/
|
|
3292
|
+
this.handleKeyDown = (e) => {
|
|
3293
|
+
if (e.key === 'Tab') {
|
|
3294
|
+
const focusableElements = this.getFocusableElements();
|
|
3295
|
+
if (focusableElements.length === 0)
|
|
3296
|
+
return;
|
|
3297
|
+
const firstElement = focusableElements[0];
|
|
3298
|
+
const lastElement = focusableElements[focusableElements.length - 1];
|
|
3299
|
+
if (e.shiftKey) {
|
|
3300
|
+
if (document.activeElement === firstElement) {
|
|
3301
|
+
lastElement.focus();
|
|
3302
|
+
e.preventDefault();
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
else {
|
|
3306
|
+
if (document.activeElement === lastElement) {
|
|
3307
|
+
firstElement.focus();
|
|
3308
|
+
e.preventDefault();
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3312
|
+
};
|
|
3313
|
+
/**
|
|
3314
|
+
* Restores focus to the element that was focused before the drawer opened.
|
|
3315
|
+
*/
|
|
3316
|
+
this.restoreFocus = () => {
|
|
3317
|
+
if (this.lastFocusedElement) {
|
|
3318
|
+
// Check if the element is still in the document
|
|
3319
|
+
const elementToBeFocused = this.lastFocusedElement;
|
|
3320
|
+
this.lastFocusedElement = null;
|
|
3321
|
+
setTimeout(() => {
|
|
3322
|
+
if (document.body.contains(elementToBeFocused)) {
|
|
3323
|
+
elementToBeFocused.focus();
|
|
3324
|
+
}
|
|
3325
|
+
}, 100);
|
|
3326
|
+
}
|
|
3327
|
+
};
|
|
3328
|
+
/**
|
|
3329
|
+
* Callback ref to capture the Drawer DOM element.
|
|
3330
|
+
* Triggers initial focus setting when the element mounts.
|
|
3331
|
+
*/
|
|
3332
|
+
this.setDrawerRef = (node) => {
|
|
3333
|
+
// Update ref
|
|
3334
|
+
this.drawerRef.current = node;
|
|
3335
|
+
if (node) {
|
|
3336
|
+
// Set initial focus when the node is mounted
|
|
3337
|
+
this.setInitialFocus(node);
|
|
3338
|
+
}
|
|
3339
|
+
};
|
|
3340
|
+
/**
|
|
3341
|
+
* Sets initial focus within the drawer.
|
|
3342
|
+
* Tries to focus the header first, then the first interactive element, or falls back to the container.
|
|
3343
|
+
*/
|
|
3344
|
+
this.setInitialFocus = (root) => {
|
|
3345
|
+
// Try to find the header (assumed to be the first child)
|
|
3346
|
+
const firstChild = root.firstElementChild;
|
|
3347
|
+
if (firstChild) {
|
|
3348
|
+
// Ensure it's focusable
|
|
3349
|
+
if (firstChild.getAttribute('tabindex') === null) {
|
|
3350
|
+
firstChild.setAttribute('tabindex', '-1');
|
|
3351
|
+
}
|
|
3352
|
+
firstChild.focus();
|
|
3353
|
+
return;
|
|
3354
|
+
}
|
|
3355
|
+
// Fallback to focusable elements
|
|
3356
|
+
const focusableElements = this.getFocusableElements();
|
|
3357
|
+
if (focusableElements.length > 0) {
|
|
3358
|
+
focusableElements[0].focus();
|
|
3359
|
+
}
|
|
3360
|
+
else {
|
|
3361
|
+
// Fallback to container
|
|
3362
|
+
root.focus();
|
|
3363
|
+
}
|
|
3364
|
+
};
|
|
2873
3365
|
}
|
|
3366
|
+
/**
|
|
3367
|
+
* Syncs state with props.
|
|
3368
|
+
*/
|
|
2874
3369
|
static getDerivedStateFromProps(props) {
|
|
2875
3370
|
if (props.open) {
|
|
2876
3371
|
return {
|
|
@@ -2879,13 +3374,36 @@ class Drawer extends React.Component {
|
|
|
2879
3374
|
}
|
|
2880
3375
|
return null;
|
|
2881
3376
|
}
|
|
3377
|
+
/**
|
|
3378
|
+
* Lifecycle method to save the currently focused element when the drawer mounts while open.
|
|
3379
|
+
*/
|
|
3380
|
+
componentDidMount() {
|
|
3381
|
+
if (this.props.open) {
|
|
3382
|
+
this.lastFocusedElement = document.activeElement;
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
/**
|
|
3386
|
+
* Lifecycle method to restore focus when the drawer unmounts.
|
|
3387
|
+
*/
|
|
3388
|
+
componentWillUnmount() {
|
|
3389
|
+
if (this.props.open) {
|
|
3390
|
+
this.restoreFocus();
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
/**
|
|
3394
|
+
* Lifecycle method to handle Drawer updates.
|
|
3395
|
+
* Manages opening/closing logic via LayerManager and focus preservation.
|
|
3396
|
+
*/
|
|
2882
3397
|
getSnapshotBeforeUpdate(prevProps) {
|
|
2883
3398
|
var _a;
|
|
2884
3399
|
const _b = this.props, { open, closeOnEsc, closeOnOverlayClick, overlay, position, children, size } = _b, rest = __rest(_b, ["open", "closeOnEsc", "closeOnOverlayClick", "overlay", "position", "children", "size"]);
|
|
2885
3400
|
if (prevProps.open && !open) {
|
|
2886
3401
|
(_a = this.closeCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
3402
|
+
this.restoreFocus();
|
|
2887
3403
|
}
|
|
2888
3404
|
if (!prevProps.open && open) {
|
|
3405
|
+
// Save current focus
|
|
3406
|
+
this.lastFocusedElement = document.activeElement;
|
|
2889
3407
|
this.layer = LayerManager$1.renderLayer({
|
|
2890
3408
|
overlay,
|
|
2891
3409
|
exitDelay: 300,
|
|
@@ -2893,12 +3411,15 @@ class Drawer extends React.Component {
|
|
|
2893
3411
|
closeCallback: this.onClose,
|
|
2894
3412
|
closeOnEsc,
|
|
2895
3413
|
closeOnOverlayClick,
|
|
2896
|
-
component: (jsxRuntime.jsx(DrawerDiv, Object.assign({}, rest, { position: position, size: size, onClick: (e) => e.stopPropagation(), children: children }))),
|
|
3414
|
+
component: (jsxRuntime.jsx(DrawerDiv, Object.assign({}, rest, { ref: this.setDrawerRef, role: "dialog", "aria-modal": "true", tabIndex: -1, onKeyDown: this.handleKeyDown, position: position, size: size, onClick: (e) => e.stopPropagation(), children: children }))),
|
|
2897
3415
|
});
|
|
2898
3416
|
this.closeCallback = this.layer[1];
|
|
2899
3417
|
this.forceUpdate();
|
|
2900
3418
|
}
|
|
2901
3419
|
}
|
|
3420
|
+
/**
|
|
3421
|
+
* Renders the Drawer component via the LayerManager portal.
|
|
3422
|
+
*/
|
|
2902
3423
|
render() {
|
|
2903
3424
|
if (this.state.open && this.layer) {
|
|
2904
3425
|
const [Component] = this.layer;
|
|
@@ -2907,26 +3428,7 @@ class Drawer extends React.Component {
|
|
|
2907
3428
|
return null;
|
|
2908
3429
|
}
|
|
2909
3430
|
}
|
|
2910
|
-
Drawer.propTypes =
|
|
2911
|
-
/** Opens the drawer */
|
|
2912
|
-
open: PropTypes.bool.isRequired,
|
|
2913
|
-
/** position of the drawer */
|
|
2914
|
-
position: PropTypes.oneOf([
|
|
2915
|
-
exports.DRAWER_POSITION.LEFT,
|
|
2916
|
-
exports.DRAWER_POSITION.RIGHT,
|
|
2917
|
-
exports.DRAWER_POSITION.BOTTOM,
|
|
2918
|
-
]),
|
|
2919
|
-
/** size of the drawer */
|
|
2920
|
-
size: PropTypes.string,
|
|
2921
|
-
/** Shows an overlay behind the drawer. */
|
|
2922
|
-
overlay: PropTypes.bool,
|
|
2923
|
-
/** Closes the drawer on esc */
|
|
2924
|
-
closeOnEsc: PropTypes.bool,
|
|
2925
|
-
/** Closes the drawer on overlay click */
|
|
2926
|
-
closeOnOverlayClick: PropTypes.bool,
|
|
2927
|
-
/** Call back function called when the drawer closes. */
|
|
2928
|
-
onClose: PropTypes.func,
|
|
2929
|
-
};
|
|
3431
|
+
Drawer.propTypes = drawerPropTypes;
|
|
2930
3432
|
Drawer.defaultProps = {
|
|
2931
3433
|
overlay: true,
|
|
2932
3434
|
position: exports.DRAWER_POSITION.LEFT,
|
|
@@ -2936,7 +3438,7 @@ Drawer.defaultProps = {
|
|
|
2936
3438
|
|
|
2937
3439
|
const Container$3 = styled.div `
|
|
2938
3440
|
display: inline-flex;
|
|
2939
|
-
border: 1px solid
|
|
3441
|
+
border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
|
|
2940
3442
|
border-radius: 3px;
|
|
2941
3443
|
margin: 5px;
|
|
2942
3444
|
|
|
@@ -2946,7 +3448,7 @@ const Container$3 = styled.div `
|
|
|
2946
3448
|
margin: 0;
|
|
2947
3449
|
border: none;
|
|
2948
3450
|
border-radius: 0;
|
|
2949
|
-
border-left: 1px solid
|
|
3451
|
+
border-left: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
|
|
2950
3452
|
box-shadow: none;
|
|
2951
3453
|
height: 32px;
|
|
2952
3454
|
}
|
|
@@ -3001,26 +3503,27 @@ const Container$3 = styled.div `
|
|
|
3001
3503
|
|
|
3002
3504
|
&:focus-within,
|
|
3003
3505
|
&:hover {
|
|
3004
|
-
box-shadow:
|
|
3506
|
+
box-shadow: ${getThemeValue(THEME_NAME.HOVER_SHADOW)};
|
|
3005
3507
|
}
|
|
3006
3508
|
|
|
3007
3509
|
${(props) => props.errorText
|
|
3008
3510
|
? `
|
|
3009
|
-
border-color:
|
|
3511
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
3010
3512
|
|
|
3011
3513
|
& > button, & > label {
|
|
3012
|
-
border-color:
|
|
3514
|
+
border-color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
3013
3515
|
}
|
|
3014
3516
|
`
|
|
3015
3517
|
: ''}
|
|
3016
3518
|
`;
|
|
3017
3519
|
const ErrorContainer = styled.div `
|
|
3018
|
-
color:
|
|
3520
|
+
color: ${getThemeValue(THEME_NAME.ERROR)};
|
|
3019
3521
|
margin-left: 8px;
|
|
3020
3522
|
font-size: 12px;
|
|
3021
3523
|
`;
|
|
3022
3524
|
function Group(props) {
|
|
3023
|
-
|
|
3525
|
+
const errorId = React.useId();
|
|
3526
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Container$3, Object.assign({}, props, { "aria-describedby": props.errorText ? errorId : undefined, children: props.children })), props.errorText && jsxRuntime.jsx(ErrorContainer, { id: errorId, children: props.errorText })] }));
|
|
3024
3527
|
}
|
|
3025
3528
|
Group.propTypes = {
|
|
3026
3529
|
/** Error Message for the group */
|
|
@@ -3029,12 +3532,12 @@ Group.propTypes = {
|
|
|
3029
3532
|
|
|
3030
3533
|
var GroupLabel = styled.label `
|
|
3031
3534
|
height: 32px;
|
|
3032
|
-
background-color: ${
|
|
3535
|
+
background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};
|
|
3033
3536
|
padding: 0 4px;
|
|
3034
3537
|
line-height: 32px;
|
|
3035
3538
|
min-width: 24px;
|
|
3036
3539
|
text-align: center;
|
|
3037
|
-
color: ${
|
|
3540
|
+
color: ${getThemeValue(THEME_NAME.BORDER_COLOR)};
|
|
3038
3541
|
|
|
3039
3542
|
& > svg {
|
|
3040
3543
|
height: 24px;
|
|
@@ -3044,14 +3547,41 @@ var GroupLabel = styled.label `
|
|
|
3044
3547
|
}
|
|
3045
3548
|
`;
|
|
3046
3549
|
|
|
3550
|
+
const modalPropTypes = {
|
|
3551
|
+
/** Opens the modal */
|
|
3552
|
+
open: PropTypes.bool.isRequired,
|
|
3553
|
+
/** Closes the modal on esc */
|
|
3554
|
+
closeOnEsc: PropTypes.bool,
|
|
3555
|
+
/** Closes the modal on overlay click */
|
|
3556
|
+
closeOnOverlayClick: PropTypes.bool,
|
|
3557
|
+
/** Call back function called when the modal closes. */
|
|
3558
|
+
onClose: PropTypes.func,
|
|
3559
|
+
};
|
|
3560
|
+
/**
|
|
3561
|
+
* Modal component
|
|
3562
|
+
*
|
|
3563
|
+
* A dialog window that sits on top of the main application content.
|
|
3564
|
+
* It disrupts the user's workflow to demand attention for a critical task or decision.
|
|
3565
|
+
*
|
|
3566
|
+
* Accessibility:
|
|
3567
|
+
* - Implements ARIA `role="dialog"` and `aria-modal="true"`.
|
|
3568
|
+
* - Traps focus effectively within the modal while open.
|
|
3569
|
+
* - Restores focus to the triggering element upon closure.
|
|
3570
|
+
* - Supports closing via ESC key and overlay click.
|
|
3571
|
+
*/
|
|
3047
3572
|
class Modal extends React.Component {
|
|
3048
3573
|
constructor() {
|
|
3049
3574
|
super(...arguments);
|
|
3050
3575
|
this.state = {
|
|
3051
3576
|
open: false,
|
|
3052
3577
|
};
|
|
3578
|
+
/**
|
|
3579
|
+
* Internal close handler.
|
|
3580
|
+
* Restores focus and calls the external onClose callback.
|
|
3581
|
+
*/
|
|
3053
3582
|
this.onClose = () => {
|
|
3054
3583
|
var _a, _b;
|
|
3584
|
+
this.restoreFocus();
|
|
3055
3585
|
this.setState({
|
|
3056
3586
|
open: false,
|
|
3057
3587
|
});
|
|
@@ -3059,7 +3589,97 @@ class Modal extends React.Component {
|
|
|
3059
3589
|
this.closeCallback = null;
|
|
3060
3590
|
this.layer = null;
|
|
3061
3591
|
};
|
|
3592
|
+
this.lastFocusedElement = null;
|
|
3593
|
+
this.modalRef = React.createRef();
|
|
3594
|
+
/**
|
|
3595
|
+
* Retrieves all focusable elements within the modal.
|
|
3596
|
+
*/
|
|
3597
|
+
this.getFocusableElements = () => {
|
|
3598
|
+
if (!this.modalRef.current)
|
|
3599
|
+
return [];
|
|
3600
|
+
return Array.from(this.modalRef.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));
|
|
3601
|
+
};
|
|
3602
|
+
/**
|
|
3603
|
+
* Handles keydown events to implement the focus trap.
|
|
3604
|
+
* Traps Tab and Shift+Tab within the modal.
|
|
3605
|
+
*/
|
|
3606
|
+
this.handleKeyDown = (e) => {
|
|
3607
|
+
if (e.key === 'Tab') {
|
|
3608
|
+
const focusableElements = this.getFocusableElements();
|
|
3609
|
+
if (focusableElements.length === 0)
|
|
3610
|
+
return;
|
|
3611
|
+
const firstElement = focusableElements[0];
|
|
3612
|
+
const lastElement = focusableElements[focusableElements.length - 1];
|
|
3613
|
+
if (e.shiftKey) {
|
|
3614
|
+
if (document.activeElement === firstElement) {
|
|
3615
|
+
lastElement.focus();
|
|
3616
|
+
e.preventDefault();
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3619
|
+
else {
|
|
3620
|
+
if (document.activeElement === lastElement) {
|
|
3621
|
+
firstElement.focus();
|
|
3622
|
+
e.preventDefault();
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
};
|
|
3627
|
+
/**
|
|
3628
|
+
* Restores focus to the element that was focused before the modal opened.
|
|
3629
|
+
*/
|
|
3630
|
+
this.restoreFocus = () => {
|
|
3631
|
+
if (this.lastFocusedElement) {
|
|
3632
|
+
// Check if the element is still in the document
|
|
3633
|
+
const elementToBeFocused = this.lastFocusedElement;
|
|
3634
|
+
this.lastFocusedElement = null;
|
|
3635
|
+
setTimeout(() => {
|
|
3636
|
+
if (document.body.contains(elementToBeFocused)) {
|
|
3637
|
+
elementToBeFocused.focus();
|
|
3638
|
+
}
|
|
3639
|
+
}, 100);
|
|
3640
|
+
}
|
|
3641
|
+
};
|
|
3642
|
+
/**
|
|
3643
|
+
* Callback ref to capture the Modal DOM element.
|
|
3644
|
+
* Triggers initial focus setting when the element mounts.
|
|
3645
|
+
*/
|
|
3646
|
+
this.setModalRef = (node) => {
|
|
3647
|
+
// Update ref
|
|
3648
|
+
this.modalRef.current = node;
|
|
3649
|
+
if (node) {
|
|
3650
|
+
// Set initial focus when the node is mounted
|
|
3651
|
+
this.setInitialFocus(node);
|
|
3652
|
+
}
|
|
3653
|
+
};
|
|
3654
|
+
/**
|
|
3655
|
+
* Sets initial focus within the modal.
|
|
3656
|
+
* Tries to focus the header (first child) first, then the first interactive element, or falls back to the container.
|
|
3657
|
+
*/
|
|
3658
|
+
this.setInitialFocus = (root) => {
|
|
3659
|
+
// Try to find the header (assumed to be the first child)
|
|
3660
|
+
const firstChild = root.firstElementChild;
|
|
3661
|
+
if (firstChild) {
|
|
3662
|
+
// Ensure it's focusable
|
|
3663
|
+
if (firstChild.getAttribute('tabindex') === null) {
|
|
3664
|
+
firstChild.setAttribute('tabindex', '-1');
|
|
3665
|
+
}
|
|
3666
|
+
firstChild.focus();
|
|
3667
|
+
return;
|
|
3668
|
+
}
|
|
3669
|
+
// Fallback to focusable elements
|
|
3670
|
+
const focusableElements = this.getFocusableElements();
|
|
3671
|
+
if (focusableElements.length > 0) {
|
|
3672
|
+
focusableElements[0].focus();
|
|
3673
|
+
}
|
|
3674
|
+
else {
|
|
3675
|
+
// Fallback to container
|
|
3676
|
+
root.focus();
|
|
3677
|
+
}
|
|
3678
|
+
};
|
|
3062
3679
|
}
|
|
3680
|
+
/**
|
|
3681
|
+
* Syncs state with props.
|
|
3682
|
+
*/
|
|
3063
3683
|
static getDerivedStateFromProps(props) {
|
|
3064
3684
|
if (props.open) {
|
|
3065
3685
|
return {
|
|
@@ -3068,13 +3688,36 @@ class Modal extends React.Component {
|
|
|
3068
3688
|
}
|
|
3069
3689
|
return null;
|
|
3070
3690
|
}
|
|
3691
|
+
/**
|
|
3692
|
+
* Lifecycle method to save the currently focused element when the modal mounts while open.
|
|
3693
|
+
*/
|
|
3694
|
+
componentDidMount() {
|
|
3695
|
+
if (this.props.open) {
|
|
3696
|
+
this.lastFocusedElement = document.activeElement;
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
/**
|
|
3700
|
+
* Lifecycle method to restore focus when the modal unmounts.
|
|
3701
|
+
*/
|
|
3702
|
+
componentWillUnmount() {
|
|
3703
|
+
if (this.props.open) {
|
|
3704
|
+
this.restoreFocus();
|
|
3705
|
+
}
|
|
3706
|
+
}
|
|
3707
|
+
/**
|
|
3708
|
+
* Lifecycle method to handle Modal updates.
|
|
3709
|
+
* Manages opening/closing logic via LayerManager and focus preservation.
|
|
3710
|
+
*/
|
|
3071
3711
|
getSnapshotBeforeUpdate(prevProps) {
|
|
3072
3712
|
var _a;
|
|
3073
3713
|
const _b = this.props, { open, closeOnEsc, closeOnOverlayClick, children } = _b, rest = __rest(_b, ["open", "closeOnEsc", "closeOnOverlayClick", "children"]);
|
|
3074
3714
|
if (prevProps.open && !open) {
|
|
3075
3715
|
(_a = this.closeCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
3716
|
+
this.restoreFocus();
|
|
3076
3717
|
}
|
|
3077
3718
|
if (!prevProps.open && open) {
|
|
3719
|
+
// Save current focus
|
|
3720
|
+
this.lastFocusedElement = document.activeElement;
|
|
3078
3721
|
this.layer = LayerManager$1.renderLayer({
|
|
3079
3722
|
overlay: true,
|
|
3080
3723
|
exitDelay: 300,
|
|
@@ -3082,12 +3725,15 @@ class Modal extends React.Component {
|
|
|
3082
3725
|
closeCallback: this.onClose,
|
|
3083
3726
|
closeOnEsc: closeOnEsc,
|
|
3084
3727
|
closeOnOverlayClick: closeOnOverlayClick,
|
|
3085
|
-
component: (jsxRuntime.jsx(DialogContainer, Object.assign({}, rest, { onClick: (e) => e.stopPropagation(), elevated: true, children: children }))),
|
|
3728
|
+
component: (jsxRuntime.jsx(DialogContainer, Object.assign({}, rest, { ref: this.setModalRef, role: "dialog", "aria-modal": "true", tabIndex: -1, onKeyDown: this.handleKeyDown, onClick: (e) => e.stopPropagation(), elevated: true, children: children }))),
|
|
3086
3729
|
});
|
|
3087
3730
|
this.closeCallback = this.layer[1];
|
|
3088
3731
|
this.forceUpdate();
|
|
3089
3732
|
}
|
|
3090
3733
|
}
|
|
3734
|
+
/**
|
|
3735
|
+
* Renders the Modal component via the LayerManager portal.
|
|
3736
|
+
*/
|
|
3091
3737
|
render() {
|
|
3092
3738
|
if (this.state.open && this.layer) {
|
|
3093
3739
|
const [Component] = this.layer;
|
|
@@ -3096,16 +3742,7 @@ class Modal extends React.Component {
|
|
|
3096
3742
|
return null;
|
|
3097
3743
|
}
|
|
3098
3744
|
}
|
|
3099
|
-
Modal.propTypes =
|
|
3100
|
-
/** Opens the modal */
|
|
3101
|
-
open: PropTypes.bool.isRequired,
|
|
3102
|
-
/** Closes the modal on esc */
|
|
3103
|
-
closeOnEsc: PropTypes.bool,
|
|
3104
|
-
/** Closes the modal on overlay click */
|
|
3105
|
-
closeOnOverlayClick: PropTypes.bool,
|
|
3106
|
-
/** Call back function called when the modal closes. */
|
|
3107
|
-
onClose: PropTypes.func,
|
|
3108
|
-
};
|
|
3745
|
+
Modal.propTypes = modalPropTypes;
|
|
3109
3746
|
Modal.defaultProps = {
|
|
3110
3747
|
closeOnEsc: true,
|
|
3111
3748
|
closeOnOverlayClick: true,
|
|
@@ -3149,37 +3786,37 @@ const getExitAnimation = (position) => {
|
|
|
3149
3786
|
const getBorderColor = (type) => {
|
|
3150
3787
|
switch (type) {
|
|
3151
3788
|
case exports.NOTIFICATION_TYPE.SUCCESS:
|
|
3152
|
-
return
|
|
3789
|
+
return getThemeValue(THEME_NAME.SUCCESS_LIGHT);
|
|
3153
3790
|
case exports.NOTIFICATION_TYPE.DANGER:
|
|
3154
|
-
return
|
|
3791
|
+
return getThemeValue(THEME_NAME.ERROR_LIGHT);
|
|
3155
3792
|
case exports.NOTIFICATION_TYPE.WARNING:
|
|
3156
|
-
return
|
|
3793
|
+
return getThemeValue(THEME_NAME.WARNING_LIGHT);
|
|
3157
3794
|
default:
|
|
3158
|
-
return
|
|
3795
|
+
return getThemeValue(THEME_NAME.INFO_LIGHT);
|
|
3159
3796
|
}
|
|
3160
3797
|
};
|
|
3161
3798
|
const getTitleColor = (type) => {
|
|
3162
3799
|
switch (type) {
|
|
3163
3800
|
case exports.NOTIFICATION_TYPE.SUCCESS:
|
|
3164
|
-
return
|
|
3801
|
+
return getThemeValue(THEME_NAME.SUCCESS);
|
|
3165
3802
|
case exports.NOTIFICATION_TYPE.DANGER:
|
|
3166
|
-
return
|
|
3803
|
+
return getThemeValue(THEME_NAME.ERROR);
|
|
3167
3804
|
case exports.NOTIFICATION_TYPE.WARNING:
|
|
3168
|
-
return
|
|
3805
|
+
return getThemeValue(THEME_NAME.WARNING);
|
|
3169
3806
|
case exports.NOTIFICATION_TYPE.INFO:
|
|
3170
|
-
return
|
|
3807
|
+
return getThemeValue(THEME_NAME.INFO);
|
|
3171
3808
|
}
|
|
3172
3809
|
};
|
|
3173
3810
|
const getTypeStyle = (type) => {
|
|
3174
3811
|
switch (type) {
|
|
3175
3812
|
case exports.NOTIFICATION_TYPE.INFO:
|
|
3176
|
-
return `color:
|
|
3813
|
+
return `color: ${getThemeValue(THEME_NAME.INFO)}`;
|
|
3177
3814
|
case exports.NOTIFICATION_TYPE.SUCCESS:
|
|
3178
|
-
return `color:
|
|
3815
|
+
return `color: ${getThemeValue(THEME_NAME.SUCCESS)}`;
|
|
3179
3816
|
case exports.NOTIFICATION_TYPE.DANGER:
|
|
3180
|
-
return `color:
|
|
3817
|
+
return `color: ${getThemeValue(THEME_NAME.ERROR)}`;
|
|
3181
3818
|
case exports.NOTIFICATION_TYPE.WARNING:
|
|
3182
|
-
return `color:
|
|
3819
|
+
return `color: ${getThemeValue(THEME_NAME.WARNING)}`;
|
|
3183
3820
|
}
|
|
3184
3821
|
};
|
|
3185
3822
|
const Container$2 = styled.div `
|
|
@@ -3190,6 +3827,7 @@ const Container$2 = styled.div `
|
|
|
3190
3827
|
: 'column-reverse'};
|
|
3191
3828
|
`;
|
|
3192
3829
|
const Notice = styled(Card) `
|
|
3830
|
+
position: relative;
|
|
3193
3831
|
border-radius: 3px;
|
|
3194
3832
|
border-left: 4px solid ${(props) => getBorderColor(props.type)};
|
|
3195
3833
|
width: 300px;
|
|
@@ -3276,13 +3914,16 @@ const FillParent = styled.div `
|
|
|
3276
3914
|
flex: 1;
|
|
3277
3915
|
`;
|
|
3278
3916
|
const CloseButton = styled.button `
|
|
3917
|
+
position: absolute;
|
|
3279
3918
|
background-color: transparent;
|
|
3280
3919
|
border: none;
|
|
3281
|
-
padding:
|
|
3920
|
+
padding: 0;
|
|
3921
|
+
top: 4px;
|
|
3922
|
+
right: 4px;
|
|
3282
3923
|
cursor: pointer;
|
|
3283
3924
|
|
|
3284
3925
|
&:focus {
|
|
3285
|
-
box-shadow: 0 0 0 3px
|
|
3926
|
+
box-shadow: 0 0 0 3px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
3286
3927
|
border-radius: 3px;
|
|
3287
3928
|
}
|
|
3288
3929
|
`;
|
|
@@ -3299,6 +3940,17 @@ const Footer = styled.div `
|
|
|
3299
3940
|
justify-content: flex-end;
|
|
3300
3941
|
padding: 0 5px;
|
|
3301
3942
|
`;
|
|
3943
|
+
const VisuallyHidden = styled.span `
|
|
3944
|
+
position: absolute;
|
|
3945
|
+
width: 1px;
|
|
3946
|
+
height: 1px;
|
|
3947
|
+
padding: 0;
|
|
3948
|
+
margin: -1px;
|
|
3949
|
+
overflow: hidden;
|
|
3950
|
+
clip: rect(0, 0, 0, 0);
|
|
3951
|
+
white-space: nowrap;
|
|
3952
|
+
border: 0;
|
|
3953
|
+
`;
|
|
3302
3954
|
|
|
3303
3955
|
const DEFAULT_DURATION$1 = 5000;
|
|
3304
3956
|
/**
|
|
@@ -3314,6 +3966,9 @@ class NotificationManager extends React.Component {
|
|
|
3314
3966
|
this.timeouts = {};
|
|
3315
3967
|
// Set of notification ids
|
|
3316
3968
|
this.set = new Set();
|
|
3969
|
+
// Refs for live regions to ensure they exist before updates
|
|
3970
|
+
this.politeRegionRef = React.createRef();
|
|
3971
|
+
this.assertiveRegionRef = React.createRef();
|
|
3317
3972
|
/**
|
|
3318
3973
|
* Removes a notification from stack if the notification with the given id is found.
|
|
3319
3974
|
*
|
|
@@ -3356,17 +4011,23 @@ class NotificationManager extends React.Component {
|
|
|
3356
4011
|
*
|
|
3357
4012
|
* @param notice
|
|
3358
4013
|
*/
|
|
3359
|
-
this.add = (notice) => {
|
|
4014
|
+
this.add = (notice) => __awaiter(this, void 0, void 0, function* () {
|
|
3360
4015
|
// Generate unique id if not provided.
|
|
3361
4016
|
const id = notice.id || (Math.random() * Math.pow(10, 7)).toFixed(0);
|
|
3362
4017
|
// De-dupe on id
|
|
3363
4018
|
if (!this.set.has(id)) {
|
|
4019
|
+
const type = notice.type || exports.NOTIFICATION_TYPE.INFO;
|
|
4020
|
+
const isUrgent = type === exports.NOTIFICATION_TYPE.WARNING || type === exports.NOTIFICATION_TYPE.DANGER;
|
|
3364
4021
|
// Add notice to the top of stack.
|
|
3365
4022
|
this.setState({
|
|
3366
4023
|
notices: [
|
|
3367
4024
|
Object.assign(Object.assign({}, notice), { id }),
|
|
3368
4025
|
...this.state.notices,
|
|
3369
4026
|
],
|
|
4027
|
+
}, () => {
|
|
4028
|
+
// Update live region after state update
|
|
4029
|
+
const announcement = `${notice.title} ${notice.description}`;
|
|
4030
|
+
this.updateLiveRegion(announcement, isUrgent);
|
|
3370
4031
|
});
|
|
3371
4032
|
// set timeout for closing the notification.
|
|
3372
4033
|
if (!notice.sticky) {
|
|
@@ -3376,6 +4037,23 @@ class NotificationManager extends React.Component {
|
|
|
3376
4037
|
this.set.add(id);
|
|
3377
4038
|
}
|
|
3378
4039
|
return id;
|
|
4040
|
+
});
|
|
4041
|
+
/**
|
|
4042
|
+
* Update live region content with clear-then-set pattern for reliable VoiceOver announcements.
|
|
4043
|
+
*
|
|
4044
|
+
* @param content - The text content to announce
|
|
4045
|
+
* @param isAssertive - Whether to use assertive (alert) or polite (log) live region
|
|
4046
|
+
*/
|
|
4047
|
+
this.updateLiveRegion = (content, isAssertive) => {
|
|
4048
|
+
const region = isAssertive ? this.assertiveRegionRef.current : this.politeRegionRef.current;
|
|
4049
|
+
if (region) {
|
|
4050
|
+
// Add content after delay
|
|
4051
|
+
setTimeout(() => {
|
|
4052
|
+
if (region) {
|
|
4053
|
+
region.textContent = content;
|
|
4054
|
+
}
|
|
4055
|
+
}, 150);
|
|
4056
|
+
}
|
|
3379
4057
|
};
|
|
3380
4058
|
/**
|
|
3381
4059
|
* Handler for close button click.
|
|
@@ -3406,12 +4084,12 @@ class NotificationManager extends React.Component {
|
|
|
3406
4084
|
};
|
|
3407
4085
|
}
|
|
3408
4086
|
render() {
|
|
3409
|
-
return (jsxRuntime.
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
4087
|
+
return (jsxRuntime.jsxs(Container$2, { position: this.props.position, children: [jsxRuntime.jsx(VisuallyHidden, { ref: this.politeRegionRef, role: "log", "aria-live": "polite", "aria-atomic": "false", "aria-relevant": "additions text" }), jsxRuntime.jsx(VisuallyHidden, { ref: this.assertiveRegionRef, role: "alert", "aria-live": "assertive", "aria-atomic": "true" }), jsxRuntime.jsx("div", { role: "list", "aria-label": this.props.ariaLabel, children: this.state.notices.map((notice) => {
|
|
4088
|
+
const { id, title, description, leaving, type = exports.NOTIFICATION_TYPE.INFO, buttonText, buttonClick, closeButtonAriaLabel, } = notice;
|
|
4089
|
+
return (jsxRuntime.jsxs(Notice, Object.assign({}, notice, { position: this.props.position, className: leaving ? 'leave' : '', onMouseEnter: this.pause(id), onMouseLeave: this.resume(id), role: "listitem", children: [jsxRuntime.jsxs(IconContainer, { type: type, "aria-hidden": "true", 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.jsx(Title, { type: type, children: title }), jsxRuntime.jsx(Body, { children: description }), buttonText && (jsxRuntime.jsx(Footer, { children: jsxRuntime.jsx(ActionButton, { onClick: () => {
|
|
4090
|
+
buttonClick === null || buttonClick === void 0 ? void 0 : buttonClick();
|
|
4091
|
+
}, children: buttonText }) }))] }), jsxRuntime.jsx(CloseButton, { onClick: this.closeClickHandler(id), "aria-label": closeButtonAriaLabel || 'Close notification', tabIndex: 0, children: jsxRuntime.jsx(Close, {}) })] }), id));
|
|
4092
|
+
}) })] }));
|
|
3415
4093
|
}
|
|
3416
4094
|
}
|
|
3417
4095
|
|
|
@@ -3445,6 +4123,8 @@ StoryProps.propTypes = {
|
|
|
3445
4123
|
buttonClick: PropTypes.func,
|
|
3446
4124
|
/** Notification close callback. */
|
|
3447
4125
|
onClose: PropTypes.func,
|
|
4126
|
+
/** Aria label for the close button on the notification. Defaults to "Close notification" */
|
|
4127
|
+
closeButtonAriaLabel: PropTypes.string,
|
|
3448
4128
|
};
|
|
3449
4129
|
StoryProps.defaultProps = {
|
|
3450
4130
|
duration: 5000,
|
|
@@ -3470,7 +4150,7 @@ class Notification {
|
|
|
3470
4150
|
* @param options - Configuration options for the notification
|
|
3471
4151
|
* @returns The notification ID or a promise that resolves to the notification ID
|
|
3472
4152
|
*/
|
|
3473
|
-
this.add = (position, options) => {
|
|
4153
|
+
this.add = (position, options, ariaLabel = 'Notifications') => {
|
|
3474
4154
|
if (!this.containers.has(position)) {
|
|
3475
4155
|
/** Callback ref to capture the NotificationManager instance when it mounts */
|
|
3476
4156
|
const refCallback = (instance) => {
|
|
@@ -3486,7 +4166,7 @@ class Notification {
|
|
|
3486
4166
|
closeOnOverlayClick: false,
|
|
3487
4167
|
position: positionMap[position],
|
|
3488
4168
|
alwaysOnTop: true,
|
|
3489
|
-
component: (jsxRuntime.jsx(NotificationManager, { ref: refCallback, position: position, onEmpty: () => this.destroy(position) })),
|
|
4169
|
+
component: (jsxRuntime.jsx(NotificationManager, { ref: refCallback, position: position, onEmpty: () => this.destroy(position), ariaLabel: ariaLabel })),
|
|
3490
4170
|
});
|
|
3491
4171
|
// Create a div to mount the Component
|
|
3492
4172
|
const div = document.createElement('div');
|
|
@@ -3550,8 +4230,8 @@ class Notification {
|
|
|
3550
4230
|
var Notification$1 = new Notification();
|
|
3551
4231
|
|
|
3552
4232
|
const SpinnerDiv = styled.div `
|
|
3553
|
-
border: 4px solid
|
|
3554
|
-
border-top: 4px solid
|
|
4233
|
+
border: 4px solid ${getThemeValue(THEME_NAME.PRIMARY)};
|
|
4234
|
+
border-top: 4px solid ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};
|
|
3555
4235
|
border-radius: 50%;
|
|
3556
4236
|
width: ${(props) => props.size}px;
|
|
3557
4237
|
height: ${(props) => props.size}px;
|
|
@@ -3568,14 +4248,18 @@ const SpinnerDiv = styled.div `
|
|
|
3568
4248
|
}
|
|
3569
4249
|
`;
|
|
3570
4250
|
function Spinner(props) {
|
|
3571
|
-
|
|
4251
|
+
const { label } = props, rest = __rest(props, ["label"]);
|
|
4252
|
+
return (jsxRuntime.jsx(SpinnerDiv, Object.assign({}, rest, { role: "status", "aria-label": label, "aria-live": "polite", "aria-busy": "true" })));
|
|
3572
4253
|
}
|
|
3573
4254
|
Spinner.propTypes = {
|
|
3574
4255
|
/** Spinner's size */
|
|
3575
4256
|
size: PropTypes.number,
|
|
4257
|
+
/** Accessible label for screen readers */
|
|
4258
|
+
label: PropTypes.string,
|
|
3576
4259
|
};
|
|
3577
4260
|
Spinner.defaultProps = {
|
|
3578
4261
|
size: 30,
|
|
4262
|
+
label: 'Loading',
|
|
3579
4263
|
};
|
|
3580
4264
|
|
|
3581
4265
|
const Container$1 = styled.div `
|
|
@@ -3588,7 +4272,7 @@ const Header = styled.div `
|
|
|
3588
4272
|
display: flex;
|
|
3589
4273
|
flex-direction: row;
|
|
3590
4274
|
justify-content: space-between;
|
|
3591
|
-
border-bottom: 1px solid
|
|
4275
|
+
border-bottom: 1px solid ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};
|
|
3592
4276
|
|
|
3593
4277
|
@media (min-width: 601px) {
|
|
3594
4278
|
&::before {
|
|
@@ -3597,7 +4281,7 @@ const Header = styled.div `
|
|
|
3597
4281
|
left: 0;
|
|
3598
4282
|
right: 0;
|
|
3599
4283
|
height: 2px;
|
|
3600
|
-
background-color:
|
|
4284
|
+
background-color: ${getThemeValue(THEME_NAME.LIGHT_GREY)};
|
|
3601
4285
|
content: ' ';
|
|
3602
4286
|
z-index: 0;
|
|
3603
4287
|
}
|
|
@@ -3613,21 +4297,22 @@ const HeaderButton = styled.button `
|
|
|
3613
4297
|
font-size: 16px;
|
|
3614
4298
|
cursor: pointer;
|
|
3615
4299
|
background-color: ${(props) => props.active
|
|
3616
|
-
?
|
|
3617
|
-
:
|
|
4300
|
+
? getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)
|
|
4301
|
+
: getThemeValue(THEME_NAME.BACKGROUND)};
|
|
3618
4302
|
font-weight: ${(props) => (props.active ? 'bold' : 'normal')};
|
|
3619
4303
|
overflow: hidden;
|
|
3620
4304
|
display: flex;
|
|
3621
4305
|
align-items: center;
|
|
4306
|
+
color: ${getThemeValue(THEME_NAME.TEXT_COLOR_DARK)};
|
|
3622
4307
|
|
|
3623
4308
|
&:disabled {
|
|
3624
4309
|
cursor: not-allowed;
|
|
3625
|
-
background-color:
|
|
4310
|
+
background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};
|
|
3626
4311
|
}
|
|
3627
4312
|
|
|
3628
4313
|
&:enabled:hover,
|
|
3629
4314
|
&:focus {
|
|
3630
|
-
background-color:
|
|
4315
|
+
background-color: ${getThemeValue(THEME_NAME.PRIMARY_LIGHTER)};
|
|
3631
4316
|
}
|
|
3632
4317
|
|
|
3633
4318
|
@media (max-width: 600px) {
|
|
@@ -3657,9 +4342,13 @@ function Stepper(props) {
|
|
|
3657
4342
|
const [active, setActive] = React.useState(props.active);
|
|
3658
4343
|
const { children, onStepClick } = props;
|
|
3659
4344
|
const childrenArray = React.Children.toArray(children);
|
|
4345
|
+
const stepRefs = [];
|
|
3660
4346
|
const stepClickHandler = (index) => () => {
|
|
4347
|
+
var _a;
|
|
3661
4348
|
setActive(index);
|
|
3662
4349
|
onStepClick === null || onStepClick === void 0 ? void 0 : onStepClick(index);
|
|
4350
|
+
// Move focus to the active step
|
|
4351
|
+
(_a = stepRefs[index]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
3663
4352
|
};
|
|
3664
4353
|
const getBadgeType = (index, completed, disabled) => {
|
|
3665
4354
|
if (disabled) {
|
|
@@ -3673,10 +4362,24 @@ function Stepper(props) {
|
|
|
3673
4362
|
}
|
|
3674
4363
|
return exports.BADGE_TYPE.DISABLED;
|
|
3675
4364
|
};
|
|
3676
|
-
|
|
4365
|
+
// Keyboard navigation for step buttons
|
|
4366
|
+
const onStepKeyDown = (index) => (e) => {
|
|
4367
|
+
var _a, _b;
|
|
4368
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowDown') {
|
|
4369
|
+
e.preventDefault();
|
|
4370
|
+
const next = (index + 1) % childrenArray.length;
|
|
4371
|
+
(_a = stepRefs[next]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4372
|
+
}
|
|
4373
|
+
else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {
|
|
4374
|
+
e.preventDefault();
|
|
4375
|
+
const prev = (index - 1 + childrenArray.length) % childrenArray.length;
|
|
4376
|
+
(_b = stepRefs[prev]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
4377
|
+
}
|
|
4378
|
+
};
|
|
4379
|
+
return (jsxRuntime.jsxs(Container$1, { children: [jsxRuntime.jsxs(Header, { role: "tablist", "aria-label": "Stepper Steps", children: [React.Children.map(children, (child, index) => {
|
|
3677
4380
|
if (!React.isValidElement(child))
|
|
3678
4381
|
return null;
|
|
3679
|
-
return (jsxRuntime.
|
|
4382
|
+
return (jsxRuntime.jsxs(HeaderButton, { ref: (el) => (stepRefs[index] = el), active: index === active, type: "button", role: "tab", "aria-selected": index === active, "aria-disabled": !!child.props.disabled, tabIndex: index === active ? 0 : -1, disabled: child.props.disabled, onClick: stepClickHandler(index), onKeyDown: onStepKeyDown(index), children: [jsxRuntime.jsx(Badge, { inline: true, type: getBadgeType(index, child.props.completed, child.props.disabled) }), jsxRuntime.jsx(Ellipsis, { children: child.props.name })] }));
|
|
3680
4383
|
}), jsxRuntime.jsxs(MobileHeader, { children: [jsxRuntime.jsx("span", { children: React.isValidElement(childrenArray[active])
|
|
3681
4384
|
? childrenArray[active].props.name
|
|
3682
4385
|
: '' }), jsxRuntime.jsxs(Badge, { inline: true, type: exports.BADGE_TYPE.PRIMARY, children: [active + 1, " of ", React.Children.count(children)] })] })] }), childrenArray[active]] }));
|
|
@@ -3712,26 +4415,28 @@ const Button = styled.button `
|
|
|
3712
4415
|
padding: 8px 12px;
|
|
3713
4416
|
font-size: 14px;
|
|
3714
4417
|
border-radius: 3px 3px 0 0;
|
|
3715
|
-
border-bottom: ${(props) => props.active ? `3px solid
|
|
3716
|
-
color: ${(props) =>
|
|
4418
|
+
border-bottom: ${(props) => props.active ? `3px solid ${getThemeValue(THEME_NAME.PRIMARY)}` : 'none'};
|
|
4419
|
+
color: ${(props) => props.active
|
|
4420
|
+
? getThemeValue(THEME_NAME.PRIMARY)
|
|
4421
|
+
: getThemeValue(THEME_NAME.TEXT_COLOR_DARK)};
|
|
3717
4422
|
cursor: pointer;
|
|
3718
4423
|
|
|
3719
4424
|
&:hover,
|
|
3720
4425
|
&:focus {
|
|
3721
|
-
background-color:
|
|
4426
|
+
background-color: ${getThemeValue(THEME_NAME.PRIMARY_LIGHTER)};
|
|
3722
4427
|
border-bottom: ${(props) => props.active
|
|
3723
|
-
? `3px solid
|
|
3724
|
-
: `3px solid
|
|
4428
|
+
? `3px solid ${getThemeValue(THEME_NAME.PRIMARY)}`
|
|
4429
|
+
: `3px solid ${getThemeValue(THEME_NAME.PRIMARY)}`};
|
|
3725
4430
|
}
|
|
3726
4431
|
|
|
3727
4432
|
&[disabled] {
|
|
3728
|
-
background-color:
|
|
3729
|
-
color:
|
|
3730
|
-
border-bottom: 3px solid
|
|
4433
|
+
background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};
|
|
4434
|
+
color: ${getThemeValue(THEME_NAME.DISABLED)};
|
|
4435
|
+
border-bottom: 3px solid ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
3731
4436
|
}
|
|
3732
4437
|
`;
|
|
3733
4438
|
const ButtonContainer = styled.div `
|
|
3734
|
-
border-bottom: 1px solid
|
|
4439
|
+
border-bottom: 1px solid ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
|
|
3735
4440
|
margin-bottom: 5px;
|
|
3736
4441
|
position: relative;
|
|
3737
4442
|
`;
|
|
@@ -3740,14 +4445,45 @@ const TabBody = styled.div `
|
|
|
3740
4445
|
`;
|
|
3741
4446
|
function Tabs(props) {
|
|
3742
4447
|
const [active, setActive] = React.useState(props.active);
|
|
3743
|
-
const switchTab = (index) => () => setActive(index);
|
|
3744
4448
|
const { children } = props;
|
|
4449
|
+
const tabRefs = [];
|
|
4450
|
+
const childrenArray = React.Children.toArray(children);
|
|
4451
|
+
const switchTab = (index) => () => {
|
|
4452
|
+
var _a, _b;
|
|
4453
|
+
setActive(index);
|
|
4454
|
+
(_a = tabRefs[index]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4455
|
+
(_b = props.onChange) === null || _b === void 0 ? void 0 : _b.call(props, index);
|
|
4456
|
+
};
|
|
4457
|
+
// Keyboard navigation for tab buttons
|
|
4458
|
+
const onTabKeyDown = (index) => (e) => {
|
|
4459
|
+
var _a, _b;
|
|
4460
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowDown') {
|
|
4461
|
+
e.preventDefault();
|
|
4462
|
+
const next = (index + 1) % childrenArray.length;
|
|
4463
|
+
(_a = tabRefs[next]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4464
|
+
}
|
|
4465
|
+
else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {
|
|
4466
|
+
e.preventDefault();
|
|
4467
|
+
const prev = (index - 1 + childrenArray.length) % childrenArray.length;
|
|
4468
|
+
(_b = tabRefs[prev]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
4469
|
+
}
|
|
4470
|
+
};
|
|
3745
4471
|
React.useEffect(() => {
|
|
3746
4472
|
var _a;
|
|
3747
4473
|
setActive(props.active);
|
|
3748
4474
|
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, props.active);
|
|
3749
4475
|
}, [props]);
|
|
3750
|
-
|
|
4476
|
+
// Generate unique IDs for tabs and panels using sanitized tab name and index
|
|
4477
|
+
const sanitize = (str) => str.replace(/[^a-zA-Z0-9_-]/g, '').toLowerCase();
|
|
4478
|
+
const tabIds = childrenArray.map((child, i) => {
|
|
4479
|
+
const name = React.isValidElement(child) && child.props.name ? child.props.name : `tab${i}`;
|
|
4480
|
+
return `nfui-tab-${sanitize(name)}-${i}`;
|
|
4481
|
+
});
|
|
4482
|
+
const panelIds = childrenArray.map((child, i) => {
|
|
4483
|
+
const name = React.isValidElement(child) && child.props.name ? child.props.name : `tab${i}`;
|
|
4484
|
+
return `nfui-tabpanel-${sanitize(name)}-${i}`;
|
|
4485
|
+
});
|
|
4486
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ButtonContainer, Object.assign({ role: "tablist", "aria-label": "Tabs" }, props.props, { children: childrenArray.map((child, index) => (jsxRuntime.jsx(Button, { ref: (el) => (tabRefs[index] = el), id: tabIds[index], type: "button", role: "tab", "aria-selected": active === index, "aria-controls": panelIds[index], tabIndex: active === index ? 0 : -1, active: active === index, onClick: switchTab(index), onKeyDown: onTabKeyDown(index), disabled: React.isValidElement(child) ? child.props.disabled : false, "aria-disabled": React.isValidElement(child) ? child.props.disabled : false, children: React.isValidElement(child) ? child.props.name : '' }, tabIds[index]))) })), jsxRuntime.jsx(TabBody, Object.assign({ id: panelIds[active], role: "tabpanel", "aria-labelledby": tabIds[active], tabIndex: 0 }, props.bodyProps, { children: childrenArray[active] }))] }));
|
|
3751
4487
|
}
|
|
3752
4488
|
Tabs.propTypes = {
|
|
3753
4489
|
/** Active Tab Index */
|
|
@@ -3788,15 +4524,15 @@ exports.TOAST_TYPE = void 0;
|
|
|
3788
4524
|
const getBackgroundColor = (type) => {
|
|
3789
4525
|
switch (type) {
|
|
3790
4526
|
case exports.TOAST_TYPE.INFO:
|
|
3791
|
-
return
|
|
4527
|
+
return getThemeValue(THEME_NAME.INFO);
|
|
3792
4528
|
case exports.TOAST_TYPE.SUCCESS:
|
|
3793
|
-
return
|
|
4529
|
+
return getThemeValue(THEME_NAME.SUCCESS);
|
|
3794
4530
|
case exports.TOAST_TYPE.WARNING:
|
|
3795
|
-
return
|
|
4531
|
+
return getThemeValue(THEME_NAME.WARNING);
|
|
3796
4532
|
case exports.TOAST_TYPE.DANGER:
|
|
3797
|
-
return
|
|
4533
|
+
return getThemeValue(THEME_NAME.ERROR);
|
|
3798
4534
|
case exports.TOAST_TYPE.NORMAL:
|
|
3799
|
-
return
|
|
4535
|
+
return getThemeValue(THEME_NAME.TOAST);
|
|
3800
4536
|
}
|
|
3801
4537
|
};
|
|
3802
4538
|
const ToastContainer = styled(Card) `
|
|
@@ -3804,7 +4540,7 @@ const ToastContainer = styled(Card) `
|
|
|
3804
4540
|
border-radius: 3px;
|
|
3805
4541
|
padding: 12px;
|
|
3806
4542
|
background-color: ${(props) => getBackgroundColor(props.type)};
|
|
3807
|
-
color:
|
|
4543
|
+
color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};
|
|
3808
4544
|
margin: 20px;
|
|
3809
4545
|
font-size: 14px;
|
|
3810
4546
|
line-height: 20px;
|
|
@@ -3813,6 +4549,7 @@ const ToastContainer = styled(Card) `
|
|
|
3813
4549
|
width: 344px;
|
|
3814
4550
|
display: flex;
|
|
3815
4551
|
align-items: center;
|
|
4552
|
+
position: relative;
|
|
3816
4553
|
|
|
3817
4554
|
& svg {
|
|
3818
4555
|
width: 20px;
|
|
@@ -3837,7 +4574,7 @@ const TextContainer = styled.div `
|
|
|
3837
4574
|
`;
|
|
3838
4575
|
const CloseContainer = styled.button `
|
|
3839
4576
|
background-color: transparent;
|
|
3840
|
-
color:
|
|
4577
|
+
color: ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
|
|
3841
4578
|
padding: 6px 10px;
|
|
3842
4579
|
border: none;
|
|
3843
4580
|
border-radius: 3px;
|
|
@@ -3849,8 +4586,71 @@ const CloseContainer = styled.button `
|
|
|
3849
4586
|
}
|
|
3850
4587
|
`;
|
|
3851
4588
|
const DEFAULT_DURATION = 2000;
|
|
4589
|
+
const createAriaLiveRegion = (id, ariaLive) => {
|
|
4590
|
+
const region = document.createElement('div');
|
|
4591
|
+
region.id = id;
|
|
4592
|
+
region.style.position = 'absolute';
|
|
4593
|
+
region.style.width = '1px';
|
|
4594
|
+
region.style.height = '1px';
|
|
4595
|
+
region.style.padding = '0';
|
|
4596
|
+
region.style.margin = '-1px';
|
|
4597
|
+
region.style.overflow = 'hidden';
|
|
4598
|
+
region.style.clip = 'rect(0, 0, 0, 0)';
|
|
4599
|
+
region.style.whiteSpace = 'nowrap';
|
|
4600
|
+
region.style.borderWidth = '0';
|
|
4601
|
+
region.setAttribute('role', ariaLive === 'assertive' ? 'alert' : 'log');
|
|
4602
|
+
region.setAttribute('aria-live', ariaLive);
|
|
4603
|
+
region.setAttribute('aria-atomic', 'true');
|
|
4604
|
+
return region;
|
|
4605
|
+
};
|
|
3852
4606
|
class Toast {
|
|
3853
4607
|
constructor() {
|
|
4608
|
+
this.isPaused = false;
|
|
4609
|
+
this.currentOptions = null;
|
|
4610
|
+
/**
|
|
4611
|
+
* Set up keyboard listener for dismissing toast with Escape key
|
|
4612
|
+
*/
|
|
4613
|
+
this.setupKeyboardListeners = () => {
|
|
4614
|
+
if (typeof document !== 'undefined') {
|
|
4615
|
+
document.addEventListener('keydown', this.handleKeyDown);
|
|
4616
|
+
}
|
|
4617
|
+
};
|
|
4618
|
+
/**
|
|
4619
|
+
* Handle keyboard events for toast interaction
|
|
4620
|
+
*/
|
|
4621
|
+
this.handleKeyDown = (event) => {
|
|
4622
|
+
if (!this.toast)
|
|
4623
|
+
return;
|
|
4624
|
+
// Escape key dismisses the toast
|
|
4625
|
+
if (event.key === 'Escape') {
|
|
4626
|
+
this.remove();
|
|
4627
|
+
}
|
|
4628
|
+
// Space key pauses/resumes auto-dismiss
|
|
4629
|
+
else if (event.key === ' ' && this.currentOptions) {
|
|
4630
|
+
event.preventDefault();
|
|
4631
|
+
if (this.isPaused) {
|
|
4632
|
+
this.resumeTimeout();
|
|
4633
|
+
}
|
|
4634
|
+
else {
|
|
4635
|
+
this.pauseTimeout();
|
|
4636
|
+
}
|
|
4637
|
+
}
|
|
4638
|
+
};
|
|
4639
|
+
/**
|
|
4640
|
+
* Update the appropriate live region with toast content
|
|
4641
|
+
*/
|
|
4642
|
+
this.updateLiveRegion = (content, isAssertive) => {
|
|
4643
|
+
const region = isAssertive ? this.assertiveRegion : this.politeRegion;
|
|
4644
|
+
region.textContent = '';
|
|
4645
|
+
if (region) {
|
|
4646
|
+
// Add content after delay
|
|
4647
|
+
setTimeout(() => {
|
|
4648
|
+
if (region) {
|
|
4649
|
+
region.textContent = content;
|
|
4650
|
+
}
|
|
4651
|
+
}, 200);
|
|
4652
|
+
}
|
|
4653
|
+
};
|
|
3854
4654
|
this.remove = () => {
|
|
3855
4655
|
if (this.toast) {
|
|
3856
4656
|
this.toast[1]();
|
|
@@ -3864,36 +4664,68 @@ class Toast {
|
|
|
3864
4664
|
}
|
|
3865
4665
|
}, 300);
|
|
3866
4666
|
};
|
|
4667
|
+
/**
|
|
4668
|
+
* Pause toast auto-dismiss
|
|
4669
|
+
*/
|
|
4670
|
+
this.pauseTimeout = () => {
|
|
4671
|
+
if (this.timeout) {
|
|
4672
|
+
clearTimeout(this.timeout);
|
|
4673
|
+
this.isPaused = true;
|
|
4674
|
+
}
|
|
4675
|
+
};
|
|
4676
|
+
/**
|
|
4677
|
+
* Resume toast auto-dismiss
|
|
4678
|
+
*/
|
|
4679
|
+
this.resumeTimeout = () => {
|
|
4680
|
+
if (this.currentOptions && this.isPaused) {
|
|
4681
|
+
this.timeout = setTimeout(() => {
|
|
4682
|
+
this.remove();
|
|
4683
|
+
}, this.currentOptions.duration || DEFAULT_DURATION);
|
|
4684
|
+
this.isPaused = false;
|
|
4685
|
+
}
|
|
4686
|
+
};
|
|
3867
4687
|
/**
|
|
3868
4688
|
* Pause toast when user is hovering over it.
|
|
3869
|
-
*
|
|
3870
|
-
* @param id
|
|
3871
4689
|
*/
|
|
3872
4690
|
this.pause = () => {
|
|
3873
|
-
|
|
4691
|
+
this.pauseTimeout();
|
|
3874
4692
|
};
|
|
3875
4693
|
/**
|
|
3876
4694
|
* Restart the removal of toast.
|
|
3877
|
-
*
|
|
3878
|
-
* @param id
|
|
3879
4695
|
*/
|
|
3880
4696
|
this.resume = (options) => () => {
|
|
3881
|
-
this.
|
|
3882
|
-
|
|
3883
|
-
}, options.duration || DEFAULT_DURATION);
|
|
4697
|
+
this.currentOptions = options;
|
|
4698
|
+
this.resumeTimeout();
|
|
3884
4699
|
};
|
|
4700
|
+
if (typeof document === 'undefined')
|
|
4701
|
+
return;
|
|
3885
4702
|
this.element = document === null || document === void 0 ? void 0 : document.createElement('div');
|
|
4703
|
+
this.ariaLiveContainer = document === null || document === void 0 ? void 0 : document.createElement('div');
|
|
4704
|
+
this.ariaLiveContainer.id = 'nf-toast-container';
|
|
4705
|
+
document.body.appendChild(this.ariaLiveContainer);
|
|
4706
|
+
this.politeRegion = createAriaLiveRegion('nf-toast-polite-region', 'polite');
|
|
4707
|
+
this.assertiveRegion = createAriaLiveRegion('nf-toast-assertive-region', 'assertive');
|
|
4708
|
+
this.ariaLiveContainer.appendChild(this.politeRegion);
|
|
4709
|
+
this.ariaLiveContainer.appendChild(this.assertiveRegion);
|
|
4710
|
+
this.setupKeyboardListeners();
|
|
3886
4711
|
}
|
|
3887
4712
|
add(options) {
|
|
3888
4713
|
const { text, buttonText, buttonClick, duration, type = exports.TOAST_TYPE.NORMAL } = options;
|
|
4714
|
+
this.currentOptions = options;
|
|
4715
|
+
this.isPaused = false;
|
|
3889
4716
|
this.remove();
|
|
4717
|
+
// Determine if this is an assertive message (warning/danger)
|
|
4718
|
+
const isAssertive = type === exports.TOAST_TYPE.WARNING || type === exports.TOAST_TYPE.DANGER;
|
|
4719
|
+
// Announce to screen readers
|
|
4720
|
+
const announcement = buttonText ? `${text} ${buttonText} button available` : text;
|
|
4721
|
+
this.updateLiveRegion(announcement, isAssertive);
|
|
3890
4722
|
this.toast = LayerManager$1.renderLayer({
|
|
3891
4723
|
exitDelay: 300,
|
|
3892
4724
|
closeOnEsc: false,
|
|
3893
4725
|
closeOnOverlayClick: false,
|
|
3894
4726
|
alwaysOnTop: true,
|
|
3895
4727
|
position: LAYER_POSITION.BOTTOM_LEFT,
|
|
3896
|
-
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 }))] }))),
|
|
4728
|
+
component: (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(ToastContainer, Object.assign({}, options, { type: type, elevated: true, onMouseEnter: this.pause, onMouseLeave: this.resume(options), "aria-hidden": "true", children: [jsxRuntime.jsx(TextContainer, { children: text }), buttonText && (jsxRuntime.jsx(CloseContainer, { onClick: buttonClick, type: "button", "aria-label": `${buttonText} - Press Space to pause auto-dismiss, Escape to close`, children: buttonText }))] })) })),
|
|
3897
4729
|
});
|
|
3898
4730
|
const Component = this.toast[0];
|
|
3899
4731
|
this.root = client.createRoot(this.element);
|
|
@@ -3946,9 +4778,9 @@ const positionHoverStyle = {
|
|
|
3946
4778
|
};
|
|
3947
4779
|
const TooltipDiv = styled.div `
|
|
3948
4780
|
position: absolute;
|
|
3949
|
-
background-color:
|
|
4781
|
+
background-color: ${getThemeValue(THEME_NAME.TOOLTIP_COLOR)};
|
|
3950
4782
|
padding: 5px;
|
|
3951
|
-
color:
|
|
4783
|
+
color: ${getThemeValue(THEME_NAME.TEXT_COLOR_LIGHT)};
|
|
3952
4784
|
border-radius: 3px;
|
|
3953
4785
|
transition: transform 0.3s ease;
|
|
3954
4786
|
font-size: 12px;
|
|
@@ -3961,13 +4793,23 @@ const TooltipContainer = styled.div `
|
|
|
3961
4793
|
justify-content: center;
|
|
3962
4794
|
align-items: center;
|
|
3963
4795
|
|
|
3964
|
-
&:hover ${TooltipDiv} {
|
|
4796
|
+
&:hover ${TooltipDiv}, &:focus-within ${TooltipDiv} {
|
|
3965
4797
|
${(props) => positionHoverStyle[props.position]}
|
|
3966
4798
|
}
|
|
3967
4799
|
`;
|
|
3968
4800
|
function Tooltip(props) {
|
|
3969
4801
|
const { children, position } = props, rest = __rest(props, ["children", "position"]);
|
|
3970
|
-
|
|
4802
|
+
const tooltipId = React.useId();
|
|
4803
|
+
// Clone the child to inject aria-describedby and tabIndex if possible
|
|
4804
|
+
const trigger = React.isValidElement(children)
|
|
4805
|
+
? React.cloneElement(children, {
|
|
4806
|
+
'aria-describedby': tooltipId,
|
|
4807
|
+
tabIndex: children.props && typeof children.props.tabIndex !== 'undefined'
|
|
4808
|
+
? children.props.tabIndex
|
|
4809
|
+
: 0,
|
|
4810
|
+
})
|
|
4811
|
+
: children;
|
|
4812
|
+
return (jsxRuntime.jsxs(TooltipContainer, Object.assign({ position: position }, rest, { children: [trigger, jsxRuntime.jsx(TooltipDiv, { id: tooltipId, "aria-hidden": "true", role: "tooltip", position: position, children: rest.tooltipText })] })));
|
|
3971
4813
|
}
|
|
3972
4814
|
Tooltip.propTypes = {
|
|
3973
4815
|
/** Text to show in the tooltip */
|
|
@@ -4013,7 +4855,7 @@ exports.Dropdown = Dropdown;
|
|
|
4013
4855
|
exports.Group = Group;
|
|
4014
4856
|
exports.GroupLabel = GroupLabel;
|
|
4015
4857
|
exports.IconButton = IconButton;
|
|
4016
|
-
exports.Input = Input$
|
|
4858
|
+
exports.Input = Input$2;
|
|
4017
4859
|
exports.LinkButton = LinkButton;
|
|
4018
4860
|
exports.Menu = Menu;
|
|
4019
4861
|
exports.MenuItem = MenuItem;
|