@ultraviolet/ui 1.16.0 → 1.17.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/README.md CHANGED
@@ -20,13 +20,13 @@ You will also need to import fonts in your project by adding:
20
20
  ### Usage
21
21
 
22
22
  ```js
23
- import { theme, normalize, Button } from '@ultraviolet/ui'
24
- import { Global, css, ThemeProvider } from '@emotion/react'
23
+ import { Global, ThemeProvider, css } from '@emotion/react'
24
+ import { Button, normalize, theme } from '@ultraviolet/ui'
25
25
 
26
26
  const App = () => (
27
27
  <ThemeProvider theme={theme}>
28
28
  <Global styles={css`${normalize()}`} />
29
- <Button variant="primary" onClick={() => console.log('clicked')}>
29
+ <Button onClick={() => console.log('clicked')}>
30
30
  Click Me
31
31
  </Button>
32
32
  </ThemeProvider>
@@ -42,10 +42,10 @@ Example, in a `emotion.d.ts` file:
42
42
 
43
43
  ```ts
44
44
  import '@emotion/react'
45
- import type { SCWUITheme } from '@ultraviolet/ui'
45
+ import type { UltravioletUITheme } from '@ultraviolet/ui'
46
46
 
47
47
  declare module '@emotion/react' {
48
- export interface Theme extends SCWUITheme {}
48
+ export interface Theme extends UltravioletUITheme {}
49
49
  }
