@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/Modal.css
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-stack {
|
|
3
|
+
display: flex;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.ds-stack-hug {
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ds-stack-horizontal {
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ds-stack-vertical {
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ds-stack-fill.ds-stack-vertical {
|
|
19
|
+
height: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ds-stack-fill.ds-stack-horizontal {
|
|
23
|
+
width: 100%;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ds-stack-wrap {
|
|
27
|
+
flex-wrap: wrap;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ds-stack-gap-0 {
|
|
31
|
+
gap: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ds-stack-gap-1 {
|
|
35
|
+
gap: 1px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ds-stack-gap-2 {
|
|
39
|
+
gap: 2px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.ds-stack-gap-4 {
|
|
43
|
+
gap: 4px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ds-stack-gap-8 {
|
|
47
|
+
gap: 8px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ds-stack-gap-12 {
|
|
51
|
+
gap: 12px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.ds-stack-gap-16 {
|
|
55
|
+
gap: 16px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.ds-stack-gap-24, .ds-stack-gap-32 {
|
|
59
|
+
gap: 24px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.ds-stack-align-flex-start {
|
|
63
|
+
align-items: flex-start;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.ds-stack-align-flex-end {
|
|
67
|
+
align-items: flex-end;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.ds-stack-align-center {
|
|
71
|
+
align-items: center;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.ds-stack-align-stretch {
|
|
75
|
+
align-items: stretch;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.ds-stack-align-baseline {
|
|
79
|
+
align-items: baseline;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ds-stack-justify-flex-start {
|
|
83
|
+
justify-content: flex-start;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.ds-stack-justify-flex-end {
|
|
87
|
+
justify-content: flex-end;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.ds-stack-justify-center {
|
|
91
|
+
justify-content: center;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.ds-stack-justify-space-between {
|
|
95
|
+
justify-content: space-between;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.ds-stack-justify-space-around {
|
|
99
|
+
justify-content: space-around;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.ds-stack-justify-space-evenly {
|
|
103
|
+
justify-content: space-evenly;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.ds-stack-child {
|
|
107
|
+
min-width: 0;
|
|
108
|
+
min-height: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.ds-stack-child-flex-0 {
|
|
112
|
+
flex: 0;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.ds-stack-child-flex-1 {
|
|
116
|
+
flex: 1;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.ds-stack-child-grow {
|
|
120
|
+
flex-grow: 1;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.ds-stack-child-shrink {
|
|
124
|
+
flex-shrink: 1;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@layer components {
|
|
129
|
+
.ds-truncate {
|
|
130
|
+
white-space: nowrap;
|
|
131
|
+
flex-grow: 1;
|
|
132
|
+
width: 100%;
|
|
133
|
+
min-width: 0;
|
|
134
|
+
max-width: 100%;
|
|
135
|
+
display: block;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.ds-truncate-end {
|
|
140
|
+
text-overflow: ellipsis;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.ds-truncate-middle {
|
|
144
|
+
text-overflow: clip;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.ds-truncate-multiline {
|
|
148
|
+
-webkit-line-clamp: var(--ds-line-clamp, 2);
|
|
149
|
+
line-clamp: var(--ds-line-clamp, 2);
|
|
150
|
+
white-space: normal;
|
|
151
|
+
text-overflow: ellipsis;
|
|
152
|
+
word-break: break-word;
|
|
153
|
+
-webkit-box-orient: vertical;
|
|
154
|
+
display: -webkit-box;
|
|
155
|
+
overflow: hidden;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@layer components {
|
|
160
|
+
.ds-icon-button {
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
color: var(--ds-color-icon);
|
|
163
|
+
background-color: #0000;
|
|
164
|
+
border: none;
|
|
165
|
+
border-radius: 999px;
|
|
166
|
+
justify-content: center;
|
|
167
|
+
align-items: center;
|
|
168
|
+
transition: all .2s;
|
|
169
|
+
display: inline-flex;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.ds-icon-button:hover {
|
|
173
|
+
background-color: var(--ds-color-fill-secondary);
|
|
174
|
+
color: var(--ds-color-icon-hover);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.ds-icon-button:active, .ds-icon-button.ds-popover-open {
|
|
178
|
+
background-color: var(--ds-color-primary-bg);
|
|
179
|
+
color: var(--ds-color-primary);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.ds-icon-button:focus {
|
|
183
|
+
outline: none;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.ds-icon-button:disabled {
|
|
187
|
+
cursor: not-allowed;
|
|
188
|
+
pointer-events: none;
|
|
189
|
+
color: var(--ds-color-text-disabled);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.ds-icon-button.ds-icon-button-medium {
|
|
193
|
+
width: 1.5rem;
|
|
194
|
+
height: 1.5rem;
|
|
195
|
+
padding: .125rem;
|
|
196
|
+
font-size: 1.25rem;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.ds-icon-button.ds-icon-button-small {
|
|
200
|
+
width: 1.25rem;
|
|
201
|
+
height: 1.25rem;
|
|
202
|
+
padding: .125rem;
|
|
203
|
+
font-size: 1rem;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.ds-icon-button.ds-icon-button-negative-margin {
|
|
207
|
+
margin: -.125rem;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
@layer components {
|
|
212
|
+
.ds-modal-wrap {
|
|
213
|
+
max-height: 100vh;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.ds-modal-wrap .ds-modal-close-x {
|
|
217
|
+
width: 100%;
|
|
218
|
+
display: flex;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.ds-modal-wrap .ds-modal {
|
|
222
|
+
max-height: 100vh;
|
|
223
|
+
margin-top: 0;
|
|
224
|
+
margin-bottom: 0;
|
|
225
|
+
padding-bottom: 0;
|
|
226
|
+
top: 0;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
:is(.ds-modal-wrap .ds-modal) .ds-modal-content {
|
|
230
|
+
box-shadow: var(--ds-box-shadow-secondary);
|
|
231
|
+
background: var(--ds-modal-bg);
|
|
232
|
+
flex-direction: column;
|
|
233
|
+
padding: 0;
|
|
234
|
+
display: flex;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
:is(.ds-modal-wrap .ds-modal) .ds-modal-body {
|
|
238
|
+
padding: var(--ds-modal-content-padding);
|
|
239
|
+
flex-grow: 1;
|
|
240
|
+
flex-shrink: 1;
|
|
241
|
+
min-height: 0;
|
|
242
|
+
overflow: auto;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
:is(.ds-modal-wrap .ds-modal) .ds-modal-header {
|
|
246
|
+
padding: calc(var(--ds-modal-padding) * 2 / 3) var(--ds-modal-padding) 0 var(--ds-modal-padding);
|
|
247
|
+
background: none;
|
|
248
|
+
margin-bottom: 0;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
:is(.ds-modal-wrap .ds-modal) .ds-modal-footer {
|
|
252
|
+
padding: 0 var(--ds-modal-padding) var(--ds-modal-padding) var(--ds-modal-padding);
|
|
253
|
+
background: none;
|
|
254
|
+
margin-top: 0;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
:is(.ds-modal-wrap .ds-modal) .ds-modal-close {
|
|
258
|
+
top: calc(var(--ds-modal-padding) * 2 / 3 - 4px);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.ds-modal-wrap:not(.ds-modal-centered) .ds-modal-inner {
|
|
262
|
+
margin-top: 4rem;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.ds-modal-wrap:not(.ds-modal-fullscreen) .ds-modal-content {
|
|
266
|
+
max-height: calc(100vh - var(--ds-modal-edge-padding) * 2);
|
|
267
|
+
margin: var(--ds-modal-edge-padding);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.ds-modal-wrap:not(.ds-modal-fullscreen) .ds-modal > div[tabindex="0"] {
|
|
271
|
+
max-height: calc(100vh - var(--ds-modal-edge-padding) * 2);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.ds-modal-no-body-scroll .ds-modal {
|
|
275
|
+
max-height: 100%;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
:is(.ds-modal-no-body-scroll .ds-modal) .ds-modal-body {
|
|
279
|
+
display: grid;
|
|
280
|
+
overflow: hidden;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
:is(:is(.ds-modal-no-body-scroll .ds-modal) .ds-modal-body) > * {
|
|
284
|
+
min-height: 0;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.ds-modal-fullscreen .ds-modal > div[tabindex="0"], .ds-modal-fullscreen .ds-modal .ds-modal-inner {
|
|
288
|
+
height: 100%;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.ds-modal-fullscreen .ds-modal .ds-modal-content {
|
|
292
|
+
border-radius: 0;
|
|
293
|
+
width: 100%;
|
|
294
|
+
height: 100%;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
:is(.ds-modal-fixed .ds-modal) .ds-modal-footer {
|
|
298
|
+
border-top: 1px solid var(--ds-color-split);
|
|
299
|
+
padding: calc(var(--ds-modal-padding) / 2) var(--ds-modal-padding);
|
|
300
|
+
margin-top: 0;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
:is(.ds-modal-fixed .ds-modal) .ds-modal-header {
|
|
304
|
+
border-bottom: 1px solid var(--ds-color-split);
|
|
305
|
+
padding: calc(var(--ds-modal-padding) / 2) var(--ds-modal-padding);
|
|
306
|
+
margin-bottom: 0;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
:is(.ds-modal-fixed .ds-modal) .ds-modal-close {
|
|
310
|
+
top: 8px;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
:is(.ds-modal-content-overflow .ds-modal) .ds-modal-inner {
|
|
314
|
+
margin-top: 0;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
package/dist/Modal.js
CHANGED
|
@@ -6,13 +6,15 @@ import * as __WEBPACK_EXTERNAL_MODULE__bioturing_assets_dd0c210d__ from "@biotur
|
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_config_provider_6a57beb3__ from "antd/es/config-provider";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_theme_useToken_e8911485__ from "antd/es/theme/useToken";
|
|
9
|
-
import "tailwind-merge";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__ from "tailwind-merge";
|
|
10
10
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_modal_context_bc73863f__ from "antd/es/modal/context";
|
|
11
11
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_modal_components_NormalCancelBtn_54ff398c__ from "antd/es/modal/components/NormalCancelBtn";
|
|
12
12
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_modal_components_NormalOkBtn_897b50c4__ from "antd/es/modal/components/NormalOkBtn";
|
|
13
13
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_modal_locale_f16c0933__ from "antd/es/modal/locale";
|
|
14
14
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_locale_31079002__ from "antd/es/locale";
|
|
15
15
|
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
16
|
+
import * as __WEBPACK_EXTERNAL_MODULE__base_ui_components_react_use_render_2fb9dc6d__ from "@base-ui-components/react/use-render";
|
|
17
|
+
import * as __WEBPACK_EXTERNAL_MODULE__base_ui_components_react_merge_props_04b69945__ from "@base-ui-components/react/merge-props";
|
|
16
18
|
function cx(...args) {
|
|
17
19
|
const classes = [];
|
|
18
20
|
for (const arg of args)if (arg) {
|
|
@@ -24,6 +26,12 @@ function cx(...args) {
|
|
|
24
26
|
}
|
|
25
27
|
return classes;
|
|
26
28
|
}
|
|
29
|
+
function clsx(...args) {
|
|
30
|
+
return cx(...args).join(" ");
|
|
31
|
+
}
|
|
32
|
+
function cn(...args) {
|
|
33
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__.twMerge)(cx(...args));
|
|
34
|
+
}
|
|
27
35
|
"use client";
|
|
28
36
|
const useAntdCssVarClassname = ()=>{
|
|
29
37
|
var _token_;
|
|
@@ -98,9 +106,244 @@ var constants_ModalSize = /*#__PURE__*/ function(ModalSize) {
|
|
|
98
106
|
ModalSize["fullscreen"] = "100%";
|
|
99
107
|
return ModalSize;
|
|
100
108
|
}({});
|
|
109
|
+
const measureText = (container)=>{
|
|
110
|
+
const span = document.createElement("span");
|
|
111
|
+
span.style.opacity = "0";
|
|
112
|
+
span.style.position = "absolute";
|
|
113
|
+
span.style.top = "-1000px";
|
|
114
|
+
span.style.left = "-1000px";
|
|
115
|
+
span.style.whiteSpace = "nowrap";
|
|
116
|
+
span.style.pointerEvents = "none";
|
|
117
|
+
container.appendChild(span);
|
|
118
|
+
return {
|
|
119
|
+
measure: (text)=>{
|
|
120
|
+
span.innerText = text;
|
|
121
|
+
return span.clientWidth;
|
|
122
|
+
},
|
|
123
|
+
destroy: ()=>{
|
|
124
|
+
container.removeChild(span);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const getMiddleTruncatedString = (text, ellipsis, container)=>{
|
|
129
|
+
var _Object_values_reverse_find;
|
|
130
|
+
if (!text) return text;
|
|
131
|
+
const { measure: getTextWidth, destroy: destroyMeasure } = measureText(container);
|
|
132
|
+
const textWidth = getTextWidth(text);
|
|
133
|
+
const containerWidth = container.clientWidth;
|
|
134
|
+
const initialOffset = Math.floor(containerWidth / textWidth * text.length);
|
|
135
|
+
if (textWidth <= containerWidth) {
|
|
136
|
+
destroyMeasure();
|
|
137
|
+
return text;
|
|
138
|
+
}
|
|
139
|
+
let offset = initialOffset;
|
|
140
|
+
const attempts = {};
|
|
141
|
+
const maxAttempts = 20;
|
|
142
|
+
const buffer = 10;
|
|
143
|
+
while(Object.values(attempts).length <= maxAttempts){
|
|
144
|
+
if (attempts[offset]) break;
|
|
145
|
+
if (offset <= 1) {
|
|
146
|
+
attempts[0] = [
|
|
147
|
+
0,
|
|
148
|
+
ellipsis
|
|
149
|
+
];
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
const start = text.slice(0, Math.ceil((offset - ellipsis.length) / 2 - 1)).trimEnd();
|
|
153
|
+
const end = text.slice(Math.floor((offset - ellipsis.length) / 2) - offset).trimStart();
|
|
154
|
+
const truncatedStr = start + ellipsis + end;
|
|
155
|
+
const width = getTextWidth(truncatedStr);
|
|
156
|
+
attempts[offset] = [
|
|
157
|
+
width,
|
|
158
|
+
truncatedStr
|
|
159
|
+
];
|
|
160
|
+
if (width >= containerWidth) offset -= 2;
|
|
161
|
+
else {
|
|
162
|
+
if (containerWidth - width < buffer) break;
|
|
163
|
+
offset += 2;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
destroyMeasure();
|
|
167
|
+
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];
|
|
168
|
+
};
|
|
169
|
+
"use client";
|
|
170
|
+
const Truncate = ({ children, position = "end", lines = 1, className, style, ...rest })=>{
|
|
171
|
+
const cls = useCls();
|
|
172
|
+
const containerRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
|
|
173
|
+
const [isTruncated, setIsTruncated] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
174
|
+
const [truncatedText, setTruncatedText] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(children);
|
|
175
|
+
const text = children;
|
|
176
|
+
const getContainerStyles = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
|
|
177
|
+
if ("auto" !== lines) return {
|
|
178
|
+
...style,
|
|
179
|
+
...lines > 1 ? {
|
|
180
|
+
"--ds-line-clamp": lines
|
|
181
|
+
} : {}
|
|
182
|
+
};
|
|
183
|
+
return {
|
|
184
|
+
...style,
|
|
185
|
+
"--ds-line-clamp": 999
|
|
186
|
+
};
|
|
187
|
+
}, [
|
|
188
|
+
lines,
|
|
189
|
+
style
|
|
190
|
+
]);
|
|
191
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect)(()=>{
|
|
192
|
+
const container = containerRef.current;
|
|
193
|
+
if (!container) return;
|
|
194
|
+
if ("auto" === lines) {
|
|
195
|
+
var _window_document_fonts_ready, _window_document_fonts;
|
|
196
|
+
setTruncatedText(text);
|
|
197
|
+
const calculateLines = ()=>{
|
|
198
|
+
const parent = container.parentElement;
|
|
199
|
+
if (!parent) return;
|
|
200
|
+
const styles = window.getComputedStyle(container);
|
|
201
|
+
const fontSize = parseFloat(styles.fontSize);
|
|
202
|
+
const lineHeight = "normal" === styles.lineHeight ? 1.2 * fontSize : parseFloat(styles.lineHeight);
|
|
203
|
+
const parentStyles = window.getComputedStyle(parent);
|
|
204
|
+
const paddingTop = parseFloat(parentStyles.paddingTop) || 0;
|
|
205
|
+
const paddingBottom = parseFloat(parentStyles.paddingBottom) || 0;
|
|
206
|
+
const borderTopWidth = parseFloat(parentStyles.borderTopWidth) || 0;
|
|
207
|
+
const borderBottomWidth = parseFloat(parentStyles.borderBottomWidth) || 0;
|
|
208
|
+
const parentHeight = parent.clientHeight;
|
|
209
|
+
const availableHeight = parentHeight - paddingTop - paddingBottom - borderTopWidth - borderBottomWidth;
|
|
210
|
+
const maxLines = Math.max(1, Math.floor(availableHeight / lineHeight));
|
|
211
|
+
if (container) container.style.setProperty("--ds-line-clamp", String(maxLines));
|
|
212
|
+
const clone = document.createElement("span");
|
|
213
|
+
clone.style.visibility = "hidden";
|
|
214
|
+
clone.style.position = "absolute";
|
|
215
|
+
clone.style.width = `${container.clientWidth}px`;
|
|
216
|
+
clone.style.fontSize = styles.fontSize;
|
|
217
|
+
clone.style.fontFamily = styles.fontFamily;
|
|
218
|
+
clone.style.lineHeight = styles.lineHeight;
|
|
219
|
+
clone.textContent = text;
|
|
220
|
+
document.body.appendChild(clone);
|
|
221
|
+
const isTruncated = clone.scrollHeight > availableHeight;
|
|
222
|
+
document.body.removeChild(clone);
|
|
223
|
+
setIsTruncated(isTruncated);
|
|
224
|
+
};
|
|
225
|
+
null == (_window_document_fonts = window.document.fonts) || null == (_window_document_fonts_ready = _window_document_fonts.ready) || _window_document_fonts_ready.then(calculateLines);
|
|
226
|
+
const observer = new ResizeObserver(()=>{
|
|
227
|
+
window.requestAnimationFrame(calculateLines);
|
|
228
|
+
});
|
|
229
|
+
observer.observe(container);
|
|
230
|
+
if (container.parentElement) observer.observe(container.parentElement);
|
|
231
|
+
return ()=>observer.disconnect();
|
|
232
|
+
}
|
|
233
|
+
if ("number" == typeof lines && lines > 1) {
|
|
234
|
+
var _window_document_fonts_ready1, _window_document_fonts1;
|
|
235
|
+
setTruncatedText(text);
|
|
236
|
+
const checkIfTruncated = ()=>{
|
|
237
|
+
const clone = document.createElement("span");
|
|
238
|
+
clone.style.visibility = "hidden";
|
|
239
|
+
clone.style.position = "absolute";
|
|
240
|
+
clone.style.width = `${container.clientWidth}px`;
|
|
241
|
+
clone.textContent = text;
|
|
242
|
+
document.body.appendChild(clone);
|
|
243
|
+
const isTruncated = clone.scrollHeight > (container.clientHeight || container.offsetHeight);
|
|
244
|
+
document.body.removeChild(clone);
|
|
245
|
+
setIsTruncated(isTruncated);
|
|
246
|
+
};
|
|
247
|
+
null == (_window_document_fonts1 = window.document.fonts) || null == (_window_document_fonts_ready1 = _window_document_fonts1.ready) || _window_document_fonts_ready1.then(checkIfTruncated);
|
|
248
|
+
const observer = new ResizeObserver(()=>{
|
|
249
|
+
window.requestAnimationFrame(checkIfTruncated);
|
|
250
|
+
});
|
|
251
|
+
observer.observe(container);
|
|
252
|
+
return ()=>observer.disconnect();
|
|
253
|
+
}
|
|
254
|
+
let cancellationToken = {
|
|
255
|
+
cancelled: false
|
|
256
|
+
};
|
|
257
|
+
const calculateTruncatedString = ()=>{
|
|
258
|
+
if (cancellationToken) cancellationToken.cancelled = true;
|
|
259
|
+
const requestCancellationToken = {
|
|
260
|
+
cancelled: false
|
|
261
|
+
};
|
|
262
|
+
cancellationToken = requestCancellationToken;
|
|
263
|
+
const truncated = getMiddleTruncatedString(text, "\u2026", container);
|
|
264
|
+
if (requestCancellationToken.cancelled) return;
|
|
265
|
+
setTruncatedText(truncated);
|
|
266
|
+
};
|
|
267
|
+
if ("middle" == position) {
|
|
268
|
+
var _window_document_fonts_ready2, _window_document_fonts2;
|
|
269
|
+
null == (_window_document_fonts2 = window.document.fonts) || null == (_window_document_fonts_ready2 = _window_document_fonts2.ready) || _window_document_fonts_ready2.then(calculateTruncatedString);
|
|
270
|
+
}
|
|
271
|
+
if ("end" == position) setTruncatedText(text);
|
|
272
|
+
const observer = new ResizeObserver(()=>{
|
|
273
|
+
if ("middle" == position) window.requestAnimationFrame(calculateTruncatedString);
|
|
274
|
+
if ("end" == position) {
|
|
275
|
+
const isOverflowing = container.scrollWidth > container.clientWidth;
|
|
276
|
+
if (isOverflowing) setIsTruncated(true);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
observer.observe(container);
|
|
280
|
+
return ()=>{
|
|
281
|
+
cancellationToken.cancelled = true;
|
|
282
|
+
observer.disconnect();
|
|
283
|
+
};
|
|
284
|
+
}, [
|
|
285
|
+
text,
|
|
286
|
+
position,
|
|
287
|
+
lines
|
|
288
|
+
]);
|
|
289
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
|
|
290
|
+
ref: containerRef,
|
|
291
|
+
style: getContainerStyles(),
|
|
292
|
+
className: clsx(1 === lines ? cls("truncate") : cls("truncate-multiline"), "middle" === position ? cls("truncate-middle") : cls("truncate-end"), className),
|
|
293
|
+
title: isTruncated ? text : void 0,
|
|
294
|
+
...rest,
|
|
295
|
+
children: text === truncatedText ? text : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
|
|
296
|
+
children: truncatedText
|
|
297
|
+
})
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
const Stack = ({ hug = false, align = "flex-start", justify = "flex-start", vertical = false, gap = 0, wrap = false, className, children, ...rest })=>{
|
|
301
|
+
const cls = useCls();
|
|
302
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
303
|
+
className: cn(cls("stack"), hug ? cls("stack-hug") : cls("stack-fill"), cls(`stack-gap-${gap}`), vertical ? cls("stack-vertical") : cls("stack-horizontal"), wrap && cls("stack-wrap"), cls(`stack-align-${align}`), cls(`stack-justify-${justify}`), className),
|
|
304
|
+
...rest,
|
|
305
|
+
children: children
|
|
306
|
+
});
|
|
307
|
+
};
|
|
308
|
+
const StackChild = ({ flex, grow = false, shrink = false, children, style, stack = false, hug = false, align = "flex-start", justify = "flex-start", vertical = false, gap = 0, wrap = false, className, ...rest })=>{
|
|
309
|
+
const cls = useCls();
|
|
310
|
+
const stackProps = {
|
|
311
|
+
hug,
|
|
312
|
+
align,
|
|
313
|
+
justify,
|
|
314
|
+
vertical,
|
|
315
|
+
gap,
|
|
316
|
+
wrap
|
|
317
|
+
};
|
|
318
|
+
let flexClass = "";
|
|
319
|
+
if ("boolean" == typeof flex) flexClass = flex ? cls("stack-child-flex-1") : cls("stack-child-flex-0");
|
|
320
|
+
const combinedClassName = cn(cls("stack-child"), grow && cls("stack-child-grow"), shrink && cls("stack-child-shrink"), flexClass, className);
|
|
321
|
+
const flexValue = "string" == typeof flex || "number" == typeof flex ? flex : void 0;
|
|
322
|
+
const { renderElement } = (0, __WEBPACK_EXTERNAL_MODULE__base_ui_components_react_use_render_2fb9dc6d__.useRender)({
|
|
323
|
+
render: ()=>/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].isValidElement(children) ? children : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
324
|
+
children: children
|
|
325
|
+
}),
|
|
326
|
+
props: (0, __WEBPACK_EXTERNAL_MODULE__base_ui_components_react_merge_props_04b69945__.mergeProps)({
|
|
327
|
+
className: combinedClassName,
|
|
328
|
+
style: {
|
|
329
|
+
...style,
|
|
330
|
+
flex: flexValue
|
|
331
|
+
},
|
|
332
|
+
...rest
|
|
333
|
+
})
|
|
334
|
+
});
|
|
335
|
+
return stack ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Stack, {
|
|
336
|
+
...stackProps,
|
|
337
|
+
className: combinedClassName,
|
|
338
|
+
children: children
|
|
339
|
+
}) : renderElement();
|
|
340
|
+
};
|
|
341
|
+
const Stack_Stack = Object.assign(Stack, {
|
|
342
|
+
Child: StackChild
|
|
343
|
+
});
|
|
101
344
|
"use client";
|
|
102
345
|
const Modal = ({ open: externalOpen, closeIcon, children, size: sizeProp, footer, width, style, styles, classNames, okButtonProps, cancelButtonProps, loading, onOk, onCancel, okText, okType = "primary", confirmLoading, cancelText = "Close", hideOkButton = false, hideCancelButton = false, contentPadding, title, afterTitle, beforeCloseButton, afterCloseButton, defaultFixedHeaderFooter = false, centered = true, type = "default", defaultOpen = true, background: backgroundProp, bodyScrollable = true, ...rest })=>{
|
|
103
|
-
const defaultCloseIcon = void 0 === closeIcon ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__bioturing_assets_dd0c210d__.
|
|
346
|
+
const defaultCloseIcon = void 0 === closeIcon ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__bioturing_assets_dd0c210d__.XIcon, {
|
|
104
347
|
size: 16,
|
|
105
348
|
weight: "bold"
|
|
106
349
|
}) : closeIcon;
|
|
@@ -183,17 +426,21 @@ const Modal = ({ open: externalOpen, closeIcon, children, size: sizeProp, footer
|
|
|
183
426
|
});
|
|
184
427
|
const renderTitle = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
|
|
185
428
|
children: [
|
|
186
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(
|
|
429
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(Stack_Stack, {
|
|
187
430
|
align: "center",
|
|
188
431
|
gap: 8,
|
|
189
432
|
className: cls("modal-title-wrapper"),
|
|
190
433
|
children: [
|
|
191
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(
|
|
192
|
-
|
|
193
|
-
children: title
|
|
434
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Stack_Stack.Child, {
|
|
435
|
+
grow: true,
|
|
436
|
+
children: "string" == typeof title ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Truncate, {
|
|
437
|
+
children: title
|
|
438
|
+
}) : title
|
|
194
439
|
}),
|
|
195
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(
|
|
196
|
-
|
|
440
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(Stack_Stack.Child, {
|
|
441
|
+
stack: true,
|
|
442
|
+
hug: true,
|
|
443
|
+
align: "center",
|
|
197
444
|
children: [
|
|
198
445
|
beforeCloseButton,
|
|
199
446
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(IconButton, {
|
|
@@ -216,7 +463,7 @@ const Modal = ({ open: externalOpen, closeIcon, children, size: sizeProp, footer
|
|
|
216
463
|
title: renderTitle(),
|
|
217
464
|
classNames: {
|
|
218
465
|
...classNames,
|
|
219
|
-
wrapper: cls("modal-wrap", "fullscreen" == size && "modal-fullscreen", isContentOverflow && "modal-content-overflow", false === bodyScrollable && "modal-no-body-scroll",
|
|
466
|
+
wrapper: cls("modal-wrap", "fullscreen" == size && "modal-fullscreen", isContentOverflow && "modal-content-overflow", false === bodyScrollable && "modal-no-body-scroll", defaultFixedHeaderFooter || isContentOverflow || "fullscreen" == size ? "modal-fixed" : "")
|
|
220
467
|
},
|
|
221
468
|
styles: modalStyles,
|
|
222
469
|
modalRender: (modal)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|