@ultraviolet/ui 1.41.1 → 1.43.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 +10 -3
- package/dist/src/components/Bullet/index.js +3 -1
- package/dist/src/components/Button/index.js +3 -1
- package/dist/src/components/List/Row.js +19 -14
- package/dist/src/components/List/constants.js +2 -2
- package/dist/src/components/List/index.js +4 -4
- package/dist/src/components/Table/Row.js +0 -2
- package/dist/src/components/TagList/index.js +2 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1202,6 +1202,7 @@ type CommonProps = {
|
|
|
1202
1202
|
sentiment?: SENTIMENT;
|
|
1203
1203
|
disabled?: boolean;
|
|
1204
1204
|
iconPosition?: 'left' | 'right';
|
|
1205
|
+
iconVariant?: ComponentProps<typeof Icon>['variant'];
|
|
1205
1206
|
fullWidth?: boolean;
|
|
1206
1207
|
isLoading?: boolean;
|
|
1207
1208
|
'aria-label'?: string;
|
|
@@ -1484,6 +1485,7 @@ type BulletSize = keyof typeof sizes;
|
|
|
1484
1485
|
type ContentProps$1 = XOR<[
|
|
1485
1486
|
{
|
|
1486
1487
|
icon: ComponentProps<typeof Icon>['name'];
|
|
1488
|
+
iconVariant?: ComponentProps<typeof Icon>['variant'];
|
|
1487
1489
|
},
|
|
1488
1490
|
{
|
|
1489
1491
|
text: string;
|
|
@@ -1501,7 +1503,7 @@ type BulletProps = {
|
|
|
1501
1503
|
/**
|
|
1502
1504
|
* Bullet component is used to display a small icon or text with a colored background in a circle.
|
|
1503
1505
|
*/
|
|
1504
|
-
declare const Bullet: ({ className, sentiment, size, icon, text, tooltip, tooltipBaseId, "data-testid": dataTestId, prominence, }: BulletProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1506
|
+
declare const Bullet: ({ className, sentiment, size, icon, iconVariant, text, tooltip, tooltipBaseId, "data-testid": dataTestId, prominence, }: BulletProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
1505
1507
|
|
|
1506
1508
|
type CardProps = {
|
|
1507
1509
|
children: ReactNode;
|
|
@@ -1780,7 +1782,7 @@ type ColumnProps$1 = Pick<ComponentProps<typeof HeaderCell$1>, 'isOrdered' | 'on
|
|
|
1780
1782
|
info?: string;
|
|
1781
1783
|
};
|
|
1782
1784
|
type ListProps = {
|
|
1783
|
-
|
|
1785
|
+
expandable?: boolean;
|
|
1784
1786
|
selectable?: boolean;
|
|
1785
1787
|
columns: ColumnProps$1[];
|
|
1786
1788
|
children: ReactNode;
|
|
@@ -2879,13 +2881,18 @@ type TagListProps = {
|
|
|
2879
2881
|
* This property define the title of the Popover, when some tags are hidden because of the threshold.
|
|
2880
2882
|
*/
|
|
2881
2883
|
popoverTitle: string;
|
|
2884
|
+
/**
|
|
2885
|
+
* The popover will be placed automatically by default. You can also specify the placement of the popover through
|
|
2886
|
+
* this property.
|
|
2887
|
+
*/
|
|
2888
|
+
popoverPlacement?: ComponentProps<typeof Popover>['placement'];
|
|
2882
2889
|
className?: string;
|
|
2883
2890
|
'data-testid'?: string;
|
|
2884
2891
|
} & Pick<ComponentProps<typeof Tag>, 'copiable' | 'copyText' | 'copiedText'>;
|
|
2885
2892
|
/**
|
|
2886
2893
|
* This component is used to display a list of tags with a threshold and a popover when there are too many tags.
|
|
2887
2894
|
*/
|
|
2888
|
-
declare const TagList: ({ maxLength, tags, threshold, multiline, popoverTitle, copiable, copyText, copiedText, className, "data-testid": dataTestId, }: TagListProps) => _emotion_react_jsx_runtime.JSX.Element | null;
|
|
2895
|
+
declare const TagList: ({ maxLength, tags, threshold, multiline, popoverTitle, popoverPlacement, copiable, copyText, copiedText, className, "data-testid": dataTestId, }: TagListProps) => _emotion_react_jsx_runtime.JSX.Element | null;
|
|
2889
2896
|
|
|
2890
2897
|
declare const PROMINENCES: {
|
|
2891
2898
|
default: string;
|
|
@@ -72,6 +72,7 @@ const Bullet = ({
|
|
|
72
72
|
sentiment = 'neutral',
|
|
73
73
|
size = 'medium',
|
|
74
74
|
icon,
|
|
75
|
+
iconVariant,
|
|
75
76
|
text,
|
|
76
77
|
tooltip,
|
|
77
78
|
tooltipBaseId,
|
|
@@ -88,7 +89,8 @@ const Bullet = ({
|
|
|
88
89
|
prominence: prominence,
|
|
89
90
|
children: icon ? jsx(Icon, {
|
|
90
91
|
name: icon,
|
|
91
|
-
size: "50%"
|
|
92
|
+
size: "50%",
|
|
93
|
+
variant: iconVariant
|
|
92
94
|
}) : text
|
|
93
95
|
})
|
|
94
96
|
});
|
|
@@ -201,6 +201,7 @@ const Button = /*#__PURE__*/forwardRef(({
|
|
|
201
201
|
disabled = false,
|
|
202
202
|
icon,
|
|
203
203
|
iconPosition = 'left',
|
|
204
|
+
iconVariant,
|
|
204
205
|
fullWidth = false,
|
|
205
206
|
isLoading = false,
|
|
206
207
|
children,
|
|
@@ -226,7 +227,8 @@ const Button = /*#__PURE__*/forwardRef(({
|
|
|
226
227
|
const content = jsxs(Fragment, {
|
|
227
228
|
children: [!isLoading && icon ? jsx(Icon, {
|
|
228
229
|
name: icon,
|
|
229
|
-
size:
|
|
230
|
+
size: "small",
|
|
231
|
+
variant: iconVariant
|
|
230
232
|
}) : null, isLoading ? jsx(Loader, {
|
|
231
233
|
active: true,
|
|
232
234
|
trailColor: "transparent",
|
|
@@ -16,7 +16,13 @@ const ExpandableWrapper = /*#__PURE__*/_styled("div", {
|
|
|
16
16
|
theme
|
|
17
17
|
}) => theme.space['2'], ";padding:", ({
|
|
18
18
|
theme
|
|
19
|
-
}) => theme.space['2'], ";cursor:auto;"
|
|
19
|
+
}) => theme.space['2'], ";cursor:auto;background:", ({
|
|
20
|
+
theme
|
|
21
|
+
}) => theme.colors.neutral.backgroundWeak, ";border-radius:0 0 ", ({
|
|
22
|
+
theme
|
|
23
|
+
}) => theme.radii.default, " ", ({
|
|
24
|
+
theme
|
|
25
|
+
}) => theme.radii.default, ";");
|
|
20
26
|
const StyledRow = /*#__PURE__*/_styled('div', {
|
|
21
27
|
shouldForwardProp: prop => !['sentiment'].includes(prop),
|
|
22
28
|
target: "ei4uyz11"
|
|
@@ -58,7 +64,7 @@ const StyledRow = /*#__PURE__*/_styled('div', {
|
|
|
58
64
|
theme
|
|
59
65
|
}) => theme.colors.neutral.backgroundDisabled, ";color:", ({
|
|
60
66
|
theme
|
|
61
|
-
}) => theme.colors.neutral.textDisabled, ";cursor:not-allowed;}
|
|
67
|
+
}) => theme.colors.neutral.textDisabled, ";cursor:not-allowed;}");
|
|
62
68
|
const StyledCheckboxContainer = /*#__PURE__*/_styled("div", {
|
|
63
69
|
target: "ei4uyz10"
|
|
64
70
|
})(process.env.NODE_ENV === "production" ? {
|
|
@@ -80,7 +86,6 @@ const Row = /*#__PURE__*/forwardRef(({
|
|
|
80
86
|
'data-testid': dataTestid
|
|
81
87
|
}, ref) => {
|
|
82
88
|
const {
|
|
83
|
-
allRowSelectValue,
|
|
84
89
|
selectable,
|
|
85
90
|
registerExpandableRow,
|
|
86
91
|
expandedRowIds,
|
|
@@ -115,27 +120,27 @@ const Row = /*#__PURE__*/forwardRef(({
|
|
|
115
120
|
expandRow(id);
|
|
116
121
|
}
|
|
117
122
|
};
|
|
123
|
+
const canClickRowToExpand = !disabled && !!expandable && !expandButton;
|
|
118
124
|
return jsxs(StyledRow, {
|
|
119
125
|
className: className,
|
|
120
126
|
ref: ref,
|
|
121
|
-
role:
|
|
122
|
-
onClick:
|
|
123
|
-
onKeyDown:
|
|
127
|
+
role: canClickRowToExpand ? 'button row' : 'row',
|
|
128
|
+
onClick: canClickRowToExpand ? toggleRowExpand : undefined,
|
|
129
|
+
onKeyDown: canClickRowToExpand ? event => {
|
|
124
130
|
if (event.key === ' ') {
|
|
125
131
|
toggleRowExpand();
|
|
126
132
|
event.preventDefault();
|
|
127
133
|
}
|
|
128
134
|
} : undefined,
|
|
129
|
-
tabIndex:
|
|
135
|
+
tabIndex: canClickRowToExpand ? 0 : -1,
|
|
130
136
|
sentiment: sentiment,
|
|
131
137
|
"aria-disabled": disabled,
|
|
132
138
|
"aria-expanded": expandable ? expandedRowIds[id] : undefined,
|
|
133
139
|
"data-highlight": !!selectedRowIds[id],
|
|
134
140
|
"data-testid": dataTestid,
|
|
135
141
|
children: [selectable ? jsx(Cell, {
|
|
136
|
-
preventClick:
|
|
142
|
+
preventClick: canClickRowToExpand,
|
|
137
143
|
children: jsx(StyledCheckboxContainer, {
|
|
138
|
-
"data-visibility": allRowSelectValue === false ? 'hover' : undefined,
|
|
139
144
|
children: jsx(Tooltip, {
|
|
140
145
|
text: typeof selectDisabled === 'string' ? selectDisabled : undefined,
|
|
141
146
|
children: jsx(Checkbox, {
|
|
@@ -160,18 +165,18 @@ const Row = /*#__PURE__*/forwardRef(({
|
|
|
160
165
|
disabled: disabled || !expandable,
|
|
161
166
|
icon: expandedRowIds[id] ? 'arrow-up' : 'arrow-down',
|
|
162
167
|
onClick: toggleRowExpand,
|
|
163
|
-
size: "
|
|
168
|
+
size: "small",
|
|
164
169
|
sentiment: "neutral",
|
|
165
170
|
variant: "ghost"
|
|
166
171
|
})
|
|
167
172
|
}) : null, children, expandable && expandedRowIds[id] ? jsx(ExpandableWrapper, {
|
|
168
173
|
"data-expandable-content": true,
|
|
169
|
-
onClick: e => {
|
|
174
|
+
onClick: canClickRowToExpand ? e => {
|
|
170
175
|
e.stopPropagation();
|
|
171
|
-
},
|
|
172
|
-
onKeyDown: e => {
|
|
176
|
+
} : undefined,
|
|
177
|
+
onKeyDown: canClickRowToExpand ? e => {
|
|
173
178
|
e.stopPropagation();
|
|
174
|
-
},
|
|
179
|
+
} : undefined,
|
|
175
180
|
children: expandable
|
|
176
181
|
}) : null]
|
|
177
182
|
});
|
|
@@ -8,7 +8,7 @@ import { useListContext, ListProvider } from './ListContext.js';
|
|
|
8
8
|
import { Row } from './Row.js';
|
|
9
9
|
import { SelectBar } from './SelectBar.js';
|
|
10
10
|
import { SkeletonRows } from './SkeletonRows.js';
|
|
11
|
-
import { SELECTABLE_CHECKBOX_SIZE,
|
|
11
|
+
import { SELECTABLE_CHECKBOX_SIZE, EXPANDABLE_COLUMN_SIZE } from './constants.js';
|
|
12
12
|
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
13
13
|
|
|
14
14
|
const StyledList = /*#__PURE__*/_styled('div', {
|
|
@@ -20,19 +20,19 @@ const StyledList = /*#__PURE__*/_styled('div', {
|
|
|
20
20
|
template
|
|
21
21
|
}) => template, ";align-items:center;}");
|
|
22
22
|
const BaseList = /*#__PURE__*/forwardRef(({
|
|
23
|
-
|
|
23
|
+
expandable = false,
|
|
24
24
|
selectable = false,
|
|
25
25
|
columns,
|
|
26
26
|
children,
|
|
27
27
|
loading,
|
|
28
28
|
autoCollapse = false
|
|
29
29
|
}, ref) => {
|
|
30
|
-
const computeTemplate = `${selectable ? `${SELECTABLE_CHECKBOX_SIZE}px ` : ''}${
|
|
30
|
+
const computeTemplate = `${selectable ? `${SELECTABLE_CHECKBOX_SIZE}px ` : ''}${expandable ? `${EXPANDABLE_COLUMN_SIZE}px ` : ''}${columns.map(({
|
|
31
31
|
width
|
|
32
32
|
}) => width ?? 'minmax(0, 1fr)').join(' ')}`;
|
|
33
33
|
return jsx(ListProvider, {
|
|
34
34
|
selectable: selectable,
|
|
35
|
-
expandButton:
|
|
35
|
+
expandButton: expandable,
|
|
36
36
|
autoCollapse: autoCollapse,
|
|
37
37
|
children: jsxs(StyledList, {
|
|
38
38
|
ref: ref,
|
|
@@ -45,7 +45,6 @@ const Row = ({
|
|
|
45
45
|
'data-testid': dataTestid
|
|
46
46
|
}) => {
|
|
47
47
|
const {
|
|
48
|
-
allRowSelectValue,
|
|
49
48
|
selectable,
|
|
50
49
|
registerSelectableRow,
|
|
51
50
|
selectedRowIds,
|
|
@@ -65,7 +64,6 @@ const Row = ({
|
|
|
65
64
|
highlightAnimation: highlightAnimation,
|
|
66
65
|
children: [selectable ? jsx(Cell, {
|
|
67
66
|
children: jsx(StyledCheckboxContainer, {
|
|
68
|
-
"data-visibility": allRowSelectValue === false ? 'hover' : undefined,
|
|
69
67
|
children: jsx(Tooltip, {
|
|
70
68
|
text: typeof selectDisabled === 'string' ? selectDisabled : undefined,
|
|
71
69
|
children: jsx(Checkbox, {
|
|
@@ -41,6 +41,7 @@ const TagList = ({
|
|
|
41
41
|
threshold = 1,
|
|
42
42
|
multiline = false,
|
|
43
43
|
popoverTitle,
|
|
44
|
+
popoverPlacement,
|
|
44
45
|
copiable,
|
|
45
46
|
copyText,
|
|
46
47
|
copiedText,
|
|
@@ -79,6 +80,7 @@ const TagList = ({
|
|
|
79
80
|
visible: isVisible,
|
|
80
81
|
size: "small",
|
|
81
82
|
onClose: () => setIsVisible(false),
|
|
83
|
+
placement: popoverPlacement,
|
|
82
84
|
content: jsx(StyledTagContainer, {
|
|
83
85
|
multiline: true,
|
|
84
86
|
children: tags.slice(visibleTagsCount).map((tag, index) => jsx(Tag
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultraviolet/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.0",
|
|
4
4
|
"description": "Ultraviolet UI",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"react-use-clipboard": "1.0.9",
|
|
68
68
|
"reakit": "1.3.11",
|
|
69
69
|
"@ultraviolet/themes": "1.9.0",
|
|
70
|
-
"@ultraviolet/icons": "2.10.
|
|
70
|
+
"@ultraviolet/icons": "2.10.1"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build": "rollup -c ../../rollup.config.mjs",
|