@ultraviolet/ui 1.26.1 → 1.27.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
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import react__default, { ReactNode, ComponentProps, ButtonHTMLAttributes, AriaRole, MouseEventHandler, JSX, MouseEvent, InputHTMLAttributes, HTMLAttributeAnchorTarget, AnchorHTMLAttributes, ReactElement, Ref, RefObject, KeyboardEventHandler, HTMLAttributes, CSSProperties, ChangeEventHandler, FocusEventHandler, ForwardRefExoticComponent, ForwardedRef, ElementType, TextareaHTMLAttributes } from 'react';
2
+ import react__default, { ReactNode, ComponentProps, ButtonHTMLAttributes, AriaRole, MouseEventHandler, JSX, MouseEvent, InputHTMLAttributes, FocusEvent, HTMLAttributeAnchorTarget, AnchorHTMLAttributes, ReactElement, Ref, RefObject, KeyboardEventHandler, HTMLAttributes, CSSProperties, ChangeEventHandler, FocusEventHandler, ForwardRefExoticComponent, ForwardedRef, ElementType, TextareaHTMLAttributes } from 'react';
3
3
  import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
4
4
  import * as _emotion_styled from '@emotion/styled';
5
5
  import * as _emotion_react from '@emotion/react';
@@ -1382,8 +1382,16 @@ type CopyButtonProps = {
1382
1382
  */
1383
1383
  declare const CopyButton: ({ size, value, copyText, copiedText, sentiment, noBorder, className, "data-testid": dataTestId, }: CopyButtonProps) => _emotion_react_jsx_runtime.JSX.Element;
1384
1384
 
1385
- type DateInputProps = Pick<ReactDatePickerProps<string, boolean>, 'autoFocus' | 'disabled' | 'locale' | 'maxDate' | 'minDate' | 'name' | 'onBlur' | 'onChange' | 'onFocus' | 'required'> & {
1385
+ type DateInputProps = Pick<ReactDatePickerProps<string, boolean>, 'locale' | 'onChange'> & {
1386
+ autoFocus?: boolean;
1387
+ disabled?: boolean;
1388
+ maxDate?: Date | null;
1389
+ minDate?: Date | null;
1390
+ name?: string;
1391
+ onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
1392
+ onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
1386
1393
  error?: string;
1394
+ required?: boolean;
1387
1395
  format?: (value?: Date | string) => string | undefined;
1388
1396
  /**
1389
1397
  * Label of the field
@@ -1498,6 +1506,7 @@ declare const PROMINENCES$1: {
1498
1506
  default: string;
1499
1507
  weak: string;
1500
1508
  strong: string;
1509
+ stronger: string;
1501
1510
  };
1502
1511
  type ProminenceProps$1 = keyof typeof PROMINENCES$1;
1503
1512
  type LinkSizes = 'large' | 'small';
@@ -1517,6 +1526,7 @@ type LinkProps = {
1517
1526
  'aria-label'?: string;
1518
1527
  oneLine?: boolean;
1519
1528
  'data-testid'?: string;
1529
+ variant?: 'inline' | 'standalone';
1520
1530
  };
1521
1531
  /**
1522
1532
  * Link is a component used to navigate between pages or to external websites.
@@ -2831,6 +2841,7 @@ type VerificationCodeProps = {
2831
2841
  initialValue?: string;
2832
2842
  inputId?: string;
2833
2843
  inputStyle?: string;
2844
+ size?: 'small' | 'medium' | 'large' | 'xlarge';
2834
2845
  /**
2835
2846
  * Triggered when a field change
2836
2847
  */
@@ -2851,7 +2862,7 @@ type VerificationCodeProps = {
2851
2862
  /**
2852
2863
  * Verification code allows you to enter a code in multiple fields (4 by default).
2853
2864
  */
2854
- declare const VerificationCode: ({ disabled, className, error, fields, initialValue, inputId, inputStyle, onChange, onComplete, placeholder, required, type, "data-testid": dataTestId, "aria-label": ariaLabel, }: VerificationCodeProps) => _emotion_react_jsx_runtime.JSX.Element;
2865
+ 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;
2855
2866
 
2856
2867
  type RadioGroupRadioProps = Omit<ComponentProps<typeof Radio>, 'onChange' | 'checked' | 'required'>;
2857
2868
  type RadioGroupProps = {
@@ -2918,6 +2929,41 @@ declare const MenuV2: react.ForwardRefExoticComponent<MenuProps & react.RefAttri
2918
2929
  } & react.RefAttributes<HTMLElement>>;
2919
2930
  };
2920
2931
 
2932
+ type GlobalAlertProps = {
2933
+ children: ReactNode;
2934
+ variant?: 'info' | 'danger' | 'promotional';
2935
+ onClose?: () => void;
2936
+ closable?: boolean;
2937
+ className?: string;
2938
+ 'data-testid'?: string;
2939
+ buttonText?: string;
2940
+ onClickButton?: () => void;
2941
+ };
2942
+ /**
2943
+ * GlobalAlert is a component that is used to display a global alert message.
2944
+ * It has its own internal state and can be closed by clicking on the close button.
2945
+ */
2946
+ declare const GlobalAlert: {
2947
+ ({ children, variant, onClose, closable, buttonText, onClickButton, className, "data-testid": dataTestId, }: GlobalAlertProps): _emotion_react_jsx_runtime.JSX.Element | null;
2948
+ Link: ({ children, href, target, download, rel, className, onClick, "aria-label": ariaLabel, oneLine, "data-testid": dataTestId, }: Omit<{
2949
+ children: ReactNode;
2950
+ target?: react.HTMLAttributeAnchorTarget | undefined;
2951
+ download?: string | boolean | undefined;
2952
+ sentiment?: Color | undefined;
2953
+ prominence?: "strong" | "default" | "stronger" | "weak" | undefined;
2954
+ size?: ("large" | "small") | undefined;
2955
+ iconPosition?: ("left" | "right") | undefined;
2956
+ rel?: string | undefined;
2957
+ className?: string | undefined;
2958
+ href: string;
2959
+ onClick?: react.MouseEventHandler<HTMLAnchorElement> | undefined;
2960
+ 'aria-label'?: string | undefined;
2961
+ oneLine?: boolean | undefined;
2962
+ 'data-testid'?: string | undefined;
2963
+ variant?: "inline" | "standalone" | undefined;
2964
+ } & react.RefAttributes<HTMLAnchorElement>, "size" | "sentiment" | "prominence">) => _emotion_react_jsx_runtime.JSX.Element;
2965
+ };
2966
+
2921
2967
  declare const getUUID: (prefix?: string) => string;
2922
2968
 
2923
2969
  declare const bounce: _emotion_react.Keyframes;
@@ -2961,4 +3007,4 @@ declare const down: (size: ScreenSize, rules: string) => string;
2961
3007
 
2962
3008
  declare const normalize: () => string;
2963
3009
 
2964
- 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, Popup, 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 };
3010
+ 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, 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, 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 };
@@ -332,4 +332,4 @@ const Button = /*#__PURE__*/forwardRef((_ref10, ref) => {
332
332
  });
333
333
  });
