@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.
Files changed (115) hide show
  1. package/LICENSE +189 -0
  2. package/README.md +64 -0
  3. package/dist/index.d.ts +2427 -0
  4. package/dist/react-datepicker/dist/react-datepicker.min.css.js +3 -0
  5. package/dist/react-toastify/dist/ReactToastify.min.css.js +3 -0
  6. package/dist/src/components/ActionBar/index.js +55 -0
  7. package/dist/src/components/Alert/index.js +144 -0
  8. package/dist/src/components/Avatar/index.js +90 -0
  9. package/dist/src/components/Badge/index.js +143 -0
  10. package/dist/src/components/Banner/index.js +117 -0
  11. package/dist/src/components/BarChart/Tooltip.js +63 -0
  12. package/dist/src/components/BarChart/index.js +94 -0
  13. package/dist/src/components/BarStack/index.js +223 -0
  14. package/dist/src/components/Breadcrumbs/index.js +89 -0
  15. package/dist/src/components/Bullet/index.js +137 -0
  16. package/dist/src/components/Button/index.js +303 -0
  17. package/dist/src/components/Card/index.js +81 -0
  18. package/dist/src/components/Carousel/index.js +162 -0
  19. package/dist/src/components/Checkbox/index.js +338 -0
  20. package/dist/src/components/CopyButton/index.js +92 -0
  21. package/dist/src/components/DateInput/index.js +250 -0
  22. package/dist/src/components/EmptyState/index.js +124 -0
  23. package/dist/src/components/Expandable/index.js +84 -0
  24. package/dist/src/components/Icon/index.js +350 -0
  25. package/dist/src/components/LineChart/CustomLegend.js +147 -0
  26. package/dist/src/components/LineChart/Tooltip.js +58 -0
  27. package/dist/src/components/LineChart/helpers.js +75 -0
  28. package/dist/src/components/LineChart/index.js +139 -0
  29. package/dist/src/components/Link/index.js +159 -0
  30. package/dist/src/components/List/Body.js +22 -0
  31. package/dist/src/components/List/Cell.js +38 -0
  32. package/dist/src/components/List/HeaderCell.js +118 -0
  33. package/dist/src/components/List/HeaderRow.js +47 -0
  34. package/dist/src/components/List/ListContext.js +120 -0
  35. package/dist/src/components/List/Row.js +211 -0
  36. package/dist/src/components/List/SelectBar.js +52 -0
  37. package/dist/src/components/List/SkeletonRows.js +54 -0
  38. package/dist/src/components/List/constants.js +3 -0
  39. package/dist/src/components/List/index.js +77 -0
  40. package/dist/src/components/Loader/index.js +87 -0
  41. package/dist/src/components/Menu/Item.js +122 -0
  42. package/dist/src/components/Menu/index.js +143 -0
  43. package/dist/src/components/Modal/index.js +279 -0
  44. package/dist/src/components/Notice/index.js +33 -0
  45. package/dist/src/components/NumberInput/helpers.js +6 -0
  46. package/dist/src/components/NumberInput/index.js +366 -0
  47. package/dist/src/components/Pagination/getPageNumbers.js +32 -0
  48. package/dist/src/components/Pagination/index.js +118 -0
  49. package/dist/src/components/PasswordCheck/index.js +42 -0
  50. package/dist/src/components/PasswordStrengthMeter/index.js +116 -0
  51. package/dist/src/components/PieChart/Legends.js +183 -0
  52. package/dist/src/components/PieChart/Tooltip.js +64 -0
  53. package/dist/src/components/PieChart/index.js +133 -0
  54. package/dist/src/components/PieChart/patterns.js +9 -0
  55. package/dist/src/components/Popover/index.js +131 -0
  56. package/dist/src/components/ProgressBar/index.js +72 -0
  57. package/dist/src/components/Radio/index.js +231 -0
  58. package/dist/src/components/Row/index.js +43 -0
  59. package/dist/src/components/SelectInput/index.js +662 -0
  60. package/dist/src/components/SelectableCard/index.js +154 -0
  61. package/dist/src/components/Separator/index.js +91 -0
  62. package/dist/src/components/Skeleton/Block.js +53 -0
  63. package/dist/src/components/Skeleton/Blocks.js +52 -0
  64. package/dist/src/components/Skeleton/BoxWithIcon.js +47 -0
  65. package/dist/src/components/Skeleton/Donut.js +58 -0
  66. package/dist/src/components/Skeleton/IconSkeleton.js +37 -0
  67. package/dist/src/components/Skeleton/Line.js +19 -0
  68. package/dist/src/components/Skeleton/List.js +60 -0
  69. package/dist/src/components/Skeleton/Slider.js +57 -0
  70. package/dist/src/components/Skeleton/index.js +85 -0
  71. package/dist/src/components/Snippet/index.js +250 -0
  72. package/dist/src/components/Stack/index.js +24 -0
  73. package/dist/src/components/Status/index.js +101 -0
  74. package/dist/src/components/StepList/index.js +81 -0
  75. package/dist/src/components/Stepper/index.js +217 -0
  76. package/dist/src/components/SwitchButton/FocusOverlay.js +47 -0
  77. package/dist/src/components/SwitchButton/index.js +131 -0
  78. package/dist/src/components/Table/Body.js +12 -0
  79. package/dist/src/components/Table/Cell.js +27 -0
  80. package/dist/src/components/Table/Header.js +21 -0
  81. package/dist/src/components/Table/HeaderCell.js +119 -0
  82. package/dist/src/components/Table/HeaderRow.js +35 -0
  83. package/dist/src/components/Table/Row.js +70 -0
  84. package/dist/src/components/Table/SelectBar.js +52 -0
  85. package/dist/src/components/Table/SkeletonRows.js +52 -0
  86. package/dist/src/components/Table/TableContext.js +91 -0
  87. package/dist/src/components/Table/index.js +84 -0
  88. package/dist/src/components/Tabs/Tab.js +165 -0
  89. package/dist/src/components/Tabs/TabMenu.js +46 -0
  90. package/dist/src/components/Tabs/TabMenuItem.js +40 -0
  91. package/dist/src/components/Tabs/TabsContext.js +6 -0
  92. package/dist/src/components/Tabs/index.js +117 -0
  93. package/dist/src/components/Tag/index.js +177 -0
  94. package/dist/src/components/TagInput/index.js +277 -0
  95. package/dist/src/components/TagList/index.js +110 -0
  96. package/dist/src/components/Text/index.js +106 -0
  97. package/dist/src/components/TextInput/index.js +529 -0
  98. package/dist/src/components/TimeInput/index.js +38 -0
  99. package/dist/src/components/Toaster/index.js +116 -0
  100. package/dist/src/components/Toggle/index.js +192 -0
  101. package/dist/src/components/Tooltip/helpers.js +131 -0
  102. package/dist/src/components/Tooltip/index.js +275 -0
  103. package/dist/src/components/VerificationCode/index.js +203 -0
  104. package/dist/src/helpers/isJSON.js +11 -0
  105. package/dist/src/helpers/legend.js +13 -0
  106. package/dist/src/helpers/recursivelyGetChildrenString.js +12 -0
  107. package/dist/src/index.js +63 -0
  108. package/dist/src/theme/index.js +25 -0
  109. package/dist/src/utils/animations.js +250 -0
  110. package/dist/src/utils/capitalize.js +4 -0
  111. package/dist/src/utils/ids.js +12 -0
  112. package/dist/src/utils/normalize.js +36 -0
  113. package/dist/src/utils/responsive/Breakpoint.js +12 -0
  114. package/dist/src/utils/responsive/utilities.js +12 -0
  115. package/package.json +70 -0
