@bioturing/components 0.16.0 → 0.17.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 +7 -20
- package/dist/components/Badge/component.js.map +1 -1
- package/dist/components/ColorSelect/component.js +138 -0
- package/dist/components/ColorSelect/component.js.map +1 -0
- package/dist/components/ColorSelect/style.css +1 -0
- package/dist/components/DragDrop/context.js +18 -0
- package/dist/components/DragDrop/context.js.map +1 -0
- package/dist/components/DragDrop/draggable.js +64 -0
- package/dist/components/DragDrop/draggable.js.map +1 -0
- package/dist/components/DragDrop/droppable.js +48 -0
- package/dist/components/DragDrop/droppable.js.map +1 -0
- package/dist/components/DragDrop/hooks.js +139 -0
- package/dist/components/DragDrop/hooks.js.map +1 -0
- package/dist/components/DragDrop/index.js +45 -0
- package/dist/components/DragDrop/index.js.map +1 -0
- package/dist/components/DragDrop/style.css +1 -0
- package/dist/components/IconButton/component.js +54 -43
- package/dist/components/IconButton/component.js.map +1 -1
- package/dist/components/IconButton/style.css +1 -1
- package/dist/components/Nav/context.js +7 -0
- package/dist/components/Nav/context.js.map +1 -0
- package/dist/components/Nav/group.js +16 -0
- package/dist/components/Nav/group.js.map +1 -0
- package/dist/components/Nav/heading.js +16 -0
- package/dist/components/Nav/heading.js.map +1 -0
- package/dist/components/Nav/index.js +13 -0
- package/dist/components/Nav/index.js.map +1 -0
- package/dist/components/Nav/item.js +36 -0
- package/dist/components/Nav/item.js.map +1 -0
- package/dist/components/Nav/style.css +1 -0
- package/dist/components/PopupPanel/component.js +69 -74
- package/dist/components/PopupPanel/component.js.map +1 -1
- package/dist/components/Stack/Stack.js +40 -34
- package/dist/components/Stack/Stack.js.map +1 -1
- package/dist/components/Stack/StackChild.js +59 -54
- package/dist/components/Stack/StackChild.js.map +1 -1
- package/dist/components/Tag/component.js +59 -24
- package/dist/components/Tag/component.js.map +1 -1
- package/dist/components/Tag/style.css +1 -1
- package/dist/components/ThemeProvider/component.js +18 -18
- package/dist/components/ThemeProvider/component.js.map +1 -1
- package/dist/components/ThemeProvider/style.css +1 -1
- package/dist/components/Toast/component.js +29 -35
- package/dist/components/Toast/component.js.map +1 -1
- package/dist/components/Tooltip/component.js +4 -22
- package/dist/components/Tooltip/component.js.map +1 -1
- package/dist/components/VerticalCollapsiblePanel/component.js +37 -37
- package/dist/components/VerticalCollapsiblePanel/component.js.map +1 -1
- package/dist/components/hooks/useCharts.js +19 -17
- package/dist/components/hooks/useCharts.js.map +1 -1
- package/dist/components/utils/colors.js +5 -0
- package/dist/components/utils/colors.js.map +1 -0
- package/dist/index.d.ts +724 -23
- package/dist/index.js +186 -162
- package/dist/index.js.map +1 -1
- package/dist/metadata.js +45 -7
- package/dist/metadata.js.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tokens/and-theme/tokens.js +13 -7
- package/dist/tokens/and-theme/tokens.js.map +1 -1
- package/dist/tokens/charts/{tokens.js → palettes/cloudscape.js} +22 -12
- package/dist/tokens/charts/palettes/cloudscape.js.map +1 -0
- package/dist/tokens/charts/palettes/colorbrewer.js +1525 -0
- package/dist/tokens/charts/palettes/colorbrewer.js.map +1 -0
- package/dist/tokens/charts/palettes/index.js +61 -0
- package/dist/tokens/charts/palettes/index.js.map +1 -0
- package/dist/tokens/charts/palettes/tableau.js +112 -0
- package/dist/tokens/charts/palettes/tableau.js.map +1 -0
- package/dist/tokens/utils.js.map +1 -1
- package/package.json +2 -2
- package/dist/tokens/charts/index.js +0 -18
- package/dist/tokens/charts/index.js.map +0 -1
- package/dist/tokens/charts/tokens.js.map +0 -1
|
@@ -1,50 +1,61 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as m } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import {
|
|
3
|
+
import { forwardRef as w } from "react";
|
|
4
|
+
import { useRender as N } from "@base-ui-components/react/use-render";
|
|
5
5
|
import './style.css';/* empty css */
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
...l !== void 0 && { referrerPolicy: l }
|
|
36
|
-
} : {}, I = {
|
|
6
|
+
import { Spin as S } from "../Spin/component.js";
|
|
7
|
+
import { Tooltip as T } from "../Tooltip/component.js";
|
|
8
|
+
import { useCls as $ } from "../utils/antdUtils.js";
|
|
9
|
+
import { clsx as k } from "../utils/cn.js";
|
|
10
|
+
const q = ({
|
|
11
|
+
label: s,
|
|
12
|
+
size: b = "medium",
|
|
13
|
+
negativeMargin: v = !0,
|
|
14
|
+
children: f,
|
|
15
|
+
className: x,
|
|
16
|
+
tooltipProps: C = {},
|
|
17
|
+
as: I,
|
|
18
|
+
href: o,
|
|
19
|
+
// Extract anchor-specific props
|
|
20
|
+
target: r,
|
|
21
|
+
rel: e,
|
|
22
|
+
download: c,
|
|
23
|
+
hrefLang: p,
|
|
24
|
+
referrerPolicy: u,
|
|
25
|
+
loading: t,
|
|
26
|
+
render: B,
|
|
27
|
+
...R
|
|
28
|
+
}, d) => {
|
|
29
|
+
const n = $(), j = k(
|
|
30
|
+
n("icon-button"),
|
|
31
|
+
n(`icon-button-${b}`),
|
|
32
|
+
n(v ? "icon-button-negative-margin" : ""),
|
|
33
|
+
x
|
|
34
|
+
), i = I || (o ? "a" : "button"), a = {
|
|
37
35
|
ref: d,
|
|
38
|
-
className:
|
|
39
|
-
...
|
|
40
|
-
...
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
className: j,
|
|
37
|
+
...i === "button" && { type: "button" },
|
|
38
|
+
...i === "a" ? {
|
|
39
|
+
...o && { href: o },
|
|
40
|
+
...r !== void 0 && { target: r },
|
|
41
|
+
...e !== void 0 && { rel: e },
|
|
42
|
+
...c !== void 0 && { download: c },
|
|
43
|
+
...p !== void 0 && { hrefLang: p },
|
|
44
|
+
...u !== void 0 && { referrerPolicy: u }
|
|
45
|
+
} : {},
|
|
46
|
+
"data-loading": t,
|
|
47
|
+
...R
|
|
48
|
+
}, l = N({
|
|
49
|
+
ref: d,
|
|
50
|
+
render: B || /* @__PURE__ */ m(i, { ...a, children: t ? /* @__PURE__ */ m(S, {}) : f }),
|
|
51
|
+
props: a,
|
|
52
|
+
state: {
|
|
53
|
+
loading: t
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return s ? /* @__PURE__ */ m(T, { title: s, arrow: !1, ...C, children: l }) : l;
|
|
57
|
+
}, J = w(q);
|
|
46
58
|
export {
|
|
47
|
-
|
|
48
|
-
T as default
|
|
59
|
+
J as IconButton
|
|
49
60
|
};
|
|
50
61
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/IconButton/component.tsx"],"sourcesContent":["\"use client\";\nimport React, {\n forwardRef,\n type ElementType,\n type ComponentPropsWithoutRef,\n type ReactElement,\n type Ref,\n type AnchorHTMLAttributes,\n ComponentPropsWithRef,\n} from \"react\";\nimport { Tooltip } from \"
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/IconButton/component.tsx"],"sourcesContent":["\"use client\";\nimport React, {\n forwardRef,\n type ElementType,\n type ComponentPropsWithoutRef,\n type ReactElement,\n type Ref,\n type AnchorHTMLAttributes,\n ComponentPropsWithRef,\n} from \"react\";\nimport { Tooltip, TooltipProps } from \"../Tooltip\";\nimport { useCls, clsx } from \"../utils\";\nimport { useRender } from \"@base-ui-components/react/use-render\";\n\n// Import component-specific styles\nimport \"./style.css\";\nimport { Spin } from \"../Spin\";\n\n// Base props without href/as handling\ntype IconButtonBaseProps = {\n /**\n * Label text or element to display within tooltip\n * @default undefined\n */\n label?: React.ReactNode;\n /**\n * Size of the icon button: small (1.25rem) or medium (1.5rem)\n * @default medium\n */\n size?: \"small\" | \"medium\";\n /**\n * Whether to apply negative margin for better visual alignment\n * @default true\n */\n negativeMargin?: boolean;\n /**\n * Whether to show loading state\n * @default false\n */\n loading?: boolean;\n /**\n * Props to pass to the Tooltip component when wrapping the button\n */\n tooltipProps?: TooltipProps;\n /**\n * Custom render function for the button\n */\n render?: useRender.RenderProp<{ loading: boolean }>;\n};\n\n// Extract anchor-specific props we want to automatically handle\ntype AnchorSpecificProps = Pick<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n \"target\" | \"rel\" | \"download\" | \"hrefLang\" | \"referrerPolicy\"\n>;\n\n// Props when href is provided - as defaults to 'a' and includes anchor-specific props\ntype WithHrefProps<E extends ElementType = \"a\"> = IconButtonBaseProps & {\n href: string;\n as?: E;\n} & AnchorSpecificProps;\n\n// Props when href is not provided - as defaults to 'button'\ntype WithoutHrefProps<E extends ElementType = \"button\"> =\n IconButtonBaseProps & {\n href?: undefined;\n as?: E;\n } & {\n [K in keyof AnchorSpecificProps]?: never;\n };\n\n// Combined props type with conditional behavior\ntype IconButtonOwnProps<E extends ElementType = ElementType> =\n | WithHrefProps<E>\n | WithoutHrefProps<E>;\n\nexport type IconButtonProps<E extends ElementType = \"button\"> =\n IconButtonOwnProps<E> &\n Omit<ComponentPropsWithoutRef<E>, keyof IconButtonOwnProps<E>>;\n\n/**\n * A type-safe polymorphic component pattern\n */\ninterface PolymorphicComponentProps<E extends ElementType = \"button\"> {\n as?: E;\n href?: string;\n}\n\n/**\n * Type for wrapping the forwardRef implementation\n */\ntype IconButtonComponent = <E extends ElementType = \"button\">(\n props: IconButtonProps<E> & { ref?: ComponentPropsWithRef<E>[\"ref\"] }\n) => ReactElement;\n\n/**\n * Implementation of the IconButton component\n */\nconst IconButtonImpl = <E extends ElementType = \"button\">(\n {\n label,\n size = \"medium\",\n negativeMargin = true,\n children,\n className,\n tooltipProps = {},\n as,\n href,\n // Extract anchor-specific props\n target,\n rel,\n download,\n hrefLang,\n referrerPolicy,\n loading,\n render,\n ...rest\n }: IconButtonProps<E> & PolymorphicComponentProps<E>,\n ref: Ref<Element>\n) => {\n const cls = useCls();\n const buttonClasses = clsx(\n cls(\"icon-button\"),\n cls(`icon-button-${size}`),\n cls(negativeMargin ? \"icon-button-negative-margin\" : \"\"),\n className\n );\n\n // Use a type assertion for the component to avoid TypeScript errors\n const Component = (as || (href ? \"a\" : \"button\")) as ElementType;\n\n const elementProps = {\n ref,\n className: buttonClasses,\n ...(Component === \"button\" && { type: \"button\" }),\n ...(Component === \"a\"\n ? {\n ...(href && { href }),\n ...(target !== undefined && { target }),\n ...(rel !== undefined && { rel }),\n ...(download !== undefined && { download }),\n ...(hrefLang !== undefined && { hrefLang }),\n ...(referrerPolicy !== undefined && { referrerPolicy }),\n }\n : {}),\n \"data-loading\": loading,\n ...rest,\n };\n\n const element = useRender({\n ref,\n render: render || (\n <Component {...elementProps}>{loading ? <Spin /> : children}</Component>\n ),\n props: elementProps,\n state: {\n loading,\n },\n });\n\n return label ? (\n <Tooltip title={label} arrow={false} {...tooltipProps}>\n {element}\n </Tooltip>\n ) : (\n element\n );\n};\n\n// Export with correct typing\nexport const IconButton = forwardRef(IconButtonImpl) as IconButtonComponent;\n"],"names":["IconButtonImpl","label","size","negativeMargin","children","className","tooltipProps","as","href","target","rel","download","hrefLang","referrerPolicy","loading","render","rest","ref","cls","useCls","buttonClasses","clsx","Component","elementProps","element","useRender","jsx","Spin","Tooltip","IconButton","forwardRef"],"mappings":";;;;;;;;;AAkGA,MAAMA,IAAiB,CACrB;AAAA,EACE,OAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,gBAAAC,IAAiB;AAAA,EACjB,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC,IAAe,CAAC;AAAA,EAChB,IAAAC;AAAA,EACA,MAAAC;AAAA;AAAA,EAEA,QAAAC;AAAA,EACA,KAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,GAAGC;AACL,GACAC,MACG;AACH,QAAMC,IAAMC,EAAO,GACbC,IAAgBC;AAAA,IACpBH,EAAI,aAAa;AAAA,IACjBA,EAAI,eAAehB,CAAI,EAAE;AAAA,IACzBgB,EAAIf,IAAiB,gCAAgC,EAAE;AAAA,IACvDE;AAAA,EACF,GAGMiB,IAAaf,MAAOC,IAAO,MAAM,WAEjCe,IAAe;AAAA,IACnB,KAAAN;AAAA,IACA,WAAWG;AAAA,IACX,GAAIE,MAAc,YAAY,EAAE,MAAM,SAAS;AAAA,IAC/C,GAAIA,MAAc,MACd;AAAA,MACE,GAAId,KAAQ,EAAE,MAAAA,EAAK;AAAA,MACnB,GAAIC,MAAW,UAAa,EAAE,QAAAA,EAAO;AAAA,MACrC,GAAIC,MAAQ,UAAa,EAAE,KAAAA,EAAI;AAAA,MAC/B,GAAIC,MAAa,UAAa,EAAE,UAAAA,EAAS;AAAA,MACzC,GAAIC,MAAa,UAAa,EAAE,UAAAA,EAAS;AAAA,MACzC,GAAIC,MAAmB,UAAa,EAAE,gBAAAA,EAAe;AAAA,IAAA,IAEvD,CAAC;AAAA,IACL,gBAAgBC;AAAA,IAChB,GAAGE;AAAA,EACL,GAEMQ,IAAUC,EAAU;AAAA,IACxB,KAAAR;AAAA,IACA,QAAQF,KACN,gBAAAW,EAACJ,GAAW,EAAA,GAAGC,GAAe,UAAUT,IAAA,gBAAAY,EAACC,GAAK,CAAA,CAAA,IAAKvB,EAAS,CAAA;AAAA,IAE9D,OAAOmB;AAAA,IACP,OAAO;AAAA,MACL,SAAAT;AAAA,IAAA;AAAA,EACF,CACD;AAEM,SAAAb,IACJ,gBAAAyB,EAAAE,GAAA,EAAQ,OAAO3B,GAAO,OAAO,IAAQ,GAAGK,GACtC,UAAAkB,EAAA,CACH,IAEAA;AAEJ,GAGaK,IAAaC,EAAW9B,CAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.ds-icon-button{display:inline-flex;align-items:center;justify-content:center;border:none;border-radius:999px;cursor:pointer;background-color:transparent;color:var(--ds-color-icon);transition:all .2s}.ds-icon-button:hover{background-color:var(--ds-color-fill-secondary);color:var(--ds-color-icon-hover)}.ds-icon-button:active,.ds-icon-button.ds-popover-open{background-color:var(--ds-color-primary-bg);color:var(--ds-color-primary)}.ds-icon-button:focus{outline:none}.ds-icon-button:disabled{cursor:not-allowed;pointer-events:none;color:var(--ds-color-text-disabled)}.ds-icon-button.ds-icon-button-medium{padding:.
|
|
1
|
+
@layer components{.ds-icon-button{display:inline-flex;align-items:center;justify-content:center;border:none;border-radius:999px;cursor:pointer;background-color:transparent;color:var(--ds-color-icon);transition:all .2s}.ds-icon-button:hover{background-color:var(--ds-color-fill-secondary);color:var(--ds-color-icon-hover)}.ds-icon-button:active,.ds-icon-button.ds-popover-open{background-color:var(--ds-color-primary-bg);color:var(--ds-color-primary)}.ds-icon-button:focus{outline:none}.ds-icon-button:disabled{cursor:not-allowed;pointer-events:none;color:var(--ds-color-text-disabled)}.ds-icon-button.ds-icon-button-medium{padding:.25rem;font-size:1.25rem;height:1.75rem;width:1.75rem}.ds-icon-button.ds-icon-button-medium.ds-icon-button-negative-margin{margin:-.25rem}.ds-icon-button.ds-icon-button-small{padding:.25rem;font-size:1rem;height:1.5rem;width:1.5rem}.ds-icon-button.ds-icon-button-small.ds-icon-button-negative-margin{margin:-.25rem}.ds-icon-button .ds-spin{font-size:.8em;line-height:1;display:flex;align-items:center;justify-content:center}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../src/components/Nav/context.ts"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\n\nexport const NavGroupContext = React.createContext<{\n size: \"small\" | \"medium\" | \"large\";\n collapsible?: boolean;\n} | null>(null);\n\nexport const useNavGroupContext = () => {\n const context = React.useContext(NavGroupContext);\n if (!context) {\n throw new Error(\"useNavGroupContext must be used within a NavGroup\");\n }\n return context;\n};\n"],"names":["NavGroupContext","React"],"mappings":";;AAIa,MAAAA,IAAkBC,EAAM,cAG3B,IAAI;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as p } from "react";
|
|
4
|
+
import { NavGroupContext as i } from "./context.js";
|
|
5
|
+
import { useCls as s } from "../utils/antdUtils.js";
|
|
6
|
+
const u = p(
|
|
7
|
+
({ children: e, size: r = "medium", collapsible: m }, a) => {
|
|
8
|
+
const t = s();
|
|
9
|
+
return /* @__PURE__ */ o(i.Provider, { value: { size: r, collapsible: m }, children: /* @__PURE__ */ o("div", { className: t("nav-group", `nav-${r}`), ref: a, children: e }) });
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
u.displayName = "NavGroup";
|
|
13
|
+
export {
|
|
14
|
+
u as NavGroup
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group.js","sources":["../../../src/components/Nav/group.tsx"],"sourcesContent":["\"use client\";\nimport React, { forwardRef } from \"react\";\nimport { useCls } from \"../utils\";\nimport { NavGroupContext } from \"./context\";\n\nexport interface NavGroupProps extends React.ComponentPropsWithoutRef<\"div\"> {\n /**\n * Size of the nav\n * @default \"medium\"\n */\n size?: \"small\" | \"medium\" | \"large\";\n /**\n * Weather it's collapsible or not\n */\n collapsible?: boolean;\n}\n\nconst NavGroup = forwardRef(\n (\n { children, size = \"medium\", collapsible }: NavGroupProps,\n ref: React.ForwardedRef<HTMLDivElement>\n ) => {\n const cls = useCls();\n return (\n <NavGroupContext.Provider value={{ size, collapsible }}>\n <div className={cls(\"nav-group\", `nav-${size}`)} ref={ref}>\n {children}\n </div>\n </NavGroupContext.Provider>\n );\n }\n);\n\nNavGroup.displayName = \"NavGroup\";\n\nexport { NavGroup };\n"],"names":["NavGroup","forwardRef","children","size","collapsible","ref","cls","useCls","jsx","NavGroupContext"],"mappings":";;;;;AAiBA,MAAMA,IAAWC;AAAA,EACf,CACE,EAAE,UAAAC,GAAU,MAAAC,IAAO,UAAU,aAAAC,EAAA,GAC7BC,MACG;AACH,UAAMC,IAAMC,EAAO;AAEjB,WAAA,gBAAAC,EAACC,EAAgB,UAAhB,EAAyB,OAAO,EAAE,MAAAN,GAAM,aAAAC,KACvC,UAAA,gBAAAI,EAAC,SAAI,WAAWF,EAAI,aAAa,OAAOH,CAAI,EAAE,GAAG,KAAAE,GAC9C,UAAAH,EACH,CAAA,GACF;AAAA,EAAA;AAGN;AAEAF,EAAS,cAAc;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { useCls as t } from "../utils/antdUtils.js";
|
|
4
|
+
import { clsx as o } from "../utils/cn.js";
|
|
5
|
+
const l = ({
|
|
6
|
+
children: a,
|
|
7
|
+
className: n,
|
|
8
|
+
...r
|
|
9
|
+
}) => {
|
|
10
|
+
const s = t();
|
|
11
|
+
return /* @__PURE__ */ e("h3", { className: o(s("nav-heading"), n), ...r, children: /* @__PURE__ */ e("span", { className: s("nav-heading-text"), children: a }) });
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
l as NavHeading
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=heading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.js","sources":["../../../src/components/Nav/heading.tsx"],"sourcesContent":["\"use client\";\nimport React from \"react\";\nimport { clsx, useCls } from \"../utils\";\n\nexport interface NavHeadingProps\n extends React.HTMLAttributes<HTMLHeadingElement> {\n children: React.ReactNode;\n}\n\nexport const NavHeading = ({\n children,\n className,\n ...rest\n}: NavHeadingProps) => {\n const cls = useCls();\n return (\n <h3 className={clsx(cls(\"nav-heading\"), className)} {...rest}>\n <span className={cls(\"nav-heading-text\")}>{children}</span>\n </h3>\n );\n};\n"],"names":["NavHeading","children","className","rest","cls","useCls","clsx"],"mappings":";;;;AASO,MAAMA,IAAa,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,MAAuB;AACrB,QAAMC,IAAMC,EAAO;AACnB,2BACG,MAAG,EAAA,WAAWC,EAAKF,EAAI,aAAa,GAAGF,CAAS,GAAI,GAAGC,GACtD,4BAAC,QAAK,EAAA,WAAWC,EAAI,kBAAkB,GAAI,UAAAH,EAAS,CAAA,GACtD;AAEJ;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NavItem as o } from "./item.js";
|
|
2
|
+
import { NavHeading as r } from "./heading.js";
|
|
3
|
+
import { NavGroup as m } from "./group.js";
|
|
4
|
+
import './style.css';/* empty css */
|
|
5
|
+
const e = {
|
|
6
|
+
Item: o,
|
|
7
|
+
Heading: r,
|
|
8
|
+
Group: m
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
e as Nav
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Nav/index.tsx"],"sourcesContent":["import { NavItem, NavItemProps } from \"./item\";\nimport { NavHeading, NavHeadingProps } from \"./heading\";\nimport { NavGroup, NavGroupProps } from \"./group\";\n\nimport \"./style.css\";\n\nexport const Nav = {\n Item: NavItem,\n Heading: NavHeading,\n Group: NavGroup,\n};\n\nexport type { NavItemProps, NavHeadingProps, NavGroupProps };\n"],"names":["Nav","NavItem","NavHeading","NavGroup"],"mappings":";;;;AAMO,MAAMA,IAAM;AAAA,EACjB,MAAMC;AAAA,EACN,SAASC;AAAA,EACT,OAAOC;AACT;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as c, jsx as a, Fragment as l } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as d } from "react";
|
|
4
|
+
import { useRender as p } from "@base-ui-components/react/use-render";
|
|
5
|
+
import { useCls as f } from "../utils/antdUtils.js";
|
|
6
|
+
import { clsx as v } from "../utils/cn.js";
|
|
7
|
+
const x = ({
|
|
8
|
+
icon: r,
|
|
9
|
+
active: s = !1,
|
|
10
|
+
render: n,
|
|
11
|
+
onClick: N,
|
|
12
|
+
className: m,
|
|
13
|
+
children: o,
|
|
14
|
+
...t
|
|
15
|
+
}, i) => {
|
|
16
|
+
const e = f();
|
|
17
|
+
return p({
|
|
18
|
+
render: n ?? /* @__PURE__ */ a("button", { className: v(e("nav-item"), m) }),
|
|
19
|
+
ref: i,
|
|
20
|
+
props: {
|
|
21
|
+
"data-active": s || void 0,
|
|
22
|
+
"aria-expanded": t["aria-expanded"],
|
|
23
|
+
className: void 0,
|
|
24
|
+
...t,
|
|
25
|
+
children: /* @__PURE__ */ c(l, { children: [
|
|
26
|
+
/* @__PURE__ */ a("span", { className: e("nav-item-icon"), children: r }),
|
|
27
|
+
/* @__PURE__ */ a("span", { className: e("nav-item-content"), children: o })
|
|
28
|
+
] })
|
|
29
|
+
},
|
|
30
|
+
state: { active: s, icon: r }
|
|
31
|
+
});
|
|
32
|
+
}, R = d(x);
|
|
33
|
+
export {
|
|
34
|
+
R as NavItem
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item.js","sources":["../../../src/components/Nav/item.tsx"],"sourcesContent":["\"use client\";\nimport React, { useState, type MouseEvent, forwardRef } from \"react\";\nimport { clsx, useCls } from \"../utils\";\nimport { Transition } from \"../Transition\";\nimport { useRender } from \"@base-ui-components/react/use-render\";\n\nexport interface NavItemProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n icon?: React.ReactNode;\n active?: boolean;\n render?: useRender.RenderProp<{\n active: boolean;\n icon?: React.ReactNode;\n }>;\n size?: \"small\" | \"medium\" | \"large\";\n}\n\nconst NavItemImpl = <T extends HTMLElement>(\n {\n icon,\n active = false,\n render,\n onClick,\n className,\n children,\n ...rest\n }: NavItemProps,\n ref: React.Ref<T>\n) => {\n const cls = useCls();\n\n return useRender({\n render: render ?? <button className={clsx(cls(\"nav-item\"), className)} />,\n ref,\n props: {\n \"data-active\": active || undefined,\n \"aria-expanded\": rest[\"aria-expanded\"],\n className: undefined,\n ...rest,\n children: (\n <>\n <span className={cls(\"nav-item-icon\")}>{icon}</span>\n {/* <Transition\n starting=\"opacity-0 max-w-[0]\"\n ending=\"opacity-0 max-w-[0]\"\n className={cls(\"nav-item-transition\")}\n > */}\n <span className={cls(\"nav-item-content\")}>{children}</span>\n {/* </Transition> */}\n </>\n ),\n },\n state: { active, icon },\n });\n};\n\nconst NavItem = forwardRef(NavItemImpl) as <T extends HTMLElement>(\n props: NavItemProps & { ref?: React.Ref<T> }\n) => ReturnType<typeof NavItemImpl>;\n\nexport { NavItem };\n"],"names":["NavItemImpl","icon","active","render","onClick","className","children","rest","ref","cls","useCls","useRender","jsx","clsx","jsxs","Fragment","NavItem","forwardRef"],"mappings":";;;;;;AAiBA,MAAMA,IAAc,CAClB;AAAA,EACE,MAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GACAC,MACG;AACH,QAAMC,IAAMC,EAAO;AAEnB,SAAOC,EAAU;AAAA,IACf,QAAQR,KAAU,gBAAAS,EAAC,UAAO,EAAA,WAAWC,EAAKJ,EAAI,UAAU,GAAGJ,CAAS,EAAG,CAAA;AAAA,IACvE,KAAAG;AAAA,IACA,OAAO;AAAA,MACL,eAAeN,KAAU;AAAA,MACzB,iBAAiBK,EAAK,eAAe;AAAA,MACrC,WAAW;AAAA,MACX,GAAGA;AAAA,MACH,UAEI,gBAAAO,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAH,EAAC,QAAK,EAAA,WAAWH,EAAI,eAAe,GAAI,UAAKR,GAAA;AAAA,0BAM5C,QAAK,EAAA,WAAWQ,EAAI,kBAAkB,GAAI,UAAAH,EAAS,CAAA;AAAA,MAAA,EAEtD,CAAA;AAAA,IAEJ;AAAA,IACA,OAAO,EAAE,QAAAJ,GAAQ,MAAAD,EAAK;AAAA,EAAA,CACvB;AACH,GAEMe,IAAUC,EAAWjB,CAAW;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ds-nav-group{display:flex;flex-direction:column;gap:.25rem}.ds-nav-item{width:100%;display:flex;align-items:center;gap:.5rem;padding:.375rem .75rem;font-size:1.25rem;color:var(--ds-color-icon);background:transparent;border-radius:var(--ds-border-radius);transition:background-color var(--ds-motion-duration-mid),color var(--ds-motion-duration-mid)}.ds-nav-item:hover{background-color:var(--ds-color-fill-tertiary);color:var(--ds-color-icon-hover)}.ds-nav-item[data-active]{background-color:var(--ds-color-fill-secondary);color:var(--ds-color-text);font-weight:500}.ds-nav-item[aria-expanded]{background-color:var(--ds-color-fill-secondary);color:var(--ds-color-text)}.ds-nav-item:disabled{background:transparent;color:var(--ds-color-text-disabled);cursor:not-allowed}.ds-nav-item .ds-nav-item-icon{font-size:1.25rem;line-height:1;transition:all .1s}.ds-nav-item .ds-nav-item-content{flex:1;display:flex;align-items:center;white-space:nowrap;overflow:hidden;font-size:.875rem;line-height:1rem;transition:max-width .15s,opacity .15s}.ds-nav-small .ds-nav-item,.ds-nav-item.ds-nav-item-small{padding:.25rem .5rem}:is(.ds-nav-small .ds-nav-item,.ds-nav-item.ds-nav-item-small) .ds-nav-item-icon{font-size:1rem}.ds-nav-large .ds-nav-item,.ds-nav-item.ds-nav-item-large{padding:.5rem 1rem}:is(.ds-nav-large .ds-nav-item,.ds-nav-item.ds-nav-item-large) .ds-nav-item-icon{font-size:1.5rem}:is(.ds-nav-large .ds-nav-item,.ds-nav-item.ds-nav-item-large) .ds-nav-item-content{font-size:1rem;line-height:1.5rem}.ds-nav-heading{width:100%;height:.875rem;position:relative;color:var(--ds-color-text-tertiary);text-transform:uppercase;font-weight:500;letter-spacing:.002em;font-size:.75rem;line-height:1rem;margin-bottom:.5rem}.ds-nav-small .ds-nav-heading{font-size:.625rem;line-height:1.4}.ds-nav-heading-text{display:inline-block;overflow:hidden;text-overflow:ellipsis;position:absolute;transition:all .1s;white-space:nowrap}
|
|
@@ -1,87 +1,87 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as r, jsxs as d, Fragment as a } from "react/jsx-runtime";
|
|
3
3
|
import { Popover as i } from "@base-ui-components/react/popover";
|
|
4
|
-
import { useState as f, useCallback as k, useEffect as
|
|
5
|
-
import
|
|
6
|
-
import { X as
|
|
7
|
-
import { PopupPanelSize as
|
|
4
|
+
import { useState as f, useCallback as k, useEffect as C, useMemo as N } from "react";
|
|
5
|
+
import s from "antd/es/flex";
|
|
6
|
+
import { X as ee } from "@bioturing/assets";
|
|
7
|
+
import { PopupPanelSize as te } from "./constants.js";
|
|
8
8
|
import { useResizable as re } from "react-use-resizable";
|
|
9
|
-
import
|
|
9
|
+
import ne from "merge-refs";
|
|
10
10
|
import './style.css';/* empty css */
|
|
11
|
-
import { useControlledState as
|
|
12
|
-
import { useCls as
|
|
11
|
+
import { useControlledState as oe } from "../hooks/useControlledState.js";
|
|
12
|
+
import { useCls as pe, parseAntdPlacement as ie } from "../utils/antdUtils.js";
|
|
13
13
|
import { clsx as o } from "../utils/cn.js";
|
|
14
|
-
import { IconButton as
|
|
15
|
-
const
|
|
16
|
-
children:
|
|
17
|
-
placement:
|
|
18
|
-
openOnHover:
|
|
14
|
+
import { IconButton as de } from "../IconButton/component.js";
|
|
15
|
+
const we = ({
|
|
16
|
+
children: O,
|
|
17
|
+
placement: S,
|
|
18
|
+
openOnHover: I = !1,
|
|
19
19
|
open: D,
|
|
20
20
|
onOpenChange: W,
|
|
21
21
|
content: j,
|
|
22
22
|
title: h,
|
|
23
|
-
trigger:
|
|
24
|
-
className:
|
|
25
|
-
anchor:
|
|
23
|
+
trigger: E = "click",
|
|
24
|
+
className: F,
|
|
25
|
+
anchor: V,
|
|
26
26
|
beforeCloseButton: P,
|
|
27
|
-
afterCloseButton:
|
|
27
|
+
afterCloseButton: H,
|
|
28
28
|
afterTitle: g,
|
|
29
29
|
size: c = "medium",
|
|
30
30
|
footer: l,
|
|
31
31
|
defaultOpen: $,
|
|
32
|
-
resizable:
|
|
32
|
+
resizable: A = !1,
|
|
33
33
|
classNames: e,
|
|
34
|
-
modal:
|
|
35
|
-
closeOnClickOutside:
|
|
34
|
+
modal: M = !1,
|
|
35
|
+
closeOnClickOutside: T = !0
|
|
36
36
|
}) => {
|
|
37
|
-
const [
|
|
37
|
+
const [U, y] = oe(
|
|
38
38
|
D,
|
|
39
39
|
W,
|
|
40
40
|
$ ?? !1
|
|
41
41
|
// Always provide a default value to prevent undefined
|
|
42
|
-
), t =
|
|
43
|
-
|
|
42
|
+
), t = pe(), b = ie(S), [v, X] = f(null), [q, G] = f(), [J, K] = f(), L = k((n) => {
|
|
43
|
+
X(n);
|
|
44
44
|
}, []);
|
|
45
|
-
|
|
45
|
+
C(() => {
|
|
46
46
|
if (!v) return;
|
|
47
|
-
const
|
|
47
|
+
const n = new ResizeObserver((u) => {
|
|
48
48
|
for (const p of u)
|
|
49
|
-
|
|
49
|
+
G(p.contentRect.width), K(p.contentRect.height);
|
|
50
50
|
});
|
|
51
|
-
return
|
|
52
|
-
|
|
51
|
+
return n.observe(v), () => {
|
|
52
|
+
n.disconnect();
|
|
53
53
|
};
|
|
54
54
|
}, [v]);
|
|
55
|
-
const w =
|
|
55
|
+
const w = N(() => /* @__PURE__ */ r(ee, { size: 16 }), []), Q = k(() => /* @__PURE__ */ d("div", { className: o(t("popup-panel-header"), e == null ? void 0 : e.header), children: [
|
|
56
56
|
/* @__PURE__ */ d(
|
|
57
|
-
|
|
57
|
+
s,
|
|
58
58
|
{
|
|
59
59
|
align: "center",
|
|
60
60
|
gap: 8,
|
|
61
61
|
className: t("popup-panel-title-wrapper"),
|
|
62
62
|
children: [
|
|
63
|
-
/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ r(
|
|
64
64
|
i.Title,
|
|
65
65
|
{
|
|
66
|
-
render: /* @__PURE__ */
|
|
66
|
+
render: /* @__PURE__ */ r("div", { className: o(t("grow", "truncate"), e == null ? void 0 : e.title), children: h })
|
|
67
67
|
}
|
|
68
68
|
),
|
|
69
69
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
70
70
|
P,
|
|
71
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ r(
|
|
72
72
|
i.Close,
|
|
73
73
|
{
|
|
74
|
-
render: /* @__PURE__ */
|
|
74
|
+
render: /* @__PURE__ */ r(de, { children: w })
|
|
75
75
|
}
|
|
76
76
|
),
|
|
77
|
-
|
|
77
|
+
H
|
|
78
78
|
] })
|
|
79
79
|
]
|
|
80
80
|
}
|
|
81
81
|
),
|
|
82
82
|
g || null
|
|
83
83
|
] }), [
|
|
84
|
-
|
|
84
|
+
H,
|
|
85
85
|
g,
|
|
86
86
|
P,
|
|
87
87
|
t,
|
|
@@ -89,51 +89,47 @@ const xe = ({
|
|
|
89
89
|
e == null ? void 0 : e.title,
|
|
90
90
|
w,
|
|
91
91
|
h
|
|
92
|
-
]), [z, x] = f(!1), { getRootProps:
|
|
93
|
-
initialWidth:
|
|
94
|
-
initialHeight:
|
|
92
|
+
]), [z, x] = f(!1), { getRootProps: Y, getHandleProps: R, rootRef: Z } = re({
|
|
93
|
+
initialWidth: q,
|
|
94
|
+
initialHeight: J,
|
|
95
95
|
onDragStart: () => x(!0),
|
|
96
96
|
onDragEnd: () => x(!1)
|
|
97
97
|
});
|
|
98
|
-
|
|
98
|
+
C(() => {
|
|
99
99
|
z ? document.body.style.userSelect = "none" : document.body.style.userSelect = "";
|
|
100
100
|
}, [z]);
|
|
101
|
-
const { ref:
|
|
102
|
-
if (!
|
|
101
|
+
const { ref: _, ...B } = Y(), m = (n, u) => {
|
|
102
|
+
if (!n.current) return;
|
|
103
103
|
const { widthDiff: p } = u;
|
|
104
|
-
|
|
104
|
+
n.current.style.left = `${parseInt(n.current.style.left || "0") - p}px`;
|
|
105
105
|
};
|
|
106
106
|
return /* @__PURE__ */ d(
|
|
107
107
|
i.Root,
|
|
108
108
|
{
|
|
109
|
-
openOnHover:
|
|
110
|
-
open:
|
|
111
|
-
onOpenChange: (
|
|
112
|
-
p === "outside-press" && !
|
|
109
|
+
openOnHover: E === "hover" ? !0 : I,
|
|
110
|
+
open: U,
|
|
111
|
+
onOpenChange: (n, u, p) => {
|
|
112
|
+
p === "outside-press" && !T || y(n, u, p);
|
|
113
113
|
},
|
|
114
|
-
modal:
|
|
114
|
+
modal: M,
|
|
115
115
|
children: [
|
|
116
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ r(
|
|
117
117
|
i.Trigger,
|
|
118
118
|
{
|
|
119
|
-
render:
|
|
119
|
+
render: O,
|
|
120
120
|
className: o(t("popup-panel-trigger"), e == null ? void 0 : e.trigger)
|
|
121
121
|
}
|
|
122
122
|
),
|
|
123
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ r(i.Portal, { children: /* @__PURE__ */ r(
|
|
124
124
|
i.Positioner,
|
|
125
125
|
{
|
|
126
|
-
className: o(
|
|
127
|
-
t("popup-panel-root"),
|
|
128
|
-
e == null ? void 0 : e.root,
|
|
129
|
-
y
|
|
130
|
-
),
|
|
126
|
+
className: o(t("popup-panel-root"), e == null ? void 0 : e.root),
|
|
131
127
|
side: b.placement,
|
|
132
128
|
align: b.align,
|
|
133
129
|
sideOffset: 4,
|
|
134
|
-
anchor:
|
|
130
|
+
anchor: V,
|
|
135
131
|
style: {
|
|
136
|
-
"--size-width": c ?
|
|
132
|
+
"--size-width": c ? te[c] : void 0
|
|
137
133
|
},
|
|
138
134
|
children: /* @__PURE__ */ d(
|
|
139
135
|
i.Popup,
|
|
@@ -141,31 +137,30 @@ const xe = ({
|
|
|
141
137
|
className: o(
|
|
142
138
|
t("popup-panel"),
|
|
143
139
|
t(`popup-panel-size-${c}`),
|
|
144
|
-
|
|
145
|
-
e == null ? void 0 : e.popup
|
|
146
|
-
y
|
|
140
|
+
F,
|
|
141
|
+
e == null ? void 0 : e.popup
|
|
147
142
|
),
|
|
148
|
-
ref:
|
|
149
|
-
...
|
|
143
|
+
ref: ne(_, L),
|
|
144
|
+
...B,
|
|
150
145
|
...z ? { "data-resizing": !0 } : {},
|
|
151
146
|
children: [
|
|
152
|
-
h &&
|
|
153
|
-
/* @__PURE__ */
|
|
147
|
+
h && Q(),
|
|
148
|
+
/* @__PURE__ */ r(
|
|
154
149
|
"div",
|
|
155
150
|
{
|
|
156
151
|
className: o(t("popup-panel-content"), e == null ? void 0 : e.content),
|
|
157
|
-
children: /* @__PURE__ */
|
|
152
|
+
children: /* @__PURE__ */ r("div", { className: t("popup-panel-content-inner"), children: j })
|
|
158
153
|
}
|
|
159
154
|
),
|
|
160
|
-
l && /* @__PURE__ */
|
|
155
|
+
l && /* @__PURE__ */ r(
|
|
161
156
|
"div",
|
|
162
157
|
{
|
|
163
158
|
className: o(t("popup-panel-footer"), e == null ? void 0 : e.footer),
|
|
164
|
-
children: typeof l == "function" ? l({ close: () =>
|
|
159
|
+
children: typeof l == "function" ? l({ close: () => y(!1) }) : l
|
|
165
160
|
}
|
|
166
161
|
),
|
|
167
|
-
|
|
168
|
-
/* @__PURE__ */
|
|
162
|
+
A && /* @__PURE__ */ d(a, { children: [
|
|
163
|
+
/* @__PURE__ */ r(
|
|
169
164
|
"div",
|
|
170
165
|
{
|
|
171
166
|
className: o(
|
|
@@ -178,7 +173,7 @@ const xe = ({
|
|
|
178
173
|
})
|
|
179
174
|
}
|
|
180
175
|
),
|
|
181
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ r(
|
|
182
177
|
"div",
|
|
183
178
|
{
|
|
184
179
|
className: o(
|
|
@@ -189,11 +184,11 @@ const xe = ({
|
|
|
189
184
|
...R({
|
|
190
185
|
reverse: !0,
|
|
191
186
|
lockVertical: !0,
|
|
192
|
-
onResize: (
|
|
187
|
+
onResize: (n) => m(Z, n)
|
|
193
188
|
})
|
|
194
189
|
}
|
|
195
190
|
),
|
|
196
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ r(
|
|
197
192
|
"div",
|
|
198
193
|
{
|
|
199
194
|
className: o(
|
|
@@ -217,6 +212,6 @@ const xe = ({
|
|
|
217
212
|
);
|
|
218
213
|
};
|
|
219
214
|
export {
|
|
220
|
-
|
|
215
|
+
we as PopupPanel
|
|
221
216
|
};
|
|
222
217
|
//# sourceMappingURL=component.js.map
|