@ultraviolet/ui 1.37.0 → 1.38.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 +33 -2
- package/dist/src/components/Notification/index.js +74 -0
- package/dist/src/components/NumberInputV2/index.js +4 -4
- package/dist/src/components/SelectableCard/index.js +4 -1
- package/dist/src/components/Skeleton/index.js +2 -0
- package/dist/src/components/TagInput/index.js +5 -5
- package/dist/src/components/TextArea/index.js +4 -4
- package/dist/src/components/TextInputV2/index.js +4 -4
- package/dist/src/index.js +1 -0
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,8 @@ import { Serie, LineSvgProps } from '@nivo/line';
|
|
|
15
15
|
import { ScaleSpec } from '@nivo/scales';
|
|
16
16
|
import { PopoverStateReturn } from 'reakit/Popover';
|
|
17
17
|
import Select, { OptionProps, Props, CommonProps as CommonProps$1, GroupBase } from 'react-select';
|
|
18
|
-
import
|
|
18
|
+
import * as react_toastify from 'react-toastify';
|
|
19
|
+
import { ToastOptions, TypeOptions, Theme as Theme$1 } from 'react-toastify';
|
|
19
20
|
|
|
20
21
|
type ActionBarProps = {
|
|
21
22
|
children: ReactNode;
|
|
@@ -3317,6 +3318,36 @@ declare const GlobalAlert: {
|
|
|
3317
3318
|
} & react.RefAttributes<HTMLAnchorElement>, "size" | "sentiment" | "prominence">) => _emotion_react_jsx_runtime.JSX.Element;
|
|
3318
3319
|
};
|
|
3319
3320
|
|
|
3321
|
+
type CloseButtonProps = {
|
|
3322
|
+
closeToast: (event: React.MouseEvent<HTMLElement>) => void;
|
|
3323
|
+
type: TypeOptions;
|
|
3324
|
+
ariaLabel?: string;
|
|
3325
|
+
theme: Theme$1;
|
|
3326
|
+
};
|
|
3327
|
+
declare const notification: (children: ReactNode | ((props: CloseButtonProps) => ReactNode), title: string, icon?: ReactNode, isClosable?: boolean, options?: ToastOptions) => react_toastify.Id;
|
|
3328
|
+
type NotificationContainerProps = {
|
|
3329
|
+
/**
|
|
3330
|
+
* Delay (in ms) before the notification autocloses. To disable autoclose, set to false
|
|
3331
|
+
*/
|
|
3332
|
+
autoClose?: false | number;
|
|
3333
|
+
/**
|
|
3334
|
+
* Whether to display the newest toast on top.
|
|
3335
|
+
* `Default: false`
|
|
3336
|
+
*/
|
|
3337
|
+
newestOnTop?: boolean;
|
|
3338
|
+
/**
|
|
3339
|
+
* Limit the number of toast displayed at the same time
|
|
3340
|
+
*/
|
|
3341
|
+
limit?: number;
|
|
3342
|
+
/**
|
|
3343
|
+
* Position on the notification container
|
|
3344
|
+
*/
|
|
3345
|
+
position?: ToastOptions['position'];
|
|
3346
|
+
'data-testid'?: string;
|
|
3347
|
+
className?: string;
|
|
3348
|
+
};
|
|
3349
|
+
declare const NotificationContainer: ({ newestOnTop, limit, autoClose, position, "data-testid": dataTestId, className, }: NotificationContainerProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
3350
|
+
|
|
3320
3351
|
declare const getUUID: (prefix?: string) => string;
|
|
3321
3352
|
|
|
3322
3353
|
declare const bounce: _emotion_react.Keyframes;
|
|
@@ -3360,4 +3391,4 @@ declare const down: (size: ScreenSize, rules: string) => string;
|
|
|
3360
3391
|
|
|
3361
3392
|
declare const normalize: () => string;
|
|
3362
3393
|
|
|
3363
|
-
export { ActionBar, Alert, Avatar, Badge, Banner, BarChart, BarStack, Breadcrumbs, Breakpoint, Bullet, Button, Card, Carousel, Checkbox, CheckboxGroup, CheckboxGroupCheckbox, CopyButton, DateInput, EmptyState, Expandable, GlobalAlert, LineChart, Link, List, Loader, Menu, MenuV2, Meter, Modal, Notice, NumberInput, NumberInputV2, Pagination, PasswordCheck, PasswordStrengthMeter, PieChart, Popover, Popup, ProgressBar, Radio, RadioGroup, Row, type SCWUITheme, SelectInput, SelectableCard, Separator, Skeleton, Snippet, Stack, Status, StepList, Stepper, SwitchButton, Table, Tabs, Tag, TagInput, TagList, Text, TextArea, TextInput, TextInputV2, 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 };
|
|
3394
|
+
export { ActionBar, Alert, Avatar, Badge, Banner, BarChart, BarStack, Breadcrumbs, Breakpoint, Bullet, Button, Card, Carousel, Checkbox, CheckboxGroup, CheckboxGroupCheckbox, CopyButton, DateInput, EmptyState, Expandable, GlobalAlert, LineChart, Link, List, Loader, Menu, MenuV2, Meter, Modal, Notice, NotificationContainer, NumberInput, NumberInputV2, Pagination, PasswordCheck, PasswordStrengthMeter, PieChart, Popover, Popup, ProgressBar, Radio, RadioGroup, Row, type SCWUITheme, SelectInput, SelectableCard, Separator, Skeleton, Snippet, Stack, Status, StepList, Stepper, SwitchButton, Table, Tabs, Tag, TagInput, TagList, Text, TextArea, TextInput, TextInputV2, TimeInput, ToastContainer, Toggle, ToggleGroup, Tooltip, type UltravioletUITheme, VerificationCode, bounce, down, extendTheme, fadeIn, fadeOut, flash, getUUID, normalize, notification, 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 };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { useTheme, Global, ClassNames, css } from '@emotion/react';
|
|
2
|
+
import { toast, ToastContainer, Slide } from 'react-toastify';
|
|
3
|
+
import css_248z from '../../../react-toastify/dist/ReactToastify.min.css.js';
|
|
4
|
+
import { Button } from '../Button/index.js';
|
|
5
|
+
import { Stack } from '../Stack/index.js';
|
|
6
|
+
import { Text } from '../Text/index.js';
|
|
7
|
+
import { jsxs, jsx, Fragment } from '@emotion/react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
const PREFIX = '.Toastify';
|
|
10
|
+
const styles = {
|
|
11
|
+
toast: ({
|
|
12
|
+
theme
|
|
13
|
+
}) => /*#__PURE__*/css("border-radius:", theme.radii.default, ";&", PREFIX, "__toast{background-color:", theme.colors.neutral.background, ";color:", theme.colors.neutral.text, ";padding:", theme.space['2'], ";box-shadow:", theme.shadows.defaultShadow, ";}&", PREFIX, "__toast-container{width:312px;}", PREFIX, "__toast-body{margin:0;padding:0;}")
|
|
14
|
+
};
|
|
15
|
+
const closeButton = props => jsx(Button, {
|
|
16
|
+
"aria-label": "close",
|
|
17
|
+
icon: "close",
|
|
18
|
+
sentiment: "neutral",
|
|
19
|
+
variant: "ghost",
|
|
20
|
+
onClick: props.closeToast,
|
|
21
|
+
size: "xsmall"
|
|
22
|
+
});
|
|
23
|
+
const notification = (children, title, icon, isClosable, options) => toast('', {
|
|
24
|
+
...options,
|
|
25
|
+
closeButton: props => jsxs(Stack, {
|
|
26
|
+
direction: "row",
|
|
27
|
+
gap: 2,
|
|
28
|
+
children: [jsx("div", {
|
|
29
|
+
children: icon
|
|
30
|
+
}), jsxs(Stack, {
|
|
31
|
+
direction: "column",
|
|
32
|
+
children: [jsx(Text, {
|
|
33
|
+
as: "h3",
|
|
34
|
+
variant: "bodySmallStronger",
|
|
35
|
+
children: title
|
|
36
|
+
}), typeof children === 'function' ? children(props) : children]
|
|
37
|
+
}), isClosable ? closeButton(props) : null]
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
const NotificationContainer = ({
|
|
41
|
+
newestOnTop,
|
|
42
|
+
limit,
|
|
43
|
+
autoClose = false,
|
|
44
|
+
position = 'top-right',
|
|
45
|
+
'data-testid': dataTestId,
|
|
46
|
+
className
|
|
47
|
+
}) => {
|
|
48
|
+
const theme = useTheme();
|
|
49
|
+
return jsxs(Fragment, {
|
|
50
|
+
children: [jsx(Global, {
|
|
51
|
+
styles: css_248z
|
|
52
|
+
}), jsx(ClassNames, {
|
|
53
|
+
children: ({
|
|
54
|
+
css: localCss
|
|
55
|
+
}) => jsx(ToastContainer, {
|
|
56
|
+
"data-testid": dataTestId,
|
|
57
|
+
toastClassName: localCss(styles.toast({
|
|
58
|
+
theme
|
|
59
|
+
})),
|
|
60
|
+
icon: false,
|
|
61
|
+
autoClose: autoClose,
|
|
62
|
+
newestOnTop: newestOnTop,
|
|
63
|
+
limit: limit,
|
|
64
|
+
position: position,
|
|
65
|
+
hideProgressBar: true,
|
|
66
|
+
draggable: false,
|
|
67
|
+
transition: Slide,
|
|
68
|
+
className: className
|
|
69
|
+
})
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export { NotificationContainer, notification };
|
|
@@ -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, {
|
|
@@ -9,7 +9,9 @@ import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
|
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 Container = /*#__PURE__*/_styled(Stack, {
|
|
11
11
|
target: "e1s5n3hj2"
|
|
12
|
-
})("
|
|
12
|
+
})("&[data-has-label='false']>:first-child{margin-bottom:-", ({
|
|
13
|
+
theme
|
|
14
|
+
}) => theme.space['0.5'], ";}padding:", ({
|
|
13
15
|
theme
|
|
14
16
|
}) => theme.space['2'], ";border-radius:", ({
|
|
15
17
|
theme
|
|
@@ -117,6 +119,7 @@ const SelectableCard = /*#__PURE__*/forwardRef(({
|
|
|
117
119
|
"data-error": isError,
|
|
118
120
|
"data-testid": dataTestId,
|
|
119
121
|
"data-type": type,
|
|
122
|
+
"data-has-label": !!label,
|
|
120
123
|
ref: ref,
|
|
121
124
|
alignItems: "start",
|
|
122
125
|
direction: "column",
|
|
@@ -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, {
|
package/dist/src/index.js
CHANGED
|
@@ -71,3 +71,4 @@ export { RadioGroup } from './components/RadioGroup/index.js';
|
|
|
71
71
|
export { Icon } from '@ultraviolet/icons';
|
|
72
72
|
export { MenuV2 } from './components/MenuV2/index.js';
|
|
73
73
|
export { GlobalAlert } from './components/GlobalAlert/index.js';
|
|
74
|
+
export { NotificationContainer, notification } from './components/Notification/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultraviolet/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.38.0",
|
|
4
4
|
"description": "Ultraviolet UI",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"@emotion/babel-plugin": "11.11.0",
|
|
44
44
|
"@emotion/react": "11.11.3",
|
|
45
45
|
"@emotion/styled": "11.11.0",
|
|
46
|
-
"@types/react": "18.2.
|
|
46
|
+
"@types/react": "18.2.55",
|
|
47
47
|
"@types/react-datepicker": "4.19.6",
|
|
48
|
-
"@types/react-dom": "18.2.
|
|
48
|
+
"@types/react-dom": "18.2.19",
|
|
49
49
|
"react": "18.2.0",
|
|
50
50
|
"react-dom": "18.2.0"
|
|
51
51
|
},
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"react-use-clipboard": "1.0.9",
|
|
68
68
|
"reakit": "1.3.11",
|
|
69
69
|
"@ultraviolet/themes": "1.9.0",
|
|
70
|
-
"@ultraviolet/icons": "2.9.
|
|
70
|
+
"@ultraviolet/icons": "2.9.1"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build": "rollup -c ../../rollup.config.mjs",
|