@ultraviolet/ui 1.44.0 → 1.45.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/dist/index.d.ts CHANGED
@@ -1997,10 +1997,10 @@ type NoticeProps = {
1997
1997
  */
1998
1998
  declare const Notice: ({ children, className, "data-testid": dataTestId, }: NoticeProps) => _emotion_react_jsx_runtime.JSX.Element;
1999
1999
 
2000
- type CheckboxGroupCheckboxProps = Omit<ComponentProps<typeof Checkbox>, 'onChange' | 'checked' | 'required'> & {
2000
+ type CheckboxGroupCheckboxProps = Omit<ComponentProps<typeof Checkbox>, 'onChange' | 'checked'> & {
2001
2001
  value: string;
2002
2002
  };
2003
- declare const CheckboxGroupCheckbox: ({ onFocus, onBlur, disabled, error, name, value, children, helper, className, autoFocus, "data-testid": dataTestId, }: CheckboxGroupCheckboxProps) => _emotion_react_jsx_runtime.JSX.Element;
2003
+ declare const CheckboxGroupCheckbox: ({ onFocus, onBlur, disabled, error, name, value, children, helper, className, autoFocus, "data-testid": dataTestId, required, }: CheckboxGroupCheckboxProps) => _emotion_react_jsx_runtime.JSX.Element;
2004
2004
  type CheckboxGroupProps = {
2005
2005
  legend: string;
2006
2006
  value?: string[];
@@ -2016,7 +2016,7 @@ type CheckboxGroupProps = {
2016
2016
  */
2017
2017
  declare const CheckboxGroup: {
2018
2018
  ({ legend, value, className, helper, error, direction, children, onChange, name, required, }: CheckboxGroupProps): _emotion_react_jsx_runtime.JSX.Element;
2019
- Checkbox: ({ onFocus, onBlur, disabled, error, name, value, children, helper, className, autoFocus, "data-testid": dataTestId, }: CheckboxGroupCheckboxProps) => _emotion_react_jsx_runtime.JSX.Element;
2019
+ Checkbox: ({ onFocus, onBlur, disabled, error, name, value, children, helper, className, autoFocus, "data-testid": dataTestId, required, }: CheckboxGroupCheckboxProps) => _emotion_react_jsx_runtime.JSX.Element;
2020
2020
  };
2021
2021
 
2022
2022
  declare const containerSizes: {
@@ -2506,13 +2506,15 @@ type SkeletonProps = {
2506
2506
  length?: number;
2507
2507
  col?: number;
2508
2508
  className?: string;
2509
+ 'aria-label'?: string;
2510
+ 'data-testid'?: string;
2509
2511
  };
2510
2512
  /**
2511
2513
  * Skeleton component is used to indicate that the data is loading.
2512
2514
  * It is used to provide a better user experience by showing a temporary placeholder reflecting the dimensions of the
2513
2515
  * content that will eventually be loaded on the screen.
2514
2516
  */
2515
- declare const Skeleton: ({ variant, length, col, className, }: SkeletonProps) => _emotion_react_jsx_runtime.JSX.Element;
2517
+ declare const Skeleton: ({ variant, length, col, className, "aria-label": ariaLabel, "data-testid": dataTestId, }: SkeletonProps) => _emotion_react_jsx_runtime.JSX.Element;
2516
2518
 
2517
2519
  type Prefixes = 'lines' | 'command';
2518
2520
  type SnippetProps = {
@@ -4,14 +4,15 @@ import { jsx } from '@emotion/react/jsx-runtime';
4
4
 
5
5
  const formatTextToAvatar = text => {
6
6
  if (!text) return '';
7
- if (text.length <= 2) {
8
- return text.toUpperCase();
7
+ const textCleaned = text.replace(/\s+/g, ' ').trim();
8
+ if (textCleaned.length <= 2) {
9
+ return textCleaned.toUpperCase();
9
10
  }
10
- if (text.split(' ').length > 1) {
11
- const [a, b] = text.split(' ');
11
+ if (textCleaned.split(' ').length > 1) {
12
+ const [a, b] = textCleaned.split(' ');
12
13
  return `${a[0]}${b[0]}`.toUpperCase();
13
14
  }
14
- return text.substring(0, 2).toUpperCase();
15
+ return textCleaned.substring(0, 2).toUpperCase();
15
16
  };
16
17
  const StyledTextAvatar = /*#__PURE__*/_styled("span", {
17
18
  target: "ec0473m1"
@@ -8,6 +8,16 @@ import { jsx, jsxs } from '@emotion/react/jsx-runtime';
8
8
 
9
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
10
  const CheckboxGroupContext = /*#__PURE__*/createContext(undefined);
11
+ const StyledCheckbox = /*#__PURE__*/_styled(Checkbox, {
12
+ target: "e1k5uyng2"
13
+ })(process.env.NODE_ENV === "production" ? {
14
+ name: "6vgcqf",
15
+ styles: "label{width:fit-content;}"
16
+ } : {
17
+ name: "6vgcqf",
18
+ styles: "label{width:fit-content;}",
19
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
20
+ });
11
21
  const CheckboxGroupCheckbox = ({
12
22
  onFocus,
13
23
  onBlur,
@@ -19,7 +29,8 @@ const CheckboxGroupCheckbox = ({
19
29
  helper,
20
30
  className,
21
31
  autoFocus,
22
- 'data-testid': dataTestId
32
+ 'data-testid': dataTestId,
33
+ required
23
34
  }) => {
24
35
  const context = useContext(CheckboxGroupContext);
25
36
  if (!context) {
@@ -32,7 +43,7 @@ const CheckboxGroupCheckbox = ({
32
43
  } = context;
33
44
  const checkboxName = `${groupName}.${name ?? ''}`;
34
45
  const checkboxValue = `${value}`;
35
- return jsx(Checkbox, {
46
+ return jsx(StyledCheckbox, {
36
47
  onChange: onChange,
37
48
  checked: groupValues?.includes(checkboxValue),
38
49
  onFocus: onFocus,
@@ -45,6 +56,7 @@ const CheckboxGroupCheckbox = ({
45
56
  className: className,
46
57
  autoFocus: autoFocus,
47
58
  "data-testid": dataTestId,
59
+ required: required,
48
60
  children: children
49
61
  });
50
62
  };
@@ -86,8 +98,9 @@ const CheckboxGroup = ({
86
98
  const contextValue = useMemo(() => ({
87
99
  groupName: name,
88
100
  groupValues: value ?? [],
89
- onChange
90
- }), [name, value, onChange]);
101
+ onChange,
102
+ required
103
+ }), [name, value, onChange, required]);
91
104
  return jsx(CheckboxGroupContext.Provider, {
92
105
  value: contextValue,
93
106
  children: jsxs(Stack, {
@@ -2,7 +2,6 @@ import _styled from '@emotion/styled/base';
2
2
  import { useTheme, css } from '@emotion/react';
3
3
  import { Icon } from '@ultraviolet/icons';
4
4
  import { forwardRef, useState, useId, useMemo, useEffect } from 'react';
5
- import flattenChildren from 'react-flatten-children';
6
5
  import Select, { components } from 'react-select';
7
6
  import isJSONString from '../../helpers/isJSON.js';
8
7
  import * as animations from '../../utils/animations.js';
@@ -531,7 +530,7 @@ const FwdSelectInput = ({
531
530
  const currentValue = value?.value;
532
531
 
533
532
  // Options need to keep the same reference otherwise react-select doesn't focus the selected option
534
- const selectOptions = useMemo(() => options || flattenChildren(children).map(({
533
+ const selectOptions = useMemo(() => options || (children ?? []).map(({
535
534
  props: {
536
535
  children: label,
537
536
  ...subProps
@@ -105,7 +105,7 @@ const SelectableCardGroup = ({
105
105
  className: className,
106
106
  children: jsxs(Stack, {
107
107
  gap: 1.5,
108
- children: [jsxs(Text, {
108
+ children: [legend ? jsxs(Text, {
109
109
  as: "legend",
110
110
  variant: "bodyStrong",
111
111
  children: [legend && jsxs(Fragment, {
@@ -115,7 +115,7 @@ const SelectableCardGroup = ({
115
115
  color: "danger",
116
116
  size: 8
117
117
  }) : null]
118
- }), jsx(Row, {
118
+ }) : null, jsx(Row, {
119
119
  gap: 2,
120
120
  templateColumns: `repeat(${columns}, auto)`,
121
121
  children: children
@@ -26,7 +26,7 @@ const StyledHr = /*#__PURE__*/_styled('hr', {
26
26
  }) => direction === 'horizontal' ? `${thickness}px` : 'auto', ";flex-shrink:0;background-color:", ({
27
27
  theme,
28
28
  color
29
- }) => theme.colors[color].border, ";", ({
29
+ }) => theme.colors[color].borderWeak, ";", ({
30
30
  hasIcon
31
31
  }) => hasIcon && `flex: 1;`, ";");
32
32
  /**
@@ -61,13 +61,17 @@ const Skeleton = ({
61
61
  variant = 'blocks',
62
62
  length,
63
63
  col,
64
- className
64
+ className,
65
+ 'aria-label': ariaLabel,
66
+ 'data-testid': dataTestId
65
67
  }) => {
66
68
  const Component = variants[variant];
67
69
  return jsxs(StyledContainer, {
68
70
  className: className,
69
71
  "aria-busy": true,
70
72
  "aria-live": "polite",
73
+ "aria-label": ariaLabel,
74
+ "data-testid": dataTestId,
71
75
  children: [jsx(Component, {
72
76
  length: length,
73
77
  col: col
@@ -1,7 +1,6 @@
1
1
  import _styled from '@emotion/styled/base';
2
2
  import { keyframes, css } from '@emotion/react';
3
3
  import { Children, Fragment } from 'react';
4
- import flattenChildren from 'react-flatten-children';
5
4
  import { Bullet } from '../Bullet/index.js';
6
5
  import { Text } from '../Text/index.js';
7
6
  import { jsx, jsxs } from '@emotion/react/jsx-runtime';
@@ -121,7 +120,7 @@ const Stepper = ({
121
120
  "data-testid": dataTestId,
122
121
  labelPosition: labelPosition,
123
122
  size: size,
124
- children: flattenChildren(children).map((child, index) => {
123
+ children: Children.map(children, (child, index) => {
125
124
  const getTemporal = () => {
126
125
  if (selected > index) return 'previous';
127
126
  if (selected === index) return 'current';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/ui",
3
- "version": "1.44.0",
3
+ "version": "1.45.0",
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.24.1",
42
+ "@babel/core": "7.24.3",
43
43
  "@emotion/babel-plugin": "11.11.0",
44
44
  "@emotion/react": "11.11.4",
45
45
  "@emotion/styled": "11.11.0",
46
- "@types/react": "18.2.61",
46
+ "@types/react": "18.2.64",
47
47
  "@types/react-datepicker": "4.19.6",
48
- "@types/react-dom": "18.2.19",
48
+ "@types/react-dom": "18.2.21",
49
49
  "react": "18.2.0",
50
50
  "react-dom": "18.2.0"
51
51
  },
@@ -56,18 +56,16 @@
56
56
  "@nivo/line": "0.80.0",
57
57
  "@nivo/pie": "0.80.0",
58
58
  "@nivo/scales": "0.80.0",
59
- "@nivo/tooltip": "0.80.0",
60
- "@scaleway/random-name": "4.0.3",
59
+ "@scaleway/random-name": "5.0.0",
61
60
  "@scaleway/use-media": "2.0.1",
62
61
  "deepmerge": "4.3.1",
63
62
  "react-datepicker": "4.25.0",
64
- "react-flatten-children": "1.1.2",
65
63
  "react-select": "5.8.0",
66
64
  "react-toastify": "10.0.5",
67
65
  "react-use-clipboard": "1.0.9",
68
66
  "reakit": "1.3.11",
69
67
  "@ultraviolet/themes": "1.9.0",
70
- "@ultraviolet/icons": "2.11.0"
68
+ "@ultraviolet/icons": "2.11.1"
71
69
  },
72
70
  "scripts": {
73
71
  "build": "rollup -c ../../rollup.config.mjs",