@ultraviolet/ui 1.28.0 → 1.29.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/README.md +14 -7
- package/dist/index.d.ts +51 -2
- package/dist/src/components/ActionBar/index.js +22 -37
- package/dist/src/components/Alert/index.js +27 -41
- package/dist/src/components/Avatar/index.js +48 -69
- package/dist/src/components/Badge/index.js +29 -49
- package/dist/src/components/Banner/index.js +42 -62
- package/dist/src/components/BarChart/Tooltip.js +35 -50
- package/dist/src/components/BarChart/index.js +13 -14
- package/dist/src/components/BarStack/index.js +100 -191
- package/dist/src/components/Breadcrumbs/index.js +29 -39
- package/dist/src/components/Bullet/index.js +42 -55
- package/dist/src/components/Button/index.js +73 -99
- package/dist/src/components/Card/index.js +39 -57
- package/dist/src/components/Carousel/index.js +32 -60
- package/dist/src/components/Checkbox/index.js +153 -341
- package/dist/src/components/CheckboxGroup/index.js +25 -27
- package/dist/src/components/CopyButton/index.js +11 -12
- package/dist/src/components/DateInput/index.js +141 -268
- package/dist/src/components/EmptyState/index.js +68 -83
- package/dist/src/components/Expandable/index.js +13 -20
- package/dist/src/components/GlobalAlert/GlobalAlertLink.js +12 -13
- package/dist/src/components/GlobalAlert/index.js +19 -32
- package/dist/src/components/LineChart/CustomLegend.js +80 -89
- package/dist/src/components/LineChart/Tooltip.js +32 -47
- package/dist/src/components/LineChart/helpers.js +15 -50
- package/dist/src/components/LineChart/index.js +23 -33
- package/dist/src/components/Link/index.js +46 -65
- package/dist/src/components/List/Body.js +9 -15
- package/dist/src/components/List/Cell.js +6 -7
- package/dist/src/components/List/HeaderCell.js +28 -56
- package/dist/src/components/List/HeaderRow.js +9 -16
- package/dist/src/components/List/ListContext.js +5 -6
- package/dist/src/components/List/Row.js +44 -90
- package/dist/src/components/List/SelectBar.js +9 -13
- package/dist/src/components/List/SkeletonRows.js +5 -6
- package/dist/src/components/List/index.js +15 -25
- package/dist/src/components/Loader/index.js +18 -25
- package/dist/src/components/Menu/Item.js +39 -49
- package/dist/src/components/Menu/index.js +31 -56
- package/dist/src/components/MenuV2/Item.js +39 -49
- package/dist/src/components/MenuV2/index.js +28 -47
- package/dist/src/components/Meter/index.js +25 -47
- package/dist/src/components/Modal/Dialog.js +33 -58
- package/dist/src/components/Modal/Disclosure.js +8 -9
- package/dist/src/components/Modal/index.js +26 -33
- package/dist/src/components/Notice/index.js +21 -27
- package/dist/src/components/NumberInput/index.js +73 -137
- package/dist/src/components/Pagination/getPageNumbers.js +1 -4
- package/dist/src/components/Pagination/index.js +17 -27
- package/dist/src/components/PasswordCheck/index.js +26 -32
- package/dist/src/components/PasswordStrengthMeter/index.js +25 -44
- package/dist/src/components/PieChart/Legends.js +71 -107
- package/dist/src/components/PieChart/Tooltip.js +33 -36
- package/dist/src/components/PieChart/index.js +13 -17
- package/dist/src/components/Popover/index.js +58 -75
- package/dist/src/components/Popup/helpers.js +13 -15
- package/dist/src/components/Popup/index.js +55 -98
- package/dist/src/components/ProgressBar/index.js +31 -49
- package/dist/src/components/Radio/index.js +58 -113
- package/dist/src/components/RadioGroup/index.js +26 -28
- package/dist/src/components/Row/index.js +25 -31
- package/dist/src/components/SelectInput/index.js +357 -410
- package/dist/src/components/SelectableCard/index.js +73 -115
- package/dist/src/components/Separator/index.js +52 -73
- package/dist/src/components/Skeleton/Block.js +23 -41
- package/dist/src/components/Skeleton/Blocks.js +23 -41
- package/dist/src/components/Skeleton/BoxWithIcon.js +21 -36
- package/dist/src/components/Skeleton/Donut.js +3 -6
- package/dist/src/components/Skeleton/IconSkeleton.js +13 -31
- package/dist/src/components/Skeleton/Line.js +5 -11
- package/dist/src/components/Skeleton/List.js +22 -31
- package/dist/src/components/Skeleton/Slider.js +25 -46
- package/dist/src/components/Skeleton/Square.js +3 -6
- package/dist/src/components/Skeleton/index.js +17 -33
- package/dist/src/components/Snippet/index.js +82 -137
- package/dist/src/components/Stack/index.js +11 -14
- package/dist/src/components/Status/index.js +48 -78
- package/dist/src/components/StepList/index.js +45 -63
- package/dist/src/components/Stepper/index.js +74 -129
- package/dist/src/components/SwitchButton/FocusOverlay.js +13 -23
- package/dist/src/components/SwitchButton/index.js +36 -62
- package/dist/src/components/Table/Body.js +5 -8
- package/dist/src/components/Table/Cell.js +14 -20
- package/dist/src/components/Table/Header.js +8 -14
- package/dist/src/components/Table/HeaderCell.js +40 -56
- package/dist/src/components/Table/HeaderRow.js +4 -5
- package/dist/src/components/Table/Row.js +10 -14
- package/dist/src/components/Table/SelectBar.js +9 -13
- package/dist/src/components/Table/SkeletonRows.js +5 -6
- package/dist/src/components/Table/TableContext.js +6 -7
- package/dist/src/components/Table/index.js +44 -50
- package/dist/src/components/Tabs/Tab.js +57 -118
- package/dist/src/components/Tabs/TabMenu.js +32 -38
- package/dist/src/components/Tabs/TabMenuItem.js +9 -13
- package/dist/src/components/Tabs/index.js +24 -43
- package/dist/src/components/Tag/index.js +57 -74
- package/dist/src/components/TagInput/index.js +63 -94
- package/dist/src/components/TagList/index.js +22 -35
- package/dist/src/components/Text/index.js +29 -31
- package/dist/src/components/TextArea/index.js +240 -0
- package/dist/src/components/TextInput/index.js +166 -260
- package/dist/src/components/TimeInput/index.js +10 -13
- package/dist/src/components/Toaster/index.js +51 -67
- package/dist/src/components/Toggle/index.js +62 -129
- package/dist/src/components/ToggleGroup/index.js +21 -23
- package/dist/src/components/Tooltip/index.js +28 -31
- package/dist/src/components/VerificationCode/index.js +55 -90
- package/dist/src/index.js +1 -0
- package/dist/src/utils/ids.js +1 -6
- package/package.json +3 -3
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import _styled from '@emotion/styled/base';
|
|
2
|
+
import { Icon } from '@ultraviolet/icons';
|
|
3
|
+
import { forwardRef, useId } from 'react';
|
|
4
|
+
import { Button, SIZE_HEIGHT } from '../Button/index.js';
|
|
5
|
+
import { Row } from '../Row/index.js';
|
|
6
|
+
import { Stack } from '../Stack/index.js';
|
|
7
|
+
import { Text } from '../Text/index.js';
|
|
8
|
+
import { Tooltip } from '../Tooltip/index.js';
|
|
9
|
+
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
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)."; }
|
|
12
|
+
const STATE_ICON_SIZE = 16;
|
|
13
|
+
const StyledTextAreaWrapper = /*#__PURE__*/_styled("div", {
|
|
14
|
+
target: "enu776d2"
|
|
15
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
16
|
+
name: "8k1832",
|
|
17
|
+
styles: "position:relative;display:flex"
|
|
18
|
+
} : {
|
|
19
|
+
name: "8k1832",
|
|
20
|
+
styles: "position:relative;display:flex",
|
|
21
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
22
|
+
});
|
|
23
|
+
const StyledTextAreaAbsoluteStack = /*#__PURE__*/_styled(Stack, {
|
|
24
|
+
target: "enu776d1"
|
|
25
|
+
})("position:absolute;top:", ({
|
|
26
|
+
theme
|
|
27
|
+
}) => theme.space['1.5'], ";right:", ({
|
|
28
|
+
theme
|
|
29
|
+
}) => theme.space['1'], ";");
|
|
30
|
+
const StyledTextArea = /*#__PURE__*/_styled('textarea', {
|
|
31
|
+
shouldForwardProp: prop => !['isSuccess', 'isError', 'isClearable'].includes(prop),
|
|
32
|
+
target: "enu776d0"
|
|
33
|
+
})("width:100%;resize:vertical;background:", ({
|
|
34
|
+
theme
|
|
35
|
+
}) => theme.colors.neutral.background, ";border:1px solid ", ({
|
|
36
|
+
theme
|
|
37
|
+
}) => theme.colors.neutral.border, ";color:", ({
|
|
38
|
+
theme
|
|
39
|
+
}) => theme.colors.neutral.text, ";&::placeholder{color:", ({
|
|
40
|
+
theme
|
|
41
|
+
}) => theme.colors.neutral.textWeak, ";}border-radius:", ({
|
|
42
|
+
theme
|
|
43
|
+
}) => theme.radii.default, ";padding:", ({
|
|
44
|
+
theme
|
|
45
|
+
}) => `${theme.space['1.5']} ${theme.space['1']} ${theme.space['1.5']} ${theme.space['2']}`, ";padding-right:", ({
|
|
46
|
+
theme,
|
|
47
|
+
isClearable,
|
|
48
|
+
isError,
|
|
49
|
+
isSuccess
|
|
50
|
+
}) => /* including 1 optional if both element is visible + 1 because content is absolute 1space unit from right */
|
|
51
|
+
`calc(${theme.space[isClearable && (isSuccess || isError) ? '4' : '3']} + ${isClearable ? `${SIZE_HEIGHT.xsmall}px` : '0px'} + ${isSuccess || isError ? `${STATE_ICON_SIZE}px` : '0px'})`, ";", ({
|
|
52
|
+
theme,
|
|
53
|
+
disabled
|
|
54
|
+
}) => !disabled ? `
|
|
55
|
+
&:hover {
|
|
56
|
+
border-color: ${theme.colors.primary.border};
|
|
57
|
+
}
|
|
58
|
+
&:focus {
|
|
59
|
+
outline: none;
|
|
60
|
+
border-color: ${theme.colors.primary.border};
|
|
61
|
+
box-shadow: ${theme.shadows.focusPrimary};
|
|
62
|
+
}
|
|
63
|
+
` : '', " ", ({
|
|
64
|
+
theme,
|
|
65
|
+
isSuccess,
|
|
66
|
+
isError,
|
|
67
|
+
readOnly,
|
|
68
|
+
disabled
|
|
69
|
+
}) => {
|
|
70
|
+
if (disabled) {
|
|
71
|
+
return `
|
|
72
|
+
background : ${theme.colors.neutral.backgroundDisabled};
|
|
73
|
+
border-color : ${theme.colors.neutral.borderDisabled};
|
|
74
|
+
color : ${theme.colors.neutral.textDisabled};
|
|
75
|
+
&::placeholder {
|
|
76
|
+
color: ${theme.colors.neutral.textWeakDisabled};
|
|
77
|
+
}
|
|
78
|
+
cursor: not-allowed;
|
|
79
|
+
`;
|
|
80
|
+
}
|
|
81
|
+
if (readOnly) {
|
|
82
|
+
return `
|
|
83
|
+
background : ${theme.colors.neutral.backgroundWeak};
|
|
84
|
+
border-color : ${theme.colors.neutral.borderWeak};
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
if (isSuccess) {
|
|
88
|
+
return `
|
|
89
|
+
border-color : ${theme.colors.success.border};
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
if (isError) {
|
|
93
|
+
return `
|
|
94
|
+
border-color : ${theme.colors.danger.border};
|
|
95
|
+
`;
|
|
96
|
+
}
|
|
97
|
+
return '';
|
|
98
|
+
}, ";");
|
|
99
|
+
/**
|
|
100
|
+
* This component offers an extended textarea HTML
|
|
101
|
+
*/
|
|
102
|
+
const TextArea = /*#__PURE__*/forwardRef(({
|
|
103
|
+
id,
|
|
104
|
+
className,
|
|
105
|
+
tabIndex,
|
|
106
|
+
value,
|
|
107
|
+
onChange,
|
|
108
|
+
placeholder,
|
|
109
|
+
rows = 3,
|
|
110
|
+
disabled = false,
|
|
111
|
+
readOnly = false,
|
|
112
|
+
success,
|
|
113
|
+
error,
|
|
114
|
+
helper,
|
|
115
|
+
minLength,
|
|
116
|
+
maxLength,
|
|
117
|
+
tooltip,
|
|
118
|
+
label,
|
|
119
|
+
autoFocus,
|
|
120
|
+
required = false,
|
|
121
|
+
'data-testid': dataTestId,
|
|
122
|
+
name,
|
|
123
|
+
onFocus,
|
|
124
|
+
onBlur,
|
|
125
|
+
clearable = false,
|
|
126
|
+
labelDescription
|
|
127
|
+
}, ref) => {
|
|
128
|
+
const localId = useId();
|
|
129
|
+
|
|
130
|
+
// Avoid conflicts between properties
|
|
131
|
+
const computedReadOnly = !disabled && readOnly;
|
|
132
|
+
const computedSuccess = !disabled && !readOnly ? success : undefined;
|
|
133
|
+
const computedError = !disabled && !readOnly && !success ? error : undefined;
|
|
134
|
+
const computedHelper = !success && !error ? helper : undefined;
|
|
135
|
+
return jsxs(Stack, {
|
|
136
|
+
gap: "0.5",
|
|
137
|
+
className: className,
|
|
138
|
+
children: [jsxs(Stack, {
|
|
139
|
+
direction: "row",
|
|
140
|
+
gap: "1",
|
|
141
|
+
alignItems: "center",
|
|
142
|
+
children: [jsxs(Stack, {
|
|
143
|
+
direction: "row",
|
|
144
|
+
gap: "0.5",
|
|
145
|
+
alignItems: "start",
|
|
146
|
+
children: [jsx(Text, {
|
|
147
|
+
as: "label",
|
|
148
|
+
variant: "bodySmallStrong",
|
|
149
|
+
sentiment: "neutral",
|
|
150
|
+
htmlFor: id ?? localId,
|
|
151
|
+
children: label
|
|
152
|
+
}), required ? jsx(Icon, {
|
|
153
|
+
name: "asterisk",
|
|
154
|
+
color: "danger",
|
|
155
|
+
size: 8
|
|
156
|
+
}) : null]
|
|
157
|
+
}), labelDescription ?? null]
|
|
158
|
+
}), jsx(Tooltip, {
|
|
159
|
+
text: tooltip,
|
|
160
|
+
children: jsxs(StyledTextAreaWrapper, {
|
|
161
|
+
children: [jsx(StyledTextArea, {
|
|
162
|
+
"aria-invalid": !!computedError,
|
|
163
|
+
id: id ?? localId,
|
|
164
|
+
tabIndex: tabIndex,
|
|
165
|
+
autoFocus: autoFocus,
|
|
166
|
+
disabled: disabled,
|
|
167
|
+
rows: rows,
|
|
168
|
+
ref: ref,
|
|
169
|
+
value: value,
|
|
170
|
+
onChange: event => {
|
|
171
|
+
onChange(event.currentTarget.value);
|
|
172
|
+
},
|
|
173
|
+
isSuccess: !!computedSuccess,
|
|
174
|
+
isError: !!computedError,
|
|
175
|
+
isClearable: !!clearable,
|
|
176
|
+
minLength: minLength,
|
|
177
|
+
maxLength: maxLength,
|
|
178
|
+
placeholder: placeholder,
|
|
179
|
+
"data-testid": dataTestId,
|
|
180
|
+
name: name,
|
|
181
|
+
onFocus: onFocus,
|
|
182
|
+
onBlur: onBlur,
|
|
183
|
+
readOnly: computedReadOnly
|
|
184
|
+
}), jsxs(StyledTextAreaAbsoluteStack, {
|
|
185
|
+
direction: "row",
|
|
186
|
+
alignItems: "center",
|
|
187
|
+
gap: "1",
|
|
188
|
+
children: [clearable ? jsx(Button, {
|
|
189
|
+
"aria-label": "clear value",
|
|
190
|
+
variant: "ghost",
|
|
191
|
+
size: "xsmall",
|
|
192
|
+
icon: "close",
|
|
193
|
+
onClick: () => {
|
|
194
|
+
onChange('');
|
|
195
|
+
},
|
|
196
|
+
sentiment: "neutral"
|
|
197
|
+
}) : null, success ? jsx(Icon, {
|
|
198
|
+
name: "checkbox-circle-outline",
|
|
199
|
+
color: "success",
|
|
200
|
+
size: STATE_ICON_SIZE
|
|
201
|
+
}) : null, error ? jsx(Icon, {
|
|
202
|
+
name: "alert",
|
|
203
|
+
color: "danger"
|
|
204
|
+
}) : null]
|
|
205
|
+
})]
|
|
206
|
+
})
|
|
207
|
+
}), computedSuccess || computedError || computedHelper || maxLength ? jsxs(Row, {
|
|
208
|
+
templateColumns: "minmax(0, 1fr) min-content",
|
|
209
|
+
gap: "1",
|
|
210
|
+
children: [jsxs("div", {
|
|
211
|
+
children: [computedSuccess ? jsx(Text, {
|
|
212
|
+
as: "p",
|
|
213
|
+
variant: "caption",
|
|
214
|
+
sentiment: "success",
|
|
215
|
+
children: computedSuccess
|
|
216
|
+
}) : null, computedError ? jsx(Text, {
|
|
217
|
+
as: "p",
|
|
218
|
+
variant: "caption",
|
|
219
|
+
sentiment: "danger",
|
|
220
|
+
children: computedError
|
|
221
|
+
}) : null, computedHelper && typeof computedHelper === 'string' ? jsx(Text, {
|
|
222
|
+
as: "p",
|
|
223
|
+
variant: "caption",
|
|
224
|
+
sentiment: "neutral",
|
|
225
|
+
prominence: "weak",
|
|
226
|
+
disabled: disabled,
|
|
227
|
+
children: computedHelper
|
|
228
|
+
}) : null, computedHelper && typeof computedHelper !== 'string' ? computedHelper : null]
|
|
229
|
+
}), maxLength ? jsxs(Text, {
|
|
230
|
+
as: "div",
|
|
231
|
+
sentiment: "neutral",
|
|
232
|
+
prominence: "weak",
|
|
233
|
+
variant: "caption",
|
|
234
|
+
children: [value?.length ?? 0, "/", maxLength]
|
|
235
|
+
}) : null]
|
|
236
|
+
}) : null]
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
export { TextArea };
|