@ultraviolet/ui 1.31.6 → 1.32.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 +34 -43
- package/dist/src/components/Breadcrumbs/index.js +4 -4
- package/dist/src/components/Checkbox/index.js +4 -4
- package/dist/src/components/DateInput/index.js +40 -34
- package/dist/src/components/MenuV2/Item.js +24 -20
- package/dist/src/components/Radio/index.js +3 -2
- package/dist/src/components/SelectInput/index.js +2 -8
- package/dist/src/components/TextInput/index.js +1 -0
- package/dist/src/components/TextInputV2/index.js +117 -115
- package/dist/src/components/Toaster/index.js +2 -2
- package/dist/src/index.js +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1605,12 +1605,19 @@ type DateInputProps = Pick<ReactDatePickerProps<string, boolean>, 'locale' | 'on
|
|
|
1605
1605
|
startDate?: Date | null;
|
|
1606
1606
|
endDate?: Date | null;
|
|
1607
1607
|
excludeDates?: Date[];
|
|
1608
|
+
id?: string;
|
|
1609
|
+
labelDescription?: ReactNode;
|
|
1610
|
+
success?: string;
|
|
1611
|
+
helper?: string;
|
|
1612
|
+
size?: 'small' | 'medium' | 'large';
|
|
1613
|
+
readOnly?: boolean;
|
|
1614
|
+
tooltip?: string;
|
|
1608
1615
|
};
|
|
1609
1616
|
/**
|
|
1610
1617
|
* DateInput is a wrapper around react-datepicker that provides a consistent look and feel with the rest of the Ultraviolet UI.
|
|
1611
1618
|
* See https://reactdatepicker.com/ for more information.
|
|
1612
1619
|
*/
|
|
1613
|
-
declare const DateInput: ({ autoFocus, disabled, error, format, label, locale, maxDate, minDate, startDate, endDate, name, onBlur, onChange, onFocus, required, excludeDates, value, selectsRange, className, "data-testid": dataTestId, }: DateInputProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1620
|
+
declare const DateInput: ({ autoFocus, disabled, error, format, label, labelDescription, locale, maxDate, minDate, startDate, endDate, name, onBlur, onChange, onFocus, required, excludeDates, value, selectsRange, className, id, success, helper, size, readOnly, tooltip, "data-testid": dataTestId, }: DateInputProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1614
1621
|
|
|
1615
1622
|
declare const CONTAINER_SIZES: {
|
|
1616
1623
|
readonly small: 720;
|
|
@@ -2957,7 +2964,7 @@ type StyledInputProps = {
|
|
|
2957
2964
|
rightComponentLength: number;
|
|
2958
2965
|
} & (InputHTMLAttributes<HTMLInputElement> | TextareaHTMLAttributes<HTMLTextAreaElement>);
|
|
2959
2966
|
type InputProps = Omit<Exclude<StyledInputProps, TextareaHTMLAttributes<HTMLTextAreaElement>>, 'inputSize'>;
|
|
2960
|
-
type TextInputProps
|
|
2967
|
+
type TextInputProps = {
|
|
2961
2968
|
'data-testid'?: string;
|
|
2962
2969
|
ariaControls?: string;
|
|
2963
2970
|
autoComplete?: string;
|
|
@@ -3003,50 +3010,34 @@ type TextInputProps$1 = {
|
|
|
3003
3010
|
* TextInput component allows users to input text, with options for customization and validation.
|
|
3004
3011
|
* It supports various input types and should be appropriately sized with clear labeling.
|
|
3005
3012
|
*/
|
|
3006
|
-
declare const TextInput
|
|
3013
|
+
declare const TextInput: react.ForwardRefExoticComponent<TextInputProps & react.RefAttributes<HTMLInputElement | HTMLTextAreaElement | null>>;
|
|
3007
3014
|
|
|
3008
|
-
declare const TEXTINPUT_SIZE_HEIGHT: {
|
|
3009
|
-
readonly large: 48;
|
|
3010
|
-
readonly medium: 40;
|
|
3011
|
-
readonly small: 32;
|
|
3012
|
-
};
|
|
3013
|
-
type TextInputSize = keyof typeof TEXTINPUT_SIZE_HEIGHT;
|
|
3014
|
-
type TextInputProps = {
|
|
3015
|
-
autoFocus?: boolean;
|
|
3016
|
-
className?: string;
|
|
3017
|
-
clearable?: boolean;
|
|
3018
|
-
'data-testid'?: string;
|
|
3019
|
-
disabled?: boolean;
|
|
3020
|
-
error?: string;
|
|
3021
|
-
helper?: ReactNode;
|
|
3022
|
-
iconName?: ComponentProps<typeof Icon>['name'];
|
|
3023
|
-
id?: string;
|
|
3024
|
-
label: string;
|
|
3025
|
-
labelDescription?: ReactNode;
|
|
3026
|
-
loading?: boolean;
|
|
3027
|
-
minLength?: number;
|
|
3028
|
-
maxLength?: number;
|
|
3029
|
-
name?: string;
|
|
3030
|
-
onBlur?: DOMAttributes<HTMLInputElement>['onBlur'];
|
|
3031
|
-
onChange: (newValue: string) => void;
|
|
3032
|
-
onFocus?: DOMAttributes<HTMLInputElement>['onFocus'];
|
|
3033
|
-
onRandomize?: () => void;
|
|
3034
|
-
placeholder?: string;
|
|
3035
|
-
prefix?: string;
|
|
3036
|
-
readOnly?: boolean;
|
|
3037
|
-
required?: boolean;
|
|
3038
|
-
size?: TextInputSize;
|
|
3039
|
-
success?: string;
|
|
3040
|
-
suffix?: string;
|
|
3041
|
-
tabIndex?: number;
|
|
3042
|
-
tooltip?: string;
|
|
3043
|
-
type?: 'text' | 'password' | 'url' | 'email';
|
|
3044
|
-
value?: string;
|
|
3045
|
-
};
|
|
3046
3015
|
/**
|
|
3047
3016
|
* This component offers an extended input HTML
|
|
3048
3017
|
*/
|
|
3049
|
-
declare const
|
|
3018
|
+
declare const TextInputV2: react.ForwardRefExoticComponent<{
|
|
3019
|
+
className?: string | undefined;
|
|
3020
|
+
clearable?: boolean | undefined;
|
|
3021
|
+
'data-testid'?: string | undefined;
|
|
3022
|
+
error?: string | undefined;
|
|
3023
|
+
helper?: ReactNode;
|
|
3024
|
+
iconName?: ComponentProps<typeof Icon>['name'];
|
|
3025
|
+
label?: string | undefined;
|
|
3026
|
+
labelDescription?: ReactNode;
|
|
3027
|
+
loading?: boolean | undefined;
|
|
3028
|
+
minLength?: number | undefined;
|
|
3029
|
+
maxLength?: number | undefined;
|
|
3030
|
+
onRandomize?: (() => void) | undefined;
|
|
3031
|
+
onChange?: ((newValue: string) => void) | undefined;
|
|
3032
|
+
prefix?: ReactNode;
|
|
3033
|
+
size?: "large" | "small" | "medium" | undefined;
|
|
3034
|
+
success?: string | undefined;
|
|
3035
|
+
suffix?: ReactNode;
|
|
3036
|
+
tabIndex?: number | undefined;
|
|
3037
|
+
tooltip?: string | undefined;
|
|
3038
|
+
type?: "text" | "email" | "password" | "url" | undefined;
|
|
3039
|
+
value?: string | undefined;
|
|
3040
|
+
} & Pick<InputHTMLAttributes<HTMLInputElement>, "autoFocus" | "id" | "aria-label" | "onFocus" | "onBlur" | "name" | "disabled" | "placeholder" | "readOnly" | "required"> & react.RefAttributes<HTMLInputElement>>;
|
|
3050
3041
|
|
|
3051
3042
|
declare const schedules: {
|
|
3052
3043
|
half: readonly ["00:00", "00:30", "01:00", "01:30", "02:00", "02:30", "03:00", "03:30", "04:00", "04:30", "05:00", "05:30", "06:00", "06:30", "07:00", "07:30", "08:00", "08:30", "09:00", "09:30", "10:00", "10:30", "11:00", "11:30", "12:00", "12:30", "13:00", "13:30", "14:00", "14:30", "15:00", "15:30", "16:00", "16:30", "17:00", "17:30", "18:00", "18:30", "19:00", "19:30", "20:00", "20:30", "21:00", "21:30", "22:00", "22:30", "23:00", "23:30"];
|
|
@@ -3330,4 +3321,4 @@ declare const down: (size: ScreenSize, rules: string) => string;
|
|
|
3330
3321
|
|
|
3331
3322
|
declare const normalize: () => string;
|
|
3332
3323
|
|
|
3333
|
-
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
|
|
3324
|
+
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 };
|
|
@@ -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: "
|
|
17
|
-
styles: "list-style:none;margin:0;padding:0;display:flex"
|
|
16
|
+
name: "55j7or",
|
|
17
|
+
styles: "list-style:none;margin:0;padding:0;display:flex;align-items:center"
|
|
18
18
|
} : {
|
|
19
|
-
name: "
|
|
20
|
-
styles: "list-style:none;margin:0;padding:0;display:flex",
|
|
19
|
+
name: "55j7or",
|
|
20
|
+
styles: "list-style:none;margin:0;padding:0;display:flex;align-items:center",
|
|
21
21
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
22
22
|
});
|
|
23
23
|
const ItemContainer = /*#__PURE__*/_styled("li", {
|
|
@@ -295,14 +295,14 @@ const Checkbox = /*#__PURE__*/forwardRef(({
|
|
|
295
295
|
})
|
|
296
296
|
}) : null]
|
|
297
297
|
}), helper ? jsx(Text, {
|
|
298
|
-
variant: "
|
|
299
|
-
as: "
|
|
298
|
+
variant: "caption",
|
|
299
|
+
as: "span",
|
|
300
300
|
prominence: "weak",
|
|
301
301
|
sentiment: "neutral",
|
|
302
302
|
children: helper
|
|
303
303
|
}) : null, error ? jsx(ErrorText, {
|
|
304
|
-
variant: "
|
|
305
|
-
as: "
|
|
304
|
+
variant: "caption",
|
|
305
|
+
as: "span",
|
|
306
306
|
sentiment: "danger",
|
|
307
307
|
children: error
|
|
308
308
|
}) : null]
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import _styled from '@emotion/styled/base';
|
|
2
2
|
import { Global } from '@emotion/react';
|
|
3
3
|
import { Icon } from '@ultraviolet/icons';
|
|
4
|
+
import { useId } from 'react';
|
|
4
5
|
import DatePicker, { registerLocale } from 'react-datepicker';
|
|
5
6
|
import css_248z from '../../../react-datepicker/dist/react-datepicker.min.css.js';
|
|
6
7
|
import { Button } from '../Button/index.js';
|
|
7
|
-
import { Separator } from '../Separator/index.js';
|
|
8
8
|
import { Stack } from '../Stack/index.js';
|
|
9
9
|
import { Text } from '../Text/index.js';
|
|
10
|
-
import {
|
|
10
|
+
import { TextInputV2 } from '../TextInputV2/index.js';
|
|
11
11
|
import { jsxs, Fragment, jsx } from '@emotion/react/jsx-runtime';
|
|
12
12
|
|
|
13
13
|
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)."; }
|
|
14
14
|
const PREFIX = '.react-datepicker';
|
|
15
|
-
const StyledSeparator = /*#__PURE__*/_styled(Separator, {
|
|
16
|
-
target: "e1bm75lk3"
|
|
17
|
-
})("margin:0 ", ({
|
|
18
|
-
theme
|
|
19
|
-
}) => theme.space['1'], ";height:100%;");
|
|
20
15
|
const StyledWrapper = /*#__PURE__*/_styled("div", {
|
|
21
|
-
target: "
|
|
16
|
+
target: "e1bm75lk1"
|
|
22
17
|
})("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:", ({
|
|
23
18
|
theme
|
|
24
19
|
}) => theme.typography.body.fontFamily, ";border-color:", ({
|
|
@@ -43,9 +38,17 @@ const StyledWrapper = /*#__PURE__*/_styled("div", {
|
|
|
43
38
|
theme
|
|
44
39
|
}) => theme.typography.bodySmallStrong.lineHeight, ";text-align:center;margin:3px;text-transform:capitalize;}", PREFIX, "__day{color:", ({
|
|
45
40
|
theme
|
|
46
|
-
}) => theme.colors.neutral.textWeak, ";font-
|
|
41
|
+
}) => theme.colors.neutral.textWeak, ";font-weight:", ({
|
|
42
|
+
theme
|
|
43
|
+
}) => theme.typography.bodyStrong.weight, ";font-size:", ({
|
|
44
|
+
theme
|
|
45
|
+
}) => theme.typography.bodyStrong.fontSize, ";width:26px;height:26px;margin-left:3px;margin-right:3px;}", PREFIX, "__day--outside-month{color:", ({
|
|
46
|
+
theme
|
|
47
|
+
}) => theme.colors.neutral.textDisabled, ";font-weight:", ({
|
|
47
48
|
theme
|
|
48
|
-
}) => theme.typography.
|
|
49
|
+
}) => theme.typography.bodyStrong.weight, ";font-size:", ({
|
|
50
|
+
theme
|
|
51
|
+
}) => theme.typography.bodyStrong.fontSize, ";}", PREFIX, "__day--selected{color:", ({
|
|
49
52
|
theme
|
|
50
53
|
}) => theme.colors.primary.textStrong, ";background-color:", ({
|
|
51
54
|
theme
|
|
@@ -98,11 +101,6 @@ const StyledWrapper = /*#__PURE__*/_styled("div", {
|
|
|
98
101
|
}) => theme.colors.neutral.textDisabled, ";}", PREFIX, "__day--disabled:hover{color:", ({
|
|
99
102
|
theme
|
|
100
103
|
}) => theme.colors.neutral.textDisabled, ";background-color:transparent;}}");
|
|
101
|
-
const StyledIconContainer = /*#__PURE__*/_styled("div", {
|
|
102
|
-
target: "e1bm75lk1"
|
|
103
|
-
})("padding:", ({
|
|
104
|
-
theme
|
|
105
|
-
}) => theme.space['1'], ";position:absolute;display:flex;align-items:center;right:0;top:0;height:48px;");
|
|
106
104
|
const StyledText = /*#__PURE__*/_styled(Text, {
|
|
107
105
|
target: "e1bm75lk0"
|
|
108
106
|
})(process.env.NODE_ENV === "production" ? {
|
|
@@ -125,6 +123,7 @@ const DateInput = ({
|
|
|
125
123
|
error,
|
|
126
124
|
format = DEFAULT_FORMAT,
|
|
127
125
|
label,
|
|
126
|
+
labelDescription,
|
|
128
127
|
locale,
|
|
129
128
|
maxDate,
|
|
130
129
|
minDate,
|
|
@@ -139,8 +138,17 @@ const DateInput = ({
|
|
|
139
138
|
value,
|
|
140
139
|
selectsRange,
|
|
141
140
|
className,
|
|
141
|
+
id,
|
|
142
|
+
success,
|
|
143
|
+
helper,
|
|
144
|
+
size = 'large',
|
|
145
|
+
readOnly = false,
|
|
146
|
+
tooltip,
|
|
142
147
|
'data-testid': dataTestId
|
|
143
148
|
}) => {
|
|
149
|
+
const uniqueId = useId();
|
|
150
|
+
const localId = id ?? uniqueId;
|
|
151
|
+
|
|
144
152
|
// Linked to: https://github.com/Hacker0x01/react-datepicker/issues/3834
|
|
145
153
|
const ReactDatePicker = DatePicker.default ?? DatePicker;
|
|
146
154
|
const localeCode = (typeof locale === 'string' ? locale : locale?.code) ?? 'en-GB';
|
|
@@ -155,6 +163,7 @@ const DateInput = ({
|
|
|
155
163
|
styles: css_248z
|
|
156
164
|
}), jsx(StyledWrapper, {
|
|
157
165
|
children: jsx(ReactDatePicker, {
|
|
166
|
+
required: required,
|
|
158
167
|
"data-testid": dataTestId,
|
|
159
168
|
className: className,
|
|
160
169
|
autoFocus: autoFocus,
|
|
@@ -167,26 +176,23 @@ const DateInput = ({
|
|
|
167
176
|
selected: value && !selectsRange ? new Date(value) : undefined,
|
|
168
177
|
selectsRange: selectsRange,
|
|
169
178
|
excludeDates: excludeDates,
|
|
170
|
-
customInput:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
customInput: jsx(TextInputV2, {
|
|
180
|
+
error: error,
|
|
181
|
+
success: success,
|
|
182
|
+
helper: helper,
|
|
183
|
+
id: localId,
|
|
184
|
+
label: label,
|
|
185
|
+
labelDescription: labelDescription,
|
|
186
|
+
value: valueFormat || '',
|
|
187
|
+
disabled: disabled,
|
|
188
|
+
size: size,
|
|
189
|
+
suffix: jsx(Icon, {
|
|
190
|
+
name: "calendar-range",
|
|
191
|
+
color: "neutral",
|
|
176
192
|
disabled: disabled
|
|
177
|
-
}),
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
color: "danger",
|
|
181
|
-
size: 8
|
|
182
|
-
}) : null, jsx(StyledSeparator, {
|
|
183
|
-
direction: "vertical"
|
|
184
|
-
}), jsx(Icon, {
|
|
185
|
-
name: "calendar-range",
|
|
186
|
-
color: error ? 'danger' : 'neutral',
|
|
187
|
-
size: 24
|
|
188
|
-
})]
|
|
189
|
-
})]
|
|
193
|
+
}),
|
|
194
|
+
readOnly: readOnly,
|
|
195
|
+
tooltip: tooltip
|
|
190
196
|
}),
|
|
191
197
|
disabled: disabled,
|
|
192
198
|
calendarClassName: "calendar",
|
|
@@ -75,35 +75,39 @@ const Item = /*#__PURE__*/forwardRef(({
|
|
|
75
75
|
'data-testid': dataTestId
|
|
76
76
|
}, ref) => {
|
|
77
77
|
if (href && !disabled) {
|
|
78
|
-
return jsx(
|
|
78
|
+
return jsx("div", {
|
|
79
|
+
children: jsx(Tooltip, {
|
|
80
|
+
text: tooltip,
|
|
81
|
+
children: jsx(StyledLinkItem, {
|
|
82
|
+
borderless: true,
|
|
83
|
+
href: href,
|
|
84
|
+
ref: ref,
|
|
85
|
+
onClick: disabled ? undefined : onClick,
|
|
86
|
+
role: "menuitem",
|
|
87
|
+
disabled: disabled,
|
|
88
|
+
sentiment: sentiment,
|
|
89
|
+
className: className,
|
|
90
|
+
"data-testid": dataTestId,
|
|
91
|
+
children: children
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return jsx("div", {
|
|
97
|
+
children: jsx(Tooltip, {
|
|
79
98
|
text: tooltip,
|
|
80
|
-
children: jsx(
|
|
81
|
-
|
|
82
|
-
href: href,
|
|
99
|
+
children: jsx(StyledItem, {
|
|
100
|
+
type: "button",
|
|
83
101
|
ref: ref,
|
|
84
|
-
onClick: disabled ? undefined : onClick,
|
|
85
102
|
role: "menuitem",
|
|
86
103
|
disabled: disabled,
|
|
104
|
+
onClick: onClick,
|
|
105
|
+
borderless: borderless,
|
|
87
106
|
sentiment: sentiment,
|
|
88
107
|
className: className,
|
|
89
108
|
"data-testid": dataTestId,
|
|
90
109
|
children: children
|
|
91
110
|
})
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
return jsx(Tooltip, {
|
|
95
|
-
text: tooltip,
|
|
96
|
-
children: jsx(StyledItem, {
|
|
97
|
-
type: "button",
|
|
98
|
-
ref: ref,
|
|
99
|
-
role: "menuitem",
|
|
100
|
-
disabled: disabled,
|
|
101
|
-
onClick: onClick,
|
|
102
|
-
borderless: borderless,
|
|
103
|
-
sentiment: sentiment,
|
|
104
|
-
className: className,
|
|
105
|
-
"data-testid": dataTestId,
|
|
106
|
-
children: children
|
|
107
111
|
})
|
|
108
112
|
});
|
|
109
113
|
});
|
|
@@ -144,9 +144,10 @@ const Radio = /*#__PURE__*/forwardRef(({
|
|
|
144
144
|
children: label
|
|
145
145
|
}) : null]
|
|
146
146
|
}), helper ? jsx(MargedText, {
|
|
147
|
-
as: "
|
|
148
|
-
variant: "
|
|
147
|
+
as: "span",
|
|
148
|
+
variant: "caption",
|
|
149
149
|
prominence: "weak",
|
|
150
|
+
sentiment: "neutral",
|
|
150
151
|
children: helper
|
|
151
152
|
}) : null]
|
|
152
153
|
})
|
|
@@ -85,16 +85,10 @@ const getSelectStyles = ({
|
|
|
85
85
|
...(!state.isDisabled && {
|
|
86
86
|
':focus-within': {
|
|
87
87
|
borderColor: error ? theme.colors.danger.border : theme.colors.primary.border,
|
|
88
|
-
boxShadow: error ? theme.shadows.focusDanger : theme.shadows.focusPrimary
|
|
89
|
-
svg: {
|
|
90
|
-
fill: error ? theme.colors.danger.text : theme.colors.primary.text
|
|
91
|
-
}
|
|
88
|
+
boxShadow: error ? theme.shadows.focusDanger : theme.shadows.focusPrimary
|
|
92
89
|
},
|
|
93
90
|
':hover': {
|
|
94
|
-
borderColor: error ? theme.colors.danger.borderHover : theme.colors.primary.borderHover
|
|
95
|
-
svg: {
|
|
96
|
-
fill: error ? theme.colors.danger.text : theme.colors.primary.text
|
|
97
|
-
}
|
|
91
|
+
borderColor: error ? theme.colors.danger.borderHover : theme.colors.primary.borderHover
|
|
98
92
|
}
|
|
99
93
|
}),
|
|
100
94
|
...(customStyle(state)?.['control'] || {}),
|
|
@@ -82,7 +82,7 @@ const StyledInputWrapper = /*#__PURE__*/_styled('div', {
|
|
|
82
82
|
/**
|
|
83
83
|
* This component offers an extended input HTML
|
|
84
84
|
*/
|
|
85
|
-
const
|
|
85
|
+
const TextInputV2 = /*#__PURE__*/forwardRef(({
|
|
86
86
|
id,
|
|
87
87
|
className,
|
|
88
88
|
tabIndex,
|
|
@@ -151,122 +151,124 @@ const TextInput = /*#__PURE__*/forwardRef(({
|
|
|
151
151
|
size: 8
|
|
152
152
|
}) : null]
|
|
153
153
|
}), labelDescription ?? null]
|
|
154
|
-
}), jsx(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}) : null, jsx(StyledInput, {
|
|
177
|
-
type: computedType,
|
|
178
|
-
"aria-invalid": !!error,
|
|
179
|
-
id: id ?? localId,
|
|
180
|
-
tabIndex: tabIndex,
|
|
181
|
-
autoFocus: autoFocus,
|
|
182
|
-
disabled: disabled,
|
|
183
|
-
ref: ref,
|
|
184
|
-
value: value === null ? '' : value,
|
|
185
|
-
onChange: event => {
|
|
186
|
-
onChange(event.currentTarget.value);
|
|
187
|
-
},
|
|
188
|
-
isSuccess: !!success,
|
|
189
|
-
isError: !!error,
|
|
190
|
-
isClearable: !!computedClearable,
|
|
191
|
-
placeholder: placeholder,
|
|
192
|
-
"data-testid": dataTestId,
|
|
193
|
-
name: name,
|
|
194
|
-
onFocus: event => {
|
|
195
|
-
setHasFocus(true);
|
|
196
|
-
onFocus?.(event);
|
|
197
|
-
},
|
|
198
|
-
onBlur: event => {
|
|
199
|
-
setHasFocus(false);
|
|
200
|
-
onBlur?.(event);
|
|
201
|
-
},
|
|
202
|
-
readOnly: readOnly,
|
|
203
|
-
minLength: minLength,
|
|
204
|
-
maxLength: maxLength
|
|
205
|
-
}), success || error || loading || computedClearable ? jsxs(StateStack, {
|
|
206
|
-
direction: "row",
|
|
207
|
-
gap: 1,
|
|
208
|
-
alignItems: "center",
|
|
209
|
-
children: [computedClearable ? jsx(Button, {
|
|
210
|
-
"aria-label": "clear value",
|
|
211
|
-
disabled: disabled || !value,
|
|
212
|
-
variant: "ghost",
|
|
213
|
-
size: size === 'small' ? 'xsmall' : 'small',
|
|
214
|
-
icon: "close",
|
|
215
|
-
onClick: () => {
|
|
216
|
-
onChange('');
|
|
217
|
-
},
|
|
218
|
-
sentiment: "neutral"
|
|
219
|
-
}) : null, success ? jsx(Icon, {
|
|
220
|
-
name: "checkbox-circle-outline",
|
|
221
|
-
color: "success",
|
|
222
|
-
size: 16,
|
|
223
|
-
disabled: disabled
|
|
224
|
-
}) : null, error ? jsx(Icon, {
|
|
225
|
-
name: "alert",
|
|
226
|
-
color: "danger",
|
|
227
|
-
size: 16,
|
|
228
|
-
disabled: disabled
|
|
229
|
-
}) : null, loading && !disabled ? jsx(Loader, {
|
|
230
|
-
active: true,
|
|
154
|
+
}), jsx("div", {
|
|
155
|
+
children: jsx(Tooltip, {
|
|
156
|
+
text: tooltip,
|
|
157
|
+
children: jsxs(StyledInputWrapper, {
|
|
158
|
+
hasFocus: hasFocus,
|
|
159
|
+
"data-disabled": disabled,
|
|
160
|
+
"data-readOnly": readOnly,
|
|
161
|
+
"data-success": !!success,
|
|
162
|
+
"data-error": !!error,
|
|
163
|
+
size: size,
|
|
164
|
+
children: [prefix ? jsx(BasicPrefixStack, {
|
|
165
|
+
direction: "row",
|
|
166
|
+
alignItems: "center",
|
|
167
|
+
children: typeof prefix === 'string' ? jsx(Text, {
|
|
168
|
+
as: "span",
|
|
169
|
+
sentiment: "neutral",
|
|
170
|
+
variant: "bodySmall",
|
|
171
|
+
disabled: disabled,
|
|
172
|
+
children: prefix
|
|
173
|
+
}) : prefix
|
|
174
|
+
}) : null, iconName ? jsx(Icon, {
|
|
175
|
+
name: iconName,
|
|
231
176
|
size: 16
|
|
232
|
-
}) : null
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
sentiment: "neutral",
|
|
239
|
-
variant: "bodySmall",
|
|
177
|
+
}) : null, jsx(StyledInput, {
|
|
178
|
+
type: computedType,
|
|
179
|
+
"aria-invalid": !!error,
|
|
180
|
+
id: id ?? localId,
|
|
181
|
+
tabIndex: tabIndex,
|
|
182
|
+
autoFocus: autoFocus,
|
|
240
183
|
disabled: disabled,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
alignItems: "center",
|
|
246
|
-
children: jsx(Button, {
|
|
247
|
-
disabled: disabled,
|
|
248
|
-
"data-testid": dataTestId ? `${dataTestId}-visibility-button` : undefined,
|
|
249
|
-
"aria-label": isPasswordVisible ? 'hide' : 'show',
|
|
250
|
-
onClick: () => {
|
|
251
|
-
setIsPasswordVisible(!isPasswordVisible);
|
|
184
|
+
ref: ref,
|
|
185
|
+
value: value === null || value === undefined ? '' : value,
|
|
186
|
+
onChange: event => {
|
|
187
|
+
onChange?.(event.currentTarget.value);
|
|
252
188
|
},
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
189
|
+
isSuccess: !!success,
|
|
190
|
+
isError: !!error,
|
|
191
|
+
isClearable: !!computedClearable,
|
|
192
|
+
placeholder: placeholder,
|
|
193
|
+
"data-testid": dataTestId,
|
|
194
|
+
name: name,
|
|
195
|
+
onFocus: event => {
|
|
196
|
+
setHasFocus(true);
|
|
197
|
+
onFocus?.(event);
|
|
198
|
+
},
|
|
199
|
+
onBlur: event => {
|
|
200
|
+
setHasFocus(false);
|
|
201
|
+
onBlur?.(event);
|
|
202
|
+
},
|
|
203
|
+
readOnly: readOnly,
|
|
204
|
+
minLength: minLength,
|
|
205
|
+
maxLength: maxLength
|
|
206
|
+
}), success || error || loading || computedClearable ? jsxs(StateStack, {
|
|
207
|
+
direction: "row",
|
|
208
|
+
gap: 1,
|
|
209
|
+
alignItems: "center",
|
|
210
|
+
children: [computedClearable ? jsx(Button, {
|
|
211
|
+
"aria-label": "clear value",
|
|
212
|
+
disabled: disabled || !value,
|
|
213
|
+
variant: "ghost",
|
|
214
|
+
size: size === 'small' ? 'xsmall' : 'small',
|
|
215
|
+
icon: "close",
|
|
216
|
+
onClick: () => {
|
|
217
|
+
onChange?.('');
|
|
218
|
+
},
|
|
219
|
+
sentiment: "neutral"
|
|
220
|
+
}) : null, success ? jsx(Icon, {
|
|
221
|
+
name: "checkbox-circle-outline",
|
|
222
|
+
color: "success",
|
|
223
|
+
size: 16,
|
|
224
|
+
disabled: disabled
|
|
225
|
+
}) : null, error ? jsx(Icon, {
|
|
226
|
+
name: "alert",
|
|
227
|
+
color: "danger",
|
|
228
|
+
size: 16,
|
|
229
|
+
disabled: disabled
|
|
230
|
+
}) : null, loading && !disabled ? jsx(Loader, {
|
|
231
|
+
active: true,
|
|
232
|
+
size: 16
|
|
233
|
+
}) : null]
|
|
234
|
+
}) : null, suffix ? jsx(BasicSuffixStack, {
|
|
235
|
+
direction: "row",
|
|
236
|
+
alignItems: "center",
|
|
237
|
+
children: typeof suffix === 'string' ? jsx(Text, {
|
|
238
|
+
as: "span",
|
|
239
|
+
sentiment: "neutral",
|
|
240
|
+
variant: "bodySmall",
|
|
241
|
+
disabled: disabled,
|
|
242
|
+
children: suffix
|
|
243
|
+
}) : suffix
|
|
244
|
+
}) : null, type === 'password' ? jsx(CTASuffixStack, {
|
|
245
|
+
direction: "row",
|
|
246
|
+
alignItems: "center",
|
|
247
|
+
children: jsx(Button, {
|
|
248
|
+
disabled: disabled,
|
|
249
|
+
"data-testid": dataTestId ? `${dataTestId}-visibility-button` : undefined,
|
|
250
|
+
"aria-label": isPasswordVisible ? 'hide' : 'show',
|
|
251
|
+
onClick: () => {
|
|
252
|
+
setIsPasswordVisible(!isPasswordVisible);
|
|
253
|
+
},
|
|
254
|
+
variant: "ghost",
|
|
255
|
+
sentiment: "neutral",
|
|
256
|
+
icon: isPasswordVisible ? 'eye-off' : 'eye',
|
|
257
|
+
size: size === 'small' ? 'xsmall' : 'small'
|
|
258
|
+
})
|
|
259
|
+
}) : null, onRandomize ? jsx(CTASuffixStack, {
|
|
260
|
+
direction: "row",
|
|
261
|
+
alignItems: "center",
|
|
262
|
+
children: jsx(Button, {
|
|
263
|
+
disabled: disabled,
|
|
264
|
+
icon: "auto-fix",
|
|
265
|
+
size: size === 'small' ? 'xsmall' : 'small',
|
|
266
|
+
variant: "ghost",
|
|
267
|
+
sentiment: "neutral",
|
|
268
|
+
onClick: onRandomize
|
|
269
|
+
})
|
|
270
|
+
}) : null]
|
|
271
|
+
})
|
|
270
272
|
})
|
|
271
273
|
}), error || success || typeof helper === 'string' ? jsx(Text, {
|
|
272
274
|
as: "p",
|
|
@@ -279,4 +281,4 @@ const TextInput = /*#__PURE__*/forwardRef(({
|
|
|
279
281
|
});
|
|
280
282
|
});
|
|
281
283
|
|
|
282
|
-
export { TEXTINPUT_SIZE_HEIGHT,
|
|
284
|
+
export { TEXTINPUT_SIZE_HEIGHT, TextInputV2 };
|
|
@@ -17,7 +17,7 @@ const TOAST_ICONS = {
|
|
|
17
17
|
danger: 'alert'
|
|
18
18
|
};
|
|
19
19
|
const styles = {
|
|
20
|
-
toast: theme => /*#__PURE__*/css("border-radius:", theme.radii.default, ";box-shadow:", theme.shadows.dropdown, ";min-height:44px;margin-bottom:", theme.space['2'], ";", PREFIX, "__toast-body{margin:0;padding:0;}&", PREFIX, "__toast--success{background-color:", theme.colors.success.background, ";color:", theme.colors.success.text, ";", PREFIX, "__progress-bar{background-color:", theme.colors.success.backgroundStrong, ";}}&", PREFIX, "__toast--info{background-color:", theme.colors.info.background, ";color:", theme.colors.info.text, ";", PREFIX, "__progress-bar{background-color:", theme.colors.info.backgroundStrong, ";}}&", PREFIX, "__toast--error{background-color:", theme.colors.danger.background, ";color:", theme.colors.danger.text, ";", PREFIX, "__progress-bar{background-color:", theme.colors.danger.backgroundStrong, ";}}")
|
|
20
|
+
toast: theme => /*#__PURE__*/css("border-radius:", theme.radii.default, ";box-shadow:", theme.shadows.dropdown, ";min-height:44px;margin-bottom:", theme.space['2'], ";", PREFIX, "__toast-body{margin:0;padding:0;}&", PREFIX, "__toast--success{background-color:", theme.colors.success.background, ";color:", theme.colors.success.text, ";", PREFIX, "__progress-bar--success{background-color:", theme.colors.success.backgroundStrong, ";height:4px;}}&", PREFIX, "__toast--info{background-color:", theme.colors.info.background, ";color:", theme.colors.info.text, ";", PREFIX, "__progress-bar--info{background-color:", theme.colors.info.backgroundStrong, ";height:4px;}}&", PREFIX, "__toast--error{background-color:", theme.colors.danger.background, ";color:", theme.colors.danger.text, ";", PREFIX, "__progress-bar--danger{background-color:", theme.colors.danger.backgroundStrong, ";height:4px;}}")
|
|
21
21
|
};
|
|
22
22
|
const CloseButtonWrapper = /*#__PURE__*/_styled("button", {
|
|
23
23
|
target: "e1eb63991"
|
|
@@ -80,7 +80,7 @@ const toast = {
|
|
|
80
80
|
const ToastContainer = ({
|
|
81
81
|
newestOnTop,
|
|
82
82
|
limit,
|
|
83
|
-
position,
|
|
83
|
+
position = 'top-right',
|
|
84
84
|
'data-testid': dataTestId
|
|
85
85
|
}) => {
|
|
86
86
|
const theme = useTheme();
|
package/dist/src/index.js
CHANGED
|
@@ -60,7 +60,7 @@ export { TagList } from './components/TagList/index.js';
|
|
|
60
60
|
export { Text } from './components/Text/index.js';
|
|
61
61
|
export { TextArea } from './components/TextArea/index.js';
|
|
62
62
|
export { TextInput } from './components/TextInput/index.js';
|
|
63
|
-
export {
|
|
63
|
+
export { TextInputV2 } from './components/TextInputV2/index.js';
|
|
64
64
|
export { TimeInput } from './components/TimeInput/index.js';
|
|
65
65
|
export { ToastContainer, toast } from './components/Toaster/index.js';
|
|
66
66
|
export { Toggle } from './components/Toggle/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultraviolet/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.0",
|
|
4
4
|
"description": "Ultraviolet UI",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -43,7 +43,7 @@
|
|
|
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.52",
|
|
47
47
|
"@types/react-datepicker": "4.19.5",
|
|
48
48
|
"@types/react-dom": "18.2.18",
|
|
49
49
|
"react": "18.2.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"react-use-clipboard": "1.0.9",
|
|
68
68
|
"reakit": "1.3.11",
|
|
69
69
|
"@ultraviolet/themes": "1.8.0",
|
|
70
|
-
"@ultraviolet/icons": "2.8.
|
|
70
|
+
"@ultraviolet/icons": "2.8.4"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build": "rollup -c ../../rollup.config.mjs",
|