@@ -0,0 +1,529 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { css } from '@emotion/react';
3
+ import randomName from '@scaleway/random-name';
4
+ import { forwardRef, useRef, useState, useCallback, useImperativeHandle, useEffect, useMemo } from 'react';
5
+ import { Button } from '../Button/index.js';
6
+ import { Expandable } from '../Expandable/index.js';
7
+ import { Icon } from '../Icon/index.js';
8
+ import { Notice } from '../Notice/index.js';
9
+ import { Separator } from '../Separator/index.js';
10
+ import { Stack } from '../Stack/index.js';
11
+ import { Text } from '../Text/index.js';
12
+ import { jsx, jsxs } from '@emotion/react/jsx-runtime';
13
+
14
+ 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)."; }
15
+ const inputSizes = {
16
+ medium: {
17
+ default: `
18
+ height: 48px;
19
+ padding-left: 8px;
20
+ padding-right: 20px;
21
+ padding-top: 14px;
22
+ `,
23
+ full: `
24
+ padding: 8px;
25
+ `
26
+ },
27
+ small: {
28
+ default: `
29
+ height: 30px;
30
+ padding-left: 8px;
31
+ padding-right: 8px;
32
+ padding-top: 14px;
33
+ font-size: 14px;
34
+ `,
35
+ full: `
36
+ padding: 4px 8px;
37
+ `
38
+ }
39
+ };
40
+ const StyledSeparator = /*#__PURE__*/_styled(Separator, {
41
+ target: "el3h3g98"
42
+ })("margin:1px 0px;height:calc(100% - 2px);background-color:", _ref3 => {
43
+ let {
44
+ theme: {
45
+ colors
46
+ }
47
+ } = _ref3;
48
+ return colors.neutral.backgroundStrong;
49
+ }, ";");
50
+ var _ref2 = process.env.NODE_ENV === "production" ? {
51
+ name: "176jwhy",
52
+ styles: "pointer-events:auto;>button{box-shadow:none!important;}"
53
+ } : {
54
+ name: "176jwhy",
55
+ styles: "pointer-events:auto;>button{box-shadow:none!important;}",
56
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
57
+ };
58
+ const StyledRightElement = /*#__PURE__*/_styled('div', {
59
+ shouldForwardProp: prop => !['edit', 'touchable'].includes(prop),
60
+ target: "el3h3g97"
61
+ })(_ref4 => {
62
+ let {
63
+ theme: {
64
+ colors,
65
+ space
66
+ }
67
+ } = _ref4;
68
+ return /*#__PURE__*/css("pointer-events:none;position:absolute;right:0;bottom:0;top:0;padding:0 ", space['1'], ";display:flex;gap:", space['1'], ";align-items:center;transition:transform 150ms,color 150ms;color:", colors.neutral.textWeak, ";&:hover,&:focus-within{color:", colors.neutral.textWeakHover, ";}");
69
+ }, " ", _ref5 => {
70
+ let {
71
+ touchable
72
+ } = _ref5;
73
+ return touchable && _ref2;
74
+ }, ";");
75
+ var _ref = process.env.NODE_ENV === "production" ? {
76
+ name: "z8qxmc",
77
+ styles: "transform:translate(-9.6%, -3px) scale(0.8)"
78
+ } : {
79
+ name: "z8qxmc",
80
+ styles: "transform:translate(-9.6%, -3px) scale(0.8)",
81
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
82
+ };
83
+ const StyledLabel = /*#__PURE__*/_styled('label', {
84
+ shouldForwardProp: prop => !['edit', 'error', 'resizable', 'fillAvailable'].includes(prop),
85
+ target: "el3h3g96"
86
+ })("display:block;position:absolute;left:0;top:0;padding-left:8px;padding-right:8px;pointer-events:none;color:", _ref6 => {
87
+ let {
88
+ theme: {
89
+ colors
90
+ }
91
+ } = _ref6;
92
+ return colors.neutral.textWeak;
93
+ }, ";white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;height:48px;font-size:16px;transition:transform 150ms;transform:translate(0, 12px) scale(1);", _ref7 => {
94
+ let {
95
+ edit
96
+ } = _ref7;
97
+ return edit && _ref;
98
+ }, " ", _ref8 => {
99
+ let {
100
+ disabled,
101
+ theme: {
102
+ colors
103
+ }
104
+ } = _ref8;
105
+ return disabled && /*#__PURE__*/css("color:", colors.neutral.textDisabled, ";");
106
+ }, " ", _ref9 => {
107
+ let {
108
+ readOnly,
109
+ theme: {
110
+ colors
111
+ }
112
+ } = _ref9;
113
+ return readOnly && /*#__PURE__*/css("color:", colors.neutral.textDisabled, ";");
114
+ }, " ", _ref10 => {
115
+ let {
116
+ error,
117
+ theme: {
118
+ colors
119
+ }
120
+ } = _ref10;
121
+ return error && /*#__PURE__*/css("color:", colors.danger.textWeak, ";");
122
+ }, ";");
123
+ const StyledRelativeDiv = /*#__PURE__*/_styled("div", {
124
+ target: "el3h3g95"
125
+ })(process.env.NODE_ENV === "production" ? {
126
+ name: "bjn8wh",
127
+ styles: "position:relative"
128
+ } : {
129
+ name: "bjn8wh",
130
+ styles: "position:relative",
131
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
132
+ });
133
+ const StyledError = /*#__PURE__*/_styled("div", {
134
+ target: "el3h3g94"
135
+ })("font-size:12px;color:", _ref11 => {
136
+ let {
137
+ theme
138
+ } = _ref11;
139
+ return theme.colors.danger.textWeak;
140
+ }, ";padding-top:", _ref12 => {
141
+ let {
142
+ theme
143
+ } = _ref12;
144
+ return theme.space['0.25'];
145
+ }, ";");
146
+ const StyledNotice = /*#__PURE__*/_styled(Notice, {
147
+ target: "el3h3g93"
148
+ })("margin-top:", _ref13 => {
149
+ let {
150
+ theme
151
+ } = _ref13;
152
+ return theme.space['1'];
153
+ }, ";");
154
+ const StyledInput = /*#__PURE__*/_styled('input', {
155
+ shouldForwardProp: prop => !['as', 'error', 'fillAvailable', 'hasLabel', 'isPlaceholderVisible', 'multiline', 'resizable', 'inputSize', 'paddingRightFactor'].includes(prop),
156
+ target: "el3h3g92"
157
+ })("transition:border-color 0.2s ease,box-shadow 0.2s ease;appearance:none;background-color:", _ref14 => {
158
+ let {
159
+ theme: {
160
+ colors
161
+ }
162
+ } = _ref14;
163
+ return colors.neutral.backgroundWeak;
164
+ }, ";background-image:none;border:1px solid ", _ref15 => {
165
+ let {
166
+ theme: {
167
+ colors
168
+ }
169
+ } = _ref15;
170
+ return colors.neutral.borderWeak;
171
+ }, ";border-radius:", _ref16 => {
172
+ let {
173
+ theme: {
174
+ radii
175
+ }
176
+ } = _ref16;
177
+ return radii.default;
178
+ }, ";color:", _ref17 => {
179
+ let {
180
+ theme: {
181
+ colors
182
+ }
183
+ } = _ref17;
184
+ return colors.neutral.text;
185
+ }, ";display:block;max-width:100%;outline:none;position:relative;width:100%;padding-left:", _ref18 => {
186
+ let {
187
+ theme
188
+ } = _ref18;
189
+ return theme.space['1'];
190
+ }, ";padding-right:", _ref19 => {
191
+ let {
192
+ theme
193
+ } = _ref19;
194
+ return theme.space['1'];
195
+ }, ";padding-top:14px;font-size:16px;line-height:24px;&::placeholder{color:", _ref20 => {
196
+ let {
197
+ theme: {
198
+ colors
199
+ }
200
+ } = _ref20;
201
+ return colors.neutral.textWeak;
202
+ }, ";opacity:0;}&:hover,&:focus{border-color:", _ref21 => {
203
+ let {
204
+ theme: {
205
+ colors
206
+ }
207
+ } = _ref21;
208
+ return colors.primary.borderWeakHover;
209
+ }, ";}&:focus{box-shadow:", _ref22 => {
210
+ let {
211
+ theme: {
212
+ shadows
213
+ }
214
+ } = _ref22;
215
+ return shadows.focusPrimary;
216
+ }, ";border-color:", _ref23 => {
217
+ let {
218
+ theme: {
219
+ colors
220
+ }
221
+ } = _ref23;
222
+ return colors.primary.borderWeakHover;
223
+ }, ";}", _ref24 => {
224
+ let {
225
+ isPlaceholderVisible
226
+ } = _ref24;
227
+ return isPlaceholderVisible && `&::placeholder {
228
+ opacity: 1;
229
+ }`;
230
+ }, " ", _ref25 => {
231
+ let {
232
+ disabled,
233
+ theme: {
234
+ colors
235
+ }
236
+ } = _ref25;
237
+ return disabled && `cursor: default;
238
+ pointer-events: none;
239
+ background-color: ${colors.neutral.backgroundDisabled};
240
+ border-color: ${colors.neutral.borderDisabled};
241
+ color: ${colors.neutral.textDisabled};`;
242
+ }, " ", _ref26 => {
243
+ let {
244
+ readOnly,
245
+ theme: {
246
+ colors
247
+ }
248
+ } = _ref26;
249
+ return readOnly && `background-color: ${colors.neutral.backgroundDisabled};
250
+ border-color: ${colors.neutral.borderDisabled};
251
+ color: ${colors.neutral.text};`;
252
+ }, " ", _ref27 => {
253
+ let {
254
+ inputSize
255
+ } = _ref27;
256
+ return inputSizes[inputSize]?.default;
257
+ }, " ", _ref28 => {
258
+ let {
259
+ inputSize,
260
+ hasLabel
261
+ } = _ref28;
262
+ return !!inputSize && !hasLabel && inputSizes[inputSize]?.full;
263
+ }, " ", _ref29 => {
264
+ let {
265
+ error,
266
+ theme: {
267
+ colors,
268
+ shadows
269
+ }
270
+ } = _ref29;
271
+ return error && `border-color: ${colors.danger.borderWeak};
272
+
273
+ &:hover,
274
+ &:focus {
275
+ border-color: ${colors.danger.borderHover};
276
+ }
277
+
278
+ &:focus {
279
+ box-shadow: ${shadows.focusDanger};
280
+ border-color: ${colors.danger.borderWeakHover};
281
+ }`;
282
+ }, " ", _ref30 => {
283
+ let {
284
+ multiline,
285
+ resizable,
286
+ fillAvailable
287
+ } = _ref30;
288
+ return multiline && `
289
+ padding-top: 20px;
290
+ height: ${fillAvailable ? '100%' : 'initial'};
291
+ resize: ${resizable === false ? 'none' : 'vertical'};
292
+ `;
293
+ }, " ", _ref31 => {
294
+ let {
295
+ multiline,
296
+ hasLabel,
297
+ theme
298
+ } = _ref31;
299
+ return multiline && !hasLabel && `
300
+ padding-top: ${theme.space['1']};
301
+ `;
302
+ }, " ", _ref32 => {
303
+ let {
304
+ paddingRightFactor,
305
+ theme
306
+ } = _ref32;
307
+ return paddingRightFactor > 0 && `
308
+ padding-right: calc(${paddingRightFactor} * ${theme.space['4']});
309
+ `;
310
+ }, ";");
311
+ const RightComponent = /*#__PURE__*/_styled(Stack, {
312
+ target: "el3h3g91"
313
+ })(process.env.NODE_ENV === "production" ? {
314
+ name: "9bmev",
315
+ styles: "min-width:24px"
316
+ } : {
317
+ name: "9bmev",
318
+ styles: "min-width:24px",
319
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
320
+ });
321
+ const UnitLabel = /*#__PURE__*/_styled(Text, {
322
+ target: "el3h3g90"
323
+ })("padding:", _ref33 => {
324
+ let {
325
+ theme
326
+ } = _ref33;
327
+ return theme.space['1'];
328
+ }, " 0;line-height:18px;");
329
+ const TextInput = /*#__PURE__*/forwardRef((_ref34, ref) => {
330
+ let {
331
+ 'data-testid': dataTestId,
332
+ ariaControls,
333
+ autoComplete = 'on',
334
+ autoFocus,
335
+ className,
336
+ cols,
337
+ defaultValue,
338
+ disabled,
339
+ edit: forceEdit,
340
+ error,
341
+ fillAvailable,
342
+ generated,
343
+ height,
344
+ id,
345
+ label,
346
+ multiline,
347
+ name,
348
+ notice,
349
+ noTopLabel = false,
350
+ onBlur,
351
+ onChange,
352
+ onFocus,
353
+ onKeyUp,
354
+ onKeyDown,
355
+ placeholder,
356
+ random,
357
+ readOnly,
358
+ required,
359
+ resizable,
360
+ rows,
361
+ size = 'medium',
362
+ tabIndex,
363
+ type = 'text',
364
+ unit,
365
+ valid,
366
+ value,
367
+ wrap,
368
+ inputProps
369
+ } = _ref34;
370
+ const controlRef = useRef(null);
371
+ const [visited, setVisited] = useState(false);
372
+ const [passwordVisible, setPasswordVisible] = useState(false);
373
+ const togglePasswordVisibility = useCallback(() => setPasswordVisible(x => !x), []);
374
+
375
+ // Forward ref to parent ref
376
+ useImperativeHandle(ref, () => controlRef, []);
377
+
378
+ // Focus when password is visible
379
+ useEffect(() => {
380
+ if (passwordVisible) {
381
+ controlRef?.current?.focus();
382
+ }
383
+ }, [passwordVisible]);
384
+ const handlePassVisibilityClick = useCallback(() => togglePasswordVisibility(), [togglePasswordVisibility]);
385
+ const randomize = useCallback(() => onChange?.(randomName(random)), [onChange, random]);
386
+ const handleClickRandomize = useCallback(() => randomize(), [randomize]);
387
+ const handleFocus = useCallback(event => {
388
+ if (!visited && !readOnly) {
389
+ setVisited(true);
390
+ }
391
+ if (onFocus) {
392
+ onFocus(event);
393
+ }
394
+ }, [visited, readOnly, onFocus]);
395
+ const handleChange = useCallback(event => onChange?.(event.target.value), [onChange]);
396
+ const isPassToggleable = type === 'toggleable-password';
397
+ const hasLabel = !!label && !noTopLabel && size === 'medium';
398
+ const edit = hasLabel && (forceEdit || visited || value || error || generated);
399
+ const isPlaceholderVisible = !hasLabel || !!edit;
400
+ const hasRightElement = !!(valid !== undefined || isPassToggleable || random || unit);
401
+ const getType = () => {
402
+ if (isPassToggleable) {
403
+ return passwordVisible || generated ? 'text' : 'password';
404
+ }
405
+ return multiline ? undefined : type;
406
+ };
407
+ const inputSize = size;
408
+ const rightComponentsArray = useMemo(() => {
409
+ const rightComponents = [];
410
+ if (isPassToggleable && !generated) {
411
+ rightComponents.push(jsx(Button, {
412
+ "data-testid": dataTestId ? `${dataTestId}-visibility-button` : undefined,
413
+ "aria-label": passwordVisible ? 'hide' : 'show',
414
+ onClick: handlePassVisibilityClick,
415
+ variant: "ghost",
416
+ sentiment: "neutral",
417
+ icon: passwordVisible ? 'eye-off' : 'eye',
418
+ size: "small"
419
+ }, "password-visible"));
420
+ }
421
+ if (random) {
422
+ rightComponents.push(jsx(Button, {
423
+ "data-testid": dataTestId ? `${dataTestId}-randomize-button` : undefined,
424
+ "aria-label": "randomize",
425
+ onClick: handleClickRandomize,
426
+ disabled: disabled,
427
+ icon: "auto-fix",
428
+ variant: "ghost",
429
+ sentiment: "neutral",
430
+ size: "small"
431
+ }, "random"));
432
+ }
433
+ if (valid === false || valid === true) {
434
+ rightComponents.push(jsx(Icon, {
435
+ name: !valid ? 'close' : 'check',
436
+ color: !valid ? 'danger' : 'success',
437
+ size: 20
438
+ }, "valid"));
439
+ }
440
+ if (unit) {
441
+ rightComponents.push(jsx(UnitLabel, {
442
+ variant: "bodySmall",
443
+ as: "p",
444
+ prominence: "weak",
445
+ children: unit
446
+ }, "unit"));
447
+ }
448
+ return rightComponents;
449
+ }, [disabled, generated, handleClickRandomize, handlePassVisibilityClick, isPassToggleable, passwordVisible, random, unit, valid, dataTestId]);
450
+ const showSeparator = required && hasRightElement || unit;
451
+ const paddingRightFactor = rightComponentsArray.length + (required ? 1 : 0) + (showSeparator ? 0.5 : 0);
452
+ return jsxs("div", {
453
+ className: className,
454
+ children: [jsxs(StyledRelativeDiv, {
455
+ children: [jsx(StyledInput, {
456
+ "aria-controls": ariaControls,
457
+ "aria-label": label || undefined,
458
+ "aria-labelledby": hasLabel ? ariaControls : undefined,
459
+ as: multiline ? 'textarea' : 'input',
460
+ autoComplete: autoComplete,
461
+ autoFocus: autoFocus,
462
+ cols: cols,
463
+ "data-testid": dataTestId,
464
+ defaultValue: defaultValue,
465
+ disabled: disabled,
466
+ error: !!error,
467
+ fillAvailable: fillAvailable,
468
+ hasLabel: hasLabel,
469
+ paddingRightFactor: paddingRightFactor,
470
+ id: id,
471
+ inputSize: inputSize,
472
+ isPlaceholderVisible: isPlaceholderVisible,
473
+ multiline: multiline,
474
+ name: name,
475
+ onBlur: onBlur,
476
+ onChange: handleChange,
477
+ onFocus: handleFocus,
478
+ onKeyUp: onKeyUp,
479
+ onKeyDown: onKeyDown,
480
+ placeholder: placeholder,
481
+ readOnly: readOnly,
482
+ ref: controlRef,
483
+ resizable: resizable,
484
+ rows: rows,
485
+ style: {
486
+ height
487
+ },
488
+ tabIndex: tabIndex,
489
+ type: getType(),
490
+ value: value,
491
+ wrap: wrap,
492
+ ...inputProps
493
+ }), hasLabel && jsx(StyledLabel, {
494
+ edit: !!edit,
495
+ disabled: disabled,
496
+ readOnly: readOnly,
497
+ error: !!error,
498
+ id: ariaControls,
499
+ htmlFor: id,
500
+ "aria-live": "assertive",
501
+ children: label
502
+ }), hasRightElement || required ? jsxs(StyledRightElement, {
503
+ edit: !!edit,
504
+ touchable: isPassToggleable || !!random,
505
+ children: [required ? jsx(Icon, {
506
+ name: "asterisk",
507
+ color: "danger",
508
+ size: 10
509
+ }) : null, showSeparator ? jsx(StyledSeparator, {
510
+ direction: "vertical"
511
+ }) : null, rightComponentsArray.length > 0 ? jsx(RightComponent, {
512
+ justifyContent: "center",
513
+ direction: "row",
514
+ alignItems: "center",
515
+ children: rightComponentsArray
516
+ }) : null]
517
+ }) : null]
518
+ }), jsx(Expandable, {
519
+ opened: !!error,
520
+ children: jsx(StyledError, {
521
+ children: error
522
+ })
523
+ }), notice ? jsx(StyledNotice, {
524
+ children: notice
525
+ }) : null]
526
+ });
527
+ });
528
+
529
+ export { TextInput };
@@ -0,0 +1,38 @@
1
+ import { SelectInput } from '../SelectInput/index.js';
2
+ import { jsx } from '@emotion/react/jsx-runtime';
3
+
4
+ const hours = ['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00'];
5
+ const half = ['00:00', '00:30', '01:00', '01:30', '02:00', '02:30', '03:00', '03:30', '04:00', '04:30', '05:00', '05:30', '06:00', '06:30', '07:00', '07:30', '08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00', '20:30', '21:00', '21:30', '22:00', '22:30', '23:00', '23:30'];
6
+ const quarter = ['00:00', '00:15', '00:30', '00:45', '01:00', '01:15', '01:30', '01:45', '02:00', '02:15', '02:30', '02:45', '03:00', '03:15', '03:30', '03:45', '04:00', '04:15', '04:30', '04:45', '05:00', '05:15', '05:30', '05:45', '06:00', '06:15', '06:30', '06:45', '07:00', '07:15', '07:30', '07:45', '08:00', '08:15', '08:30', '08:45', '09:00', '09:15', '09:30', '09:45', '10:00', '10:15', '10:30', '10:45', '11:00', '11:15', '11:30', '11:45', '12:00', '12:15', '12:30', '12:45', '13:00', '13:15', '13:30', '13:45', '14:00', '14:15', '14:30', '14:45', '15:00', '15:15', '15:30', '15:45', '16:00', '16:15', '16:30', '16:45', '17:00', '17:15', '17:30', '17:45', '18:00', '18:15', '18:30', '18:45', '19:00', '19:15', '19:30', '19:45', '20:00', '20:15', '20:30', '20:45', '21:00', '21:15', '21:30', '21:45', '22:00', '22:15', '22:30', '22:45', '23:00', '23:15', '23:30', '23:45'];
7
+ const schedules = {
8
+ half,
9
+ hours,
10
+ quarter
11
+ };
12
+ const options = schedule => schedules[schedule].map(hour => ({
13
+ label: hour,
14
+ value: hour
15
+ }));
16
+ const defaultValue = {
17
+ label: '00:00',
18
+ value: '00:00'
19
+ };
20
+ /**
21
+ * @experimental This component is experimental and may be subject to breaking changes in the future.
22
+ */
23
+ const TimeInput = function (_temp) {
24
+ let {
25
+ value = defaultValue,
26
+ schedule = 'hours',
27
+ ...props
28
+ } = _temp === void 0 ? {} : _temp;
29
+ return jsx(SelectInput, {
30
+ ...props,
31
+ time: true,
32
+ value: value,
33
+ options: options(schedule)
34
+ });
35
+ };
36
+ TimeInput.options = options;
37
+
38
+ export { TimeInput, schedules };
@@ -0,0 +1,116 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { useTheme, Global, ClassNames, css } from '@emotion/react';
3
+ import { toast as toast$1, ToastContainer as ToastContainer$1 } from 'react-toastify';
4
+ import css_248z from '../../../react-toastify/dist/ReactToastify.min.css.js';
5
+ import { Icon } from '../Icon/index.js';
6
+ import { Stack } from '../Stack/index.js';
7
+ import { Text } from '../Text/index.js';
8
+ import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
9
+
10
+ const PREFIX = '.Toastify';
11
+ const AUTOCLOSE_DELAY = 6000; // Delay to close the toast in ms
12
+
13
+ const TOAST_ICONS = {
14
+ warning: 'alert',
15
+ info: 'information-outline',
16
+ success: 'checkbox-circle-outline',
17
+ danger: 'alert'
18
+ };
19
+ const styles = {
20
+ toast: theme => /*#__PURE__*/css("border-radius:", theme.radii.default, ";box-shadow:", theme.shadows.dropdown, ";min-height:44px;margin-bottom:", theme.space['2'], ";", PREFIX, "__toast-body{margin:0;padding:0;}&", PREFIX, "__toast--success{background-color:", theme.colors.success.background, ";color:", theme.colors.success.text, ";", PREFIX, "__progress-bar{background-color:", theme.colors.success.backgroundStrong, ";}}&", PREFIX, "__toast--info{background-color:", theme.colors.info.background, ";color:", theme.colors.info.text, ";", PREFIX, "__progress-bar{background-color:", theme.colors.info.backgroundStrong, ";}}&", PREFIX, "__toast--error{background-color:", theme.colors.danger.background, ";color:", theme.colors.danger.text, ";", PREFIX, "__progress-bar{background-color:", theme.colors.danger.backgroundStrong, ";}}")
21
+ };
22
+ const CloseButtonWrapper = /*#__PURE__*/_styled("button", {
23
+ target: "e1eb63991"
24
+ })("background:none;border:none;cursor:pointer;color:inherit;padding:0;margin:0;margin-bottom:", _ref => {
25
+ let {
26
+ theme
27
+ } = _ref;
28
+ return theme.space['2'];
29
+ }, ";");
30
+ const IconWithLeftMargin = /*#__PURE__*/_styled(Icon, {
31
+ target: "e1eb63990"
32
+ })("margin-left:", _ref2 => {
33
+ let {
34
+ theme
35
+ } = _ref2;
36
+ return theme.space['1'];
37
+ }, ";");
38
+ const CloseButton = _ref3 => {
39
+ let {
40
+ closeToast
41
+ } = _ref3;
42
+ return jsx(CloseButtonWrapper, {
43
+ type: "button",
44
+ onClick: closeToast,
45
+ children: jsx(IconWithLeftMargin, {
46
+ name: "close",
47
+ size: 18
48
+ })
49
+ });
50
+ };
51
+ const Content = _ref4 => {
52
+ let {
53
+ variant,
54
+ children
55
+ } = _ref4;
56
+ return jsxs(Stack, {
57
+ gap: 2,
58
+ direction: "row",
59
+ children: [jsx(Icon, {
60
+ name: TOAST_ICONS[variant],
61
+ size: 24
62
+ }), jsx(Text, {
63
+ variant: "body",
64
+ as: "span",
65
+ color: variant,
66
+ children: children
67
+ })]
68
+ });
69
+ };
70
+ const toast = {
71
+ error: (children, options) => toast$1.error(jsx(Content, {
72
+ variant: "danger",
73
+ children: children
74
+ }), options),
75
+ info: (children, options) => toast$1.info(jsx(Content, {
76
+ variant: "info",
77
+ children: children
78
+ }), options),
79
+ success: (children, options) => toast$1.success(jsx(Content, {
80
+ variant: "success",
81
+ children: children
82
+ }), options)
83
+ };
84
+ const ToastContainer = _ref5 => {
85
+ let {
86
+ newestOnTop,
87
+ limit,
88
+ position,
89
+ 'data-testid': dataTestId
90
+ } = _ref5;
91
+ const theme = useTheme();
92
+ return jsxs(Fragment, {
93
+ children: [jsx(Global, {
94
+ styles: css_248z
95
+ }), jsx(ClassNames, {
96
+ children: _ref6 => {
97
+ let {
98
+ css: localCss
99
+ } = _ref6;
100
+ return jsx(ToastContainer$1, {
101
+ "data-testid": dataTestId,
102
+ closeButton: jsx(CloseButton, {}),
103
+ toastClassName: localCss(styles.toast(theme)),
104
+ autoClose: AUTOCLOSE_DELAY,
105
+ icon: false,
106
+ newestOnTop: newestOnTop,
107
+ limit: limit,
108
+ position: position,
109
+ css: /*#__PURE__*/css("top:100px;right:calc(0% + ", theme.space['2'], ");")
110
+ });
111
+ }
112
+ })]
113
+ });
114
+ };
115
+
116
+ export { ToastContainer, toast };