@bioturing/components 0.15.5 → 0.16.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/components/Badge/component.js +16 -11
- package/dist/components/Badge/component.js.map +1 -1
- package/dist/components/Breadcrumb/component.js +4 -3
- package/dist/components/Breadcrumb/component.js.map +1 -1
- package/dist/components/Button/component.js +30 -3
- package/dist/components/Button/component.js.map +1 -1
- package/dist/components/Button/style.css +1 -1
- package/dist/components/CodeBlock/component.js +7 -6
- package/dist/components/CodeBlock/component.js.map +1 -1
- package/dist/components/CodeBlock/style.css +1 -1
- package/dist/components/Collapse/component.js +11 -10
- package/dist/components/Collapse/component.js.map +1 -1
- package/dist/components/DSRoot/component.js +8 -7
- package/dist/components/DSRoot/component.js.map +1 -1
- package/dist/components/DSRoot/context.js +5 -4
- package/dist/components/DSRoot/context.js.map +1 -1
- package/dist/components/DropdownMenu/component.js +1 -0
- package/dist/components/DropdownMenu/component.js.map +1 -1
- package/dist/components/Field/component.js +13 -12
- package/dist/components/Field/component.js.map +1 -1
- package/dist/components/Form/component.js +4 -3
- package/dist/components/Form/component.js.map +1 -1
- package/dist/components/Form/item.js +1 -0
- package/dist/components/Form/item.js.map +1 -1
- package/dist/components/IconButton/component.js +1 -0
- package/dist/components/IconButton/component.js.map +1 -1
- package/dist/components/Modal/Modal.js +1 -0
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/ModalProvider.js +1 -0
- package/dist/components/Modal/ModalProvider.js.map +1 -1
- package/dist/components/Modal/index.js +11 -10
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Popover/component.js +6 -5
- package/dist/components/Popover/component.js.map +1 -1
- package/dist/components/PopupPanel/component.js +74 -68
- package/dist/components/PopupPanel/component.js.map +1 -1
- package/dist/components/ScrollArea/component.js +10 -9
- package/dist/components/ScrollArea/component.js.map +1 -1
- package/dist/components/Slider/component.js +9 -8
- package/dist/components/Slider/component.js.map +1 -1
- package/dist/components/Splitter/component.js +12 -11
- package/dist/components/Splitter/component.js.map +1 -1
- package/dist/components/Stack/Stack.js.map +1 -1
- package/dist/components/Stack/StackChild.js +26 -23
- package/dist/components/Stack/StackChild.js.map +1 -1
- package/dist/components/Stack/style.css +1 -1
- package/dist/components/Table/component.js +54 -50
- package/dist/components/Table/component.js.map +1 -1
- package/dist/components/Table/style.css +1 -1
- package/dist/components/Tag/component.js +6 -5
- package/dist/components/Tag/component.js.map +1 -1
- package/dist/components/ThemeProvider/component.js +15 -14
- package/dist/components/ThemeProvider/component.js.map +1 -1
- package/dist/components/Toast/component.js +17 -16
- package/dist/components/Toast/component.js.map +1 -1
- package/dist/components/Toast/function.js +5 -4
- package/dist/components/Toast/function.js.map +1 -1
- package/dist/components/Tooltip/component.js +13 -12
- package/dist/components/Tooltip/component.js.map +1 -1
- package/dist/components/Tour/component.js +5 -4
- package/dist/components/Tour/component.js.map +1 -1
- package/dist/components/Transition/component.js +45 -32
- package/dist/components/Transition/component.js.map +1 -1
- package/dist/components/Tree/components.js +9 -8
- package/dist/components/Tree/components.js.map +1 -1
- package/dist/components/Tree/helpers.js +1 -0
- package/dist/components/Tree/helpers.js.map +1 -1
- package/dist/components/Tree/useTreeCommon.js +12 -11
- package/dist/components/Tree/useTreeCommon.js.map +1 -1
- package/dist/components/Truncate/component.js +1 -0
- package/dist/components/Truncate/component.js.map +1 -1
- package/dist/components/Upload/component.js +13 -11
- package/dist/components/Upload/component.js.map +1 -1
- package/dist/components/Upload/dragger.js +3 -2
- package/dist/components/Upload/dragger.js.map +1 -1
- package/dist/components/Upload/hooks.js +3 -2
- package/dist/components/Upload/hooks.js.map +1 -1
- package/dist/components/Upload/style.css +1 -0
- package/dist/components/VerticalCollapsiblePanel/component.js +35 -32
- package/dist/components/VerticalCollapsiblePanel/component.js.map +1 -1
- package/dist/components/hooks/antd.js +4 -3
- package/dist/components/hooks/antd.js.map +1 -1
- package/dist/components/hooks/base-ui.js +34 -28
- package/dist/components/hooks/base-ui.js.map +1 -1
- package/dist/components/hooks/useControlledState.js +17 -9
- package/dist/components/hooks/useControlledState.js.map +1 -1
- package/dist/components/utils/WithAntdTokens.js +14 -13
- package/dist/components/utils/WithAntdTokens.js.map +1 -1
- package/dist/components/utils/antdUtils.js +1 -0
- package/dist/components/utils/antdUtils.js.map +1 -1
- package/dist/index.d.ts +112 -59
- package/dist/index.js +78 -70
- package/dist/index.js.map +1 -1
- package/dist/metadata.js +81 -87
- package/dist/metadata.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import a from "antd/es/badge";
|
|
4
|
+
import m from "antd/es/badge/Ribbon";
|
|
3
5
|
import './style.css';/* empty css */
|
|
4
|
-
import { useCls as
|
|
6
|
+
import { useCls as c, useAntdCssVarClassname as i } from "../utils/antdUtils.js";
|
|
5
7
|
import { clsx as d } from "../utils/cn.js";
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
|
|
8
|
+
const l = ({ count: s, showZero: t, ...o }) => {
|
|
9
|
+
const r = c(), e = i();
|
|
10
|
+
return /* @__PURE__ */ n(
|
|
11
|
+
a,
|
|
10
12
|
{
|
|
11
13
|
count: s,
|
|
12
|
-
showZero:
|
|
13
|
-
className: d(
|
|
14
|
+
showZero: t,
|
|
15
|
+
className: d(r("badge"), e),
|
|
14
16
|
...o
|
|
15
17
|
}
|
|
16
18
|
);
|
|
17
|
-
}
|
|
19
|
+
}, x = Object.assign(l, {
|
|
20
|
+
Ribbon: m
|
|
21
|
+
});
|
|
18
22
|
export {
|
|
19
|
-
|
|
23
|
+
x as Badge,
|
|
24
|
+
l as InternalBadge
|
|
20
25
|
};
|
|
21
26
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/Badge/component.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/Badge/component.tsx"],"sourcesContent":["\"use client\";\n\nimport { clsx, useCls, useAntdCssVarClassname } from \"../utils\";\nimport {\n default as AntdBadge,\n type BadgeProps as AntdBadgeProps,\n} from \"antd/es/badge\";\nimport Ribbon from \"antd/es/badge/Ribbon\";\n// Import component-specific styles\nimport \"./style.css\";\n\nexport type BadgeProps = AntdBadgeProps;\n\nexport const InternalBadge = ({ count, showZero, ...rest }: BadgeProps) => {\n const cls = useCls();\n const antdCssVar = useAntdCssVarClassname();\n\n return (\n <AntdBadge\n count={count}\n showZero={showZero}\n className={clsx(cls(\"badge\"), antdCssVar)}\n {...rest}\n />\n );\n};\n\nexport const Badge = Object.assign(InternalBadge, {\n Ribbon,\n});\n"],"names":["InternalBadge","count","showZero","rest","cls","useCls","antdCssVar","useAntdCssVarClassname","jsx","AntdBadge","clsx","Badge","Ribbon"],"mappings":";;;;;;;AAaO,MAAMA,IAAgB,CAAC,EAAE,OAAAC,GAAO,UAAAC,GAAU,GAAGC,QAAuB;AACzE,QAAMC,IAAMC,EAAO,GACbC,IAAaC,EAAuB;AAGxC,SAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAAR;AAAA,MACA,UAAAC;AAAA,MACA,WAAWQ,EAAKN,EAAI,OAAO,GAAGE,CAAU;AAAA,MACvC,GAAGH;AAAA,IAAA;AAAA,EACN;AAEJ,GAEaQ,IAAQ,OAAO,OAAOX,GAAe;AAAA,EAChD,QAAAY;AACF,CAAC;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
3
|
import m from "antd/es/breadcrumb";
|
|
3
|
-
import
|
|
4
|
+
import b from "./useItemRender.js";
|
|
4
5
|
import './style.css';/* empty css */
|
|
5
6
|
import { useCls as c, useGetPrefixCls as d } from "../utils/antdUtils.js";
|
|
6
7
|
import { clsx as n } from "../utils/cn.js";
|
|
@@ -11,7 +12,7 @@ const f = ({
|
|
|
11
12
|
itemRender: t,
|
|
12
13
|
...a
|
|
13
14
|
}) => {
|
|
14
|
-
const i = c(), { getPrefixCls:
|
|
15
|
+
const i = c(), { getPrefixCls: u } = d(), l = u("breadcrumb"), p = b(l, t);
|
|
15
16
|
return /* @__PURE__ */ o(
|
|
16
17
|
m,
|
|
17
18
|
{
|
|
@@ -20,7 +21,7 @@ const f = ({
|
|
|
20
21
|
r
|
|
21
22
|
),
|
|
22
23
|
items: s,
|
|
23
|
-
itemRender:
|
|
24
|
+
itemRender: p,
|
|
24
25
|
...a
|
|
25
26
|
}
|
|
26
27
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/Breadcrumb/component.tsx"],"sourcesContent":["\"use client\";\nimport { default as AntBreadcrumb } from \"antd/es/breadcrumb\";\nimport { clsx, useCls, useGetPrefixCls } from \"../utils\";\nimport { type BreadcrumbProps, type BreadcrumbItemProps } from \"./types\";\nimport useItemRender from \"./useItemRender\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\n// Create inner function with forwarded ref\nconst BreadcrumbInner = ({\n className,\n items,\n noWrap = false,\n itemRender: outsideItemRender,\n ...rest\n}: BreadcrumbProps) => {\n const cls = useCls();\n const { getPrefixCls } = useGetPrefixCls();\n const componentPrefixCls = getPrefixCls(\"breadcrumb\");\n const itemRender = useItemRender(componentPrefixCls, outsideItemRender);\n\n return (\n <AntBreadcrumb\n className={clsx(\n cls(\"breadcrumb\", noWrap && \"breadcrumb-nowrap\"),\n className\n )}\n items={items}\n itemRender={itemRender}\n {...rest}\n />\n );\n};\n\n// Create the Item component\nconst Item = (props: BreadcrumbItemProps) => {\n const { className, ...restProps } = props;\n const cls = useCls();\n\n return (\n <AntBreadcrumb.Item\n className={clsx(cls(\"breadcrumb-item\"), className)}\n {...restProps}\n />\n );\n};\n\n// Create the Separator component\nconst Separator = (props: React.HTMLAttributes<HTMLSpanElement>) => {\n const { className, ...restProps } = props;\n\n return <AntBreadcrumb.Separator {...restProps} />;\n};\n\n// Create the final component with Item property and Separator properties\nexport const Breadcrumb = Object.assign(BreadcrumbInner, {\n Item,\n Separator,\n});\n"],"names":["BreadcrumbInner","className","items","noWrap","outsideItemRender","rest","cls","useCls","getPrefixCls","useGetPrefixCls","componentPrefixCls","itemRender","useItemRender","jsx","AntBreadcrumb","clsx","Item","props","restProps","Separator","Breadcrumb"],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/Breadcrumb/component.tsx"],"sourcesContent":["\"use client\";\nimport { default as AntBreadcrumb } from \"antd/es/breadcrumb\";\nimport { clsx, useCls, useGetPrefixCls } from \"../utils\";\nimport { type BreadcrumbProps, type BreadcrumbItemProps } from \"./types\";\nimport useItemRender from \"./useItemRender\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\n// Create inner function with forwarded ref\nconst BreadcrumbInner = ({\n className,\n items,\n noWrap = false,\n itemRender: outsideItemRender,\n ...rest\n}: BreadcrumbProps) => {\n const cls = useCls();\n const { getPrefixCls } = useGetPrefixCls();\n const componentPrefixCls = getPrefixCls(\"breadcrumb\");\n const itemRender = useItemRender(componentPrefixCls, outsideItemRender);\n\n return (\n <AntBreadcrumb\n className={clsx(\n cls(\"breadcrumb\", noWrap && \"breadcrumb-nowrap\"),\n className\n )}\n items={items}\n itemRender={itemRender}\n {...rest}\n />\n );\n};\n\n// Create the Item component\nconst Item = (props: BreadcrumbItemProps) => {\n const { className, ...restProps } = props;\n const cls = useCls();\n\n return (\n <AntBreadcrumb.Item\n className={clsx(cls(\"breadcrumb-item\"), className)}\n {...restProps}\n />\n );\n};\n\n// Create the Separator component\nconst Separator = (props: React.HTMLAttributes<HTMLSpanElement>) => {\n const { className, ...restProps } = props;\n\n return <AntBreadcrumb.Separator {...restProps} />;\n};\n\n// Create the final component with Item property and Separator properties\nexport const Breadcrumb = Object.assign(BreadcrumbInner, {\n Item,\n Separator,\n});\n"],"names":["BreadcrumbInner","className","items","noWrap","outsideItemRender","rest","cls","useCls","getPrefixCls","useGetPrefixCls","componentPrefixCls","itemRender","useItemRender","jsx","AntBreadcrumb","clsx","Item","props","restProps","Separator","Breadcrumb"],"mappings":";;;;;;;AAUA,MAAMA,IAAkB,CAAC;AAAA,EACvB,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,YAAYC;AAAA,EACZ,GAAGC;AACL,MAAuB;AACrB,QAAMC,IAAMC,EAAO,GACb,EAAE,cAAAC,EAAa,IAAIC,EAAgB,GACnCC,IAAqBF,EAAa,YAAY,GAC9CG,IAAaC,EAAcF,GAAoBN,CAAiB;AAGpE,SAAA,gBAAAS;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACTT,EAAI,cAAcH,KAAU,mBAAmB;AAAA,QAC/CF;AAAA,MACF;AAAA,MACA,OAAAC;AAAA,MACA,YAAAS;AAAA,MACC,GAAGN;AAAA,IAAA;AAAA,EACN;AAEJ,GAGMW,IAAO,CAACC,MAA+B;AAC3C,QAAM,EAAE,WAAAhB,GAAW,GAAGiB,EAAA,IAAcD,GAC9BX,IAAMC,EAAO;AAGjB,SAAA,gBAAAM;AAAA,IAACC,EAAc;AAAA,IAAd;AAAA,MACC,WAAWC,EAAKT,EAAI,iBAAiB,GAAGL,CAAS;AAAA,MAChD,GAAGiB;AAAA,IAAA;AAAA,EACN;AAEJ,GAGMC,IAAY,CAACF,MAAiD;AAClE,QAAM,EAAE,WAAAhB,GAAW,GAAGiB,EAAA,IAAcD;AAEpC,SAAQ,gBAAAJ,EAAAC,EAAc,WAAd,EAAyB,GAAGI,EAAW,CAAA;AACjD,GAGaE,IAAa,OAAO,OAAOpB,GAAiB;AAAA,EACvD,MAAAgB;AAAA,EACA,WAAAG;AACF,CAAC;"}
|
|
@@ -1,8 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as u, jsx as s } from "react/jsx-runtime";
|
|
2
3
|
import m from "antd/es/button";
|
|
3
|
-
import { forwardRef as
|
|
4
|
+
import { forwardRef as l } from "react";
|
|
4
5
|
import './style.css';/* empty css */
|
|
5
|
-
|
|
6
|
+
import { useCls as a } from "../utils/antdUtils.js";
|
|
7
|
+
const f = ({ negativeMargin: p = !0, type: t, size: n, variant: r, ...o }, e) => {
|
|
8
|
+
const c = p && (r === "text" || r === "link" || t == "text" || t === "link"), i = a();
|
|
9
|
+
return c ? /* @__PURE__ */ u(
|
|
10
|
+
"span",
|
|
11
|
+
{
|
|
12
|
+
className: i(
|
|
13
|
+
"btn-wrapper",
|
|
14
|
+
"btn-negative-margin-wrapper",
|
|
15
|
+
"btn-wrapper-" + n
|
|
16
|
+
),
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ s(
|
|
19
|
+
m,
|
|
20
|
+
{
|
|
21
|
+
ref: e,
|
|
22
|
+
type: t,
|
|
23
|
+
size: n,
|
|
24
|
+
variant: r,
|
|
25
|
+
...o
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
" "
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
) : /* @__PURE__ */ s(m, { ref: e, type: t, size: n, variant: r, ...o });
|
|
32
|
+
}, B = l(f);
|
|
6
33
|
export {
|
|
7
34
|
B as Button
|
|
8
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/Button/component.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/Button/component.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n default as AntdButton,\n type ButtonProps as AntdButtonProps,\n} from \"antd/es/button\";\nimport { forwardRef } from \"react\";\n\n// Import component-specific styles\nimport { useCls } from \"../utils\";\nimport \"./style.css\";\n\nexport interface ButtonProps extends AntdButtonProps {\n /**\n * If true, negative margin will be applied to the text and link buttons to make it align with content\n * @default true\n */\n negativeMargin?: boolean;\n}\n\nconst ButtonInner = (\n { negativeMargin = true, type, size, variant, ...rest }: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n) => {\n const useNegativeMargin =\n negativeMargin &&\n (variant === \"text\" ||\n variant === \"link\" ||\n type == \"text\" ||\n type === \"link\");\n const cls = useCls();\n return useNegativeMargin ? (\n <span\n className={cls(\n \"btn-wrapper\",\n \"btn-negative-margin-wrapper\",\n \"btn-wrapper-\" + size\n )}\n >\n <AntdButton\n ref={ref}\n type={type}\n size={size}\n variant={variant}\n {...rest}\n />{\" \"}\n </span>\n ) : (\n <AntdButton ref={ref} type={type} size={size} variant={variant} {...rest} />\n );\n};\n\nexport const Button = forwardRef(ButtonInner) as (\n props: ButtonProps & {\n ref?: React.ForwardedRef<HTMLButtonElement | HTMLAnchorElement>;\n }\n) => ReturnType<typeof ButtonInner>;\n"],"names":["ButtonInner","negativeMargin","type","size","variant","rest","ref","useNegativeMargin","cls","useCls","jsxs","jsx","AntdButton","Button","forwardRef"],"mappings":";;;;;;AAoBA,MAAMA,IAAc,CAClB,EAAE,gBAAAC,IAAiB,IAAM,MAAAC,GAAM,MAAAC,GAAM,SAAAC,GAAS,GAAGC,EAAK,GACtDC,MACG;AACG,QAAAC,IACJN,MACCG,MAAY,UACXA,MAAY,UACZF,KAAQ,UACRA,MAAS,SACPM,IAAMC,EAAO;AACnB,SAAOF,IACL,gBAAAG;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWF;AAAA,QACT;AAAA,QACA;AAAA,QACA,iBAAiBL;AAAA,MACnB;AAAA,MAEA,UAAA;AAAA,QAAA,gBAAAQ;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,KAAAN;AAAA,YACA,MAAAJ;AAAA,YACA,MAAAC;AAAA,YACA,SAAAC;AAAA,YACC,GAAGC;AAAA,UAAA;AAAA,QACN;AAAA,QAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,sBAGJO,GAAW,EAAA,KAAAN,GAAU,MAAAJ,GAAY,MAAAC,GAAY,SAAAC,GAAmB,GAAGC,GAAM;AAE9E,GAEaQ,IAASC,EAAWd,CAAW;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{span.ds-btn-icon{display:flex;align-items:center}}
|
|
1
|
+
@layer components{span.ds-btn-icon{display:flex;align-items:center}.ds-btn-negative-margin-wrapper{display:inline-flex;flex-shrink:0}.ds-btn-negative-margin-wrapper,.ds-btn-negative-margin-wrapper.ds-btn-wrapper-lg{margin-inline:-1rem}.ds-btn-negative-margin-wrapper.ds-btn-wrapper-sm{margin-inline:-.5rem}.ds-btn-loading .ds-btn-loading-icon{position:absolute}.ds-btn-loading>span:not(.ds-btn-loading-icon){opacity:0}}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as o, jsxs as _ } from "react/jsx-runtime";
|
|
2
3
|
import { useState as p, useEffect as $ } from "react";
|
|
3
4
|
import { Check as q, Copy as z } from "@bioturing/assets";
|
|
@@ -14,13 +15,13 @@ import { clsx as Z } from "../utils/cn.js";
|
|
|
14
15
|
import { IconButton as H } from "../IconButton/component.js";
|
|
15
16
|
const fo = ({
|
|
16
17
|
code: u,
|
|
17
|
-
children:
|
|
18
|
+
children: s,
|
|
18
19
|
// initial,
|
|
19
20
|
lang: m = "tsx",
|
|
20
21
|
className: S,
|
|
21
22
|
options: n,
|
|
22
23
|
activeOption: x,
|
|
23
|
-
defaultActiveOption:
|
|
24
|
+
defaultActiveOption: v = 0,
|
|
24
25
|
onActiveOptionChange: T,
|
|
25
26
|
copyText: g = "Copy",
|
|
26
27
|
copySuccessText: w = "Copied",
|
|
@@ -31,7 +32,7 @@ const fo = ({
|
|
|
31
32
|
const [i, k] = X(
|
|
32
33
|
x,
|
|
33
34
|
T,
|
|
34
|
-
|
|
35
|
+
v
|
|
35
36
|
), [l, j] = p(u || ""), [A, B] = p(m), h = n && n.length > 0;
|
|
36
37
|
$(() => {
|
|
37
38
|
var t, r;
|
|
@@ -42,14 +43,14 @@ const fo = ({
|
|
|
42
43
|
}, [
|
|
43
44
|
u,
|
|
44
45
|
i,
|
|
45
|
-
|
|
46
|
+
v,
|
|
46
47
|
n,
|
|
47
48
|
m,
|
|
48
49
|
h,
|
|
49
50
|
k
|
|
50
51
|
]);
|
|
51
52
|
const [L, a] = p(g), [M, b] = p(!1), D = () => {
|
|
52
|
-
const t = l || V(
|
|
53
|
+
const t = l || V(s);
|
|
53
54
|
try {
|
|
54
55
|
navigator.clipboard.writeText(t).then(() => {
|
|
55
56
|
a(w), b(!0);
|
|
@@ -114,7 +115,7 @@ const fo = ({
|
|
|
114
115
|
}
|
|
115
116
|
)
|
|
116
117
|
}
|
|
117
|
-
) :
|
|
118
|
+
) : s })
|
|
118
119
|
}
|
|
119
120
|
)
|
|
120
121
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/CodeBlock/component.tsx"],"sourcesContent":["\"use client\";\nimport { useEffect, useState } from \"react\";\nimport { Check, Copy } from \"@bioturing/assets\";\nimport { IconButton } from \"../IconButton\";\nimport { ScrollArea } from \"../ScrollArea\";\nimport { Segmented } from \"../Segmented\";\nimport { ThemeProvider } from \"../ThemeProvider/component\";\nimport { useControlledState } from \"../hooks\";\nimport { clsx, useCls, WithAntdTokens } from \"../utils\";\nimport { Highlight, themes } from \"prism-react-renderer\";\nimport type { CodeBlockProps } from \"./types\";\nimport { reactNodeToString } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport const CodeBlock = ({\n code,\n children,\n // initial,\n lang: defaultLang = \"tsx\",\n className,\n options,\n activeOption: controlledActiveOption,\n defaultActiveOption = 0,\n onActiveOptionChange,\n copyText = \"Copy\",\n copySuccessText = \"Copied\",\n classNames,\n maxHeight,\n ...rest\n}: CodeBlockProps) => {\n const [activeOption, setActiveOption] = useControlledState(\n controlledActiveOption,\n onActiveOptionChange,\n defaultActiveOption\n );\n\n const [currentCode, setCurrentCode] = useState(code || \"\");\n const [lang, setLang] = useState(defaultLang);\n\n const hasOptions = options && options.length > 0;\n\n useEffect(() => {\n if (hasOptions) {\n const newCode = options[activeOption]?.code || \"\";\n const newLang = options[activeOption]?.lang || defaultLang;\n setCurrentCode(newCode);\n setLang(newLang);\n }\n }, [\n code,\n activeOption,\n defaultActiveOption,\n options,\n defaultLang,\n hasOptions,\n setActiveOption,\n ]);\n\n const [tooltipContent, setTooltipContent] = useState(copyText);\n const [copySuccess, setCopySuccess] = useState(false);\n\n const handleCopy = () => {\n const codeContent = currentCode ? currentCode : reactNodeToString(children);\n try {\n navigator.clipboard.writeText(codeContent).then(() => {\n setTooltipContent(copySuccessText);\n setCopySuccess(true);\n });\n } catch (_) {\n setTooltipContent(\"Failed to copy\");\n }\n };\n\n const handleMouseLeave = () => {\n setTooltipContent(copyText);\n setCopySuccess(false);\n };\n\n const cls = useCls();\n return (\n <ThemeProvider theme={\"dark\"}>\n <WithAntdTokens\n className={clsx(cls(\"code-block\"), className, classNames?.root)}\n {...rest}\n >\n {hasOptions && (\n <div className={cls(\"code-block-header\", classNames?.header)}>\n <Segmented\n value={activeOption}\n onChange={setActiveOption}\n options={options.map((opt, index) => ({\n label: opt.label,\n value: index,\n }))}\n />\n </div>\n )}\n <div className={cls(\"code-block-copy\")}>\n <IconButton\n onClick={handleCopy}\n label={tooltipContent}\n onMouseLeave={handleMouseLeave}\n >\n {copySuccess ? <Check /> : <Copy />}\n </IconButton>\n </div>\n <div\n className={cls(\"code-block-content\", classNames?.content)}\n style={{\n maxHeight:\n maxHeight &&\n (typeof maxHeight === \"number\" ? `${maxHeight}px` : maxHeight),\n }}\n >\n <ScrollArea>\n {currentCode ? (\n <Highlight\n language={lang}\n code={currentCode}\n theme={themes.vsDark}\n >\n {({\n className,\n style,\n tokens,\n getLineProps,\n getTokenProps,\n }) => (\n <pre\n style={{ ...style, backgroundColor: \"transparent\" }}\n className={className}\n >\n {tokens.map((line, i) => (\n <div key={i} {...getLineProps({ line })}>\n {/* <span>{i + 1}</span> */}\n {line.map((token, key) => (\n <span key={key} {...getTokenProps({ token })} />\n ))}\n </div>\n ))}\n </pre>\n )}\n </Highlight>\n ) : (\n children\n )}\n </ScrollArea>\n </div>\n </WithAntdTokens>\n </ThemeProvider>\n );\n};\n"],"names":["CodeBlock","code","children","defaultLang","className","options","controlledActiveOption","defaultActiveOption","onActiveOptionChange","copyText","copySuccessText","classNames","maxHeight","rest","activeOption","setActiveOption","useControlledState","currentCode","setCurrentCode","useState","lang","setLang","hasOptions","useEffect","newCode","_a","newLang","_b","tooltipContent","setTooltipContent","copySuccess","setCopySuccess","handleCopy","codeContent","reactNodeToString","handleMouseLeave","cls","useCls","jsx","ThemeProvider","jsxs","WithAntdTokens","clsx","Segmented","opt","index","IconButton","Check","Copy","ScrollArea","Highlight","themes","style","tokens","getLineProps","getTokenProps","line","i","token","key"],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/CodeBlock/component.tsx"],"sourcesContent":["\"use client\";\nimport { useEffect, useState } from \"react\";\nimport { Check, Copy } from \"@bioturing/assets\";\nimport { IconButton } from \"../IconButton\";\nimport { ScrollArea } from \"../ScrollArea\";\nimport { Segmented } from \"../Segmented\";\nimport { ThemeProvider } from \"../ThemeProvider/component\";\nimport { useControlledState } from \"../hooks\";\nimport { clsx, useCls, WithAntdTokens } from \"../utils\";\nimport { Highlight, themes } from \"prism-react-renderer\";\nimport type { CodeBlockProps } from \"./types\";\nimport { reactNodeToString } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport const CodeBlock = ({\n code,\n children,\n // initial,\n lang: defaultLang = \"tsx\",\n className,\n options,\n activeOption: controlledActiveOption,\n defaultActiveOption = 0,\n onActiveOptionChange,\n copyText = \"Copy\",\n copySuccessText = \"Copied\",\n classNames,\n maxHeight,\n ...rest\n}: CodeBlockProps) => {\n const [activeOption, setActiveOption] = useControlledState(\n controlledActiveOption,\n onActiveOptionChange,\n defaultActiveOption\n );\n\n const [currentCode, setCurrentCode] = useState(code || \"\");\n const [lang, setLang] = useState(defaultLang);\n\n const hasOptions = options && options.length > 0;\n\n useEffect(() => {\n if (hasOptions) {\n const newCode = options[activeOption]?.code || \"\";\n const newLang = options[activeOption]?.lang || defaultLang;\n setCurrentCode(newCode);\n setLang(newLang);\n }\n }, [\n code,\n activeOption,\n defaultActiveOption,\n options,\n defaultLang,\n hasOptions,\n setActiveOption,\n ]);\n\n const [tooltipContent, setTooltipContent] = useState(copyText);\n const [copySuccess, setCopySuccess] = useState(false);\n\n const handleCopy = () => {\n const codeContent = currentCode ? currentCode : reactNodeToString(children);\n try {\n navigator.clipboard.writeText(codeContent).then(() => {\n setTooltipContent(copySuccessText);\n setCopySuccess(true);\n });\n } catch (_) {\n setTooltipContent(\"Failed to copy\");\n }\n };\n\n const handleMouseLeave = () => {\n setTooltipContent(copyText);\n setCopySuccess(false);\n };\n\n const cls = useCls();\n return (\n <ThemeProvider theme={\"dark\"}>\n <WithAntdTokens\n className={clsx(cls(\"code-block\"), className, classNames?.root)}\n {...rest}\n >\n {hasOptions && (\n <div className={cls(\"code-block-header\", classNames?.header)}>\n <Segmented\n value={activeOption}\n onChange={setActiveOption}\n options={options.map((opt, index) => ({\n label: opt.label,\n value: index,\n }))}\n />\n </div>\n )}\n <div className={cls(\"code-block-copy\")}>\n <IconButton\n onClick={handleCopy}\n label={tooltipContent}\n onMouseLeave={handleMouseLeave}\n >\n {copySuccess ? <Check /> : <Copy />}\n </IconButton>\n </div>\n <div\n className={cls(\"code-block-content\", classNames?.content)}\n style={{\n maxHeight:\n maxHeight &&\n (typeof maxHeight === \"number\" ? `${maxHeight}px` : maxHeight),\n }}\n >\n <ScrollArea>\n {currentCode ? (\n <Highlight\n language={lang}\n code={currentCode}\n theme={themes.vsDark}\n >\n {({\n className,\n style,\n tokens,\n getLineProps,\n getTokenProps,\n }) => (\n <pre\n style={{ ...style, backgroundColor: \"transparent\" }}\n className={className}\n >\n {tokens.map((line, i) => (\n <div key={i} {...getLineProps({ line })}>\n {/* <span>{i + 1}</span> */}\n {line.map((token, key) => (\n <span key={key} {...getTokenProps({ token })} />\n ))}\n </div>\n ))}\n </pre>\n )}\n </Highlight>\n ) : (\n children\n )}\n </ScrollArea>\n </div>\n </WithAntdTokens>\n </ThemeProvider>\n );\n};\n"],"names":["CodeBlock","code","children","defaultLang","className","options","controlledActiveOption","defaultActiveOption","onActiveOptionChange","copyText","copySuccessText","classNames","maxHeight","rest","activeOption","setActiveOption","useControlledState","currentCode","setCurrentCode","useState","lang","setLang","hasOptions","useEffect","newCode","_a","newLang","_b","tooltipContent","setTooltipContent","copySuccess","setCopySuccess","handleCopy","codeContent","reactNodeToString","handleMouseLeave","cls","useCls","jsx","ThemeProvider","jsxs","WithAntdTokens","clsx","Segmented","opt","index","IconButton","Check","Copy","ScrollArea","Highlight","themes","style","tokens","getLineProps","getTokenProps","line","i","token","key"],"mappings":";;;;;;;;;;;;;;;AAgBO,MAAMA,KAAY,CAAC;AAAA,EACxB,MAAAC;AAAA,EACA,UAAAC;AAAA;AAAA,EAEA,MAAMC,IAAc;AAAA,EACpB,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,cAAcC;AAAA,EACd,qBAAAC,IAAsB;AAAA,EACtB,sBAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,iBAAAC,IAAkB;AAAA,EAClB,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,MAAsB;AACd,QAAA,CAACC,GAAcC,CAAe,IAAIC;AAAA,IACtCV;AAAA,IACAE;AAAA,IACAD;AAAA,EACF,GAEM,CAACU,GAAaC,CAAc,IAAIC,EAASlB,KAAQ,EAAE,GACnD,CAACmB,GAAMC,CAAO,IAAIF,EAAShB,CAAW,GAEtCmB,IAAajB,KAAWA,EAAQ,SAAS;AAE/C,EAAAkB,EAAU,MAAM;;AACd,QAAID,GAAY;AACd,YAAME,MAAUC,IAAApB,EAAQS,CAAY,MA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AIJvD,EAEJ,CAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.ds-code-block{background:var(--ds-color-bg-layout);box-shadow:0 0 0 1px inset var(--ds-color-split);border-radius:var(--ds-border-radius);padding:1rem;position:relative;font-family:var(--font-mono)}.ds-code-block-header{display:flex;justify-items:start;margin-bottom:.75rem}.ds-code-block-copy{top:1rem;right:.75rem;opacity:0;transition:opacity .2s ease-in-out;position:absolute}.ds-code-block:hover .ds-code-block-copy{opacity:100}.ds-code-block-content{padding-right:1.5rem;display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}.ds-code-block-content .ds-scoll-area{max-height:30rem}}
|
|
1
|
+
@layer components{.ds-code-block{background:var(--ds-color-bg-layout);box-shadow:0 0 0 1px inset var(--ds-color-split);border-radius:var(--ds-border-radius);padding:1rem;position:relative;font-family:var(--font-mono);color:var(--ds-color-text)}.ds-code-block-header{display:flex;justify-items:start;margin-bottom:.75rem}.ds-code-block-copy{top:1rem;right:.75rem;opacity:0;transition:opacity .2s ease-in-out;position:absolute}.ds-code-block:hover .ds-code-block-copy{opacity:100}.ds-code-block-content{padding-right:1.5rem;display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}.ds-code-block-content .ds-scoll-area{max-height:30rem}}
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
3
|
import { Collapse as r } from "antd";
|
|
3
|
-
import { forwardRef as
|
|
4
|
+
import { forwardRef as c } from "react";
|
|
4
5
|
import './style.css';/* empty css */
|
|
5
6
|
import { useCls as t } from "../utils/antdUtils.js";
|
|
6
|
-
import { clsx as
|
|
7
|
-
const m = (s,
|
|
8
|
-
const { className:
|
|
7
|
+
import { clsx as p } from "../utils/cn.js";
|
|
8
|
+
const m = (s, e) => {
|
|
9
|
+
const { className: o, ...l } = s, n = t();
|
|
9
10
|
return /* @__PURE__ */ a(
|
|
10
11
|
r,
|
|
11
12
|
{
|
|
12
|
-
ref:
|
|
13
|
-
className: n("collapse",
|
|
13
|
+
ref: e,
|
|
14
|
+
className: n("collapse", o),
|
|
14
15
|
...l
|
|
15
16
|
}
|
|
16
17
|
);
|
|
17
|
-
}, i =
|
|
18
|
-
const { className:
|
|
18
|
+
}, i = c(m), f = (s) => {
|
|
19
|
+
const { className: e, ...o } = s, l = t();
|
|
19
20
|
return console.warn(
|
|
20
21
|
"[bioturing-ds] Collapse.Panel is deprecated. Please use items prop instead."
|
|
21
22
|
), /* @__PURE__ */ a(
|
|
22
23
|
r.Panel,
|
|
23
24
|
{
|
|
24
|
-
className:
|
|
25
|
-
...
|
|
25
|
+
className: p(l("collapse-panel"), e),
|
|
26
|
+
...o
|
|
26
27
|
}
|
|
27
28
|
);
|
|
28
29
|
}, b = Object.assign(i, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/Collapse/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n Collapse as AntCollapse,\n type CollapseProps as AntCollapseProps,\n type CollapsePanelProps as AntCollapsePanelProps,\n} from \"antd\";\nimport { type ForwardedRef, forwardRef } from \"react\";\nimport { useCls, clsx } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\n// Define props interface extending Ant Design's CollapseProps\nexport interface CollapseProps extends AntCollapseProps {}\n\n// Define props interface extending Ant Design's CollapsePanelProps\nexport interface CollapsePanelProps extends AntCollapsePanelProps {}\n\n// Create inner function with forwarded ref\nconst CollapseInner = (\n props: CollapseProps,\n ref: ForwardedRef<HTMLDivElement>\n) => {\n const { className, ...restProps } = props;\n const cls = useCls();\n return (\n <AntCollapse\n ref={ref}\n className={cls(\"collapse\", className)}\n {...restProps}\n />\n );\n};\n\n// Use forwardRef with type assertion\nconst MainCollapse = forwardRef(CollapseInner) as (\n props: CollapseProps & {\n ref?: React.ForwardedRef<HTMLDivElement>;\n }\n) => ReturnType<typeof CollapseInner>;\n\n// Create the Panel component (deprecated)\nconst Panel = (props: CollapsePanelProps) => {\n const { className, ...restProps } = props;\n const cls = useCls();\n console.warn(\n \"[bioturing-ds] Collapse.Panel is deprecated. Please use items prop instead.\"\n );\n return (\n <AntCollapse.Panel\n className={clsx(cls(\"collapse-panel\"), className)}\n {...restProps}\n />\n );\n};\n\n// Create the final component with Panel property\nexport const Collapse = Object.assign(MainCollapse, {\n Panel: Panel,\n});\n"],"names":["CollapseInner","props","ref","className","restProps","cls","useCls","jsx","AntCollapse","MainCollapse","forwardRef","Panel","clsx","Collapse"],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/Collapse/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n Collapse as AntCollapse,\n type CollapseProps as AntCollapseProps,\n type CollapsePanelProps as AntCollapsePanelProps,\n} from \"antd\";\nimport { type ForwardedRef, forwardRef } from \"react\";\nimport { useCls, clsx } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\n// Define props interface extending Ant Design's CollapseProps\nexport interface CollapseProps extends AntCollapseProps {}\n\n// Define props interface extending Ant Design's CollapsePanelProps\nexport interface CollapsePanelProps extends AntCollapsePanelProps {}\n\n// Create inner function with forwarded ref\nconst CollapseInner = (\n props: CollapseProps,\n ref: ForwardedRef<HTMLDivElement>\n) => {\n const { className, ...restProps } = props;\n const cls = useCls();\n return (\n <AntCollapse\n ref={ref}\n className={cls(\"collapse\", className)}\n {...restProps}\n />\n );\n};\n\n// Use forwardRef with type assertion\nconst MainCollapse = forwardRef(CollapseInner) as (\n props: CollapseProps & {\n ref?: React.ForwardedRef<HTMLDivElement>;\n }\n) => ReturnType<typeof CollapseInner>;\n\n// Create the Panel component (deprecated)\nconst Panel = (props: CollapsePanelProps) => {\n const { className, ...restProps } = props;\n const cls = useCls();\n console.warn(\n \"[bioturing-ds] Collapse.Panel is deprecated. Please use items prop instead.\"\n );\n return (\n <AntCollapse.Panel\n className={clsx(cls(\"collapse-panel\"), className)}\n {...restProps}\n />\n );\n};\n\n// Create the final component with Panel property\nexport const Collapse = Object.assign(MainCollapse, {\n Panel: Panel,\n});\n"],"names":["CollapseInner","props","ref","className","restProps","cls","useCls","jsx","AntCollapse","MainCollapse","forwardRef","Panel","clsx","Collapse"],"mappings":";;;;;;;AAmBA,MAAMA,IAAgB,CACpBC,GACAC,MACG;AACH,QAAM,EAAE,WAAAC,GAAW,GAAGC,EAAA,IAAcH,GAC9BI,IAAMC,EAAO;AAEjB,SAAA,gBAAAC;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,KAAAN;AAAA,MACA,WAAWG,EAAI,YAAYF,CAAS;AAAA,MACnC,GAAGC;AAAA,IAAA;AAAA,EACN;AAEJ,GAGMK,IAAeC,EAAWV,CAAa,GAOvCW,IAAQ,CAACV,MAA8B;AAC3C,QAAM,EAAE,WAAAE,GAAW,GAAGC,EAAA,IAAcH,GAC9BI,IAAMC,EAAO;AACX,iBAAA;AAAA,IACN;AAAA,EACF,GAEE,gBAAAC;AAAA,IAACC,EAAY;AAAA,IAAZ;AAAA,MACC,WAAWI,EAAKP,EAAI,gBAAgB,GAAGF,CAAS;AAAA,MAC/C,GAAGC;AAAA,IAAA;AAAA,EACN;AAEJ,GAGaS,IAAW,OAAO,OAAOJ,GAAc;AAAA,EAClD,OAAAE;AACF,CAAC;"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
2
3
|
import { ThemeProvider as l } from "../ThemeProvider/component.js";
|
|
3
4
|
import { Modal as n } from "../Modal/index.js";
|
|
4
5
|
import c from "antd/es/app/App";
|
|
5
|
-
import { DSRootContextProvider as
|
|
6
|
+
import { DSRootContextProvider as s } from "./context.js";
|
|
6
7
|
import './style.css';/* empty css */
|
|
7
8
|
import { Toast as i } from "../Toast/component.js";
|
|
8
|
-
const
|
|
9
|
+
const j = ({
|
|
9
10
|
className: t,
|
|
10
|
-
appendClassesTo:
|
|
11
|
-
children:
|
|
11
|
+
appendClassesTo: e = "html",
|
|
12
|
+
children: m,
|
|
12
13
|
theme: o,
|
|
13
14
|
...d
|
|
14
|
-
}) => /* @__PURE__ */ r(
|
|
15
|
+
}) => /* @__PURE__ */ r(s, { value: { theme: o }, children: /* @__PURE__ */ r(l, { theme: o, ...d, appendClassesTo: e, children: /* @__PURE__ */ r(c, { className: t, children: /* @__PURE__ */ r(i.Provider, { children: /* @__PURE__ */ p(n.Provider, { children: [
|
|
15
16
|
/* @__PURE__ */ r(i.List, {}),
|
|
16
|
-
|
|
17
|
+
m
|
|
17
18
|
] }) }) }) }) });
|
|
18
19
|
export {
|
|
19
|
-
|
|
20
|
+
j as DSRoot
|
|
20
21
|
};
|
|
21
22
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/DSRoot/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n ThemeProvider,\n type ThemeProviderProps,\n} from \"../ThemeProvider/component\";\nimport { Toast } from \"../Toast\";\nimport { Modal } from \"../Modal\";\nimport App from \"antd/es/app/App\";\nimport { DSRootContextProvider } from \"./context\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface DSRootProps extends ThemeProviderProps {\n /**\n * Classname passed to App component\n */\n className?: string;\n\n /**\n * Element to which the theme classes are appended\n * @default \"html\"\n */\n appendClassesTo?: string | HTMLElement;\n}\n\nexport const DSRoot = ({\n className,\n appendClassesTo = \"html\",\n children,\n theme,\n ...props\n}: DSRootProps) => {\n return (\n <DSRootContextProvider value={{ theme: theme }}>\n <ThemeProvider theme={theme} {...props} appendClassesTo={appendClassesTo}>\n <App className={className}>\n <Toast.Provider>\n <Modal.Provider>\n <Toast.List />\n {children}\n </Modal.Provider>\n </Toast.Provider>\n </App>\n </ThemeProvider>\n </DSRootContextProvider>\n );\n};\n"],"names":["DSRoot","className","appendClassesTo","children","theme","props","jsx","DSRootContextProvider","ThemeProvider","App","Toast","jsxs","Modal"],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/DSRoot/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n ThemeProvider,\n type ThemeProviderProps,\n} from \"../ThemeProvider/component\";\nimport { Toast } from \"../Toast\";\nimport { Modal } from \"../Modal\";\nimport App from \"antd/es/app/App\";\nimport { DSRootContextProvider } from \"./context\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface DSRootProps extends ThemeProviderProps {\n /**\n * Classname passed to App component\n */\n className?: string;\n\n /**\n * Element to which the theme classes are appended\n * @default \"html\"\n */\n appendClassesTo?: string | HTMLElement;\n}\n\nexport const DSRoot = ({\n className,\n appendClassesTo = \"html\",\n children,\n theme,\n ...props\n}: DSRootProps) => {\n return (\n <DSRootContextProvider value={{ theme: theme }}>\n <ThemeProvider theme={theme} {...props} appendClassesTo={appendClassesTo}>\n <App className={className}>\n <Toast.Provider>\n <Modal.Provider>\n <Toast.List />\n {children}\n </Modal.Provider>\n </Toast.Provider>\n </App>\n </ThemeProvider>\n </DSRootContextProvider>\n );\n};\n"],"names":["DSRoot","className","appendClassesTo","children","theme","props","jsx","DSRootContextProvider","ThemeProvider","App","Toast","jsxs","Modal"],"mappings":";;;;;;;;AA0BO,MAAMA,IAAS,CAAC;AAAA,EACrB,WAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAC,EAACC,KAAsB,OAAO,EAAE,OAAAH,EAC9B,GAAA,UAAA,gBAAAE,EAACE,GAAc,EAAA,OAAAJ,GAAe,GAAGC,GAAO,iBAAAH,GACtC,UAAC,gBAAAI,EAAAG,GAAA,EAAI,WAAAR,GACH,UAAC,gBAAAK,EAAAI,EAAM,UAAN,EACC,UAAA,gBAAAC,EAACC,EAAM,UAAN,EACC,UAAA;AAAA,EAAC,gBAAAN,EAAAI,EAAM,MAAN,EAAW;AAAA,EACXP;AACH,EAAA,CAAA,EACF,CAAA,GACF,EAAA,CACF,EACF,CAAA;"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import t from "react";
|
|
2
|
-
const
|
|
3
|
+
const e = t.createContext({
|
|
3
4
|
theme: "light"
|
|
4
|
-
}),
|
|
5
|
+
}), n = e.Provider, r = () => t.useContext(e);
|
|
5
6
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
n as DSRootContextProvider,
|
|
8
|
+
r as useDS
|
|
8
9
|
};
|
|
9
10
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../../src/components/DSRoot/context.ts"],"sourcesContent":["\"use client\";\nimport React from \"react\";\n\nconst DSRootContext = React.createContext<{\n theme: \"light\" | \"dark\";\n}>({\n theme: \"light\",\n});\n\nexport const DSRootContextProvider = DSRootContext.Provider;\n\nexport const useDS = () => React.useContext(DSRootContext);\n"],"names":["DSRootContext","React","DSRootContextProvider","useDS"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../src/components/DSRoot/context.ts"],"sourcesContent":["\"use client\";\nimport React from \"react\";\n\nconst DSRootContext = React.createContext<{\n theme: \"light\" | \"dark\";\n}>({\n theme: \"light\",\n});\n\nexport const DSRootContextProvider = DSRootContext.Provider;\n\nexport const useDS = () => React.useContext(DSRootContext);\n"],"names":["DSRootContext","React","DSRootContextProvider","useDS"],"mappings":";;AAGA,MAAMA,IAAgBC,EAAM,cAEzB;AAAA,EACD,OAAO;AACT,CAAC,GAEYC,IAAwBF,EAAc,UAEtCG,IAAQ,MAAMF,EAAM,WAAWD,CAAa;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/DropdownMenu/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n useCls,\n clsx,\n useAntdCssVarClassname,\n parseAntdPlacement,\n} from \"../utils\";\nimport { Menu } from \"@base-ui-components/react/menu\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useRef } from \"react\";\nimport { useControlled } from \"@base-ui-components/react/utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport type DropdownMenuItemType =\n | {\n type: \"item\";\n label?: React.ReactNode;\n disabled?: boolean;\n icon?: React.ReactNode;\n key: React.Key;\n onClick?: React.HTMLAttributes<HTMLElement>[\"onClick\"];\n onMouseEnter?: React.HTMLAttributes<HTMLElement>[\"onMouseEnter\"];\n onMouseLeave?: React.HTMLAttributes<HTMLElement>[\"onMouseLeave\"];\n onMouseOver?: React.HTMLAttributes<HTMLElement>[\"onMouseOver\"];\n onMouseOut?: React.HTMLAttributes<HTMLElement>[\"onMouseOut\"];\n danger?: boolean;\n ref?: React.Ref<HTMLElement>;\n }\n | {\n type: \"divider\";\n }\n | {\n type: \"header\";\n title?: React.ReactNode;\n };\n\nexport interface DropdownMenuProps {\n /** Array of menu items to be displayed in the dropdown */\n items: DropdownMenuItemType[];\n /** Custom render function for the trigger element */\n children?: React.ComponentProps<typeof Menu.Trigger>[\"render\"];\n /**\n * Placement of the dropdown relative to the trigger element\n * @default \"bottomLeft\"\n */\n placement?: PopoverProps[\"placement\"];\n /**\n * Whether to open the dropdown on hover instead of click\n * @default false\n */\n openOnHover?: boolean;\n /**\n * Controlled open state of the dropdown\n */\n open?: boolean;\n /**\n * Callback fired when the dropdown open state changes\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Additional CSS class for the dropdown component\n */\n className?: string;\n /**\n * Custom class names for different parts of the dropdown\n * @default {}\n */\n classNames?: {\n root?: string;\n trigger?: string;\n popup?: string;\n group?: string;\n groupLabel?: string;\n item?: string;\n itemIcon?: string;\n itemText?: string;\n separator?: string;\n positioner?: string;\n };\n /**\n * Custom render function for menu items\n */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n}\n\ninterface DropdownMenuGroup {\n label: React.ReactNode | null;\n items: DropdownMenuItemType[];\n}\n\nexport const DropdownMenu = ({\n children,\n items,\n placement,\n openOnHover,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n className,\n itemRender,\n classNames,\n}: DropdownMenuProps) => {\n const [open, setOpen] = useControlled({\n controlled: outsideOpen,\n default: false,\n name: \"open\",\n });\n const onOpenChange = useCallback(\n (newValue: boolean) => {\n setOpen(newValue);\n outsideOnOpenChange?.(newValue);\n },\n [setOpen, outsideOnOpenChange]\n );\n const cls = useCls();\n const antdCssVarClassname = useAntdCssVarClassname();\n const headlessUIPlacement = parseAntdPlacement(placement);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const itemGroups = items.reduce<DropdownMenuGroup[]>((acc, current) => {\n // If no groups exist yet and current item is not a header, create default group\n if (acc.length === 0 && current.type !== \"header\") {\n acc.push({\n label: null,\n items: [],\n });\n }\n\n // If it's a header, create a new group\n if (current.type === \"header\") {\n acc.push({\n label: current.title,\n items: [],\n });\n }\n // If it's an item and we have at least one group, add it to the last group's items\n else if (\n (current.type === \"item\" || current.type === \"divider\") &&\n acc.length > 0\n ) {\n acc[acc.length - 1].items.push(current);\n }\n // Skip dividers\n return acc;\n }, []);\n\n return (\n <Menu.Root\n openOnHover={openOnHover}\n open={open}\n onOpenChange={onOpenChange}\n >\n <Menu.Trigger\n render={children}\n ref={buttonRef}\n className={clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n antdCssVarClassname\n )}\n ></Menu.Trigger>\n <Menu.Portal>\n <Menu.Positioner\n side={headlessUIPlacement.placement}\n align={headlessUIPlacement.align}\n sideOffset={4}\n className={clsx(cls(\"dropdown-menu-root\"), classNames?.root)}\n >\n <Menu.Popup\n className={clsx(\n cls(\"dropdown-menu\"),\n className,\n classNames?.popup,\n antdCssVarClassname\n )}\n >\n {itemGroups.map((group, i) => {\n return (\n <Menu.Group\n key={\"group\" + i}\n className={clsx(\n cls(\"dropdown-menu-group\"),\n classNames?.group\n )}\n >\n {group.label && (\n <Menu.GroupLabel\n key={i}\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n )}\n {group.items.map((item, j) => {\n return item.type == \"item\" ? (\n <Menu.Item\n key={i + \"-\" + j}\n className={clsx(\n cls(\"dropdown-menu-item\"),\n classNames?.item\n )}\n disabled={item.disabled}\n data-danger={item.danger}\n ref={item.ref}\n onClick={item.onClick}\n onMouseEnter={item.onMouseEnter}\n onMouseLeave={item.onMouseLeave}\n onMouseOver={item.onMouseOver}\n onMouseOut={item.onMouseOut}\n render={\n itemRender\n ? (itemProps) => itemRender(item, itemProps)\n : undefined\n }\n >\n {item.icon && (\n <span\n className={clsx(\n cls(\"dropdown-menu-item-icon\"),\n classNames?.itemIcon\n )}\n >\n {item.icon}\n </span>\n )}\n <span>{item.label}</span>\n </Menu.Item>\n ) : item.type == \"divider\" ? (\n <Menu.Separator\n key={i}\n className={clsx(\n cls(\"dropdown-menu-divider\"),\n classNames?.separator\n )}\n ></Menu.Separator>\n ) : item.type == \"header\" ? (\n <Menu.GroupLabel\n key={i}\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{item.title}</span>\n </Menu.GroupLabel>\n ) : null;\n })}\n </Menu.Group>\n );\n })}\n </Menu.Popup>\n </Menu.Positioner>\n </Menu.Portal>\n </Menu.Root>\n );\n};\n"],"names":["DropdownMenu","children","items","placement","openOnHover","outsideOpen","outsideOnOpenChange","className","itemRender","classNames","open","setOpen","useControlled","onOpenChange","useCallback","newValue","cls","useCls","antdCssVarClassname","useAntdCssVarClassname","headlessUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","acc","current","jsxs","Menu","jsx","clsx","group","i","item","j","itemProps"],"mappings":";;;;;;;AA+FO,MAAMA,IAAe,CAAC;AAAA,EAC3B,UAAAC;AAAA,EACA,OA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ources":["../../../src/components/DropdownMenu/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n useCls,\n clsx,\n useAntdCssVarClassname,\n parseAntdPlacement,\n} from \"../utils\";\nimport { Menu } from \"@base-ui-components/react/menu\";\nimport { type PopoverProps } from \"antd/es/popover\";\nimport { useCallback, useRef } from \"react\";\nimport { useControlled } from \"@base-ui-components/react/utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport type DropdownMenuItemType =\n | {\n type: \"item\";\n label?: React.ReactNode;\n disabled?: boolean;\n icon?: React.ReactNode;\n key: React.Key;\n onClick?: React.HTMLAttributes<HTMLElement>[\"onClick\"];\n onMouseEnter?: React.HTMLAttributes<HTMLElement>[\"onMouseEnter\"];\n onMouseLeave?: React.HTMLAttributes<HTMLElement>[\"onMouseLeave\"];\n onMouseOver?: React.HTMLAttributes<HTMLElement>[\"onMouseOver\"];\n onMouseOut?: React.HTMLAttributes<HTMLElement>[\"onMouseOut\"];\n danger?: boolean;\n ref?: React.Ref<HTMLElement>;\n }\n | {\n type: \"divider\";\n }\n | {\n type: \"header\";\n title?: React.ReactNode;\n };\n\nexport interface DropdownMenuProps {\n /** Array of menu items to be displayed in the dropdown */\n items: DropdownMenuItemType[];\n /** Custom render function for the trigger element */\n children?: React.ComponentProps<typeof Menu.Trigger>[\"render\"];\n /**\n * Placement of the dropdown relative to the trigger element\n * @default \"bottomLeft\"\n */\n placement?: PopoverProps[\"placement\"];\n /**\n * Whether to open the dropdown on hover instead of click\n * @default false\n */\n openOnHover?: boolean;\n /**\n * Controlled open state of the dropdown\n */\n open?: boolean;\n /**\n * Callback fired when the dropdown open state changes\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Additional CSS class for the dropdown component\n */\n className?: string;\n /**\n * Custom class names for different parts of the dropdown\n * @default {}\n */\n classNames?: {\n root?: string;\n trigger?: string;\n popup?: string;\n group?: string;\n groupLabel?: string;\n item?: string;\n itemIcon?: string;\n itemText?: string;\n separator?: string;\n positioner?: string;\n };\n /**\n * Custom render function for menu items\n */\n itemRender?: (\n item: DropdownMenuItemType,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n}\n\ninterface DropdownMenuGroup {\n label: React.ReactNode | null;\n items: DropdownMenuItemType[];\n}\n\nexport const DropdownMenu = ({\n children,\n items,\n placement,\n openOnHover,\n open: outsideOpen,\n onOpenChange: outsideOnOpenChange,\n className,\n itemRender,\n classNames,\n}: DropdownMenuProps) => {\n const [open, setOpen] = useControlled({\n controlled: outsideOpen,\n default: false,\n name: \"open\",\n });\n const onOpenChange = useCallback(\n (newValue: boolean) => {\n setOpen(newValue);\n outsideOnOpenChange?.(newValue);\n },\n [setOpen, outsideOnOpenChange]\n );\n const cls = useCls();\n const antdCssVarClassname = useAntdCssVarClassname();\n const headlessUIPlacement = parseAntdPlacement(placement);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const itemGroups = items.reduce<DropdownMenuGroup[]>((acc, current) => {\n // If no groups exist yet and current item is not a header, create default group\n if (acc.length === 0 && current.type !== \"header\") {\n acc.push({\n label: null,\n items: [],\n });\n }\n\n // If it's a header, create a new group\n if (current.type === \"header\") {\n acc.push({\n label: current.title,\n items: [],\n });\n }\n // If it's an item and we have at least one group, add it to the last group's items\n else if (\n (current.type === \"item\" || current.type === \"divider\") &&\n acc.length > 0\n ) {\n acc[acc.length - 1].items.push(current);\n }\n // Skip dividers\n return acc;\n }, []);\n\n return (\n <Menu.Root\n openOnHover={openOnHover}\n open={open}\n onOpenChange={onOpenChange}\n >\n <Menu.Trigger\n render={children}\n ref={buttonRef}\n className={clsx(\n cls(\"dropdown-menu-trigger\"),\n classNames?.trigger,\n antdCssVarClassname\n )}\n ></Menu.Trigger>\n <Menu.Portal>\n <Menu.Positioner\n side={headlessUIPlacement.placement}\n align={headlessUIPlacement.align}\n sideOffset={4}\n className={clsx(cls(\"dropdown-menu-root\"), classNames?.root)}\n >\n <Menu.Popup\n className={clsx(\n cls(\"dropdown-menu\"),\n className,\n classNames?.popup,\n antdCssVarClassname\n )}\n >\n {itemGroups.map((group, i) => {\n return (\n <Menu.Group\n key={\"group\" + i}\n className={clsx(\n cls(\"dropdown-menu-group\"),\n classNames?.group\n )}\n >\n {group.label && (\n <Menu.GroupLabel\n key={i}\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{group.label}</span>\n </Menu.GroupLabel>\n )}\n {group.items.map((item, j) => {\n return item.type == \"item\" ? (\n <Menu.Item\n key={i + \"-\" + j}\n className={clsx(\n cls(\"dropdown-menu-item\"),\n classNames?.item\n )}\n disabled={item.disabled}\n data-danger={item.danger}\n ref={item.ref}\n onClick={item.onClick}\n onMouseEnter={item.onMouseEnter}\n onMouseLeave={item.onMouseLeave}\n onMouseOver={item.onMouseOver}\n onMouseOut={item.onMouseOut}\n render={\n itemRender\n ? (itemProps) => itemRender(item, itemProps)\n : undefined\n }\n >\n {item.icon && (\n <span\n className={clsx(\n cls(\"dropdown-menu-item-icon\"),\n classNames?.itemIcon\n )}\n >\n {item.icon}\n </span>\n )}\n <span>{item.label}</span>\n </Menu.Item>\n ) : item.type == \"divider\" ? (\n <Menu.Separator\n key={i}\n className={clsx(\n cls(\"dropdown-menu-divider\"),\n classNames?.separator\n )}\n ></Menu.Separator>\n ) : item.type == \"header\" ? (\n <Menu.GroupLabel\n key={i}\n className={clsx(\n cls(\"dropdown-menu-header\"),\n classNames?.groupLabel\n )}\n >\n <span>{item.title}</span>\n </Menu.GroupLabel>\n ) : null;\n })}\n </Menu.Group>\n );\n })}\n </Menu.Popup>\n </Menu.Positioner>\n </Menu.Portal>\n </Menu.Root>\n );\n};\n"],"names":["DropdownMenu","children","items","placement","openOnHover","outsideOpen","outsideOnOpenChange","className","itemRender","classNames","open","setOpen","useControlled","onOpenChange","useCallback","newValue","cls","useCls","antdCssVarClassname","useAntdCssVarClassname","headlessUIPlacement","parseAntdPlacement","buttonRef","useRef","itemGroups","acc","current","jsxs","Menu","jsx","clsx","group","i","item","j","itemPro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AA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as o, jsx as c } from "react/jsx-runtime";
|
|
2
3
|
import { Select as u, Input as f } from "antd";
|
|
3
4
|
import { forwardRef as x, useId as C } from "react";
|
|
4
5
|
import './style.css';/* empty css */
|
|
5
6
|
import { useCls as I, useAntdCssVarClassname as h } from "../utils/antdUtils.js";
|
|
6
7
|
import { clsx as F } from "../utils/cn.js";
|
|
7
8
|
const j = ({
|
|
8
|
-
label:
|
|
9
|
-
className:
|
|
10
|
-
size:
|
|
11
|
-
colon:
|
|
9
|
+
label: e,
|
|
10
|
+
className: i,
|
|
11
|
+
size: r = "small",
|
|
12
|
+
colon: m = !0,
|
|
12
13
|
type: a = "input",
|
|
13
14
|
...t
|
|
14
15
|
}, l) => {
|
|
15
|
-
const
|
|
16
|
+
const n = I(), s = C(), p = h(), d = () => a === "select" ? (
|
|
16
17
|
// @ts-expect-error: this is a workaround for the type error
|
|
17
|
-
/* @__PURE__ */ c(u, { id:
|
|
18
|
-
) : /* @__PURE__ */ c(f, { id:
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
/* @__PURE__ */ c(u, { id: s, ref: l, size: r, ...t.selectProps || {} })
|
|
19
|
+
) : /* @__PURE__ */ c(f, { id: s, ref: l, size: r, ...t.inputProps || {} });
|
|
20
|
+
return /* @__PURE__ */ o("div", { className: F(n("field"), p, i), children: [
|
|
21
|
+
e && /* @__PURE__ */ o("label", { htmlFor: s, className: n("field-label"), children: [
|
|
22
|
+
e,
|
|
23
|
+
m ? ":" : ""
|
|
23
24
|
] }),
|
|
24
25
|
d()
|
|
25
26
|
] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/Field/component.tsx"],"sourcesContent":["\"use client\";\nimport type { InputProps, InputRef, SelectProps } from \"antd\";\nimport { Input, Select } from \"antd\";\nimport { SizeType } from \"antd/es/config-provider/SizeContext\";\nimport { RefSelectProps } from \"antd/es/select\";\nimport { ForwardedRef, forwardRef, useId } from \"react\";\nimport { clsx, useCls, useAntdCssVarClassname } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport type FieldType = \"input\" | \"select\";\n\ntype RefType<T extends FieldType> = T extends \"input\"\n ? InputRef\n : T extends \"select\"\n ? RefSelectProps\n : never;\n\ninterface BaseFieldProps extends React.HTMLAttributes<HTMLDivElement> {\n label?: React.ReactNode;\n /**\n * Block or inline display\n * @default false\n */\n block?: boolean;\n /**\n * Size of the field\n * @default \"small\"\n */\n size?: SizeType;\n /**\n * Colon after label\n * @default true\n */\n colon?: boolean;\n}\n\ntype InputFieldProps = BaseFieldProps & {\n type?: \"input\";\n inputProps: InputProps;\n};\n\ntype SelectFieldProps = BaseFieldProps & {\n type: \"select\";\n selectProps: SelectProps;\n};\n\nexport type FieldProps<T extends FieldType = \"input\"> = T extends \"input\"\n ? InputFieldProps\n : SelectFieldProps;\n\n/**\n * Generic Field component that forwards ref to Input or Select\n */\nconst FieldInner = <T extends FieldType>(\n {\n label,\n className,\n size = \"small\",\n colon = true,\n type = \"input\",\n ...rest\n }: FieldProps<T>,\n ref: ForwardedRef<RefType<T>>\n) => {\n const cls = useCls();\n const id = useId();\n const cssVarClassname = useAntdCssVarClassname();\n const renderInputOrSelect = () => {\n if (type === \"select\") {\n return (\n // @ts-expect-error: this is a workaround for the type error\n <Select id={id} ref={ref} size={size} {...(rest.selectProps || {})} />\n );\n }\n // @ts-expect-error: this is a workaround for the type error\n return <Input id={id} ref={ref} size={size} {...(rest.inputProps || {})} />;\n };\n return (\n <div className={clsx(cls(\"field\"), cssVarClassname, className)}>\n {label && (\n <label htmlFor={id} className={cls(\"field-label\")}>\n {label}\n {colon ? \":\" : \"\"}\n </label>\n )}\n {renderInputOrSelect()}\n </div>\n );\n};\n\nexport const Field = forwardRef(FieldInner) as <T extends FieldType>(\n props: FieldProps<T> & { ref?: ForwardedRef<RefType<T>> }\n) => ReturnType<typeof FieldInner<T>>;\n"],"names":["FieldInner","label","className","size","colon","type","rest","ref","cls","useCls","id","useId","cssVarClassname","useAntdCssVarClassname","renderInputOrSelect","jsx","Select","Input","jsxs","clsx","Field","forwardRef"],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/Field/component.tsx"],"sourcesContent":["\"use client\";\nimport type { InputProps, InputRef, SelectProps } from \"antd\";\nimport { Input, Select } from \"antd\";\nimport { SizeType } from \"antd/es/config-provider/SizeContext\";\nimport { RefSelectProps } from \"antd/es/select\";\nimport { ForwardedRef, forwardRef, useId } from \"react\";\nimport { clsx, useCls, useAntdCssVarClassname } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport type FieldType = \"input\" | \"select\";\n\ntype RefType<T extends FieldType> = T extends \"input\"\n ? InputRef\n : T extends \"select\"\n ? RefSelectProps\n : never;\n\ninterface BaseFieldProps extends React.HTMLAttributes<HTMLDivElement> {\n label?: React.ReactNode;\n /**\n * Block or inline display\n * @default false\n */\n block?: boolean;\n /**\n * Size of the field\n * @default \"small\"\n */\n size?: SizeType;\n /**\n * Colon after label\n * @default true\n */\n colon?: boolean;\n}\n\ntype InputFieldProps = BaseFieldProps & {\n type?: \"input\";\n inputProps: InputProps;\n};\n\ntype SelectFieldProps = BaseFieldProps & {\n type: \"select\";\n selectProps: SelectProps;\n};\n\nexport type FieldProps<T extends FieldType = \"input\"> = T extends \"input\"\n ? InputFieldProps\n : SelectFieldProps;\n\n/**\n * Generic Field component that forwards ref to Input or Select\n */\nconst FieldInner = <T extends FieldType>(\n {\n label,\n className,\n size = \"small\",\n colon = true,\n type = \"input\",\n ...rest\n }: FieldProps<T>,\n ref: ForwardedRef<RefType<T>>\n) => {\n const cls = useCls();\n const id = useId();\n const cssVarClassname = useAntdCssVarClassname();\n const renderInputOrSelect = () => {\n if (type === \"select\") {\n return (\n // @ts-expect-error: this is a workaround for the type error\n <Select id={id} ref={ref} size={size} {...(rest.selectProps || {})} />\n );\n }\n // @ts-expect-error: this is a workaround for the type error\n return <Input id={id} ref={ref} size={size} {...(rest.inputProps || {})} />;\n };\n return (\n <div className={clsx(cls(\"field\"), cssVarClassname, className)}>\n {label && (\n <label htmlFor={id} className={cls(\"field-label\")}>\n {label}\n {colon ? \":\" : \"\"}\n </label>\n )}\n {renderInputOrSelect()}\n </div>\n );\n};\n\nexport const Field = forwardRef(FieldInner) as <T extends FieldType>(\n props: FieldProps<T> & { ref?: ForwardedRef<RefType<T>> }\n) => ReturnType<typeof FieldInner<T>>;\n"],"names":["FieldInner","label","className","size","colon","type","rest","ref","cls","useCls","id","useId","cssVarClassname","useAntdCssVarClassname","renderInputOrSelect","jsx","Select","Input","jsxs","clsx","Field","forwardRef"],"mappings":";;;;;;;AAuDA,MAAMA,IAAa,CACjB;AAAA,EACE,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,MAAAC,IAAO;AAAA,EACP,GAAGC;AACL,GACAC,MACG;AACH,QAAMC,IAAMC,EAAO,GACbC,IAAKC,EAAM,GACXC,IAAkBC,EAAuB,GACzCC,IAAsB,MACtBT,MAAS;AAAA;AAAA,IAGT,gBAAAU,EAACC,KAAO,IAAAN,GAAQ,KAAAH,GAAU,MAAAJ,GAAa,GAAIG,EAAK,eAAe,GAAK,CAAA;AAAA,MAIjE,gBAAAS,EAACE,KAAM,IAAAP,GAAQ,KAAAH,GAAU,MAAAJ,GAAa,GAAIG,EAAK,cAAc,CAAA,GAAK;AAGzE,SAAA,gBAAAY,EAAC,SAAI,WAAWC,EAAKX,EAAI,OAAO,GAAGI,GAAiBV,CAAS,GAC1D,UAAA;AAAA,IAAAD,uBACE,SAAM,EAAA,SAASS,GAAI,WAAWF,EAAI,aAAa,GAC7C,UAAA;AAAA,MAAAP;AAAA,MACAG,IAAQ,MAAM;AAAA,IAAA,GACjB;AAAA,IAEDU,EAAoB;AAAA,EAAA,GACvB;AAEJ,GAEaM,IAAQC,EAAWrB,CAAU;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
3
|
import m from "antd/es/form/ErrorList";
|
|
3
|
-
import t, { useWatch as
|
|
4
|
+
import t, { useWatch as e, useForm as i } from "antd/es/form/Form";
|
|
4
5
|
import s from "antd/es/form/FormList";
|
|
5
6
|
import { FormProvider as n } from "antd/es/form/context";
|
|
6
7
|
import p from "antd/es/form/hooks/useFormInstance";
|
|
@@ -9,9 +10,9 @@ import './style.css';/* empty css */
|
|
|
9
10
|
const f = ({
|
|
10
11
|
...r
|
|
11
12
|
}) => /* @__PURE__ */ o(t, { ...r }), v = Object.assign(f, {
|
|
12
|
-
useForm:
|
|
13
|
+
useForm: i,
|
|
13
14
|
useFormInstance: p,
|
|
14
|
-
useWatch:
|
|
15
|
+
useWatch: e,
|
|
15
16
|
Item: F,
|
|
16
17
|
List: s,
|
|
17
18
|
ErrorList: m,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/Form/component.tsx"],"sourcesContent":["\"use client\";\nimport ErrorList from \"antd/es/form/ErrorList\";\nimport {\n FormProps as AntdFormProps,\n default as AntdInternalForm,\n useForm,\n useWatch,\n} from \"antd/es/form/Form\";\nimport FormList from \"antd/es/form/FormList\";\nimport { FormProvider } from \"antd/es/form/context\";\nimport useFormInstance from \"antd/es/form/hooks/useFormInstance\";\nimport * as React from \"react\";\nimport { FormItem, type FormItemProps } from \"./item\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface FormProps<Values = any> extends AntdFormProps<Values> {}\n\ninterface InternalFormProps<Values = any>\n extends React.ComponentProps<typeof AntdInternalForm<Values>> {}\n\nconst InternalForm = <Values = any,>({\n ...rest\n}: InternalFormProps<Values>) => {\n return <AntdInternalForm {...rest} />;\n};\n\nexport const Form = Object.assign(InternalForm, {\n useForm,\n useFormInstance,\n useWatch,\n Item: FormItem,\n List: FormList,\n ErrorList,\n Provider: FormProvider,\n});\n\nexport type { FormItemProps };\n"],"names":["InternalForm","rest","jsx","AntdInternalForm","Form","useForm","useFormInstance","useWatch","FormItem","FormList","ErrorList","FormProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/Form/component.tsx"],"sourcesContent":["\"use client\";\nimport ErrorList from \"antd/es/form/ErrorList\";\nimport {\n FormProps as AntdFormProps,\n default as AntdInternalForm,\n useForm,\n useWatch,\n} from \"antd/es/form/Form\";\nimport FormList from \"antd/es/form/FormList\";\nimport { FormProvider } from \"antd/es/form/context\";\nimport useFormInstance from \"antd/es/form/hooks/useFormInstance\";\nimport * as React from \"react\";\nimport { FormItem, type FormItemProps } from \"./item\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface FormProps<Values = any> extends AntdFormProps<Values> {}\n\ninterface InternalFormProps<Values = any>\n extends React.ComponentProps<typeof AntdInternalForm<Values>> {}\n\nconst InternalForm = <Values = any,>({\n ...rest\n}: InternalFormProps<Values>) => {\n return <AntdInternalForm {...rest} />;\n};\n\nexport const Form = Object.assign(InternalForm, {\n useForm,\n useFormInstance,\n useWatch,\n Item: FormItem,\n List: FormList,\n ErrorList,\n Provider: FormProvider,\n});\n\nexport type { FormItemProps };\n"],"names":["InternalForm","rest","jsx","AntdInternalForm","Form","useForm","useFormInstance","useWatch","FormItem","FormList","ErrorList","FormProvider"],"mappings":";;;;;;;;;AAsBA,MAAMA,IAAe,CAAgB;AAAA,EACnC,GAAGC;AACL,MACS,gBAAAC,EAACC,GAAkB,EAAA,GAAGF,EAAM,CAAA,GAGxBG,IAAO,OAAO,OAAOJ,GAAc;AAAA,EAC9C,SAAAK;AAAA,EACA,iBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAMC;AAAA,EACN,MAAMC;AAAA,EACN,WAAAC;AAAA,EACA,UAAUC;AACZ,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.js","sources":["../../../src/components/Form/item.tsx"],"sourcesContent":["\"use client\";\nimport { isValidElement } from \"react\";\nimport {\n default as AntdFormItem,\n type FormItemProps as AntdFormItemProps,\n} from \"antd/es/form/FormItem\";\nimport { Question } from \"@bioturing/assets\";\nimport { IconButton } from \"../IconButton\";\nimport { useCls } from \"../utils\";\n\nexport interface FormItemProps<Values = unknown>\n extends AntdFormItemProps<Values> {\n // tooltip?: React.ReactNode | TooltipProps;\n optionalMark?: boolean | React.ReactNode;\n}\n\nexport const FormItem = <Values = unknown,>({\n tooltip,\n label,\n optionalMark,\n ...rest\n}: FormItemProps<Values>) => {\n const cls = useCls();\n const renderedLabel =\n tooltip || optionalMark ? (\n <span className={cls(\"form-item-label-inner\")}>\n {label}\n {tooltip && (\n <IconButton\n className={cls(\"form-item-explaination-icon\")}\n label={\n typeof tooltip == \"string\" || isValidElement(tooltip)\n ? tooltip\n : undefined\n }\n >\n <Question />\n </IconButton>\n )}\n {optionalMark && (\n <span className={cls(\"form-item-label-optional-mark\")}>\n {typeof optionalMark == \"boolean\" ? \"(optional)\" : optionalMark}\n </span>\n )}\n </span>\n ) : (\n label\n );\n return <AntdFormItem label={renderedLabel} {...rest} />;\n};\n"],"names":["FormItem","tooltip","label","optionalMark","rest","cls","useCls","renderedLabel","jsxs","jsx","IconButton","isValidElement","Question","AntdFormItem"],"mappings":"
|
|
1
|
+
{"version":3,"file":"item.js","sources":["../../../src/components/Form/item.tsx"],"sourcesContent":["\"use client\";\nimport { isValidElement } from \"react\";\nimport {\n default as AntdFormItem,\n type FormItemProps as AntdFormItemProps,\n} from \"antd/es/form/FormItem\";\nimport { Question } from \"@bioturing/assets\";\nimport { IconButton } from \"../IconButton\";\nimport { useCls } from \"../utils\";\n\nexport interface FormItemProps<Values = unknown>\n extends AntdFormItemProps<Values> {\n // tooltip?: React.ReactNode | TooltipProps;\n optionalMark?: boolean | React.ReactNode;\n}\n\nexport const FormItem = <Values = unknown,>({\n tooltip,\n label,\n optionalMark,\n ...rest\n}: FormItemProps<Values>) => {\n const cls = useCls();\n const renderedLabel =\n tooltip || optionalMark ? (\n <span className={cls(\"form-item-label-inner\")}>\n {label}\n {tooltip && (\n <IconButton\n className={cls(\"form-item-explaination-icon\")}\n label={\n typeof tooltip == \"string\" || isValidElement(tooltip)\n ? tooltip\n : undefined\n }\n >\n <Question />\n </IconButton>\n )}\n {optionalMark && (\n <span className={cls(\"form-item-label-optional-mark\")}>\n {typeof optionalMark == \"boolean\" ? \"(optional)\" : optionalMark}\n </span>\n )}\n </span>\n ) : (\n label\n );\n return <AntdFormItem label={renderedLabel} {...rest} />;\n};\n"],"names":["FormItem","tooltip","label","optionalMark","rest","cls","useCls","renderedLabel","jsxs","jsx","IconButton","isValidElement","Question","AntdFormItem"],"mappings":";;;;;;;AAgBO,MAAMA,IAAW,CAAoB;AAAA,EAC1C,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,GAAGC;AACL,MAA6B;AAC3B,QAAMC,IAAMC,EAAO,GACbC,IACJN,KAAWE,IACT,gBAAAK,EAAC,UAAK,WAAWH,EAAI,uBAAuB,GACzC,UAAA;AAAA,IAAAH;AAAA,IACAD,KACC,gBAAAQ;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,WAAWL,EAAI,6BAA6B;AAAA,QAC5C,OACE,OAAOJ,KAAW,YAAYU,EAAeV,CAAO,IAChDA,IACA;AAAA,QAGN,4BAACW,GAAS,CAAA,CAAA;AAAA,MAAA;AAAA,IACZ;AAAA,IAEDT,KACE,gBAAAM,EAAA,QAAA,EAAK,WAAWJ,EAAI,+BAA+B,GACjD,UAAO,OAAAF,KAAgB,YAAY,eAAeA,EACrD,CAAA;AAAA,EAAA,EAAA,CAEJ,IAEAD;AAEJ,SAAQ,gBAAAO,EAAAI,GAAA,EAAa,OAAON,GAAgB,GAAGH,GAAM;AACvD;"}
|