@bioturing/components 0.15.0 → 0.15.2
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/components/Badge/component.js +21 -0
- package/dist/components/Badge/component.js.map +1 -0
- package/dist/components/Badge/style.css +1 -0
- package/dist/components/Breadcrumb/component.js +46 -0
- package/dist/components/Breadcrumb/component.js.map +1 -0
- package/dist/components/Breadcrumb/style.css +1 -0
- package/dist/components/Breadcrumb/useItemRender.js +27 -0
- package/dist/components/Breadcrumb/useItemRender.js.map +1 -0
- package/dist/components/Button/component.js +9 -0
- package/dist/components/Button/component.js.map +1 -0
- package/dist/components/Button/style.css +1 -0
- package/dist/components/Checkbox/component.js +11 -0
- package/dist/components/Checkbox/component.js.map +1 -0
- package/dist/components/Checkbox/style.css +1 -0
- package/dist/components/CodeBlock/component.js +127 -0
- package/dist/components/CodeBlock/component.js.map +1 -0
- package/dist/components/CodeBlock/style.css +1 -0
- package/dist/components/DSRoot/component.js +21 -0
- package/dist/components/DSRoot/component.js.map +1 -0
- package/dist/components/DSRoot/context.js +9 -0
- package/dist/components/DSRoot/context.js.map +1 -0
- package/dist/components/DSRoot/style.css +1 -0
- package/dist/components/DropdownMenu/component.js +103 -0
- package/dist/components/DropdownMenu/component.js.map +1 -0
- package/dist/components/DropdownMenu/style.css +1 -0
- package/dist/components/Empty/component.js +48 -0
- package/dist/components/Empty/component.js.map +1 -0
- package/dist/components/Empty/style.css +1 -0
- package/dist/components/Field/component.js +30 -0
- package/dist/components/Field/component.js.map +1 -0
- package/dist/components/Field/style.css +1 -0
- package/dist/components/Form/component.js +23 -0
- package/dist/components/Form/component.js.map +1 -0
- package/dist/components/Form/item.js +30 -0
- package/dist/components/Form/item.js.map +1 -0
- package/dist/components/Form/style.css +1 -0
- package/dist/components/IconButton/component.js +49 -0
- package/dist/components/IconButton/component.js.map +1 -0
- package/dist/components/IconButton/style.css +1 -0
- package/dist/components/Input/component.js +25 -0
- package/dist/components/Input/component.js.map +1 -0
- package/dist/components/Modal/Modal.js +161 -0
- package/dist/components/Modal/Modal.js.map +1 -0
- package/dist/components/Modal/ModalProvider.js +70 -0
- package/dist/components/Modal/ModalProvider.js.map +1 -0
- package/dist/components/Modal/ModalService.js +25 -0
- package/dist/components/Modal/ModalService.js.map +1 -0
- package/dist/components/Modal/constants.js +5 -0
- package/dist/components/Modal/constants.js.map +1 -0
- package/dist/components/Modal/functions.js +27 -0
- package/dist/components/Modal/functions.js.map +1 -0
- package/dist/components/Modal/index.js +20 -0
- package/dist/components/Modal/index.js.map +1 -0
- package/dist/components/Modal/style.css +1 -0
- package/dist/components/Popover/component.js +12 -0
- package/dist/components/Popover/component.js.map +1 -0
- package/dist/components/PopupPanel/component.js +190 -0
- package/dist/components/PopupPanel/component.js.map +1 -0
- package/dist/components/PopupPanel/constants.js +5 -0
- package/dist/components/PopupPanel/constants.js.map +1 -0
- package/dist/components/PopupPanel/style.css +1 -0
- package/dist/components/Radio/component.js +22 -0
- package/dist/components/Radio/component.js.map +1 -0
- package/dist/components/Radio/style.css +1 -0
- package/dist/components/ScrollArea/component.js +40 -0
- package/dist/components/ScrollArea/component.js.map +1 -0
- package/dist/components/ScrollArea/style.css +1 -0
- package/dist/components/Segmented/component.js +9 -0
- package/dist/components/Segmented/component.js.map +1 -0
- package/dist/components/Segmented/style.css +1 -0
- package/dist/components/Select/component.js +135 -0
- package/dist/components/Select/component.js.map +1 -0
- package/dist/components/Select/style.css +1 -0
- package/dist/components/Slider/component.js +23 -0
- package/dist/components/Slider/component.js.map +1 -0
- package/dist/components/Spin/component.js +12 -0
- package/dist/components/Spin/component.js.map +1 -0
- package/dist/components/Spin/style.css +1 -0
- package/dist/components/Splitter/component.js +40 -0
- package/dist/components/Splitter/component.js.map +1 -0
- package/dist/components/Splitter/style.css +1 -0
- package/dist/components/Stack/Stack.js +37 -0
- package/dist/components/Stack/Stack.js.map +1 -0
- package/dist/components/Stack/StackChild.js +57 -0
- package/dist/components/Stack/StackChild.js.map +1 -0
- package/dist/components/Stack/index.js +9 -0
- package/dist/components/Stack/index.js.map +1 -0
- package/dist/components/Stack/style.css +1 -0
- package/dist/components/Switch/component.js +9 -0
- package/dist/components/Switch/component.js.map +1 -0
- package/dist/components/Switch/style.css +1 -0
- package/dist/components/Table/component.js +68 -0
- package/dist/components/Table/component.js.map +1 -0
- package/dist/components/Table/style.css +1 -0
- package/dist/components/Tag/component.js +30 -0
- package/dist/components/Tag/component.js.map +1 -0
- package/dist/components/Tag/style.css +1 -0
- package/dist/components/ThemeProvider/component.js +41 -0
- package/dist/components/ThemeProvider/component.js.map +1 -0
- package/dist/components/ThemeProvider/style.css +1 -0
- package/dist/components/Toast/component.js +101 -0
- package/dist/components/Toast/component.js.map +1 -0
- package/dist/components/Toast/function.js +25 -0
- package/dist/components/Toast/function.js.map +1 -0
- package/dist/components/Toast/style.css +1 -0
- package/dist/components/Tooltip/component.js +26 -0
- package/dist/components/Tooltip/component.js.map +1 -0
- package/dist/components/Tooltip/style.css +1 -0
- package/dist/components/Tour/component.js +35 -0
- package/dist/components/Tour/component.js.map +1 -0
- package/dist/components/Tour/style.css +1 -0
- package/dist/components/Transition/component.js +44 -0
- package/dist/components/Transition/component.js.map +1 -0
- package/dist/components/Tree/components.js +68 -0
- package/dist/components/Tree/components.js.map +1 -0
- package/dist/components/Tree/helpers.js +53 -0
- package/dist/components/Tree/helpers.js.map +1 -0
- package/dist/components/Tree/style.css +1 -0
- package/dist/components/Tree/useTreeCommon.js +86 -0
- package/dist/components/Tree/useTreeCommon.js.map +1 -0
- package/dist/components/Tree/useUniqueKeysTree.js +142 -0
- package/dist/components/Tree/useUniqueKeysTree.js.map +1 -0
- package/dist/components/Truncate/component.js +93 -0
- package/dist/components/Truncate/component.js.map +1 -0
- package/dist/components/Truncate/helpers.js +36 -0
- package/dist/components/Truncate/helpers.js.map +1 -0
- package/dist/components/Truncate/style.css +1 -0
- package/dist/components/Upload/component.js +39 -0
- package/dist/components/Upload/component.js.map +1 -0
- package/dist/components/Upload/dragger.js +23 -0
- package/dist/components/Upload/dragger.js.map +1 -0
- package/dist/components/Upload/hooks.js +18 -0
- package/dist/components/Upload/hooks.js.map +1 -0
- package/dist/components/Upload/item.js +84 -0
- package/dist/components/Upload/item.js.map +1 -0
- package/dist/components/Upload/utils.js +7 -0
- package/dist/components/Upload/utils.js.map +1 -0
- package/dist/components/VerticalCollapsiblePanel/component.js +125 -0
- package/dist/components/VerticalCollapsiblePanel/component.js.map +1 -0
- package/dist/components/VerticalCollapsiblePanel/style.css +1 -0
- package/dist/components/hooks/antd.js +22 -0
- package/dist/components/hooks/antd.js.map +1 -0
- package/dist/components/hooks/base-ui.js +47 -0
- package/dist/components/hooks/base-ui.js.map +1 -0
- package/dist/components/hooks/useCharts.js +28 -0
- package/dist/components/hooks/useCharts.js.map +1 -0
- package/dist/components/hooks/useControlledState.js +15 -0
- package/dist/components/hooks/useControlledState.js.map +1 -0
- package/dist/components/utils/WithAntdTokens.js +24 -0
- package/dist/components/utils/WithAntdTokens.js.map +1 -0
- package/dist/components/utils/antdUtils.js +58 -0
- package/dist/components/utils/antdUtils.js.map +1 -0
- package/dist/components/utils/cn.js +27 -0
- package/dist/components/utils/cn.js.map +1 -0
- package/dist/components/utils/isTracebackError.js +10 -0
- package/dist/components/utils/isTracebackError.js.map +1 -0
- package/dist/components/utils/reactToString.js +23 -0
- package/dist/components/utils/reactToString.js.map +1 -0
- package/dist/index.d.ts +2497 -3
- package/dist/index.js +188 -4004
- package/dist/index.js.map +1 -0
- package/dist/metadata.js +513 -0
- package/dist/metadata.js.map +1 -0
- package/dist/tailwind.css +1 -121
- package/dist/tailwind.d.ts +1 -0
- package/dist/tokens/and-theme/tokens.js +351 -0
- package/dist/tokens/and-theme/tokens.js.map +1 -0
- package/dist/tokens/charts/index.js +18 -0
- package/dist/tokens/charts/index.js.map +1 -0
- package/dist/tokens/charts/tokens.js +208 -0
- package/dist/tokens/charts/tokens.js.map +1 -0
- package/dist/tokens/utils.js +37 -0
- package/dist/tokens/utils.js.map +1 -0
- package/package.json +10 -108
- package/dist/Badge.css +0 -6
- package/dist/Badge.js +0 -41
- package/dist/Breadcrumb.css +0 -83
- package/dist/Breadcrumb.js +0 -92
- package/dist/Checkbox.css +0 -13
- package/dist/Checkbox.js +0 -12
- package/dist/CodeBlock.css +0 -213
- package/dist/CodeBlock.js +0 -644
- package/dist/Collapse.css +0 -21
- package/dist/Collapse.js +0 -49
- package/dist/DSRoot.css +0 -667
- package/dist/DSRoot.js +0 -1428
- package/dist/DropdownMenu.css +0 -95
- package/dist/DropdownMenu.js +0 -211
- package/dist/Empty.css +0 -19
- package/dist/Empty.js +0 -53
- package/dist/Field.css +0 -14
- package/dist/Field.js +0 -66
- package/dist/Form.css +0 -64
- package/dist/Form.js +0 -125
- package/dist/IconButton.css +0 -52
- package/dist/IconButton.js +0 -82
- package/dist/Input.js +0 -48
- package/dist/Modal.css +0 -317
- package/dist/Modal.js +0 -677
- package/dist/Popover.js +0 -10
- package/dist/PopupPanel.css +0 -170
- package/dist/PopupPanel.js +0 -333
- package/dist/Radio.css +0 -14
- package/dist/Radio.js +0 -24
- package/dist/ScrollArea.css +0 -64
- package/dist/ScrollArea.js +0 -50
- package/dist/Segmented.css +0 -16
- package/dist/Segmented.js +0 -10
- package/dist/Select.css +0 -24
- package/dist/Select.js +0 -157
- package/dist/Slider.js +0 -39
- package/dist/Spin.css +0 -36
- package/dist/Spin.js +0 -33
- package/dist/Splitter.css +0 -6
- package/dist/Splitter.js +0 -47
- package/dist/Switch.css +0 -7
- package/dist/Switch.js +0 -10
- package/dist/Table.css +0 -116
- package/dist/Table.js +0 -126
- package/dist/Tag.css +0 -17
- package/dist/Tag.js +0 -24
- package/dist/ThemeProvider.css +0 -39
- package/dist/ThemeProvider.js +0 -403
- package/dist/Toast.css +0 -622
- package/dist/Toast.js +0 -1401
- package/dist/Tooltip.css +0 -6
- package/dist/Tooltip.js +0 -36
- package/dist/Tour.css +0 -73
- package/dist/Tour.js +0 -54
- package/dist/Tree.js +0 -318
- package/dist/Truncate.css +0 -31
- package/dist/Truncate.js +0 -216
- package/dist/Upload.css +0 -144
- package/dist/Upload.js +0 -516
- package/dist/VerticalCollapsiblePanel.css +0 -193
- package/dist/VerticalCollapsiblePanel.js +0 -469
- package/dist/components/Badge/component.d.ts +0 -4
- package/dist/components/Badge/index.d.ts +0 -1
- package/dist/components/Breadcrumb/component.d.ts +0 -6
- package/dist/components/Breadcrumb/index.d.ts +0 -2
- package/dist/components/Breadcrumb/types.d.ts +0 -18
- package/dist/components/Breadcrumb/useItemRender.d.ts +0 -6
- package/dist/components/Button/component.d.ts +0 -8
- package/dist/components/Button/index.d.ts +0 -1
- package/dist/components/Checkbox/component.d.ts +0 -11
- package/dist/components/Checkbox/index.d.ts +0 -1
- package/dist/components/CodeBlock/component.d.ts +0 -3
- package/dist/components/CodeBlock/index.d.ts +0 -2
- package/dist/components/CodeBlock/types.d.ts +0 -59
- package/dist/components/Collapse/component.d.ts +0 -14
- package/dist/components/Collapse/index.d.ts +0 -1
- package/dist/components/DSRoot/component.d.ts +0 -14
- package/dist/components/DSRoot/context.d.ts +0 -7
- package/dist/components/DSRoot/index.d.ts +0 -1
- package/dist/components/DropdownMenu/component.d.ts +0 -31
- package/dist/components/DropdownMenu/index.d.ts +0 -2
- package/dist/components/Empty/component.d.ts +0 -13
- package/dist/components/Empty/index.d.ts +0 -1
- package/dist/components/Field/component.d.ts +0 -42
- package/dist/components/Field/index.d.ts +0 -1
- package/dist/components/Form/component.d.ts +0 -19
- package/dist/components/Form/index.d.ts +0 -1
- package/dist/components/Form/item.d.ts +0 -5
- package/dist/components/IconButton/component.d.ts +0 -30
- package/dist/components/IconButton/index.d.ts +0 -1
- package/dist/components/Input/component.d.ts +0 -30
- package/dist/components/Input/index.d.ts +0 -1
- package/dist/components/Modal/Modal.d.ts +0 -84
- package/dist/components/Modal/ModalProvider.d.ts +0 -5
- package/dist/components/Modal/ModalService.d.ts +0 -33
- package/dist/components/Modal/constants.d.ts +0 -9
- package/dist/components/Modal/functions.d.ts +0 -27
- package/dist/components/Modal/index.d.ts +0 -15
- package/dist/components/Popover/component.d.ts +0 -9
- package/dist/components/Popover/index.d.ts +0 -1
- package/dist/components/PopupPanel/component.d.ts +0 -61
- package/dist/components/PopupPanel/constants.d.ts +0 -7
- package/dist/components/PopupPanel/index.d.ts +0 -1
- package/dist/components/Radio/component.d.ts +0 -8
- package/dist/components/Radio/index.d.ts +0 -2
- package/dist/components/Radio/interface.d.ts +0 -5
- package/dist/components/ScrollArea/component.d.ts +0 -32
- package/dist/components/ScrollArea/index.d.ts +0 -1
- package/dist/components/Segmented/component.d.ts +0 -10
- package/dist/components/Segmented/index.d.ts +0 -1
- package/dist/components/Select/component.d.ts +0 -24
- package/dist/components/Select/index.d.ts +0 -1
- package/dist/components/Slider/component.d.ts +0 -5
- package/dist/components/Slider/index.d.ts +0 -1
- package/dist/components/Spin/component.d.ts +0 -4
- package/dist/components/Spin/index.d.ts +0 -1
- package/dist/components/Splitter/component.d.ts +0 -13
- package/dist/components/Splitter/index.d.ts +0 -1
- package/dist/components/Stack/Stack.d.ts +0 -39
- package/dist/components/Stack/StackChild.d.ts +0 -30
- package/dist/components/Stack/index.d.ts +0 -8
- package/dist/components/Switch/component.d.ts +0 -9
- package/dist/components/Switch/index.d.ts +0 -1
- package/dist/components/Table/component.d.ts +0 -20
- package/dist/components/Table/index.d.ts +0 -1
- package/dist/components/Tag/component.d.ts +0 -12
- package/dist/components/Tag/index.d.ts +0 -1
- package/dist/components/ThemeProvider/component.d.ts +0 -7
- package/dist/components/ThemeProvider/index.d.ts +0 -1
- package/dist/components/Toast/component.d.ts +0 -15
- package/dist/components/Toast/function.d.ts +0 -10
- package/dist/components/Toast/index.d.ts +0 -3
- package/dist/components/Toast/types.d.ts +0 -3
- package/dist/components/Tooltip/component.d.ts +0 -10
- package/dist/components/Tooltip/index.d.ts +0 -1
- package/dist/components/Tour/component.d.ts +0 -8
- package/dist/components/Tour/index.d.ts +0 -1
- package/dist/components/Transition/component.d.ts +0 -17
- package/dist/components/Transition/index.d.ts +0 -1
- package/dist/components/Tree/components.d.ts +0 -13
- package/dist/components/Tree/helpers.d.ts +0 -4
- package/dist/components/Tree/index.d.ts +0 -4
- package/dist/components/Tree/types.d.ts +0 -55
- package/dist/components/Tree/useTreeCommon.d.ts +0 -178
- package/dist/components/Tree/useUniqueKeysTree.d.ts +0 -33
- package/dist/components/Truncate/component.d.ts +0 -15
- package/dist/components/Truncate/helpers.d.ts +0 -5
- package/dist/components/Truncate/index.d.ts +0 -1
- package/dist/components/Upload/component.d.ts +0 -16
- package/dist/components/Upload/dragger.d.ts +0 -13
- package/dist/components/Upload/hooks.d.ts +0 -5
- package/dist/components/Upload/index.d.ts +0 -4
- package/dist/components/Upload/item.d.ts +0 -11
- package/dist/components/Upload/utils.d.ts +0 -1
- package/dist/components/VerticalCollapsiblePanel/component.d.ts +0 -65
- package/dist/components/VerticalCollapsiblePanel/index.d.ts +0 -1
- package/dist/components/hooks/antd.d.ts +0 -11
- package/dist/components/hooks/base-ui.d.ts +0 -7
- package/dist/components/hooks/index.d.ts +0 -4
- package/dist/components/hooks/useCharts.d.ts +0 -22
- package/dist/components/hooks/useControlledState.d.ts +0 -1
- package/dist/components/index.d.ts +0 -41
- package/dist/components/utils/WithAntdTokens.d.ts +0 -7
- package/dist/components/utils/antdUtils.d.ts +0 -15
- package/dist/components/utils/client.d.ts +0 -2
- package/dist/components/utils/cn.d.ts +0 -4
- package/dist/components/utils/index.d.ts +0 -3
- package/dist/components/utils/isTracebackError.d.ts +0 -1
- package/dist/components/utils/main.d.ts +0 -3
- package/dist/components/utils/reactToString.d.ts +0 -2
- package/dist/components/utils/types.d.ts +0 -9
- package/dist/hooks.js +0 -961
- package/dist/index.css +0 -1471
- package/dist/metadata.d.ts +0 -363
- package/dist/tokens/and-theme/index.d.ts +0 -1
- package/dist/tokens/and-theme/tokens.d.ts +0 -5
- package/dist/tokens/charts/index.d.ts +0 -6
- package/dist/tokens/charts/tokens.d.ts +0 -455
- package/dist/tokens/index.d.ts +0 -2
- package/dist/tokens/utils.d.ts +0 -16
- package/dist/utils.js +0 -120
package/dist/CodeBlock.js
DELETED
|
@@ -1,644 +0,0 @@
|
|
|
1
|
-
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
|
-
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
3
|
-
import * as __WEBPACK_EXTERNAL_MODULE__bioturing_assets_dd0c210d__ from "@bioturing/assets";
|
|
4
|
-
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
5
|
-
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_config_provider_6a57beb3__ from "antd/es/config-provider";
|
|
6
|
-
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_theme_useToken_e8911485__ from "antd/es/theme/useToken";
|
|
7
|
-
import "tailwind-merge";
|
|
8
|
-
import * as __WEBPACK_EXTERNAL_MODULE__base_ui_components_react_5aaa6934__ from "@base-ui-components/react";
|
|
9
|
-
import * as __WEBPACK_EXTERNAL_MODULE_antd_es_segmented_6dbdbe23__ from "antd/es/segmented";
|
|
10
|
-
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_cssinjs_c619260f__ from "@ant-design/cssinjs";
|
|
11
|
-
import * as __WEBPACK_EXTERNAL_MODULE_prism_react_renderer_be33806e__ from "prism-react-renderer";
|
|
12
|
-
function cx(...args) {
|
|
13
|
-
const classes = [];
|
|
14
|
-
for (const arg of args)if (arg) {
|
|
15
|
-
if ("string" == typeof arg || "number" == typeof arg) classes.push(String(arg));
|
|
16
|
-
else if (Array.isArray(arg)) classes.push(...cx(...arg));
|
|
17
|
-
else if ("object" == typeof arg) {
|
|
18
|
-
for (const [key, value] of Object.entries(arg))if (value) classes.push(key);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return classes;
|
|
22
|
-
}
|
|
23
|
-
function clsx(...args) {
|
|
24
|
-
return cx(...args).join(" ");
|
|
25
|
-
}
|
|
26
|
-
"use client";
|
|
27
|
-
const useAntdCssVarClassname = ()=>{
|
|
28
|
-
var _token_;
|
|
29
|
-
const token = (0, __WEBPACK_EXTERNAL_MODULE_antd_es_theme_useToken_e8911485__["default"])();
|
|
30
|
-
return null == (_token_ = token[4]) ? void 0 : _token_.key;
|
|
31
|
-
};
|
|
32
|
-
const useCls = ()=>{
|
|
33
|
-
const { getPrefixCls } = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE_antd_es_config_provider_6a57beb3__["default"].ConfigContext);
|
|
34
|
-
return (...args)=>cx(...args).map((cls)=>getPrefixCls(cls)).join(" ");
|
|
35
|
-
};
|
|
36
|
-
"use client";
|
|
37
|
-
const IconButtonImpl = (props, ref)=>{
|
|
38
|
-
const { label, size = "medium", negativeMargin = true, children, className, tooltipProps = {}, as, href, target, rel, download, hrefLang, referrerPolicy, ...rest } = props;
|
|
39
|
-
const cls = useCls();
|
|
40
|
-
const antdCssVarClassname = useAntdCssVarClassname();
|
|
41
|
-
const buttonClasses = [
|
|
42
|
-
cls("icon-button"),
|
|
43
|
-
cls(`icon-button-${size}`),
|
|
44
|
-
cls(negativeMargin ? "icon-button-negative-margin" : ""),
|
|
45
|
-
antdCssVarClassname,
|
|
46
|
-
className
|
|
47
|
-
].filter(Boolean).join(" ");
|
|
48
|
-
const Component = as || (href ? "a" : "button");
|
|
49
|
-
const anchorProps = "a" === Component ? {
|
|
50
|
-
...void 0 !== target && {
|
|
51
|
-
target
|
|
52
|
-
},
|
|
53
|
-
...void 0 !== rel && {
|
|
54
|
-
rel
|
|
55
|
-
},
|
|
56
|
-
...void 0 !== download && {
|
|
57
|
-
download
|
|
58
|
-
},
|
|
59
|
-
...void 0 !== hrefLang && {
|
|
60
|
-
hrefLang
|
|
61
|
-
},
|
|
62
|
-
...void 0 !== referrerPolicy && {
|
|
63
|
-
referrerPolicy
|
|
64
|
-
}
|
|
65
|
-
} : {};
|
|
66
|
-
const elementProps = {
|
|
67
|
-
ref,
|
|
68
|
-
className: buttonClasses,
|
|
69
|
-
..."button" === Component && {
|
|
70
|
-
type: "button"
|
|
71
|
-
},
|
|
72
|
-
...href && {
|
|
73
|
-
href
|
|
74
|
-
},
|
|
75
|
-
...anchorProps,
|
|
76
|
-
...rest
|
|
77
|
-
};
|
|
78
|
-
const element = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Component, {
|
|
79
|
-
...elementProps,
|
|
80
|
-
children: children
|
|
81
|
-
});
|
|
82
|
-
return label ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Tooltip, {
|
|
83
|
-
title: label,
|
|
84
|
-
arrow: false,
|
|
85
|
-
...tooltipProps,
|
|
86
|
-
children: element
|
|
87
|
-
}) : element;
|
|
88
|
-
};
|
|
89
|
-
const IconButton = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)(IconButtonImpl);
|
|
90
|
-
"use client";
|
|
91
|
-
const ScrollArea = ({ children, className, classNames = {}, orientation = "vertical" })=>{
|
|
92
|
-
const cls = useCls();
|
|
93
|
-
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__base_ui_components_react_5aaa6934__.ScrollArea.Root, {
|
|
94
|
-
className: clsx(cls("scroll-area"), className),
|
|
95
|
-
children: [
|
|
96
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__base_ui_components_react_5aaa6934__.ScrollArea.Viewport, {
|
|
97
|
-
className: clsx(cls("scroll-area-viewport"), null == classNames ? void 0 : classNames.viewport),
|
|
98
|
-
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__base_ui_components_react_5aaa6934__.ScrollArea.Content, {
|
|
99
|
-
className: clsx(cls("scroll-area-content")),
|
|
100
|
-
children: children
|
|
101
|
-
})
|
|
102
|
-
}),
|
|
103
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__base_ui_components_react_5aaa6934__.ScrollArea.Scrollbar, {
|
|
104
|
-
className: clsx(cls("scroll-area-scrollbar"), null == classNames ? void 0 : classNames.scrollbar),
|
|
105
|
-
orientation: orientation,
|
|
106
|
-
"data-orientation": orientation,
|
|
107
|
-
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__base_ui_components_react_5aaa6934__.ScrollArea.Thumb, {
|
|
108
|
-
className: clsx(cls("scroll-area-thumb"), null == classNames ? void 0 : classNames.thumb)
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
]
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
const MainSegmentedInner = ({ className, ...rest }, ref)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd_es_segmented_6dbdbe23__["default"], {
|
|
115
|
-
ref: ref,
|
|
116
|
-
...rest
|
|
117
|
-
});
|
|
118
|
-
const MainSegmented = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)(MainSegmentedInner);
|
|
119
|
-
const Segmented = MainSegmented;
|
|
120
|
-
const getTokensByTheme = (originTokens, theme)=>{
|
|
121
|
-
const tokens = {};
|
|
122
|
-
Object.entries(originTokens).forEach(([key, value])=>{
|
|
123
|
-
if (value && "object" == typeof value && "light" in value && "dark" in value) {
|
|
124
|
-
const tokenValue = value;
|
|
125
|
-
tokens[key] = tokenValue[theme];
|
|
126
|
-
} else if ("string" == typeof value) tokens[key] = value;
|
|
127
|
-
});
|
|
128
|
-
return tokens;
|
|
129
|
-
};
|
|
130
|
-
const antdColorTokens = {
|
|
131
|
-
colorText: {
|
|
132
|
-
light: "rgba(0, 0, 0, 0.88)",
|
|
133
|
-
dark: "rgba(255, 255, 255, 0.85)"
|
|
134
|
-
},
|
|
135
|
-
colorTextSecondary: {
|
|
136
|
-
light: "rgba(0, 0, 0, 0.65)",
|
|
137
|
-
dark: "rgba(255, 255, 255, 0.65)"
|
|
138
|
-
},
|
|
139
|
-
colorTextTertiary: {
|
|
140
|
-
light: "rgba(0, 0, 0, 0.45)",
|
|
141
|
-
dark: "rgba(255, 255, 255, 0.45)"
|
|
142
|
-
},
|
|
143
|
-
colorTextQuaternary: {
|
|
144
|
-
light: "rgba(0, 0, 0, 0.25)",
|
|
145
|
-
dark: "rgba(255, 255, 255, 0.25)"
|
|
146
|
-
},
|
|
147
|
-
colorPrimary: {
|
|
148
|
-
light: "#175CD3",
|
|
149
|
-
dark: "#2E90FA"
|
|
150
|
-
},
|
|
151
|
-
colorPrimaryBg: {
|
|
152
|
-
light: "#E9F2FF",
|
|
153
|
-
dark: "#152137"
|
|
154
|
-
},
|
|
155
|
-
colorPrimaryBgHover: {
|
|
156
|
-
light: "#D1E9FF",
|
|
157
|
-
dark: "#112545"
|
|
158
|
-
},
|
|
159
|
-
colorPrimaryBorder: {
|
|
160
|
-
light: "#84CAFF",
|
|
161
|
-
dark: "#1C3959"
|
|
162
|
-
},
|
|
163
|
-
colorPrimaryBorderHover: {
|
|
164
|
-
light: "#53B1FD",
|
|
165
|
-
dark: "#204C7C"
|
|
166
|
-
},
|
|
167
|
-
colorPrimaryHover: {
|
|
168
|
-
light: "#1570EF",
|
|
169
|
-
dark: "#50A0E8"
|
|
170
|
-
},
|
|
171
|
-
colorPrimaryActive: {
|
|
172
|
-
light: "#175CD3",
|
|
173
|
-
dark: "#2565AB"
|
|
174
|
-
},
|
|
175
|
-
colorPrimaryTextHover: {
|
|
176
|
-
light: "#1570EF",
|
|
177
|
-
dark: "#50A0E8"
|
|
178
|
-
},
|
|
179
|
-
colorPrimaryTextActive: {
|
|
180
|
-
light: "#175CD3",
|
|
181
|
-
dark: "#2565AB"
|
|
182
|
-
},
|
|
183
|
-
colorInfo: {
|
|
184
|
-
light: "#175CD3",
|
|
185
|
-
dark: "#2E90FA"
|
|
186
|
-
},
|
|
187
|
-
colorInfoBg: {
|
|
188
|
-
light: "#E9F2FF",
|
|
189
|
-
dark: "#152137"
|
|
190
|
-
},
|
|
191
|
-
colorInfoBgHover: {
|
|
192
|
-
light: "#D1E9FF",
|
|
193
|
-
dark: "#112545"
|
|
194
|
-
},
|
|
195
|
-
colorInfoBorder: {
|
|
196
|
-
light: "#84CAFF",
|
|
197
|
-
dark: "#1C3959"
|
|
198
|
-
},
|
|
199
|
-
colorInfoBorderHover: {
|
|
200
|
-
light: "#53B1FD",
|
|
201
|
-
dark: "#204C7C"
|
|
202
|
-
},
|
|
203
|
-
colorInfoHover: {
|
|
204
|
-
light: "#1570EF",
|
|
205
|
-
dark: "#50A0E8"
|
|
206
|
-
},
|
|
207
|
-
colorInfoActive: {
|
|
208
|
-
light: "#175CD3",
|
|
209
|
-
dark: "#2565AB"
|
|
210
|
-
},
|
|
211
|
-
colorInfoTextHover: {
|
|
212
|
-
light: "#1570EF",
|
|
213
|
-
dark: "#50A0E8"
|
|
214
|
-
},
|
|
215
|
-
colorInfoTextActive: {
|
|
216
|
-
light: "#175CD3",
|
|
217
|
-
dark: "#2565AB"
|
|
218
|
-
},
|
|
219
|
-
colorSuccess: {
|
|
220
|
-
light: "#4CB200",
|
|
221
|
-
dark: "#389E0D"
|
|
222
|
-
},
|
|
223
|
-
colorSuccessBg: {
|
|
224
|
-
light: "#F6FFF0",
|
|
225
|
-
dark: "#162100"
|
|
226
|
-
},
|
|
227
|
-
colorSuccessBgHover: {
|
|
228
|
-
light: "#D9F7BE",
|
|
229
|
-
dark: "#1D2B00"
|
|
230
|
-
},
|
|
231
|
-
colorSuccessBorder: {
|
|
232
|
-
light: "#B7EB8F",
|
|
233
|
-
dark: "#274916"
|
|
234
|
-
},
|
|
235
|
-
colorSuccessBorderHover: {
|
|
236
|
-
light: "#95DE64",
|
|
237
|
-
dark: "#306317"
|
|
238
|
-
},
|
|
239
|
-
colorSuccessHover: {
|
|
240
|
-
light: "#73D13D",
|
|
241
|
-
dark: "#52C41A"
|
|
242
|
-
},
|
|
243
|
-
colorSuccessActive: {
|
|
244
|
-
light: "#389E0D",
|
|
245
|
-
dark: "#237804"
|
|
246
|
-
},
|
|
247
|
-
colorSuccessTextHover: {
|
|
248
|
-
light: "#237804",
|
|
249
|
-
dark: "#52C41A"
|
|
250
|
-
},
|
|
251
|
-
colorSuccessTextActive: {
|
|
252
|
-
light: "#092B00",
|
|
253
|
-
dark: "#237804"
|
|
254
|
-
},
|
|
255
|
-
colorWarning: {
|
|
256
|
-
light: "#FA8C16",
|
|
257
|
-
dark: "#D48806"
|
|
258
|
-
},
|
|
259
|
-
colorWarningBg: {
|
|
260
|
-
light: "#FFF7E6",
|
|
261
|
-
dark: "#281800"
|
|
262
|
-
},
|
|
263
|
-
colorWarningBgHover: {
|
|
264
|
-
light: "#FFE7BA",
|
|
265
|
-
dark: "#3D2200"
|
|
266
|
-
},
|
|
267
|
-
colorWarningBorder: {
|
|
268
|
-
light: "#FFD591",
|
|
269
|
-
dark: "#443B16"
|
|
270
|
-
},
|
|
271
|
-
colorWarningBorderHover: {
|
|
272
|
-
light: "#FFC069",
|
|
273
|
-
dark: "#594E1A"
|
|
274
|
-
},
|
|
275
|
-
colorWarningHover: {
|
|
276
|
-
light: "#FFA940",
|
|
277
|
-
dark: "#E8B339"
|
|
278
|
-
},
|
|
279
|
-
colorWarningActive: {
|
|
280
|
-
light: "#D46B08",
|
|
281
|
-
dark: "#AA7714"
|
|
282
|
-
},
|
|
283
|
-
colorWarningTextHover: {
|
|
284
|
-
light: "#AD4E00",
|
|
285
|
-
dark: "#E8B339"
|
|
286
|
-
},
|
|
287
|
-
colorWarningTextActive: {
|
|
288
|
-
light: "#873800",
|
|
289
|
-
dark: "#AA7714"
|
|
290
|
-
},
|
|
291
|
-
colorError: {
|
|
292
|
-
light: "#D92D20",
|
|
293
|
-
dark: "#CF3D33"
|
|
294
|
-
},
|
|
295
|
-
colorErrorBg: {
|
|
296
|
-
light: "#FEF3F2",
|
|
297
|
-
dark: "#291414"
|
|
298
|
-
},
|
|
299
|
-
colorErrorBgHover: {
|
|
300
|
-
light: "#FEE4E2",
|
|
301
|
-
dark: "#411A18"
|
|
302
|
-
},
|
|
303
|
-
colorErrorBorder: {
|
|
304
|
-
light: "#FDA29B",
|
|
305
|
-
dark: "#562222"
|
|
306
|
-
},
|
|
307
|
-
colorErrorBorderHover: {
|
|
308
|
-
light: "#F97066",
|
|
309
|
-
dark: "#772A24"
|
|
310
|
-
},
|
|
311
|
-
colorErrorHover: {
|
|
312
|
-
light: "#F04438",
|
|
313
|
-
dark: "#E5695A"
|
|
314
|
-
},
|
|
315
|
-
colorErrorActive: {
|
|
316
|
-
light: "#D92D20",
|
|
317
|
-
dark: "#A3332B"
|
|
318
|
-
},
|
|
319
|
-
colorErrorTextHover: {
|
|
320
|
-
light: "#F04438",
|
|
321
|
-
dark: "#E5695A"
|
|
322
|
-
},
|
|
323
|
-
colorErrorTextActive: {
|
|
324
|
-
light: "#D92D20",
|
|
325
|
-
dark: "#A3332B"
|
|
326
|
-
},
|
|
327
|
-
colorFill: {
|
|
328
|
-
light: "rgba(0, 0, 0, 0.15)",
|
|
329
|
-
dark: "rgba(255, 255, 255, 0.15)"
|
|
330
|
-
},
|
|
331
|
-
colorFillSecondary: {
|
|
332
|
-
light: "rgba(0, 0, 0, 0.06)",
|
|
333
|
-
dark: "rgba(255, 255, 255, 0.06)"
|
|
334
|
-
},
|
|
335
|
-
colorFillTertiary: {
|
|
336
|
-
light: "rgba(0, 0, 0, 0.04)",
|
|
337
|
-
dark: "rgba(255, 255, 255, 0.04)"
|
|
338
|
-
},
|
|
339
|
-
colorFillQuaternary: {
|
|
340
|
-
light: "rgba(0, 0, 0, 0.02)",
|
|
341
|
-
dark: "rgba(255, 255, 255, 0.02)"
|
|
342
|
-
},
|
|
343
|
-
colorFillAlter: {
|
|
344
|
-
light: "rgba(0, 0, 0, 0.02)",
|
|
345
|
-
dark: "rgba(255, 255, 255, 0.02)"
|
|
346
|
-
},
|
|
347
|
-
colorBorder: {
|
|
348
|
-
light: "rgba(0, 0, 0, 0.16)",
|
|
349
|
-
dark: "rgba(255, 255, 255, 0.16)"
|
|
350
|
-
},
|
|
351
|
-
colorBorderSecondary: {
|
|
352
|
-
light: "rgba(0, 0, 0, 0.06)",
|
|
353
|
-
dark: "rgba(255, 255, 255, 0.06)"
|
|
354
|
-
},
|
|
355
|
-
colorIcon: {
|
|
356
|
-
light: "rgba(0, 0, 0, 0.58)",
|
|
357
|
-
dark: "rgba(255, 255, 255, 0.58)"
|
|
358
|
-
},
|
|
359
|
-
colorIconHover: {
|
|
360
|
-
light: "rgba(0, 0, 0, 0.88)",
|
|
361
|
-
dark: "rgba(255, 255, 255, 0.88)"
|
|
362
|
-
},
|
|
363
|
-
colorBgContainer: {
|
|
364
|
-
light: "#FFFFFF",
|
|
365
|
-
dark: "#26262C"
|
|
366
|
-
},
|
|
367
|
-
colorBgElevated: {
|
|
368
|
-
light: "#FFFFFF",
|
|
369
|
-
dark: "#2F2F37"
|
|
370
|
-
},
|
|
371
|
-
colorBgLayout: {
|
|
372
|
-
light: "#F5F5F5",
|
|
373
|
-
dark: "#1A1A1E"
|
|
374
|
-
},
|
|
375
|
-
colorBgSpotlight: {
|
|
376
|
-
light: "rgba(0, 0, 0, 0.85)",
|
|
377
|
-
dark: "#505D5D"
|
|
378
|
-
},
|
|
379
|
-
colorBgMask: {
|
|
380
|
-
light: "rgba(0, 0, 0, 0.45)",
|
|
381
|
-
dark: "rgba(0, 0, 0, 0.45)"
|
|
382
|
-
},
|
|
383
|
-
colorBgBase: {
|
|
384
|
-
light: "#FFFFFF",
|
|
385
|
-
dark: "#13131A"
|
|
386
|
-
},
|
|
387
|
-
controlOutline: {
|
|
388
|
-
light: "rgba(0, 0, 0, 0.12)",
|
|
389
|
-
dark: "rgba(255, 255, 255, 0.12)"
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
const sharedTokens = {
|
|
393
|
-
fontFamily: "var(--ds-inter)",
|
|
394
|
-
fontFamilyCode: "var(--ds-roboto-mono)",
|
|
395
|
-
fontSizeHeading1: 36,
|
|
396
|
-
fontSizeHeading2: 30,
|
|
397
|
-
fontSizeHeading3: 24,
|
|
398
|
-
fontSizeHeading4: 20,
|
|
399
|
-
fontSizeHeading5: 16,
|
|
400
|
-
lineHeightHeading1: 40 / 36,
|
|
401
|
-
lineHeightHeading2: 1.2,
|
|
402
|
-
lineHeightHeading3: 32 / 24,
|
|
403
|
-
lineHeightHeading4: 1.4,
|
|
404
|
-
lineHeightHeading5: 1.5,
|
|
405
|
-
lineHeight: 20 / 14,
|
|
406
|
-
lineHeightLG: 1.5,
|
|
407
|
-
lineHeightSM: 16 / 12,
|
|
408
|
-
fontWeightStrong: 600,
|
|
409
|
-
boxShadow: "0px 1px 2px rgba(0, 0, 0, 0.06), 0px 1px 6px rgba(0, 0, 0, 0.04), 0px 2px 10px rgba(0, 0, 0, 0.04)",
|
|
410
|
-
boxShadowSecondary: "0px 0px 1px 0px var(--ds-color-border-modal), 0px 3px 6px 1px rgba(0, 0, 0, 0.08), 0px 6px 26px 2px rgba(0, 0, 0, 0.08), 0px 4px 52px 0px rgba(0, 0, 0, 0.05)",
|
|
411
|
-
colorBgSpotlight: "rgba(0, 0, 0, 0.85)"
|
|
412
|
-
};
|
|
413
|
-
const sharedThemeConfig = {
|
|
414
|
-
cssVar: true,
|
|
415
|
-
components: {
|
|
416
|
-
Input: {},
|
|
417
|
-
InputNumber: {},
|
|
418
|
-
Button: {
|
|
419
|
-
defaultShadow: void 0,
|
|
420
|
-
primaryShadow: void 0,
|
|
421
|
-
dangerShadow: void 0
|
|
422
|
-
},
|
|
423
|
-
Select: {},
|
|
424
|
-
Segmented: {
|
|
425
|
-
controlHeightLG: 36,
|
|
426
|
-
controlHeightSM: 24
|
|
427
|
-
},
|
|
428
|
-
Breadcrumb: {
|
|
429
|
-
separatorColor: "var(--ds-color-border)"
|
|
430
|
-
},
|
|
431
|
-
Slider: {
|
|
432
|
-
trackBg: "var(--ds-color-primary)",
|
|
433
|
-
trackHoverBg: "var(--ds-color-primary-hover)",
|
|
434
|
-
trackBgDisabled: "var(--ds-color-text-disabled)",
|
|
435
|
-
railBg: "var(--ds-control-outline)",
|
|
436
|
-
railHoverBg: "var(--ds-color-border)",
|
|
437
|
-
handleColor: "var(--ds-color-primary)",
|
|
438
|
-
handleActiveColor: "var(--ds-color-primary-active)",
|
|
439
|
-
handleColorDisabled: "var(--ds-color-text-disabled)",
|
|
440
|
-
dotBorderColor: "var(--ds-color-primary)",
|
|
441
|
-
dotActiveBorderColor: "var(--ds-color-primary-active)"
|
|
442
|
-
},
|
|
443
|
-
Form: {
|
|
444
|
-
itemMarginBottom: 16,
|
|
445
|
-
labelColor: "var(--ds-color-text)"
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
const lightTheme = {
|
|
450
|
-
token: {
|
|
451
|
-
...getTokensByTheme(antdColorTokens, "light"),
|
|
452
|
-
...sharedTokens
|
|
453
|
-
},
|
|
454
|
-
...sharedThemeConfig
|
|
455
|
-
};
|
|
456
|
-
const darkTheme = {
|
|
457
|
-
token: {
|
|
458
|
-
...getTokensByTheme(antdColorTokens, "dark"),
|
|
459
|
-
...sharedTokens
|
|
460
|
-
},
|
|
461
|
-
...sharedThemeConfig
|
|
462
|
-
};
|
|
463
|
-
"use client";
|
|
464
|
-
const DSWrapper = ({ children, theme, appendClassesTo })=>{
|
|
465
|
-
const cls = useCls();
|
|
466
|
-
const className = clsx(cls("theme-provider"), theme.toString());
|
|
467
|
-
(0, __WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect)(()=>{
|
|
468
|
-
const classes = className.split(" ");
|
|
469
|
-
const el = "string" == typeof appendClassesTo ? document.querySelector(appendClassesTo) : appendClassesTo;
|
|
470
|
-
if (el) el.classList.add(...classes);
|
|
471
|
-
return ()=>{
|
|
472
|
-
if (el) el.classList.remove(...classes);
|
|
473
|
-
};
|
|
474
|
-
}, [
|
|
475
|
-
appendClassesTo,
|
|
476
|
-
className
|
|
477
|
-
]);
|
|
478
|
-
return void 0 === appendClassesTo ? __WEBPACK_EXTERNAL_MODULE_react__.Children.map(children, (child)=>{
|
|
479
|
-
if (/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.isValidElement)(child)) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.cloneElement)(child, {
|
|
480
|
-
className: clsx(child.props.className, className)
|
|
481
|
-
});
|
|
482
|
-
return child;
|
|
483
|
-
}) : children;
|
|
484
|
-
};
|
|
485
|
-
const ThemeProvider = ({ theme, appendClassesTo, children })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_cssinjs_c619260f__.StyleProvider, {
|
|
486
|
-
layer: true,
|
|
487
|
-
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd_es_config_provider_6a57beb3__["default"], {
|
|
488
|
-
theme: "light" == theme ? lightTheme : darkTheme,
|
|
489
|
-
prefixCls: "ds",
|
|
490
|
-
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(DSWrapper, {
|
|
491
|
-
theme: theme,
|
|
492
|
-
appendClassesTo: appendClassesTo,
|
|
493
|
-
children: children
|
|
494
|
-
})
|
|
495
|
-
})
|
|
496
|
-
});
|
|
497
|
-
"use client";
|
|
498
|
-
function useControlledState(value, onChange, defaultValue) {
|
|
499
|
-
const [internalState, setInternalState] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(defaultValue);
|
|
500
|
-
const isControlled = void 0 !== value;
|
|
501
|
-
const setState = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((next)=>{
|
|
502
|
-
const nextValue = "function" == typeof next ? next(value) : next;
|
|
503
|
-
if ("function" == typeof onChange) onChange(nextValue);
|
|
504
|
-
if (!isControlled) setInternalState(next);
|
|
505
|
-
}, [
|
|
506
|
-
value,
|
|
507
|
-
onChange,
|
|
508
|
-
isControlled
|
|
509
|
-
]);
|
|
510
|
-
const state = isControlled ? value : internalState;
|
|
511
|
-
return [
|
|
512
|
-
state,
|
|
513
|
-
setState
|
|
514
|
-
];
|
|
515
|
-
}
|
|
516
|
-
"use client";
|
|
517
|
-
const WithAntdTokens = ({ as: Tag = "div", ref, className, ...rest })=>{
|
|
518
|
-
const Component = Tag;
|
|
519
|
-
const cssVar = useAntdCssVarClassname();
|
|
520
|
-
const { renderElement } = (0, __WEBPACK_EXTERNAL_MODULE__base_ui_components_react_5aaa6934__.useRender)({
|
|
521
|
-
render: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Component, {}),
|
|
522
|
-
refs: [
|
|
523
|
-
ref
|
|
524
|
-
],
|
|
525
|
-
props: {
|
|
526
|
-
...rest,
|
|
527
|
-
className: clsx(className, cssVar)
|
|
528
|
-
}
|
|
529
|
-
});
|
|
530
|
-
return renderElement();
|
|
531
|
-
};
|
|
532
|
-
function reactNodeToString(node) {
|
|
533
|
-
if (null == node) return "";
|
|
534
|
-
if ("string" == typeof node) return node;
|
|
535
|
-
if ("number" == typeof node || "boolean" == typeof node) return node.toString();
|
|
536
|
-
if (Array.isArray(node)) return node.map(reactNodeToString).join("");
|
|
537
|
-
if ((0, __WEBPACK_EXTERNAL_MODULE_react__.isValidElement)(node) && "props" in node && node.props && "object" == typeof node.props && "children" in node.props && node.props.children) {
|
|
538
|
-
if ("br" === node.type) return "\n";
|
|
539
|
-
if (node.props.children) return reactNodeToString(node.props.children);
|
|
540
|
-
}
|
|
541
|
-
return "";
|
|
542
|
-
}
|
|
543
|
-
"use client";
|
|
544
|
-
const CodeBlock = ({ code, children, lang: defaultLang = "tsx", className, options, activeOption: controlledActiveOption, defaultActiveOption = 0, onActiveOptionChange, copyText = "Copy", copySuccessText = "Copied", classNames, maxHeight, ...rest })=>{
|
|
545
|
-
const [activeOption, setActiveOption] = useControlledState(controlledActiveOption, onActiveOptionChange, defaultActiveOption);
|
|
546
|
-
const [currentCode, setCurrentCode] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(code || "");
|
|
547
|
-
const [lang, setLang] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(defaultLang);
|
|
548
|
-
const hasOptions = options && options.length > 0;
|
|
549
|
-
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
550
|
-
if (hasOptions) {
|
|
551
|
-
var _options_activeOption, _options_activeOption1;
|
|
552
|
-
const newCode = (null == (_options_activeOption = options[activeOption]) ? void 0 : _options_activeOption.code) || "";
|
|
553
|
-
const newLang = (null == (_options_activeOption1 = options[activeOption]) ? void 0 : _options_activeOption1.lang) || defaultLang;
|
|
554
|
-
setCurrentCode(newCode);
|
|
555
|
-
setLang(newLang);
|
|
556
|
-
}
|
|
557
|
-
}, [
|
|
558
|
-
code,
|
|
559
|
-
activeOption,
|
|
560
|
-
defaultActiveOption,
|
|
561
|
-
options,
|
|
562
|
-
defaultLang,
|
|
563
|
-
hasOptions,
|
|
564
|
-
setActiveOption
|
|
565
|
-
]);
|
|
566
|
-
const [tooltipContent, setTooltipContent] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(copyText);
|
|
567
|
-
const [copySuccess, setCopySuccess] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
568
|
-
const handleCopy = ()=>{
|
|
569
|
-
const codeContent = currentCode ? currentCode : reactNodeToString(children);
|
|
570
|
-
try {
|
|
571
|
-
navigator.clipboard.writeText(codeContent).then(()=>{
|
|
572
|
-
setTooltipContent(copySuccessText);
|
|
573
|
-
setCopySuccess(true);
|
|
574
|
-
});
|
|
575
|
-
} catch (_) {
|
|
576
|
-
setTooltipContent("Failed to copy");
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
const handleMouseLeave = ()=>{
|
|
580
|
-
setTooltipContent(copyText);
|
|
581
|
-
setCopySuccess(false);
|
|
582
|
-
};
|
|
583
|
-
const cls = useCls();
|
|
584
|
-
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ThemeProvider, {
|
|
585
|
-
theme: "dark",
|
|
586
|
-
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(WithAntdTokens, {
|
|
587
|
-
className: clsx(cls("code-block"), className, null == classNames ? void 0 : classNames.root),
|
|
588
|
-
...rest,
|
|
589
|
-
children: [
|
|
590
|
-
hasOptions && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
591
|
-
className: cls("code-block-header", null == classNames ? void 0 : classNames.header),
|
|
592
|
-
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Segmented, {
|
|
593
|
-
value: activeOption,
|
|
594
|
-
onChange: setActiveOption,
|
|
595
|
-
options: options.map((opt, index)=>({
|
|
596
|
-
label: opt.label,
|
|
597
|
-
value: index
|
|
598
|
-
}))
|
|
599
|
-
})
|
|
600
|
-
}),
|
|
601
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
602
|
-
className: cls("code-block-copy"),
|
|
603
|
-
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(IconButton, {
|
|
604
|
-
onClick: handleCopy,
|
|
605
|
-
label: tooltipContent,
|
|
606
|
-
onMouseLeave: handleMouseLeave,
|
|
607
|
-
children: copySuccess ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__bioturing_assets_dd0c210d__.Check, {}) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__bioturing_assets_dd0c210d__.Copy, {})
|
|
608
|
-
})
|
|
609
|
-
}),
|
|
610
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
611
|
-
className: cls("code-block-content", null == classNames ? void 0 : classNames.content),
|
|
612
|
-
style: {
|
|
613
|
-
maxHeight: maxHeight && ("number" == typeof maxHeight ? `${maxHeight}px` : maxHeight)
|
|
614
|
-
},
|
|
615
|
-
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(ScrollArea, {
|
|
616
|
-
children: currentCode ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_prism_react_renderer_be33806e__.Highlight, {
|
|
617
|
-
language: lang,
|
|
618
|
-
code: currentCode,
|
|
619
|
-
theme: __WEBPACK_EXTERNAL_MODULE_prism_react_renderer_be33806e__.themes.vsDark,
|
|
620
|
-
children: ({ className, style, tokens, getLineProps, getTokenProps })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("pre", {
|
|
621
|
-
style: {
|
|
622
|
-
...style,
|
|
623
|
-
backgroundColor: "transparent"
|
|
624
|
-
},
|
|
625
|
-
className: className,
|
|
626
|
-
children: tokens.map((line, i)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
627
|
-
...getLineProps({
|
|
628
|
-
line
|
|
629
|
-
}),
|
|
630
|
-
children: line.map((token, key)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
|
|
631
|
-
...getTokenProps({
|
|
632
|
-
token
|
|
633
|
-
})
|
|
634
|
-
}, key))
|
|
635
|
-
}, i))
|
|
636
|
-
})
|
|
637
|
-
}) : children
|
|
638
|
-
})
|
|
639
|
-
})
|
|
640
|
-
]
|
|
641
|
-
})
|
|
642
|
-
});
|
|
643
|
-
};
|
|
644
|
-
export { CodeBlock };
|
package/dist/Collapse.css
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
@layer components {
|
|
2
|
-
.ds-collapse .ds-collapse-header {
|
|
3
|
-
align-items: center;
|
|
4
|
-
display: flex;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.ds-collapse .ds-collapse-expand-icon {
|
|
8
|
-
flex-grow: 0;
|
|
9
|
-
flex-shrink: 0;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
align-items: center;
|
|
12
|
-
display: flex;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.ds-collapse .ds-collapse-header-text {
|
|
16
|
-
flex-grow: 1;
|
|
17
|
-
flex-shrink: 1;
|
|
18
|
-
min-width: 0;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|