@ultraviolet/ui 1.0.0
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/LICENSE +189 -0
- package/README.md +64 -0
- package/dist/index.d.ts +2427 -0
- package/dist/react-datepicker/dist/react-datepicker.min.css.js +3 -0
- package/dist/react-toastify/dist/ReactToastify.min.css.js +3 -0
- package/dist/src/components/ActionBar/index.js +55 -0
- package/dist/src/components/Alert/index.js +144 -0
- package/dist/src/components/Avatar/index.js +90 -0
- package/dist/src/components/Badge/index.js +143 -0
- package/dist/src/components/Banner/index.js +117 -0
- package/dist/src/components/BarChart/Tooltip.js +63 -0
- package/dist/src/components/BarChart/index.js +94 -0
- package/dist/src/components/BarStack/index.js +223 -0
- package/dist/src/components/Breadcrumbs/index.js +89 -0
- package/dist/src/components/Bullet/index.js +137 -0
- package/dist/src/components/Button/index.js +303 -0
- package/dist/src/components/Card/index.js +81 -0
- package/dist/src/components/Carousel/index.js +162 -0
- package/dist/src/components/Checkbox/index.js +338 -0
- package/dist/src/components/CopyButton/index.js +92 -0
- package/dist/src/components/DateInput/index.js +250 -0
- package/dist/src/components/EmptyState/index.js +124 -0
- package/dist/src/components/Expandable/index.js +84 -0
- package/dist/src/components/Icon/index.js +350 -0
- package/dist/src/components/LineChart/CustomLegend.js +147 -0
- package/dist/src/components/LineChart/Tooltip.js +58 -0
- package/dist/src/components/LineChart/helpers.js +75 -0
- package/dist/src/components/LineChart/index.js +139 -0
- package/dist/src/components/Link/index.js +159 -0
- package/dist/src/components/List/Body.js +22 -0
- package/dist/src/components/List/Cell.js +38 -0
- package/dist/src/components/List/HeaderCell.js +118 -0
- package/dist/src/components/List/HeaderRow.js +47 -0
- package/dist/src/components/List/ListContext.js +120 -0
- package/dist/src/components/List/Row.js +211 -0
- package/dist/src/components/List/SelectBar.js +52 -0
- package/dist/src/components/List/SkeletonRows.js +54 -0
- package/dist/src/components/List/constants.js +3 -0
- package/dist/src/components/List/index.js +77 -0
- package/dist/src/components/Loader/index.js +87 -0
- package/dist/src/components/Menu/Item.js +122 -0
- package/dist/src/components/Menu/index.js +143 -0
- package/dist/src/components/Modal/index.js +279 -0
- package/dist/src/components/Notice/index.js +33 -0
- package/dist/src/components/NumberInput/helpers.js +6 -0
- package/dist/src/components/NumberInput/index.js +366 -0
- package/dist/src/components/Pagination/getPageNumbers.js +32 -0
- package/dist/src/components/Pagination/index.js +118 -0
- package/dist/src/components/PasswordCheck/index.js +42 -0
- package/dist/src/components/PasswordStrengthMeter/index.js +116 -0
- package/dist/src/components/PieChart/Legends.js +183 -0
- package/dist/src/components/PieChart/Tooltip.js +64 -0
- package/dist/src/components/PieChart/index.js +133 -0
- package/dist/src/components/PieChart/patterns.js +9 -0
- package/dist/src/components/Popover/index.js +131 -0
- package/dist/src/components/ProgressBar/index.js +72 -0
- package/dist/src/components/Radio/index.js +231 -0
- package/dist/src/components/Row/index.js +43 -0
- package/dist/src/components/SelectInput/index.js +662 -0
- package/dist/src/components/SelectableCard/index.js +154 -0
- package/dist/src/components/Separator/index.js +91 -0
- package/dist/src/components/Skeleton/Block.js +53 -0
- package/dist/src/components/Skeleton/Blocks.js +52 -0
- package/dist/src/components/Skeleton/BoxWithIcon.js +47 -0
- package/dist/src/components/Skeleton/Donut.js +58 -0
- package/dist/src/components/Skeleton/IconSkeleton.js +37 -0
- package/dist/src/components/Skeleton/Line.js +19 -0
- package/dist/src/components/Skeleton/List.js +60 -0
- package/dist/src/components/Skeleton/Slider.js +57 -0
- package/dist/src/components/Skeleton/index.js +85 -0
- package/dist/src/components/Snippet/index.js +250 -0
- package/dist/src/components/Stack/index.js +24 -0
- package/dist/src/components/Status/index.js +101 -0
- package/dist/src/components/StepList/index.js +81 -0
- package/dist/src/components/Stepper/index.js +217 -0
- package/dist/src/components/SwitchButton/FocusOverlay.js +47 -0
- package/dist/src/components/SwitchButton/index.js +131 -0
- package/dist/src/components/Table/Body.js +12 -0
- package/dist/src/components/Table/Cell.js +27 -0
- package/dist/src/components/Table/Header.js +21 -0
- package/dist/src/components/Table/HeaderCell.js +119 -0
- package/dist/src/components/Table/HeaderRow.js +35 -0
- package/dist/src/components/Table/Row.js +70 -0
- package/dist/src/components/Table/SelectBar.js +52 -0
- package/dist/src/components/Table/SkeletonRows.js +52 -0
- package/dist/src/components/Table/TableContext.js +91 -0
- package/dist/src/components/Table/index.js +84 -0
- package/dist/src/components/Tabs/Tab.js +165 -0
- package/dist/src/components/Tabs/TabMenu.js +46 -0
- package/dist/src/components/Tabs/TabMenuItem.js +40 -0
- package/dist/src/components/Tabs/TabsContext.js +6 -0
- package/dist/src/components/Tabs/index.js +117 -0
- package/dist/src/components/Tag/index.js +177 -0
- package/dist/src/components/TagInput/index.js +277 -0
- package/dist/src/components/TagList/index.js +110 -0
- package/dist/src/components/Text/index.js +106 -0
- package/dist/src/components/TextInput/index.js +529 -0
- package/dist/src/components/TimeInput/index.js +38 -0
- package/dist/src/components/Toaster/index.js +116 -0
- package/dist/src/components/Toggle/index.js +192 -0
- package/dist/src/components/Tooltip/helpers.js +131 -0
- package/dist/src/components/Tooltip/index.js +275 -0
- package/dist/src/components/VerificationCode/index.js +203 -0
- package/dist/src/helpers/isJSON.js +11 -0
- package/dist/src/helpers/legend.js +13 -0
- package/dist/src/helpers/recursivelyGetChildrenString.js +12 -0
- package/dist/src/index.js +63 -0
- package/dist/src/theme/index.js +25 -0
- package/dist/src/utils/animations.js +250 -0
- package/dist/src/utils/capitalize.js +4 -0
- package/dist/src/utils/ids.js +12 -0
- package/dist/src/utils/normalize.js +36 -0
- package/dist/src/utils/responsive/Breakpoint.js +12 -0
- package/dist/src/utils/responsive/utilities.js +12 -0
- package/package.json +70 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import _styled from '@emotion/styled/base';
|
|
2
|
+
import { useTheme } from '@emotion/react';
|
|
3
|
+
import { forwardRef, useState, useId, useEffect, useCallback } from 'react';
|
|
4
|
+
import { Icon } from '../Icon/index.js';
|
|
5
|
+
import { Loader } from '../Loader/index.js';
|
|
6
|
+
import { Text } from '../Text/index.js';
|
|
7
|
+
import { jsxs, Fragment, jsx } from '@emotion/react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
10
|
+
const InnerCheckbox = /*#__PURE__*/_styled("rect", {
|
|
11
|
+
target: "eqr7bqq7"
|
|
12
|
+
})("fill:", _ref => {
|
|
13
|
+
let {
|
|
14
|
+
theme
|
|
15
|
+
} = _ref;
|
|
16
|
+
return theme.colors.neutral.backgroundWeak;
|
|
17
|
+
}, ";stroke:", _ref2 => {
|
|
18
|
+
let {
|
|
19
|
+
theme
|
|
20
|
+
} = _ref2;
|
|
21
|
+
return theme.colors.neutral.textWeak;
|
|
22
|
+
}, ";");
|
|
23
|
+
const CheckMark = /*#__PURE__*/_styled("rect", {
|
|
24
|
+
target: "eqr7bqq6"
|
|
25
|
+
})();
|
|
26
|
+
const CheckMixedMark = /*#__PURE__*/_styled("rect", {
|
|
27
|
+
target: "eqr7bqq5"
|
|
28
|
+
})();
|
|
29
|
+
const CheckboxIconContainer = _ref3 => {
|
|
30
|
+
let {
|
|
31
|
+
children
|
|
32
|
+
} = _ref3;
|
|
33
|
+
const theme = useTheme();
|
|
34
|
+
return jsxs("g", {
|
|
35
|
+
children: [jsx(InnerCheckbox, {
|
|
36
|
+
x: "5",
|
|
37
|
+
y: "5",
|
|
38
|
+
width: "14",
|
|
39
|
+
height: "14",
|
|
40
|
+
rx: theme.radii.small,
|
|
41
|
+
strokeWidth: "2"
|
|
42
|
+
}), children]
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const PaddedText = /*#__PURE__*/_styled(Text, {
|
|
46
|
+
target: "eqr7bqq4"
|
|
47
|
+
})("padding:", _ref4 => {
|
|
48
|
+
let {
|
|
49
|
+
theme
|
|
50
|
+
} = _ref4;
|
|
51
|
+
return `0 ${theme.space['0.5']}`;
|
|
52
|
+
}, ";");
|
|
53
|
+
const StyledIcon = /*#__PURE__*/_styled('svg', {
|
|
54
|
+
target: "eqr7bqq3"
|
|
55
|
+
})("border-radius:", _ref5 => {
|
|
56
|
+
let {
|
|
57
|
+
theme
|
|
58
|
+
} = _ref5;
|
|
59
|
+
return theme.radii.default;
|
|
60
|
+
}, ";height:", _ref6 => {
|
|
61
|
+
let {
|
|
62
|
+
size
|
|
63
|
+
} = _ref6;
|
|
64
|
+
return size;
|
|
65
|
+
}, "px;width:", _ref7 => {
|
|
66
|
+
let {
|
|
67
|
+
size
|
|
68
|
+
} = _ref7;
|
|
69
|
+
return size;
|
|
70
|
+
}, "px;min-width:", _ref8 => {
|
|
71
|
+
let {
|
|
72
|
+
size
|
|
73
|
+
} = _ref8;
|
|
74
|
+
return size;
|
|
75
|
+
}, "px;min-height:", _ref9 => {
|
|
76
|
+
let {
|
|
77
|
+
size
|
|
78
|
+
} = _ref9;
|
|
79
|
+
return size;
|
|
80
|
+
}, "px;");
|
|
81
|
+
const CheckboxInput = /*#__PURE__*/_styled('input', {
|
|
82
|
+
shouldForwardProp: prop => !['size'].includes(prop),
|
|
83
|
+
target: "eqr7bqq2"
|
|
84
|
+
})("position:absolute;white-space:nowrap;height:", _ref10 => {
|
|
85
|
+
let {
|
|
86
|
+
size
|
|
87
|
+
} = _ref10;
|
|
88
|
+
return size;
|
|
89
|
+
}, "px;width:", _ref11 => {
|
|
90
|
+
let {
|
|
91
|
+
size
|
|
92
|
+
} = _ref11;
|
|
93
|
+
return size;
|
|
94
|
+
}, "px;opacity:0;border-width:0;&:not(:disabled){cursor:pointer;}&:disabled{cursor:not-allowed;}&:not(:disabled){&:checked+", StyledIcon, ",&[aria-checked='mixed']+", StyledIcon, "{fill:", _ref12 => {
|
|
95
|
+
let {
|
|
96
|
+
theme
|
|
97
|
+
} = _ref12;
|
|
98
|
+
return theme.colors.primary.backgroundStrong;
|
|
99
|
+
}, ";", InnerCheckbox, "{stroke:", _ref13 => {
|
|
100
|
+
let {
|
|
101
|
+
theme
|
|
102
|
+
} = _ref13;
|
|
103
|
+
return theme.colors.primary.backgroundStrong;
|
|
104
|
+
}, ";}}&[aria-invalid='true']+", StyledIcon, ",&[aria-invalid='mixed']+", StyledIcon, "{fill:", _ref14 => {
|
|
105
|
+
let {
|
|
106
|
+
theme
|
|
107
|
+
} = _ref14;
|
|
108
|
+
return theme.colors.danger.backgroundStrong;
|
|
109
|
+
}, ";", InnerCheckbox, "{stroke:", _ref15 => {
|
|
110
|
+
let {
|
|
111
|
+
theme
|
|
112
|
+
} = _ref15;
|
|
113
|
+
return theme.colors.danger.backgroundStrong;
|
|
114
|
+
}, ";}}}&:focus+", StyledIcon, "{background-color:", _ref16 => {
|
|
115
|
+
let {
|
|
116
|
+
theme
|
|
117
|
+
} = _ref16;
|
|
118
|
+
return theme.colors.primary.background;
|
|
119
|
+
}, ";fill:", _ref17 => {
|
|
120
|
+
let {
|
|
121
|
+
theme
|
|
122
|
+
} = _ref17;
|
|
123
|
+
return theme.colors.primary.backgroundStrong;
|
|
124
|
+
}, ";", InnerCheckbox, "{stroke:", _ref18 => {
|
|
125
|
+
let {
|
|
126
|
+
theme
|
|
127
|
+
} = _ref18;
|
|
128
|
+
return theme.colors.primary.backgroundStrong;
|
|
129
|
+
}, ";fill:", _ref19 => {
|
|
130
|
+
let {
|
|
131
|
+
theme
|
|
132
|
+
} = _ref19;
|
|
133
|
+
return theme.colors.primary.background;
|
|
134
|
+
}, ";}}&[aria-invalid='true']:focus+", StyledIcon, "{background-color:", _ref20 => {
|
|
135
|
+
let {
|
|
136
|
+
theme
|
|
137
|
+
} = _ref20;
|
|
138
|
+
return theme.colors.danger.background;
|
|
139
|
+
}, ";fill:", _ref21 => {
|
|
140
|
+
let {
|
|
141
|
+
theme
|
|
142
|
+
} = _ref21;
|
|
143
|
+
return theme.colors.danger.backgroundStrong;
|
|
144
|
+
}, ";", InnerCheckbox, "{stroke:", _ref22 => {
|
|
145
|
+
let {
|
|
146
|
+
theme
|
|
147
|
+
} = _ref22;
|
|
148
|
+
return theme.colors.danger.backgroundStrong;
|
|
149
|
+
}, ";fill:", _ref23 => {
|
|
150
|
+
let {
|
|
151
|
+
theme
|
|
152
|
+
} = _ref23;
|
|
153
|
+
return theme.colors.danger.background;
|
|
154
|
+
}, ";}}");
|
|
155
|
+
const CheckboxContainer = /*#__PURE__*/_styled("div", {
|
|
156
|
+
target: "eqr7bqq1"
|
|
157
|
+
})("position:relative;display:inline-flex;align-items:center;gap:", _ref24 => {
|
|
158
|
+
let {
|
|
159
|
+
theme
|
|
160
|
+
} = _ref24;
|
|
161
|
+
return theme.space['1'];
|
|
162
|
+
}, ";&[aria-disabled='false'],&[aria-disabled='false']>label{cursor:pointer;}&[aria-disabled='true']{cursor:not-allowed;color:", _ref25 => {
|
|
163
|
+
let {
|
|
164
|
+
theme
|
|
165
|
+
} = _ref25;
|
|
166
|
+
return theme.colors.neutral.textDisabled;
|
|
167
|
+
}, ";&>label{cursor:not-allowed;}", StyledIcon, "{fill:", _ref26 => {
|
|
168
|
+
let {
|
|
169
|
+
theme
|
|
170
|
+
} = _ref26;
|
|
171
|
+
return theme.colors.neutral.textDisabled;
|
|
172
|
+
}, ";", InnerCheckbox, "{stroke:", _ref27 => {
|
|
173
|
+
let {
|
|
174
|
+
theme
|
|
175
|
+
} = _ref27;
|
|
176
|
+
return theme.colors.neutral.textDisabled;
|
|
177
|
+
}, ";fill:", _ref28 => {
|
|
178
|
+
let {
|
|
179
|
+
theme
|
|
180
|
+
} = _ref28;
|
|
181
|
+
return theme.colors.neutral.backgroundDisabled;
|
|
182
|
+
}, ";}}}", CheckMark, ",", CheckMixedMark, "{transform-origin:center;transition:200ms transform ease-in-out;transform:scale(0);}", CheckboxInput, ":checked+", StyledIcon, " ", CheckMark, "{transform:scale(1);}", CheckboxInput, "[aria-checked=\"mixed\"]+", StyledIcon, " ", CheckMixedMark, "{transform:scale(1);}&:hover[aria-disabled='false']{", CheckboxInput, "+", StyledIcon, "{background-color:", _ref29 => {
|
|
183
|
+
let {
|
|
184
|
+
theme
|
|
185
|
+
} = _ref29;
|
|
186
|
+
return theme.colors.primary.background;
|
|
187
|
+
}, ";fill:", _ref30 => {
|
|
188
|
+
let {
|
|
189
|
+
theme
|
|
190
|
+
} = _ref30;
|
|
191
|
+
return theme.colors.primary.backgroundStrong;
|
|
192
|
+
}, ";", InnerCheckbox, "{stroke:", _ref31 => {
|
|
193
|
+
let {
|
|
194
|
+
theme
|
|
195
|
+
} = _ref31;
|
|
196
|
+
return theme.colors.primary.backgroundStrong;
|
|
197
|
+
}, ";fill:", _ref32 => {
|
|
198
|
+
let {
|
|
199
|
+
theme
|
|
200
|
+
} = _ref32;
|
|
201
|
+
return theme.colors.primary.background;
|
|
202
|
+
}, ";}}", CheckboxInput, "[aria-invalid=\"true\"]+", StyledIcon, "{background-color:", _ref33 => {
|
|
203
|
+
let {
|
|
204
|
+
theme
|
|
205
|
+
} = _ref33;
|
|
206
|
+
return theme.colors.danger.background;
|
|
207
|
+
}, ";fill:", _ref34 => {
|
|
208
|
+
let {
|
|
209
|
+
theme
|
|
210
|
+
} = _ref34;
|
|
211
|
+
return theme.colors.danger.backgroundStrong;
|
|
212
|
+
}, ";", InnerCheckbox, "{stroke:", _ref35 => {
|
|
213
|
+
let {
|
|
214
|
+
theme
|
|
215
|
+
} = _ref35;
|
|
216
|
+
return theme.colors.danger.backgroundStrong;
|
|
217
|
+
}, ";fill:", _ref36 => {
|
|
218
|
+
let {
|
|
219
|
+
theme
|
|
220
|
+
} = _ref36;
|
|
221
|
+
return theme.colors.danger.background;
|
|
222
|
+
}, ";}}}");
|
|
223
|
+
const StyledActivityContainer = /*#__PURE__*/_styled("div", {
|
|
224
|
+
target: "eqr7bqq0"
|
|
225
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
226
|
+
name: "zjik7",
|
|
227
|
+
styles: "display:flex"
|
|
228
|
+
} : {
|
|
229
|
+
name: "zjik7",
|
|
230
|
+
styles: "display:flex",
|
|
231
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
232
|
+
});
|
|
233
|
+
const Checkbox = /*#__PURE__*/forwardRef((_ref37, ref) => {
|
|
234
|
+
let {
|
|
235
|
+
checked = false,
|
|
236
|
+
onChange,
|
|
237
|
+
onFocus,
|
|
238
|
+
onBlur,
|
|
239
|
+
error,
|
|
240
|
+
name,
|
|
241
|
+
value,
|
|
242
|
+
size = 24,
|
|
243
|
+
children,
|
|
244
|
+
progress = false,
|
|
245
|
+
disabled = false,
|
|
246
|
+
autoFocus = false,
|
|
247
|
+
className,
|
|
248
|
+
'data-visibility': dataVisibility,
|
|
249
|
+
'aria-label': ariaLabel,
|
|
250
|
+
required,
|
|
251
|
+
'data-testid': dataTestId
|
|
252
|
+
} = _ref37;
|
|
253
|
+
const [state, setState] = useState(checked);
|
|
254
|
+
const id = useId();
|
|
255
|
+
const computedName = name ?? id;
|
|
256
|
+
useEffect(() => {
|
|
257
|
+
setState(checked);
|
|
258
|
+
}, [checked]);
|
|
259
|
+
const onLocalChange = useCallback(event => {
|
|
260
|
+
if (!progress) onChange?.(event);
|
|
261
|
+
setState(current => current === 'indeterminate' ? false : event.target.checked);
|
|
262
|
+
}, [onChange, progress, setState]);
|
|
263
|
+
const onKeyDown = useCallback(event => {
|
|
264
|
+
if (event.key.charCodeAt(0) === 32) {
|
|
265
|
+
event.preventDefault();
|
|
266
|
+
setState(current => !current);
|
|
267
|
+
}
|
|
268
|
+
}, []);
|
|
269
|
+
return jsxs(Fragment, {
|
|
270
|
+
children: [jsxs(CheckboxContainer, {
|
|
271
|
+
className: className,
|
|
272
|
+
"aria-disabled": disabled,
|
|
273
|
+
"data-visibility": dataVisibility,
|
|
274
|
+
"data-checked": state,
|
|
275
|
+
"data-error": !!error,
|
|
276
|
+
"data-testid": dataTestId,
|
|
277
|
+
children: [progress ? jsx(StyledActivityContainer, {
|
|
278
|
+
children: jsx(Loader, {
|
|
279
|
+
active: true,
|
|
280
|
+
size: size
|
|
281
|
+
})
|
|
282
|
+
}) : null, jsx(CheckboxInput, {
|
|
283
|
+
id: computedName,
|
|
284
|
+
type: "checkbox",
|
|
285
|
+
"aria-invalid": !!error,
|
|
286
|
+
"aria-describedby": error ? `${computedName}-hint` : undefined,
|
|
287
|
+
"aria-checked": state === 'indeterminate' ? 'mixed' : undefined,
|
|
288
|
+
"aria-label": ariaLabel,
|
|
289
|
+
checked: state === 'indeterminate' ? false : state,
|
|
290
|
+
size: size,
|
|
291
|
+
onChange: onLocalChange,
|
|
292
|
+
onKeyDown: onKeyDown,
|
|
293
|
+
onFocus: onFocus,
|
|
294
|
+
onBlur: onBlur,
|
|
295
|
+
disabled: disabled,
|
|
296
|
+
value: value,
|
|
297
|
+
name: computedName,
|
|
298
|
+
autoFocus: autoFocus,
|
|
299
|
+
ref: ref,
|
|
300
|
+
required: required
|
|
301
|
+
}), !progress ? jsx(StyledIcon, {
|
|
302
|
+
size: size,
|
|
303
|
+
viewBox: "0 0 24 24",
|
|
304
|
+
children: jsxs(CheckboxIconContainer, {
|
|
305
|
+
children: [jsx(CheckMixedMark, {
|
|
306
|
+
x: "8",
|
|
307
|
+
y: "11",
|
|
308
|
+
rx: "1",
|
|
309
|
+
width: "8",
|
|
310
|
+
height: "2"
|
|
311
|
+
}), jsx(CheckMark, {
|
|
312
|
+
x: "8",
|
|
313
|
+
y: "8",
|
|
314
|
+
rx: "1",
|
|
315
|
+
width: "8",
|
|
316
|
+
height: "8"
|
|
317
|
+
})]
|
|
318
|
+
})
|
|
319
|
+
}) : null, children ? jsx("label", {
|
|
320
|
+
htmlFor: computedName,
|
|
321
|
+
children: children
|
|
322
|
+
}) : null, required ? jsx("sup", {
|
|
323
|
+
children: jsx(Icon, {
|
|
324
|
+
name: "asterisk",
|
|
325
|
+
size: 10,
|
|
326
|
+
color: "danger"
|
|
327
|
+
})
|
|
328
|
+
}) : null]
|
|
329
|
+
}), error ? jsx(PaddedText, {
|
|
330
|
+
variant: "bodySmall",
|
|
331
|
+
as: "p",
|
|
332
|
+
color: "danger",
|
|
333
|
+
children: error
|
|
334
|
+
}) : null]
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
export { Checkbox };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import _styled from '@emotion/styled/base';
|
|
2
|
+
import useClipboard from 'react-use-clipboard';
|
|
3
|
+
import { Icon } from '../Icon/index.js';
|
|
4
|
+
import { Tooltip } from '../Tooltip/index.js';
|
|
5
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
const COPY_DURATION = 2500;
|
|
8
|
+
const SIZES = {
|
|
9
|
+
small: 32,
|
|
10
|
+
large: 48
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* TODO: replace when buttonV2 will be available
|
|
15
|
+
*/
|
|
16
|
+
const StyledButton = /*#__PURE__*/_styled('button', {
|
|
17
|
+
shouldForwardProp: prop => !['size', 'sentiment', 'noBorder'].includes(prop),
|
|
18
|
+
target: "e1qa6uyd0"
|
|
19
|
+
})("width:", _ref => {
|
|
20
|
+
let {
|
|
21
|
+
size
|
|
22
|
+
} = _ref;
|
|
23
|
+
return size;
|
|
24
|
+
}, "px;height:", _ref2 => {
|
|
25
|
+
let {
|
|
26
|
+
size
|
|
27
|
+
} = _ref2;
|
|
28
|
+
return size;
|
|
29
|
+
}, "px;background:transparent;color:", _ref3 => {
|
|
30
|
+
let {
|
|
31
|
+
theme,
|
|
32
|
+
sentiment
|
|
33
|
+
} = _ref3;
|
|
34
|
+
return sentiment === 'primary' ? theme.colors.primary.textWeak : theme.colors.neutral.text;
|
|
35
|
+
}, ";border:", _ref4 => {
|
|
36
|
+
let {
|
|
37
|
+
theme,
|
|
38
|
+
noBorder,
|
|
39
|
+
sentiment
|
|
40
|
+
} = _ref4;
|
|
41
|
+
return noBorder ? 'none' : `1px solid ${theme.colors[sentiment].borderWeak}`;
|
|
42
|
+
}, ";border-radius:", _ref5 => {
|
|
43
|
+
let {
|
|
44
|
+
theme
|
|
45
|
+
} = _ref5;
|
|
46
|
+
return theme.radii.default;
|
|
47
|
+
}, ";display:flex;cursor:pointer;align-items:center;justify-content:center;outline:none;&:hover{background:", _ref6 => {
|
|
48
|
+
let {
|
|
49
|
+
theme,
|
|
50
|
+
sentiment
|
|
51
|
+
} = _ref6;
|
|
52
|
+
return theme.colors[sentiment].backgroundWeakHover;
|
|
53
|
+
}, ";}&active,&:focus{box-shadow:", _ref7 => {
|
|
54
|
+
let {
|
|
55
|
+
theme
|
|
56
|
+
} = _ref7;
|
|
57
|
+
return theme.shadows.focusPrimary;
|
|
58
|
+
}, ";}");
|
|
59
|
+
const CopyButton = _ref8 => {
|
|
60
|
+
let {
|
|
61
|
+
size = 'small',
|
|
62
|
+
value,
|
|
63
|
+
copyText = 'Copy',
|
|
64
|
+
copiedText = 'Copied!',
|
|
65
|
+
sentiment = 'primary',
|
|
66
|
+
noBorder,
|
|
67
|
+
className,
|
|
68
|
+
'data-testid': dataTestId
|
|
69
|
+
} = _ref8;
|
|
70
|
+
const [isCopied, setCopied] = useClipboard(value, {
|
|
71
|
+
successDuration: COPY_DURATION
|
|
72
|
+
});
|
|
73
|
+
return jsx(Tooltip, {
|
|
74
|
+
text: isCopied ? copiedText : copyText,
|
|
75
|
+
children: jsx(StyledButton, {
|
|
76
|
+
type: "button",
|
|
77
|
+
onClick: setCopied,
|
|
78
|
+
size: SIZES[size],
|
|
79
|
+
sentiment: sentiment,
|
|
80
|
+
noBorder: noBorder,
|
|
81
|
+
className: className,
|
|
82
|
+
"data-testid": dataTestId,
|
|
83
|
+
"aria-label": "Copy",
|
|
84
|
+
children: jsx(Icon, {
|
|
85
|
+
name: isCopied ? 'check' : 'copy-content',
|
|
86
|
+
size: 16
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export { CopyButton, SIZES };
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import _styled from '@emotion/styled/base';
|
|
2
|
+
import { Global } from '@emotion/react';
|
|
3
|
+
import DatePicker, { registerLocale } from 'react-datepicker';
|
|
4
|
+
import css_248z from '../../../react-datepicker/dist/react-datepicker.min.css.js';
|
|
5
|
+
import { Button } from '../Button/index.js';
|
|
6
|
+
import { Icon } from '../Icon/index.js';
|
|
7
|
+
import { Separator } from '../Separator/index.js';
|
|
8
|
+
import { Text } from '../Text/index.js';
|
|
9
|
+
import { TextInput } from '../TextInput/index.js';
|
|
10
|
+
import { jsxs, Fragment, jsx } from '@emotion/react/jsx-runtime';
|
|
11
|
+
|
|
12
|
+
const PREFIX = '.react-datepicker';
|
|
13
|
+
const StyledSeparator = /*#__PURE__*/_styled(Separator, {
|
|
14
|
+
target: "e1bm75lk5"
|
|
15
|
+
})("margin:0 ", _ref => {
|
|
16
|
+
let {
|
|
17
|
+
theme
|
|
18
|
+
} = _ref;
|
|
19
|
+
return theme.space['1'];
|
|
20
|
+
}, ";height:100%;");
|
|
21
|
+
const StyledWrapper = /*#__PURE__*/_styled("div", {
|
|
22
|
+
target: "e1bm75lk4"
|
|
23
|
+
})("width:100%;div", PREFIX, "-wrapper{display:block;}div", PREFIX, "__input-container{display:block;}div", PREFIX, "__triangle{display:none;}div", PREFIX, "__month-container{padding:16px;}", PREFIX, "-popper{z-index:1000;}.calendar{font-family:'Asap';border-color:", _ref2 => {
|
|
24
|
+
let {
|
|
25
|
+
theme
|
|
26
|
+
} = _ref2;
|
|
27
|
+
return theme.colors.neutral.borderWeak;
|
|
28
|
+
}, ";background-color:", _ref3 => {
|
|
29
|
+
let {
|
|
30
|
+
theme
|
|
31
|
+
} = _ref3;
|
|
32
|
+
return theme.colors.neutral.backgroundWeakElevated;
|
|
33
|
+
}, ";", PREFIX, "__header{color:", _ref4 => {
|
|
34
|
+
let {
|
|
35
|
+
theme
|
|
36
|
+
} = _ref4;
|
|
37
|
+
return theme.colors.neutral.text;
|
|
38
|
+
}, ";background-color:", _ref5 => {
|
|
39
|
+
let {
|
|
40
|
+
theme
|
|
41
|
+
} = _ref5;
|
|
42
|
+
return theme.colors.neutral.backgroundWeakElevated;
|
|
43
|
+
}, ";border-bottom:none;text-align:inherit;display:block;padding-top:0;position:inherit;}", PREFIX, "__triangle{border-bottom-color:", _ref6 => {
|
|
44
|
+
let {
|
|
45
|
+
theme
|
|
46
|
+
} = _ref6;
|
|
47
|
+
return theme.colors.neutral.backgroundWeak;
|
|
48
|
+
}, ";}", PREFIX, "__month{margin:0;}", PREFIX, "__day-names{margin-top:8px;}", PREFIX, "__day-name{font-family:'Asap';color:", _ref7 => {
|
|
49
|
+
let {
|
|
50
|
+
theme
|
|
51
|
+
} = _ref7;
|
|
52
|
+
return theme.colors.neutral.text;
|
|
53
|
+
}, ";font-weight:500;font-size:14px;line-height:24px;text-align:center;margin:3px;text-transform:capitalize;}", PREFIX, "__day{color:", _ref8 => {
|
|
54
|
+
let {
|
|
55
|
+
theme
|
|
56
|
+
} = _ref8;
|
|
57
|
+
return theme.colors.neutral.textWeak;
|
|
58
|
+
}, ";font-size:16px;width:1.7rem;height:1.7rem;margin-left:3px;margin-right:3px;}", PREFIX, "__day--selected{color:", _ref9 => {
|
|
59
|
+
let {
|
|
60
|
+
theme
|
|
61
|
+
} = _ref9;
|
|
62
|
+
return theme.colors.primary.text;
|
|
63
|
+
}, ";background-color:", _ref10 => {
|
|
64
|
+
let {
|
|
65
|
+
theme
|
|
66
|
+
} = _ref10;
|
|
67
|
+
return theme.colors.primary.background;
|
|
68
|
+
}, ";border-radius:", _ref11 => {
|
|
69
|
+
let {
|
|
70
|
+
theme
|
|
71
|
+
} = _ref11;
|
|
72
|
+
return theme.radii.circle;
|
|
73
|
+
}, ";}", PREFIX, "__day--keyboard-selected{color:", _ref12 => {
|
|
74
|
+
let {
|
|
75
|
+
theme
|
|
76
|
+
} = _ref12;
|
|
77
|
+
return theme.colors.primary.text;
|
|
78
|
+
}, ";background-color:", _ref13 => {
|
|
79
|
+
let {
|
|
80
|
+
theme
|
|
81
|
+
} = _ref13;
|
|
82
|
+
return theme.colors.primary.background;
|
|
83
|
+
}, ";border-radius:", _ref14 => {
|
|
84
|
+
let {
|
|
85
|
+
theme
|
|
86
|
+
} = _ref14;
|
|
87
|
+
return theme.radii.circle;
|
|
88
|
+
}, ";}", PREFIX, "__day:hover{color:", _ref15 => {
|
|
89
|
+
let {
|
|
90
|
+
theme
|
|
91
|
+
} = _ref15;
|
|
92
|
+
return theme.colors.primary.text;
|
|
93
|
+
}, ";border-radius:", _ref16 => {
|
|
94
|
+
let {
|
|
95
|
+
theme
|
|
96
|
+
} = _ref16;
|
|
97
|
+
return theme.radii.circle;
|
|
98
|
+
}, ";background-color:", _ref17 => {
|
|
99
|
+
let {
|
|
100
|
+
theme
|
|
101
|
+
} = _ref17;
|
|
102
|
+
return theme.colors.primary.background;
|
|
103
|
+
}, ";}", PREFIX, "__day--disabled{color:", _ref18 => {
|
|
104
|
+
let {
|
|
105
|
+
theme
|
|
106
|
+
} = _ref18;
|
|
107
|
+
return theme.colors.primary.textStrongDisabled;
|
|
108
|
+
}, ";}", PREFIX, "__day--disabled:hover{color:", _ref19 => {
|
|
109
|
+
let {
|
|
110
|
+
theme
|
|
111
|
+
} = _ref19;
|
|
112
|
+
return theme.colors.primary.textStrongDisabled;
|
|
113
|
+
}, ";background-color:transparent;}}");
|
|
114
|
+
const StyledSpan = /*#__PURE__*/_styled("span", {
|
|
115
|
+
target: "e1bm75lk3"
|
|
116
|
+
})("position:absolute;right:16px;top:16px;display:flex;gap:", _ref20 => {
|
|
117
|
+
let {
|
|
118
|
+
theme
|
|
119
|
+
} = _ref20;
|
|
120
|
+
return theme.space['1'];
|
|
121
|
+
}, ";");
|
|
122
|
+
const StyledIconContainer = /*#__PURE__*/_styled("div", {
|
|
123
|
+
target: "e1bm75lk2"
|
|
124
|
+
})("padding:", _ref21 => {
|
|
125
|
+
let {
|
|
126
|
+
theme
|
|
127
|
+
} = _ref21;
|
|
128
|
+
return theme.space['1'];
|
|
129
|
+
}, ";position:absolute;display:flex;align-items:center;right:0;top:0;height:48px;");
|
|
130
|
+
const TopHeaderDiv = /*#__PURE__*/_styled("div", {
|
|
131
|
+
target: "e1bm75lk1"
|
|
132
|
+
})("margin-bottom:8px;margin-left:8px;display:inline-block;background-color:", _ref22 => {
|
|
133
|
+
let {
|
|
134
|
+
theme
|
|
135
|
+
} = _ref22;
|
|
136
|
+
return theme.colors.neutral.backgroundWeakElevated;
|
|
137
|
+
}, ";");
|
|
138
|
+
const StyledText = /*#__PURE__*/_styled(Text, {
|
|
139
|
+
target: "e1bm75lk0"
|
|
140
|
+
})("text-transform:capitalize;margin-right:", _ref23 => {
|
|
141
|
+
let {
|
|
142
|
+
theme
|
|
143
|
+
} = _ref23;
|
|
144
|
+
return theme.space['1'];
|
|
145
|
+
}, ";");
|
|
146
|
+
const DEFAULT_FORMAT = value => value instanceof Date ? value.toISOString() : value;
|
|
147
|
+
const DateInput = _ref24 => {
|
|
148
|
+
let {
|
|
149
|
+
autoFocus = false,
|
|
150
|
+
disabled = false,
|
|
151
|
+
error,
|
|
152
|
+
format = DEFAULT_FORMAT,
|
|
153
|
+
label,
|
|
154
|
+
locale,
|
|
155
|
+
maxDate,
|
|
156
|
+
minDate,
|
|
157
|
+
name,
|
|
158
|
+
onBlur,
|
|
159
|
+
onChange,
|
|
160
|
+
onFocus,
|
|
161
|
+
required = false,
|
|
162
|
+
value,
|
|
163
|
+
className,
|
|
164
|
+
'data-testid': dataTestId
|
|
165
|
+
} = _ref24;
|
|
166
|
+
const localeCode = (typeof locale === 'string' ? locale : locale?.code) ?? 'en-GB';
|
|
167
|
+
if (typeof locale === 'object') {
|
|
168
|
+
registerLocale(localeCode, locale);
|
|
169
|
+
}
|
|
170
|
+
return jsxs(Fragment, {
|
|
171
|
+
children: [jsx(Global, {
|
|
172
|
+
styles: css_248z
|
|
173
|
+
}), jsx(StyledWrapper, {
|
|
174
|
+
children: jsx(DatePicker, {
|
|
175
|
+
"data-testid": dataTestId,
|
|
176
|
+
className: className,
|
|
177
|
+
autoFocus: autoFocus,
|
|
178
|
+
fixedHeight: true,
|
|
179
|
+
name: name,
|
|
180
|
+
locale: localeCode,
|
|
181
|
+
onBlur: onBlur,
|
|
182
|
+
onChange: onChange,
|
|
183
|
+
onFocus: onFocus,
|
|
184
|
+
selected: value ? new Date(value) : undefined,
|
|
185
|
+
customInput: jsxs("div", {
|
|
186
|
+
children: [jsx(TextInput, {
|
|
187
|
+
error: error ? `${error}` : undefined,
|
|
188
|
+
id: `date-input${name ? `-${name}` : ''}`,
|
|
189
|
+
label: label,
|
|
190
|
+
value: format(value) || '',
|
|
191
|
+
disabled: disabled
|
|
192
|
+
}), jsxs(StyledIconContainer, {
|
|
193
|
+
children: [required ? jsx(Icon, {
|
|
194
|
+
name: "asterisk",
|
|
195
|
+
color: "danger",
|
|
196
|
+
size: 8
|
|
197
|
+
}) : null, jsx(StyledSeparator, {
|
|
198
|
+
direction: "vertical"
|
|
199
|
+
}), jsx(Icon, {
|
|
200
|
+
name: "calendar-range",
|
|
201
|
+
color: error ? 'danger' : 'neutral',
|
|
202
|
+
size: 24
|
|
203
|
+
})]
|
|
204
|
+
})]
|
|
205
|
+
}),
|
|
206
|
+
disabled: disabled,
|
|
207
|
+
calendarClassName: "calendar",
|
|
208
|
+
minDate: minDate,
|
|
209
|
+
maxDate: maxDate,
|
|
210
|
+
renderCustomHeader: _ref25 => {
|
|
211
|
+
let {
|
|
212
|
+
date,
|
|
213
|
+
decreaseMonth,
|
|
214
|
+
increaseMonth,
|
|
215
|
+
prevMonthButtonDisabled,
|
|
216
|
+
nextMonthButtonDisabled
|
|
217
|
+
} = _ref25;
|
|
218
|
+
return jsxs(Fragment, {
|
|
219
|
+
children: [jsx(TopHeaderDiv, {
|
|
220
|
+
children: jsx(StyledText, {
|
|
221
|
+
variant: "body",
|
|
222
|
+
as: "p",
|
|
223
|
+
children: new Date(date).toLocaleString(localeCode, {
|
|
224
|
+
month: 'long',
|
|
225
|
+
year: 'numeric'
|
|
226
|
+
})
|
|
227
|
+
})
|
|
228
|
+
}), jsxs(StyledSpan, {
|
|
229
|
+
children: [jsx(Button, {
|
|
230
|
+
size: "small",
|
|
231
|
+
icon: "arrow-left",
|
|
232
|
+
sentiment: "neutral",
|
|
233
|
+
onClick: decreaseMonth,
|
|
234
|
+
disabled: prevMonthButtonDisabled
|
|
235
|
+
}), jsx(Button, {
|
|
236
|
+
size: "small",
|
|
237
|
+
icon: "arrow-right",
|
|
238
|
+
sentiment: "neutral",
|
|
239
|
+
onClick: increaseMonth,
|
|
240
|
+
disabled: nextMonthButtonDisabled
|
|
241
|
+
})]
|
|
242
|
+
})]
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
})]
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
export { DateInput };
|