@hebium-ui/preact 0.1.0-alpha.1 → 0.1.0-alpha.3

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.
Files changed (73) hide show
  1. package/dist/components/alert/alert.d.ts +0 -2
  2. package/dist/components/alert/alert.js +5 -6
  3. package/dist/components/alert/alert.js.map +1 -1
  4. package/dist/components/anchor/anchor.d.ts +0 -2
  5. package/dist/components/anchor/anchor.js +5 -6
  6. package/dist/components/anchor/anchor.js.map +1 -1
  7. package/dist/components/avatar/avatar.d.ts +6 -4
  8. package/dist/components/avatar/avatar.js +16 -19
  9. package/dist/components/avatar/avatar.js.map +1 -1
  10. package/dist/components/blockquote/blockquote.d.ts +1 -3
  11. package/dist/components/blockquote/blockquote.js +5 -6
  12. package/dist/components/blockquote/blockquote.js.map +1 -1
  13. package/dist/components/button/button.d.ts +0 -2
  14. package/dist/components/button/button.js +5 -6
  15. package/dist/components/button/button.js.map +1 -1
  16. package/dist/components/checkbox/checkbox.d.ts +32 -0
  17. package/dist/components/checkbox/checkbox.js +84 -0
  18. package/dist/components/checkbox/checkbox.js.map +1 -0
  19. package/dist/components/checkbox/index.d.ts +2 -0
  20. package/dist/components/code/code.d.ts +9 -0
  21. package/dist/components/code/code.js +20 -0
  22. package/dist/components/code/code.js.map +1 -0
  23. package/dist/components/code/index.d.ts +2 -0
  24. package/dist/components/details/details.d.ts +20 -0
  25. package/dist/components/details/details.js +27 -0
  26. package/dist/components/details/details.js.map +1 -0
  27. package/dist/components/details/index.d.ts +2 -0
  28. package/dist/components/dialog/dialog.context.d.ts +2 -0
  29. package/dist/components/dialog/dialog.context.js +15 -0
  30. package/dist/components/dialog/dialog.context.js.map +1 -0
  31. package/dist/components/dialog/dialog.d.ts +65 -0
  32. package/dist/components/dialog/dialog.js +131 -0
  33. package/dist/components/dialog/dialog.js.map +1 -0
  34. package/dist/components/dialog/index.d.ts +3 -0
  35. package/dist/components/dl/dl.d.ts +16 -0
  36. package/dist/components/dl/dl.js +47 -0
  37. package/dist/components/dl/dl.js.map +1 -0
  38. package/dist/components/dl/index.d.ts +2 -0
  39. package/dist/components/drawer/drawer.context.d.ts +2 -0
  40. package/dist/components/drawer/drawer.context.js +15 -0
  41. package/dist/components/drawer/drawer.context.js.map +1 -0
  42. package/dist/components/drawer/drawer.d.ts +65 -0
  43. package/dist/components/drawer/drawer.js +111 -0
  44. package/dist/components/drawer/drawer.js.map +1 -0
  45. package/dist/components/drawer/index.d.ts +3 -0
  46. package/dist/components/heading/heading.d.ts +22 -0
  47. package/dist/components/heading/heading.js +23 -0
  48. package/dist/components/heading/heading.js.map +1 -0
  49. package/dist/components/heading/index.d.ts +2 -0
  50. package/dist/components/index.d.ts +17 -1
  51. package/dist/components/progress/progress.d.ts +0 -2
  52. package/dist/components/progress/progress.js +5 -6
  53. package/dist/components/progress/progress.js.map +1 -1
  54. package/dist/components/tabs/tabs.context.d.ts +0 -2
  55. package/dist/components/tabs/tabs.context.js +1 -2
  56. package/dist/components/tabs/tabs.d.ts +1 -3
  57. package/dist/components/tabs/tabs.js +18 -18
  58. package/dist/components/tabs/tabs.js.map +1 -1
  59. package/dist/index.d.ts +11 -2
  60. package/dist/index.js +11 -2
  61. package/dist/provider/hui-provider.context.d.ts +35 -6
  62. package/dist/provider/hui-provider.context.js +25 -16
  63. package/dist/provider/hui-provider.context.js.map +1 -1
  64. package/dist/provider/hui-provider.d.ts +0 -2
  65. package/dist/provider/hui-provider.js +1 -2
  66. package/dist/provider/index.d.ts +2 -2
  67. package/dist/provider/merge-props.js +1 -2
  68. package/dist/types/hui-component.d.ts +13 -7
  69. package/dist/types/index.d.ts +2 -2
  70. package/dist/types/polymorphic.d.ts +4 -10
  71. package/dist/utils/unwrap-signalish.js +10 -0
  72. package/dist/utils/unwrap-signalish.js.map +1 -0
  73. package/package.json +9 -8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.context.js","names":[],"sources":["../../../src/components/dialog/dialog.context.ts"],"sourcesContent":["import { createContext } from \"preact\";\nimport { useContext } from \"preact/hooks\";\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":";;;AASA,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,65 @@
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 { ComponentChildren, ComponentProps, JSX, VNode } from "preact";
10
+ export interface DialogProps {
11
+ /**
12
+ * The id of the dialog content element.
13
+ */
14
+ id?: string | undefined;
15
+ /**
16
+ * Whether the dialog should open as a modal dialog.
17
+ *
18
+ * @default false
19
+ */
20
+ modal?: boolean | undefined;
21
+ children?: ComponentChildren | undefined;
22
+ }
23
+ declare function DialogRoot(rawProps: DialogProps): VNode;
24
+ interface DialogTriggerOwnProps {}
25
+ export type DialogTriggerProps<E extends JSX.ElementType = typeof Button> = HuiPolymorphicProps<E, DialogTriggerOwnProps, ButtonSlots>;
26
+ declare function Trigger<E extends JSX.ElementType = typeof Button>(rawProps: DialogTriggerProps<E>): VNode;
27
+ interface DialogContentOwnProps {
28
+ /**
29
+ * The heading rendered at the top of the dialog content.
30
+ */
31
+ heading?: ComponentChildren | undefined;
32
+ /**
33
+ * Additional props passed to the internal heading component.
34
+ */
35
+ headingProps?: Omit<HeadingProps, "children" | "id" | "class" | "className" | "style"> | undefined;
36
+ /**
37
+ * The content rendered inside the internal close button. Set to `null` or `false` to hide the button.
38
+ *
39
+ * @default close icon
40
+ */
41
+ closeButton?: ComponentChildren | undefined;
42
+ /**
43
+ * Additional props passed to the internal close button.
44
+ */
45
+ closeButtonProps?: Omit<DialogCloseProps, "children" | "class" | "className" | "style"> | undefined;
46
+ }
47
+ export type DialogContentProps = HuiComponentProps<Omit<ComponentProps<"dialog">, "id" | "open"> & DialogContentOwnProps, DialogSlots>;
48
+ declare function Content(rawProps: DialogContentProps): VNode;
49
+ interface DialogCloseOwnProps {
50
+ /**
51
+ * The command used to close the dialog.
52
+ *
53
+ * @default "request-close"
54
+ */
55
+ command?: "close" | "request-close" | undefined;
56
+ }
57
+ export type DialogCloseProps = Omit<ButtonProps, "as" | keyof DialogCloseOwnProps> & DialogCloseOwnProps;
58
+ declare function Close(rawProps: DialogCloseProps): VNode;
59
+ export declare const Dialog: typeof DialogRoot & {
60
+ Trigger: typeof Trigger;
61
+ Content: typeof Content;
62
+ Close: typeof Close;
63
+ };
64
+ export {};
65
+ //# sourceMappingURL=dialog.d.ts.map
@@ -0,0 +1,131 @@
1
+ import { unwrapSignalish } from "../../utils/unwrap-signalish.js";
2
+ import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
3
+ import { Button } from "../button/button.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 "preact/hooks";
8
+ import { jsx, jsxs } from "preact/jsx-runtime";
9
+ // 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 cls = useHuiClasses("DialogTrigger", { root: "" }, rawProps);
35
+ const sls = useHuiStyles("DialogTrigger", { root: rawProps.style });
36
+ const { dialogId, modal, open } = useDialogContext();
37
+ const attrs = dialogControl.getTriggerAttributes({ id: dialogId }, {
38
+ modal,
39
+ isButtonElement: as === void 0
40
+ });
41
+ const handleClick = useCallback((e) => {
42
+ onClick?.(e);
43
+ if (modal || e.defaultPrevented) return;
44
+ open();
45
+ }, [
46
+ modal,
47
+ onClick,
48
+ open
49
+ ]);
50
+ return /* @__PURE__ */ jsx(Component, {
51
+ ...attrs,
52
+ className: cls.root,
53
+ style: sls.root,
54
+ onClick: handleClick,
55
+ ...restProps,
56
+ children
57
+ });
58
+ }
59
+ function Content(rawProps) {
60
+ const { children, heading, headingProps, closeButton, closeButtonProps, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...restProps } = useHuiProps("DialogContent", rawProps);
61
+ const { dialogId, modal } = useDialogContext();
62
+ const resolvedHeading = heading !== void 0 && heading !== null && heading !== false ? heading : void 0;
63
+ const state = { id: dialogId };
64
+ const attrs = dialogControl.getContentAttributes(state, {
65
+ hasHeading: resolvedHeading !== void 0,
66
+ ariaLabel: unwrapSignalish(ariaLabel),
67
+ ariaLabelledBy: unwrapSignalish(ariaLabelledBy)
68
+ });
69
+ const headingAttrs = dialogControl.getHeadingAttributes(state);
70
+ const headingId = resolvedHeading !== void 0 ? headingAttrs.id : void 0;
71
+ const headingLevel = headingProps?.level ?? 2;
72
+ const recipe = dialogRecipe({ modal: toStrbool(modal) });
73
+ const cls = useHuiClasses("DialogContent", recipe, rawProps);
74
+ const sls = useHuiStyles("DialogContent", rawProps.styles);
75
+ const shouldRenderCloseButton = closeButton !== null && closeButton !== false;
76
+ const shouldRenderHeader = headingId !== void 0 || shouldRenderCloseButton;
77
+ const closeButtonContent = closeButton === void 0 ? /* @__PURE__ */ jsx("span", {
78
+ "aria-hidden": true,
79
+ className: cls.closeButtonIcon,
80
+ style: sls.closeButtonIcon
81
+ }) : closeButton;
82
+ return /* @__PURE__ */ jsxs("dialog", {
83
+ ...attrs,
84
+ className: cls.root,
85
+ style: sls.root,
86
+ ...restProps,
87
+ children: [shouldRenderHeader && /* @__PURE__ */ jsxs("div", {
88
+ className: cls.header,
89
+ style: sls.header,
90
+ children: [headingId && /* @__PURE__ */ jsx(Heading, {
91
+ margin: "none",
92
+ ...headingProps,
93
+ ...headingAttrs,
94
+ className: cls.heading,
95
+ style: sls.heading,
96
+ level: headingLevel,
97
+ children: resolvedHeading
98
+ }), shouldRenderCloseButton && /* @__PURE__ */ jsx(Close, {
99
+ className: cls.closeButton,
100
+ style: sls.closeButton,
101
+ "aria-label": "Close Dialog",
102
+ variant: "ghost",
103
+ color: "neutral",
104
+ shape: "square",
105
+ ...closeButtonProps,
106
+ children: closeButtonContent
107
+ })]
108
+ }), children]
109
+ });
110
+ }
111
+ function Close(rawProps) {
112
+ const props = useHuiProps("DialogClose", rawProps);
113
+ const cls = useHuiClasses("DialogClose", { root: "" }, rawProps);
114
+ const sls = useHuiStyles("DialogClose", { root: rawProps.style });
115
+ const dialogId = useDialogId();
116
+ const attrs = dialogControl.getCloseAttributes({ id: dialogId });
117
+ return /* @__PURE__ */ jsx(Button, {
118
+ ...attrs,
119
+ ...props,
120
+ className: cls.root,
121
+ style: sls.root
122
+ });
123
+ }
124
+ const Dialog = Object.assign(DialogRoot, {
125
+ Trigger,
126
+ Content,
127
+ Close
128
+ });
129
+ export { Dialog };
130
+
131
+ //# 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 { type ComponentChildren, type ComponentProps, type JSX, type TargetedMouseEvent, type VNode } from \"preact\";\nimport { useCallback, useId, useMemo } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { unwrapSignalish } 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?: ComponentChildren | undefined;\n}\n\nfunction DialogRoot(rawProps: DialogProps): VNode {\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\ninterface DialogTriggerOwnProps {}\nexport type DialogTriggerProps<E extends JSX.ElementType = typeof Button> = HuiPolymorphicProps<\n E,\n DialogTriggerOwnProps,\n ButtonSlots\n>;\n\nfunction Trigger<E extends JSX.ElementType = typeof Button>(rawProps: DialogTriggerProps<E>): VNode {\n const {\n as,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"DialogTrigger\", rawProps);\n\n const Component = as ?? Button;\n const cls = useHuiClasses(\"DialogTrigger\", { root: \"\" }, rawProps);\n const sls = useHuiStyles(\"DialogTrigger\", { root: rawProps.style });\n const {\n dialogId,\n modal,\n open,\n } = useDialogContext();\n const attrs = dialogControl.getTriggerAttributes(\n { id: dialogId },\n {\n modal,\n isButtonElement: as === undefined,\n },\n );\n\n const handleClick = useCallback((e: TargetedMouseEvent<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 className={cls.root}\n style={sls.root}\n onClick={handleClick}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ninterface DialogContentOwnProps {\n /**\n * The heading rendered at the top of the dialog content.\n */\n heading?: ComponentChildren | undefined;\n /**\n * Additional props passed to the internal heading component.\n */\n headingProps?: Omit<HeadingProps, \"children\" | \"id\" | \"class\" | \"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?: ComponentChildren | undefined;\n /**\n * Additional props passed to the internal close button.\n */\n closeButtonProps?: Omit<DialogCloseProps, \"children\" | \"class\" | \"className\" | \"style\"> | undefined;\n}\nexport type DialogContentProps = HuiComponentProps<\n Omit<ComponentProps<\"dialog\">, \"id\" | \"open\"> & DialogContentOwnProps,\n DialogSlots\n>;\n\nfunction Content(rawProps: DialogContentProps): VNode {\n const {\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 = dialogControl.getContentAttributes(\n state,\n {\n hasHeading: resolvedHeading !== undefined,\n ariaLabel: unwrapSignalish(ariaLabel),\n ariaLabelledBy: unwrapSignalish(ariaLabelledBy),\n },\n );\n const headingAttrs = 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 = useHuiClasses(\"DialogContent\", recipe, rawProps);\n const sls = useHuiStyles(\"DialogContent\", rawProps.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\ninterface DialogCloseOwnProps {\n /**\n * The command used to close the dialog.\n *\n * @default \"request-close\"\n */\n command?: \"close\" | \"request-close\" | undefined;\n}\nexport type DialogCloseProps = Omit<ButtonProps, \"as\" | keyof DialogCloseOwnProps> & DialogCloseOwnProps;\n\nfunction Close(rawProps: DialogCloseProps): VNode {\n const props = useHuiProps(\"DialogClose\", rawProps);\n const cls = useHuiClasses(\"DialogClose\", { root: \"\" }, rawProps);\n const sls = useHuiStyles(\"DialogClose\", { root: rawProps.style });\n const dialogId = useDialogId();\n const attrs = dialogControl.getCloseAttributes({ id: dialogId });\n\n return (\n <Button\n {...attrs}\n {...props}\n className={cls.root}\n style={sls.root}\n />\n );\n}\n\nexport const Dialog = Object.assign(DialogRoot, {\n Trigger,\n Content,\n Close,\n});\n"],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ import { Dialog, DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps } from "./dialog.js";
2
+ import { useDialogId } from "./dialog.context.js";
3
+ export { Dialog, DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps, useDialogId };
@@ -0,0 +1,16 @@
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, VNode } from "preact";
5
+ export type DlProps = HuiComponentProps<ComponentProps<"dl">, DlSlots>;
6
+ declare function DlRoot(rawProps: DlProps): VNode;
7
+ export type DtProps = HuiComponentProps<ComponentProps<"dt">, DtSlots>;
8
+ declare function Dt(rawProps: DtProps): VNode;
9
+ export type DdProps = HuiComponentProps<ComponentProps<"dd">, DdSlots>;
10
+ declare function Dd(rawProps: DdProps): VNode;
11
+ export declare const Dl: typeof DlRoot & {
12
+ Dt: typeof Dt;
13
+ Dd: typeof Dd;
14
+ };
15
+ export {};
16
+ //# sourceMappingURL=dl.d.ts.map
@@ -0,0 +1,47 @@
1
+ import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
+ import { ddRecipe, dlRecipe, dtRecipe } from "@hebium-ui/core";
3
+ import { jsx } from "preact/jsx-runtime";
4
+ // src/components/dl/dl.tsx
5
+ function DlRoot(rawProps) {
6
+ const { children, ...restProps } = useHuiProps("Dl", rawProps);
7
+ const recipe = dlRecipe({});
8
+ const cls = useHuiClasses("Dl", recipe, rawProps);
9
+ const sls = useHuiStyles("Dl", { root: rawProps.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 { children, ...restProps } = useHuiProps("DlDt", rawProps);
19
+ const recipe = dtRecipe({});
20
+ const cls = useHuiClasses("DlDt", recipe, rawProps);
21
+ const sls = useHuiStyles("DlDt", { root: rawProps.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 { children, ...restProps } = useHuiProps("DlDd", rawProps);
31
+ const recipe = ddRecipe({});
32
+ const cls = useHuiClasses("DlDd", recipe, rawProps);
33
+ const sls = useHuiStyles("DlDd", { root: rawProps.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
+ export { Dl };
46
+
47
+ //# 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 VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport type DlProps = HuiComponentProps<ComponentProps<\"dl\">, DlSlots>;\n\nfunction DlRoot(rawProps: DlProps): VNode {\n const { children, ...restProps } = useHuiProps(\"Dl\", rawProps);\n\n const recipe = dlRecipe({});\n const cls = useHuiClasses(\"Dl\", recipe, rawProps);\n const sls = useHuiStyles(\"Dl\", { root: rawProps.style });\n return (\n <dl\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </dl>\n );\n}\n\nexport type DtProps = HuiComponentProps<ComponentProps<\"dt\">, DtSlots>;\n\nfunction Dt(rawProps: DtProps): VNode {\n const { children, ...restProps } = useHuiProps(\"DlDt\", rawProps);\n\n const recipe = dtRecipe({});\n const cls = useHuiClasses(\"DlDt\", recipe, rawProps);\n const sls = useHuiStyles(\"DlDt\", { root: rawProps.style });\n return (\n <dt\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </dt>\n );\n}\n\nexport type DdProps = HuiComponentProps<ComponentProps<\"dd\">, DdSlots>;\n\nfunction Dd(rawProps: DdProps): VNode {\n const { children, ...restProps } = useHuiProps(\"DlDd\", rawProps);\n\n const recipe = ddRecipe({});\n const cls = useHuiClasses(\"DlDd\", recipe, rawProps);\n const sls = useHuiStyles(\"DlDd\", { root: rawProps.style });\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,UAA0B;CACxC,MAAM,EAAE,UAAU,GAAG,cAAc,YAAY,MAAM,QAAQ;CAE7D,MAAM,SAAS,SAAS,CAAC,CAAC;CAC1B,MAAM,MAAM,cAAc,MAAM,QAAQ,QAAQ;CAChD,MAAM,MAAM,aAAa,MAAM,EAAE,MAAM,SAAS,MAAM,CAAC;CACvD,OACE,oBAAC,MAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACC,CAAA;AAER;AAIA,SAAS,GAAG,UAA0B;CACpC,MAAM,EAAE,UAAU,GAAG,cAAc,YAAY,QAAQ,QAAQ;CAE/D,MAAM,SAAS,SAAS,CAAC,CAAC;CAC1B,MAAM,MAAM,cAAc,QAAQ,QAAQ,QAAQ;CAClD,MAAM,MAAM,aAAa,QAAQ,EAAE,MAAM,SAAS,MAAM,CAAC;CACzD,OACE,oBAAC,MAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACC,CAAA;AAER;AAIA,SAAS,GAAG,UAA0B;CACpC,MAAM,EAAE,UAAU,GAAG,cAAc,YAAY,QAAQ,QAAQ;CAE/D,MAAM,SAAS,SAAS,CAAC,CAAC;CAC1B,MAAM,MAAM,cAAc,QAAQ,QAAQ,QAAQ;CAClD,MAAM,MAAM,aAAa,QAAQ,EAAE,MAAM,SAAS,MAAM,CAAC;CACzD,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,2 @@
1
+ import { DdProps, Dl, DlProps, DtProps } from "./dl.js";
2
+ export { DdProps, Dl, DlProps, DtProps };
@@ -0,0 +1,2 @@
1
+ export declare function useDrawerId(): string;
2
+ //# sourceMappingURL=drawer.context.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { useContext } from "preact/hooks";
2
+ import { createContext } from "preact";
3
+ // src/components/drawer/drawer.context.ts
4
+ const DrawerContext = createContext(null);
5
+ function useDrawerContext() {
6
+ const context = useContext(DrawerContext);
7
+ if (!context) throw new Error("[Hebium UI] Drawer compound components must be used within <Drawer>");
8
+ return context;
9
+ }
10
+ function useDrawerId() {
11
+ return useDrawerContext().drawerId;
12
+ }
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 } from \"preact\";\nimport { useContext } from \"preact/hooks\";\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":";;;AAOA,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,65 @@
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 { ComponentChildren, ComponentProps, JSX, VNode } from "preact";
10
+ export interface DrawerProps {
11
+ /**
12
+ * The id of the drawer content element.
13
+ */
14
+ id?: string | undefined;
15
+ children?: ComponentChildren | undefined;
16
+ }
17
+ declare function DrawerRoot(rawProps: DrawerProps): VNode;
18
+ interface DrawerTriggerOwnProps {}
19
+ export type DrawerTriggerProps<E extends JSX.ElementType = typeof Button> = HuiPolymorphicProps<E, DrawerTriggerOwnProps, ButtonSlots>;
20
+ declare function Trigger<E extends JSX.ElementType = typeof Button>(rawProps: DrawerTriggerProps<E>): VNode;
21
+ interface DrawerContentOwnProps {
22
+ /**
23
+ * The edge from which the drawer enters.
24
+ *
25
+ * @default "inline-end"
26
+ */
27
+ placement?: DrawerVariants["placement"] | undefined;
28
+ /**
29
+ * The heading rendered at the top of the drawer content.
30
+ */
31
+ heading?: ComponentChildren | undefined;
32
+ /**
33
+ * Additional props passed to the internal heading component.
34
+ */
35
+ headingProps?: Omit<HeadingProps, "children" | "id" | "class" | "className" | "style"> | undefined;
36
+ /**
37
+ * The content rendered inside the internal close button. Set to `null` or `false` to hide the button.
38
+ *
39
+ * @default close icon
40
+ */
41
+ closeButton?: ComponentChildren | undefined;
42
+ /**
43
+ * Additional props passed to the internal close button.
44
+ */
45
+ closeButtonProps?: Omit<DrawerCloseProps, "children" | "class" | "className" | "style"> | undefined;
46
+ }
47
+ export type DrawerContentProps = HuiComponentProps<Omit<ComponentProps<"dialog">, "id" | "open"> & DrawerContentOwnProps, DrawerSlots>;
48
+ declare function Content(rawProps: DrawerContentProps): VNode;
49
+ interface DrawerCloseOwnProps {
50
+ /**
51
+ * The command used to close the drawer.
52
+ *
53
+ * @default "request-close"
54
+ */
55
+ command?: "close" | "request-close" | undefined;
56
+ }
57
+ export type DrawerCloseProps = Omit<ButtonProps, "as" | keyof DrawerCloseOwnProps> & DrawerCloseOwnProps;
58
+ declare function Close(rawProps: DrawerCloseProps): VNode;
59
+ export declare const Drawer: typeof DrawerRoot & {
60
+ Trigger: typeof Trigger;
61
+ Content: typeof Content;
62
+ Close: typeof Close;
63
+ };
64
+ export {};
65
+ //# sourceMappingURL=drawer.d.ts.map
@@ -0,0 +1,111 @@
1
+ import { unwrapSignalish } from "../../utils/unwrap-signalish.js";
2
+ import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
3
+ import { Button } from "../button/button.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 "preact/hooks";
8
+ import { jsx, jsxs } from "preact/jsx-runtime";
9
+ // 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 cls = useHuiClasses("DrawerTrigger", { root: "" }, rawProps);
24
+ const sls = useHuiStyles("DrawerTrigger", { root: rawProps.style });
25
+ const { drawerId } = useDrawerContext();
26
+ const attrs = dialogControl.getTriggerAttributes({ id: drawerId }, {
27
+ modal: true,
28
+ isButtonElement: as === void 0
29
+ });
30
+ return /* @__PURE__ */ jsx(Component, {
31
+ ...attrs,
32
+ className: cls.root,
33
+ style: sls.root,
34
+ onClick,
35
+ ...restProps,
36
+ children
37
+ });
38
+ }
39
+ function Content(rawProps) {
40
+ const { placement, children, heading, headingProps, closeButton, closeButtonProps, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...restProps } = useHuiProps("DrawerContent", rawProps);
41
+ const { drawerId } = useDrawerContext();
42
+ const resolvedHeading = heading !== void 0 && heading !== null && heading !== false ? heading : void 0;
43
+ const state = { id: drawerId };
44
+ const attrs = dialogControl.getContentAttributes(state, {
45
+ hasHeading: resolvedHeading !== void 0,
46
+ ariaLabel: unwrapSignalish(ariaLabel),
47
+ ariaLabelledBy: unwrapSignalish(ariaLabelledBy)
48
+ });
49
+ const headingAttrs = dialogControl.getHeadingAttributes(state);
50
+ const headingId = resolvedHeading !== void 0 ? headingAttrs.id : void 0;
51
+ const headingLevel = headingProps?.level ?? 2;
52
+ const recipe = drawerRecipe({ placement });
53
+ const cls = useHuiClasses("DrawerContent", recipe, rawProps);
54
+ const sls = useHuiStyles("DrawerContent", rawProps.styles);
55
+ const shouldRenderCloseButton = closeButton !== null && closeButton !== false;
56
+ const shouldRenderHeader = headingId !== void 0 || shouldRenderCloseButton;
57
+ const closeButtonContent = closeButton === void 0 ? /* @__PURE__ */ jsx("span", {
58
+ "aria-hidden": true,
59
+ className: cls.closeButtonIcon,
60
+ style: sls.closeButtonIcon
61
+ }) : closeButton;
62
+ return /* @__PURE__ */ jsxs("dialog", {
63
+ ...attrs,
64
+ className: cls.root,
65
+ style: sls.root,
66
+ ...restProps,
67
+ children: [shouldRenderHeader && /* @__PURE__ */ jsxs("div", {
68
+ className: cls.header,
69
+ style: sls.header,
70
+ children: [headingId && /* @__PURE__ */ jsx(Heading, {
71
+ margin: "none",
72
+ ...headingProps,
73
+ ...headingAttrs,
74
+ className: cls.heading,
75
+ style: sls.heading,
76
+ level: headingLevel,
77
+ children: resolvedHeading
78
+ }), shouldRenderCloseButton && /* @__PURE__ */ jsx(Close, {
79
+ className: cls.closeButton,
80
+ style: sls.closeButton,
81
+ "aria-label": "Close Drawer",
82
+ variant: "ghost",
83
+ color: "neutral",
84
+ shape: "square",
85
+ ...closeButtonProps,
86
+ children: closeButtonContent
87
+ })]
88
+ }), children]
89
+ });
90
+ }
91
+ function Close(rawProps) {
92
+ const props = useHuiProps("DrawerClose", rawProps);
93
+ const cls = useHuiClasses("DrawerClose", { root: "" }, rawProps);
94
+ const sls = useHuiStyles("DrawerClose", { root: rawProps.style });
95
+ const drawerId = useDrawerId();
96
+ const attrs = dialogControl.getCloseAttributes({ id: drawerId });
97
+ return /* @__PURE__ */ jsx(Button, {
98
+ ...attrs,
99
+ ...props,
100
+ className: cls.root,
101
+ style: sls.root
102
+ });
103
+ }
104
+ const Drawer = Object.assign(DrawerRoot, {
105
+ Trigger,
106
+ Content,
107
+ Close
108
+ });
109
+ export { Drawer };
110
+
111
+ //# 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 ComponentChildren, type ComponentProps, type JSX, type VNode } from \"preact\";\nimport { useId, useMemo } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { unwrapSignalish } 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?: ComponentChildren | undefined;\n}\n\nfunction DrawerRoot(rawProps: DrawerProps): VNode {\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\ninterface DrawerTriggerOwnProps {}\nexport type DrawerTriggerProps<E extends JSX.ElementType = typeof Button> = HuiPolymorphicProps<\n E,\n DrawerTriggerOwnProps,\n ButtonSlots\n>;\n\nfunction Trigger<E extends JSX.ElementType = typeof Button>(rawProps: DrawerTriggerProps<E>): VNode {\n const {\n as,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"DrawerTrigger\", rawProps);\n\n const Component = as ?? Button;\n const cls = useHuiClasses(\"DrawerTrigger\", { root: \"\" }, rawProps);\n const sls = useHuiStyles(\"DrawerTrigger\", { root: rawProps.style });\n const {\n drawerId,\n } = useDrawerContext();\n const attrs = dialogControl.getTriggerAttributes(\n { id: drawerId },\n {\n modal: true,\n isButtonElement: as === undefined,\n },\n );\n\n return (\n <Component\n {...attrs}\n className={cls.root}\n style={sls.root}\n onClick={onClick}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ninterface DrawerContentOwnProps {\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?: ComponentChildren | undefined;\n /**\n * Additional props passed to the internal heading component.\n */\n headingProps?: Omit<HeadingProps, \"children\" | \"id\" | \"class\" | \"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?: ComponentChildren | undefined;\n /**\n * Additional props passed to the internal close button.\n */\n closeButtonProps?: Omit<DrawerCloseProps, \"children\" | \"class\" | \"className\" | \"style\"> | undefined;\n}\nexport type DrawerContentProps = HuiComponentProps<\n Omit<ComponentProps<\"dialog\">, \"id\" | \"open\"> & DrawerContentOwnProps,\n DrawerSlots\n>;\n\nfunction Content(rawProps: DrawerContentProps): VNode {\n const {\n placement,\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 = dialogControl.getContentAttributes(\n state,\n {\n hasHeading: resolvedHeading !== undefined,\n ariaLabel: unwrapSignalish(ariaLabel),\n ariaLabelledBy: unwrapSignalish(ariaLabelledBy),\n },\n );\n const headingAttrs = 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 = useHuiClasses(\"DrawerContent\", recipe, rawProps);\n const sls = useHuiStyles(\"DrawerContent\", rawProps.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\ninterface DrawerCloseOwnProps {\n /**\n * The command used to close the drawer.\n *\n * @default \"request-close\"\n */\n command?: \"close\" | \"request-close\" | undefined;\n}\nexport type DrawerCloseProps = Omit<ButtonProps, \"as\" | keyof DrawerCloseOwnProps> & DrawerCloseOwnProps;\n\nfunction Close(rawProps: DrawerCloseProps): VNode {\n const props = useHuiProps(\"DrawerClose\", rawProps);\n const cls = useHuiClasses(\"DrawerClose\", { root: \"\" }, rawProps);\n const sls = useHuiStyles(\"DrawerClose\", { root: rawProps.style });\n const drawerId = useDrawerId();\n const attrs = dialogControl.getCloseAttributes({ id: drawerId });\n\n return (\n <Button\n {...attrs}\n {...props}\n className={cls.root}\n style={sls.root}\n />\n );\n}\n\nexport const Drawer = Object.assign(DrawerRoot, {\n Trigger,\n Content,\n Close,\n});\n"],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ import { Drawer, DrawerCloseProps, DrawerContentProps, DrawerProps, DrawerTriggerProps } from "./drawer.js";
2
+ import { useDrawerId } from "./drawer.context.js";
3
+ export { Drawer, DrawerCloseProps, DrawerContentProps, DrawerProps, DrawerTriggerProps, useDrawerId };
@@ -0,0 +1,22 @@
1
+ import { HuiComponentProps } from "../../types/hui-component.js";
2
+ import "../../types/index.js";
3
+ import { HeadingSlots, HeadingVariants } from "@hebium-ui/core";
4
+ import { ComponentProps, VNode } from "preact";
5
+ interface HeadingOwnProps {
6
+ /**
7
+ * The heading level used to choose the rendered heading element.
8
+ *
9
+ * @default 2
10
+ */
11
+ level?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
12
+ /**
13
+ * The block margin applied to the heading.
14
+ *
15
+ * @default "none"
16
+ */
17
+ margin?: HeadingVariants["margin"] | undefined;
18
+ }
19
+ export type HeadingProps = HuiComponentProps<ComponentProps<"h2"> & HeadingOwnProps, HeadingSlots>;
20
+ export declare function Heading(rawProps: HeadingProps): VNode;
21
+ export {};
22
+ //# sourceMappingURL=heading.d.ts.map
@@ -0,0 +1,23 @@
1
+ import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
+ import { headingRecipe } from "@hebium-ui/core";
3
+ import { jsx } from "preact/jsx-runtime";
4
+ // src/components/heading/heading.tsx
5
+ function Heading(rawProps) {
6
+ const { level = 2, margin, children, ...restProps } = useHuiProps("Heading", rawProps);
7
+ const Component = `h${level}`;
8
+ const recipe = headingRecipe({
9
+ level: `${level}`,
10
+ margin
11
+ });
12
+ const cls = useHuiClasses("Heading", recipe, rawProps);
13
+ const sls = useHuiStyles("Heading", { root: rawProps.style });
14
+ return /* @__PURE__ */ jsx(Component, {
15
+ className: cls.root,
16
+ style: sls.root,
17
+ ...restProps,
18
+ children
19
+ });
20
+ }
21
+ export { Heading };
22
+
23
+ //# sourceMappingURL=heading.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"heading.js","names":[],"sources":["../../../src/components/heading/heading.tsx"],"sourcesContent":["import { headingRecipe, type HeadingSlots, type HeadingVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface HeadingOwnProps {\n /**\n * The heading level used to choose the rendered heading element.\n *\n * @default 2\n */\n level?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;\n /**\n * The block margin applied to the heading.\n *\n * @default \"none\"\n */\n margin?: HeadingVariants[\"margin\"] | undefined;\n}\n\nexport type HeadingProps = HuiComponentProps<ComponentProps<\"h2\"> & HeadingOwnProps, HeadingSlots>;\n\nexport function Heading(rawProps: HeadingProps): VNode {\n const {\n level = 2,\n margin,\n children,\n ...restProps\n } = useHuiProps(\"Heading\", rawProps);\n\n const Component = `h${level}` as const;\n\n const recipe = headingRecipe({ level: `${level}`, margin });\n const cls = useHuiClasses(\"Heading\", recipe, rawProps);\n const sls = useHuiStyles(\"Heading\", { root: rawProps.style });\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n"],"mappings":";;;;AAsBA,SAAgB,QAAQ,UAA+B;CACrD,MAAM,EACJ,QAAQ,GACR,QACA,UACA,GAAG,cACD,YAAY,WAAW,QAAQ;CAEnC,MAAM,YAAY,IAAI;CAEtB,MAAM,SAAS,cAAc;EAAE,OAAO,GAAG;EAAS;CAAO,CAAC;CAC1D,MAAM,MAAM,cAAc,WAAW,QAAQ,QAAQ;CACrD,MAAM,MAAM,aAAa,WAAW,EAAE,MAAM,SAAS,MAAM,CAAC;CAE5D,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
@@ -0,0 +1,2 @@
1
+ import { Heading, HeadingProps } from "./heading.js";
2
+ export { Heading, HeadingProps };
@@ -8,8 +8,24 @@ import { Blockquote, BlockquoteProps } from "./blockquote/blockquote.js";
8
8
  import "./blockquote/index.js";
9
9
  import { Button, ButtonProps } from "./button/button.js";
10
10
  import "./button/index.js";
11
+ import { Checkbox, CheckboxProps } from "./checkbox/checkbox.js";
12
+ import "./checkbox/index.js";
13
+ import { Code, CodeProps } from "./code/code.js";
14
+ import "./code/index.js";
15
+ import { Details, DetailsProps } from "./details/details.js";
16
+ import "./details/index.js";
17
+ import { Heading, HeadingProps } from "./heading/heading.js";
18
+ import "./heading/index.js";
19
+ import { Dialog, DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps } from "./dialog/dialog.js";
20
+ import { useDialogId } from "./dialog/dialog.context.js";
21
+ import "./dialog/index.js";
22
+ import { DdProps, Dl, DlProps, DtProps } from "./dl/dl.js";
23
+ import "./dl/index.js";
24
+ import { Drawer, DrawerCloseProps, DrawerContentProps, DrawerProps, DrawerTriggerProps } from "./drawer/drawer.js";
25
+ import { useDrawerId } from "./drawer/drawer.context.js";
26
+ import "./drawer/index.js";
11
27
  import { Progress, ProgressProps } from "./progress/progress.js";
12
28
  import "./progress/index.js";
13
29
  import { Tabs, TabsListProps, TabsPanelProps, TabsProps, TabsTabProps } from "./tabs/tabs.js";
14
30
  import "./tabs/index.js";
15
- export { Alert, AlertProps, Anchor, AnchorProps, Avatar, AvatarProps, Blockquote, BlockquoteProps, Button, ButtonProps, Progress, ProgressProps, Tabs, TabsListProps, TabsPanelProps, TabsProps, TabsTabProps };
31
+ export { Alert, AlertProps, Anchor, AnchorProps, Avatar, AvatarProps, Blockquote, BlockquoteProps, Button, ButtonProps, Checkbox, CheckboxProps, Code, CodeProps, DdProps, Details, DetailsProps, Dialog, DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps, Dl, DlProps, Drawer, DrawerCloseProps, DrawerContentProps, DrawerProps, DrawerTriggerProps, DtProps, Heading, HeadingProps, Progress, ProgressProps, Tabs, TabsListProps, TabsPanelProps, TabsProps, TabsTabProps, useDialogId, useDrawerId };
@@ -2,7 +2,6 @@ import { HuiComponentProps } from "../../types/hui-component.js";
2
2
  import "../../types/index.js";
3
3
  import { ProgressSlots, ProgressVariants } from "@hebium-ui/core";
4
4
  import { ComponentChildren, ComponentProps, VNode } from "preact";
5
- //#region src/components/progress/progress.d.ts
6
5
  interface ProgressOwnProps {
7
6
  /**
8
7
  * The minimum value of the progress range.
@@ -49,6 +48,5 @@ interface ProgressOwnProps {
49
48
  }
50
49
  export type ProgressProps = HuiComponentProps<ComponentProps<"div"> & ProgressOwnProps, ProgressSlots>;
51
50
  export declare function Progress(rawProps: ProgressProps): VNode;
52
- //#endregion
53
51
  export {};
54
52
  //# sourceMappingURL=progress.d.ts.map