@bioturing/components 0.14.0 → 0.15.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/Badge.css +6 -0
- package/dist/Breadcrumb.css +83 -0
- package/dist/Checkbox.css +13 -0
- package/dist/CodeBlock.css +213 -0
- package/dist/CodeBlock.js +11 -8
- package/dist/Collapse.css +21 -0
- package/dist/DSRoot.css +667 -0
- package/dist/DSRoot.js +264 -17
- package/dist/DropdownMenu.css +95 -0
- package/dist/Empty.css +19 -0
- package/dist/Field.css +14 -0
- package/dist/Form.css +64 -0
- package/dist/IconButton.css +52 -0
- package/dist/Modal.css +317 -0
- package/dist/Modal.js +256 -9
- package/dist/PopupPanel.css +156 -102
- package/dist/Radio.css +14 -0
- package/dist/ScrollArea.css +64 -0
- package/dist/ScrollArea.js +4 -4
- package/dist/Segmented.css +16 -0
- package/dist/Select.css +24 -0
- package/dist/Select.js +4 -3
- package/dist/Spin.css +36 -0
- package/dist/Splitter.css +6 -0
- package/dist/Switch.css +7 -0
- package/dist/Table.css +116 -0
- package/dist/Tag.css +17 -0
- package/dist/ThemeProvider.css +39 -0
- package/dist/Toast.css +622 -0
- package/dist/Toast.js +264 -17
- package/dist/Tooltip.css +6 -0
- package/dist/Tour.css +73 -0
- package/dist/Tour.js +1 -1
- package/dist/Truncate.css +31 -0
- package/dist/Truncate.js +75 -19
- package/dist/Upload.css +144 -0
- package/dist/Upload.js +75 -19
- package/dist/VerticalCollapsiblePanel.css +193 -0
- package/dist/VerticalCollapsiblePanel.js +75 -19
- package/dist/components/Badge/component.d.ts +1 -0
- package/dist/components/Breadcrumb/component.d.ts +1 -0
- package/dist/components/Button/component.d.ts +1 -0
- package/dist/components/Checkbox/component.d.ts +1 -0
- package/dist/components/CodeBlock/component.d.ts +2 -1
- package/dist/components/CodeBlock/types.d.ts +12 -0
- package/dist/components/Collapse/component.d.ts +1 -0
- package/dist/components/DSRoot/component.d.ts +1 -0
- package/dist/components/DropdownMenu/component.d.ts +1 -0
- package/dist/components/Empty/component.d.ts +1 -0
- package/dist/components/Field/component.d.ts +1 -0
- package/dist/components/Form/component.d.ts +1 -0
- package/dist/components/IconButton/component.d.ts +1 -0
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/Radio/component.d.ts +1 -0
- package/dist/components/ScrollArea/component.d.ts +26 -4
- package/dist/components/Segmented/component.d.ts +1 -0
- package/dist/components/Select/component.d.ts +2 -1
- package/dist/components/Spin/component.d.ts +1 -0
- package/dist/components/Splitter/component.d.ts +1 -0
- package/dist/components/Stack/Stack.d.ts +39 -0
- package/dist/components/Stack/StackChild.d.ts +30 -0
- package/dist/components/Stack/index.d.ts +8 -0
- package/dist/components/Switch/component.d.ts +1 -0
- package/dist/components/Table/component.d.ts +1 -0
- package/dist/components/Tag/component.d.ts +1 -0
- package/dist/components/ThemeProvider/component.d.ts +1 -0
- package/dist/components/Toast/component.d.ts +1 -0
- package/dist/components/Tooltip/component.d.ts +1 -0
- package/dist/components/Tour/component.d.ts +1 -0
- package/dist/components/Truncate/component.d.ts +3 -0
- package/dist/components/Upload/index.d.ts +1 -0
- package/dist/components/VerticalCollapsiblePanel/component.d.ts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/hooks.js +1 -1
- package/dist/index.css +1469 -114
- package/dist/index.d.ts +1 -0
- package/dist/index.js +788 -159
- package/dist/metadata.d.ts +363 -0
- package/dist/tailwind.css +118 -1
- package/package.json +2 -2
- package/dist/style.css +0 -1392
- package/dist/style.js +0 -0
- package/dist/tailwind.js +0 -0
package/dist/Upload.css
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-upload-wrapper {
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
display: flex;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ds-upload-list {
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
flex-grow: 1;
|
|
10
|
+
display: flex;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ds-upload-list-item-container {
|
|
14
|
+
margin-top: .5rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ds-upload-item {
|
|
18
|
+
border-radius: var(--ds-border-radius);
|
|
19
|
+
border: 1px solid var(--ds-color-border);
|
|
20
|
+
flex-grow: 1;
|
|
21
|
+
padding: .5rem;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ds-upload-item-icon {
|
|
25
|
+
color: var(--ds-color-text-tertiary);
|
|
26
|
+
font-size: 1.25rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ds-upload-drag-icon {
|
|
30
|
+
color: var(--ds-color-primary);
|
|
31
|
+
justify-content: center;
|
|
32
|
+
align-items: center;
|
|
33
|
+
margin-bottom: .5rem;
|
|
34
|
+
font-size: 2.5rem;
|
|
35
|
+
display: flex;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ds-upload-item-content {
|
|
39
|
+
justify-content: space-between;
|
|
40
|
+
align-items: center;
|
|
41
|
+
min-width: 0;
|
|
42
|
+
display: flex;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ds-upload-item-name-progress {
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
flex-grow: 1;
|
|
48
|
+
flex-shrink: 1;
|
|
49
|
+
gap: 0;
|
|
50
|
+
min-width: 0;
|
|
51
|
+
display: flex;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@layer components {
|
|
56
|
+
.ds-truncate {
|
|
57
|
+
white-space: nowrap;
|
|
58
|
+
flex-grow: 1;
|
|
59
|
+
width: 100%;
|
|
60
|
+
min-width: 0;
|
|
61
|
+
max-width: 100%;
|
|
62
|
+
display: block;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.ds-truncate-end {
|
|
67
|
+
text-overflow: ellipsis;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.ds-truncate-middle {
|
|
71
|
+
text-overflow: clip;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.ds-truncate-multiline {
|
|
75
|
+
-webkit-line-clamp: var(--ds-line-clamp, 2);
|
|
76
|
+
line-clamp: var(--ds-line-clamp, 2);
|
|
77
|
+
white-space: normal;
|
|
78
|
+
text-overflow: ellipsis;
|
|
79
|
+
word-break: break-word;
|
|
80
|
+
-webkit-box-orient: vertical;
|
|
81
|
+
display: -webkit-box;
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@layer components {
|
|
87
|
+
.ds-icon-button {
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
color: var(--ds-color-icon);
|
|
90
|
+
background-color: #0000;
|
|
91
|
+
border: none;
|
|
92
|
+
border-radius: 999px;
|
|
93
|
+
justify-content: center;
|
|
94
|
+
align-items: center;
|
|
95
|
+
transition: all .2s;
|
|
96
|
+
display: inline-flex;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.ds-icon-button:hover {
|
|
100
|
+
background-color: var(--ds-color-fill-secondary);
|
|
101
|
+
color: var(--ds-color-icon-hover);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.ds-icon-button:active, .ds-icon-button.ds-popover-open {
|
|
105
|
+
background-color: var(--ds-color-primary-bg);
|
|
106
|
+
color: var(--ds-color-primary);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.ds-icon-button:focus {
|
|
110
|
+
outline: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.ds-icon-button:disabled {
|
|
114
|
+
cursor: not-allowed;
|
|
115
|
+
pointer-events: none;
|
|
116
|
+
color: var(--ds-color-text-disabled);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.ds-icon-button.ds-icon-button-medium {
|
|
120
|
+
width: 1.5rem;
|
|
121
|
+
height: 1.5rem;
|
|
122
|
+
padding: .125rem;
|
|
123
|
+
font-size: 1.25rem;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.ds-icon-button.ds-icon-button-small {
|
|
127
|
+
width: 1.25rem;
|
|
128
|
+
height: 1.25rem;
|
|
129
|
+
padding: .125rem;
|
|
130
|
+
font-size: 1rem;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.ds-icon-button.ds-icon-button-negative-margin {
|
|
134
|
+
margin: -.125rem;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@layer components {
|
|
139
|
+
span.ds-btn-icon {
|
|
140
|
+
align-items: center;
|
|
141
|
+
display: flex;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
package/dist/Upload.js
CHANGED
|
@@ -206,35 +206,90 @@ const getMiddleTruncatedString = (text, ellipsis, container)=>{
|
|
|
206
206
|
return (null == (_Object_values_reverse_find = Object.values(attempts).reverse().find(([width])=>width < containerWidth)) ? void 0 : _Object_values_reverse_find[1]) ?? Object.values(attempts)[0][1];
|
|
207
207
|
};
|
|
208
208
|
"use client";
|
|
209
|
-
const Truncate = ({ children, position = "end", className, style, ...rest })=>{
|
|
209
|
+
const Truncate = ({ children, position = "end", lines = 1, className, style, ...rest })=>{
|
|
210
210
|
const cls = useCls();
|
|
211
211
|
const containerRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
|
|
212
212
|
const [isTruncated, setIsTruncated] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
213
213
|
const [truncatedText, setTruncatedText] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(children);
|
|
214
214
|
const text = children;
|
|
215
215
|
const getContainerStyles = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
minWidth: 0,
|
|
222
|
-
maxWidth: "100%",
|
|
223
|
-
display: "block",
|
|
224
|
-
...style
|
|
216
|
+
if ("auto" !== lines) return {
|
|
217
|
+
...style,
|
|
218
|
+
...lines > 1 ? {
|
|
219
|
+
"--ds-line-clamp": lines
|
|
220
|
+
} : {}
|
|
225
221
|
};
|
|
226
|
-
|
|
227
|
-
...
|
|
228
|
-
|
|
222
|
+
return {
|
|
223
|
+
...style,
|
|
224
|
+
"--ds-line-clamp": 999
|
|
229
225
|
};
|
|
230
|
-
return baseStyles;
|
|
231
226
|
}, [
|
|
232
|
-
|
|
227
|
+
lines,
|
|
233
228
|
style
|
|
234
229
|
]);
|
|
235
230
|
(0, __WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect)(()=>{
|
|
236
231
|
const container = containerRef.current;
|
|
237
232
|
if (!container) return;
|
|
233
|
+
if ("auto" === lines) {
|
|
234
|
+
var _window_document_fonts_ready, _window_document_fonts;
|
|
235
|
+
setTruncatedText(text);
|
|
236
|
+
const calculateLines = ()=>{
|
|
237
|
+
const parent = container.parentElement;
|
|
238
|
+
if (!parent) return;
|
|
239
|
+
const styles = window.getComputedStyle(container);
|
|
240
|
+
const fontSize = parseFloat(styles.fontSize);
|
|
241
|
+
const lineHeight = "normal" === styles.lineHeight ? 1.2 * fontSize : parseFloat(styles.lineHeight);
|
|
242
|
+
const parentStyles = window.getComputedStyle(parent);
|
|
243
|
+
const paddingTop = parseFloat(parentStyles.paddingTop) || 0;
|
|
244
|
+
const paddingBottom = parseFloat(parentStyles.paddingBottom) || 0;
|
|
245
|
+
const borderTopWidth = parseFloat(parentStyles.borderTopWidth) || 0;
|
|
246
|
+
const borderBottomWidth = parseFloat(parentStyles.borderBottomWidth) || 0;
|
|
247
|
+
const parentHeight = parent.clientHeight;
|
|
248
|
+
const availableHeight = parentHeight - paddingTop - paddingBottom - borderTopWidth - borderBottomWidth;
|
|
249
|
+
const maxLines = Math.max(1, Math.floor(availableHeight / lineHeight));
|
|
250
|
+
if (container) container.style.setProperty("--ds-line-clamp", String(maxLines));
|
|
251
|
+
const clone = document.createElement("span");
|
|
252
|
+
clone.style.visibility = "hidden";
|
|
253
|
+
clone.style.position = "absolute";
|
|
254
|
+
clone.style.width = `${container.clientWidth}px`;
|
|
255
|
+
clone.style.fontSize = styles.fontSize;
|
|
256
|
+
clone.style.fontFamily = styles.fontFamily;
|
|
257
|
+
clone.style.lineHeight = styles.lineHeight;
|
|
258
|
+
clone.textContent = text;
|
|
259
|
+
document.body.appendChild(clone);
|
|
260
|
+
const isTruncated = clone.scrollHeight > availableHeight;
|
|
261
|
+
document.body.removeChild(clone);
|
|
262
|
+
setIsTruncated(isTruncated);
|
|
263
|
+
};
|
|
264
|
+
null == (_window_document_fonts = window.document.fonts) || null == (_window_document_fonts_ready = _window_document_fonts.ready) || _window_document_fonts_ready.then(calculateLines);
|
|
265
|
+
const observer = new ResizeObserver(()=>{
|
|
266
|
+
window.requestAnimationFrame(calculateLines);
|
|
267
|
+
});
|
|
268
|
+
observer.observe(container);
|
|
269
|
+
if (container.parentElement) observer.observe(container.parentElement);
|
|
270
|
+
return ()=>observer.disconnect();
|
|
271
|
+
}
|
|
272
|
+
if ("number" == typeof lines && lines > 1) {
|
|
273
|
+
var _window_document_fonts_ready1, _window_document_fonts1;
|
|
274
|
+
setTruncatedText(text);
|
|
275
|
+
const checkIfTruncated = ()=>{
|
|
276
|
+
const clone = document.createElement("span");
|
|
277
|
+
clone.style.visibility = "hidden";
|
|
278
|
+
clone.style.position = "absolute";
|
|
279
|
+
clone.style.width = `${container.clientWidth}px`;
|
|
280
|
+
clone.textContent = text;
|
|
281
|
+
document.body.appendChild(clone);
|
|
282
|
+
const isTruncated = clone.scrollHeight > (container.clientHeight || container.offsetHeight);
|
|
283
|
+
document.body.removeChild(clone);
|
|
284
|
+
setIsTruncated(isTruncated);
|
|
285
|
+
};
|
|
286
|
+
null == (_window_document_fonts1 = window.document.fonts) || null == (_window_document_fonts_ready1 = _window_document_fonts1.ready) || _window_document_fonts_ready1.then(checkIfTruncated);
|
|
287
|
+
const observer = new ResizeObserver(()=>{
|
|
288
|
+
window.requestAnimationFrame(checkIfTruncated);
|
|
289
|
+
});
|
|
290
|
+
observer.observe(container);
|
|
291
|
+
return ()=>observer.disconnect();
|
|
292
|
+
}
|
|
238
293
|
let cancellationToken = {
|
|
239
294
|
cancelled: false
|
|
240
295
|
};
|
|
@@ -249,8 +304,8 @@ const Truncate = ({ children, position = "end", className, style, ...rest })=>{
|
|
|
249
304
|
setTruncatedText(truncated);
|
|
250
305
|
};
|
|
251
306
|
if ("middle" == position) {
|
|
252
|
-
var
|
|
253
|
-
null == (
|
|
307
|
+
var _window_document_fonts_ready2, _window_document_fonts2;
|
|
308
|
+
null == (_window_document_fonts2 = window.document.fonts) || null == (_window_document_fonts_ready2 = _window_document_fonts2.ready) || _window_document_fonts_ready2.then(calculateTruncatedString);
|
|
254
309
|
}
|
|
255
310
|
if ("end" == position) setTruncatedText(text);
|
|
256
311
|
const observer = new ResizeObserver(()=>{
|
|
@@ -267,12 +322,13 @@ const Truncate = ({ children, position = "end", className, style, ...rest })=>{
|
|
|
267
322
|
};
|
|
268
323
|
}, [
|
|
269
324
|
text,
|
|
270
|
-
position
|
|
325
|
+
position,
|
|
326
|
+
lines
|
|
271
327
|
]);
|
|
272
328
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
|
|
273
329
|
ref: containerRef,
|
|
274
330
|
style: getContainerStyles(),
|
|
275
|
-
className: clsx(cls("truncate"), className),
|
|
331
|
+
className: clsx(1 === lines ? cls("truncate") : cls("truncate-multiline"), "middle" === position ? cls("truncate-middle") : cls("truncate-end"), className),
|
|
276
332
|
title: isTruncated ? text : void 0,
|
|
277
333
|
...rest,
|
|
278
334
|
children: text === truncatedText ? text : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-truncate {
|
|
3
|
+
white-space: nowrap;
|
|
4
|
+
flex-grow: 1;
|
|
5
|
+
width: 100%;
|
|
6
|
+
min-width: 0;
|
|
7
|
+
max-width: 100%;
|
|
8
|
+
display: block;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.ds-truncate-end {
|
|
13
|
+
text-overflow: ellipsis;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ds-truncate-middle {
|
|
17
|
+
text-overflow: clip;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ds-truncate-multiline {
|
|
21
|
+
-webkit-line-clamp: var(--ds-line-clamp, 2);
|
|
22
|
+
line-clamp: var(--ds-line-clamp, 2);
|
|
23
|
+
white-space: normal;
|
|
24
|
+
text-overflow: ellipsis;
|
|
25
|
+
word-break: break-word;
|
|
26
|
+
-webkit-box-orient: vertical;
|
|
27
|
+
display: -webkit-box;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@layer components {
|
|
33
|
+
.ds-collapsible-panel {
|
|
34
|
+
flex-basis: fit-content;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
flex-grow: 0;
|
|
37
|
+
flex-shrink: 0;
|
|
38
|
+
max-height: 100%;
|
|
39
|
+
display: flex;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ds-collapsible-panel[data-closed] {
|
|
44
|
+
transition: all .2s ease-out;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.ds-collapsible-panel[data-open] {
|
|
48
|
+
flex-grow: 1;
|
|
49
|
+
transition: all .2s ease-in;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ds-collapsible-panel-trigger {
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
text-align: left;
|
|
55
|
+
background: none;
|
|
56
|
+
border: none;
|
|
57
|
+
padding: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ds-collapsible-panel-header {
|
|
61
|
+
border-bottom: 1px solid #0000;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
flex-grow: 0;
|
|
64
|
+
transition: all .2s ease-in-out;
|
|
65
|
+
display: flex;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ds-collapsible-panel-header-inner {
|
|
69
|
+
align-items: center;
|
|
70
|
+
gap: .5rem;
|
|
71
|
+
padding: .75rem 1rem;
|
|
72
|
+
transition: width .2s;
|
|
73
|
+
display: flex;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ds-collapsible-panel-header-after {
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: .5rem;
|
|
79
|
+
padding: 0 1rem .75rem;
|
|
80
|
+
display: flex;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.ds-collapsible-panel[data-open] .ds-collapsible-panel-header {
|
|
84
|
+
border-bottom: 1px solid var(--ds-color-split);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ds-collapsible-panel[data-open] .ds-collapsible-panel-header-inner {
|
|
88
|
+
flex-grow: 1;
|
|
89
|
+
justify-content: flex-start;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.ds-collapsible-panel-trigger:hover .ds-collapsible-panel-header {
|
|
93
|
+
background-color: var(--ds-color-bg-hover);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.ds-collapsible-panel-header-actions {
|
|
97
|
+
flex-grow: 0;
|
|
98
|
+
flex-shrink: 0;
|
|
99
|
+
justify-content: center;
|
|
100
|
+
align-items: center;
|
|
101
|
+
gap: .5rem;
|
|
102
|
+
display: flex;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.ds-collapsible-panel-header-text {
|
|
106
|
+
font-size: var(--text-ds-h5);
|
|
107
|
+
font-weight: var(--text-ds-h5--font-weight);
|
|
108
|
+
line-height: var(--text-ds-h5--line-height);
|
|
109
|
+
color: var(--ds-color-text);
|
|
110
|
+
flex-grow: 1;
|
|
111
|
+
display: inline-block;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.ds-collapsible-panel[data-closed] .ds-collapsible-panel-header-inner {
|
|
115
|
+
writing-mode: vertical-rl;
|
|
116
|
+
transform: rotate(180deg);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.ds-collapsible-panel-content {
|
|
120
|
+
flex-direction: column;
|
|
121
|
+
flex-grow: 1;
|
|
122
|
+
flex-shrink: 1;
|
|
123
|
+
display: flex;
|
|
124
|
+
overflow-y: auto;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.ds-collapsible-panel-content[data-closed] {
|
|
128
|
+
display: none;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.ds-collapsible-panel-body {
|
|
132
|
+
padding: var(--ds-content-padding);
|
|
133
|
+
flex-grow: 1;
|
|
134
|
+
transition: opacity .2s ease-in-out;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.ds-collapsible-panel-body[data-starting], .ds-collapsible-panel-body[data-ending] {
|
|
138
|
+
opacity: 0;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@layer components {
|
|
143
|
+
.ds-icon-button {
|
|
144
|
+
cursor: pointer;
|
|
145
|
+
color: var(--ds-color-icon);
|
|
146
|
+
background-color: #0000;
|
|
147
|
+
border: none;
|
|
148
|
+
border-radius: 999px;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
align-items: center;
|
|
151
|
+
transition: all .2s;
|
|
152
|
+
display: inline-flex;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.ds-icon-button:hover {
|
|
156
|
+
background-color: var(--ds-color-fill-secondary);
|
|
157
|
+
color: var(--ds-color-icon-hover);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.ds-icon-button:active, .ds-icon-button.ds-popover-open {
|
|
161
|
+
background-color: var(--ds-color-primary-bg);
|
|
162
|
+
color: var(--ds-color-primary);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.ds-icon-button:focus {
|
|
166
|
+
outline: none;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.ds-icon-button:disabled {
|
|
170
|
+
cursor: not-allowed;
|
|
171
|
+
pointer-events: none;
|
|
172
|
+
color: var(--ds-color-text-disabled);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.ds-icon-button.ds-icon-button-medium {
|
|
176
|
+
width: 1.5rem;
|
|
177
|
+
height: 1.5rem;
|
|
178
|
+
padding: .125rem;
|
|
179
|
+
font-size: 1.25rem;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.ds-icon-button.ds-icon-button-small {
|
|
183
|
+
width: 1.25rem;
|
|
184
|
+
height: 1.25rem;
|
|
185
|
+
padding: .125rem;
|
|
186
|
+
font-size: 1rem;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.ds-icon-button.ds-icon-button-negative-margin {
|
|
190
|
+
margin: -.125rem;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
@@ -252,35 +252,90 @@ const getMiddleTruncatedString = (text, ellipsis, container)=>{
|
|
|
252
252
|
return (null == (_Object_values_reverse_find = Object.values(attempts).reverse().find(([width])=>width < containerWidth)) ? void 0 : _Object_values_reverse_find[1]) ?? Object.values(attempts)[0][1];
|
|
253
253
|
};
|
|
254
254
|
"use client";
|
|
255
|
-
const Truncate = ({ children, position = "end", className, style, ...rest })=>{
|
|
255
|
+
const Truncate = ({ children, position = "end", lines = 1, className, style, ...rest })=>{
|
|
256
256
|
const cls = useCls();
|
|
257
257
|
const containerRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
|
|
258
258
|
const [isTruncated, setIsTruncated] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
259
259
|
const [truncatedText, setTruncatedText] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(children);
|
|
260
260
|
const text = children;
|
|
261
261
|
const getContainerStyles = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
minWidth: 0,
|
|
268
|
-
maxWidth: "100%",
|
|
269
|
-
display: "block",
|
|
270
|
-
...style
|
|
262
|
+
if ("auto" !== lines) return {
|
|
263
|
+
...style,
|
|
264
|
+
...lines > 1 ? {
|
|
265
|
+
"--ds-line-clamp": lines
|
|
266
|
+
} : {}
|
|
271
267
|
};
|
|
272
|
-
|
|
273
|
-
...
|
|
274
|
-
|
|
268
|
+
return {
|
|
269
|
+
...style,
|
|
270
|
+
"--ds-line-clamp": 999
|
|
275
271
|
};
|
|
276
|
-
return baseStyles;
|
|
277
272
|
}, [
|
|
278
|
-
|
|
273
|
+
lines,
|
|
279
274
|
style
|
|
280
275
|
]);
|
|
281
276
|
(0, __WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect)(()=>{
|
|
282
277
|
const container = containerRef.current;
|
|
283
278
|
if (!container) return;
|
|
279
|
+
if ("auto" === lines) {
|
|
280
|
+
var _window_document_fonts_ready, _window_document_fonts;
|
|
281
|
+
setTruncatedText(text);
|
|
282
|
+
const calculateLines = ()=>{
|
|
283
|
+
const parent = container.parentElement;
|
|
284
|
+
if (!parent) return;
|
|
285
|
+
const styles = window.getComputedStyle(container);
|
|
286
|
+
const fontSize = parseFloat(styles.fontSize);
|
|
287
|
+
const lineHeight = "normal" === styles.lineHeight ? 1.2 * fontSize : parseFloat(styles.lineHeight);
|
|
288
|
+
const parentStyles = window.getComputedStyle(parent);
|
|
289
|
+
const paddingTop = parseFloat(parentStyles.paddingTop) || 0;
|
|
290
|
+
const paddingBottom = parseFloat(parentStyles.paddingBottom) || 0;
|
|
291
|
+
const borderTopWidth = parseFloat(parentStyles.borderTopWidth) || 0;
|
|
292
|
+
const borderBottomWidth = parseFloat(parentStyles.borderBottomWidth) || 0;
|
|
293
|
+
const parentHeight = parent.clientHeight;
|
|
294
|
+
const availableHeight = parentHeight - paddingTop - paddingBottom - borderTopWidth - borderBottomWidth;
|
|
295
|
+
const maxLines = Math.max(1, Math.floor(availableHeight / lineHeight));
|
|
296
|
+
if (container) container.style.setProperty("--ds-line-clamp", String(maxLines));
|
|
297
|
+
const clone = document.createElement("span");
|
|
298
|
+
clone.style.visibility = "hidden";
|
|
299
|
+
clone.style.position = "absolute";
|
|
300
|
+
clone.style.width = `${container.clientWidth}px`;
|
|
301
|
+
clone.style.fontSize = styles.fontSize;
|
|
302
|
+
clone.style.fontFamily = styles.fontFamily;
|
|
303
|
+
clone.style.lineHeight = styles.lineHeight;
|
|
304
|
+
clone.textContent = text;
|
|
305
|
+
document.body.appendChild(clone);
|
|
306
|
+
const isTruncated = clone.scrollHeight > availableHeight;
|
|
307
|
+
document.body.removeChild(clone);
|
|
308
|
+
setIsTruncated(isTruncated);
|
|
309
|
+
};
|
|
310
|
+
null == (_window_document_fonts = window.document.fonts) || null == (_window_document_fonts_ready = _window_document_fonts.ready) || _window_document_fonts_ready.then(calculateLines);
|
|
311
|
+
const observer = new ResizeObserver(()=>{
|
|
312
|
+
window.requestAnimationFrame(calculateLines);
|
|
313
|
+
});
|
|
314
|
+
observer.observe(container);
|
|
315
|
+
if (container.parentElement) observer.observe(container.parentElement);
|
|
316
|
+
return ()=>observer.disconnect();
|
|
317
|
+
}
|
|
318
|
+
if ("number" == typeof lines && lines > 1) {
|
|
319
|
+
var _window_document_fonts_ready1, _window_document_fonts1;
|
|
320
|
+
setTruncatedText(text);
|
|
321
|
+
const checkIfTruncated = ()=>{
|
|
322
|
+
const clone = document.createElement("span");
|
|
323
|
+
clone.style.visibility = "hidden";
|
|
324
|
+
clone.style.position = "absolute";
|
|
325
|
+
clone.style.width = `${container.clientWidth}px`;
|
|
326
|
+
clone.textContent = text;
|
|
327
|
+
document.body.appendChild(clone);
|
|
328
|
+
const isTruncated = clone.scrollHeight > (container.clientHeight || container.offsetHeight);
|
|
329
|
+
document.body.removeChild(clone);
|
|
330
|
+
setIsTruncated(isTruncated);
|
|
331
|
+
};
|
|
332
|
+
null == (_window_document_fonts1 = window.document.fonts) || null == (_window_document_fonts_ready1 = _window_document_fonts1.ready) || _window_document_fonts_ready1.then(checkIfTruncated);
|
|
333
|
+
const observer = new ResizeObserver(()=>{
|
|
334
|
+
window.requestAnimationFrame(checkIfTruncated);
|
|
335
|
+
});
|
|
336
|
+
observer.observe(container);
|
|
337
|
+
return ()=>observer.disconnect();
|
|
338
|
+
}
|
|
284
339
|
let cancellationToken = {
|
|
285
340
|
cancelled: false
|
|
286
341
|
};
|
|
@@ -295,8 +350,8 @@ const Truncate = ({ children, position = "end", className, style, ...rest })=>{
|
|
|
295
350
|
setTruncatedText(truncated);
|
|
296
351
|
};
|
|
297
352
|
if ("middle" == position) {
|
|
298
|
-
var
|
|
299
|
-
null == (
|
|
353
|
+
var _window_document_fonts_ready2, _window_document_fonts2;
|
|
354
|
+
null == (_window_document_fonts2 = window.document.fonts) || null == (_window_document_fonts_ready2 = _window_document_fonts2.ready) || _window_document_fonts_ready2.then(calculateTruncatedString);
|
|
300
355
|
}
|
|
301
356
|
if ("end" == position) setTruncatedText(text);
|
|
302
357
|
const observer = new ResizeObserver(()=>{
|
|
@@ -313,12 +368,13 @@ const Truncate = ({ children, position = "end", className, style, ...rest })=>{
|
|
|
313
368
|
};
|
|
314
369
|
}, [
|
|
315
370
|
text,
|
|
316
|
-
position
|
|
371
|
+
position,
|
|
372
|
+
lines
|
|
317
373
|
]);
|
|
318
374
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
|
|
319
375
|
ref: containerRef,
|
|
320
376
|
style: getContainerStyles(),
|
|
321
|
-
className: clsx(cls("truncate"), className),
|
|
377
|
+
className: clsx(1 === lines ? cls("truncate") : cls("truncate-multiline"), "middle" === position ? cls("truncate-middle") : cls("truncate-end"), className),
|
|
322
378
|
title: isTruncated ? text : void 0,
|
|
323
379
|
...rest,
|
|
324
380
|
children: text === truncatedText ? text : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type BreadcrumbProps, type BreadcrumbItemProps } from "./types";
|
|
2
|
+
import "./style.css";
|
|
2
3
|
export declare const Breadcrumb: (({ className, items, noWrap, itemRender: outsideItemRender, ...rest }: BreadcrumbProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
3
4
|
Item: (props: BreadcrumbItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
5
|
Separator: (props: React.HTMLAttributes<HTMLSpanElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ButtonProps as AntdButtonProps } from "antd/es/button";
|
|
2
|
+
import "./style.css";
|
|
2
3
|
export type ButtonProps = AntdButtonProps;
|
|
3
4
|
declare const ButtonInner: ({ style, ...rest }: ButtonProps, ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>) => import("react/jsx-runtime").JSX.Element;
|
|
4
5
|
export declare const Button: (props: ButtonProps & {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Checkbox as AntCheckbox, type CheckboxProps as AntCheckboxProps } from "antd";
|
|
2
|
+
import "./style.css";
|
|
2
3
|
export interface CheckboxProps extends AntCheckboxProps {
|
|
3
4
|
}
|
|
4
5
|
declare const MainCheckboxInner: (props: CheckboxProps, ref: React.Ref<React.ComponentRef<typeof AntCheckbox>>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { CodeBlockProps } from "./types";
|
|
2
|
-
|
|
2
|
+
import "./style.css";
|
|
3
|
+
export declare const CodeBlock: ({ code, children, lang: defaultLang, className, options, activeOption: controlledActiveOption, defaultActiveOption, onActiveOptionChange, copyText, copySuccessText, classNames, maxHeight, ...rest }: CodeBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -44,4 +44,16 @@ export interface CodeBlockProps extends React.ComponentPropsWithRef<"div"> {
|
|
|
44
44
|
* Copy success text label
|
|
45
45
|
*/
|
|
46
46
|
copySuccessText?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Custom class names for each part of the code block
|
|
49
|
+
*/
|
|
50
|
+
classNames?: {
|
|
51
|
+
root?: string;
|
|
52
|
+
content?: string;
|
|
53
|
+
header?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Maximum height of the code block
|
|
57
|
+
*/
|
|
58
|
+
maxHeight?: string | number;
|
|
47
59
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type CollapseProps as AntCollapseProps, type CollapsePanelProps as AntCollapsePanelProps } from "antd";
|
|
2
2
|
import { type ForwardedRef } from "react";
|
|
3
|
+
import "./style.css";
|
|
3
4
|
export interface CollapseProps extends AntCollapseProps {
|
|
4
5
|
}
|
|
5
6
|
export interface CollapsePanelProps extends AntCollapsePanelProps {
|