@ultraviolet/ui 1.34.0 → 1.36.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
@@ -2690,12 +2690,13 @@ declare const Table: react.ForwardRefExoticComponent<TableProps & react.RefAttri
2690
2690
  Body: ({ children }: {
2691
2691
  children: ReactNode;
2692
2692
  }) => _emotion_react_jsx_runtime.JSX.Element;
2693
- Row: ({ children, className, id, selectDisabled, "data-testid": dataTestid, }: {
2693
+ Row: ({ children, className, id, selectDisabled, highlightAnimation, "data-testid": dataTestid, }: {
2694
2694
  children: ReactNode;
2695
2695
  className?: string | undefined;
2696
2696
  id: string;
2697
2697
  'data-testid'?: string | undefined;
2698
2698
  selectDisabled?: string | boolean | undefined;
2699
+ highlightAnimation?: boolean | undefined;
2699
2700
  }) => _emotion_react_jsx_runtime.JSX.Element;
2700
2701
  Cell: ({ children, className, colSpan, rowSpan }: {
2701
2702
  children?: ReactNode;
@@ -3103,6 +3104,11 @@ type ToastContainerProps = {
3103
3104
  */
3104
3105
  position?: ToastOptions['position'];
3105
3106
  'data-testid'?: string;
3107
+ className?: string;
3108
+ /**
3109
+ * Delay before the toast is automatically closed, if not set the default value is 6000ms
3110
+ */
3111
+ autoClose?: number;
3106
3112
  };
3107
3113
  /**
3108
3114
  * Display short information about an event that happen in the interface in a floating alert.
@@ -3112,7 +3118,7 @@ type ToastContainerProps = {
3112
3118
  * Toaster is separated in two parts, first the `ToastContainer` which is where the div of the toast will be rendered,
3113
3119
  * and second the `toast()` function which is used to display the toast.
3114
3120
  */
3115
- declare const ToastContainer: ({ newestOnTop, limit, position, "data-testid": dataTestId, }: ToastContainerProps) => _emotion_react_jsx_runtime.JSX.Element;
3121
+ declare const ToastContainer: ({ newestOnTop, limit, position, "data-testid": dataTestId, className, autoClose, }: ToastContainerProps) => _emotion_react_jsx_runtime.JSX.Element;
3116
3122
 
3117
3123
  /**
3118
3124
  * Toggle component is used to toggle between two states (on/off, true/false, etc.).
@@ -13,11 +13,11 @@ const contractString = str => {
13
13
  const StyledOl = /*#__PURE__*/_styled("ol", {
14
14
  target: "ej0p0s41"
15
15
  })(process.env.NODE_ENV === "production" ? {
16
- name: "55j7or",
17
- styles: "list-style:none;margin:0;padding:0;display:flex;align-items:center"
16
+ name: "105zz11",
17
+ styles: "list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;align-items:center"
18
18
  } : {
19
- name: "55j7or",
20
- styles: "list-style:none;margin:0;padding:0;display:flex;align-items:center",
19
+ name: "105zz11",
20
+ styles: "list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;align-items:center",
21
21
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
22
22
  });
23
23
  const ItemContainer = /*#__PURE__*/_styled("li", {
@@ -1,4 +1,5 @@
1
1
  import _styled from '@emotion/styled/base';
2
+ import { keyframes } from '@emotion/react';
2
3
  import { useEffect } from 'react';
3
4
  import { Checkbox } from '../Checkbox/index.js';
4
5
  import { Tooltip } from '../Tooltip/index.js';
@@ -6,16 +7,41 @@ import { Cell } from './Cell.js';
6
7
  import { useTableContext } from './TableContext.js';
7
8
  import { jsxs, jsx } from '@emotion/react/jsx-runtime';
8
9
 
10
+ 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
11
  const StyledCheckboxContainer = /*#__PURE__*/_styled("div", {
12
+ target: "e1qvrbgq1"
13
+ })(process.env.NODE_ENV === "production" ? {
14
+ name: "zjik7",
15
+ styles: "display:flex"
16
+ } : {
17
+ name: "zjik7",
18
+ styles: "display:flex",
19
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
20
+ });
21
+
22
+ // We start at 5% and finish at 80% to leave the original background color
23
+ // as we can't know if the table will be stripped or not
24
+ const colorChange = theme => keyframes`
25
+ 5% {
26
+ background-color: ${theme.colors.primary.background};
27
+ }
28
+ 80% {
29
+ background-color: ${theme.colors.primary.background};
30
+ }
31
+ `;
32
+ const StyledTr = /*#__PURE__*/_styled('tr', {
33
+ shouldForwardProp: prop => !['highlightAnimation'].includes(prop),
10
34
  target: "e1qvrbgq0"
11
- })("display:flex;background:", ({
35
+ })("animation:", ({
36
+ highlightAnimation,
12
37
  theme
13
- }) => theme.colors.neutral.background, ";");
38
+ }) => highlightAnimation ? colorChange(theme) : undefined, " 3s linear;");
14
39
  const Row = ({
15
40
  children,
16
41
  className,
17
42
  id,
18
43
  selectDisabled,
44
+ highlightAnimation,
19
45
  'data-testid': dataTestid
20
46
  }) => {
21
47
  const {
@@ -33,9 +59,10 @@ const Row = ({
33
59
  }
34
60
  return undefined;
35
61
  }, [id, registerSelectableRow, selectDisabled]);
36
- return jsxs("tr", {
62
+ return jsxs(StyledTr, {
37
63
  className: className,
38
64
  "data-testid": dataTestid,
65
+ highlightAnimation: highlightAnimation,
39
66
  children: [selectable ? jsx(Cell, {
40
67
  children: jsx(StyledCheckboxContainer, {
41
68
  "data-visibility": allRowSelectValue === false ? 'hover' : undefined,
@@ -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;width:344px;padding:", theme.space['2'], ";text-size:", theme.typography.bodySmallStrong.fontSize, ";", 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;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, ";}")
16
16
  };
17
17
  const StyledButton = /*#__PURE__*/_styled(Button, {
18
18
  target: "e1eb63990"
@@ -95,7 +95,9 @@ const ToastContainer = ({
95
95
  newestOnTop,
96
96
  limit,
97
97
  position = 'top-right',
98
- 'data-testid': dataTestId
98
+ 'data-testid': dataTestId,
99
+ className,
100
+ autoClose
99
101
  }) => {
100
102
  const theme = useTheme();
101
103
  return jsxs(Fragment, {
@@ -107,14 +109,14 @@ const ToastContainer = ({
107
109
  }) => jsx(ToastContainer$1, {
108
110
  "data-testid": dataTestId,
109
111
  toastClassName: localCss(styles.toast(theme)),
110
- autoClose: AUTOCLOSE_DELAY,
112
+ autoClose: autoClose ?? AUTOCLOSE_DELAY,
111
113
  icon: false,
112
114
  newestOnTop: newestOnTop,
113
115
  limit: limit,
114
116
  position: position,
115
- css: /*#__PURE__*/css("top:100px;right:calc(0% + ", theme.space['2'], ");"),
116
117
  stacked: true,
117
- hideProgressBar: true
118
+ hideProgressBar: true,
119
+ className: className
118
120
  })
119
121
  })]
120
122
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/ui",
3
- "version": "1.34.0",
3
+ "version": "1.36.0",
4
4
  "description": "Ultraviolet UI",
5
5
  "homepage": "https://github.com/scaleway/ultraviolet#readme",
6
6
  "repository": {