@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
@@ -2,7 +2,6 @@ import { HuiComponentProps } from "../../types/hui-component.js";
2
2
  import "../../types/index.js";
3
3
  import { AlertSlots, AlertVariants } from "@hebium-ui/core";
4
4
  import { ComponentChildren, ComponentProps, VNode } from "preact";
5
- //#region src/components/alert/alert.d.ts
6
5
  interface AlertOwnProps {
7
6
  /**
8
7
  * The main message displayed in the alert.
@@ -39,6 +38,5 @@ interface AlertOwnProps {
39
38
  }
40
39
  export type AlertProps = HuiComponentProps<Omit<ComponentProps<"div">, "children"> & AlertOwnProps, AlertSlots>;
41
40
  export declare function Alert(rawProps: AlertProps): VNode;
42
- //#endregion
43
41
  export {};
44
42
  //# sourceMappingURL=alert.d.ts.map
@@ -1,16 +1,16 @@
1
- import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
1
+ import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
2
  import { alertRecipe } from "@hebium-ui/core";
3
3
  import { jsx, jsxs } from "preact/jsx-runtime";
4
- //#region src/components/alert/alert.tsx
4
+ // src/components/alert/alert.tsx
5
5
  function Alert(rawProps) {
6
- const { classNames, styles, description, icon, variant, color, padding, message, ...restProps } = useHuiProps("Alert", rawProps);
6
+ const { description, icon, variant, color, padding, message, ...restProps } = useHuiProps("Alert", rawProps);
7
7
  const recipe = alertRecipe({
8
8
  variant,
9
9
  color,
10
10
  padding
11
11
  });
12
- const cls = useHuiClassNames("Alert", recipe, classNames);
13
- const sls = useHuiStyles("Alert", styles);
12
+ const cls = useHuiClasses("Alert", recipe, rawProps);
13
+ const sls = useHuiStyles("Alert", rawProps.styles);
14
14
  return /* @__PURE__ */ jsxs("div", {
15
15
  className: cls.root,
16
16
  style: sls.root,
@@ -39,7 +39,6 @@ function Alert(rawProps) {
39
39
  })]
40
40
  });
41
41
  }
42
- //#endregion
43
42
  export { Alert };
44
43
 
45
44
  //# sourceMappingURL=alert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alert.js","names":[],"sources":["../../../src/components/alert/alert.tsx"],"sourcesContent":["import { alertRecipe, type AlertSlots, type AlertVariants } from \"@hebium-ui/core\";\nimport { type ComponentChildren, type ComponentProps, type VNode } from \"preact\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface AlertOwnProps {\n /**\n * The main message displayed in the alert.\n */\n message?: ComponentChildren | undefined;\n /**\n * The description displayed below the alert message.\n */\n description?: ComponentChildren | undefined;\n /**\n * The icon displayed beside the alert content. Set to `null` or `false` to hide the icon.\n *\n * @default error icon\n */\n icon?: ComponentChildren | undefined;\n /**\n * The visual style of the alert.\n *\n * @default \"light\"\n */\n variant?: AlertVariants[\"variant\"] | undefined;\n /**\n * The semantic color of the alert.\n *\n * @default \"danger\"\n */\n color?: AlertVariants[\"color\"] | undefined;\n /**\n * The padding of the alert.\n *\n * @default \"md\"\n */\n padding?: AlertVariants[\"padding\"] | undefined;\n}\n\nexport type AlertProps = HuiComponentProps<Omit<ComponentProps<\"div\">, \"children\"> & AlertOwnProps, AlertSlots>;\n\nexport function Alert(rawProps: AlertProps): VNode {\n const {\n classNames,\n styles,\n description,\n icon,\n variant,\n color,\n padding,\n message,\n ...restProps\n } = useHuiProps(\"Alert\", rawProps);\n\n const recipe = alertRecipe({\n variant,\n color,\n padding,\n });\n const cls = useHuiClassNames(\"Alert\", recipe, classNames);\n const sls = useHuiStyles(\"Alert\", styles);\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n role=\"alert\"\n {...restProps}\n >\n <div className={cls.icon} style={sls.icon}>\n {typeof icon === \"undefined\"\n ? (\n <span\n aria-hidden\n className={cls.errorIcon}\n style={sls.errorIcon}\n />\n )\n : icon}\n </div>\n <div className={cls.content} style={sls.content}>\n {message && <div className={cls.message} style={sls.message}>{message}</div>}\n {description\n && (\n <div className={cls.description} style={sls.description}>\n {description}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AA0CA,SAAgB,MAAM,UAA6B;CACjD,MAAM,EACJ,YACA,QACA,aACA,MACA,SACA,OACA,SACA,SACA,GAAG,cACD,YAAY,SAAS,QAAQ;CAEjC,MAAM,SAAS,YAAY;EACzB;EACA;EACA;CACF,CAAC;CACD,MAAM,MAAM,iBAAiB,SAAS,QAAQ,UAAU;CACxD,MAAM,MAAM,aAAa,SAAS,MAAM;CAExC,OACE,qBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,MAAK;EACL,GAAI;EAJN,UAAA,CAME,oBAAC,OAAD;GAAK,WAAW,IAAI;GAAM,OAAO,IAAI;GAClC,UAAA,OAAO,SAAS,cAEb,oBAAC,QAAD;IACE,eAAA;IACA,WAAW,IAAI;IACf,OAAO,IAAI;GACZ,CAAA,IAED;EACD,CAAA,GACL,qBAAC,OAAD;GAAK,WAAW,IAAI;GAAS,OAAO,IAAI;GAAxC,UAAA,CACG,WAAW,oBAAC,OAAD;IAAK,WAAW,IAAI;IAAS,OAAO,IAAI;IAAU,UAAA;GAAa,CAAA,GAC1E,eAEG,oBAAC,OAAD;IAAK,WAAW,IAAI;IAAa,OAAO,IAAI;IACzC,UAAA;GACE,CAAA,CAEN;EACF,CAAA,CAAA;;AAET"}
