@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
|
@@ -8,60 +8,41 @@ import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
|
8
8
|
|
|
9
9
|
const MenuContainer = /*#__PURE__*/_styled("div", {
|
|
10
10
|
target: "ewug27g2"
|
|
11
|
-
})("display:flex;flex-direction:column;", StyledTabButton, "{font-size:",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
theme
|
|
19
|
-
} = _ref2;
|
|
20
|
-
return theme.typography.bodySmall.lineHeight;
|
|
21
|
-
}, ";font-weight:inherit;padding:", _ref3 => {
|
|
22
|
-
let {
|
|
23
|
-
theme
|
|
24
|
-
} = _ref3;
|
|
25
|
-
return `${theme.space['1']} ${theme.space['2']}`;
|
|
26
|
-
}, ";border-bottom-width:1.5px;width:100%;cursor:pointer;min-width:110px;background-color:transparent;&[aria-disabled='true'],&:disabled{cursor:not-allowed;filter:grayscale(1) opacity(50%);}}");
|
|
11
|
+
})("display:flex;flex-direction:column;", StyledTabButton, "{font-size:", ({
|
|
12
|
+
theme
|
|
13
|
+
}) => theme.typography.bodySmall.fontSize, ";line-height:", ({
|
|
14
|
+
theme
|
|
15
|
+
}) => theme.typography.bodySmall.lineHeight, ";font-weight:inherit;padding:", ({
|
|
16
|
+
theme
|
|
17
|
+
}) => `${theme.space['1']} ${theme.space['2']}`, ";border-bottom-width:1.5px;width:100%;cursor:pointer;min-width:110px;background-color:transparent;&[aria-disabled='true'],&:disabled{cursor:not-allowed;filter:grayscale(1) opacity(50%);}}");
|
|
27
18
|
|
|
28
19
|
// Migration to MenuV2 will not work as expected here.
|
|
29
20
|
const StyledTabMenu = /*#__PURE__*/_styled(TabMenu, {
|
|
30
21
|
target: "ewug27g1"
|
|
31
|
-
})("position:sticky;right:0;top:0;bottom:0;background:",
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, ";box-shadow:", _ref5 => {
|
|
37
|
-
let {
|
|
38
|
-
theme
|
|
39
|
-
} = _ref5;
|
|
40
|
-
return theme.shadows.menu;
|
|
41
|
-
}, ";");
|
|
22
|
+
})("position:sticky;right:0;top:0;bottom:0;background:", ({
|
|
23
|
+
theme
|
|
24
|
+
}) => theme.colors.neutral.background, ";box-shadow:", ({
|
|
25
|
+
theme
|
|
26
|
+
}) => theme.shadows.menu, ";");
|
|
42
27
|
const TabsContainer = /*#__PURE__*/_styled("div", {
|
|
43
28
|
target: "ewug27g0"
|
|
44
|
-
})("display:flex;flex-wrap:nowrap;overflow-x:scroll;position:relative;z-index:0;-ms-overflow-style:none;scrollbar-width:none;&::after{z-index:-1;content:'';position:absolute;bottom:0;left:0;right:0;height:2px;background:",
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} = _ref6;
|
|
48
|
-
return theme.colors.neutral.border;
|
|
49
|
-
}, ";}&::-webkit-scrollbar{display:none;}");
|
|
29
|
+
})("display:flex;flex-wrap:nowrap;overflow-x:scroll;position:relative;z-index:0;-ms-overflow-style:none;scrollbar-width:none;&::after{z-index:-1;content:'';position:absolute;bottom:0;left:0;right:0;height:2px;background:", ({
|
|
30
|
+
theme
|
|
31
|
+
}) => theme.colors.neutral.border, ";}&::-webkit-scrollbar{display:none;}");
|
|
50
32
|
const SHADOW_THRESHOLD = 10;
|
|
51
33
|
|
|
52
34
|
/**
|
|
53
35
|
* Tabs component is used to display a set of tabs with a single tab selected at a time.
|
|
54
36
|
*/
|
|
55
|
-
const Tabs =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} = _ref7;
|
|
37
|
+
const Tabs = ({
|
|
38
|
+
children = null,
|
|
39
|
+
onChange,
|
|
40
|
+
moreDisclosure = 'More',
|
|
41
|
+
selected,
|
|
42
|
+
className,
|
|
43
|
+
'data-testid': dataTestId,
|
|
44
|
+
...props
|
|
45
|
+
}) => {
|
|
65
46
|
const tabsRef = useRef({});
|
|
66
47
|
const moreStaticRef = useRef(null);
|
|
67
48
|
const [displayMore, setDisplayMore] = useState(false);
|
|
@@ -12,27 +12,16 @@ const COPY_DURATION = 2500;
|
|
|
12
12
|
const StyledContainer = /*#__PURE__*/_styled('span', {
|
|
13
13
|
shouldForwardProp: prop => !['sentiment', 'copiable'].includes(prop),
|
|
14
14
|
target: "el6733p2"
|
|
15
|
-
})("display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;border-radius:",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}, ";gap:", _ref3 => {
|
|
26
|
-
let {
|
|
27
|
-
theme
|
|
28
|
-
} = _ref3;
|
|
29
|
-
return theme.space['1'];
|
|
30
|
-
}, ";width:fit-content;height:24px;", _ref4 => {
|
|
31
|
-
let {
|
|
32
|
-
copiable,
|
|
33
|
-
theme
|
|
34
|
-
} = _ref4;
|
|
35
|
-
return copiable && `
|
|
15
|
+
})("display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;border-radius:", ({
|
|
16
|
+
theme
|
|
17
|
+
}) => theme.radii.default, ";padding:0 ", ({
|
|
18
|
+
theme
|
|
19
|
+
}) => theme.space['1'], ";gap:", ({
|
|
20
|
+
theme
|
|
21
|
+
}) => theme.space['1'], ";width:fit-content;height:24px;", ({
|
|
22
|
+
copiable,
|
|
23
|
+
theme
|
|
24
|
+
}) => copiable && `
|
|
36
25
|
&:hover, &:active {
|
|
37
26
|
cursor: pointer;
|
|
38
27
|
background: ${theme.colors.neutral.backgroundWeakHover};
|
|
@@ -42,12 +31,10 @@ const StyledContainer = /*#__PURE__*/_styled('span', {
|
|
|
42
31
|
&:active {
|
|
43
32
|
box-shadow: ${theme.shadows.focusNeutral};
|
|
44
33
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
theme
|
|
50
|
-
} = _ref5;
|
|
34
|
+
`, " ", ({
|
|
35
|
+
sentiment,
|
|
36
|
+
theme
|
|
37
|
+
}) => {
|
|
51
38
|
if (sentiment === 'disabled') {
|
|
52
39
|
return `
|
|
53
40
|
color: ${theme.colors.neutral.textDisabled};
|
|
@@ -90,58 +77,54 @@ const StyledCloseButton = /*#__PURE__*/_styled(Button, {
|
|
|
90
77
|
styles: "width:fit-content;height:fit-content;padding:2px",
|
|
91
78
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
92
79
|
});
|
|
93
|
-
const TagInner =
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}) : null]
|
|
124
|
-
});
|
|
125
|
-
};
|
|
80
|
+
const TagInner = ({
|
|
81
|
+
children,
|
|
82
|
+
isLoading = false,
|
|
83
|
+
onClose,
|
|
84
|
+
icon,
|
|
85
|
+
disabled = false
|
|
86
|
+
}) => jsxs(Fragment, {
|
|
87
|
+
children: [icon ? jsx(Icon, {
|
|
88
|
+
name: icon,
|
|
89
|
+
size: 16
|
|
90
|
+
}) : null, jsx(StyledText, {
|
|
91
|
+
as: "span",
|
|
92
|
+
variant: "caption",
|
|
93
|
+
oneLine: true,
|
|
94
|
+
"aria-disabled": disabled,
|
|
95
|
+
children: children
|
|
96
|
+
}), onClose && !isLoading ? jsx(StyledCloseButton, {
|
|
97
|
+
onClick: onClose,
|
|
98
|
+
disabled: disabled,
|
|
99
|
+
"aria-label": "Close tag",
|
|
100
|
+
"data-testid": "close-tag",
|
|
101
|
+
variant: "ghost",
|
|
102
|
+
sentiment: "neutral",
|
|
103
|
+
icon: "close",
|
|
104
|
+
size: "small"
|
|
105
|
+
}) : null, isLoading ? jsx(Loader, {
|
|
106
|
+
active: true,
|
|
107
|
+
size: 16
|
|
108
|
+
}) : null]
|
|
109
|
+
});
|
|
126
110
|
|
|
127
111
|
/**
|
|
128
112
|
* Tag component is used to display a short text description of an item. It can be used to display a category
|
|
129
113
|
* or any other metadata.
|
|
130
114
|
*/
|
|
131
|
-
const Tag =
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
} = _ref7;
|
|
115
|
+
const Tag = ({
|
|
116
|
+
children,
|
|
117
|
+
isLoading,
|
|
118
|
+
onClose,
|
|
119
|
+
icon,
|
|
120
|
+
copiable = false,
|
|
121
|
+
copyText = 'Copy',
|
|
122
|
+
copiedText = 'Copied!',
|
|
123
|
+
disabled,
|
|
124
|
+
sentiment = 'neutral',
|
|
125
|
+
className,
|
|
126
|
+
'data-testid': dataTestId
|
|
127
|
+
}) => {
|
|
145
128
|
const [isCopied, setCopied] = useClipboard(typeof children === 'string' ? children : '', {
|
|
146
129
|
successDuration: COPY_DURATION
|
|
147
130
|
});
|
|
@@ -9,15 +9,13 @@ const STATUS = {
|
|
|
9
9
|
LOADING: 'loading'
|
|
10
10
|
};
|
|
11
11
|
const variants = {
|
|
12
|
-
base:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
20
|
-
return `
|
|
12
|
+
base: ({
|
|
13
|
+
theme: {
|
|
14
|
+
colors,
|
|
15
|
+
shadows,
|
|
16
|
+
radii
|
|
17
|
+
}
|
|
18
|
+
}) => `
|
|
21
19
|
padding: 8px;
|
|
22
20
|
cursor: text;
|
|
23
21
|
border-radius: ${radii.default};
|
|
@@ -34,15 +32,12 @@ const variants = {
|
|
|
34
32
|
& > * {
|
|
35
33
|
margin: 6px;
|
|
36
34
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
} = _ref2;
|
|
45
|
-
return `
|
|
35
|
+
`,
|
|
36
|
+
bordered: ({
|
|
37
|
+
theme: {
|
|
38
|
+
shadows
|
|
39
|
+
}
|
|
40
|
+
}) => `
|
|
46
41
|
margin-top: 0;
|
|
47
42
|
padding: 8px 0;
|
|
48
43
|
|
|
@@ -56,15 +51,12 @@ const variants = {
|
|
|
56
51
|
margin-right: 6px;
|
|
57
52
|
}
|
|
58
53
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
} = _ref3;
|
|
67
|
-
return `
|
|
54
|
+
`,
|
|
55
|
+
'no-border': ({
|
|
56
|
+
theme: {
|
|
57
|
+
shadows
|
|
58
|
+
}
|
|
59
|
+
}) => `
|
|
68
60
|
&:focus-within {
|
|
69
61
|
box-shadow: ${shadows.focusPrimary};
|
|
70
62
|
}
|
|
@@ -73,59 +65,40 @@ const variants = {
|
|
|
73
65
|
margin-right: 6px;
|
|
74
66
|
margin-bottom: 6px;
|
|
75
67
|
}
|
|
76
|
-
|
|
77
|
-
}
|
|
68
|
+
`
|
|
78
69
|
};
|
|
79
70
|
const TagInputContainer = /*#__PURE__*/_styled('div', {
|
|
80
71
|
shouldForwardProp: prop => !['variant'].includes(prop),
|
|
81
72
|
target: "ea7vc6o1"
|
|
82
|
-
})("display:flex;flex-wrap:wrap;background-color:",
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return variants[variant] ? variants[variant]({
|
|
95
|
-
theme
|
|
96
|
-
}) : variants.base({
|
|
97
|
-
theme
|
|
98
|
-
});
|
|
99
|
-
}, ";");
|
|
73
|
+
})("display:flex;flex-wrap:wrap;background-color:", ({
|
|
74
|
+
theme: {
|
|
75
|
+
colors
|
|
76
|
+
}
|
|
77
|
+
}) => colors.neutral.background, ";", ({
|
|
78
|
+
variant,
|
|
79
|
+
theme
|
|
80
|
+
}) => variants[variant] ? variants[variant]({
|
|
81
|
+
theme
|
|
82
|
+
}) : variants.base({
|
|
83
|
+
theme
|
|
84
|
+
}), ";");
|
|
100
85
|
const StyledInput = /*#__PURE__*/_styled("input", {
|
|
101
86
|
target: "ea7vc6o0"
|
|
102
|
-
})("display:flex;flex:1;font-size:",
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
colors
|
|
118
|
-
}
|
|
119
|
-
} = _ref8;
|
|
120
|
-
return colors.neutral.background;
|
|
121
|
-
}, ";&::placeholder{color:", _ref9 => {
|
|
122
|
-
let {
|
|
123
|
-
theme: {
|
|
124
|
-
colors
|
|
125
|
-
}
|
|
126
|
-
} = _ref9;
|
|
127
|
-
return colors.neutral.textWeak;
|
|
128
|
-
}, ";}");
|
|
87
|
+
})("display:flex;flex:1;font-size:", ({
|
|
88
|
+
theme
|
|
89
|
+
}) => theme.typography.body.fontSize, ";color:", ({
|
|
90
|
+
theme: {
|
|
91
|
+
colors
|
|
92
|
+
}
|
|
93
|
+
}) => colors.neutral.text, ";border:none;outline:none;background-color:", ({
|
|
94
|
+
theme: {
|
|
95
|
+
colors
|
|
96
|
+
}
|
|
97
|
+
}) => colors.neutral.background, ";&::placeholder{color:", ({
|
|
98
|
+
theme: {
|
|
99
|
+
colors
|
|
100
|
+
}
|
|
101
|
+
}) => colors.neutral.textWeak, ";}");
|
|
129
102
|
const convertTagArrayToTagStateArray = tags => (tags || [])?.map((tag, index) => typeof tag === 'object' ? {
|
|
130
103
|
...tag,
|
|
131
104
|
index: getUUID(`tag-${index}`)
|
|
@@ -137,20 +110,19 @@ const convertTagArrayToTagStateArray = tags => (tags || [])?.map((tag, index) =>
|
|
|
137
110
|
* TagInput is a component that allows users to input tags.
|
|
138
111
|
* @experimental This component is experimental and may be subject to breaking changes in the future.
|
|
139
112
|
*/
|
|
140
|
-
const TagInput =
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
} = _ref10;
|
|
113
|
+
const TagInput = ({
|
|
114
|
+
disabled = false,
|
|
115
|
+
id,
|
|
116
|
+
manualInput = true,
|
|
117
|
+
name,
|
|
118
|
+
onChange,
|
|
119
|
+
onChangeError,
|
|
120
|
+
placeholder,
|
|
121
|
+
tags,
|
|
122
|
+
variant = 'base',
|
|
123
|
+
className,
|
|
124
|
+
'data-testid': dataTestId
|
|
125
|
+
}) => {
|
|
154
126
|
const [tagInputState, setTagInput] = useState(convertTagArrayToTagStateArray(tags ?? []));
|
|
155
127
|
const [input, setInput] = useState('');
|
|
156
128
|
const [status, setStatus] = useState({});
|
|
@@ -194,12 +166,9 @@ const TagInput = _ref10 => {
|
|
|
194
166
|
setStatus({
|
|
195
167
|
[tagIndex]: STATUS.LOADING
|
|
196
168
|
});
|
|
197
|
-
const findIndex = tagInputState.findIndex(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
} = _ref11;
|
|
201
|
-
return index === tagIndex;
|
|
202
|
-
});
|
|
169
|
+
const findIndex = tagInputState.findIndex(({
|
|
170
|
+
index
|
|
171
|
+
}) => index === tagIndex);
|
|
203
172
|
const newTagInput = [...tagInputState];
|
|
204
173
|
newTagInput.splice(findIndex, 1);
|
|
205
174
|
try {
|
|
@@ -17,49 +17,36 @@ const StyledContainer = /*#__PURE__*/_styled("div", {
|
|
|
17
17
|
});
|
|
18
18
|
const TagsWrapper = /*#__PURE__*/_styled("span", {
|
|
19
19
|
target: "eb6op481"
|
|
20
|
-
})("cursor:pointer;color:",
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} = _ref;
|
|
24
|
-
return theme.colors.primary.text;
|
|
25
|
-
}, ";border:none;font-size:14px;align-self:center;max-width:350px;overflow:hidden;white-space:pre;text-overflow:ellipsis;background-color:transparent;padding-left:8px;padding-right:8px;");
|
|
20
|
+
})("cursor:pointer;color:", ({
|
|
21
|
+
theme
|
|
22
|
+
}) => theme.colors.primary.text, ";border:none;font-size:14px;align-self:center;max-width:350px;overflow:hidden;white-space:pre;text-overflow:ellipsis;background-color:transparent;padding-left:8px;padding-right:8px;");
|
|
26
23
|
const StyledTagContainer = /*#__PURE__*/_styled("div", {
|
|
27
24
|
target: "eb6op480"
|
|
28
|
-
})("display:flex;align-items:center;color:",
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
theme
|
|
36
|
-
} = _ref3;
|
|
37
|
-
return theme.space['1'];
|
|
38
|
-
}, ";", _ref4 => {
|
|
39
|
-
let {
|
|
40
|
-
multiline
|
|
41
|
-
} = _ref4;
|
|
42
|
-
return multiline && `flex-wrap: wrap;`;
|
|
43
|
-
}, ";");
|
|
25
|
+
})("display:flex;align-items:center;color:", ({
|
|
26
|
+
theme
|
|
27
|
+
}) => theme.colors.neutral.text, ";gap:", ({
|
|
28
|
+
theme
|
|
29
|
+
}) => theme.space['1'], ";", ({
|
|
30
|
+
multiline
|
|
31
|
+
}) => multiline && `flex-wrap: wrap;`, ";");
|
|
44
32
|
const DEFAULT_TAGS = [];
|
|
45
33
|
const getTagLabel = tag => typeof tag === 'object' ? tag.label : tag;
|
|
46
34
|
|
|
47
35
|
/**
|
|
48
36
|
* This component is used to display a list of tags with a threshold and a popover when there are too many tags.
|
|
49
37
|
*/
|
|
50
|
-
const TagList =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
} = _ref5;
|
|
38
|
+
const TagList = ({
|
|
39
|
+
maxLength = 600,
|
|
40
|
+
tags = DEFAULT_TAGS,
|
|
41
|
+
threshold = 1,
|
|
42
|
+
multiline = false,
|
|
43
|
+
popoverTitle,
|
|
44
|
+
copiable,
|
|
45
|
+
copyText,
|
|
46
|
+
copiedText,
|
|
47
|
+
className,
|
|
48
|
+
'data-testid': dataTestId
|
|
49
|
+
}) => {
|
|
63
50
|
let tmpThreshold = threshold;
|
|
64
51
|
if (tags.length > 0 && tags.slice(0, tmpThreshold).reduce((acc, tag) => acc + getTagLabel(tag), '').length > maxLength) {
|
|
65
52
|
// If total tags length in characters is above maxLength,
|
|
@@ -16,18 +16,17 @@ const PROMINENCES = {
|
|
|
16
16
|
/**
|
|
17
17
|
* Generate all styles available for text based on prominence and variants
|
|
18
18
|
*/
|
|
19
|
-
const generateStyles =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = _ref;
|
|
19
|
+
const generateStyles = ({
|
|
20
|
+
placement,
|
|
21
|
+
prominence,
|
|
22
|
+
sentiment,
|
|
23
|
+
variant,
|
|
24
|
+
theme,
|
|
25
|
+
oneLine,
|
|
26
|
+
disabled,
|
|
27
|
+
italic,
|
|
28
|
+
underline
|
|
29
|
+
}) => {
|
|
31
30
|
// stronger is available only for neutral sentiment
|
|
32
31
|
const definedProminence = sentiment !== 'neutral' && prominence === 'stronger' ? capitalize(PROMINENCES.default) : capitalize(PROMINENCES[prominence]);
|
|
33
32
|
sentiment ? theme.colors[sentiment] : undefined;
|
|
@@ -60,25 +59,24 @@ const StyledText = /*#__PURE__*/_styled('div', {
|
|
|
60
59
|
/**
|
|
61
60
|
* Text component is used to display text with different variants and sentiments.
|
|
62
61
|
*/
|
|
63
|
-
const Text =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
} = _ref2;
|
|
62
|
+
const Text = ({
|
|
63
|
+
variant,
|
|
64
|
+
children,
|
|
65
|
+
as,
|
|
66
|
+
color,
|
|
67
|
+
sentiment,
|
|
68
|
+
oneLine = false,
|
|
69
|
+
placement,
|
|
70
|
+
prominence = 'default',
|
|
71
|
+
className,
|
|
72
|
+
disabled = false,
|
|
73
|
+
italic = false,
|
|
74
|
+
underline = false,
|
|
75
|
+
id,
|
|
76
|
+
dir,
|
|
77
|
+
htmlFor,
|
|
78
|
+
'data-testid': dataTestId
|
|
79
|
+
}) => {
|
|
82
80
|
const computedSentiment = sentiment ?? color;
|
|
83
81
|
const elementRef = useRef(null);
|
|
84
82
|
const isOverflowing = useIsOverflowing(elementRef);
|