@ultraviolet/ui 1.41.0 → 1.42.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 +7 -2
- 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/dist/src/components/TextArea/index.js +2 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1780,7 +1780,7 @@ type ColumnProps$1 = Pick<ComponentProps<typeof HeaderCell$1>, 'isOrdered' | 'on
|
|
|
1780
1780
|
info?: string;
|
|
1781
1781
|
};
|
|
1782
1782
|
type ListProps = {
|
|
1783
|
-
|
|
1783
|
+
expandable?: boolean;
|
|
1784
1784
|
selectable?: boolean;
|
|
1785
1785
|
columns: ColumnProps$1[];
|
|
1786
1786
|
children: ReactNode;
|
|
@@ -2879,13 +2879,18 @@ type TagListProps = {
|
|
|
2879
2879
|
* This property define the title of the Popover, when some tags are hidden because of the threshold.
|
|
2880
2880
|
*/
|
|
2881
2881
|
popoverTitle: string;
|
|
2882
|
+
/**
|
|
2883
|
+
* The popover will be placed automatically by default. You can also specify the placement of the popover through
|
|
2884
|
+
* this property.
|
|
2885
|
+
*/
|
|
2886
|
+
popoverPlacement?: ComponentProps<typeof Popover>['placement'];
|
|
2882
2887
|
className?: string;
|
|
2883
2888
|
'data-testid'?: string;
|
|
2884
2889
|
} & Pick<ComponentProps<typeof Tag>, 'copiable' | 'copyText' | 'copiedText'>;
|
|
2885
2890
|
/**
|
|
2886
2891
|
* This component is used to display a list of tags with a threshold and a popover when there are too many tags.
|
|
2887
2892
|
*/
|
|
2888
|
-
declare const TagList: ({ maxLength, tags, threshold, multiline, popoverTitle, copiable, copyText, copiedText, className, "data-testid": dataTestId, }: TagListProps) => _emotion_react_jsx_runtime.JSX.Element | null;
|
|
2893
|
+
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
2894
|
|
|
2890
2895
|
declare const PROMINENCES: {
|
|
2891
2896
|
default: string;
|
|
@@ -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.42.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.
|
|
70
|
+
"@ultraviolet/icons": "2.10.1"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build": "rollup -c ../../rollup.config.mjs",
|