@ultraviolet/ui 1.11.1 → 1.13.1
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.d.ts +4 -0
- package/dist/src/components/Checkbox/index.js +137 -102
- package/dist/src/components/Modal/Dialog.js +8 -5
- package/dist/src/components/Modal/Disclosure.js +0 -5
- package/dist/src/components/Radio/index.js +41 -36
- package/dist/src/components/Stack/index.js +5 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1096,6 +1096,7 @@ type CheckboxProps = {
|
|
|
1096
1096
|
['data-visibility']?: string;
|
|
1097
1097
|
required?: boolean;
|
|
1098
1098
|
'data-testid'?: string;
|
|
1099
|
+
tooltip?: string;
|
|
1099
1100
|
} & Pick<InputHTMLAttributes<HTMLInputElement>, 'onFocus' | 'onBlur' | 'name' | 'value' | 'autoFocus' | 'id' | 'onChange'> & XOR<[
|
|
1100
1101
|
{
|
|
1101
1102
|
/**
|
|
@@ -1691,6 +1692,7 @@ type RadioProps = {
|
|
|
1691
1692
|
helper?: ReactNode;
|
|
1692
1693
|
className?: string;
|
|
1693
1694
|
'data-testid'?: string;
|
|
1695
|
+
tooltip?: string;
|
|
1694
1696
|
} & Required<Pick<InputHTMLAttributes<HTMLInputElement>, 'onChange'>> & Pick<InputHTMLAttributes<HTMLInputElement>, 'onFocus' | 'onBlur' | 'disabled' | 'autoFocus' | 'onKeyDown' | 'id' | 'name' | 'required'> & ({
|
|
1695
1697
|
'aria-label': string;
|
|
1696
1698
|
label?: never;
|
|
@@ -1863,6 +1865,8 @@ type StackProps = {
|
|
|
1863
1865
|
alignItems?: CSSProperties['alignItems'];
|
|
1864
1866
|
justifyContent?: CSSProperties['justifyContent'];
|
|
1865
1867
|
wrap?: boolean | CSSProperties['flexWrap'];
|
|
1868
|
+
width?: CSSProperties['width'];
|
|
1869
|
+
flex?: CSSProperties['flex'];
|
|
1866
1870
|
className?: string;
|
|
1867
1871
|
children: ReactNode;
|
|
1868
1872
|
'data-testid'?: string;
|
|
@@ -6,7 +6,8 @@ import { Loader } from '../Loader/index.js';
|
|
|
6
6
|
import { Row } from '../Row/index.js';
|
|
7
7
|
import { Stack } from '../Stack/index.js';
|
|
8
8
|
import { Text } from '../Text/index.js';
|
|
9
|
-
import {
|
|
9
|
+
import { Tooltip } from '../Tooltip/index.js';
|
|
10
|
+
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
10
11
|
|
|
11
12
|
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)."; }
|
|
12
13
|
const ErrorText = /*#__PURE__*/_styled(Text, {
|
|
@@ -107,7 +108,7 @@ const CheckboxInput = /*#__PURE__*/_styled('input', {
|
|
|
107
108
|
let {
|
|
108
109
|
theme
|
|
109
110
|
} = _ref14;
|
|
110
|
-
return theme.colors.primary.
|
|
111
|
+
return theme.colors.primary.borderStrong;
|
|
111
112
|
}, ";}}&[aria-invalid='true']+", StyledIcon, ",&[aria-invalid='mixed']+", StyledIcon, "{fill:", _ref15 => {
|
|
112
113
|
let {
|
|
113
114
|
theme
|
|
@@ -190,7 +191,7 @@ const CheckboxContainer = /*#__PURE__*/_styled("div", {
|
|
|
190
191
|
let {
|
|
191
192
|
theme
|
|
192
193
|
} = _ref30;
|
|
193
|
-
return theme.colors.neutral.
|
|
194
|
+
return theme.colors.neutral.borderStrongDisabled;
|
|
194
195
|
}, ";fill:", _ref31 => {
|
|
195
196
|
let {
|
|
196
197
|
theme
|
|
@@ -200,17 +201,17 @@ const CheckboxContainer = /*#__PURE__*/_styled("div", {
|
|
|
200
201
|
let {
|
|
201
202
|
theme
|
|
202
203
|
} = _ref32;
|
|
203
|
-
return theme.colors.danger.
|
|
204
|
+
return theme.colors.danger.backgroundStrongDisabled;
|
|
204
205
|
}, ";", InnerCheckbox, "{stroke:", _ref33 => {
|
|
205
206
|
let {
|
|
206
207
|
theme
|
|
207
208
|
} = _ref33;
|
|
208
|
-
return theme.colors.danger.
|
|
209
|
+
return theme.colors.danger.borderStrongDisabled;
|
|
209
210
|
}, ";fill:", _ref34 => {
|
|
210
211
|
let {
|
|
211
212
|
theme
|
|
212
213
|
} = _ref34;
|
|
213
|
-
return theme.colors.danger.
|
|
214
|
+
return theme.colors.danger.backgroundStrongDisabled;
|
|
214
215
|
}, ";}}", CheckboxInput, "[aria-invalid=\"true\"]+", StyledIcon, "{fill:", _ref35 => {
|
|
215
216
|
let {
|
|
216
217
|
theme
|
|
@@ -230,7 +231,7 @@ const CheckboxContainer = /*#__PURE__*/_styled("div", {
|
|
|
230
231
|
let {
|
|
231
232
|
theme
|
|
232
233
|
} = _ref38;
|
|
233
|
-
return theme.colors.primary.
|
|
234
|
+
return theme.colors.primary.backgroundStrongDisabled;
|
|
234
235
|
}, ";", InnerCheckbox, "{stroke:", _ref39 => {
|
|
235
236
|
let {
|
|
236
237
|
theme
|
|
@@ -245,37 +246,37 @@ const CheckboxContainer = /*#__PURE__*/_styled("div", {
|
|
|
245
246
|
let {
|
|
246
247
|
theme
|
|
247
248
|
} = _ref41;
|
|
248
|
-
return theme.colors.primary.
|
|
249
|
+
return theme.colors.primary.backgroundStrongDisabled;
|
|
249
250
|
}, ";", InnerCheckbox, "{stroke:", _ref42 => {
|
|
250
251
|
let {
|
|
251
252
|
theme
|
|
252
253
|
} = _ref42;
|
|
253
|
-
return theme.colors.primary.
|
|
254
|
+
return theme.colors.primary.borderStrongDisabled;
|
|
254
255
|
}, ";fill:", _ref43 => {
|
|
255
256
|
let {
|
|
256
257
|
theme
|
|
257
258
|
} = _ref43;
|
|
258
|
-
return theme.colors.primary.
|
|
259
|
+
return theme.colors.primary.backgroundStrongDisabled;
|
|
259
260
|
}, ";}}}", CheckboxInput, ":checked+", StyledIcon, " path{transform-origin:center;transition:200ms transform ease-in-out;transform:scale(1);transform:translate(2px, 2px);}", CheckboxInput, ":checked+", StyledIcon, " ", InnerCheckbox, "{fill:", _ref44 => {
|
|
260
261
|
let {
|
|
261
262
|
theme
|
|
262
263
|
} = _ref44;
|
|
263
|
-
return theme.colors.primary.
|
|
264
|
+
return theme.colors.primary.backgroundStrong;
|
|
264
265
|
}, ";stroke:", _ref45 => {
|
|
265
266
|
let {
|
|
266
267
|
theme
|
|
267
268
|
} = _ref45;
|
|
268
|
-
return theme.colors.primary.
|
|
269
|
+
return theme.colors.primary.borderStrong;
|
|
269
270
|
}, ";}", CheckboxInput, "[aria-invalid=\"true\"]:checked+", StyledIcon, " ", InnerCheckbox, "{fill:", _ref46 => {
|
|
270
271
|
let {
|
|
271
272
|
theme
|
|
272
273
|
} = _ref46;
|
|
273
|
-
return theme.colors.danger.
|
|
274
|
+
return theme.colors.danger.backgroundStrong;
|
|
274
275
|
}, ";stroke:", _ref47 => {
|
|
275
276
|
let {
|
|
276
277
|
theme
|
|
277
278
|
} = _ref47;
|
|
278
|
-
return theme.colors.danger.
|
|
279
|
+
return theme.colors.danger.borderStrong;
|
|
279
280
|
}, ";}", CheckboxInput, "[aria-checked=\"mixed\"]+", StyledIcon, "{", CheckMixedMark, "{fill:", _ref48 => {
|
|
280
281
|
let {
|
|
281
282
|
theme
|
|
@@ -285,12 +286,12 @@ const CheckboxContainer = /*#__PURE__*/_styled("div", {
|
|
|
285
286
|
let {
|
|
286
287
|
theme
|
|
287
288
|
} = _ref49;
|
|
288
|
-
return theme.colors.primary.
|
|
289
|
+
return theme.colors.primary.backgroundStrong;
|
|
289
290
|
}, ";stroke:", _ref50 => {
|
|
290
291
|
let {
|
|
291
292
|
theme
|
|
292
293
|
} = _ref50;
|
|
293
|
-
return theme.colors.primary.
|
|
294
|
+
return theme.colors.primary.borderStrong;
|
|
294
295
|
}, ";}}&:hover[aria-disabled='false']{", CheckboxInput, "[aria-invalid='false']{&[aria-checked='false']+", StyledIcon, " ", InnerCheckbox, "{stroke:", _ref51 => {
|
|
295
296
|
let {
|
|
296
297
|
theme
|
|
@@ -301,30 +302,60 @@ const CheckboxContainer = /*#__PURE__*/_styled("div", {
|
|
|
301
302
|
theme
|
|
302
303
|
} = _ref52;
|
|
303
304
|
return theme.colors.primary.backgroundHover;
|
|
304
|
-
}, ";}
|
|
305
|
+
}, ";}&[aria-checked='true']+", StyledIcon, " ", InnerCheckbox, "{stroke:", _ref53 => {
|
|
305
306
|
let {
|
|
306
307
|
theme
|
|
307
308
|
} = _ref53;
|
|
308
|
-
return theme.colors.
|
|
309
|
+
return theme.colors.primary.borderStrongHover;
|
|
309
310
|
}, ";fill:", _ref54 => {
|
|
310
311
|
let {
|
|
311
312
|
theme
|
|
312
313
|
} = _ref54;
|
|
313
|
-
return theme.colors.
|
|
314
|
-
}, ";}
|
|
314
|
+
return theme.colors.primary.backgroundStrongHover;
|
|
315
|
+
}, ";}&[aria-checked='mixed']+", StyledIcon, " ", InnerCheckbox, "{stroke:", _ref55 => {
|
|
315
316
|
let {
|
|
316
317
|
theme
|
|
317
318
|
} = _ref55;
|
|
318
|
-
return theme.colors.
|
|
319
|
-
}, ";
|
|
319
|
+
return theme.colors.primary.borderStrongHover;
|
|
320
|
+
}, ";fill:", _ref56 => {
|
|
320
321
|
let {
|
|
321
322
|
theme
|
|
322
323
|
} = _ref56;
|
|
323
|
-
return theme.colors.
|
|
324
|
-
}, ";
|
|
324
|
+
return theme.colors.primary.backgroundStrongHover;
|
|
325
|
+
}, ";}}", CheckboxInput, "[aria-invalid='true']{&[aria-checked='false']+", StyledIcon, " ", InnerCheckbox, "{stroke:", _ref57 => {
|
|
325
326
|
let {
|
|
326
327
|
theme
|
|
327
328
|
} = _ref57;
|
|
329
|
+
return theme.colors.danger.borderHover;
|
|
330
|
+
}, ";fill:", _ref58 => {
|
|
331
|
+
let {
|
|
332
|
+
theme
|
|
333
|
+
} = _ref58;
|
|
334
|
+
return theme.colors.danger.backgroundHover;
|
|
335
|
+
}, ";}&[aria-checked='true']+", StyledIcon, " ", InnerCheckbox, "{stroke:", _ref59 => {
|
|
336
|
+
let {
|
|
337
|
+
theme
|
|
338
|
+
} = _ref59;
|
|
339
|
+
return theme.colors.danger.borderStrongHover;
|
|
340
|
+
}, ";fill:", _ref60 => {
|
|
341
|
+
let {
|
|
342
|
+
theme
|
|
343
|
+
} = _ref60;
|
|
344
|
+
return theme.colors.danger.backgroundStrongHover;
|
|
345
|
+
}, ";}}}", CheckboxInput, "[aria-invalid=\"true\"]+", StyledIcon, "{fill:", _ref61 => {
|
|
346
|
+
let {
|
|
347
|
+
theme
|
|
348
|
+
} = _ref61;
|
|
349
|
+
return theme.colors.danger.backgroundStrong;
|
|
350
|
+
}, ";", InnerCheckbox, "{stroke:", _ref62 => {
|
|
351
|
+
let {
|
|
352
|
+
theme
|
|
353
|
+
} = _ref62;
|
|
354
|
+
return theme.colors.danger.backgroundStrong;
|
|
355
|
+
}, ";fill:", _ref63 => {
|
|
356
|
+
let {
|
|
357
|
+
theme
|
|
358
|
+
} = _ref63;
|
|
328
359
|
return theme.colors.danger.background;
|
|
329
360
|
}, ";}}");
|
|
330
361
|
const StyledActivityContainer = /*#__PURE__*/_styled("div", {
|
|
@@ -337,7 +368,7 @@ const StyledActivityContainer = /*#__PURE__*/_styled("div", {
|
|
|
337
368
|
styles: "display:flex",
|
|
338
369
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
339
370
|
});
|
|
340
|
-
const Checkbox = /*#__PURE__*/forwardRef((
|
|
371
|
+
const Checkbox = /*#__PURE__*/forwardRef((_ref64, ref) => {
|
|
341
372
|
let {
|
|
342
373
|
checked = false,
|
|
343
374
|
onChange,
|
|
@@ -356,8 +387,9 @@ const Checkbox = /*#__PURE__*/forwardRef((_ref58, ref) => {
|
|
|
356
387
|
'data-visibility': dataVisibility,
|
|
357
388
|
'aria-label': ariaLabel,
|
|
358
389
|
required,
|
|
359
|
-
'data-testid': dataTestId
|
|
360
|
-
|
|
390
|
+
'data-testid': dataTestId,
|
|
391
|
+
tooltip
|
|
392
|
+
} = _ref64;
|
|
361
393
|
const [state, setState] = useState(checked);
|
|
362
394
|
const id = useId();
|
|
363
395
|
const computedName = name ?? id;
|
|
@@ -374,84 +406,87 @@ const Checkbox = /*#__PURE__*/forwardRef((_ref58, ref) => {
|
|
|
374
406
|
setState(current => !current);
|
|
375
407
|
}
|
|
376
408
|
}, []);
|
|
377
|
-
return
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
id: computedName,
|
|
391
|
-
type: "checkbox",
|
|
392
|
-
"aria-invalid": !!error,
|
|
393
|
-
"aria-describedby": error ? `${computedName}-hint` : undefined,
|
|
394
|
-
"aria-checked": state === 'indeterminate' ? 'mixed' : state,
|
|
395
|
-
"aria-label": ariaLabel,
|
|
396
|
-
checked: state === 'indeterminate' ? false : state,
|
|
397
|
-
size: size,
|
|
398
|
-
onChange: onLocalChange,
|
|
399
|
-
onKeyDown: onKeyDown,
|
|
400
|
-
onFocus: onFocus,
|
|
401
|
-
onBlur: onBlur,
|
|
402
|
-
disabled: disabled,
|
|
403
|
-
value: value,
|
|
404
|
-
name: computedName,
|
|
405
|
-
autoFocus: autoFocus,
|
|
406
|
-
ref: ref,
|
|
407
|
-
required: required
|
|
408
|
-
}), !progress ? jsx(StyledIcon, {
|
|
409
|
-
size: size,
|
|
410
|
-
viewBox: "0 0 24 24",
|
|
411
|
-
children: jsx(CheckboxIconContainer, {
|
|
412
|
-
children: state !== 'indeterminate' ? jsx("path", {
|
|
413
|
-
fillRule: "evenodd",
|
|
414
|
-
clipRule: "evenodd",
|
|
415
|
-
width: 14,
|
|
416
|
-
height: 14,
|
|
417
|
-
d: "M15.6678 5.26709C16.0849 5.6463 16.113 6.28907 15.7307 6.70276L9.29172 13.6705C9.10291 13.8748 8.83818 13.9937 8.55884 13.9998C8.2795 14.0058 8.0098 13.8984 7.81223 13.7024L4.30004 10.2185C3.89999 9.82169 3.89999 9.17831 4.30004 8.78149C4.70009 8.38467 5.34869 8.38467 5.74874 8.78149L8.50441 11.5149L14.2205 5.32951C14.6028 4.91583 15.2508 4.88788 15.6678 5.26709Z",
|
|
418
|
-
fill: "white"
|
|
419
|
-
}) : jsx(CheckMixedMark, {
|
|
420
|
-
x: "6",
|
|
421
|
-
y: "11",
|
|
422
|
-
rx: "1",
|
|
423
|
-
width: "12",
|
|
424
|
-
height: "2"
|
|
409
|
+
return jsx(Tooltip, {
|
|
410
|
+
text: tooltip,
|
|
411
|
+
children: jsxs(CheckboxContainer, {
|
|
412
|
+
className: className,
|
|
413
|
+
"aria-disabled": disabled,
|
|
414
|
+
"data-visibility": dataVisibility,
|
|
415
|
+
"data-checked": state,
|
|
416
|
+
"data-error": !!error,
|
|
417
|
+
"data-testid": dataTestId,
|
|
418
|
+
children: [progress ? jsx(StyledActivityContainer, {
|
|
419
|
+
children: jsx(Loader, {
|
|
420
|
+
active: true,
|
|
421
|
+
size: size
|
|
425
422
|
})
|
|
426
|
-
})
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
423
|
+
}) : null, jsx(CheckboxInput, {
|
|
424
|
+
id: computedName,
|
|
425
|
+
type: "checkbox",
|
|
426
|
+
"aria-invalid": !!error,
|
|
427
|
+
"aria-describedby": error ? `${computedName}-hint` : undefined,
|
|
428
|
+
"aria-checked": state === 'indeterminate' ? 'mixed' : state,
|
|
429
|
+
"aria-label": ariaLabel,
|
|
430
|
+
checked: state === 'indeterminate' ? false : state,
|
|
431
|
+
size: size,
|
|
432
|
+
onChange: onLocalChange,
|
|
433
|
+
onKeyDown: onKeyDown,
|
|
434
|
+
onFocus: onFocus,
|
|
435
|
+
onBlur: onBlur,
|
|
436
|
+
disabled: disabled,
|
|
437
|
+
value: value,
|
|
438
|
+
name: computedName,
|
|
439
|
+
autoFocus: autoFocus,
|
|
440
|
+
ref: ref,
|
|
441
|
+
required: required
|
|
442
|
+
}), !progress ? jsx(StyledIcon, {
|
|
443
|
+
size: size,
|
|
444
|
+
viewBox: "0 0 24 24",
|
|
445
|
+
children: jsx(CheckboxIconContainer, {
|
|
446
|
+
children: state !== 'indeterminate' ? jsx("path", {
|
|
447
|
+
fillRule: "evenodd",
|
|
448
|
+
clipRule: "evenodd",
|
|
449
|
+
width: 14,
|
|
450
|
+
height: 14,
|
|
451
|
+
d: "M15.6678 5.26709C16.0849 5.6463 16.113 6.28907 15.7307 6.70276L9.29172 13.6705C9.10291 13.8748 8.83818 13.9937 8.55884 13.9998C8.2795 14.0058 8.0098 13.8984 7.81223 13.7024L4.30004 10.2185C3.89999 9.82169 3.89999 9.17831 4.30004 8.78149C4.70009 8.38467 5.34869 8.38467 5.74874 8.78149L8.50441 11.5149L14.2205 5.32951C14.6028 4.91583 15.2508 4.88788 15.6678 5.26709Z",
|
|
452
|
+
fill: "white"
|
|
453
|
+
}) : jsx(CheckMixedMark, {
|
|
454
|
+
x: "6",
|
|
455
|
+
y: "11",
|
|
456
|
+
rx: "1",
|
|
457
|
+
width: "12",
|
|
458
|
+
height: "2"
|
|
440
459
|
})
|
|
460
|
+
})
|
|
461
|
+
}) : null, jsxs(Stack, {
|
|
462
|
+
gap: 0.25,
|
|
463
|
+
children: [jsxs(Row, {
|
|
464
|
+
templateColumns: "11fr 1fr",
|
|
465
|
+
alignItems: "center",
|
|
466
|
+
children: [children ? jsx(StyledLabel, {
|
|
467
|
+
htmlFor: computedName,
|
|
468
|
+
children: children
|
|
469
|
+
}) : null, required ? jsx("sup", {
|
|
470
|
+
children: jsx(Icon, {
|
|
471
|
+
name: "asterisk",
|
|
472
|
+
size: 10,
|
|
473
|
+
color: "danger"
|
|
474
|
+
})
|
|
475
|
+
}) : null]
|
|
476
|
+
}), helper ? jsx(Text, {
|
|
477
|
+
variant: "bodySmall",
|
|
478
|
+
as: "p",
|
|
479
|
+
prominence: "weak",
|
|
480
|
+
color: "neutral",
|
|
481
|
+
children: helper
|
|
482
|
+
}) : null, error ? jsx(ErrorText, {
|
|
483
|
+
variant: "bodySmall",
|
|
484
|
+
as: "p",
|
|
485
|
+
color: "danger",
|
|
486
|
+
children: error
|
|
441
487
|
}) : null]
|
|
442
|
-
})
|
|
443
|
-
|
|
444
|
-
as: "p",
|
|
445
|
-
prominence: "weak",
|
|
446
|
-
color: "neutral",
|
|
447
|
-
children: helper
|
|
448
|
-
}) : null, error ? jsx(ErrorText, {
|
|
449
|
-
variant: "bodySmall",
|
|
450
|
-
as: "p",
|
|
451
|
-
color: "danger",
|
|
452
|
-
children: error
|
|
453
|
-
}) : null]
|
|
454
|
-
})]
|
|
488
|
+
})]
|
|
489
|
+
})
|
|
455
490
|
});
|
|
456
491
|
});
|
|
457
492
|
|
|
@@ -81,7 +81,6 @@ const Dialog = _ref9 => {
|
|
|
81
81
|
const element = containerRef.current;
|
|
82
82
|
if (open) {
|
|
83
83
|
document.body.appendChild(element);
|
|
84
|
-
dialogRef.current?.focus();
|
|
85
84
|
}
|
|
86
85
|
return () => {
|
|
87
86
|
if (document.body.contains(element)) {
|
|
@@ -105,6 +104,7 @@ const Dialog = _ref9 => {
|
|
|
105
104
|
}
|
|
106
105
|
};
|
|
107
106
|
if (open) {
|
|
107
|
+
dialogRef.current?.focus();
|
|
108
108
|
document.body.addEventListener('keyup', handleEscPress, {
|
|
109
109
|
capture: true
|
|
110
110
|
});
|
|
@@ -124,11 +124,13 @@ const Dialog = _ref9 => {
|
|
|
124
124
|
|
|
125
125
|
// Handle body scroll
|
|
126
126
|
useEffect(() => {
|
|
127
|
+
const previousOverflow = document.body.style.overflow;
|
|
127
128
|
if (open && preventBodyScroll) {
|
|
128
129
|
document.body.style.overflow = 'hidden';
|
|
129
|
-
} else {
|
|
130
|
-
document.body.style.overflow = 'auto';
|
|
131
130
|
}
|
|
131
|
+
return () => {
|
|
132
|
+
document.body.style.overflow = previousOverflow;
|
|
133
|
+
};
|
|
132
134
|
}, [preventBodyScroll, open]);
|
|
133
135
|
|
|
134
136
|
// Stop focus to prevent unexpected body loose focus
|
|
@@ -166,11 +168,11 @@ const Dialog = _ref9 => {
|
|
|
166
168
|
const firstFocusableEl = focusableEls[0];
|
|
167
169
|
const lastFocusableEl = focusableEls[focusableEls.length - 1];
|
|
168
170
|
if (event.shiftKey) {
|
|
169
|
-
if (document.activeElement === firstFocusableEl) {
|
|
171
|
+
if (document.activeElement === firstFocusableEl || document.activeElement === dialogRef.current) {
|
|
170
172
|
lastFocusableEl.focus();
|
|
171
173
|
event.preventDefault();
|
|
172
174
|
}
|
|
173
|
-
} else if (document.activeElement === lastFocusableEl) {
|
|
175
|
+
} else if (document.activeElement === lastFocusableEl || document.activeElement === dialogRef.current) {
|
|
174
176
|
firstFocusableEl.focus();
|
|
175
177
|
event.preventDefault();
|
|
176
178
|
}
|
|
@@ -204,6 +206,7 @@ const Dialog = _ref9 => {
|
|
|
204
206
|
onClose: stopCancel,
|
|
205
207
|
"aria-modal": true,
|
|
206
208
|
ref: dialogRef,
|
|
209
|
+
tabIndex: 0,
|
|
207
210
|
children: open ? children : null
|
|
208
211
|
})
|
|
209
212
|
}), containerRef.current);
|
|
@@ -17,11 +17,6 @@ const Disclosure = _ref => {
|
|
|
17
17
|
element?.removeEventListener('click', handleOpen);
|
|
18
18
|
};
|
|
19
19
|
}, [handleOpen, disclosureRef]);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (!visible) {
|
|
22
|
-
disclosureRef.current?.focus();
|
|
23
|
-
}
|
|
24
|
-
}, [visible, disclosureRef]);
|
|
25
20
|
if (typeof disclosure === 'function') {
|
|
26
21
|
return disclosure({
|
|
27
22
|
visible,
|
|
@@ -2,7 +2,8 @@ import _styled from '@emotion/styled/base';
|
|
|
2
2
|
import { forwardRef, useId } from 'react';
|
|
3
3
|
import { Stack } from '../Stack/index.js';
|
|
4
4
|
import { Text } from '../Text/index.js';
|
|
5
|
-
import {
|
|
5
|
+
import { Tooltip } from '../Tooltip/index.js';
|
|
6
|
+
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
6
7
|
|
|
7
8
|
const SIZE = 24;
|
|
8
9
|
const InnerCircleRing = /*#__PURE__*/_styled("circle", {
|
|
@@ -144,48 +145,52 @@ const Radio = /*#__PURE__*/forwardRef((_ref19, ref) => {
|
|
|
144
145
|
className,
|
|
145
146
|
autoFocus,
|
|
146
147
|
onKeyDown,
|
|
148
|
+
tooltip,
|
|
147
149
|
'aria-label': ariaLabel,
|
|
148
150
|
'data-testid': dataTestId
|
|
149
151
|
} = _ref19;
|
|
150
152
|
const id = useId();
|
|
151
153
|
const computedName = name ?? id;
|
|
152
|
-
return
|
|
153
|
-
|
|
154
|
-
children:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
"data-checked": checked,
|
|
158
|
-
"data-error": error,
|
|
159
|
-
"data-testid": dataTestId,
|
|
160
|
-
children: [jsx(RadioInput, {
|
|
161
|
-
type: "radio",
|
|
162
|
-
"aria-invalid": !!error,
|
|
154
|
+
return jsx(Tooltip, {
|
|
155
|
+
text: tooltip,
|
|
156
|
+
children: jsxs(Stack, {
|
|
157
|
+
gap: 0.5,
|
|
158
|
+
children: [jsxs(RadioContainer, {
|
|
163
159
|
"aria-disabled": disabled,
|
|
164
|
-
|
|
165
|
-
checked: checked,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
160
|
+
className: className,
|
|
161
|
+
"data-checked": checked,
|
|
162
|
+
"data-error": error,
|
|
163
|
+
"data-testid": dataTestId,
|
|
164
|
+
children: [jsx(RadioInput, {
|
|
165
|
+
type: "radio",
|
|
166
|
+
"aria-invalid": !!error,
|
|
167
|
+
"aria-disabled": disabled,
|
|
168
|
+
"aria-label": ariaLabel,
|
|
169
|
+
checked: checked,
|
|
170
|
+
id: `${computedName}-${value}`,
|
|
171
|
+
onChange: onChange,
|
|
172
|
+
onFocus: onFocus,
|
|
173
|
+
onKeyDown: onKeyDown,
|
|
174
|
+
onBlur: onBlur,
|
|
175
|
+
value: value,
|
|
176
|
+
disabled: disabled,
|
|
177
|
+
name: computedName,
|
|
178
|
+
autoFocus: autoFocus,
|
|
179
|
+
ref: ref
|
|
180
|
+
}), jsx(Ring, {
|
|
181
|
+
viewBox: "0 0 24 24",
|
|
182
|
+
children: jsx(RadioMarkedIcon, {})
|
|
183
|
+
}), label ? jsx("label", {
|
|
184
|
+
htmlFor: `${computedName}-${value}`,
|
|
185
|
+
children: label
|
|
186
|
+
}) : null]
|
|
187
|
+
}), helper ? jsx(MargedText, {
|
|
188
|
+
as: "p",
|
|
189
|
+
variant: "bodySmall",
|
|
190
|
+
prominence: "weak",
|
|
191
|
+
children: helper
|
|
182
192
|
}) : null]
|
|
183
|
-
})
|
|
184
|
-
as: "p",
|
|
185
|
-
variant: "bodySmall",
|
|
186
|
-
prominence: "weak",
|
|
187
|
-
children: helper
|
|
188
|
-
}) : null]
|
|
193
|
+
})
|
|
189
194
|
});
|
|
190
195
|
});
|
|
191
196
|
|
|
@@ -10,7 +10,9 @@ const Stack = /*#__PURE__*/_styled('div', {
|
|
|
10
10
|
direction = 'column',
|
|
11
11
|
alignItems = 'normal',
|
|
12
12
|
justifyContent = 'normal',
|
|
13
|
-
wrap = 'nowrap'
|
|
13
|
+
wrap = 'nowrap',
|
|
14
|
+
width,
|
|
15
|
+
flex
|
|
14
16
|
} = _ref;
|
|
15
17
|
return `
|
|
16
18
|
gap: ${theme.space[gap]};
|
|
@@ -18,6 +20,8 @@ const Stack = /*#__PURE__*/_styled('div', {
|
|
|
18
20
|
align-items: ${alignItems};
|
|
19
21
|
justify-content: ${justifyContent};
|
|
20
22
|
flex-wrap: ${typeof wrap === 'boolean' ? 'wrap' : wrap};
|
|
23
|
+
${flex ? `flex: ${flex};` : ''}
|
|
24
|
+
${width ? `width: ${width};` : ''}
|
|
21
25
|
`;
|
|
22
26
|
}, ";");
|
|
23
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultraviolet/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.1",
|
|
4
4
|
"description": "Ultraviolet UI",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"react-dom": "18.2.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@babel/core": "7.22.
|
|
42
|
+
"@babel/core": "7.22.17",
|
|
43
43
|
"@emotion/babel-plugin": "11.11.0",
|
|
44
44
|
"@emotion/react": "11.11.1",
|
|
45
45
|
"@emotion/styled": "11.11.0",
|
|
46
|
-
"@types/react": "18.2.
|
|
46
|
+
"@types/react": "18.2.21",
|
|
47
47
|
"@types/react-datepicker": "4.15.0",
|
|
48
|
-
"@types/react-dom": "18.2.
|
|
48
|
+
"@types/react-dom": "18.2.7",
|
|
49
49
|
"react": "18.2.0",
|
|
50
50
|
"react-dom": "18.2.0"
|
|
51
51
|
},
|
|
@@ -68,6 +68,6 @@
|
|
|
68
68
|
"react-use-clipboard": "1.0.9",
|
|
69
69
|
"reakit": "1.3.11",
|
|
70
70
|
"@ultraviolet/themes": "1.2.1",
|
|
71
|
-
"@ultraviolet/icons": "2.0.
|
|
71
|
+
"@ultraviolet/icons": "2.0.2"
|
|
72
72
|
}
|
|
73
73
|
}
|