334
334
 
335
- export { Button };
335
+ export { Button, SIZE_HEIGHT };
@@ -28,49 +28,44 @@ const StyledBeforeScroll = /*#__PURE__*/_styled("span", {
28
28
  }, "\n );cursor:w-resize;z-index:auto;");
29
29
  const StyledScrollableWrapper = /*#__PURE__*/_styled("div", {
30
30
  target: "e1id70w02"
31
- })("overflow-x:scroll;overflow-y:hidden;white-space:nowrap;display:flex;padding:", _ref3 => {
31
+ })("overflow-x:scroll;overflow-y:hidden;white-space:nowrap;display:flex;padding:0 100px;gap:", _ref3 => {
32
32
  let {
33
33
  theme
34
34
  } = _ref3;
35
35
  return theme.space['2'];
36
- }, " 100px;gap:", _ref4 => {
37
- let {
38
- theme
39
- } = _ref4;
40
- return theme.space['2'];
41
36
  }, ";");
42
37
  const StyledAfterScroll = /*#__PURE__*/_styled("span", {
43
38
  target: "e1id70w01"
44
- })("position:absolute;bottom:0;right:0;width:100px;height:100%;content:'';cursor:e-resize;z-index:auto;background:linear-gradient(\n -90deg,\n ", _ref5 => {
39
+ })("position:absolute;bottom:0;right:0;width:100px;height:100%;content:'';cursor:e-resize;z-index:auto;background:linear-gradient(\n -90deg,\n ", _ref4 => {
45
40
  let {
46
41
  theme
47
- } = _ref5;
42
+ } = _ref4;
48
43
  return theme.colors.neutral.background;
49
- }, ",\n ", _ref6 => {
44
+ }, ",\n ", _ref5 => {
50
45
  let {
51
46
  theme
52
- } = _ref6;
47
+ } = _ref5;
53
48
  return theme.colors.neutral.background;
54
49
  }, "ff\n );");
55
50
  const StyledBorderWrapper = /*#__PURE__*/_styled('div', {
56
51
  shouldForwardProp: prop => !['width'].includes(prop),
57
52
  target: "e1id70w00"
58
- })("display:flex;align-items:stretch;width:", _ref7 => {
53
+ })("display:flex;align-items:stretch;width:", _ref6 => {
59
54
  let {
60
55
  width
61
- } = _ref7;
56
+ } = _ref6;
62
57
  return width;
63
- }, ";max-width:", _ref8 => {
58
+ }, ";max-width:", _ref7 => {
64
59
  let {
65
60
  width
66
- } = _ref8;
61
+ } = _ref7;
67
62
  return width;
68
63
  }, ";overflow-wrap:break-word;white-space:normal;height:auto;cursor:grab;flex-shrink:0;");
