@ultraviolet/ui 1.36.0 → 1.37.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 CHANGED
@@ -529,6 +529,14 @@ declare const extendTheme: (extendedTheme: RecursivePartial<UltravioletUITheme>)
529
529
  fillWeak: string;
530
530
  fillWeakDisabled: string;
531
531
  };
532
+ original: {
533
+ fill: string;
534
+ fillDisabled: string;
535
+ fillStrong: string;
536
+ fillStrongDisabled: string;
537
+ fillWeak: string;
538
+ fillWeakDisabled: string;
539
+ };
532
540
  primary: {
533
541
  fill: string;
534
542
  fillDisabled: string;
@@ -2041,8 +2049,7 @@ type NumberInputProps = {
2041
2049
  error?: string | boolean;
2042
2050
  } & Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'onChange' | 'value' | 'defaultValue'>;
2043
2051
  /**
2044
- * NumberInput component is used to increment / decrement a number value by clicking on + / - buttons or
2045
- * by typing into input.
2052
+ * @deprecated This component is deprecated. Please use `NumberInputV2` instead.
2046
2053
  */
2047
2054
  declare const NumberInput: ({ disabled, maxValue, minValue, name, onChange, onFocus, onBlur, onMaxCrossed, onMinCrossed, size, step, text, defaultValue, value, disabledTooltip, className, label, id, placeholder, error, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, "data-testid": dataTestId, }: NumberInputProps) => _emotion_react_jsx_runtime.JSX.Element;
2048
2055
 
@@ -3201,7 +3208,12 @@ type VerificationCodeProps = {
3201
3208
  */
3202
3209
  declare const VerificationCode: ({ disabled, className, error, fields, initialValue, inputId, inputStyle, size, onChange, onComplete, placeholder, required, type, "data-testid": dataTestId, "aria-label": ariaLabel, }: VerificationCodeProps) => _emotion_react_jsx_runtime.JSX.Element;
3203
3210
 
3204
- type RadioGroupRadioProps = Omit<ComponentProps<typeof Radio>, 'onChange' | 'checked' | 'required'>;
3211
+ type RadioGroupRadioProps = Omit<ComponentProps<typeof Radio>, 'onChange' | 'checked' | 'required'> & {
3212
+ /**
3213
+ * @deprecated you don't need to use `name` anymore, the name will be passed from the parent `RadioGroup`.
3214
+ */
3215
+ name?: string;
3216
+ };
3205
3217
  type RadioGroupProps = {
3206
3218
  legend: string;
3207
3219
  value: string | number;
@@ -79,8 +79,7 @@ const StyledContainer = /*#__PURE__*/_styled('div', {
79
79
  theme
80
80
  }) => theme.colors.primary.borderHover, ";}}");
81
81
  /**
82
- * NumberInput component is used to increment / decrement a number value by clicking on + / - buttons or
83
- * by typing into input.
82
+ * @deprecated This component is deprecated. Please use `NumberInputV2` instead.
84
83
  */
85
84
  const NumberInput = ({
86
85
  disabled = false,
@@ -107,7 +107,7 @@ const NumberInputV2 = /*#__PURE__*/forwardRef(({
107
107
  onChange,
108
108
  onFocus,
109
109
  onBlur,
110
- size = 'medium',
110
+ size = 'large',
111
111
  step,
112
112
  unit,
113
113
  value,
@@ -179,11 +179,11 @@ const NumberInputV2 = /*#__PURE__*/forwardRef(({
179
179
  return jsxs(Stack, {
180
180
  gap: "0.5",
181
181
  className: className,
182
- children: [jsxs(Stack, {
182
+ children: [label || labelDescription ? jsxs(Stack, {
183
183
  direction: "row",
184
184
  gap: "1",
185
185
  alignItems: "center",
186
- children: [jsxs(Stack, {
186
+ children: [label ? jsxs(Stack, {
187
187
  direction: "row",
188
188
  gap: "0.5",
189
189
  alignItems: "start",
@@ -198,8 +198,8 @@ const NumberInputV2 = /*#__PURE__*/forwardRef(({
198
198
  color: "danger",
199
199
  size: 8
200
200
  }) : null]
201
- }), labelDescription ?? null]
202
- }), jsx("div", {
201
+ }) : null, labelDescription ?? null]
202
+ }) : null, jsx("div", {
203
203
  children: jsx(Tooltip, {
204
204
  text: tooltip,
205
205
  children: jsxs(Container, {
@@ -31,15 +31,14 @@ const RadioGroupRadio = ({
31
31
  onChange,
32
32
  groupValue
33
33
  } = context;
34
- const radioName = `${groupName}-${name ?? ''}`;
35
34
  return jsx(Radio, {
36
35
  onChange: onChange,
37
- checked: `${groupName}-${groupValue}` === radioName,
36
+ checked: groupValue === value,
38
37
  onFocus: onFocus,
39
38
  onBlur: onBlur,
40
39
  disabled: disabled,
41
40
  error: error,
42
- name: radioName,
41
+ name: groupName ?? name,
43
42
  value: value,
44
43
  label: label,
45
44
  helper: helper,
@@ -1,14 +1,17 @@
1
1
  import _styled from '@emotion/styled/base';
2
- import { forwardRef, useRef } from 'react';
2
+ import { forwardRef, useRef, useCallback } from 'react';
3
3
  import { Checkbox } from '../Checkbox/index.js';
4
4
  import { Radio } from '../Radio/index.js';
5
+ import { Stack } from '../Stack/index.js';
5
6
  import { Tooltip } from '../Tooltip/index.js';
6
7
  import { jsx, jsxs } from '@emotion/react/jsx-runtime';
7
8
 
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)."; }
9
- const Container = /*#__PURE__*/_styled("div", {
10
+ const Container = /*#__PURE__*/_styled(Stack, {
10
11
  target: "e1s5n3hj2"
11
- })("display:inline-flex;flex-direction:column;align-items:start;padding:", ({
12
+ })("&[data-has-label='false']>:first-child{margin-bottom:-", ({
13
+ theme
14
+ }) => theme.space['0.5'], ";}padding:", ({
12
15
  theme
13
16
  }) => theme.space['2'], ";border-radius:", ({
14
17
  theme
@@ -87,8 +90,23 @@ const SelectableCard = /*#__PURE__*/forwardRef(({
87
90
  'data-testid': dataTestId
88
91
  }, ref) => {
89
92
  const innerRef = useRef(null);
90
- return jsx(Tooltip, {
91
- text: tooltip,
93
+ const ParentContainer = useCallback(({
94
+ children: subChildren
95
+ }) => {
96
+ if (tooltip) {
97
+ return jsx(Stack, {
98
+ flex: 1,
99
+ children: jsx(Tooltip, {
100
+ text: tooltip,
101
+ children: subChildren
102
+ })
103
+ });
104
+ }
105
+ return jsx(Tooltip, {
106
+ children: subChildren
107
+ });
108
+ }, [tooltip]);
109
+ return jsx(ParentContainer, {
92
110
  children: jsxs(Container, {
93
111
  onClick: () => {
94
112
  if (innerRef?.current) {
@@ -101,7 +119,12 @@ const SelectableCard = /*#__PURE__*/forwardRef(({
101
119
  "data-error": isError,
102
120
  "data-testid": dataTestId,
103
121
  "data-type": type,
122
+ "data-has-label": !!label,
104
123
  ref: ref,
124
+ alignItems: "start",
125
+ direction: "column",
126
+ gap: 0.5,
127
+ flex: 1,
105
128
  children: [type === 'radio' ? jsx(StyledRadio, {
106
129
  name: name,
107
130
  value: value,
@@ -66,6 +66,8 @@ const Skeleton = ({
66
66
  const Component = variants[variant];
67
67
  return jsxs(StyledContainer, {
68
68
  className: className,
69
+ "aria-busy": true,
70
+ "aria-live": "polite",
69
71
  children: [jsx(Component, {
70
72
  length: length,
71
73
  col: col
@@ -101,7 +101,7 @@ const TagInput = ({
101
101
  label,
102
102
  labelDescription,
103
103
  required = false,
104
- size = 'medium',
104
+ size = 'large',
105
105
  error,
106
106
  success,
107
107
  helper,
@@ -216,11 +216,11 @@ const TagInput = ({
216
216
  return jsxs(Stack, {
217
217
  gap: "0.5",
218
218
  className: className,
219
- children: [jsxs(Stack, {
219
+ children: [label || labelDescription ? jsxs(Stack, {
220
220
  direction: "row",
221
221
  gap: "1",
222
222
  alignItems: "center",
223
- children: [jsxs(Stack, {
223
+ children: [label ? jsxs(Stack, {
224
224
  direction: "row",
225
225
  gap: "0.5",
226
226
  alignItems: "start",
@@ -228,15 +228,15 @@ const TagInput = ({
228
228
  as: "label",
229
229
  variant: "bodyStrong",
230
230
  sentiment: "neutral",
231
- htmlFor: localId,
231
+ htmlFor: id ?? localId,
232
232
  children: label
233
233
  }), required ? jsx(Icon, {
234
234
  name: "asterisk",
235
235
  color: "danger",
236
236
  size: 8
237
237
  }) : null]
238
- }), labelDescription ?? null]
239
- }), jsx("div", {
238
+ }) : null, labelDescription ?? null]
239
+ }) : null, jsx("div", {
240
240
  children: jsx(Tooltip, {
241
241
  text: tooltip,
242
242
  children: jsxs(TagInputContainer, {
@@ -112,11 +112,11 @@ const TextArea = /*#__PURE__*/forwardRef(({
112
112
  return jsxs(Stack, {
113
113
  gap: "0.5",
114
114
  className: className,
115
- children: [jsxs(Stack, {
115
+ children: [label || labelDescription ? jsxs(Stack, {
116
116
  direction: "row",
117
117
  gap: "1",
118
118
  alignItems: "center",
119
- children: [jsxs(Stack, {
119
+ children: [label ? jsxs(Stack, {
120
120
  direction: "row",
121
121
  gap: "0.5",
122
122
  alignItems: "start",
@@ -131,8 +131,8 @@ const TextArea = /*#__PURE__*/forwardRef(({
131
131
  color: "danger",
132
132
  size: 8
133
133
  }) : null]
134
- }), labelDescription ?? null]
135
- }), jsx(Tooltip, {
134
+ }) : null, labelDescription ?? null]
135
+ }) : null, jsx(Tooltip, {
136
136
  text: tooltip,
137
137
  children: jsxs(StyledTextAreaWrapper, {
138
138
  children: [jsx(StyledTextArea, {
@@ -132,11 +132,11 @@ const TextInputV2 = /*#__PURE__*/forwardRef(({
132
132
  return jsxs(Stack, {
133
133
  gap: 0.5,
134
134
  className: className,
135
- children: [jsxs(Stack, {
135
+ children: [label || labelDescription ? jsxs(Stack, {
136
136
  direction: "row",
137
137
  gap: "1",
138
138
  alignItems: "center",
139
- children: [jsxs(Stack, {
139
+ children: [label ? jsxs(Stack, {
140
140
  direction: "row",
141
141
  gap: "0.5",
142
142
  alignItems: "start",
@@ -151,8 +151,8 @@ const TextInputV2 = /*#__PURE__*/forwardRef(({
151
151
  color: "danger",
152
152
  size: 8
153
153
  }) : null]
154
- }), labelDescription ?? null]
155
- }), jsx("div", {
154
+ }) : null, labelDescription ?? null]
155
+ }) : null, jsx("div", {
156
156
  children: jsx(Tooltip, {
157
157
  text: tooltip,
158
158
  children: jsxs(StyledInputWrapper, {
@@ -1,6 +1,6 @@
1
1
  import _styled from '@emotion/styled/base';
2
2
  import { useTheme, Global, ClassNames, css } from '@emotion/react';
3
- import { toast as toast$1, ToastContainer as ToastContainer$1 } from 'react-toastify';
3
+ import { toast as toast$1, ToastContainer as ToastContainer$1, Slide } from 'react-toastify';
4
4
  import css_248z from '../../../react-toastify/dist/ReactToastify.min.css.js';
5
5
  import { Button } from '../Button/index.js';
6
6
  import { Stack } from '../Stack/index.js';
@@ -12,7 +12,7 @@ const PREFIX = '.Toastify';
12
12
  const AUTOCLOSE_DELAY = 6000; // Delay to close the toast in ms
13
13
 
14
14
  const styles = {
15
- toast: theme => /*#__PURE__*/css("border-radius:", theme.radii.default, ";min-height:52px;padding:", theme.space['2'], ";text-size:", theme.typography.bodySmallStrong.fontSize, ";", PREFIX, "__toast-container{width:344px;}", PREFIX, "__toast-body{margin:0;}&", PREFIX, "__toast--success{background-color:", theme.colors.neutral.backgroundStronger, ";color:", theme.colors.neutral.textStronger, ";}&", PREFIX, "__toast--info{background-color:", theme.colors.info.backgroundStrong, ";color:", theme.colors.neutral.textStronger, ";}&", PREFIX, "__toast--error{background-color:", theme.colors.danger.backgroundStrong, ";color:", theme.colors.neutral.textStronger, ";}&", PREFIX, "__toast--warning{background-color:", theme.colors.warning.backgroundStrong, ";color:", theme.colors.warning.textStrong, ";}")
15
+ toast: theme => /*#__PURE__*/css("border-radius:", theme.radii.default, ";min-height:52px;", PREFIX, "__toast-container{width:344px;}", PREFIX, "__toast-body{margin:0;padding:0;}&", PREFIX, "__toast--success{background-color:", theme.colors.neutral.backgroundStronger, ";color:", theme.colors.neutral.textStronger, ";padding:", theme.space['2'], ";}&", PREFIX, "__toast--info{background-color:", theme.colors.info.backgroundStrong, ";color:", theme.colors.neutral.textStronger, ";padding:", theme.space['2'], ";}&", PREFIX, "__toast--error{background-color:", theme.colors.danger.backgroundStrong, ";color:", theme.colors.neutral.textStronger, ";padding:", theme.space['2'], ";}&", PREFIX, "__toast--warning{background-color:", theme.colors.warning.backgroundStrong, ";color:", theme.colors.warning.textStrong, ";padding:", theme.space['2'], ";}")
16
16
  };
17
17
  const StyledButton = /*#__PURE__*/_styled(Button, {
18
18
  target: "e1eb63990"
@@ -40,7 +40,7 @@ const Content = ({
40
40
  gap: 2,
41
41
  direction: "row",
42
42
  children: jsx(Text, {
43
- variant: "body",
43
+ variant: "bodySmallStrong",
44
44
  as: "span",
45
45
  children: children
46
46
  })
@@ -116,7 +116,8 @@ const ToastContainer = ({
116
116
  position: position,
117
117
  stacked: true,
118
118
  hideProgressBar: true,
119
- className: className
119
+ className: className,
120
+ transition: Slide
120
121
  })
121
122
  })]
122
123
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/ui",
3
- "version": "1.36.0",
3
+ "version": "1.37.1",
4
4
  "description": "Ultraviolet UI",
5
5
  "homepage": "https://github.com/scaleway/ultraviolet#readme",
6
6
  "repository": {
@@ -66,8 +66,8 @@
66
66
  "react-toastify": "10.0.4",
67
67
  "react-use-clipboard": "1.0.9",
68
68
  "reakit": "1.3.11",
69
- "@ultraviolet/themes": "1.8.0",
70
- "@ultraviolet/icons": "2.8.4"
69
+ "@ultraviolet/themes": "1.9.0",
70
+ "@ultraviolet/icons": "2.9.0"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "rollup -c ../../rollup.config.mjs",