50
50
  ```
51
51
 
package/dist/index.d.ts CHANGED
@@ -37,7 +37,11 @@ type ActionBarProps = {
37
37
  declare const ActionBar: ({ children, role, rank, className, "data-testid": dataTestId, }: ActionBarProps) => react.ReactPortal;
38
38
 
39
39
  type ScreenSize = keyof typeof consoleLightTheme.screens;
40
+ /**
41
+ * @deprecated use UltravioletUITheme instead
42
+ */
40
43
  type SCWUITheme = typeof consoleLightTheme;
44
+ type UltravioletUITheme = typeof consoleLightTheme;
41
45
  declare const typography: {
42
46
  body: {
43
47
  fontFamily: string;
@@ -177,10 +181,10 @@ type RecursivePartial<T> = {
177
181
  };
178
182
  /**
179
183
  * Will extend theme with new theme properties
180
- * @param {SCWUITheme} baseTheme the theme you want to extend from, by default it is set to light theme
181
- * @param {RecursivePartial<SCWUITheme>} extendedTheme the properties of a new theme you want to apply from baseTheme
184
+ * @param {UltravioletUITheme} baseTheme the theme you want to extend from, by default it is set to light theme
185
+ * @param {RecursivePartial<UltravioletUITheme>} extendedTheme the properties of a new theme you want to apply from baseTheme
182
186
  */
183
- declare const extendTheme: (extendedTheme: RecursivePartial<SCWUITheme>) => {
187
+ declare const extendTheme: (extendedTheme: RecursivePartial<UltravioletUITheme>) => {
184
188
  colors: {
185
189
  danger: {
186
190
  background: string;
@@ -803,6 +807,9 @@ type CommonProps = {
803
807
  onClick?: MouseEventHandler<HTMLElement>;
804
808
  tooltip?: string;
805
809
  tabIndex?: ButtonHTMLAttributes<HTMLButtonElement>['tabIndex'];
810
+ onMouseDown?: MouseEventHandler<HTMLElement>;
811
+ onMouseUp?: MouseEventHandler<HTMLElement>;
812
+ onMouseOut?: MouseEventHandler<HTMLElement>;
806
813
  };
807
814
  type FinalProps = CommonProps & ({
808
815
  children: ReactNode;
@@ -1827,7 +1834,7 @@ type RowProps = {
1827
1834
  'data-testid'?: string;
1828
1835
  children: ReactNode;
1829
1836
  templateColumns: string;
1830
- gap?: keyof SCWUITheme['space'] | number;
1837
+ gap?: keyof UltravioletUITheme['space'] | number;
1831
1838
  alignItems?: CSSProperties['alignItems'];
1832
1839
  justifyContent?: CSSProperties['justifyContent'];
1833
1840
  };
@@ -2004,7 +2011,7 @@ type SnippetProps = {
2004
2011
  declare const Snippet: ({ children, copyText, copiedText, showText, hideText, prefix, className, "data-testid": dataTestId, }: SnippetProps) => _emotion_react_jsx_runtime.JSX.Element;
2005
2012
 
2006
2013
  type StackProps = {
2007
- gap?: keyof SCWUITheme['space'] | number;
2014
+ gap?: keyof UltravioletUITheme['space'] | number;
2008
2015
  direction?: 'row' | 'column';
2009
2016
  alignItems?: CSSProperties['alignItems'];
2010
2017
  justifyContent?: CSSProperties['justifyContent'];
@@ -2674,4 +2681,4 @@ declare const down: (size: ScreenSize, rules: string) => string;
2674
2681
 
2675
2682
  declare const normalize: () => string;
2676
2683
 
2677
- export { ActionBar, Alert, Avatar, Badge, Banner, BarChart, BarStack, Breadcrumbs, Breakpoint, Bullet, Button, Card, Carousel, Checkbox, CheckboxGroup, CheckboxGroupCheckbox, CopyButton, DateInput, EmptyState, Expandable, LineChart, Link, List, Loader, Menu, MenuV2, Meter, Modal, Notice, NumberInput, Pagination, PasswordCheck, PasswordStrengthMeter, PieChart, Popover, ProgressBar, Radio, RadioGroup, Row, type SCWUITheme, SelectInput, SelectableCard, Separator, Skeleton, Snippet, Stack, Status, StepList, Stepper, SwitchButton, Table, Tabs, Tag, TagInput, TagList, Text, TextInput, TimeInput, ToastContainer, Toggle, ToggleGroup, Tooltip, VerificationCode, bounce, down, extendTheme, fadeIn, fadeOut, flash, getUUID, normalize, ping, pulse, quickScaleDown, scaleBack, scaleDown, scaleForward, scaleUp, sketchIn, sketchOut, slideDownLarge, slideFromBottom, slideFromLeft, slideFromRight, slideFromTop, slideToBottom, slideToLeft, slideToRight, slideToTop, slideUpLarge, toast, unfoldIn, unfoldOut, up, zoomIn, zoomOut };
2684
+ export { ActionBar, Alert, Avatar, Badge, Banner, BarChart, BarStack, Breadcrumbs, Breakpoint, Bullet, Button, Card, Carousel, Checkbox, CheckboxGroup, CheckboxGroupCheckbox, CopyButton, DateInput, EmptyState, Expandable, LineChart, Link, List, Loader, Menu, MenuV2, Meter, Modal, Notice, NumberInput, Pagination, PasswordCheck, PasswordStrengthMeter, PieChart, Popover, ProgressBar, Radio, RadioGroup, Row, type SCWUITheme, SelectInput, SelectableCard, Separator, Skeleton, Snippet, Stack, Status, StepList, Stepper, SwitchButton, Table, Tabs, Tag, TagInput, TagList, Text, TextInput, TimeInput, ToastContainer, Toggle, ToggleGroup, Tooltip, type UltravioletUITheme, VerificationCode, bounce, down, extendTheme, fadeIn, fadeOut, flash, getUUID, normalize, ping, pulse, quickScaleDown, scaleBack, scaleDown, scaleForward, scaleUp, sketchIn, sketchOut, slideDownLarge, slideFromBottom, slideFromLeft, slideFromRight, slideFromTop, slideToBottom, slideToLeft, slideToRight, slideToTop, slideUpLarge, toast, unfoldIn, unfoldOut, up, zoomIn, zoomOut };
@@ -115,7 +115,7 @@ const Alert = _ref6 => {
115
115
  children: [title ? jsx(Text, {
116
116
  variant: "bodyStronger",
117
117
  as: "span",
118
- color: sentiment,
118
+ sentiment: sentiment,
119
119
  children: title
120
120
  }) : null, typeof children === 'string' ? jsx(Text, {
121
121
  variant: "body",
@@ -135,13 +135,13 @@ const Banner = _ref8 => {
135
135
  children: [jsx(Text, {
136
136
  as: "p",
137
137
  variant: size === 'medium' ? 'headingSmall' : 'bodyStronger',
138
- color: variant === 'promotional' && theme !== 'light' ? 'neutral' : 'primary',
138
+ sentiment: variant === 'promotional' && theme !== 'light' ? 'neutral' : 'primary',
139
139
  prominence: variant === 'intro' ? 'default' : 'strong',
140
140
  children: title
141
141
  }), jsx(Text, {
142
142
  as: "p",
143
143
  variant: "body",
144
- color: "neutral",
144
+ sentiment: "neutral",
145
145
  prominence: variant === 'intro' || variant === 'promotional' && theme !== 'light' ? 'default' : 'stronger',
146
146
  children: children
147
147
  })]
@@ -48,7 +48,7 @@ const BarChartToolTip = _ref5 => {
48
48
  children: [jsx(Text, {
49
49
  variant: "bodyStronger",
50
50
  as: "p",
51
- color: "primary",
51
+ sentiment: "primary",
52
52
  children: formattedValue
53
53
  }), jsx(Text, {
54
54
  variant: "bodySmall",
@@ -231,6 +231,9 @@ const Button = /*#__PURE__*/forwardRef((_ref10, ref) => {
231
231
  isLoading = false,
232
232
  children,
233
233
  onClick,
234
+ onMouseDown,
235
+ onMouseUp,
236
+ onMouseOut,
234
237
  name,
235
238
  'aria-label': ariaLabel,
236
239
  'aria-current': ariaCurrent,
@@ -289,6 +292,9 @@ const Button = /*#__PURE__*/forwardRef((_ref10, ref) => {
289
292
  iconOnly: !!icon && !children,
290
293
  tabIndex: tabIndex,
291
294
  autoFocus: autoFocus,
295
+ onMouseDown: onMouseDown,
296
+ onMouseUp: onMouseUp,
297
+ onMouseOut: onMouseOut,
292
298
  children: content
293
299
  })
294
300
  });
@@ -318,6 +324,9 @@ const Button = /*#__PURE__*/forwardRef((_ref10, ref) => {
318
324
  iconOnly: !!icon && !children,
319
325
  tabIndex: tabIndex,
320
326
  autoFocus: autoFocus,
327
+ onMouseDown: onMouseDown,
328
+ onMouseUp: onMouseUp,
329
+ onMouseOut: onMouseOut,
321
330
  children: content
322
331
  })
323
332
  });
@@ -480,12 +480,12 @@ const Checkbox = /*#__PURE__*/forwardRef((_ref64, ref) => {
480
480
  variant: "bodySmall",
481
481
  as: "p",
482
482
  prominence: "weak",
483
- color: "neutral",
483
+ sentiment: "neutral",
484
484
  children: helper
485
485
  }) : null, error ? jsx(ErrorText, {
486
486
  variant: "bodySmall",
487
487
  as: "p",
488
- color: "danger",
488
+ sentiment: "danger",
489
489
  children: error
490
490
  }) : null]
491
491
  })]
@@ -117,7 +117,7 @@ const CustomLegend = _ref3 => {
117
117
  children: [jsx(Text, {
118
118
  as: "span",
119
119
  variant: "bodySmall",
120
- color: "neutral",
120
+ sentiment: "neutral",
121
121
  children: row?.['label']
122
122
  }), jsx("div", {
123
123
  "data-testid": `label-${id}`,
@@ -40,13 +40,13 @@ const LineChartTooltip = _ref5 => {
40
40
  }), jsxs("div", {
41
41
  children: [jsx(Text, {
42
42
  variant: "bodyStronger",
43
- color: "neutral",
43
+ sentiment: "neutral",
44
44
  prominence: "stronger",
45
45
  as: "div",
46
46
  children: point.data.yFormatted
47
47
  }), jsx(Text, {
48
48
  variant: "bodySmall",
49
- color: "neutral",
49
+ sentiment: "neutral",
50
50
  prominence: "stronger",
51
51
  as: "div",
52
52
  children: point.data.xFormatted
@@ -359,7 +359,7 @@ const NumberInput = _ref21 => {
359
359
  }), typeof error === 'string' ? jsx(Text, {
360
360
  as: "span",
361
361
  variant: "bodySmall",
362
- color: "danger",
362
+ sentiment: "danger",
363
363
  prominence: "weak",
364
364
  children: error
365
365
  }) : null]
@@ -3,7 +3,6 @@ import { HeaderCell } from './HeaderCell.js';
3
3
  import { useTableContext } from './TableContext.js';
4
4
  import { jsxs, jsx } from '@emotion/react/jsx-runtime';
5
5
 
6
- const SELECT_CHECKBOX_SIZE = 24;
7
6
  const HeaderRow = _ref => {
8
7
  let {
9
8
  children,
@@ -18,18 +17,17 @@ const HeaderRow = _ref => {
18
17
  const selectableRowCount = Object.keys(selectedRowIds).length;
19
18
  return jsxs("tr", {
20
19
  children: [hasSelectAllColumn ? jsx(HeaderCell, {
21
- width: `${SELECT_CHECKBOX_SIZE}px`,
20
+ width: "24px",
22
21
  children: jsx(Checkbox, {
23
22
  name: "table-select-all-checkbox",
24
23
  value: "all",
25
24
  "aria-label": "select all",
26
25
  checked: allRowSelectValue,
27
26
  onChange: allRowSelectValue === false ? selectAll : unselectAll,
28
- disabled: selectableRowCount === 0,
29
- size: SELECT_CHECKBOX_SIZE
27
+ disabled: selectableRowCount === 0
30
28
  })
31
29
  }) : null, children]
32
30
  });
33
31
  };
34
32
 
35
- export { HeaderRow, SELECT_CHECKBOX_SIZE };
33
+ export { HeaderRow };
@@ -3,7 +3,6 @@ import { useEffect } from 'react';
3
3
  import { Checkbox } from '../Checkbox/index.js';
4
4
  import { Tooltip } from '../Tooltip/index.js';
5
5
  import { Cell } from './Cell.js';
6
- import { SELECT_CHECKBOX_SIZE } from './HeaderRow.js';
7
6
  import { useTableContext } from './TableContext.js';
8
7
  import { jsxs, jsx } from '@emotion/react/jsx-runtime';
9
8
 
@@ -58,8 +57,7 @@ const Row = _ref2 => {
58
57
  selectRow(id);
59
58
  }
60
59
  },
61
- disabled: selectDisabled !== undefined,
62
- size: SELECT_CHECKBOX_SIZE
60
+ disabled: selectDisabled !== undefined
63
61
  })
64
62
  })
65
63
  })
@@ -50,34 +50,34 @@ const CloseButton = _ref3 => {
50
50
  };
51
51
  const Content = _ref4 => {
52
52
  let {
53
- variant,
53
+ sentiment,
54
54
  children
55
55
  } = _ref4;
56
56
  return jsxs(Stack, {
57
57
  gap: 2,
58
58
  direction: "row",
59
59
  children: [jsx(Icon, {
60
- name: TOAST_ICONS[variant],
60
+ name: TOAST_ICONS[sentiment],
61
61
  size: 24
62
62
  }), jsx(Text, {
63
63
  variant: "body",
64
64
  as: "span",
65
- color: variant,
65
+ sentiment: sentiment,
66
66
  children: children
67
67
  })]
68
68
  });
69
69
  };
70
70
  const toast = {
71
71
  error: (children, options) => toast$1.error(jsx(Content, {
72
- variant: "danger",
72
+ sentiment: "danger",
73
73
  children: children
74
74
  }), options),
75
75
  info: (children, options) => toast$1.info(jsx(Content, {
76
- variant: "info",
76
+ sentiment: "info",
77
77
  children: children
78
78
  }), options),
79
79
  success: (children, options) => toast$1.success(jsx(Content, {
80
- variant: "success",
80
+ sentiment: "success",
81
81
  children: children
82
82
  }), options)
83
83
  };
@@ -2,6 +2,10 @@ import { consoleLightTheme } from '@ultraviolet/themes';
2
2
  export { consoleDarkTheme as darkTheme, consoleLightTheme as default } from '@ultraviolet/themes';
3
3
  import deepmerge from 'deepmerge';
4
4
 
5
+ /**
6
+ * @deprecated use UltravioletUITheme instead
7
+ */
8
+
5
9
  const {
6
10
  colors,
7
11
  shadows,
@@ -12,8 +16,8 @@ const {
12
16
  } = consoleLightTheme;
13
17
  /**
14
18
  * Will extend theme with new theme properties
15
- * @param {SCWUITheme} baseTheme the theme you want to extend from, by default it is set to light theme
16
- * @param {RecursivePartial<SCWUITheme>} extendedTheme the properties of a new theme you want to apply from baseTheme
19
+ * @param {UltravioletUITheme} baseTheme the theme you want to extend from, by default it is set to light theme
20
+ * @param {RecursivePartial<UltravioletUITheme>} extendedTheme the properties of a new theme you want to apply from baseTheme
17
21
  */
18
22
  const extendTheme = extendedTheme => deepmerge(consoleLightTheme, extendedTheme);
19
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/ui",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "description": "Ultraviolet UI",
5
5
  "homepage": "https://github.com/scaleway/ultraviolet#readme",
6
6
  "repository": {
@@ -39,11 +39,11 @@
39
39
  "react-dom": "18.2.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@babel/core": "7.22.19",
42
+ "@babel/core": "7.22.20",
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.21",
46
+ "@types/react": "18.2.22",
47
47
  "@types/react-datepicker": "4.15.0",
48
48
  "@types/react-dom": "18.2.7",
49
49
  "react": "18.2.0",
@@ -62,11 +62,11 @@
62
62
  "deepmerge": "4.3.1",
63
63
  "react-datepicker": "4.18.0",
64
64
  "react-flatten-children": "1.1.2",
65
- "react-select": "5.7.4",
65
+ "react-select": "5.7.5",
66
66
  "react-toastify": "9.1.3",
67
67
  "react-use-clipboard": "1.0.9",
68
68
  "reakit": "1.3.11",
69
69
  "@ultraviolet/themes": "1.2.1",
70
- "@ultraviolet/icons": "2.0.3"
70
+ "@ultraviolet/icons": "2.1.0"
71
71
  }
72
72
  }