69
- const CarouselItem = _ref9 => {
64
+ const CarouselItem = _ref8 => {
70
65
  let {
71
66
  children,
72
67
  width = '240px'
73
- } = _ref9;
68
+ } = _ref8;
74
69
  return jsx(StyledBorderWrapper, {
75
70
  width: width,
76
71
  draggable: "true",
@@ -80,12 +75,12 @@ const CarouselItem = _ref9 => {
80
75
  /**
81
76
  * Carousel component allows you to scroll horizontally through a list of items.
82
77
  */
83
- const Carousel = _ref10 => {
78
+ const Carousel = _ref9 => {
84
79
  let {
85
80
  children,
86
81
  className,
87
82
  'data-testid': dataTestId = 'scrollbar'
88
- } = _ref10;
83
+ } = _ref9;
89
84
  const scrollRef = useRef(null);
90
85
  let intervalLeft;
91
86
  let intervalRight;
@@ -22,178 +22,208 @@ const StyledSeparator = /*#__PURE__*/_styled(Separator, {
22
22
  }, ";height:100%;");
23
23
  const StyledWrapper = /*#__PURE__*/_styled("div", {
24
24
  target: "e1bm75lk2"
25
- })("width:100%;div", PREFIX, "-wrapper{display:block;}div", PREFIX, "__input-container{display:block;}div", PREFIX, "__triangle{display:none;}div", PREFIX, "__month-container{padding:16px;}", PREFIX, "-popper{z-index:1000;}.calendar{font-family:'Asap';border-color:", _ref2 => {
25
+ })("width:100%;div", PREFIX, "-wrapper{display:block;}div", PREFIX, "__input-container{display:block;}div", PREFIX, "__triangle{display:none;}div", PREFIX, "__month-container{padding:16px;}", PREFIX, "-popper{z-index:1000;}.calendar{font-family:", _ref2 => {
26
26
  let {
27
27
  theme
28
28
  } = _ref2;
29
- return theme.colors.neutral.borderWeak;
30
- }, ";background-color:", _ref3 => {
29
+ return theme.typography.body.fontFamily;
30
+ }, ";border-color:", _ref3 => {
31
31
  let {
32
32
  theme
33
33
  } = _ref3;
34
- return theme.colors.neutral.backgroundWeakElevated;
35
- }, ";", PREFIX, "__header{color:", _ref4 => {
34
+ return theme.colors.neutral.borderWeak;
35
+ }, ";background-color:", _ref4 => {
36
36
  let {
37
37
  theme
38
38
  } = _ref4;
39
- return theme.colors.neutral.text;
40
- }, ";background-color:", _ref5 => {
39
+ return theme.colors.neutral.backgroundWeakElevated;
40
+ }, ";", PREFIX, "__header{color:", _ref5 => {
41
41
  let {
42
42
  theme
43
43
  } = _ref5;
44
- return theme.colors.neutral.backgroundWeakElevated;
45
- }, ";border-bottom:none;text-align:inherit;display:block;padding-top:0;position:inherit;}", PREFIX, "__triangle{border-bottom-color:", _ref6 => {
44
+ return theme.colors.neutral.text;
45
+ }, ";background-color:", _ref6 => {
46
46
  let {
47
47
  theme
48
48
  } = _ref6;
49
- return theme.colors.neutral.backgroundWeak;
50
- }, ";}", PREFIX, "__month{margin:0;}", PREFIX, "__day-names{margin-top:8px;}", PREFIX, "__day-name{font-family:'Asap';color:", _ref7 => {
49
+ return theme.colors.neutral.backgroundWeakElevated;
50
+ }, ";border-bottom:none;text-align:inherit;display:block;padding-top:0;position:inherit;}", PREFIX, "__triangle{border-bottom-color:", _ref7 => {
51
51
  let {
52
52
  theme
53
53
  } = _ref7;
54
- return theme.colors.neutral.text;
55
- }, ";font-weight:500;font-size:14px;line-height:24px;text-align:center;margin:3px;text-transform:capitalize;}", PREFIX, "__day{color:", _ref8 => {
54
+ return theme.colors.neutral.backgroundWeak;
55
+ }, ";}", PREFIX, "__month{margin:0;}", PREFIX, "__day-names{margin-top:8px;}", PREFIX, "__day-name{font-family:", _ref8 => {
56
56
  let {
57
57
  theme
58
58
  } = _ref8;
59
- return theme.colors.neutral.textWeak;
60
- }, ";font-size:16px;width:1.7rem;height:1.7rem;margin-left:3px;margin-right:3px;}", PREFIX, "__day--selected{color:", _ref9 => {
59
+ return theme.typography.bodySmallStrong.fontFamily;
60
+ }, ";color:", _ref9 => {
61
61
  let {
62
62
  theme
63
63
  } = _ref9;
64
- return theme.colors.primary.textStrong;
65
- }, ";background-color:", _ref10 => {
64
+ return theme.colors.neutral.text;
65
+ }, ";font-weight:", _ref10 => {
66
66
  let {
67
67
  theme
68
68
  } = _ref10;
69
- return theme.colors.primary.backgroundStrong;
70
- }, ";&[aria-disabled='true'],&:disabled{color:", _ref11 => {
69
+ return theme.typography.bodySmallStrong.weight;
70
+ }, ";font-size:", _ref11 => {
71
71
  let {
72
72
  theme
73
73
  } = _ref11;
74
- return theme.colors.primary.textStrongDisabled;
75
- }, ";background-color:", _ref12 => {
74
+ return theme.typography.bodySmallStrong.fontSize;
75
+ }, ";line-height:", _ref12 => {
76
76
  let {
77
77
  theme
78
78
  } = _ref12;
79
- return theme.colors.primary.backgroundStrongDisabled;
80
- }, ";}}", PREFIX, "__day--in-selecting-range{color:", _ref13 => {
79
+ return theme.typography.bodySmallStrong.lineHeight;
80
+ }, ";text-align:center;margin:3px;text-transform:capitalize;}", PREFIX, "__day{color:", _ref13 => {
81
81
  let {
82
82
  theme
83
83
  } = _ref13;
84
- return theme.colors.primary.text;
85
- }, ";background-color:", _ref14 => {
84
+ return theme.colors.neutral.textWeak;
85
+ }, ";font-size:", _ref14 => {
86
86
  let {
87
87
  theme
88
88
  } = _ref14;
89
- return theme.colors.primary.background;
90
- }, ";&[aria-disabled='true'],&:disabled{color:", _ref15 => {
89
+ return theme.typography.body.fontSize;
90
+ }, ";width:1.7rem;height:1.7rem;margin-left:3px;margin-right:3px;}", PREFIX, "__day--selected{color:", _ref15 => {
91
91
  let {
92
92
  theme
93
93
  } = _ref15;
94
- return theme.colors.primary.textDisabled;
94
+ return theme.colors.primary.textStrong;
95
95
  }, ";background-color:", _ref16 => {
96
96
  let {
97
97
  theme
98
98
  } = _ref16;
99
- return theme.colors.primary.backgroundDisabled;
100
- }, ";}}", PREFIX, "__day--in-range{color:", _ref17 => {
99
+ return theme.colors.primary.backgroundStrong;
100
+ }, ";&[aria-disabled='true'],&:disabled{color:", _ref17 => {
101
101
  let {
102
102
  theme
103
103
  } = _ref17;
104
- return theme.colors.primary.text;
104
+ return theme.colors.primary.textStrongDisabled;
105
105
  }, ";background-color:", _ref18 => {
106
106
  let {
107
107
  theme
108
108
  } = _ref18;
109
- return theme.colors.primary.background;
110
- }, ";&[aria-disabled='true'],&:disabled{color:", _ref19 => {
109
+ return theme.colors.primary.backgroundStrongDisabled;
110
+ }, ";}}", PREFIX, "__day--in-selecting-range{color:", _ref19 => {
111
111
  let {
112
112
  theme
113
113
  } = _ref19;
114
- return theme.colors.primary.textDisabled;
114
+ return theme.colors.primary.text;
115
115
  }, ";background-color:", _ref20 => {
116
116
  let {
117
117
  theme
118
118
  } = _ref20;
119
- return theme.colors.primary.backgroundDisabled;
120
- }, ";}}", PREFIX, "__day--range-start{color:", _ref21 => {
119
+ return theme.colors.primary.background;
120
+ }, ";&[aria-disabled='true'],&:disabled{color:", _ref21 => {
121
121
  let {
122
122
  theme
123
123
  } = _ref21;
124
- return theme.colors.primary.textStrong;
124
+ return theme.colors.primary.textDisabled;
125
125
  }, ";background-color:", _ref22 => {
126
126
  let {
127
127
  theme
128
128
  } = _ref22;
129
- return theme.colors.primary.backgroundStrong;
130
- }, ";&[aria-disabled='true'],&:disabled{color:", _ref23 => {
129
+ return theme.colors.primary.backgroundDisabled;
130
+ }, ";}}", PREFIX, "__day--in-range{color:", _ref23 => {
131
131
  let {
132
132
  theme
133
133
  } = _ref23;
134
- return theme.colors.primary.textStrongDisabled;
134
+ return theme.colors.primary.text;
135
135
  }, ";background-color:", _ref24 => {
136
136
  let {
137
137
  theme
138
138
  } = _ref24;
139
- return theme.colors.primary.backgroundStrongDisabled;
140
- }, ";}}", PREFIX, "__day--range-end{color:", _ref25 => {
139
+ return theme.colors.primary.background;
140
+ }, ";&[aria-disabled='true'],&:disabled{color:", _ref25 => {
141
141
  let {
142
142
  theme
143
143
  } = _ref25;
144
- return theme.colors.primary.textStrong;
144
+ return theme.colors.primary.textDisabled;
145
145
  }, ";background-color:", _ref26 => {
146
146
  let {
147
147
  theme
148
148
  } = _ref26;
149
- return theme.colors.primary.backgroundStrong;
150
- }, ";&[aria-disabled='true'],&:disabled{color:", _ref27 => {
149
+ return theme.colors.primary.backgroundDisabled;
150
+ }, ";}}", PREFIX, "__day--range-start{color:", _ref27 => {
151
151
  let {
152
152
  theme
153
153
  } = _ref27;
154
- return theme.colors.primary.textStrongDisabled;
154
+ return theme.colors.primary.textStrong;
155
155
  }, ";background-color:", _ref28 => {
156
156
  let {
157
157
  theme
158
158
  } = _ref28;
159
- return theme.colors.primary.backgroundStrongDisabled;
160
- }, ";}}", PREFIX, "__day--keyboard-selected{color:", _ref29 => {
159
+ return theme.colors.primary.backgroundStrong;
160
+ }, ";&[aria-disabled='true'],&:disabled{color:", _ref29 => {
161
161
  let {
162
162
  theme
163
163
  } = _ref29;
164
- return theme.colors.primary.textStrong;
164
+ return theme.colors.primary.textStrongDisabled;
165
165
  }, ";background-color:", _ref30 => {
166
166
  let {
167
167
  theme
168
168
  } = _ref30;
169
- return theme.colors.primary.backgroundStrong;
170
- }, ";}", PREFIX, "__day:hover{color:", _ref31 => {
169
+ return theme.colors.primary.backgroundStrongDisabled;
170
+ }, ";}}", PREFIX, "__day--range-end{color:", _ref31 => {
171
171
  let {
172
172
  theme
173
173
  } = _ref31;
174
- return theme.colors.neutral.textHover;
174
+ return theme.colors.primary.textStrong;
175
175
  }, ";background-color:", _ref32 => {
176
176
  let {
177
177
  theme
178
178
  } = _ref32;
179
- return theme.colors.neutral.backgroundHover;
180
- }, ";}", PREFIX, "__day--disabled{color:", _ref33 => {
179
+ return theme.colors.primary.backgroundStrong;
180
+ }, ";&[aria-disabled='true'],&:disabled{color:", _ref33 => {
181
181
  let {
182
182
  theme
183
183
  } = _ref33;
184
- return theme.colors.neutral.textDisabled;
185
- }, ";}", PREFIX, "__day--disabled:hover{color:", _ref34 => {
184
+ return theme.colors.primary.textStrongDisabled;
185
+ }, ";background-color:", _ref34 => {
186
186
  let {
187
187
  theme
188
188
  } = _ref34;
189
+ return theme.colors.primary.backgroundStrongDisabled;
190
+ }, ";}}", PREFIX, "__day--keyboard-selected{color:", _ref35 => {
191
+ let {
192
+ theme
193
+ } = _ref35;
194
+ return theme.colors.primary.textStrong;
195
+ }, ";background-color:", _ref36 => {
196
+ let {
197
+ theme
198
+ } = _ref36;
199
+ return theme.colors.primary.backgroundStrong;
200
+ }, ";}", PREFIX, "__day:hover{color:", _ref37 => {
201
+ let {
202
+ theme
203
+ } = _ref37;
204
+ return theme.colors.neutral.textHover;
205
+ }, ";background-color:", _ref38 => {
206
+ let {
207
+ theme
208
+ } = _ref38;
209
+ return theme.colors.neutral.backgroundHover;
210
+ }, ";}", PREFIX, "__day--disabled{color:", _ref39 => {
211
+ let {
212
+ theme
213
+ } = _ref39;
214
+ return theme.colors.neutral.textDisabled;
215
+ }, ";}", PREFIX, "__day--disabled:hover{color:", _ref40 => {
216
+ let {
217
+ theme
218
+ } = _ref40;
189
219
  return theme.colors.neutral.textDisabled;
190
220
  }, ";background-color:transparent;}}");
191
221
  const StyledIconContainer = /*#__PURE__*/_styled("div", {
192
222
  target: "e1bm75lk1"
193
- })("padding:", _ref35 => {
223
+ })("padding:", _ref41 => {
194
224
  let {
195
225
  theme
196
- } = _ref35;
226
+ } = _ref41;
197
227
  return theme.space['1'];
198
228
  }, ";position:absolute;display:flex;align-items:center;right:0;top:0;height:48px;");
199
229
  const StyledText = /*#__PURE__*/_styled(Text, {
@@ -212,7 +242,7 @@ const DEFAULT_FORMAT = value => value instanceof Date ? value.toISOString() : va
212
242
  * DateInput is a wrapper around react-datepicker that provides a consistent look and feel with the rest of the Ultraviolet UI.
213
243
  * See https://reactdatepicker.com/ for more information.
214
244
  */
215
- const DateInput = _ref36 => {
245
+ const DateInput = _ref42 => {
216
246
  let {
217
247
  autoFocus = false,
218
248
  disabled = false,
@@ -234,7 +264,7 @@ const DateInput = _ref36 => {
234
264
  selectsRange,
235
265
  className,
236
266
  'data-testid': dataTestId
237
- } = _ref36;
267
+ } = _ref42;
238
268
  // Linked to: https://github.com/Hacker0x01/react-datepicker/issues/3834
239
269
  const ReactDatePicker = DatePicker.default ?? DatePicker;
240
270
  const localeCode = (typeof locale === 'string' ? locale : locale?.code) ?? 'en-GB';
@@ -288,14 +318,14 @@ const DateInput = _ref36 => {
288
318
  maxDate: maxDate,
289
319
  startDate: startDate,
290
320
  endDate: endDate,
291
- renderCustomHeader: _ref37 => {
321
+ renderCustomHeader: _ref43 => {
292
322
  let {
293
323
  date,
294
324
  decreaseMonth,
295
325
  increaseMonth,
296
326
  prevMonthButtonDisabled,
297
327
  nextMonthButtonDisabled
298
- } = _ref37;
328
+ } = _ref43;
299
329
  return jsxs(Stack, {
300
330
  direction: "row",
301
331
  alignItems: "center",
@@ -0,0 +1,39 @@
1
+ import { useTheme } from '@emotion/react';
2
+ import { Link } from '../Link/index.js';
3
+ import { jsx } from '@emotion/react/jsx-runtime';
4
+
5
+ const GlobalAlertLink = _ref => {
6
+ let {
7
+ children,
8
+ href,
9
+ target,
10
+ download,
11
+ rel,
12
+ className,
13
+ onClick,
14
+ 'aria-label': ariaLabel,
15
+ oneLine = false,
16
+ 'data-testid': dataTestId
17
+ } = _ref;
18
+ const {
19
+ theme
20
+ } = useTheme();
21
+ return jsx(Link, {
22
+ href: href,
23
+ target: target,
24
+ download: download,
25
+ sentiment: "neutral",
26
+ prominence: theme === 'light' ? 'stronger' : 'strong',
27
+ size: "small",
28
+ variant: "inline",
29
+ rel: rel,
30
+ className: className,
31
+ onClick: onClick,
32
+ "aria-label": ariaLabel,
33
+ oneLine: oneLine,
34
+ "data-testid": dataTestId,
35
+ children: children
36
+ });
37
+ };
38
+
39
+ export { GlobalAlertLink };
@@ -0,0 +1,95 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { useTheme } from '@emotion/react';
3
+ import { useReducer } from 'react';
4
+ import { Button, SIZE_HEIGHT } from '../Button/index.js';
5
+ import { Stack } from '../Stack/index.js';
6
+ import { Text } from '../Text/index.js';
7
+ import { GlobalAlertLink } from './GlobalAlertLink.js';
8
+ import { jsxs, jsx } from '@emotion/react/jsx-runtime';
9
+
10
+ const CloseButton = /*#__PURE__*/_styled(Button, {
11
+ target: "ewvyccp1"
12
+ })("background:none;position:absolute;right:", SIZE_HEIGHT.xsmall, "px;&:hover,&:focus,&:active{background:none;}");
13
+ const Container = /*#__PURE__*/_styled(Stack, {
14
+ target: "ewvyccp0"
15
+ })("width:100%;height:56px;padding:0 ", _ref => {
16
+ let {
17
+ theme
18
+ } = _ref;
19
+ return theme.space['2'];
20
+ }, ";&[data-variant='info']{background-color:", _ref2 => {
21
+ let {
22
+ theme
23
+ } = _ref2;
24
+ return theme.colors.info.backgroundStrong;
25
+ }, ";}&[data-variant='danger']{background-color:", _ref3 => {
26
+ let {
27
+ theme
28
+ } = _ref3;
29
+ return theme.colors.danger.backgroundStrong;
30
+ }, ";}&[data-variant='promotional']{background:", _ref4 => {
31
+ let {
32
+ theme
33
+ } = _ref4;
34
+ return theme.colors.other.gradients.background.aqua;
35
+ }, ";}");
36
+ /**
37
+ * GlobalAlert is a component that is used to display a global alert message.
38
+ * It has its own internal state and can be closed by clicking on the close button.
39
+ */
40
+ const GlobalAlert = _ref5 => {
41
+ let {
42
+ children,
43
+ variant = 'info',
44
+ onClose,
45
+ closable = true,
46
+ buttonText,
47
+ onClickButton,
48
+ className,
49
+ 'data-testid': dataTestId
50
+ } = _ref5;
51
+ const {
52
+ theme
53
+ } = useTheme();
54
+ const [opened, toggleOpened] = useReducer(value => !value, true);
55
+ if (!opened) return null;
56
+ return jsxs(Container, {
57
+ justifyContent: "center",
58
+ alignItems: "center",
59
+ direction: "row",
60
+ "data-variant": variant,
61
+ "data-testid": dataTestId,
62
+ className: className,
63
+ children: [jsxs(Stack, {
64
+ gap: 2,
65
+ direction: "row",
66
+ justifyContent: "center",
67
+ alignItems: "center",
68
+ children: [jsx(Text, {
69
+ variant: "bodySmall",
70
+ as: "p",
71
+ sentiment: "neutral",
72
+ prominence: theme === 'light' ? 'stronger' : 'strong',
73
+ children: children
74
+ }), onClickButton && buttonText ? jsx(Button, {
75
+ onClick: onClickButton,
76
+ variant: "filled",
77
+ sentiment: "neutral",
78
+ size: "small",
79
+ children: buttonText
80
+ }) : null]
81
+ }), closable ? jsx(CloseButton, {
82
+ variant: "filled",
83
+ size: "xsmall",
84
+ icon: "close",
85
+ sentiment: "primary",
86
+ onClick: () => {
87
+ toggleOpened();
88
+ onClose?.();
89
+ }
90
+ }) : null]
91
+ });
92
+ };
93
+ GlobalAlert.Link = GlobalAlertLink;
94
+
95
+ export { GlobalAlert };
@@ -12,7 +12,8 @@ const StyledIcon = /*#__PURE__*/_styled(Icon, {
12
12
  const PROMINENCES = {
13
13
  default: '',
14
14
  weak: 'weak',
15
- strong: 'strong'
15
+ strong: 'strong',
16
+ stronger: 'stronger'
16
17
  };
17
18
  const ICON_SIZE = 16;
18
19
  const BLANK_TARGET_ICON_SIZE = 14;
@@ -74,17 +75,17 @@ const StyledLink = /*#__PURE__*/_styled('a', {
74
75
  } = _ref6;
75
76
  const definedProminence = capitalize(PROMINENCES[prominence ?? 'default']);
76
77
  theme.colors[sentiment];
77
- const text = `text${definedProminence}`;
78
+ const text = `text${definedProminence}Hover`;
78
79
  return `
79
- color: ${theme.colors[sentiment]?.[text] ?? theme.colors.neutral.text};
80
- text-decoration-color: ${theme.colors[sentiment]?.[text] ?? theme.colors.neutral.text};`;
80
+ color: ${theme.colors[sentiment]?.[text] ?? theme.colors.neutral.textHover};
81
+ text-decoration-color: ${theme.colors[sentiment]?.[text] ?? theme.colors.neutral.textHover};`;
81
82
  }, ";", StyledIcon, "{transform:", _ref7 => {
82
83
  let {
83
84
  theme,
84
85
  iconPosition
85
86
  } = _ref7;
86
87
  return iconPosition === 'left' ? `translate(${theme.space['0.5']}, 0)` : `translate(-${theme.space['0.5']}, 0)`;
87
- }, ";}}&:hover::after,&:focus::after{background-color:", _ref8 => {
88
+ }, ";}}&[data-variant='inline']{text-decoration:underline;text-decoration-thickness:1px;}&:hover::after,&:focus::after{background-color:", _ref8 => {
88
89
  let {
89
90
  theme,
90
91
  sentiment
@@ -110,7 +111,8 @@ const Link = /*#__PURE__*/forwardRef((_ref9, ref) => {
110
111
  onClick,
111
112
  'aria-label': ariaLabel,
112
113
  oneLine = false,
113
- 'data-testid': dataTestId
114
+ 'data-testid': dataTestId,
115
+ variant = 'standalone'
114
116
  } = _ref9;
115
117
  const isBlank = target === '_blank';
116
118
  const computedRel = rel || (isBlank ? 'noopener noreferrer' : undefined);
@@ -144,6 +146,7 @@ const Link = /*#__PURE__*/forwardRef((_ref9, ref) => {
144
146
  "aria-label": ariaLabel,
145
147
  oneLine: oneLine,
146
148
  "data-testid": dataTestId,
149
+ "data-variant": variant,
147
150
  children: [!isBlank && iconPosition === 'left' ? jsx(StyledIcon, {
148
151
  name: "arrow-left",
149
152
  size: ICON_SIZE
@@ -18,6 +18,7 @@ const computePlacement = _ref => {
18
18
  childrenStructuredRef,
19
19
  popupStructuredRef,
20
20
  offsetParentRect,
21
+ offsetParent,
21
22
  popupPortalTarget
22
23
  } = _ref;
23
24
  const {
@@ -30,9 +31,10 @@ const computePlacement = _ref => {
30
31
  left: parentLeft,
31
32
  right: parentRight
32
33
  } = offsetParentRect;
33
- const overloadedChildrenLeft = popupPortalTarget === document.body ? childrenLeft : childrenLeft - parentLeft;
34
- const overloadedChildrenTop = popupPortalTarget === document.body ? childrenTop : childrenTop - parentTop;
35
- const overloadedChildrenRight = popupPortalTarget === document.body ? childrenRight : childrenRight - parentRight;
34
+ const isPopupPortalTargetBody = popupPortalTarget === document.body || offsetParent === document.body;
35
+ const overloadedChildrenLeft = isPopupPortalTargetBody ? childrenLeft : childrenLeft - parentLeft;
36
+ const overloadedChildrenTop = isPopupPortalTargetBody ? childrenTop : childrenTop - parentTop;
37
+ const overloadedChildrenRight = isPopupPortalTargetBody ? childrenRight : childrenRight - parentRight;
36
38
  const {
37
39
  width: popupWidth,
38
40
  height: popupHeight
@@ -99,7 +101,8 @@ const computePositions = _ref2 => {
99
101
  childrenStructuredRef: childrenRect,
100
102
  popupStructuredRef,
101
103
  offsetParentRect,
102
- popupPortalTarget
104
+ popupPortalTarget,
105
+ offsetParent
103
106
  }) : placement;
104
107
  const {
105
108
  top: childrenTop,
@@ -122,7 +125,7 @@ const computePositions = _ref2 => {
122
125
  const isPopupPortalTargetBody = popupPortalTarget === document.body || offsetParent === document.body;
123
126
 
124
127
  // It will get how much scroll is done on the page to compute the position of the popup
125
- const scrollTopValue = isPopupPortalTargetBody ? document.documentElement.scrollTop : 0;
128
+ const scrollTopValue = isPopupPortalTargetBody ? document.documentElement.scrollTop : offsetParent.scrollTop;
126
129
 
127
130
  // We need to compute the position of the popup based on the parent element in the case the popup is not in the body
128
131
  const overloadedChildrenLeft = isPopupPortalTargetBody ? childrenLeft : childrenLeft - parentLeft;
@@ -3,6 +3,7 @@ import { Icon } from '@ultraviolet/icons';
3
3
  import useClipboard from 'react-use-clipboard';
4
4
  import { Button } from '../Button/index.js';
5
5
  import { Loader } from '../Loader/index.js';
6
+ import { Text } from '../Text/index.js';
6
7
  import { Tooltip } from '../Tooltip/index.js';
7
8
  import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
8
9
 
@@ -69,14 +70,14 @@ const StyledContainer = /*#__PURE__*/_styled('span', {
69
70
  border: solid 1px ${theme.colors[sentiment].background};
70
71
  `;
71
72
  }, ";");
72
- const StyledTag = /*#__PURE__*/_styled("span", {
73
+ const StyledText = /*#__PURE__*/_styled(Text, {
73
74
  target: "el6733p1"
74
75
  })(process.env.NODE_ENV === "production" ? {
75
- name: "td7tdt",
76
- styles: "font-size:12px;font-weight:500;color:inherit;max-width:232px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis"
76
+ name: "12vzl34",
77
+ styles: "max-width:232px"
77
78
  } : {
78
- name: "td7tdt",
79
- styles: "font-size:12px;font-weight:500;color:inherit;max-width:232px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis",
79
+ name: "12vzl34",
80
+ styles: "max-width:232px",
80
81
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
81
82
  });
82
83
  const StyledCloseButton = /*#__PURE__*/_styled(Button, {
@@ -101,7 +102,10 @@ const TagInner = _ref6 => {
101
102
  children: [icon ? jsx(Icon, {
102
103
  name: icon,
103
104
  size: 16
104
- }) : null, jsx(StyledTag, {
105
+ }) : null, jsx(StyledText, {
106
+ as: "span",
107
+ variant: "caption",
108
+ oneLine: true,
105
109
  "aria-disabled": disabled,
106
110
  children: children
107
111
  }), onClose && !isLoading ? jsx(StyledCloseButton, {
@@ -2,7 +2,20 @@ import _styled from '@emotion/styled/base';
2
2
  import { useId, useState, createRef } from 'react';
3
3
  import { jsx } from '@emotion/react/jsx-runtime';
4
4
 
5
- const StyledInput = /*#__PURE__*/_styled("input", {
5
+ const SIZE_HEIGHT = {
6
+ xlarge: 64,
7
+ large: 48,
8
+ medium: 40,
9
+ small: 32
10
+ };
11
+ const SIZE_WIDTH = {
12
+ xlarge: 56,
13
+ large: 40,
14
+ medium: 32,
15
+ small: 24
16
+ };
17
+ const StyledInput = /*#__PURE__*/_styled('input', {
18
+ shouldForwardProp: prop => !['inputSize'].includes(prop),
6
19
  target: "e1a2bx9q0"
7
20
  })("background:", _ref => {
8
21
  let {
@@ -15,48 +28,90 @@ const StyledInput = /*#__PURE__*/_styled("input", {
15
28
  theme
16
29
  } = _ref2;
17
30
  return error ? theme.colors.danger.border : theme.colors.neutral.border;
18
- }, ";font-size:24px;color:", _ref3 => {
31
+ }, ";color:", _ref3 => {
19
32
  let {
20
33
  'aria-invalid': error,
21
34
  theme
22
35
  } = _ref3;
23
36
  return error ? theme.colors.danger.text : theme.colors.neutral.text;
24
- }, ";text-align:center;border-radius:", _ref4 => {
37
+ }, ";", _ref4 => {
25
38
  let {
39
+ inputSize,
26
40
  theme
27
41
  } = _ref4;
28
- return theme.radii.default;
29
- }, ";margin-right:", _ref5 => {
42
+ if (inputSize === 'small') {
43
+ return `
44
+ font-size: ${theme.typography.caption.fontSize};
45
+ font-weight: ${theme.typography.caption.weight};
46
+ `;
47
+ }
48
+ return `
49
+ font-size: ${theme.typography.body.fontSize};
50
+ font-weight: ${theme.typography.body.weight};
51
+ `;
52
+ }, " text-align:center;border-radius:", _ref5 => {
30
53
  let {
31
54
  theme
32
55
  } = _ref5;
56
+ return theme.radii.default;
57
+ }, ";margin-right:", _ref6 => {
58
+ let {
59
+ theme
60
+ } = _ref6;
33
61
  return theme.space['1'];
34
- }, ";width:56px;height:64px;outline-style:none;transition:border-color 0.2s ease,box-shadow 0.2s ease;&:hover,&:focus{border-color:", _ref6 => {
62
+ }, ";width:", _ref7 => {
63
+ let {
64
+ inputSize
65
+ } = _ref7;
66
+ return SIZE_WIDTH[inputSize];
67
+ }, "px;height:", _ref8 => {
68
+ let {
69
+ inputSize
70
+ } = _ref8;
71
+ return SIZE_HEIGHT[inputSize];
72
+ }, "px;outline-style:none;transition:border-color 0.2s ease,box-shadow 0.2s ease;&:hover,&:focus{border-color:", _ref9 => {
35
73
  let {
36
74
  'aria-invalid': error,
37
75
  theme
38
- } = _ref6;
76
+ } = _ref9;
39
77
  return error ? theme.colors.danger.borderHover : theme.colors.primary.borderHover;
40
- }, ";}&:focus{box-shadow:", _ref7 => {
78
+ }, ";}&:focus{box-shadow:", _ref10 => {
41
79
  let {
42
80
  'aria-invalid': error,
43
81
  theme: {
44
82
  shadows
45
83
  }
46
- } = _ref7;
84
+ } = _ref10;
47
85
  return error ? shadows.focusDanger : shadows.focusPrimary;
48
- }, ";}&:last-child{margin-right:0;}&::placeholder{color:", _ref8 => {
86
+ }, ";}&:last-child{margin-right:0;}&::placeholder{color:", _ref11 => {
49
87
  let {
88
+ disabled,
50
89
  theme
51
- } = _ref8;
52
- return theme.colors.neutral.textWeak;
53
- }, ";}");
90
+ } = _ref11;
91
+ return disabled ? theme.colors.neutral.textWeakDisabled : theme.colors.neutral.textWeak;
92
+ }, ";}", _ref12 => {
93
+ let {
94
+ disabled,
95
+ theme: {
96
+ colors
97
+ }
98
+ } = _ref12;
99
+ return disabled && `cursor: default;
100
+ background-color: ${colors.neutral.backgroundDisabled};
101
+ border-color: ${colors.neutral.borderDisabled};
102
+ color: ${colors.neutral.textDisabled};
103
+
104
+ &:hover {
105
+ border: ${colors.neutral.borderDisabled}
106
+ }
107
+ `;
108
+ }, ";");
54
109
  const DEFAULT_ON_FUNCTION = () => {};
55
110
 
56
111
  /**
57
112
  * Verification code allows you to enter a code in multiple fields (4 by default).
58
113
  */
59
- const VerificationCode = _ref9 => {
114
+ const VerificationCode = _ref13 => {
60
115
  let {
61
116
  disabled = false,
62
117
  className,
@@ -65,6 +120,7 @@ const VerificationCode = _ref9 => {
65
120
  initialValue = '',
66
121
  inputId,
67
122
  inputStyle = '',
123
+ size = 'large',
68
124
  onChange = DEFAULT_ON_FUNCTION,
69
125
  onComplete = DEFAULT_ON_FUNCTION,
70
126
  placeholder = '',
@@ -72,7 +128,7 @@ const VerificationCode = _ref9 => {
72
128
  type = 'number',
73
129
  'data-testid': dataTestId,
74
130
  'aria-label': ariaLabel = 'Verification code'
75
- } = _ref9;
131
+ } = _ref13;
76
132
  const uniqueId = useId();
77
133
  const valuesArray = Object.assign(new Array(fields).fill(''), initialValue.substring(0, fields).split(''));
78
134
  const [values, setValues] = useState(valuesArray);
@@ -176,6 +232,7 @@ const VerificationCode = _ref9 => {
176
232
  children: values.map((value, index) => jsx(StyledInput, {
177
233
  css: [inputStyle],
178
234
  "aria-invalid": error,
235
+ inputSize: size,
179
236
  type: type === 'number' ? 'tel' : type,
180
237
  pattern: type === 'number' ? '[0-9]*' : undefined
181
238
  // eslint-disable-next-line react/no-array-index-key
package/dist/src/index.js CHANGED
@@ -67,3 +67,4 @@ export { VerificationCode } from './components/VerificationCode/index.js';
67
67
  export { RadioGroup } from './components/RadioGroup/index.js';
68
68
  export { Icon } from '@ultraviolet/icons';
69
69
  export { MenuV2 } from './components/MenuV2/index.js';
70
+ export { GlobalAlert } from './components/GlobalAlert/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/ui",
3
- "version": "1.26.1",
3
+ "version": "1.27.0",
4
4
  "description": "Ultraviolet UI",
5
5
  "homepage": "https://github.com/scaleway/ultraviolet#readme",
6
6
  "repository": {