@ultraviolet/ui 1.31.7 → 1.32.1
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 -44
- 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/NumberInputV2/index.js +2 -2
- package/dist/src/components/Radio/index.js +3 -2
- package/dist/src/components/TextInput/index.js +1 -0
- package/dist/src/components/TextInputV2/index.js +120 -118
- 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 | boolean;
|
|
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;
|
|
@@ -2058,7 +2065,7 @@ declare const NumberInputV2: react.ForwardRefExoticComponent<{
|
|
|
2058
2065
|
*/
|
|
2059
2066
|
labelDescription?: ReactNode;
|
|
2060
2067
|
error?: string | undefined;
|
|
2061
|
-
success?: string | undefined;
|
|
2068
|
+
success?: string | boolean | undefined;
|
|
2062
2069
|
helper?: ReactNode;
|
|
2063
2070
|
value?: string | number | undefined;
|
|
2064
2071
|
} & Pick<InputHTMLAttributes<HTMLInputElement>, "autoFocus" | "id" | "aria-label" | "onFocus" | "onBlur" | "onChange" | "max" | "min" | "name" | "disabled" | "step" | "placeholder" | "readOnly" | "required"> & react.RefAttributes<HTMLInputElement>>;
|
|
@@ -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,32 @@ 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
|
+
label?: string | undefined;
|
|
3025
|
+
labelDescription?: ReactNode;
|
|
3026
|
+
loading?: boolean | undefined;
|
|
3027
|
+
minLength?: number | undefined;
|
|
3028
|
+
maxLength?: number | undefined;
|
|
3029
|
+
onRandomize?: (() => void) | undefined;
|
|
3030
|
+
onChange?: ((newValue: string) => void) | undefined;
|
|
3031
|
+
prefix?: ReactNode;
|
|
3032
|
+
size?: "large" | "small" | "medium" | undefined;
|
|
3033
|
+
success?: string | boolean | undefined;
|
|
3034
|
+
suffix?: ReactNode;
|
|
3035
|
+
tooltip?: string | undefined;
|
|
3036
|
+
type?: "text" | "email" | "password" | "url" | undefined;
|
|
3037
|
+
value?: string | undefined;
|
|
3038
|
+
} & Pick<InputHTMLAttributes<HTMLInputElement>, "autoFocus" | "id" | "tabIndex" | "aria-label" | "aria-labelledby" | "onFocus" | "onBlur" | "name" | "disabled" | "placeholder" | "readOnly" | "required"> & react.RefAttributes<HTMLInputElement>>;
|
|
3050
3039
|
|
|
3051
3040
|
declare const schedules: {
|
|
3052
3041
|
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 +3319,4 @@ declare const down: (size: ScreenSize, rules: string) => string;
|
|
|
3330
3319
|
|
|
3331
3320
|
declare const normalize: () => string;
|
|
3332
3321
|
|
|
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
|
|
3322
|
+
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
|
});
|
|
@@ -285,14 +285,14 @@ const NumberInputV2 = /*#__PURE__*/forwardRef(({
|
|
|
285
285
|
})]
|
|
286
286
|
})
|
|
287
287
|
})
|
|
288
|
-
}), error || success || helper ? jsx(Text, {
|
|
288
|
+
}), error || typeof success === 'string' || typeof helper === 'string' ? jsx(Text, {
|
|
289
289
|
variant: "caption",
|
|
290
290
|
as: "span",
|
|
291
291
|
prominence: !error && !success ? 'weak' : undefined,
|
|
292
292
|
sentiment: helperSentiment,
|
|
293
293
|
disabled: disabled || readOnly,
|
|
294
294
|
children: error || success || helper
|
|
295
|
-
}) : null]
|
|
295
|
+
}) : null, !error && !success && typeof helper !== 'string' && helper ? helper : null]
|
|
296
296
|
});
|
|
297
297
|
});
|
|
298
298
|
|
|
@@ -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
|
})
|
|
@@ -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,
|
|
@@ -107,12 +107,13 @@ const TextInput = /*#__PURE__*/forwardRef(({
|
|
|
107
107
|
type = 'text',
|
|
108
108
|
prefix,
|
|
109
109
|
suffix,
|
|
110
|
-
iconName,
|
|
111
110
|
size = 'large',
|
|
112
111
|
loading,
|
|
113
112
|
onRandomize,
|
|
114
113
|
minLength,
|
|
115
|
-
maxLength
|
|
114
|
+
maxLength,
|
|
115
|
+
'aria-labelledby': ariaLabelledBy,
|
|
116
|
+
'aria-label': ariaLabel
|
|
116
117
|
}, ref) => {
|
|
117
118
|
const localId = useId();
|
|
118
119
|
const [hasFocus, setHasFocus] = useState(false);
|
|
@@ -151,124 +152,125 @@ const TextInput = /*#__PURE__*/forwardRef(({
|
|
|
151
152
|
size: 8
|
|
152
153
|
}) : null]
|
|
153
154
|
}), labelDescription ?? null]
|
|
154
|
-
}), jsx(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
155
|
+
}), jsx("div", {
|
|
156
|
+
children: jsx(Tooltip, {
|
|
157
|
+
text: tooltip,
|
|
158
|
+
children: jsxs(StyledInputWrapper, {
|
|
159
|
+
hasFocus: hasFocus,
|
|
160
|
+
"data-disabled": disabled,
|
|
161
|
+
"data-readOnly": readOnly,
|
|
162
|
+
"data-success": !!success,
|
|
163
|
+
"data-error": !!error,
|
|
164
|
+
size: size,
|
|
165
|
+
children: [prefix ? jsx(BasicPrefixStack, {
|
|
166
|
+
direction: "row",
|
|
167
|
+
alignItems: "center",
|
|
168
|
+
children: typeof prefix === 'string' ? jsx(Text, {
|
|
169
|
+
as: "span",
|
|
170
|
+
sentiment: "neutral",
|
|
171
|
+
variant: "bodySmall",
|
|
172
|
+
disabled: disabled,
|
|
173
|
+
children: prefix
|
|
174
|
+
}) : prefix
|
|
175
|
+
}) : null, jsx(StyledInput, {
|
|
176
|
+
type: computedType,
|
|
177
|
+
"aria-invalid": !!error,
|
|
178
|
+
id: id ?? localId,
|
|
179
|
+
tabIndex: tabIndex,
|
|
180
|
+
autoFocus: autoFocus,
|
|
170
181
|
disabled: disabled,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
size: 16
|
|
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('');
|
|
182
|
+
ref: ref,
|
|
183
|
+
value: value === null || value === undefined ? '' : value,
|
|
184
|
+
onChange: event => {
|
|
185
|
+
onChange?.(event.currentTarget.value);
|
|
217
186
|
},
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
size: 16,
|
|
228
|
-
disabled: disabled
|
|
229
|
-
}) : null, loading && !disabled ? jsx(Loader, {
|
|
230
|
-
active: true,
|
|
231
|
-
size: 16
|
|
232
|
-
}) : null]
|
|
233
|
-
}) : null, suffix ? jsx(BasicSuffixStack, {
|
|
234
|
-
direction: "row",
|
|
235
|
-
alignItems: "center",
|
|
236
|
-
children: jsx(Text, {
|
|
237
|
-
as: "span",
|
|
238
|
-
sentiment: "neutral",
|
|
239
|
-
variant: "bodySmall",
|
|
240
|
-
disabled: disabled,
|
|
241
|
-
children: suffix
|
|
242
|
-
})
|
|
243
|
-
}) : null, type === 'password' ? jsx(CTASuffixStack, {
|
|
244
|
-
direction: "row",
|
|
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);
|
|
187
|
+
isSuccess: !!success,
|
|
188
|
+
isError: !!error,
|
|
189
|
+
isClearable: !!computedClearable,
|
|
190
|
+
placeholder: placeholder,
|
|
191
|
+
"data-testid": dataTestId,
|
|
192
|
+
name: name,
|
|
193
|
+
onFocus: event => {
|
|
194
|
+
setHasFocus(true);
|
|
195
|
+
onFocus?.(event);
|
|
252
196
|
},
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
197
|
+
onBlur: event => {
|
|
198
|
+
setHasFocus(false);
|
|
199
|
+
onBlur?.(event);
|
|
200
|
+
},
|
|
201
|
+
readOnly: readOnly,
|
|
202
|
+
minLength: minLength,
|
|
203
|
+
maxLength: maxLength,
|
|
204
|
+
"aria-labelledby": ariaLabelledBy,
|
|
205
|
+
"aria-label": ariaLabel
|
|
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
|
-
}), error || success || typeof helper === 'string' ? jsx(Text, {
|
|
273
|
+
}), error || typeof success === 'string' || typeof helper === 'string' ? jsx(Text, {
|
|
272
274
|
as: "p",
|
|
273
275
|
variant: "caption",
|
|
274
276
|
sentiment: sentiment,
|
|
@@ -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 };
|
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.1",
|
|
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",
|