@hebium-ui/react 0.0.0-stage → 0.1.0-alpha.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/LICENSE +21 -0
- package/README.md +7 -2
- package/dist/components/alert/alert.d.ts +44 -0
- package/dist/components/alert/alert.js +45 -0
- package/dist/components/alert/alert.js.map +1 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/anchor/anchor.d.ts +30 -0
- package/dist/components/anchor/anchor.js +25 -0
- package/dist/components/anchor/anchor.js.map +1 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/avatar/avatar.d.ts +16 -0
- package/dist/components/avatar/avatar.js +50 -0
- package/dist/components/avatar/avatar.js.map +1 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/blockquote/blockquote.d.ts +28 -0
- package/dist/components/blockquote/blockquote.js +29 -0
- package/dist/components/blockquote/blockquote.js.map +1 -0
- package/dist/components/blockquote/index.d.ts +2 -0
- package/dist/components/button/button.d.ts +30 -0
- package/dist/components/button/button.js +25 -0
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/checkbox/checkbox.d.ts +33 -0
- package/dist/components/checkbox/checkbox.js +68 -0
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/code/code.d.ts +11 -0
- package/dist/components/code/code.js +21 -0
- package/dist/components/code/code.js.map +1 -0
- package/dist/components/code/index.d.ts +2 -0
- package/dist/components/details/details.d.ts +22 -0
- package/dist/components/details/details.js +28 -0
- package/dist/components/details/details.js.map +1 -0
- package/dist/components/details/index.d.ts +2 -0
- package/dist/components/dialog/dialog.context.d.ts +4 -0
- package/dist/components/dialog/dialog.context.js +15 -0
- package/dist/components/dialog/dialog.context.js.map +1 -0
- package/dist/components/dialog/dialog.d.ts +67 -0
- package/dist/components/dialog/dialog.js +124 -0
- package/dist/components/dialog/dialog.js.map +1 -0
- package/dist/components/dialog/index.d.ts +3 -0
- package/dist/components/dl/dl.d.ts +18 -0
- package/dist/components/dl/dl.js +48 -0
- package/dist/components/dl/dl.js.map +1 -0
- package/dist/components/dl/index.d.ts +2 -0
- package/dist/components/drawer/drawer.context.d.ts +4 -0
- package/dist/components/drawer/drawer.context.js +15 -0
- package/dist/components/drawer/drawer.context.js.map +1 -0
- package/dist/components/drawer/drawer.d.ts +67 -0
- package/dist/components/drawer/drawer.js +104 -0
- package/dist/components/drawer/drawer.js.map +1 -0
- package/dist/components/drawer/index.d.ts +3 -0
- package/dist/components/fieldset/fieldset.d.ts +9 -0
- package/dist/components/fieldset/fieldset.js +20 -0
- package/dist/components/fieldset/fieldset.js.map +1 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/heading/heading.d.ts +22 -0
- package/dist/components/heading/heading.js +24 -0
- package/dist/components/heading/heading.js.map +1 -0
- package/dist/components/heading/index.d.ts +2 -0
- package/dist/components/hr/hr.d.ts +11 -0
- package/dist/components/hr/hr.js +19 -0
- package/dist/components/hr/hr.js.map +1 -0
- package/dist/components/hr/index.d.ts +2 -0
- package/dist/components/index.d.ts +66 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/input.d.ts +37 -0
- package/dist/components/input/input.js +47 -0
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/label/index.d.ts +2 -0
- package/dist/components/label/label.d.ts +32 -0
- package/dist/components/label/label.js +54 -0
- package/dist/components/label/label.js.map +1 -0
- package/dist/components/menu/index.d.ts +3 -0
- package/dist/components/menu/menu.context.d.ts +4 -0
- package/dist/components/menu/menu.context.js +15 -0
- package/dist/components/menu/menu.context.js.map +1 -0
- package/dist/components/menu/menu.d.ts +82 -0
- package/dist/components/menu/menu.js +133 -0
- package/dist/components/menu/menu.js.map +1 -0
- package/dist/components/paragraph/index.d.ts +2 -0
- package/dist/components/paragraph/paragraph.d.ts +18 -0
- package/dist/components/paragraph/paragraph.js +21 -0
- package/dist/components/paragraph/paragraph.js.map +1 -0
- package/dist/components/popover/index.d.ts +3 -0
- package/dist/components/popover/popover.context.d.ts +4 -0
- package/dist/components/popover/popover.context.js +15 -0
- package/dist/components/popover/popover.context.js.map +1 -0
- package/dist/components/popover/popover.d.ts +53 -0
- package/dist/components/popover/popover.js +60 -0
- package/dist/components/popover/popover.js.map +1 -0
- package/dist/components/progress/index.d.ts +2 -0
- package/dist/components/progress/progress.d.ts +55 -0
- package/dist/components/progress/progress.js +57 -0
- package/dist/components/progress/progress.js.map +1 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/radio.d.ts +27 -0
- package/dist/components/radio/radio.js +57 -0
- package/dist/components/radio/radio.js.map +1 -0
- package/dist/components/radiogroup/index.d.ts +2 -0
- package/dist/components/radiogroup/radiogroup.d.ts +36 -0
- package/dist/components/radiogroup/radiogroup.js +44 -0
- package/dist/components/radiogroup/radiogroup.js.map +1 -0
- package/dist/components/section/index.d.ts +2 -0
- package/dist/components/section/section.d.ts +36 -0
- package/dist/components/section/section.js +26 -0
- package/dist/components/section/section.js.map +1 -0
- package/dist/components/segmented-control/index.d.ts +2 -0
- package/dist/components/segmented-control/segmented-control.context.js +12 -0
- package/dist/components/segmented-control/segmented-control.context.js.map +1 -0
- package/dist/components/segmented-control/segmented-control.d.ts +41 -0
- package/dist/components/segmented-control/segmented-control.js +68 -0
- package/dist/components/segmented-control/segmented-control.js.map +1 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/select.d.ts +31 -0
- package/dist/components/select/select.js +48 -0
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/table.d.ts +53 -0
- package/dist/components/table/table.js +110 -0
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/tabs.context.d.ts +4 -0
- package/dist/components/tabs/tabs.context.js +12 -0
- package/dist/components/tabs/tabs.context.js.map +1 -0
- package/dist/components/tabs/tabs.d.ts +60 -0
- package/dist/components/tabs/tabs.js +158 -0
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/textarea.d.ts +37 -0
- package/dist/components/textarea/textarea.js +48 -0
- package/dist/components/textarea/textarea.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +3 -0
- package/dist/components/tooltip/tooltip.context.d.ts +4 -0
- package/dist/components/tooltip/tooltip.context.js +15 -0
- package/dist/components/tooltip/tooltip.context.js.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +53 -0
- package/dist/components/tooltip/tooltip.js +83 -0
- package/dist/components/tooltip/tooltip.js.map +1 -0
- package/dist/components/visually-hidden/index.d.ts +2 -0
- package/dist/components/visually-hidden/visually-hidden.d.ts +9 -0
- package/dist/components/visually-hidden/visually-hidden.js +21 -0
- package/dist/components/visually-hidden/visually-hidden.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +38 -0
- package/dist/provider/hui-provider.context.d.ts +104 -0
- package/dist/provider/hui-provider.context.js +36 -0
- package/dist/provider/hui-provider.context.js.map +1 -0
- package/dist/provider/hui-provider.d.ts +8 -0
- package/dist/provider/hui-provider.js +17 -0
- package/dist/provider/hui-provider.js.map +1 -0
- package/dist/provider/index.d.ts +3 -0
- package/dist/provider/merge-props.js +16 -0
- package/dist/provider/merge-props.js.map +1 -0
- package/dist/types/hui-component.d.ts +8 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/polymorphic.d.ts +13 -0
- package/dist/utils/attributes/normalize-attributes.js +18 -0
- package/dist/utils/attributes/normalize-attributes.js.map +1 -0
- package/package.json +54 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { detailsRecipe } from "@hebium-ui/core";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/details/details.tsx
|
|
5
|
+
function Details(rawProps) {
|
|
6
|
+
const { summary, border, classNames, styles, children, ...restProps } = useHuiProps("Details", rawProps);
|
|
7
|
+
const recipe = detailsRecipe({ border });
|
|
8
|
+
const cls = useHuiClassNames("Details", recipe, classNames);
|
|
9
|
+
const sls = useHuiStyles("Details", styles);
|
|
10
|
+
return /* @__PURE__ */ jsxs("details", {
|
|
11
|
+
className: cls.root,
|
|
12
|
+
style: sls.root,
|
|
13
|
+
...restProps,
|
|
14
|
+
children: [/* @__PURE__ */ jsx("summary", {
|
|
15
|
+
className: cls.summary,
|
|
16
|
+
style: sls.summary,
|
|
17
|
+
children: summary
|
|
18
|
+
}), children != null && /* @__PURE__ */ jsx("div", {
|
|
19
|
+
className: cls.content,
|
|
20
|
+
style: sls.content,
|
|
21
|
+
children
|
|
22
|
+
})]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { Details };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=details.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"details.js","names":[],"sources":["../../../src/components/details/details.tsx"],"sourcesContent":["import { detailsRecipe, type DetailsSlots, type DetailsVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement, type ReactNode } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface DetailsOwnProps extends ComponentProps<\"details\"> {\n /**\n * The summary displayed in the disclosure button.\n */\n summary: ReactNode;\n /**\n * The border style of the details container.\n *\n * @default \"block\"\n */\n border?: DetailsVariants[\"border\"] | undefined;\n}\n\nexport type DetailsProps = HuiComponentProps<\n DetailsOwnProps,\n DetailsSlots\n>;\n\nexport function Details(rawProps: DetailsProps): ReactElement {\n const {\n summary,\n border,\n classNames,\n styles,\n children,\n ...restProps\n } = useHuiProps(\"Details\", rawProps);\n\n const recipe = detailsRecipe({ border });\n const cls = useHuiClassNames(\"Details\", recipe, classNames);\n const sls = useHuiStyles(\"Details\", styles);\n\n return (\n <details\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n <summary\n className={cls.summary}\n style={sls.summary}\n >\n {summary}\n </summary>\n {children != null && (\n <div\n className={cls.content}\n style={sls.content}\n >\n {children}\n </div>\n )}\n </details>\n );\n}\n"],"mappings":";;;;AAuBA,SAAgB,QAAQ,UAAsC;CAC5D,MAAM,EACJ,SACA,QACA,YACA,QACA,UACA,GAAG,cACD,YAAY,WAAW,QAAQ;CAEnC,MAAM,SAAS,cAAc,EAAE,OAAO,CAAC;CACvC,MAAM,MAAM,iBAAiB,WAAW,QAAQ,UAAU;CAC1D,MAAM,MAAM,aAAa,WAAW,MAAM;CAE1C,OACE,qBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAHN,UAAA,CAKE,oBAAC,WAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GAEV,UAAA;EACM,CAAA,GACR,YAAY,QACX,oBAAC,OAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GAEV;EACE,CAAA,CAEA;;AAEb"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
//#region src/components/dialog/dialog.context.ts
|
|
3
|
+
const DialogContext = createContext(null);
|
|
4
|
+
function useDialogContext() {
|
|
5
|
+
const context = useContext(DialogContext);
|
|
6
|
+
if (!context) throw new Error("[Hebium UI] Dialog compound components must be used within <Dialog>");
|
|
7
|
+
return context;
|
|
8
|
+
}
|
|
9
|
+
function useDialogId() {
|
|
10
|
+
return useDialogContext().dialogId;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { DialogContext, useDialogContext, useDialogId };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=dialog.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.context.js","names":[],"sources":["../../../src/components/dialog/dialog.context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nexport interface DialogContextValue {\n dialogId: string;\n modal: boolean;\n open: () => void;\n}\n\nexport const DialogContext = createContext<DialogContextValue | null>(null);\n\nexport function useDialogContext(): DialogContextValue {\n const context = useContext(DialogContext);\n if (!context) {\n throw new Error(\"[Hebium UI] Dialog compound components must be used within <Dialog>\");\n }\n return context;\n}\n\nexport function useDialogId(): string {\n return useDialogContext().dialogId;\n}\n"],"mappings":";;AAQA,MAAa,gBAAgB,cAAyC,IAAI;AAE1E,SAAgB,mBAAuC;CACrD,MAAM,UAAU,WAAW,aAAa;CACxC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,qEAAqE;CAEvF,OAAO;AACT;AAEA,SAAgB,cAAsB;CACpC,OAAO,iBAAiB,CAAC,CAAC;AAC5B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { HuiComponentProps } from "../../types/hui-component.js";
|
|
2
|
+
import { HuiPolymorphicProps } from "../../types/polymorphic.js";
|
|
3
|
+
import "../../types/index.js";
|
|
4
|
+
import { Button, ButtonProps } from "../button/button.js";
|
|
5
|
+
import "../button/index.js";
|
|
6
|
+
import { HeadingProps } from "../heading/heading.js";
|
|
7
|
+
import "../heading/index.js";
|
|
8
|
+
import { ButtonSlots, DialogSlots } from "@hebium-ui/core";
|
|
9
|
+
import { ComponentProps, ElementType, ReactElement, ReactNode } from "react";
|
|
10
|
+
//#region src/components/dialog/dialog.d.ts
|
|
11
|
+
export interface DialogProps {
|
|
12
|
+
/**
|
|
13
|
+
* The id of the dialog content element.
|
|
14
|
+
*/
|
|
15
|
+
id?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the dialog should open as a modal dialog.
|
|
18
|
+
*
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
modal?: boolean | undefined;
|
|
22
|
+
children?: ReactNode | undefined;
|
|
23
|
+
}
|
|
24
|
+
declare function DialogRoot(rawProps: DialogProps): ReactElement;
|
|
25
|
+
export type DialogTriggerProps<E extends ElementType = typeof Button> = HuiPolymorphicProps<E, {}, ButtonSlots>;
|
|
26
|
+
declare function Trigger<E extends ElementType = typeof Button>(rawProps: DialogTriggerProps<E>): ReactNode;
|
|
27
|
+
type HtmlDialogProps = Omit<ComponentProps<"dialog">, "children" | "id" | "open">;
|
|
28
|
+
interface DialogContentOwnProps extends HtmlDialogProps {
|
|
29
|
+
/**
|
|
30
|
+
* The heading rendered at the top of the dialog content.
|
|
31
|
+
*/
|
|
32
|
+
heading?: ReactNode | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Additional props passed to the internal heading component.
|
|
35
|
+
*/
|
|
36
|
+
headingProps?: Omit<HeadingProps, "children" | "id" | "className" | "style"> | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* The content rendered inside the internal close button. Set to `null` or `false` to hide the button.
|
|
39
|
+
*
|
|
40
|
+
* @default close icon
|
|
41
|
+
*/
|
|
42
|
+
closeButton?: ReactNode | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Additional props passed to the internal close button.
|
|
45
|
+
*/
|
|
46
|
+
closeButtonProps?: Omit<DialogCloseProps, "children" | "className" | "style"> | undefined;
|
|
47
|
+
children?: ReactNode | undefined;
|
|
48
|
+
}
|
|
49
|
+
export type DialogContentProps = HuiComponentProps<DialogContentOwnProps, DialogSlots>;
|
|
50
|
+
declare function Content(rawProps: DialogContentProps): ReactElement;
|
|
51
|
+
export interface DialogCloseProps extends Omit<ButtonProps, "as"> {
|
|
52
|
+
/**
|
|
53
|
+
* The command used to close the dialog.
|
|
54
|
+
*
|
|
55
|
+
* @default "request-close"
|
|
56
|
+
*/
|
|
57
|
+
command?: "close" | "request-close" | undefined;
|
|
58
|
+
}
|
|
59
|
+
declare function Close(rawProps: DialogCloseProps): ReactNode;
|
|
60
|
+
export declare const Dialog: typeof DialogRoot & {
|
|
61
|
+
Trigger: typeof Trigger;
|
|
62
|
+
Content: typeof Content;
|
|
63
|
+
Close: typeof Close;
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { Button } from "../button/button.js";
|
|
3
|
+
import { normalizeAttributes } from "../../utils/attributes/normalize-attributes.js";
|
|
4
|
+
import { Heading } from "../heading/heading.js";
|
|
5
|
+
import { DialogContext, useDialogContext, useDialogId } from "./dialog.context.js";
|
|
6
|
+
import { dialogControl, dialogRecipe, toStrbool } from "@hebium-ui/core";
|
|
7
|
+
import { useCallback, useId, useMemo } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/dialog/dialog.tsx
|
|
10
|
+
function DialogRoot(rawProps) {
|
|
11
|
+
const { id, modal = false, children } = useHuiProps("Dialog", rawProps);
|
|
12
|
+
const tmpId = useId();
|
|
13
|
+
const dialogId = id || tmpId;
|
|
14
|
+
const open = useCallback(() => {
|
|
15
|
+
dialogControl.openDialog(dialogId, modal);
|
|
16
|
+
}, [dialogId, modal]);
|
|
17
|
+
const contextValue = useMemo(() => ({
|
|
18
|
+
dialogId,
|
|
19
|
+
modal,
|
|
20
|
+
open
|
|
21
|
+
}), [
|
|
22
|
+
dialogId,
|
|
23
|
+
modal,
|
|
24
|
+
open
|
|
25
|
+
]);
|
|
26
|
+
return /* @__PURE__ */ jsx(DialogContext.Provider, {
|
|
27
|
+
value: contextValue,
|
|
28
|
+
children
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function Trigger(rawProps) {
|
|
32
|
+
const { as, children, onClick, ...restProps } = useHuiProps("DialogTrigger", rawProps);
|
|
33
|
+
const Component = as ?? Button;
|
|
34
|
+
const { dialogId, modal, open } = useDialogContext();
|
|
35
|
+
const attrs = normalizeAttributes(dialogControl.getTriggerAttributes({ id: dialogId }, {
|
|
36
|
+
modal,
|
|
37
|
+
isButtonElement: as === void 0
|
|
38
|
+
}));
|
|
39
|
+
const handleClick = useCallback((e) => {
|
|
40
|
+
onClick?.(e);
|
|
41
|
+
if (modal || e.defaultPrevented) return;
|
|
42
|
+
open();
|
|
43
|
+
}, [
|
|
44
|
+
modal,
|
|
45
|
+
onClick,
|
|
46
|
+
open
|
|
47
|
+
]);
|
|
48
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
49
|
+
...attrs,
|
|
50
|
+
onClick: handleClick,
|
|
51
|
+
...restProps,
|
|
52
|
+
children
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function Content(rawProps) {
|
|
56
|
+
const { classNames, styles, children, heading, headingProps, closeButton, closeButtonProps, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...restProps } = useHuiProps("DialogContent", rawProps);
|
|
57
|
+
const { dialogId, modal } = useDialogContext();
|
|
58
|
+
const resolvedHeading = heading !== void 0 && heading !== null && heading !== false ? heading : void 0;
|
|
59
|
+
const state = { id: dialogId };
|
|
60
|
+
const attrs = normalizeAttributes(dialogControl.getContentAttributes(state, {
|
|
61
|
+
hasHeading: resolvedHeading !== void 0,
|
|
62
|
+
ariaLabel,
|
|
63
|
+
ariaLabelledBy
|
|
64
|
+
}));
|
|
65
|
+
const headingAttrs = normalizeAttributes(dialogControl.getHeadingAttributes(state));
|
|
66
|
+
const headingId = resolvedHeading !== void 0 ? headingAttrs.id : void 0;
|
|
67
|
+
const headingLevel = headingProps?.level ?? 2;
|
|
68
|
+
const recipe = dialogRecipe({ modal: toStrbool(modal) });
|
|
69
|
+
const cls = useHuiClassNames("DialogContent", recipe, classNames);
|
|
70
|
+
const sls = useHuiStyles("DialogContent", styles);
|
|
71
|
+
const shouldRenderCloseButton = closeButton !== null && closeButton !== false;
|
|
72
|
+
const shouldRenderHeader = headingId !== void 0 || shouldRenderCloseButton;
|
|
73
|
+
const closeButtonContent = closeButton === void 0 ? /* @__PURE__ */ jsx("span", {
|
|
74
|
+
"aria-hidden": true,
|
|
75
|
+
className: cls.closeButtonIcon,
|
|
76
|
+
style: sls.closeButtonIcon
|
|
77
|
+
}) : closeButton;
|
|
78
|
+
return /* @__PURE__ */ jsxs("dialog", {
|
|
79
|
+
...attrs,
|
|
80
|
+
className: cls.root,
|
|
81
|
+
style: sls.root,
|
|
82
|
+
...restProps,
|
|
83
|
+
children: [shouldRenderHeader && /* @__PURE__ */ jsxs("div", {
|
|
84
|
+
className: cls.header,
|
|
85
|
+
style: sls.header,
|
|
86
|
+
children: [headingId && /* @__PURE__ */ jsx(Heading, {
|
|
87
|
+
margin: "none",
|
|
88
|
+
...headingProps,
|
|
89
|
+
...headingAttrs,
|
|
90
|
+
className: cls.heading,
|
|
91
|
+
style: sls.heading,
|
|
92
|
+
level: headingLevel,
|
|
93
|
+
children: resolvedHeading
|
|
94
|
+
}), shouldRenderCloseButton && /* @__PURE__ */ jsx(Close, {
|
|
95
|
+
className: cls.closeButton,
|
|
96
|
+
style: sls.closeButton,
|
|
97
|
+
"aria-label": "Close Dialog",
|
|
98
|
+
variant: "ghost",
|
|
99
|
+
color: "neutral",
|
|
100
|
+
shape: "square",
|
|
101
|
+
...closeButtonProps,
|
|
102
|
+
children: closeButtonContent
|
|
103
|
+
})]
|
|
104
|
+
}), children]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function Close(rawProps) {
|
|
108
|
+
const props = useHuiProps("DialogClose", rawProps);
|
|
109
|
+
const dialogId = useDialogId();
|
|
110
|
+
const attrs = normalizeAttributes(dialogControl.getCloseAttributes({ id: dialogId }));
|
|
111
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
112
|
+
...attrs,
|
|
113
|
+
...props
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
const Dialog = Object.assign(DialogRoot, {
|
|
117
|
+
Trigger,
|
|
118
|
+
Content,
|
|
119
|
+
Close
|
|
120
|
+
});
|
|
121
|
+
//#endregion
|
|
122
|
+
export { Dialog };
|
|
123
|
+
|
|
124
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","names":[],"sources":["../../../src/components/dialog/dialog.tsx"],"sourcesContent":["import { type ButtonSlots, dialogControl, dialogRecipe, type DialogSlots, toStrbool } from \"@hebium-ui/core\";\nimport {\n type ComponentProps,\n type ElementType,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n useCallback,\n useId,\n useMemo,\n} from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { Heading, type HeadingProps } from \"../heading\";\nimport { DialogContext, type DialogContextValue, useDialogContext, useDialogId } from \"./dialog.context\";\n\nexport interface DialogProps {\n /**\n * The id of the dialog content element.\n */\n id?: string | undefined;\n /**\n * Whether the dialog should open as a modal dialog.\n *\n * @default false\n */\n modal?: boolean | undefined;\n children?: ReactNode | undefined;\n}\n\nfunction DialogRoot(rawProps: DialogProps): ReactElement {\n const {\n id,\n modal = false,\n children,\n } = useHuiProps(\"Dialog\", rawProps);\n\n const tmpId = useId();\n const dialogId = id || tmpId;\n const open = useCallback((): void => {\n dialogControl.openDialog(dialogId, modal);\n }, [dialogId, modal]);\n\n const contextValue = useMemo<DialogContextValue>(() => ({\n dialogId,\n modal,\n open,\n }), [dialogId, modal, open]);\n\n return (\n <DialogContext.Provider value={contextValue}>\n {children}\n </DialogContext.Provider>\n );\n}\n\nexport type DialogTriggerProps<E extends ElementType = typeof Button> = HuiPolymorphicProps<\n E,\n {},\n ButtonSlots\n>;\n\nfunction Trigger<E extends ElementType = typeof Button>(rawProps: DialogTriggerProps<E>): ReactNode {\n const {\n as,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"DialogTrigger\", rawProps);\n\n const Component = as ?? Button;\n const {\n dialogId,\n modal,\n open,\n } = useDialogContext();\n const attrs = normalizeAttributes(\n dialogControl.getTriggerAttributes(\n { id: dialogId },\n {\n modal,\n isButtonElement: as === undefined,\n },\n ),\n );\n\n const handleClick = useCallback((e: MouseEvent<HTMLElement>): void => {\n onClick?.(e);\n if (modal || e.defaultPrevented) return;\n\n open();\n }, [modal, onClick, open]);\n\n return (\n <Component\n {...attrs}\n onClick={handleClick}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ntype HtmlDialogProps = Omit<ComponentProps<\"dialog\">, \"children\" | \"id\" | \"open\">;\n\ninterface DialogContentOwnProps extends HtmlDialogProps {\n /**\n * The heading rendered at the top of the dialog content.\n */\n heading?: ReactNode | undefined;\n /**\n * Additional props passed to the internal heading component.\n */\n headingProps?: Omit<HeadingProps, \"children\" | \"id\" | \"className\" | \"style\"> | undefined;\n /**\n * The content rendered inside the internal close button. Set to `null` or `false` to hide the button.\n *\n * @default close icon\n */\n closeButton?: ReactNode | undefined;\n /**\n * Additional props passed to the internal close button.\n */\n closeButtonProps?: Omit<DialogCloseProps, \"children\" | \"className\" | \"style\"> | undefined;\n children?: ReactNode | undefined;\n}\nexport type DialogContentProps = HuiComponentProps<DialogContentOwnProps, DialogSlots>;\n\nfunction Content(rawProps: DialogContentProps): ReactElement {\n const {\n classNames,\n styles,\n children,\n heading,\n headingProps,\n closeButton,\n closeButtonProps,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...restProps\n } = useHuiProps(\"DialogContent\", rawProps);\n\n const {\n dialogId,\n modal,\n } = useDialogContext();\n\n const resolvedHeading = heading !== undefined && heading !== null && heading !== false\n ? heading\n : undefined;\n const state = { id: dialogId };\n const attrs = normalizeAttributes(\n dialogControl.getContentAttributes(\n state,\n {\n hasHeading: resolvedHeading !== undefined,\n ariaLabel,\n ariaLabelledBy,\n },\n ),\n );\n const headingAttrs = normalizeAttributes(dialogControl.getHeadingAttributes(state));\n const headingId = resolvedHeading !== undefined ? headingAttrs.id : undefined;\n const headingLevel = headingProps?.level ?? 2;\n\n const recipe = dialogRecipe({ modal: toStrbool(modal) });\n const cls = useHuiClassNames(\"DialogContent\", recipe, classNames);\n const sls = useHuiStyles(\"DialogContent\", styles);\n\n const shouldRenderCloseButton = closeButton !== null && closeButton !== false;\n const shouldRenderHeader = headingId !== undefined || shouldRenderCloseButton;\n const closeButtonContent = closeButton === undefined\n ? <span aria-hidden className={cls.closeButtonIcon} style={sls.closeButtonIcon} />\n : closeButton;\n\n return (\n <dialog\n {...attrs}\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {shouldRenderHeader && (\n <div className={cls.header} style={sls.header}>\n {headingId && (\n <Heading\n margin=\"none\"\n {...headingProps}\n {...headingAttrs}\n className={cls.heading}\n style={sls.heading}\n level={headingLevel}\n >\n {resolvedHeading}\n </Heading>\n )}\n {shouldRenderCloseButton && (\n <Close\n className={cls.closeButton}\n style={sls.closeButton}\n aria-label=\"Close Dialog\"\n variant=\"ghost\"\n color=\"neutral\"\n shape=\"square\"\n {...closeButtonProps}\n >\n {closeButtonContent}\n </Close>\n )}\n </div>\n )}\n {children}\n </dialog>\n );\n}\n\nexport interface DialogCloseProps extends Omit<ButtonProps, \"as\"> {\n /**\n * The command used to close the dialog.\n *\n * @default \"request-close\"\n */\n command?: \"close\" | \"request-close\" | undefined;\n}\n\nfunction Close(rawProps: DialogCloseProps): ReactNode {\n const props = useHuiProps(\"DialogClose\", rawProps);\n const dialogId = useDialogId();\n const attrs = normalizeAttributes(dialogControl.getCloseAttributes({ id: dialogId }));\n\n return (\n <Button\n {...attrs}\n {...props}\n />\n );\n}\n\nexport const Dialog = Object.assign(DialogRoot, {\n Trigger,\n Content,\n Close,\n});\n"],"mappings":";;;;;;;;;AAgCA,SAAS,WAAW,UAAqC;CACvD,MAAM,EACJ,IACA,QAAQ,OACR,aACE,YAAY,UAAU,QAAQ;CAElC,MAAM,QAAQ,MAAM;CACpB,MAAM,WAAW,MAAM;CACvB,MAAM,OAAO,kBAAwB;EACnC,cAAc,WAAW,UAAU,KAAK;CAC1C,GAAG,CAAC,UAAU,KAAK,CAAC;CAEpB,MAAM,eAAe,eAAmC;EACtD;EACA;EACA;CACF,IAAI;EAAC;EAAU;EAAO;CAAI,CAAC;CAE3B,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;EAC5B;CACqB,CAAA;AAE5B;AAQA,SAAS,QAA+C,UAA4C;CAClG,MAAM,EACJ,IACA,UACA,SACA,GAAG,cACD,YAAY,iBAAiB,QAAQ;CAEzC,MAAM,YAAY,MAAM;CACxB,MAAM,EACJ,UACA,OACA,SACE,iBAAiB;CACrB,MAAM,QAAQ,oBACZ,cAAc,qBACZ,EAAE,IAAI,SAAS,GACf;EACE;EACA,iBAAiB,OAAO,KAAA;CAC1B,CACF,CACF;CAEA,MAAM,cAAc,aAAa,MAAqC;EACpE,UAAU,CAAC;EACX,IAAI,SAAS,EAAE,kBAAkB;EAEjC,KAAK;CACP,GAAG;EAAC;EAAO;EAAS;CAAI,CAAC;CAEzB,OACE,oBAAC,WAAD;EACE,GAAI;EACJ,SAAS;EACT,GAAI;EAEH;CACQ,CAAA;AAEf;AA2BA,SAAS,QAAQ,UAA4C;CAC3D,MAAM,EACJ,YACA,QACA,UACA,SACA,cACA,aACA,kBACA,cAAc,WACd,mBAAmB,gBACnB,GAAG,cACD,YAAY,iBAAiB,QAAQ;CAEzC,MAAM,EACJ,UACA,UACE,iBAAiB;CAErB,MAAM,kBAAkB,YAAY,KAAA,KAAa,YAAY,QAAQ,YAAY,QAC7E,UACA,KAAA;CACJ,MAAM,QAAQ,EAAE,IAAI,SAAS;CAC7B,MAAM,QAAQ,oBACZ,cAAc,qBACZ,OACA;EACE,YAAY,oBAAoB,KAAA;EAChC;EACA;CACF,CACF,CACF;CACA,MAAM,eAAe,oBAAoB,cAAc,qBAAqB,KAAK,CAAC;CAClF,MAAM,YAAY,oBAAoB,KAAA,IAAY,aAAa,KAAK,KAAA;CACpE,MAAM,eAAe,cAAc,SAAS;CAE5C,MAAM,SAAS,aAAa,EAAE,OAAO,UAAU,KAAK,EAAE,CAAC;CACvD,MAAM,MAAM,iBAAiB,iBAAiB,QAAQ,UAAU;CAChE,MAAM,MAAM,aAAa,iBAAiB,MAAM;CAEhD,MAAM,0BAA0B,gBAAgB,QAAQ,gBAAgB;CACxE,MAAM,qBAAqB,cAAc,KAAA,KAAa;CACtD,MAAM,qBAAqB,gBAAgB,KAAA,IACvC,oBAAC,QAAD;EAAM,eAAA;EAAY,WAAW,IAAI;EAAiB,OAAO,IAAI;CAAkB,CAAA,IAC/E;CAEJ,OACE,qBAAC,UAAD;EACE,GAAI;EACJ,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAJN,UAAA,CAMG,sBACC,qBAAC,OAAD;GAAK,WAAW,IAAI;GAAQ,OAAO,IAAI;GAAvC,UAAA,CACG,aACC,oBAAC,SAAD;IACE,QAAO;IACP,GAAI;IACJ,GAAI;IACJ,WAAW,IAAI;IACf,OAAO,IAAI;IACX,OAAO;IAEN,UAAA;GACM,CAAA,GAEV,2BACC,oBAAC,OAAD;IACE,WAAW,IAAI;IACf,OAAO,IAAI;IACX,cAAW;IACX,SAAQ;IACR,OAAM;IACN,OAAM;IACN,GAAI;IAEH,UAAA;GACI,CAAA,CAEN;EAEN,CAAA,GAAA,QACK;;AAEZ;AAWA,SAAS,MAAM,UAAuC;CACpD,MAAM,QAAQ,YAAY,eAAe,QAAQ;CACjD,MAAM,WAAW,YAAY;CAC7B,MAAM,QAAQ,oBAAoB,cAAc,mBAAmB,EAAE,IAAI,SAAS,CAAC,CAAC;CAEpF,OACE,oBAAC,QAAD;EACE,GAAI;EACJ,GAAI;CACL,CAAA;AAEL;AAEA,MAAa,SAAS,OAAO,OAAO,YAAY;CAC9C;CACA;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HuiComponentProps } from "../../types/hui-component.js";
|
|
2
|
+
import "../../types/index.js";
|
|
3
|
+
import { DdSlots, DlSlots, DtSlots } from "@hebium-ui/core";
|
|
4
|
+
import { ComponentProps, ReactElement } from "react";
|
|
5
|
+
//#region src/components/dl/dl.d.ts
|
|
6
|
+
export interface DlProps extends HuiComponentProps<ComponentProps<"dl">, DlSlots> {}
|
|
7
|
+
declare function DlRoot(rawProps: DlProps): ReactElement;
|
|
8
|
+
export interface DtProps extends HuiComponentProps<ComponentProps<"dt">, DtSlots> {}
|
|
9
|
+
declare function Dt(rawProps: DtProps): ReactElement;
|
|
10
|
+
export interface DdProps extends HuiComponentProps<ComponentProps<"dd">, DdSlots> {}
|
|
11
|
+
declare function Dd(rawProps: DdProps): ReactElement;
|
|
12
|
+
export declare const Dl: typeof DlRoot & {
|
|
13
|
+
Dt: typeof Dt;
|
|
14
|
+
Dd: typeof Dd;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=dl.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { ddRecipe, dlRecipe, dtRecipe } from "@hebium-ui/core";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/dl/dl.tsx
|
|
5
|
+
function DlRoot(rawProps) {
|
|
6
|
+
const { className, style, children, ...restProps } = useHuiProps("Dl", rawProps);
|
|
7
|
+
const recipe = dlRecipe({});
|
|
8
|
+
const cls = useHuiClassNames("Dl", recipe, { root: className });
|
|
9
|
+
const sls = useHuiStyles("Dl", { root: style });
|
|
10
|
+
return /* @__PURE__ */ jsx("dl", {
|
|
11
|
+
className: cls.root,
|
|
12
|
+
style: sls.root,
|
|
13
|
+
...restProps,
|
|
14
|
+
children
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function Dt(rawProps) {
|
|
18
|
+
const { className, style, children, ...restProps } = useHuiProps("DlDt", rawProps);
|
|
19
|
+
const recipe = dtRecipe({});
|
|
20
|
+
const cls = useHuiClassNames("DlDt", recipe, { root: className });
|
|
21
|
+
const sls = useHuiStyles("DlDt", { root: style });
|
|
22
|
+
return /* @__PURE__ */ jsx("dt", {
|
|
23
|
+
className: cls.root,
|
|
24
|
+
style: sls.root,
|
|
25
|
+
...restProps,
|
|
26
|
+
children
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function Dd(rawProps) {
|
|
30
|
+
const { className, style, children, ...restProps } = useHuiProps("DlDd", rawProps);
|
|
31
|
+
const recipe = ddRecipe({});
|
|
32
|
+
const cls = useHuiClassNames("DlDd", recipe, { root: className });
|
|
33
|
+
const sls = useHuiStyles("DlDd", { root: style });
|
|
34
|
+
return /* @__PURE__ */ jsx("dd", {
|
|
35
|
+
className: cls.root,
|
|
36
|
+
style: sls.root,
|
|
37
|
+
...restProps,
|
|
38
|
+
children
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const Dl = Object.assign(DlRoot, {
|
|
42
|
+
Dt,
|
|
43
|
+
Dd
|
|
44
|
+
});
|
|
45
|
+
//#endregion
|
|
46
|
+
export { Dl };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=dl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dl.js","names":[],"sources":["../../../src/components/dl/dl.tsx"],"sourcesContent":["import { ddRecipe, type DdSlots, dlRecipe, type DlSlots, dtRecipe, type DtSlots } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport interface DlProps extends HuiComponentProps<ComponentProps<\"dl\">, DlSlots> {}\n\nfunction DlRoot(rawProps: DlProps): ReactElement {\n const {\n className,\n style,\n children,\n ...restProps\n } = useHuiProps(\"Dl\", rawProps);\n\n const recipe = dlRecipe({});\n const cls = useHuiClassNames(\"Dl\", recipe, { root: className });\n const sls = useHuiStyles(\"Dl\", { root: style });\n return (\n <dl\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </dl>\n );\n}\n\nexport interface DtProps extends HuiComponentProps<ComponentProps<\"dt\">, DtSlots> {}\n\nfunction Dt(rawProps: DtProps): ReactElement {\n const {\n className,\n style,\n children,\n ...restProps\n } = useHuiProps(\"DlDt\", rawProps);\n const recipe = dtRecipe({});\n\n const cls = useHuiClassNames(\"DlDt\", recipe, { root: className });\n const sls = useHuiStyles(\"DlDt\", { root: style });\n return (\n <dt\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </dt>\n );\n}\n\nexport interface DdProps extends HuiComponentProps<ComponentProps<\"dd\">, DdSlots> {}\n\nfunction Dd(rawProps: DdProps): ReactElement {\n const {\n className,\n style,\n children,\n ...restProps\n } = useHuiProps(\"DlDd\", rawProps);\n\n const recipe = ddRecipe({});\n const cls = useHuiClassNames(\"DlDd\", recipe, { root: className });\n const sls = useHuiStyles(\"DlDd\", { root: style });\n\n return (\n <dd\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </dd>\n );\n}\n\nexport const Dl = Object.assign(DlRoot, {\n Dt,\n Dd,\n});\n"],"mappings":";;;;AAOA,SAAS,OAAO,UAAiC;CAC/C,MAAM,EACJ,WACA,OACA,UACA,GAAG,cACD,YAAY,MAAM,QAAQ;CAE9B,MAAM,SAAS,SAAS,CAAC,CAAC;CAC1B,MAAM,MAAM,iBAAiB,MAAM,QAAQ,EAAE,MAAM,UAAU,CAAC;CAC9D,MAAM,MAAM,aAAa,MAAM,EAAE,MAAM,MAAM,CAAC;CAC9C,OACE,oBAAC,MAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACC,CAAA;AAER;AAIA,SAAS,GAAG,UAAiC;CAC3C,MAAM,EACJ,WACA,OACA,UACA,GAAG,cACD,YAAY,QAAQ,QAAQ;CAChC,MAAM,SAAS,SAAS,CAAC,CAAC;CAE1B,MAAM,MAAM,iBAAiB,QAAQ,QAAQ,EAAE,MAAM,UAAU,CAAC;CAChE,MAAM,MAAM,aAAa,QAAQ,EAAE,MAAM,MAAM,CAAC;CAChD,OACE,oBAAC,MAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACC,CAAA;AAER;AAIA,SAAS,GAAG,UAAiC;CAC3C,MAAM,EACJ,WACA,OACA,UACA,GAAG,cACD,YAAY,QAAQ,QAAQ;CAEhC,MAAM,SAAS,SAAS,CAAC,CAAC;CAC1B,MAAM,MAAM,iBAAiB,QAAQ,QAAQ,EAAE,MAAM,UAAU,CAAC;CAChE,MAAM,MAAM,aAAa,QAAQ,EAAE,MAAM,MAAM,CAAC;CAEhD,OACE,oBAAC,MAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACC,CAAA;AAER;AAEA,MAAa,KAAK,OAAO,OAAO,QAAQ;CACtC;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
//#region src/components/drawer/drawer.context.ts
|
|
3
|
+
const DrawerContext = createContext(null);
|
|
4
|
+
function useDrawerContext() {
|
|
5
|
+
const context = useContext(DrawerContext);
|
|
6
|
+
if (!context) throw new Error("[Hebium UI] Drawer compound components must be used within <Drawer>");
|
|
7
|
+
return context;
|
|
8
|
+
}
|
|
9
|
+
function useDrawerId() {
|
|
10
|
+
return useDrawerContext().drawerId;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { DrawerContext, useDrawerContext, useDrawerId };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=drawer.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.context.js","names":[],"sources":["../../../src/components/drawer/drawer.context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nexport interface DrawerContextValue {\n drawerId: string;\n}\n\nexport const DrawerContext = createContext<DrawerContextValue | null>(null);\n\nexport function useDrawerContext(): DrawerContextValue {\n const context = useContext(DrawerContext);\n if (!context) {\n throw new Error(\"[Hebium UI] Drawer compound components must be used within <Drawer>\");\n }\n return context;\n}\n\nexport function useDrawerId(): string {\n return useDrawerContext().drawerId;\n}\n"],"mappings":";;AAMA,MAAa,gBAAgB,cAAyC,IAAI;AAE1E,SAAgB,mBAAuC;CACrD,MAAM,UAAU,WAAW,aAAa;CACxC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,qEAAqE;CAEvF,OAAO;AACT;AAEA,SAAgB,cAAsB;CACpC,OAAO,iBAAiB,CAAC,CAAC;AAC5B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { HuiComponentProps } from "../../types/hui-component.js";
|
|
2
|
+
import { HuiPolymorphicProps } from "../../types/polymorphic.js";
|
|
3
|
+
import "../../types/index.js";
|
|
4
|
+
import { Button, ButtonProps } from "../button/button.js";
|
|
5
|
+
import "../button/index.js";
|
|
6
|
+
import { HeadingProps } from "../heading/heading.js";
|
|
7
|
+
import "../heading/index.js";
|
|
8
|
+
import { ButtonSlots, DrawerSlots, DrawerVariants } from "@hebium-ui/core";
|
|
9
|
+
import { ComponentProps, ElementType, ReactElement, ReactNode } from "react";
|
|
10
|
+
//#region src/components/drawer/drawer.d.ts
|
|
11
|
+
export interface DrawerProps {
|
|
12
|
+
/**
|
|
13
|
+
* The id of the drawer content element.
|
|
14
|
+
*/
|
|
15
|
+
id?: string | undefined;
|
|
16
|
+
children?: ReactNode | undefined;
|
|
17
|
+
}
|
|
18
|
+
declare function DrawerRoot(rawProps: DrawerProps): ReactElement;
|
|
19
|
+
export type DrawerTriggerProps<E extends ElementType = typeof Button> = HuiPolymorphicProps<E, {}, ButtonSlots>;
|
|
20
|
+
declare function Trigger<E extends ElementType = typeof Button>(rawProps: DrawerTriggerProps<E>): ReactNode;
|
|
21
|
+
type HtmlDialogProps = Omit<ComponentProps<"dialog">, "children" | "id" | "open">;
|
|
22
|
+
interface DrawerContentOwnProps extends HtmlDialogProps {
|
|
23
|
+
/**
|
|
24
|
+
* The edge from which the drawer enters.
|
|
25
|
+
*
|
|
26
|
+
* @default "inline-end"
|
|
27
|
+
*/
|
|
28
|
+
placement?: DrawerVariants["placement"] | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The heading rendered at the top of the drawer content.
|
|
31
|
+
*/
|
|
32
|
+
heading?: ReactNode | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Additional props passed to the internal heading component.
|
|
35
|
+
*/
|
|
36
|
+
headingProps?: Omit<HeadingProps, "children" | "id" | "className" | "style"> | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* The content rendered inside the internal close button. Set to `null` or `false` to hide the button.
|
|
39
|
+
*
|
|
40
|
+
* @default close icon
|
|
41
|
+
*/
|
|
42
|
+
closeButton?: ReactNode | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Additional props passed to the internal close button.
|
|
45
|
+
*/
|
|
46
|
+
closeButtonProps?: Omit<DrawerCloseProps, "children" | "className" | "style"> | undefined;
|
|
47
|
+
children?: ReactNode | undefined;
|
|
48
|
+
}
|
|
49
|
+
export type DrawerContentProps = HuiComponentProps<DrawerContentOwnProps, DrawerSlots>;
|
|
50
|
+
declare function Content(rawProps: DrawerContentProps): ReactElement;
|
|
51
|
+
export interface DrawerCloseProps extends Omit<ButtonProps, "as"> {
|
|
52
|
+
/**
|
|
53
|
+
* The command used to close the drawer.
|
|
54
|
+
*
|
|
55
|
+
* @default "request-close"
|
|
56
|
+
*/
|
|
57
|
+
command?: "close" | "request-close" | undefined;
|
|
58
|
+
}
|
|
59
|
+
declare function Close(rawProps: DrawerCloseProps): ReactNode;
|
|
60
|
+
export declare const Drawer: typeof DrawerRoot & {
|
|
61
|
+
Trigger: typeof Trigger;
|
|
62
|
+
Content: typeof Content;
|
|
63
|
+
Close: typeof Close;
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { Button } from "../button/button.js";
|
|
3
|
+
import { normalizeAttributes } from "../../utils/attributes/normalize-attributes.js";
|
|
4
|
+
import { Heading } from "../heading/heading.js";
|
|
5
|
+
import { DrawerContext, useDrawerContext, useDrawerId } from "./drawer.context.js";
|
|
6
|
+
import { dialogControl, drawerRecipe } from "@hebium-ui/core";
|
|
7
|
+
import { useId, useMemo } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/drawer/drawer.tsx
|
|
10
|
+
function DrawerRoot(rawProps) {
|
|
11
|
+
const { id, children } = useHuiProps("Drawer", rawProps);
|
|
12
|
+
const tmpId = useId();
|
|
13
|
+
const drawerId = id || tmpId;
|
|
14
|
+
const contextValue = useMemo(() => ({ drawerId }), [drawerId]);
|
|
15
|
+
return /* @__PURE__ */ jsx(DrawerContext.Provider, {
|
|
16
|
+
value: contextValue,
|
|
17
|
+
children
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function Trigger(rawProps) {
|
|
21
|
+
const { as, children, onClick, ...restProps } = useHuiProps("DrawerTrigger", rawProps);
|
|
22
|
+
const Component = as ?? Button;
|
|
23
|
+
const { drawerId } = useDrawerContext();
|
|
24
|
+
const attrs = normalizeAttributes(dialogControl.getTriggerAttributes({ id: drawerId }, {
|
|
25
|
+
modal: true,
|
|
26
|
+
isButtonElement: as === void 0
|
|
27
|
+
}));
|
|
28
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
29
|
+
...attrs,
|
|
30
|
+
onClick,
|
|
31
|
+
...restProps,
|
|
32
|
+
children
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function Content(rawProps) {
|
|
36
|
+
const { placement, classNames, styles, children, heading, headingProps, closeButton, closeButtonProps, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...restProps } = useHuiProps("DrawerContent", rawProps);
|
|
37
|
+
const { drawerId } = useDrawerContext();
|
|
38
|
+
const resolvedHeading = heading !== void 0 && heading !== null && heading !== false ? heading : void 0;
|
|
39
|
+
const state = { id: drawerId };
|
|
40
|
+
const attrs = normalizeAttributes(dialogControl.getContentAttributes(state, {
|
|
41
|
+
hasHeading: resolvedHeading !== void 0,
|
|
42
|
+
ariaLabel,
|
|
43
|
+
ariaLabelledBy
|
|
44
|
+
}));
|
|
45
|
+
const headingAttrs = normalizeAttributes(dialogControl.getHeadingAttributes(state));
|
|
46
|
+
const headingId = resolvedHeading !== void 0 ? headingAttrs.id : void 0;
|
|
47
|
+
const headingLevel = headingProps?.level ?? 2;
|
|
48
|
+
const recipe = drawerRecipe({ placement });
|
|
49
|
+
const cls = useHuiClassNames("DrawerContent", recipe, classNames);
|
|
50
|
+
const sls = useHuiStyles("DrawerContent", styles);
|
|
51
|
+
const shouldRenderCloseButton = closeButton !== null && closeButton !== false;
|
|
52
|
+
const shouldRenderHeader = headingId !== void 0 || shouldRenderCloseButton;
|
|
53
|
+
const closeButtonContent = closeButton === void 0 ? /* @__PURE__ */ jsx("span", {
|
|
54
|
+
"aria-hidden": true,
|
|
55
|
+
className: cls.closeButtonIcon,
|
|
56
|
+
style: sls.closeButtonIcon
|
|
57
|
+
}) : closeButton;
|
|
58
|
+
return /* @__PURE__ */ jsxs("dialog", {
|
|
59
|
+
...attrs,
|
|
60
|
+
className: cls.root,
|
|
61
|
+
style: sls.root,
|
|
62
|
+
...restProps,
|
|
63
|
+
children: [shouldRenderHeader && /* @__PURE__ */ jsxs("div", {
|
|
64
|
+
className: cls.header,
|
|
65
|
+
style: sls.header,
|
|
66
|
+
children: [headingId && /* @__PURE__ */ jsx(Heading, {
|
|
67
|
+
margin: "none",
|
|
68
|
+
...headingProps,
|
|
69
|
+
...headingAttrs,
|
|
70
|
+
className: cls.heading,
|
|
71
|
+
style: sls.heading,
|
|
72
|
+
level: headingLevel,
|
|
73
|
+
children: resolvedHeading
|
|
74
|
+
}), shouldRenderCloseButton && /* @__PURE__ */ jsx(Close, {
|
|
75
|
+
className: cls.closeButton,
|
|
76
|
+
style: sls.closeButton,
|
|
77
|
+
"aria-label": "Close Drawer",
|
|
78
|
+
variant: "ghost",
|
|
79
|
+
color: "neutral",
|
|
80
|
+
shape: "square",
|
|
81
|
+
...closeButtonProps,
|
|
82
|
+
children: closeButtonContent
|
|
83
|
+
})]
|
|
84
|
+
}), children]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function Close(rawProps) {
|
|
88
|
+
const props = useHuiProps("DrawerClose", rawProps);
|
|
89
|
+
const drawerId = useDrawerId();
|
|
90
|
+
const attrs = normalizeAttributes(dialogControl.getCloseAttributes({ id: drawerId }));
|
|
91
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
92
|
+
...attrs,
|
|
93
|
+
...props
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const Drawer = Object.assign(DrawerRoot, {
|
|
97
|
+
Trigger,
|
|
98
|
+
Content,
|
|
99
|
+
Close
|
|
100
|
+
});
|
|
101
|
+
//#endregion
|
|
102
|
+
export { Drawer };
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=drawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.js","names":[],"sources":["../../../src/components/drawer/drawer.tsx"],"sourcesContent":["import { type ButtonSlots, dialogControl, drawerRecipe, type DrawerSlots, type DrawerVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ElementType, type ReactElement, type ReactNode, useId, useMemo } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { Heading, type HeadingProps } from \"../heading\";\nimport { DrawerContext, type DrawerContextValue, useDrawerContext, useDrawerId } from \"./drawer.context\";\n\nexport interface DrawerProps {\n /**\n * The id of the drawer content element.\n */\n id?: string | undefined;\n children?: ReactNode | undefined;\n}\n\nfunction DrawerRoot(rawProps: DrawerProps): ReactElement {\n const {\n id,\n children,\n } = useHuiProps(\"Drawer\", rawProps);\n\n const tmpId = useId();\n const drawerId = id || tmpId;\n\n const contextValue = useMemo<DrawerContextValue>(() => ({\n drawerId,\n }), [drawerId]);\n\n return (\n <DrawerContext.Provider value={contextValue}>\n {children}\n </DrawerContext.Provider>\n );\n}\n\nexport type DrawerTriggerProps<E extends ElementType = typeof Button> = HuiPolymorphicProps<\n E,\n {},\n ButtonSlots\n>;\n\nfunction Trigger<E extends ElementType = typeof Button>(rawProps: DrawerTriggerProps<E>): ReactNode {\n const {\n as,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"DrawerTrigger\", rawProps);\n\n const Component = as ?? Button;\n const {\n drawerId,\n } = useDrawerContext();\n const attrs = normalizeAttributes(\n dialogControl.getTriggerAttributes(\n { id: drawerId },\n {\n modal: true,\n isButtonElement: as === undefined,\n },\n ),\n );\n\n return (\n <Component\n {...attrs}\n onClick={onClick}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ntype HtmlDialogProps = Omit<ComponentProps<\"dialog\">, \"children\" | \"id\" | \"open\">;\ninterface DrawerContentOwnProps extends HtmlDialogProps {\n /**\n * The edge from which the drawer enters.\n *\n * @default \"inline-end\"\n */\n placement?: DrawerVariants[\"placement\"] | undefined;\n /**\n * The heading rendered at the top of the drawer content.\n */\n heading?: ReactNode | undefined;\n /**\n * Additional props passed to the internal heading component.\n */\n headingProps?: Omit<HeadingProps, \"children\" | \"id\" | \"className\" | \"style\"> | undefined;\n /**\n * The content rendered inside the internal close button. Set to `null` or `false` to hide the button.\n *\n * @default close icon\n */\n closeButton?: ReactNode | undefined;\n /**\n * Additional props passed to the internal close button.\n */\n closeButtonProps?: Omit<DrawerCloseProps, \"children\" | \"className\" | \"style\"> | undefined;\n children?: ReactNode | undefined;\n}\nexport type DrawerContentProps = HuiComponentProps<DrawerContentOwnProps, DrawerSlots>;\n\nfunction Content(rawProps: DrawerContentProps): ReactElement {\n const {\n placement,\n classNames,\n styles,\n children,\n heading,\n headingProps,\n closeButton,\n closeButtonProps,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...restProps\n } = useHuiProps(\"DrawerContent\", rawProps);\n\n const {\n drawerId,\n } = useDrawerContext();\n\n const resolvedHeading = heading !== undefined && heading !== null && heading !== false\n ? heading\n : undefined;\n const state = { id: drawerId };\n const attrs = normalizeAttributes(\n dialogControl.getContentAttributes(\n state,\n {\n hasHeading: resolvedHeading !== undefined,\n ariaLabel,\n ariaLabelledBy,\n },\n ),\n );\n const headingAttrs = normalizeAttributes(dialogControl.getHeadingAttributes(state));\n const headingId = resolvedHeading !== undefined ? headingAttrs.id : undefined;\n const headingLevel = headingProps?.level ?? 2;\n const recipe = drawerRecipe({ placement });\n const cls = useHuiClassNames(\"DrawerContent\", recipe, classNames);\n const sls = useHuiStyles(\"DrawerContent\", styles);\n\n const shouldRenderCloseButton = closeButton !== null && closeButton !== false;\n const shouldRenderHeader = headingId !== undefined || shouldRenderCloseButton;\n const closeButtonContent = closeButton === undefined\n ? <span aria-hidden className={cls.closeButtonIcon} style={sls.closeButtonIcon} />\n : closeButton;\n\n return (\n <dialog\n {...attrs}\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {shouldRenderHeader && (\n <div className={cls.header} style={sls.header}>\n {headingId && (\n <Heading\n margin=\"none\"\n {...headingProps}\n {...headingAttrs}\n className={cls.heading}\n style={sls.heading}\n level={headingLevel}\n >\n {resolvedHeading}\n </Heading>\n )}\n {shouldRenderCloseButton && (\n <Close\n className={cls.closeButton}\n style={sls.closeButton}\n aria-label=\"Close Drawer\"\n variant=\"ghost\"\n color=\"neutral\"\n shape=\"square\"\n {...closeButtonProps}\n >\n {closeButtonContent}\n </Close>\n )}\n </div>\n )}\n {children}\n </dialog>\n );\n}\n\nexport interface DrawerCloseProps extends Omit<ButtonProps, \"as\"> {\n /**\n * The command used to close the drawer.\n *\n * @default \"request-close\"\n */\n command?: \"close\" | \"request-close\" | undefined;\n}\n\nfunction Close(rawProps: DrawerCloseProps): ReactNode {\n const props = useHuiProps(\"DrawerClose\", rawProps);\n const drawerId = useDrawerId();\n const attrs = normalizeAttributes(dialogControl.getCloseAttributes({ id: drawerId }));\n\n return (\n <Button\n {...attrs}\n {...props}\n />\n );\n}\n\nexport const Drawer = Object.assign(DrawerRoot, {\n Trigger,\n Content,\n Close,\n});\n"],"mappings":";;;;;;;;;AAiBA,SAAS,WAAW,UAAqC;CACvD,MAAM,EACJ,IACA,aACE,YAAY,UAAU,QAAQ;CAElC,MAAM,QAAQ,MAAM;CACpB,MAAM,WAAW,MAAM;CAEvB,MAAM,eAAe,eAAmC,EACtD,SACF,IAAI,CAAC,QAAQ,CAAC;CAEd,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;EAC5B;CACqB,CAAA;AAE5B;AAQA,SAAS,QAA+C,UAA4C;CAClG,MAAM,EACJ,IACA,UACA,SACA,GAAG,cACD,YAAY,iBAAiB,QAAQ;CAEzC,MAAM,YAAY,MAAM;CACxB,MAAM,EACJ,aACE,iBAAiB;CACrB,MAAM,QAAQ,oBACZ,cAAc,qBACZ,EAAE,IAAI,SAAS,GACf;EACE,OAAO;EACP,iBAAiB,OAAO,KAAA;CAC1B,CACF,CACF;CAEA,OACE,oBAAC,WAAD;EACE,GAAI;EACK;EACT,GAAI;EAEH;CACQ,CAAA;AAEf;AAgCA,SAAS,QAAQ,UAA4C;CAC3D,MAAM,EACJ,WACA,YACA,QACA,UACA,SACA,cACA,aACA,kBACA,cAAc,WACd,mBAAmB,gBACnB,GAAG,cACD,YAAY,iBAAiB,QAAQ;CAEzC,MAAM,EACJ,aACE,iBAAiB;CAErB,MAAM,kBAAkB,YAAY,KAAA,KAAa,YAAY,QAAQ,YAAY,QAC7E,UACA,KAAA;CACJ,MAAM,QAAQ,EAAE,IAAI,SAAS;CAC7B,MAAM,QAAQ,oBACZ,cAAc,qBACZ,OACA;EACE,YAAY,oBAAoB,KAAA;EAChC;EACA;CACF,CACF,CACF;CACA,MAAM,eAAe,oBAAoB,cAAc,qBAAqB,KAAK,CAAC;CAClF,MAAM,YAAY,oBAAoB,KAAA,IAAY,aAAa,KAAK,KAAA;CACpE,MAAM,eAAe,cAAc,SAAS;CAC5C,MAAM,SAAS,aAAa,EAAE,UAAU,CAAC;CACzC,MAAM,MAAM,iBAAiB,iBAAiB,QAAQ,UAAU;CAChE,MAAM,MAAM,aAAa,iBAAiB,MAAM;CAEhD,MAAM,0BAA0B,gBAAgB,QAAQ,gBAAgB;CACxE,MAAM,qBAAqB,cAAc,KAAA,KAAa;CACtD,MAAM,qBAAqB,gBAAgB,KAAA,IACvC,oBAAC,QAAD;EAAM,eAAA;EAAY,WAAW,IAAI;EAAiB,OAAO,IAAI;CAAkB,CAAA,IAC/E;CAEJ,OACE,qBAAC,UAAD;EACE,GAAI;EACJ,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAJN,UAAA,CAMG,sBACC,qBAAC,OAAD;GAAK,WAAW,IAAI;GAAQ,OAAO,IAAI;GAAvC,UAAA,CACG,aACC,oBAAC,SAAD;IACE,QAAO;IACP,GAAI;IACJ,GAAI;IACJ,WAAW,IAAI;IACf,OAAO,IAAI;IACX,OAAO;IAEN,UAAA;GACM,CAAA,GAEV,2BACC,oBAAC,OAAD;IACE,WAAW,IAAI;IACf,OAAO,IAAI;IACX,cAAW;IACX,SAAQ;IACR,OAAM;IACN,OAAM;IACN,GAAI;IAEH,UAAA;GACI,CAAA,CAEN;EAEN,CAAA,GAAA,QACK;;AAEZ;AAWA,SAAS,MAAM,UAAuC;CACpD,MAAM,QAAQ,YAAY,eAAe,QAAQ;CACjD,MAAM,WAAW,YAAY;CAC7B,MAAM,QAAQ,oBAAoB,cAAc,mBAAmB,EAAE,IAAI,SAAS,CAAC,CAAC;CAEpF,OACE,oBAAC,QAAD;EACE,GAAI;EACJ,GAAI;CACL,CAAA;AAEL;AAEA,MAAa,SAAS,OAAO,OAAO,YAAY;CAC9C;CACA;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HuiComponentProps } from "../../types/hui-component.js";
|
|
2
|
+
import "../../types/index.js";
|
|
3
|
+
import { FieldsetSlots } from "@hebium-ui/core";
|
|
4
|
+
import { ComponentProps, ReactElement } from "react";
|
|
5
|
+
//#region src/components/fieldset/fieldset.d.ts
|
|
6
|
+
export type FieldsetProps = HuiComponentProps<ComponentProps<"fieldset">, FieldsetSlots>;
|
|
7
|
+
export declare function Fieldset(rawProps: FieldsetProps): ReactElement;
|
|
8
|
+
//#endregion
|
|
9
|
+
//# sourceMappingURL=fieldset.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { fieldsetRecipe } from "@hebium-ui/core";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/fieldset/fieldset.tsx
|
|
5
|
+
function Fieldset(rawProps) {
|
|
6
|
+
const { className, style, children, ...restProps } = useHuiProps("Fieldset", rawProps);
|
|
7
|
+
const recipe = fieldsetRecipe({});
|
|
8
|
+
const cls = useHuiClassNames("Fieldset", recipe, { root: className });
|
|
9
|
+
const sls = useHuiStyles("Fieldset", { root: style });
|
|
10
|
+
return /* @__PURE__ */ jsx("fieldset", {
|
|
11
|
+
className: cls.root,
|
|
12
|
+
style: sls.root,
|
|
13
|
+
...restProps,
|
|
14
|
+
children
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Fieldset };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=fieldset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldset.js","names":[],"sources":["../../../src/components/fieldset/fieldset.tsx"],"sourcesContent":["import { fieldsetRecipe, type FieldsetSlots } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport type FieldsetProps = HuiComponentProps<\n ComponentProps<\"fieldset\">,\n FieldsetSlots\n>;\n\nexport function Fieldset(rawProps: FieldsetProps): ReactElement {\n const {\n className,\n style,\n children,\n ...restProps\n } = useHuiProps(\"Fieldset\", rawProps);\n\n const recipe = fieldsetRecipe({});\n const cls = useHuiClassNames(\"Fieldset\", recipe, { root: className });\n const sls = useHuiStyles(\"Fieldset\", { root: style });\n\n return (\n <fieldset\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </fieldset>\n );\n}\n"],"mappings":";;;;AAUA,SAAgB,SAAS,UAAuC;CAC9D,MAAM,EACJ,WACA,OACA,UACA,GAAG,cACD,YAAY,YAAY,QAAQ;CAEpC,MAAM,SAAS,eAAe,CAAC,CAAC;CAChC,MAAM,MAAM,iBAAiB,YAAY,QAAQ,EAAE,MAAM,UAAU,CAAC;CACpE,MAAM,MAAM,aAAa,YAAY,EAAE,MAAM,MAAM,CAAC;CAEpD,OACE,oBAAC,YAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACO,CAAA;AAEd"}
|