1
+ {"version":3,"file":"alert.js","names":[],"sources":["../../../src/components/alert/alert.tsx"],"sourcesContent":["import { alertRecipe, type AlertSlots, type AlertVariants } from \"@hebium-ui/core\";\nimport { type ComponentChildren, type ComponentProps, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface AlertOwnProps {\n /**\n * The main message displayed in the alert.\n */\n message?: ComponentChildren | undefined;\n /**\n * The description displayed below the alert message.\n */\n description?: ComponentChildren | undefined;\n /**\n * The icon displayed beside the alert content. Set to `null` or `false` to hide the icon.\n *\n * @default error icon\n */\n icon?: ComponentChildren | undefined;\n /**\n * The visual style of the alert.\n *\n * @default \"light\"\n */\n variant?: AlertVariants[\"variant\"] | undefined;\n /**\n * The semantic color of the alert.\n *\n * @default \"danger\"\n */\n color?: AlertVariants[\"color\"] | undefined;\n /**\n * The padding of the alert.\n *\n * @default \"md\"\n */\n padding?: AlertVariants[\"padding\"] | undefined;\n}\n\nexport type AlertProps = HuiComponentProps<Omit<ComponentProps<\"div\">, \"children\"> & AlertOwnProps, AlertSlots>;\n\nexport function Alert(rawProps: AlertProps): VNode {\n const {\n description,\n icon,\n variant,\n color,\n padding,\n message,\n ...restProps\n } = useHuiProps(\"Alert\", rawProps);\n\n const recipe = alertRecipe({\n variant,\n color,\n padding,\n });\n const cls = useHuiClasses(\"Alert\", recipe, rawProps);\n const sls = useHuiStyles(\"Alert\", rawProps.styles);\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n role=\"alert\"\n {...restProps}\n >\n <div className={cls.icon} style={sls.icon}>\n {typeof icon === \"undefined\"\n ? (\n <span\n aria-hidden\n className={cls.errorIcon}\n style={sls.errorIcon}\n />\n )\n : icon}\n </div>\n <div className={cls.content} style={sls.content}>\n {message && <div className={cls.message} style={sls.message}>{message}</div>}\n {description\n && (\n <div className={cls.description} style={sls.description}>\n {description}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AA0CA,SAAgB,MAAM,UAA6B;CACjD,MAAM,EACJ,aACA,MACA,SACA,OACA,SACA,SACA,GAAG,cACD,YAAY,SAAS,QAAQ;CAEjC,MAAM,SAAS,YAAY;EACzB;EACA;EACA;CACF,CAAC;CACD,MAAM,MAAM,cAAc,SAAS,QAAQ,QAAQ;CACnD,MAAM,MAAM,aAAa,SAAS,SAAS,MAAM;CAEjD,OACE,qBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,MAAK;EACL,GAAI;EAJN,UAAA,CAME,oBAAC,OAAD;GAAK,WAAW,IAAI;GAAM,OAAO,IAAI;GAClC,UAAA,OAAO,SAAS,cAEb,oBAAC,QAAD;IACE,eAAA;IACA,WAAW,IAAI;IACf,OAAO,IAAI;GACZ,CAAA,IAED;EACD,CAAA,GACL,qBAAC,OAAD;GAAK,WAAW,IAAI;GAAS,OAAO,IAAI;GAAxC,UAAA,CACG,WAAW,oBAAC,OAAD;IAAK,WAAW,IAAI;IAAS,OAAO,IAAI;IAAU,UAAA;GAAa,CAAA,GAC1E,eAEG,oBAAC,OAAD;IAAK,WAAW,IAAI;IAAa,OAAO,IAAI;IACzC,UAAA;GACE,CAAA,CAEN;EACF,CAAA,CAAA;;AAET"}
@@ -2,7 +2,6 @@ import { HuiPolymorphicProps } from "../../types/polymorphic.js";
2
2
  import "../../types/index.js";
3
3
  import { AnchorSlots, AnchorVariants } from "@hebium-ui/core";
4
4
  import { JSX, VNode } from "preact";
5
- //#region src/components/anchor/anchor.d.ts
6
5
  interface AnchorOwnProps {
7
6
  /**
8
7
  * The semantic color of the anchor.
@@ -25,6 +24,5 @@ interface AnchorOwnProps {
25
24
  }
26
25
  export type AnchorProps<E extends JSX.ElementType = "a"> = HuiPolymorphicProps<E, AnchorOwnProps, AnchorSlots>;
27
26
  export declare function Anchor<E extends JSX.ElementType = "a">(rawProps: AnchorProps<E>): VNode;
28
- //#endregion
29
27
  export {};
30
28
  //# sourceMappingURL=anchor.d.ts.map
@@ -1,17 +1,17 @@
1
- import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
1
+ import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
2
  import { anchorRecipe } from "@hebium-ui/core";
3
3
  import { jsx } from "preact/jsx-runtime";
4
- //#region src/components/anchor/anchor.tsx
4
+ // src/components/anchor/anchor.tsx
5
5
  function Anchor(rawProps) {
6
- const { as, color, marker, decoration, className, style, children, ...restProps } = useHuiProps("Anchor", rawProps);
6
+ const { as, color, marker, decoration, children, ...restProps } = useHuiProps("Anchor", rawProps);
7
7
  const recipe = anchorRecipe({
8
8
  color,
9
9
  marker,
10
10
  decoration
11
11
  });
12
12
  const Component = as ?? "a";
13
- const cls = useHuiClassNames("Anchor", recipe, { root: className });
14
- const sls = useHuiStyles("Anchor", { root: style });
13
+ const cls = useHuiClasses("Anchor", recipe, rawProps);
14
+ const sls = useHuiStyles("Anchor", { root: rawProps.style });
15
15
  return /* @__PURE__ */ jsx(Component, {
16
16
  className: cls.root,
17
17
  style: sls.root,
@@ -19,7 +19,6 @@ function Anchor(rawProps) {
19
19
  children
20
20
  });
21
21
  }
22
- //#endregion
23
22
  export { Anchor };
24
23
 
25
24
  //# sourceMappingURL=anchor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"anchor.js","names":[],"sources":["../../../src/components/anchor/anchor.tsx"],"sourcesContent":["import { anchorRecipe, type AnchorSlots, type AnchorVariants } from \"@hebium-ui/core\";\nimport { type JSX, type VNode } from \"preact\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface AnchorOwnProps {\n /**\n * The semantic color of the anchor.\n *\n * @default \"accent\"\n */\n color?: AnchorVariants[\"color\"] | undefined;\n /**\n * The marker displayed before or after the anchor text.\n * Override `--hui-anchor-marker` to customize the marker content.\n * Include quotes in the CSS variable value because it is used as CSS `content`.\n */\n marker?: AnchorVariants[\"marker\"] | undefined;\n /**\n * The text decoration style of the anchor.\n *\n * @default \"underline\"\n */\n decoration?: AnchorVariants[\"decoration\"] | undefined;\n}\n\nexport type AnchorProps<E extends JSX.ElementType = \"a\"> = HuiPolymorphicProps<\n E,\n AnchorOwnProps,\n AnchorSlots\n>;\n\nexport function Anchor<E extends JSX.ElementType = \"a\">(rawProps: AnchorProps<E>): VNode {\n const {\n as,\n color,\n marker,\n decoration,\n className,\n style,\n children,\n ...restProps\n } = useHuiProps(\"Anchor\", rawProps);\n\n const recipe = anchorRecipe({ color, marker, decoration });\n const Component = as ?? \"a\";\n\n const cls = useHuiClassNames(\"Anchor\", recipe, { root: className });\n const sls = useHuiStyles(\"Anchor\", { root: 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":";;;;AAgCA,SAAgB,OAAwC,UAAiC;CACvF,MAAM,EACJ,IACA,OACA,QACA,YACA,WACA,OACA,UACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,SAAS,aAAa;EAAE;EAAO;EAAQ;CAAW,CAAC;CACzD,MAAM,YAAY,MAAM;CAExB,MAAM,MAAM,iBAAiB,UAAU,QAAQ,EAAE,MAAM,UAAU,CAAC;CAClE,MAAM,MAAM,aAAa,UAAU,EAAE,MAAM,MAAM,CAAC;CAElD,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
1
+ {"version":3,"file":"anchor.js","names":[],"sources":["../../../src/components/anchor/anchor.tsx"],"sourcesContent":["import { anchorRecipe, type AnchorSlots, type AnchorVariants } from \"@hebium-ui/core\";\nimport { type JSX, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface AnchorOwnProps {\n /**\n * The semantic color of the anchor.\n *\n * @default \"accent\"\n */\n color?: AnchorVariants[\"color\"] | undefined;\n /**\n * The marker displayed before or after the anchor text.\n * Override `--hui-anchor-marker` to customize the marker content.\n * Include quotes in the CSS variable value because it is used as CSS `content`.\n */\n marker?: AnchorVariants[\"marker\"] | undefined;\n /**\n * The text decoration style of the anchor.\n *\n * @default \"underline\"\n */\n decoration?: AnchorVariants[\"decoration\"] | undefined;\n}\n\nexport type AnchorProps<E extends JSX.ElementType = \"a\"> = HuiPolymorphicProps<\n E,\n AnchorOwnProps,\n AnchorSlots\n>;\n\nexport function Anchor<E extends JSX.ElementType = \"a\">(rawProps: AnchorProps<E>): VNode {\n const {\n as,\n color,\n marker,\n decoration,\n children,\n ...restProps\n } = useHuiProps(\"Anchor\", rawProps);\n\n const recipe = anchorRecipe({ color, marker, decoration });\n const Component = as ?? \"a\";\n\n const cls = useHuiClasses(\"Anchor\", recipe, rawProps);\n const sls = useHuiStyles(\"Anchor\", { 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":";;;;AAgCA,SAAgB,OAAwC,UAAiC;CACvF,MAAM,EACJ,IACA,OACA,QACA,YACA,UACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,SAAS,aAAa;EAAE;EAAO;EAAQ;CAAW,CAAC;CACzD,MAAM,YAAY,MAAM;CAExB,MAAM,MAAM,cAAc,UAAU,QAAQ,QAAQ;CACpD,MAAM,MAAM,aAAa,UAAU,EAAE,MAAM,SAAS,MAAM,CAAC;CAE3D,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
@@ -1,16 +1,18 @@
1
1
  import { HuiComponentProps } from "../../types/hui-component.js";
2
2
  import "../../types/index.js";
3
3
  import { AvatarSlots } from "@hebium-ui/core";
4
- import { ComponentProps, VNode } from "preact";
5
- //#region src/components/avatar/avatar.d.ts
4
+ import { ComponentProps, PartialImgHTMLAttributes, Signalish, VNode } from "preact";
5
+ type NativeImageWithAlt = Extract<ComponentProps<"img">, {
6
+ alt: unknown;
7
+ }>;
6
8
  interface AvatarOwnProps {
7
9
  /**
8
10
  * The name represented by the avatar. It is used as the default image alternative text and to generate placeholder initials.
9
11
  */
10
12
  name: string;
13
+ alt?: Signalish<string | undefined>;
11
14
  }
12
- export type AvatarProps = HuiComponentProps<ComponentProps<"img"> & AvatarOwnProps, AvatarSlots>;
15
+ export type AvatarProps = HuiComponentProps<Omit<PartialImgHTMLAttributes<HTMLImageElement>, "role"> & Pick<NativeImageWithAlt, "role"> & AvatarOwnProps, AvatarSlots>;
13
16
  export declare function Avatar(rawProps: AvatarProps): VNode;
14
- //#endregion
15
17
  export {};
16
18
  //# sourceMappingURL=avatar.d.ts.map
@@ -1,11 +1,13 @@
1
- import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
1
+ import { unwrapSignalish } from "../../utils/unwrap-signalish.js";
2
+ import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
3
  import { avatartRecipe, getAvatarPlaceholder, shouldShowAvatarPlaceholder } from "@hebium-ui/core";
3
4
  import { useCallback, useState } from "preact/hooks";
4
5
  import { jsx } from "preact/jsx-runtime";
5
- //#region src/components/avatar/avatar.tsx
6
+ // src/components/avatar/avatar.tsx
6
7
  function Avatar(rawProps) {
7
- const { classNames, styles, name, src, srcSet, srcset, onError, ...restProps } = useHuiProps("Avatar", rawProps);
8
- const imageSrcSet = srcSet ?? srcset;
8
+ const { name, src: rawSrc, srcSet: rawSrcSet, srcset: rawSrcset, onError, ...restProps } = useHuiProps("Avatar", rawProps);
9
+ const src = unwrapSignalish(rawSrc);
10
+ const imageSrcSet = unwrapSignalish(rawSrcSet) ?? unwrapSignalish(rawSrcset);
9
11
  const [failedSource, setFailedSource] = useState(null);
10
12
  const shouldShowPlaceholder = shouldShowAvatarPlaceholder({
11
13
  src,
@@ -13,8 +15,8 @@ function Avatar(rawProps) {
13
15
  failedSource
14
16
  });
15
17
  const recipe = avatartRecipe({ background: shouldShowPlaceholder ? "box" : "transparent" });
16
- const cls = useHuiClassNames("Avatar", recipe, classNames);
17
- const sls = useHuiStyles("Avatar", styles);
18
+ const cls = useHuiClasses("Avatar", recipe, rawProps);
19
+ const sls = useHuiStyles("Avatar", rawProps.styles);
18
20
  const handleOnError = useCallback((event) => {
19
21
  onError?.(event);
20
22
  setFailedSource({
@@ -27,16 +29,7 @@ function Avatar(rawProps) {
27
29
  imageSrcSet
28
30
  ]);
29
31
  const placeholder = getAvatarPlaceholder(name);
30
- const imageAlt = ("alt" in restProps ? restProps.alt : void 0) ?? name;
31
- const imageProps = {
32
- className: cls.img,
33
- style: sls.img,
34
- src,
35
- srcSet: imageSrcSet,
36
- ...restProps,
37
- alt: imageAlt,
38
- onError: handleOnError
39
- };
32
+ const imageAlt = unwrapSignalish(restProps.alt) ?? name;
40
33
  return /* @__PURE__ */ jsx("div", {
41
34
  className: cls.root,
42
35
  style: sls.root,
@@ -45,12 +38,16 @@ function Avatar(rawProps) {
45
38
  style: sls.placeholder,
46
39
  children: placeholder
47
40
  }) : /* @__PURE__ */ jsx("img", {
48
- ...imageProps,
49
- alt: imageProps.alt
41
+ className: cls.img,
42
+ style: sls.img,
43
+ src,
44
+ srcSet: imageSrcSet,
45
+ ...restProps,
46
+ alt: imageAlt,
47
+ onError: handleOnError
50
48
  })
51
49
  });
52
50
  }
53
- //#endregion
54
51
  export { Avatar };
55
52
 
56
53
  //# sourceMappingURL=avatar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"avatar.js","names":[],"sources":["../../../src/components/avatar/avatar.tsx"],"sourcesContent":["import {\n type AvatarSlots,\n type AvatarSource,\n avatartRecipe,\n getAvatarPlaceholder,\n shouldShowAvatarPlaceholder,\n} from \"@hebium-ui/core\";\nimport { type ComponentProps, type TargetedEvent, type VNode } from \"preact\";\nimport { useCallback, useState } from \"preact/hooks\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface AvatarOwnProps {\n /**\n * The name represented by the avatar. It is used as the default image alternative text and to generate placeholder initials.\n */\n name: string;\n}\n\nexport type AvatarProps = HuiComponentProps<ComponentProps<\"img\"> & AvatarOwnProps, AvatarSlots>;\n\nexport function Avatar(rawProps: AvatarProps): VNode {\n const {\n classNames,\n styles,\n name,\n src,\n srcSet,\n srcset,\n onError,\n ...restProps\n } = useHuiProps(\"Avatar\", rawProps);\n\n const imageSrcSet = srcSet ?? srcset;\n const [failedSource, setFailedSource] = useState<AvatarSource<AvatarProps[\"src\"]> | null>(null);\n const shouldShowPlaceholder = shouldShowAvatarPlaceholder({ src, srcSet: imageSrcSet, failedSource });\n\n const recipe = avatartRecipe({\n background: shouldShowPlaceholder ? \"box\" : \"transparent\",\n });\n\n const cls = useHuiClassNames(\"Avatar\", recipe, classNames);\n const sls = useHuiStyles(\"Avatar\", styles);\n\n const handleOnError = useCallback((event: TargetedEvent<HTMLImageElement>) => {\n onError?.(event);\n\n setFailedSource({ src, srcSet: imageSrcSet });\n }, [onError, src, imageSrcSet]);\n\n const placeholder = getAvatarPlaceholder(name);\n\n const imageAlt = (\"alt\" in restProps ? restProps.alt : undefined) ?? name;\n\n // Preact's JSX accessibility union does not model the default alt supplied by name.\n const imageProps = {\n className: cls.img,\n style: sls.img,\n src,\n srcSet: imageSrcSet,\n ...restProps,\n alt: imageAlt,\n onError: handleOnError,\n } as ComponentProps<\"img\"> & { alt: typeof imageAlt };\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n >\n {shouldShowPlaceholder\n ? (\n <span\n className={cls.placeholder}\n style={sls.placeholder}\n >\n {placeholder}\n </span>\n )\n : <img {...imageProps} alt={imageProps.alt} />}\n </div>\n );\n}\n"],"mappings":";;;;;AAqBA,SAAgB,OAAO,UAA8B;CACnD,MAAM,EACJ,YACA,QACA,MACA,KACA,QACA,QACA,SACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,cAAc,UAAU;CAC9B,MAAM,CAAC,cAAc,mBAAmB,SAAkD,IAAI;CAC9F,MAAM,wBAAwB,4BAA4B;EAAE;EAAK,QAAQ;EAAa;CAAa,CAAC;CAEpG,MAAM,SAAS,cAAc,EAC3B,YAAY,wBAAwB,QAAQ,cAC9C,CAAC;CAED,MAAM,MAAM,iBAAiB,UAAU,QAAQ,UAAU;CACzD,MAAM,MAAM,aAAa,UAAU,MAAM;CAEzC,MAAM,gBAAgB,aAAa,UAA2C;EAC5E,UAAU,KAAK;EAEf,gBAAgB;GAAE;GAAK,QAAQ;EAAY,CAAC;CAC9C,GAAG;EAAC;EAAS;EAAK;CAAW,CAAC;CAE9B,MAAM,cAAc,qBAAqB,IAAI;CAE7C,MAAM,YAAY,SAAS,YAAY,UAAU,MAAM,KAAA,MAAc;CAGrE,MAAM,aAAa;EACjB,WAAW,IAAI;EACf,OAAO,IAAI;EACX;EACA,QAAQ;EACR,GAAG;EACH,KAAK;EACL,SAAS;CACX;CAEA,OACE,oBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAEV,UAAA,wBAEG,oBAAC,QAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GAEV,UAAA;EACG,CAAA,IAEN,oBAAC,OAAD;GAAK,GAAI;GAAY,KAAK,WAAW;EAAM,CAAA;CAC5C,CAAA;AAET"}
1
+ {"version":3,"file":"avatar.js","names":[],"sources":["../../../src/components/avatar/avatar.tsx"],"sourcesContent":["import {\n type AvatarSlots,\n type AvatarSource,\n avatartRecipe,\n getAvatarPlaceholder,\n shouldShowAvatarPlaceholder,\n} from \"@hebium-ui/core\";\nimport {\n type ComponentProps,\n type PartialImgHTMLAttributes,\n type Signalish,\n type TargetedEvent,\n type VNode,\n} from \"preact\";\nimport { useCallback, useState } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\nimport { unwrapSignalish } from \"~/utils\";\n\ntype NativeImageWithAlt = Extract<ComponentProps<\"img\">, { alt: unknown }>;\n\ninterface AvatarOwnProps {\n /**\n * The name represented by the avatar. It is used as the default image alternative text and to generate placeholder initials.\n */\n name: string;\n alt?: Signalish<string | undefined>;\n}\n\n// Avatar supplies the accessible name through the default alt derived from name.\nexport type AvatarProps = HuiComponentProps<\n & Omit<PartialImgHTMLAttributes<HTMLImageElement>, \"role\">\n & Pick<NativeImageWithAlt, \"role\">\n & AvatarOwnProps,\n AvatarSlots\n>;\n\nexport function Avatar(rawProps: AvatarProps): VNode {\n const {\n name,\n src: rawSrc,\n srcSet: rawSrcSet,\n srcset: rawSrcset,\n onError,\n ...restProps\n } = useHuiProps(\"Avatar\", rawProps);\n\n const src = unwrapSignalish(rawSrc);\n const imageSrcSet = unwrapSignalish(rawSrcSet) ?? unwrapSignalish(rawSrcset);\n const [failedSource, setFailedSource] = useState<AvatarSource | null>(null);\n const shouldShowPlaceholder = shouldShowAvatarPlaceholder({ src, srcSet: imageSrcSet, failedSource });\n\n const recipe = avatartRecipe({\n background: shouldShowPlaceholder ? \"box\" : \"transparent\",\n });\n\n const cls = useHuiClasses(\"Avatar\", recipe, rawProps);\n const sls = useHuiStyles(\"Avatar\", rawProps.styles);\n\n const handleOnError = useCallback((event: TargetedEvent<HTMLImageElement>) => {\n onError?.(event);\n\n setFailedSource({ src, srcSet: imageSrcSet });\n }, [onError, src, imageSrcSet]);\n\n const placeholder = getAvatarPlaceholder(name);\n\n const imageAlt = unwrapSignalish(restProps.alt) ?? name;\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n >\n {shouldShowPlaceholder\n ? (\n <span\n className={cls.placeholder}\n style={sls.placeholder}\n >\n {placeholder}\n </span>\n )\n : (\n <img\n className={cls.img}\n style={sls.img}\n src={src}\n srcSet={imageSrcSet}\n {...restProps}\n alt={imageAlt}\n onError={handleOnError}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;AAqCA,SAAgB,OAAO,UAA8B;CACnD,MAAM,EACJ,MACA,KAAK,QACL,QAAQ,WACR,QAAQ,WACR,SACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,MAAM,gBAAgB,MAAM;CAClC,MAAM,cAAc,gBAAgB,SAAS,KAAK,gBAAgB,SAAS;CAC3E,MAAM,CAAC,cAAc,mBAAmB,SAA8B,IAAI;CAC1E,MAAM,wBAAwB,4BAA4B;EAAE;EAAK,QAAQ;EAAa;CAAa,CAAC;CAEpG,MAAM,SAAS,cAAc,EAC3B,YAAY,wBAAwB,QAAQ,cAC9C,CAAC;CAED,MAAM,MAAM,cAAc,UAAU,QAAQ,QAAQ;CACpD,MAAM,MAAM,aAAa,UAAU,SAAS,MAAM;CAElD,MAAM,gBAAgB,aAAa,UAA2C;EAC5E,UAAU,KAAK;EAEf,gBAAgB;GAAE;GAAK,QAAQ;EAAY,CAAC;CAC9C,GAAG;EAAC;EAAS;EAAK;CAAW,CAAC;CAE9B,MAAM,cAAc,qBAAqB,IAAI;CAE7C,MAAM,WAAW,gBAAgB,UAAU,GAAG,KAAK;CAEnD,OACE,oBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAEV,UAAA,wBAEG,oBAAC,QAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GAEV,UAAA;EACG,CAAA,IAGN,oBAAC,OAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACN;GACL,QAAQ;GACR,GAAI;GACJ,KAAK;GACL,SAAS;EACV,CAAA;CAEF,CAAA;AAET"}
@@ -2,8 +2,7 @@ import { HuiComponentProps } from "../../types/hui-component.js";
2
2
  import "../../types/index.js";
3
3
  import { BlockquoteSlots, BlockquoteVariants } from "@hebium-ui/core";
4
4
  import { ComponentChildren, ComponentProps, VNode } from "preact";
5
- //#region src/components/blockquote/blockquote.d.ts
6
- type HtmlFigcaptionProps = Omit<ComponentProps<"figcaption">, "children" | "className" | "style">;
5
+ type HtmlFigcaptionProps = Omit<ComponentProps<"figcaption">, "children" | "class" | "className" | "style">;
7
6
  interface BlockquoteOwnProps {
8
7
  /**
9
8
  * The semantic color of the blockquote accent.
@@ -22,6 +21,5 @@ interface BlockquoteOwnProps {
22
21
  }
23
22
  export type BlockquoteProps = HuiComponentProps<Omit<ComponentProps<"blockquote">, "color"> & BlockquoteOwnProps, BlockquoteSlots>;
24
23
  export declare function Blockquote(rawProps: BlockquoteProps): VNode;
25
- //#endregion
26
24
  export {};
27
25
  //# sourceMappingURL=blockquote.d.ts.map
@@ -1,12 +1,12 @@
1
- import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
1
+ import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
2
  import { blockquoteRecipe } from "@hebium-ui/core";
3
3
  import { jsx, jsxs } from "preact/jsx-runtime";
4
- //#region src/components/blockquote/blockquote.tsx
4
+ // src/components/blockquote/blockquote.tsx
5
5
  function Blockquote(rawProps) {
6
- const { color, caption, captionProps, classNames, styles, children, ...restProps } = useHuiProps("Blockquote", rawProps);
6
+ const { color, caption, captionProps, children, ...restProps } = useHuiProps("Blockquote", rawProps);
7
7
  const recipe = blockquoteRecipe({ color });
8
- const cls = useHuiClassNames("Blockquote", recipe, classNames);
9
- const sls = useHuiStyles("Blockquote", styles);
8
+ const cls = useHuiClasses("Blockquote", recipe, rawProps);
9
+ const sls = useHuiStyles("Blockquote", rawProps.styles);
10
10
  return /* @__PURE__ */ jsxs("figure", {
11
11
  className: cls.root,
12
12
  style: sls.root,
@@ -23,7 +23,6 @@ function Blockquote(rawProps) {
23
23
  })]
24
24
  });
25
25
  }
26
- //#endregion
27
26
  export { Blockquote };
28
27
 
29
28
  //# sourceMappingURL=blockquote.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"blockquote.js","names":[],"sources":["../../../src/components/blockquote/blockquote.tsx"],"sourcesContent":["import { blockquoteRecipe, type BlockquoteSlots, type BlockquoteVariants } from \"@hebium-ui/core\";\nimport { type ComponentChildren, type ComponentProps, type VNode } from \"preact\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ntype HtmlFigcaptionProps = Omit<ComponentProps<\"figcaption\">, \"children\" | \"className\" | \"style\">;\n\ninterface BlockquoteOwnProps {\n /**\n * The semantic color of the blockquote accent.\n *\n * @default \"neutral\"\n */\n color?: BlockquoteVariants[\"color\"] | undefined;\n /**\n * The citation or attribution displayed below the quote.\n */\n caption?: ComponentChildren | undefined;\n /**\n * Additional props passed to the caption element.\n */\n captionProps?: HtmlFigcaptionProps | undefined;\n}\n\nexport type BlockquoteProps = HuiComponentProps<\n Omit<ComponentProps<\"blockquote\">, \"color\"> & BlockquoteOwnProps,\n BlockquoteSlots\n>;\n\nexport function Blockquote(rawProps: BlockquoteProps): VNode {\n const {\n color,\n caption,\n captionProps,\n classNames,\n styles,\n children,\n ...restProps\n } = useHuiProps(\"Blockquote\", rawProps);\n\n const recipe = blockquoteRecipe({ color });\n const cls = useHuiClassNames(\"Blockquote\", recipe, classNames);\n const sls = useHuiStyles(\"Blockquote\", styles);\n\n return (\n <figure\n className={cls.root}\n style={sls.root}\n >\n <blockquote\n className={cls.blockquote}\n style={sls.blockquote}\n {...restProps}\n >\n {children}\n </blockquote>\n {caption != null && (\n <figcaption\n className={cls.caption}\n style={sls.caption}\n {...captionProps}\n >\n {caption}\n </figcaption>\n )}\n </figure>\n );\n}\n"],"mappings":";;;;AA6BA,SAAgB,WAAW,UAAkC;CAC3D,MAAM,EACJ,OACA,SACA,cACA,YACA,QACA,UACA,GAAG,cACD,YAAY,cAAc,QAAQ;CAEtC,MAAM,SAAS,iBAAiB,EAAE,MAAM,CAAC;CACzC,MAAM,MAAM,iBAAiB,cAAc,QAAQ,UAAU;CAC7D,MAAM,MAAM,aAAa,cAAc,MAAM;CAE7C,OACE,qBAAC,UAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIE,oBAAC,cAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH;EACS,CAAA,GACX,WAAW,QACV,oBAAC,cAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH,UAAA;EACS,CAAA,CAER;;AAEZ"}
1
+ {"version":3,"file":"blockquote.js","names":[],"sources":["../../../src/components/blockquote/blockquote.tsx"],"sourcesContent":["import { blockquoteRecipe, type BlockquoteSlots, type BlockquoteVariants } from \"@hebium-ui/core\";\nimport { type ComponentChildren, type ComponentProps, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ntype HtmlFigcaptionProps = Omit<ComponentProps<\"figcaption\">, \"children\" | \"class\" | \"className\" | \"style\">;\n\ninterface BlockquoteOwnProps {\n /**\n * The semantic color of the blockquote accent.\n *\n * @default \"neutral\"\n */\n color?: BlockquoteVariants[\"color\"] | undefined;\n /**\n * The citation or attribution displayed below the quote.\n */\n caption?: ComponentChildren | undefined;\n /**\n * Additional props passed to the caption element.\n */\n captionProps?: HtmlFigcaptionProps | undefined;\n}\n\nexport type BlockquoteProps = HuiComponentProps<\n Omit<ComponentProps<\"blockquote\">, \"color\"> & BlockquoteOwnProps,\n BlockquoteSlots\n>;\n\nexport function Blockquote(rawProps: BlockquoteProps): VNode {\n const {\n color,\n caption,\n captionProps,\n children,\n ...restProps\n } = useHuiProps(\"Blockquote\", rawProps);\n\n const recipe = blockquoteRecipe({ color });\n const cls = useHuiClasses(\"Blockquote\", recipe, rawProps);\n const sls = useHuiStyles(\"Blockquote\", rawProps.styles);\n\n return (\n <figure\n className={cls.root}\n style={sls.root}\n >\n <blockquote\n className={cls.blockquote}\n style={sls.blockquote}\n {...restProps}\n >\n {children}\n </blockquote>\n {caption != null && (\n <figcaption\n className={cls.caption}\n style={sls.caption}\n {...captionProps}\n >\n {caption}\n </figcaption>\n )}\n </figure>\n );\n}\n"],"mappings":";;;;AA6BA,SAAgB,WAAW,UAAkC;CAC3D,MAAM,EACJ,OACA,SACA,cACA,UACA,GAAG,cACD,YAAY,cAAc,QAAQ;CAEtC,MAAM,SAAS,iBAAiB,EAAE,MAAM,CAAC;CACzC,MAAM,MAAM,cAAc,cAAc,QAAQ,QAAQ;CACxD,MAAM,MAAM,aAAa,cAAc,SAAS,MAAM;CAEtD,OACE,qBAAC,UAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIE,oBAAC,cAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH;EACS,CAAA,GACX,WAAW,QACV,oBAAC,cAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH,UAAA;EACS,CAAA,CAER;;AAEZ"}
@@ -2,7 +2,6 @@ import { HuiPolymorphicProps } from "../../types/polymorphic.js";
2
2
  import "../../types/index.js";
3
3
  import { ButtonSlots, ButtonVariants } from "@hebium-ui/core";
4
4
  import { JSX, VNode } from "preact";
5
- //#region src/components/button/button.d.ts
6
5
  interface ButtonOwnProps {
7
6
  /**
8
7
  * The visual style of the button.
@@ -25,6 +24,5 @@ interface ButtonOwnProps {
25
24
  }
26
25
  export type ButtonProps<E extends JSX.ElementType = "button"> = HuiPolymorphicProps<E, ButtonOwnProps, ButtonSlots>;
27
26
  export declare function Button<E extends JSX.ElementType = "button">(rawProps: ButtonProps<E>): VNode;
28
- //#endregion
29
27
  export {};
30
28
  //# sourceMappingURL=button.d.ts.map
@@ -1,17 +1,17 @@
1
- import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
1
+ import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
2
  import { buttonRecipe } from "@hebium-ui/core";
3
3
  import { jsx } from "preact/jsx-runtime";
4
- //#region src/components/button/button.tsx
4
+ // src/components/button/button.tsx
5
5
  function Button(rawProps) {
6
- const { as, variant, color, shape, className, style, children, ...restProps } = useHuiProps("Button", rawProps);
6
+ const { as, variant, color, shape, children, ...restProps } = useHuiProps("Button", rawProps);
7
7
  const Component = as ?? "button";
8
8
  const recipe = buttonRecipe({
9
9
  variant,
10
10
  color,
11
11
  shape
12
12
  });
13
- const cls = useHuiClassNames("Button", recipe, { root: className });
14
- const sls = useHuiStyles("Button", { root: style });
13
+ const cls = useHuiClasses("Button", recipe, rawProps);
14
+ const sls = useHuiStyles("Button", { root: rawProps.style });
15
15
  return /* @__PURE__ */ jsx(Component, {
16
16
  className: cls.root,
17
17
  style: sls.root,
@@ -19,7 +19,6 @@ function Button(rawProps) {
19
19
  children
20
20
  });
21
21
  }
22
- //#endregion
23
22
  export { Button };
24
23
 
25
24
  //# sourceMappingURL=button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","names":[],"sources":["../../../src/components/button/button.tsx"],"sourcesContent":["import { buttonRecipe, type ButtonSlots, type ButtonVariants } from \"@hebium-ui/core\";\nimport { type JSX, type VNode } from \"preact\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface ButtonOwnProps {\n /**\n * The visual style of the button.\n *\n * @default \"solid\"\n */\n variant?: ButtonVariants[\"variant\"] | undefined;\n /**\n * The semantic color of the button.\n *\n * @default \"accent\"\n */\n color?: ButtonVariants[\"color\"] | undefined;\n /**\n * The shape of the button.\n *\n * @default \"rectangle\"\n */\n shape?: ButtonVariants[\"shape\"] | undefined;\n}\n\nexport type ButtonProps<E extends JSX.ElementType = \"button\"> = HuiPolymorphicProps<\n E,\n ButtonOwnProps,\n ButtonSlots\n>;\n\nexport function Button<E extends JSX.ElementType = \"button\">(rawProps: ButtonProps<E>): VNode {\n const {\n as,\n variant,\n color,\n shape,\n className,\n style,\n children,\n ...restProps\n } = useHuiProps(\"Button\", rawProps);\n\n const Component = as ?? \"button\";\n const recipe = buttonRecipe({\n variant,\n color,\n shape,\n });\n const cls = useHuiClassNames(\"Button\", recipe, { root: className });\n const sls = useHuiStyles(\"Button\", { root: 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":";;;;AAgCA,SAAgB,OAA6C,UAAiC;CAC5F,MAAM,EACJ,IACA,SACA,OACA,OACA,WACA,OACA,UACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,YAAY,MAAM;CACxB,MAAM,SAAS,aAAa;EAC1B;EACA;EACA;CACF,CAAC;CACD,MAAM,MAAM,iBAAiB,UAAU,QAAQ,EAAE,MAAM,UAAU,CAAC;CAClE,MAAM,MAAM,aAAa,UAAU,EAAE,MAAM,MAAM,CAAC;CAElD,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
1
+ {"version":3,"file":"button.js","names":[],"sources":["../../../src/components/button/button.tsx"],"sourcesContent":["import { buttonRecipe, type ButtonSlots, type ButtonVariants } from \"@hebium-ui/core\";\nimport { type JSX, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface ButtonOwnProps {\n /**\n * The visual style of the button.\n *\n * @default \"solid\"\n */\n variant?: ButtonVariants[\"variant\"] | undefined;\n /**\n * The semantic color of the button.\n *\n * @default \"accent\"\n */\n color?: ButtonVariants[\"color\"] | undefined;\n /**\n * The shape of the button.\n *\n * @default \"rectangle\"\n */\n shape?: ButtonVariants[\"shape\"] | undefined;\n}\n\nexport type ButtonProps<E extends JSX.ElementType = \"button\"> = HuiPolymorphicProps<\n E,\n ButtonOwnProps,\n ButtonSlots\n>;\n\nexport function Button<E extends JSX.ElementType = \"button\">(rawProps: ButtonProps<E>): VNode {\n const {\n as,\n variant,\n color,\n shape,\n children,\n ...restProps\n } = useHuiProps(\"Button\", rawProps);\n\n const Component = as ?? \"button\";\n const recipe = buttonRecipe({\n variant,\n color,\n shape,\n });\n const cls = useHuiClasses(\"Button\", recipe, rawProps);\n const sls = useHuiStyles(\"Button\", { 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":";;;;AAgCA,SAAgB,OAA6C,UAAiC;CAC5F,MAAM,EACJ,IACA,SACA,OACA,OACA,UACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,YAAY,MAAM;CACxB,MAAM,SAAS,aAAa;EAC1B;EACA;EACA;CACF,CAAC;CACD,MAAM,MAAM,cAAc,UAAU,QAAQ,QAAQ;CACpD,MAAM,MAAM,aAAa,UAAU,EAAE,MAAM,SAAS,MAAM,CAAC;CAE3D,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
@@ -0,0 +1,32 @@
1
+ import { HuiComponentProps } from "../../types/hui-component.js";
2
+ import "../../types/index.js";
3
+ import { CheckboxSlots, CheckboxVariants } from "@hebium-ui/core";
4
+ import { ComponentChildren, ComponentProps, Signalish, VNode } from "preact";
5
+ interface CheckboxOwnProps {
6
+ /**
7
+ * The label displayed next to the checkbox.
8
+ */
9
+ label?: ComponentChildren | undefined;
10
+ /**
11
+ * The validation error message displayed below the label.
12
+ */
13
+ error?: ComponentChildren | undefined;
14
+ /**
15
+ * The semantic color of the checkbox control.
16
+ *
17
+ * @default "accent"
18
+ */
19
+ color?: CheckboxVariants["color"] | undefined;
20
+ /**
21
+ * The controlled indeterminate state. Update this prop in response to user interaction.
22
+ *
23
+ * @default false
24
+ */
25
+ indeterminate?: boolean | undefined;
26
+ }
27
+ export type CheckboxProps = HuiComponentProps<CheckboxOwnProps & Omit<Extract<ComponentProps<"input">, {
28
+ type: Signalish<"checkbox">;
29
+ }>, keyof CheckboxOwnProps | "children" | "type">, CheckboxSlots>;
30
+ export declare function Checkbox(rawProps: CheckboxProps): VNode;
31
+ export {};
32
+ //# sourceMappingURL=checkbox.d.ts.map
@@ -0,0 +1,84 @@
1
+ import { unwrapSignalish } from "../../utils/unwrap-signalish.js";
2
+ import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
3
+ import { checkboxControl, checkboxRecipe, toBool, toStrbool } from "@hebium-ui/core";
4
+ import { useCallback, useId, useImperativeHandle, useRef } from "preact/hooks";
5
+ import { jsx, jsxs } from "preact/jsx-runtime";
6
+ // src/components/checkbox/checkbox.tsx
7
+ function Checkbox(rawProps) {
8
+ const { id, label, error, color, indeterminate, onChange, ref, ...restProps } = useHuiProps("Checkbox", rawProps);
9
+ const tmpId = useId();
10
+ const committedRef = useRef(null);
11
+ const inputRef = useCallback((input) => {
12
+ if (input === null) {
13
+ committedRef.current = null;
14
+ return;
15
+ }
16
+ input.indeterminate = !!indeterminate;
17
+ committedRef.current = {
18
+ input,
19
+ indeterminate: !!indeterminate
20
+ };
21
+ }, [indeterminate]);
22
+ useImperativeHandle(ref ?? null, () => {
23
+ const committed = committedRef.current;
24
+ if (committed === null) throw new Error("[Hebium UI] Checkbox input ref is not attached");
25
+ return committed.input;
26
+ }, []);
27
+ const handleChange = useCallback((event) => {
28
+ const input = event.currentTarget;
29
+ onChange?.(event);
30
+ const committed = committedRef.current;
31
+ if (committed?.input === input) input.indeterminate = committed.indeterminate;
32
+ }, [onChange]);
33
+ const inputId = unwrapSignalish(id);
34
+ const disabled = restProps.disabled;
35
+ const ariaDisabled = restProps["aria-disabled"];
36
+ const checkboxState = {
37
+ id: inputId ?? tmpId,
38
+ invalid: !!error,
39
+ indeterminate: !!indeterminate,
40
+ disabled: toBool(unwrapSignalish(disabled)) || toBool(unwrapSignalish(ariaDisabled))
41
+ };
42
+ const recipe = checkboxRecipe({
43
+ color,
44
+ error: toStrbool(checkboxState.invalid)
45
+ });
46
+ const cls = useHuiClasses("Checkbox", recipe, rawProps);
47
+ const sls = useHuiStyles("Checkbox", rawProps.styles);
48
+ const controlAttrs = checkboxControl.getControlAttributes(checkboxState);
49
+ const labelAttrs = checkboxControl.getLabelAttributes(checkboxState);
50
+ const errorAttrs = checkboxControl.getErrorAttributes(checkboxState);
51
+ return /* @__PURE__ */ jsxs("div", {
52
+ className: cls.root,
53
+ style: sls.root,
54
+ children: [/* @__PURE__ */ jsx("input", {
55
+ ref: inputRef,
56
+ className: cls.checkbox,
57
+ style: sls.checkbox,
58
+ ...controlAttrs,
59
+ ...restProps,
60
+ onChange: handleChange
61
+ }), /* @__PURE__ */ jsxs("div", { children: [label && /* @__PURE__ */ jsx("label", {
62
+ className: cls.label,
63
+ style: sls.label,
64
+ ...labelAttrs,
65
+ children: label
66
+ }), error && /* @__PURE__ */ jsxs("p", {
67
+ className: cls.error,
68
+ style: sls.error,
69
+ ...errorAttrs,
70
+ children: [/* @__PURE__ */ jsx("span", {
71
+ "aria-hidden": true,
72
+ className: cls.errorIcon,
73
+ style: sls.errorIcon
74
+ }), /* @__PURE__ */ jsx("span", {
75
+ className: cls.errorMessage,
76
+ style: sls.errorMessage,
77
+ children: error
78
+ })]
79
+ })] })]
80
+ });
81
+ }
82
+ export { Checkbox };
83
+
84
+ //# sourceMappingURL=checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.js","names":[],"sources":["../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import {\n checkboxControl,\n checkboxRecipe,\n type CheckboxSlots,\n type CheckboxVariants,\n toBool,\n toStrbool,\n} from \"@hebium-ui/core\";\nimport { type ComponentChildren, type ComponentProps, type Signalish, type TargetedEvent, type VNode } from \"preact\";\nimport { useCallback, useId, useImperativeHandle, useRef } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\nimport { unwrapSignalish } from \"~/utils\";\n\ninterface CheckboxOwnProps {\n /**\n * The label displayed next to the checkbox.\n */\n label?: ComponentChildren | undefined;\n /**\n * The validation error message displayed below the label.\n */\n error?: ComponentChildren | undefined;\n /**\n * The semantic color of the checkbox control.\n *\n * @default \"accent\"\n */\n color?: CheckboxVariants[\"color\"] | undefined;\n /**\n * The controlled indeterminate state. Update this prop in response to user interaction.\n *\n * @default false\n */\n indeterminate?: boolean | undefined;\n}\n\nexport type CheckboxProps = HuiComponentProps<\n & CheckboxOwnProps\n & Omit<\n Extract<ComponentProps<\"input\">, { type: Signalish<\"checkbox\"> }>,\n keyof CheckboxOwnProps | \"children\" | \"type\"\n >,\n CheckboxSlots\n>;\n\nexport function Checkbox(rawProps: CheckboxProps): VNode {\n const {\n id,\n label,\n error,\n color,\n indeterminate,\n onChange,\n ref,\n ...restProps\n } = useHuiProps(\"Checkbox\", rawProps);\n\n const tmpId = useId();\n const committedRef = useRef<\n {\n input: HTMLInputElement;\n indeterminate: boolean;\n } | null\n >(null);\n\n const inputRef = useCallback((input: HTMLInputElement | null): void => {\n if (input === null) {\n committedRef.current = null;\n return;\n }\n\n input.indeterminate = !!indeterminate;\n committedRef.current = { input, indeterminate: !!indeterminate };\n }, [indeterminate]);\n\n useImperativeHandle(ref ?? null, () => {\n const committed = committedRef.current;\n if (committed === null) {\n throw new Error(\"[Hebium UI] Checkbox input ref is not attached\");\n }\n return committed.input;\n }, []);\n\n const handleChange = useCallback((event: TargetedEvent<HTMLInputElement>): void => {\n const input = event.currentTarget;\n onChange?.(event);\n\n // The user handler may have committed new props or unmounted the input.\n const committed = committedRef.current;\n if (committed?.input === input) input.indeterminate = committed.indeterminate;\n }, [onChange]);\n\n const inputId = unwrapSignalish(id);\n const disabled = restProps.disabled;\n const ariaDisabled = restProps[\"aria-disabled\"];\n const checkboxState = {\n id: inputId ?? tmpId,\n invalid: !!error,\n indeterminate: !!indeterminate,\n disabled: toBool(unwrapSignalish(disabled)) || toBool(unwrapSignalish(ariaDisabled)),\n };\n const recipe = checkboxRecipe({\n color,\n error: toStrbool(checkboxState.invalid),\n });\n const cls = useHuiClasses(\"Checkbox\", recipe, rawProps);\n const sls = useHuiStyles(\"Checkbox\", rawProps.styles);\n const controlAttrs = checkboxControl.getControlAttributes(checkboxState);\n const labelAttrs = checkboxControl.getLabelAttributes(checkboxState);\n const errorAttrs = checkboxControl.getErrorAttributes(checkboxState);\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n >\n <input\n ref={inputRef}\n className={cls.checkbox}\n style={sls.checkbox}\n {...controlAttrs}\n {...restProps}\n onChange={handleChange}\n />\n <div>\n {label && (\n <label\n className={cls.label}\n style={sls.label}\n {...labelAttrs}\n >\n {label}\n </label>\n )}\n {error && (\n <p\n className={cls.error}\n style={sls.error}\n {...errorAttrs}\n >\n <span\n aria-hidden\n className={cls.errorIcon}\n style={sls.errorIcon}\n />\n <span\n className={cls.errorMessage}\n style={sls.errorMessage}\n >\n {error}\n </span>\n </p>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AA8CA,SAAgB,SAAS,UAAgC;CACvD,MAAM,EACJ,IACA,OACA,OACA,OACA,eACA,UACA,KACA,GAAG,cACD,YAAY,YAAY,QAAQ;CAEpC,MAAM,QAAQ,MAAM;CACpB,MAAM,eAAe,OAKnB,IAAI;CAEN,MAAM,WAAW,aAAa,UAAyC;EACrE,IAAI,UAAU,MAAM;GAClB,aAAa,UAAU;GACvB;EACF;EAEA,MAAM,gBAAgB,CAAC,CAAC;EACxB,aAAa,UAAU;GAAE;GAAO,eAAe,CAAC,CAAC;EAAc;CACjE,GAAG,CAAC,aAAa,CAAC;CAElB,oBAAoB,OAAO,YAAY;EACrC,MAAM,YAAY,aAAa;EAC/B,IAAI,cAAc,MAChB,MAAM,IAAI,MAAM,gDAAgD;EAElE,OAAO,UAAU;CACnB,GAAG,CAAC,CAAC;CAEL,MAAM,eAAe,aAAa,UAAiD;EACjF,MAAM,QAAQ,MAAM;EACpB,WAAW,KAAK;EAGhB,MAAM,YAAY,aAAa;EAC/B,IAAI,WAAW,UAAU,OAAO,MAAM,gBAAgB,UAAU;CAClE,GAAG,CAAC,QAAQ,CAAC;CAEb,MAAM,UAAU,gBAAgB,EAAE;CAClC,MAAM,WAAW,UAAU;CAC3B,MAAM,eAAe,UAAU;CAC/B,MAAM,gBAAgB;EACpB,IAAI,WAAW;EACf,SAAS,CAAC,CAAC;EACX,eAAe,CAAC,CAAC;EACjB,UAAU,OAAO,gBAAgB,QAAQ,CAAC,KAAK,OAAO,gBAAgB,YAAY,CAAC;CACrF;CACA,MAAM,SAAS,eAAe;EAC5B;EACA,OAAO,UAAU,cAAc,OAAO;CACxC,CAAC;CACD,MAAM,MAAM,cAAc,YAAY,QAAQ,QAAQ;CACtD,MAAM,MAAM,aAAa,YAAY,SAAS,MAAM;CACpD,MAAM,eAAe,gBAAgB,qBAAqB,aAAa;CACvE,MAAM,aAAa,gBAAgB,mBAAmB,aAAa;CACnE,MAAM,aAAa,gBAAgB,mBAAmB,aAAa;CAEnE,OACE,qBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIE,oBAAC,SAAD;GACE,KAAK;GACL,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GACJ,GAAI;GACJ,UAAU;EACX,CAAA,GACD,qBAAC,OAAD,EAAA,UAAA,CACG,SACC,oBAAC,SAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH,UAAA;EACI,CAAA,GAER,SACC,qBAAC,KAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAHN,UAAA,CAKE,oBAAC,QAAD;IACE,eAAA;IACA,WAAW,IAAI;IACf,OAAO,IAAI;GACZ,CAAA,GACD,oBAAC,QAAD;IACE,WAAW,IAAI;IACf,OAAO,IAAI;IAEV,UAAA;GACG,CAAA,CACL;EAEF,CAAA,CAAA,EAAA,CAAA,CACF;;AAET"}
@@ -0,0 +1,2 @@
1
+ import { Checkbox, CheckboxProps } from "./checkbox.js";
2
+ export { Checkbox, CheckboxProps };
@@ -0,0 +1,9 @@
1
+ import { HuiPolymorphicProps } from "../../types/polymorphic.js";
2
+ import "../../types/index.js";
3
+ import { CodeSlots } from "@hebium-ui/core";
4
+ import { JSX, VNode } from "preact";
5
+ interface CodeOwnProps {}
6
+ export type CodeProps<E extends JSX.ElementType = "code"> = HuiPolymorphicProps<E, CodeOwnProps, CodeSlots>;
7
+ export declare function Code<E extends JSX.ElementType = "code">(rawProps: CodeProps<E>): VNode;
8
+ export {};
9
+ //# sourceMappingURL=code.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
+ import { codeRecipe } from "@hebium-ui/core";
3
+ import { jsx } from "preact/jsx-runtime";
4
+ // src/components/code/code.tsx
5
+ function Code(rawProps) {
6
+ const { as, children, ...restProps } = useHuiProps("Code", rawProps);
7
+ const recipe = codeRecipe();
8
+ const Component = as ?? "code";
9
+ const cls = useHuiClasses("Code", recipe, rawProps);
10
+ const sls = useHuiStyles("Code", { root: rawProps.style });
11
+ return /* @__PURE__ */ jsx(Component, {
12
+ className: cls.root,
13
+ style: sls.root,
14
+ ...restProps,
15
+ children
16
+ });
17
+ }
18
+ export { Code };
19
+
20
+ //# sourceMappingURL=code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code.js","names":[],"sources":["../../../src/components/code/code.tsx"],"sourcesContent":["import { codeRecipe, type CodeSlots } from \"@hebium-ui/core\";\nimport { type JSX, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface CodeOwnProps {}\n\nexport type CodeProps<E extends JSX.ElementType = \"code\"> = HuiPolymorphicProps<\n E,\n CodeOwnProps,\n CodeSlots\n>;\n\nexport function Code<E extends JSX.ElementType = \"code\">(rawProps: CodeProps<E>): VNode {\n const {\n as,\n children,\n ...restProps\n } = useHuiProps(\"Code\", rawProps);\n\n const recipe = codeRecipe();\n const Component = as ?? \"code\";\n\n const cls = useHuiClasses(\"Code\", recipe, rawProps);\n const sls = useHuiStyles(\"Code\", { root: rawProps.style });\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n"],"mappings":";;;;AAaA,SAAgB,KAAyC,UAA+B;CACtF,MAAM,EACJ,IACA,UACA,GAAG,cACD,YAAY,QAAQ,QAAQ;CAEhC,MAAM,SAAS,WAAW;CAC1B,MAAM,YAAY,MAAM;CAExB,MAAM,MAAM,cAAc,QAAQ,QAAQ,QAAQ;CAClD,MAAM,MAAM,aAAa,QAAQ,EAAE,MAAM,SAAS,MAAM,CAAC;CACzD,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
@@ -0,0 +1,2 @@
1
+ import { Code, CodeProps } from "./code.js";
2
+ export { Code, CodeProps };
@@ -0,0 +1,20 @@
1
+ import { HuiComponentProps } from "../../types/hui-component.js";
2
+ import "../../types/index.js";
3
+ import { DetailsSlots, DetailsVariants } from "@hebium-ui/core";
4
+ import { ComponentChildren, ComponentProps, VNode } from "preact";
5
+ interface DetailsOwnProps {
6
+ /**
7
+ * The summary displayed in the disclosure button.
8
+ */
9
+ summary: ComponentChildren;
10
+ /**
11
+ * The border style of the details container.
12
+ *
13
+ * @default "block"
14
+ */
15
+ border?: DetailsVariants["border"] | undefined;
16
+ }
17
+ export type DetailsProps = HuiComponentProps<ComponentProps<"details"> & DetailsOwnProps, DetailsSlots>;
18
+ export declare function Details(rawProps: DetailsProps): VNode;
19
+ export {};
20
+ //# sourceMappingURL=details.d.ts.map
@@ -0,0 +1,27 @@
1
+ import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
+ import { detailsRecipe } from "@hebium-ui/core";
3
+ import { jsx, jsxs } from "preact/jsx-runtime";
4
+ // src/components/details/details.tsx
5
+ function Details(rawProps) {
6
+ const { summary, border, children, ...restProps } = useHuiProps("Details", rawProps);
7
+ const recipe = detailsRecipe({ border });
8
+ const cls = useHuiClasses("Details", recipe, rawProps);
9
+ const sls = useHuiStyles("Details", rawProps.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
+ export { Details };
26
+
27
+ //# 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 ComponentChildren, type ComponentProps, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface DetailsOwnProps {\n /**\n * The summary displayed in the disclosure button.\n */\n summary: ComponentChildren;\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 ComponentProps<\"details\"> & DetailsOwnProps,\n DetailsSlots\n>;\n\nexport function Details(rawProps: DetailsProps): VNode {\n const {\n summary,\n border,\n children,\n ...restProps\n } = useHuiProps(\"Details\", rawProps);\n\n const recipe = detailsRecipe({ border });\n const cls = useHuiClasses(\"Details\", recipe, rawProps);\n const sls = useHuiStyles(\"Details\", rawProps.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,UAA+B;CACrD,MAAM,EACJ,SACA,QACA,UACA,GAAG,cACD,YAAY,WAAW,QAAQ;CAEnC,MAAM,SAAS,cAAc,EAAE,OAAO,CAAC;CACvC,MAAM,MAAM,cAAc,WAAW,QAAQ,QAAQ;CACrD,MAAM,MAAM,aAAa,WAAW,SAAS,MAAM;CAEnD,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,2 @@
1
+ import { Details, DetailsProps } from "./details.js";
2
+ export { Details, DetailsProps };
@@ -0,0 +1,2 @@
1
+ export declare function useDialogId(): string;
2
+ //# sourceMappingURL=dialog.context.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { useContext } from "preact/hooks";
2
+ import { createContext } from "preact";
3
+ // src/components/dialog/dialog.context.ts
4
+ const DialogContext = createContext(null);
5
+ function useDialogContext() {
6
+ const context = useContext(DialogContext);
7
+ if (!context) throw new Error("[Hebium UI] Dialog compound components must be used within <Dialog>");
8
+ return context;
9
+ }
10
+ function useDialogId() {
11
+ return useDialogContext().dialogId;
12
+ }
13
+ export { DialogContext, useDialogContext, useDialogId };
14
+
15
+ //# sourceMappingURL=dialog.context.js.map