@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/DSRoot.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/j
|
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_config_provider_6a57beb3__ from "antd/es/config-provider";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_theme_useToken_e8911485__ from "antd/es/theme/useToken";
|
|
5
|
-
import "tailwind-merge";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__ from "tailwind-merge";
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_cssinjs_c619260f__ from "@ant-design/cssinjs";
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE__bioturing_assets_dd0c210d__ from "@bioturing/assets";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__base_ui_components_react_5aaa6934__ from "@base-ui-components/react";
|
|
@@ -15,6 +15,8 @@ import * as __WEBPACK_EXTERNAL_MODULE_antd_es_modal_components_NormalCancelBtn_5
|
|
|
15
15
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_modal_components_NormalOkBtn_897b50c4__ from "antd/es/modal/components/NormalOkBtn";
|
|
16
16
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_modal_locale_f16c0933__ from "antd/es/modal/locale";
|
|
17
17
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_locale_31079002__ from "antd/es/locale";
|
|
18
|
+
import * as __WEBPACK_EXTERNAL_MODULE__base_ui_components_react_use_render_2fb9dc6d__ from "@base-ui-components/react/use-render";
|
|
19
|
+
import * as __WEBPACK_EXTERNAL_MODULE__base_ui_components_react_merge_props_04b69945__ from "@base-ui-components/react/merge-props";
|
|
18
20
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_segmented_6dbdbe23__ from "antd/es/segmented";
|
|
19
21
|
import * as __WEBPACK_EXTERNAL_MODULE_prism_react_renderer_be33806e__ from "prism-react-renderer";
|
|
20
22
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_app_App_698582f4__ from "antd/es/app/App";
|
|
@@ -375,6 +377,9 @@ function cx(...args) {
|
|
|
375
377
|
function clsx(...args) {
|
|
376
378
|
return cx(...args).join(" ");
|
|
377
379
|
}
|
|
380
|
+
function cn(...args) {
|
|
381
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__.twMerge)(cx(...args));
|
|
382
|
+
}
|
|
378
383
|
"use client";
|
|
379
384
|
const useAntdCssVarClassname = ()=>{
|
|
380
385
|
var _token_;
|
|
@@ -524,9 +529,244 @@ var constants_ModalSize = /*#__PURE__*/ function(ModalSize) {
|
|
|
524
529
|
ModalSize["fullscreen"] = "100%";
|
|
525
530
|
return ModalSize;
|
|
526
531
|
}({});
|
|
532
|
+
const measureText = (container)=>{
|
|
533
|
+
const span = document.createElement("span");
|
|
534
|
+
span.style.opacity = "0";
|
|
535
|
+
span.style.position = "absolute";
|
|
536
|
+
span.style.top = "-1000px";
|
|
537
|
+
span.style.left = "-1000px";
|
|
538
|
+
span.style.whiteSpace = "nowrap";
|
|
539
|
+
span.style.pointerEvents = "none";
|
|
540
|
+
container.appendChild(span);
|
|
541
|
+
return {
|
|
542
|
+
measure: (text)=>{
|
|
543
|
+
span.innerText = text;
|
|
544
|
+
return span.clientWidth;
|
|
545
|
+
},
|
|
546
|
+
destroy: ()=>{
|
|
547
|
+
container.removeChild(span);
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
};
|
|
551
|
+
const getMiddleTruncatedString = (text, ellipsis, container)=>{
|
|
552
|
+
var _Object_values_reverse_find;
|
|
553
|
+
if (!text) return text;
|
|
554
|
+
const { measure: getTextWidth, destroy: destroyMeasure } = measureText(container);
|
|
555
|
+
const textWidth = getTextWidth(text);
|
|
556
|
+
const containerWidth = container.clientWidth;
|
|
557
|
+
const initialOffset = Math.floor(containerWidth / textWidth * text.length);
|
|
558
|
+
if (textWidth <= containerWidth) {
|
|
559
|
+
destroyMeasure();
|
|
560
|
+
return text;
|
|
561
|
+
}
|
|
562
|
+
let offset = initialOffset;
|
|
563
|
+
const attempts = {};
|
|
564
|
+
const maxAttempts = 20;
|
|
565
|
+
const buffer = 10;
|
|
566
|
+
while(Object.values(attempts).length <= maxAttempts){
|
|
567
|
+
if (attempts[offset]) break;
|
|
568
|
+
if (offset <= 1) {
|
|
569
|
+
attempts[0] = [
|
|
570
|
+
0,
|
|
571
|
+
ellipsis
|
|
572
|
+
];
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
const start = text.slice(0, Math.ceil((offset - ellipsis.length) / 2 - 1)).trimEnd();
|
|
576
|
+
const end = text.slice(Math.floor((offset - ellipsis.length) / 2) - offset).trimStart();
|
|
577
|
+
const truncatedStr = start + ellipsis + end;
|
|
578
|
+
const width = getTextWidth(truncatedStr);
|
|
579
|
+
attempts[offset] = [
|
|
580
|
+
width,
|
|
581
|
+
truncatedStr
|
|
582
|
+
];
|
|
583
|
+
if (width >= containerWidth) offset -= 2;
|
|
584
|
+
else {
|
|
585
|
+
if (containerWidth - width < buffer) break;
|
|
586
|
+
offset += 2;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
destroyMeasure();
|
|
590
|
+
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];
|
|
591
|
+
};
|
|
592
|
+
"use client";
|
|
593
|
+
const Truncate = ({ children, position = "end", lines = 1, className, style, ...rest })=>{
|
|
594
|
+
const cls = useCls();
|
|
595
|
+
const containerRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
|
|
596
|
+
const [isTruncated, setIsTruncated] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
597
|
+
const [truncatedText, setTruncatedText] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(children);
|
|
598
|
+
const text = children;
|
|
599
|
+
const getContainerStyles = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
|
|
600
|
+
if ("auto" !== lines) return {
|
|
601
|
+
...style,
|
|
602
|
+
...lines > 1 ? {
|
|
603
|
+
"--ds-line-clamp": lines
|
|
604
|
+
} : {}
|
|
605
|
+
};
|
|
606
|
+
return {
|
|
607
|
+
...style,
|
|
608
|
+
"--ds-line-clamp": 999
|
|
609
|
+
};
|
|
610
|
+
}, [
|
|
611
|
+
lines,
|
|
612
|
+
style
|
|
613
|
+
]);
|
|
614
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect)(()=>{
|
|
615
|
+
const container = containerRef.current;
|
|
616
|
+
if (!container) return;
|
|
617
|
+
if ("auto" === lines) {
|
|
618
|
+
var _window_document_fonts_ready, _window_document_fonts;
|
|
619
|
+
setTruncatedText(text);
|
|
620
|
+
const calculateLines = ()=>{
|
|
621
|
+
const parent = container.parentElement;
|
|
622
|
+
if (!parent) return;
|
|
623
|
+
const styles = window.getComputedStyle(container);
|
|
624
|
+
const fontSize = parseFloat(styles.fontSize);
|
|
625
|
+
const lineHeight = "normal" === styles.lineHeight ? 1.2 * fontSize : parseFloat(styles.lineHeight);
|
|
626
|
+
const parentStyles = window.getComputedStyle(parent);
|
|
627
|
+
const paddingTop = parseFloat(parentStyles.paddingTop) || 0;
|
|
628
|
+
const paddingBottom = parseFloat(parentStyles.paddingBottom) || 0;
|
|
629
|
+
const borderTopWidth = parseFloat(parentStyles.borderTopWidth) || 0;
|
|
630
|
+
const borderBottomWidth = parseFloat(parentStyles.borderBottomWidth) || 0;
|
|
631
|
+
const parentHeight = parent.clientHeight;
|
|
632
|
+
const availableHeight = parentHeight - paddingTop - paddingBottom - borderTopWidth - borderBottomWidth;
|
|
633
|
+
const maxLines = Math.max(1, Math.floor(availableHeight / lineHeight));
|
|
634
|
+
if (container) container.style.setProperty("--ds-line-clamp", String(maxLines));
|
|
635
|
+
const clone = document.createElement("span");
|
|
636
|
+
clone.style.visibility = "hidden";
|
|
637
|
+
clone.style.position = "absolute";
|
|
638
|
+
clone.style.width = `${container.clientWidth}px`;
|
|
639
|
+
clone.style.fontSize = styles.fontSize;
|
|
640
|
+
clone.style.fontFamily = styles.fontFamily;
|
|
641
|
+
clone.style.lineHeight = styles.lineHeight;
|
|
642
|
+
clone.textContent = text;
|
|
643
|
+
document.body.appendChild(clone);
|
|
644
|
+
const isTruncated = clone.scrollHeight > availableHeight;
|
|
645
|
+
document.body.removeChild(clone);
|
|
646
|
+
setIsTruncated(isTruncated);
|
|
647
|
+
};
|
|
648
|
+
null == (_window_document_fonts = window.document.fonts) || null == (_window_document_fonts_ready = _window_document_fonts.ready) || _window_document_fonts_ready.then(calculateLines);
|
|
649
|
+
const observer = new ResizeObserver(()=>{
|
|
650
|
+
window.requestAnimationFrame(calculateLines);
|
|
651
|
+
});
|
|
652
|
+
observer.observe(container);
|
|
653
|
+
if (container.parentElement) observer.observe(container.parentElement);
|
|
654
|
+
return ()=>observer.disconnect();
|
|
655
|
+
}
|
|
656
|
+
if ("number" == typeof lines && lines > 1) {
|
|
657
|
+
var _window_document_fonts_ready1, _window_document_fonts1;
|
|
658
|
+
setTruncatedText(text);
|
|
659
|
+
const checkIfTruncated = ()=>{
|
|
660
|
+
const clone = document.createElement("span");
|
|
661
|
+
clone.style.visibility = "hidden";
|
|
662
|
+
clone.style.position = "absolute";
|
|
663
|
+
clone.style.width = `${container.clientWidth}px`;
|
|
664
|
+
clone.textContent = text;
|
|
665
|
+
document.body.appendChild(clone);
|
|
666
|
+
const isTruncated = clone.scrollHeight > (container.clientHeight || container.offsetHeight);
|
|
667
|
+
document.body.removeChild(clone);
|
|
668
|
+
setIsTruncated(isTruncated);
|
|
669
|
+
};
|
|
670
|
+
null == (_window_document_fonts1 = window.document.fonts) || null == (_window_document_fonts_ready1 = _window_document_fonts1.ready) || _window_document_fonts_ready1.then(checkIfTruncated);
|
|
671
|
+
const observer = new ResizeObserver(()=>{
|
|
672
|
+
window.requestAnimationFrame(checkIfTruncated);
|
|
673
|
+
});
|
|
674
|
+
observer.observe(container);
|
|
675
|
+
return ()=>observer.disconnect();
|
|
676
|
+
}
|
|
677
|
+
let cancellationToken = {
|
|
678
|
+
cancelled: false
|
|
679
|
+
};
|
|
680
|
+
const calculateTruncatedString = ()=>{
|
|
681
|
+
if (cancellationToken) cancellationToken.cancelled = true;
|
|
682
|
+
const requestCancellationToken = {
|
|
683
|
+
cancelled: false
|
|
684
|
+
};
|
|
685
|
+
cancellationToken = requestCancellationToken;
|
|
686
|
+
const truncated = getMiddleTruncatedString(text, "\u2026", container);
|
|
687
|
+
if (requestCancellationToken.cancelled) return;
|
|
688
|
+
setTruncatedText(truncated);
|
|
689
|
+
};
|
|
690
|
+
if ("middle" == position) {
|
|
691
|
+
var _window_document_fonts_ready2, _window_document_fonts2;
|
|
692
|
+
null == (_window_document_fonts2 = window.document.fonts) || null == (_window_document_fonts_ready2 = _window_document_fonts2.ready) || _window_document_fonts_ready2.then(calculateTruncatedString);
|
|
693
|
+
}
|
|
694
|
+
if ("end" == position) setTruncatedText(text);
|
|
695
|
+
const observer = new ResizeObserver(()=>{
|
|
696
|
+
if ("middle" == position) window.requestAnimationFrame(calculateTruncatedString);
|
|
697
|
+
if ("end" == position) {
|
|
698
|
+
const isOverflowing = container.scrollWidth > container.clientWidth;
|
|
699
|
+
if (isOverflowing) setIsTruncated(true);
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
observer.observe(container);
|
|
703
|
+
return ()=>{
|
|
704
|
+
cancellationToken.cancelled = true;
|
|
705
|
+
observer.disconnect();
|
|
706
|
+
};
|
|
707
|
+
}, [
|
|
708
|
+
text,
|
|
709
|
+
position,
|
|
710
|
+
lines
|
|
711
|
+
]);
|
|
712
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
|
|
713
|
+
ref: containerRef,
|
|
714
|
+
style: getContainerStyles(),
|
|
715
|
+
className: clsx(1 === lines ? cls("truncate") : cls("truncate-multiline"), "middle" === position ? cls("truncate-middle") : cls("truncate-end"), className),
|
|
716
|
+
title: isTruncated ? text : void 0,
|
|
717
|
+
...rest,
|
|
718
|
+
children: text === truncatedText ? text : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
|
|
719
|
+
children: truncatedText
|
|
720
|
+
})
|
|
721
|
+
});
|
|
722
|
+
};
|
|
723
|
+
const Stack = ({ hug = false, align = "flex-start", justify = "flex-start", vertical = false, gap = 0, wrap = false, className, children, ...rest })=>{
|
|
724
|
+
const cls = useCls();
|
|
725
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
726
|
+
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),
|
|
727
|
+
...rest,
|
|
728
|
+
children: children
|
|
729
|
+
});
|
|
730
|
+
};
|
|
731
|
+
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 })=>{
|
|
732
|
+
const cls = useCls();
|
|
733
|
+
const stackProps = {
|
|
734
|
+
hug,
|
|
735
|
+
align,
|
|
736
|
+
justify,
|
|
737
|
+
vertical,
|
|
738
|
+
gap,
|
|
739
|
+
wrap
|
|
740
|
+
};
|
|
741
|
+
let flexClass = "";
|
|
742
|
+
if ("boolean" == typeof flex) flexClass = flex ? cls("stack-child-flex-1") : cls("stack-child-flex-0");
|
|
743
|
+
const combinedClassName = cn(cls("stack-child"), grow && cls("stack-child-grow"), shrink && cls("stack-child-shrink"), flexClass, className);
|
|
744
|
+
const flexValue = "string" == typeof flex || "number" == typeof flex ? flex : void 0;
|
|
745
|
+
const { renderElement } = (0, __WEBPACK_EXTERNAL_MODULE__base_ui_components_react_use_render_2fb9dc6d__.useRender)({
|
|
746
|
+
render: ()=>/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].isValidElement(children) ? children : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
747
|
+
children: children
|
|
748
|
+
}),
|
|
749
|
+
props: (0, __WEBPACK_EXTERNAL_MODULE__base_ui_components_react_merge_props_04b69945__.mergeProps)({
|
|
750
|
+
className: combinedClassName,
|
|
751
|
+
style: {
|
|
752
|
+
...style,
|
|
753
|
+
flex: flexValue
|
|
754
|
+
},
|
|
755
|
+
...rest
|
|
756
|
+
})
|
|
757
|
+
});
|
|
758
|
+
return stack ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Stack, {
|
|
759
|
+
...stackProps,
|
|
760
|
+
className: combinedClassName,
|
|
761
|
+
children: children
|
|
762
|
+
}) : renderElement();
|
|
763
|
+
};
|
|
764
|
+
const Stack_Stack = Object.assign(Stack, {
|
|
765
|
+
Child: StackChild
|
|
766
|
+
});
|
|
527
767
|
"use client";
|
|
528
768
|
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 })=>{
|
|
529
|
-
const defaultCloseIcon = void 0 === closeIcon ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__bioturing_assets_dd0c210d__.
|
|
769
|
+
const defaultCloseIcon = void 0 === closeIcon ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__bioturing_assets_dd0c210d__.XIcon, {
|
|
530
770
|
size: 16,
|
|
531
771
|
weight: "bold"
|
|
532
772
|
}) : closeIcon;
|
|
@@ -609,17 +849,21 @@ const Modal = ({ open: externalOpen, closeIcon, children, size: sizeProp, footer
|
|
|
609
849
|
});
|
|
610
850
|
const renderTitle = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
|
|
611
851
|
children: [
|
|
612
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(
|
|
852
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(Stack_Stack, {
|
|
613
853
|
align: "center",
|
|
614
854
|
gap: 8,
|
|
615
855
|
className: cls("modal-title-wrapper"),
|
|
616
856
|
children: [
|
|
617
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(
|
|
618
|
-
|
|
619
|
-
children: title
|
|
857
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Stack_Stack.Child, {
|
|
858
|
+
grow: true,
|
|
859
|
+
children: "string" == typeof title ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Truncate, {
|
|
860
|
+
children: title
|
|
861
|
+
}) : title
|
|
620
862
|
}),
|
|
621
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(
|
|
622
|
-
|
|
863
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(Stack_Stack.Child, {
|
|
864
|
+
stack: true,
|
|
865
|
+
hug: true,
|
|
866
|
+
align: "center",
|
|
623
867
|
children: [
|
|
624
868
|
beforeCloseButton,
|
|
625
869
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(IconButton, {
|
|
@@ -642,7 +886,7 @@ const Modal = ({ open: externalOpen, closeIcon, children, size: sizeProp, footer
|
|
|
642
886
|
title: renderTitle(),
|
|
643
887
|
classNames: {
|
|
644
888
|
...classNames,
|
|
645
|
-
wrapper: cls("modal-wrap", "fullscreen" == size && "modal-fullscreen", isContentOverflow && "modal-content-overflow", false === bodyScrollable && "modal-no-body-scroll",
|
|
889
|
+
wrapper: cls("modal-wrap", "fullscreen" == size && "modal-fullscreen", isContentOverflow && "modal-content-overflow", false === bodyScrollable && "modal-no-body-scroll", defaultFixedHeaderFooter || isContentOverflow || "fullscreen" == size ? "modal-fixed" : "")
|
|
646
890
|
},
|
|
647
891
|
styles: modalStyles,
|
|
648
892
|
modalRender: (modal)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
@@ -855,24 +1099,24 @@ const Modal_Modal = Object.assign(Modal, {
|
|
|
855
1099
|
useModal
|
|
856
1100
|
});
|
|
857
1101
|
"use client";
|
|
858
|
-
const ScrollArea = ({ children, className,
|
|
1102
|
+
const ScrollArea = ({ children, className, classNames = {}, orientation = "vertical" })=>{
|
|
859
1103
|
const cls = useCls();
|
|
860
1104
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__base_ui_components_react_5aaa6934__.ScrollArea.Root, {
|
|
861
1105
|
className: clsx(cls("scroll-area"), className),
|
|
862
1106
|
children: [
|
|
863
1107
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__base_ui_components_react_5aaa6934__.ScrollArea.Viewport, {
|
|
864
|
-
className: clsx(cls("scroll-area-viewport"),
|
|
1108
|
+
className: clsx(cls("scroll-area-viewport"), null == classNames ? void 0 : classNames.viewport),
|
|
865
1109
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__base_ui_components_react_5aaa6934__.ScrollArea.Content, {
|
|
866
1110
|
className: clsx(cls("scroll-area-content")),
|
|
867
1111
|
children: children
|
|
868
1112
|
})
|
|
869
1113
|
}),
|
|
870
1114
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__base_ui_components_react_5aaa6934__.ScrollArea.Scrollbar, {
|
|
871
|
-
className: clsx(cls("scroll-area-scrollbar"),
|
|
1115
|
+
className: clsx(cls("scroll-area-scrollbar"), null == classNames ? void 0 : classNames.scrollbar),
|
|
872
1116
|
orientation: orientation,
|
|
873
1117
|
"data-orientation": orientation,
|
|
874
1118
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__base_ui_components_react_5aaa6934__.ScrollArea.Thumb, {
|
|
875
|
-
className: clsx(cls("scroll-area-thumb",
|
|
1119
|
+
className: clsx(cls("scroll-area-thumb"), null == classNames ? void 0 : classNames.thumb)
|
|
876
1120
|
})
|
|
877
1121
|
})
|
|
878
1122
|
]
|
|
@@ -931,7 +1175,7 @@ function reactNodeToString(node) {
|
|
|
931
1175
|
return "";
|
|
932
1176
|
}
|
|
933
1177
|
"use client";
|
|
934
|
-
const CodeBlock = ({ code, children, lang: defaultLang = "tsx", className, options, activeOption: controlledActiveOption, defaultActiveOption = 0, onActiveOptionChange, copyText = "Copy", copySuccessText = "Copied", ...rest })=>{
|
|
1178
|
+
const CodeBlock = ({ code, children, lang: defaultLang = "tsx", className, options, activeOption: controlledActiveOption, defaultActiveOption = 0, onActiveOptionChange, copyText = "Copy", copySuccessText = "Copied", classNames, maxHeight, ...rest })=>{
|
|
935
1179
|
const [activeOption, setActiveOption] = useControlledState(controlledActiveOption, onActiveOptionChange, defaultActiveOption);
|
|
936
1180
|
const [currentCode, setCurrentCode] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(code || "");
|
|
937
1181
|
const [lang, setLang] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(defaultLang);
|
|
@@ -974,11 +1218,11 @@ const CodeBlock = ({ code, children, lang: defaultLang = "tsx", className, optio
|
|
|
974
1218
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ThemeProvider, {
|
|
975
1219
|
theme: "dark",
|
|
976
1220
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(WithAntdTokens, {
|
|
977
|
-
className: clsx(cls("code-block"), className),
|
|
1221
|
+
className: clsx(cls("code-block"), className, null == classNames ? void 0 : classNames.root),
|
|
978
1222
|
...rest,
|
|
979
1223
|
children: [
|
|
980
1224
|
hasOptions && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
981
|
-
className: cls("code-block-header"),
|
|
1225
|
+
className: cls("code-block-header", null == classNames ? void 0 : classNames.header),
|
|
982
1226
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Segmented, {
|
|
983
1227
|
value: activeOption,
|
|
984
1228
|
onChange: setActiveOption,
|
|
@@ -998,7 +1242,10 @@ const CodeBlock = ({ code, children, lang: defaultLang = "tsx", className, optio
|
|
|
998
1242
|
})
|
|
999
1243
|
}),
|
|
1000
1244
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
1001
|
-
className: cls("code-block-content"),
|
|
1245
|
+
className: cls("code-block-content", null == classNames ? void 0 : classNames.content),
|
|
1246
|
+
style: {
|
|
1247
|
+
maxHeight: maxHeight && ("number" == typeof maxHeight ? `${maxHeight}px` : maxHeight)
|
|
1248
|
+
},
|
|
1002
1249
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ScrollArea, {
|
|
1003
1250
|
children: currentCode ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_prism_react_renderer_be33806e__.Highlight, {
|
|
1004
1251
|
language: lang,
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-dropdown-menu {
|
|
3
|
+
box-shadow: var(--ds-box-shadow-secondary);
|
|
4
|
+
border-radius: var(--ds-border-radius);
|
|
5
|
+
background: var(--ds-color-bg-elevated);
|
|
6
|
+
color: var(--ds-color-text);
|
|
7
|
+
font-size: var(--ds-font-size);
|
|
8
|
+
font-family: var(--ds-font-family);
|
|
9
|
+
transition-property: transform, scale, opacity;
|
|
10
|
+
transition-duration: .2s;
|
|
11
|
+
transition-timing-function: var(--ds-motion-ease-out);
|
|
12
|
+
transform-origin: var(--transform-origin);
|
|
13
|
+
padding: .25rem;
|
|
14
|
+
list-style: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ds-dropdown-menu[data-ending-style], .ds-dropdown-menu[data-starting-style] {
|
|
18
|
+
opacity: 0;
|
|
19
|
+
transform: scale(.9);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ds-dropdown-menu:focus {
|
|
23
|
+
outline: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ds-dropdown-menu-item {
|
|
27
|
+
border-radius: var(--ds-border-radius-sm);
|
|
28
|
+
transition: all .3s var(--ds-motion-ease-out);
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
align-items: center;
|
|
31
|
+
padding: .375rem .75rem;
|
|
32
|
+
display: flex;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ds-dropdown-menu-item:focus {
|
|
36
|
+
outline: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ds-dropdown-menu-item:hover {
|
|
40
|
+
background: var(--ds-control-item-bg-hover);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ds-dropdown-menu-item:active, .ds-dropdown-menu-item:focus, .ds-dropdown-menu-item[data-focus] {
|
|
44
|
+
background: var(--ds-control-item-bg-active);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.ds-dropdown-menu-item[data-disabled] {
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
color: var(--ds-color-text-disabled);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ds-dropdown-menu-item[data-danger] {
|
|
53
|
+
color: var(--ds-color-error);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ds-dropdown-menu-item[data-danger]:hover {
|
|
57
|
+
background: var(--ds-color-error-bg);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ds-dropdown-menu-item[data-danger]:active, .ds-dropdown-menu-item[data-danger]:focus, .ds-dropdown-menu-item[data-danger][data-focus] {
|
|
61
|
+
background: var(--ds-color-error-bg-hover);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ds-dropdown-menu-item-icon {
|
|
65
|
+
color: var(--ds-color-icon);
|
|
66
|
+
justify-content: center;
|
|
67
|
+
align-items: center;
|
|
68
|
+
margin-right: .5rem;
|
|
69
|
+
font-size: 1rem;
|
|
70
|
+
display: flex;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
[data-danger] .ds-dropdown-menu-item-icon {
|
|
74
|
+
color: var(--ds-color-error);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ds-dropdown-menu-divider {
|
|
78
|
+
border-bottom: 1px solid var(--ds-color-split);
|
|
79
|
+
margin: .25rem 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ds-dropdown-menu-header {
|
|
83
|
+
text-transform: uppercase;
|
|
84
|
+
color: var(--ds-color-text-tertiary);
|
|
85
|
+
padding: .75rem .75rem .25rem;
|
|
86
|
+
font-size: .75rem;
|
|
87
|
+
font-weight: 500;
|
|
88
|
+
line-height: 1rem;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.ds-dropdown-menu-header:first-child {
|
|
92
|
+
padding-top: .5rem;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
package/dist/Empty.css
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-empty .ds-empty-image {
|
|
3
|
+
height: auto;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.ds-empty-small .ds-empty-icon {
|
|
7
|
+
color: var(--ds-color-base-solid);
|
|
8
|
+
font-size: 2rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ds-empty-medium .ds-empty-icon {
|
|
12
|
+
font-size: 3rem;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ds-empty-large .ds-empty-icon {
|
|
16
|
+
font-size: 4rem;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
package/dist/Field.css
ADDED
package/dist/Form.css
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-icon-button {
|
|
3
|
+
cursor: pointer;
|
|
4
|
+
color: var(--ds-color-icon);
|
|
5
|
+
background-color: #0000;
|
|
6
|
+
border: none;
|
|
7
|
+
border-radius: 999px;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
align-items: center;
|
|
10
|
+
transition: all .2s;
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ds-icon-button:hover {
|
|
15
|
+
background-color: var(--ds-color-fill-secondary);
|
|
16
|
+
color: var(--ds-color-icon-hover);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ds-icon-button:active, .ds-icon-button.ds-popover-open {
|
|
20
|
+
background-color: var(--ds-color-primary-bg);
|
|
21
|
+
color: var(--ds-color-primary);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ds-icon-button:focus {
|
|
25
|
+
outline: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ds-icon-button:disabled {
|
|
29
|
+
cursor: not-allowed;
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
color: var(--ds-color-text-disabled);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ds-icon-button.ds-icon-button-medium {
|
|
35
|
+
width: 1.5rem;
|
|
36
|
+
height: 1.5rem;
|
|
37
|
+
padding: .125rem;
|
|
38
|
+
font-size: 1.25rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ds-icon-button.ds-icon-button-small {
|
|
42
|
+
width: 1.25rem;
|
|
43
|
+
height: 1.25rem;
|
|
44
|
+
padding: .125rem;
|
|
45
|
+
font-size: 1rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ds-icon-button.ds-icon-button-negative-margin {
|
|
49
|
+
margin: -.125rem;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@layer components {
|
|
54
|
+
.ds-form-item-label-inner {
|
|
55
|
+
align-items: center;
|
|
56
|
+
gap: .25rem;
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ds-form-item-label-optional-mark {
|
|
61
|
+
color: var(--ds-color-text-tertiary);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-icon-button {
|
|
3
|
+
cursor: pointer;
|
|
4
|
+
color: var(--ds-color-icon);
|
|
5
|
+
background-color: #0000;
|
|
6
|
+
border: none;
|
|
7
|
+
border-radius: 999px;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
align-items: center;
|
|
10
|
+
transition: all .2s;
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ds-icon-button:hover {
|
|
15
|
+
background-color: var(--ds-color-fill-secondary);
|
|
16
|
+
color: var(--ds-color-icon-hover);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ds-icon-button:active, .ds-icon-button.ds-popover-open {
|
|
20
|
+
background-color: var(--ds-color-primary-bg);
|
|
21
|
+
color: var(--ds-color-primary);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ds-icon-button:focus {
|
|
25
|
+
outline: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ds-icon-button:disabled {
|
|
29
|
+
cursor: not-allowed;
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
color: var(--ds-color-text-disabled);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ds-icon-button.ds-icon-button-medium {
|
|
35
|
+
width: 1.5rem;
|
|
36
|
+
height: 1.5rem;
|
|
37
|
+
padding: .125rem;
|
|
38
|
+
font-size: 1.25rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ds-icon-button.ds-icon-button-small {
|
|
42
|
+
width: 1.25rem;
|
|
43
|
+
height: 1.25rem;
|
|
44
|
+
padding: .125rem;
|
|
45
|
+
font-size: 1rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ds-icon-button.ds-icon-button-negative-margin {
|
|
49
|
+
margin: -.125rem;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|