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

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 (63) hide show
  1. package/dist/components/alert/alert.d.ts +3 -4
  2. package/dist/components/alert/alert.js +3 -10
  3. package/dist/components/alert/alert.js.map +1 -1
  4. package/dist/components/anchor/anchor.d.ts +1 -2
  5. package/dist/components/anchor/anchor.js +1 -1
  6. package/dist/components/anchor/anchor.js.map +1 -1
  7. package/dist/components/avatar/avatar.d.ts +1 -2
  8. package/dist/components/avatar/avatar.js +2 -2
  9. package/dist/components/avatar/avatar.js.map +1 -1
  10. package/dist/components/blockquote/blockquote.d.ts +1 -2
  11. package/dist/components/blockquote/blockquote.js +1 -1
  12. package/dist/components/blockquote/blockquote.js.map +1 -1
  13. package/dist/components/button/button.d.ts +12 -2
  14. package/dist/components/button/button.js +28 -8
  15. package/dist/components/button/button.js.map +1 -1
  16. package/dist/components/checkbox/checkbox.d.ts +1 -2
  17. package/dist/components/checkbox/checkbox.js +2 -2
  18. package/dist/components/checkbox/checkbox.js.map +1 -1
  19. package/dist/components/code/code.d.ts +1 -2
  20. package/dist/components/code/code.js +1 -1
  21. package/dist/components/code/code.js.map +1 -1
  22. package/dist/components/details/details.d.ts +1 -2
  23. package/dist/components/details/details.js +1 -1
  24. package/dist/components/details/details.js.map +1 -1
  25. package/dist/components/dialog/dialog.d.ts +4 -5
  26. package/dist/components/dialog/dialog.js +25 -12
  27. package/dist/components/dialog/dialog.js.map +1 -1
  28. package/dist/components/dialog/index.d.ts +1 -2
  29. package/dist/components/dl/dl.d.ts +1 -2
  30. package/dist/components/dl/dl.js +3 -3
  31. package/dist/components/dl/dl.js.map +1 -1
  32. package/dist/components/drawer/drawer.d.ts +4 -5
  33. package/dist/components/drawer/drawer.js +25 -12
  34. package/dist/components/drawer/drawer.js.map +1 -1
  35. package/dist/components/drawer/index.d.ts +1 -2
  36. package/dist/components/heading/heading.d.ts +1 -2
  37. package/dist/components/heading/heading.js +1 -1
  38. package/dist/components/heading/heading.js.map +1 -1
  39. package/dist/components/index.d.ts +7 -7
  40. package/dist/components/progress/progress.d.ts +1 -2
  41. package/dist/components/progress/progress.js +1 -1
  42. package/dist/components/progress/progress.js.map +1 -1
  43. package/dist/components/status-icon/index.d.ts +2 -0
  44. package/dist/components/status-icon/status-icon.d.ts +19 -0
  45. package/dist/components/status-icon/status-icon.js +22 -0
  46. package/dist/components/status-icon/status-icon.js.map +1 -0
  47. package/dist/components/tabs/tabs.context.d.ts +1 -2
  48. package/dist/components/tabs/tabs.d.ts +1 -2
  49. package/dist/components/tabs/tabs.js +5 -5
  50. package/dist/components/tabs/tabs.js.map +1 -1
  51. package/dist/index.d.ts +2 -3
  52. package/dist/index.js +2 -3
  53. package/dist/provider/hui-provider.context.d.ts +12 -8
  54. package/dist/provider/hui-provider.context.js +11 -7
  55. package/dist/provider/hui-provider.context.js.map +1 -1
  56. package/dist/provider/hui-provider.d.ts +1 -2
  57. package/dist/provider/index.d.ts +1 -1
  58. package/dist/types/hui-component.d.ts +3 -3
  59. package/dist/types/index.d.ts +2 -2
  60. package/dist/types/polymorphic.d.ts +7 -5
  61. package/package.json +11 -11
  62. package/dist/components/dialog/dialog.context.d.ts +0 -2
  63. package/dist/components/drawer/drawer.context.d.ts +0 -2
@@ -1 +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"}
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\", rawProps);\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\", rawProps);\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\", rawProps);\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,QAAQ;CACvC,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,QAAQ;CACzC,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,QAAQ;CACzC,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"}
@@ -16,8 +16,8 @@ export interface DrawerProps {
16
16
  }
17
17
  declare function DrawerRoot(rawProps: DrawerProps): VNode;
18
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;
19
+ export type DrawerTriggerProps<E extends JSX.ElementType = typeof Button<"button">> = HuiPolymorphicProps<E, DrawerTriggerOwnProps, ButtonSlots>;
20
+ declare function Trigger<E extends JSX.ElementType = typeof Button<"button">>(rawProps: DrawerTriggerProps<E>): VNode;
21
21
  interface DrawerContentOwnProps {
22
22
  /**
23
23
  * The edge from which the drawer enters.
@@ -42,7 +42,7 @@ interface DrawerContentOwnProps {
42
42
  /**
43
43
  * Additional props passed to the internal close button.
44
44
  */
45
- closeButtonProps?: Omit<DrawerCloseProps, "children" | "class" | "className" | "style"> | undefined;
45
+ closeButtonProps?: Omit<DrawerCloseProps, "children" | "classes" | "styles"> | undefined;
46
46
  }
47
47
  export type DrawerContentProps = HuiComponentProps<Omit<ComponentProps<"dialog">, "id" | "open"> & DrawerContentOwnProps, DrawerSlots>;
48
48
  declare function Content(rawProps: DrawerContentProps): VNode;
@@ -61,5 +61,4 @@ export declare const Drawer: typeof DrawerRoot & {
61
61
  Content: typeof Content;
62
62
  Close: typeof Close;
63
63
  };
64
- export {};
65
- //# sourceMappingURL=drawer.d.ts.map
64
+ export {};
@@ -1,5 +1,5 @@
1
- import { unwrapSignalish } from "../../utils/unwrap-signalish.js";
2
1
  import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
+ import { unwrapSignalish } from "../../utils/unwrap-signalish.js";
3
3
  import { Button } from "../button/button.js";
4
4
  import { Heading } from "../heading/heading.js";
5
5
  import { DrawerContext, useDrawerContext, useDrawerId } from "./drawer.context.js";
@@ -7,6 +7,12 @@ import { dialogControl, drawerRecipe } from "@hebium-ui/core";
7
7
  import { useId, useMemo } from "preact/hooks";
8
8
  import { jsx, jsxs } from "preact/jsx-runtime";
9
9
  // src/components/drawer/drawer.tsx
10
+ const BUTTON_CLASSES = {
11
+ root: "",
12
+ content: "",
13
+ spinner: "",
14
+ status: ""
15
+ };
10
16
  function DrawerRoot(rawProps) {
11
17
  const { id, children } = useHuiProps("Drawer", rawProps);
12
18
  const tmpId = useId();
@@ -20,8 +26,8 @@ function DrawerRoot(rawProps) {
20
26
  function Trigger(rawProps) {
21
27
  const { as, children, onClick, ...restProps } = useHuiProps("DrawerTrigger", rawProps);
22
28
  const Component = as ?? Button;
23
- const cls = useHuiClasses("DrawerTrigger", { root: "" }, rawProps);
24
- const sls = useHuiStyles("DrawerTrigger", { root: rawProps.style });
29
+ const cls = useHuiClasses("DrawerTrigger", BUTTON_CLASSES, rawProps);
30
+ const sls = useHuiStyles("DrawerTrigger", rawProps);
25
31
  const { drawerId } = useDrawerContext();
26
32
  const attrs = dialogControl.getTriggerAttributes({ id: drawerId }, {
27
33
  modal: true,
@@ -29,8 +35,13 @@ function Trigger(rawProps) {
29
35
  });
30
36
  return /* @__PURE__ */ jsx(Component, {
31
37
  ...attrs,
32
- className: cls.root,
33
- style: sls.root,
38
+ ...Component === Button ? {
39
+ classes: cls,
40
+ styles: sls
41
+ } : {
42
+ className: cls.root,
43
+ style: sls.root
44
+ },
34
45
  onClick,
35
46
  ...restProps,
36
47
  children
@@ -51,7 +62,9 @@ function Content(rawProps) {
51
62
  const headingLevel = headingProps?.level ?? 2;
52
63
  const recipe = drawerRecipe({ placement });
53
64
  const cls = useHuiClasses("DrawerContent", recipe, rawProps);
54
- const sls = useHuiStyles("DrawerContent", rawProps.styles);
65
+ const sls = useHuiStyles("DrawerContent", rawProps);
66
+ const closeButtonClasses = useMemo(() => ({ root: cls.closeButton }), [cls.closeButton]);
67
+ const closeButtonStyles = useMemo(() => ({ root: sls.closeButton }), [sls.closeButton]);
55
68
  const shouldRenderCloseButton = closeButton !== null && closeButton !== false;
56
69
  const shouldRenderHeader = headingId !== void 0 || shouldRenderCloseButton;
57
70
  const closeButtonContent = closeButton === void 0 ? /* @__PURE__ */ jsx("span", {
@@ -76,8 +89,8 @@ function Content(rawProps) {
76
89
  level: headingLevel,
77
90
  children: resolvedHeading
78
91
  }), shouldRenderCloseButton && /* @__PURE__ */ jsx(Close, {
79
- className: cls.closeButton,
80
- style: sls.closeButton,
92
+ classes: closeButtonClasses,
93
+ styles: closeButtonStyles,
81
94
  "aria-label": "Close Drawer",
82
95
  variant: "ghost",
83
96
  color: "neutral",
@@ -90,15 +103,15 @@ function Content(rawProps) {
90
103
  }
91
104
  function Close(rawProps) {
92
105
  const props = useHuiProps("DrawerClose", rawProps);
93
- const cls = useHuiClasses("DrawerClose", { root: "" }, rawProps);
94
- const sls = useHuiStyles("DrawerClose", { root: rawProps.style });
106
+ const cls = useHuiClasses("DrawerClose", BUTTON_CLASSES, rawProps);
107
+ const sls = useHuiStyles("DrawerClose", rawProps);
95
108
  const drawerId = useDrawerId();
96
109
  const attrs = dialogControl.getCloseAttributes({ id: drawerId });
97
110
  return /* @__PURE__ */ jsx(Button, {
98
111
  ...attrs,
99
112
  ...props,
100
- className: cls.root,
101
- style: sls.root
113
+ classes: cls,
114
+ styles: sls
102
115
  });
103
116
  }
104
117
  const Drawer = Object.assign(DrawerRoot, {
@@ -1 +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":";;;;;;;;;AAkBA,SAAS,WAAW,UAA8B;CAChD,MAAM,EACJ,IACA,aACE,YAAY,UAAU,QAAQ;CAElC,MAAM,QAAQ,MAAM;CACpB,MAAM,WAAW,MAAM;CAEvB,MAAM,eAAe,eAAmC,EACtD,SACF,IAAI,CAAC,QAAQ,CAAC;CAEd,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;EAC5B;CACqB,CAAA;AAE5B;AASA,SAAS,QAAmD,UAAwC;CAClG,MAAM,EACJ,IACA,UACA,SACA,GAAG,cACD,YAAY,iBAAiB,QAAQ;CAEzC,MAAM,YA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AO,IAAI;CAAkB,CAAA,IAC/E;CAEJ,OACE,qBAAC,UAAD;EACE,GAAI;EACJ,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAJN,UAAA,CAMG,sBACC,qBAAC,OAAD;GAAK,WAAW,IAAI;GAAQ,OAAO,IAAI;GAAvC,UAAA,CACG,aACC,oBAAC,SAAD;IACE,QAAO;IACP,GAAI;IACJ,GAAI;IACJ,WAAW,IAAI;IACf,OAAO,IAAI;IACX,OAAO;IAEN,UAAA;GACM,CAAA,GAEV,2BACC,oBAAC,OAAD;IACE,WAAW,IAAI;IACf,OAAO,IAAI;IACX,cAAW;IACX,SAAQ;IACR,OAAM;IACN,OAAM;IACN,GAAI;IAEH,UAAA;GACI,CAAA,CAEN;EAEN,CAAA,GAAA,QACK;;AAEZ;AAYA,SAAS,MAAM,UAAmC;CAChD,MAAM,QAAQ,YAAY,eAAe,QAAQ;CACjD,MAAM,MAAM,cAAc,eAAe,EAAE,MAAM,GAAG,GAAG,QAAQ;CAC/D,MAAM,MAAM,aAAa,eAAe,EAAE,MAAM,SAAS,MAAM,CAAC;CAChE,MAAM,WAAW,YAAY;CAC7B,MAAM,QAAQ,cAAc,mBAAmB,EAAE,IAAI,SAAS,CAAC;CAE/D,OACE,oBAAC,QAAD;EACE,GAAI;EACJ,GAAI;EACJ,WAAW,IAAI;EACf,OAAO,IAAI;CACZ,CAAA;AAEL;AAEA,MAAa,SAAS,OAAO,OAAO,YAAY;CAC9C;CACA;CACA;AACF,CAAC"}
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\nconst BUTTON_CLASSES = { root: \"\", content: \"\", spinner: \"\", status: \"\" } satisfies Record<ButtonSlots, string>;\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<\"button\">> = HuiPolymorphicProps<\n E,\n DrawerTriggerOwnProps,\n ButtonSlots\n>;\n\nfunction Trigger<E extends JSX.ElementType = typeof Button<\"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\", BUTTON_CLASSES, rawProps);\n const sls = useHuiStyles(\"DrawerTrigger\", rawProps);\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 {...(Component === Button\n ? { classes: cls, styles: sls }\n : { className: cls.root, 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\" | \"classes\" | \"styles\"> | 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);\n const closeButtonClasses = useMemo(() => ({ root: cls.closeButton }), [cls.closeButton]);\n const closeButtonStyles = useMemo(() => ({ root: sls.closeButton }), [sls.closeButton]);\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 classes={closeButtonClasses}\n styles={closeButtonStyles}\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\", BUTTON_CLASSES, rawProps);\n const sls = useHuiStyles(\"DrawerClose\", rawProps);\n const drawerId = useDrawerId();\n const attrs = dialogControl.getCloseAttributes({ id: drawerId });\n\n return (\n <Button\n {...attrs}\n {...props}\n classes={cls}\n styles={sls}\n />\n );\n}\n\nexport const Drawer = Object.assign(DrawerRoot, {\n Trigger,\n Content,\n Close,\n});\n"],"mappings":";;;;;;;;;AAUA,MAAM,iBAAiB;CAAE,MAAM;CAAI,SAAS;CAAI,SAAS;CAAI,QAAQ;AAAG;AAUxE,SAAS,WAAW,UAA8B;CAChD,MAAM,EACJ,IACA,aACE,YAAY,UAAU,QAAQ;CAElC,MAAM,QAAQ,MAAM;CACpB,MAAM,WAAW,MAAM;CAEvB,MAAM,eAAe,eAAmC,EACtD,SACF,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;CAC9C;CACA;CACA;AACF,CAAC"}
@@ -1,3 +1,2 @@
1
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 };
2
+ export { Drawer, DrawerCloseProps, DrawerContentProps, DrawerProps, DrawerTriggerProps };
@@ -18,5 +18,4 @@ interface HeadingOwnProps {
18
18
  }
19
19
  export type HeadingProps = HuiComponentProps<ComponentProps<"h2"> & HeadingOwnProps, HeadingSlots>;
20
20
  export declare function Heading(rawProps: HeadingProps): VNode;
21
- export {};
22
- //# sourceMappingURL=heading.d.ts.map
21
+ export {};
@@ -10,7 +10,7 @@ function Heading(rawProps) {
10
10
  margin
11
11
  });
12
12
  const cls = useHuiClasses("Heading", recipe, rawProps);
13
- const sls = useHuiStyles("Heading", { root: rawProps.style });
13
+ const sls = useHuiStyles("Heading", rawProps);
14
14
  return /* @__PURE__ */ jsx(Component, {
15
15
  className: cls.root,
16
16
  style: sls.root,
@@ -1 +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"}
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\", rawProps);\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,QAAQ;CAE5C,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
@@ -15,17 +15,17 @@ import "./code/index.js";
15
15
  import { Details, DetailsProps } from "./details/details.js";
16
16
  import "./details/index.js";
17
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
18
  import "./dialog/index.js";
22
- import { DdProps, Dl, DlProps, DtProps } from "./dl/dl.js";
19
+ import { Dialog, DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps } from "./dialog/dialog.js";
23
20
  import "./dl/index.js";
24
- import { Drawer, DrawerCloseProps, DrawerContentProps, DrawerProps, DrawerTriggerProps } from "./drawer/drawer.js";
25
- import { useDrawerId } from "./drawer/drawer.context.js";
21
+ import { DdProps, Dl, DlProps, DtProps } from "./dl/dl.js";
26
22
  import "./drawer/index.js";
23
+ import { Drawer, DrawerCloseProps, DrawerContentProps, DrawerProps, DrawerTriggerProps } from "./drawer/drawer.js";
24
+ import "./heading/index.js";
27
25
  import { Progress, ProgressProps } from "./progress/progress.js";
28
26
  import "./progress/index.js";
27
+ import { StatusIcon, StatusIconProps } from "./status-icon/status-icon.js";
28
+ import "./status-icon/index.js";
29
29
  import { Tabs, TabsListProps, TabsPanelProps, TabsProps, TabsTabProps } from "./tabs/tabs.js";
30
30
  import "./tabs/index.js";
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 };
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, StatusIcon, StatusIconProps, Tabs, TabsListProps, TabsPanelProps, TabsProps, TabsTabProps };
@@ -48,5 +48,4 @@ interface ProgressOwnProps {
48
48
  }
49
49
  export type ProgressProps = HuiComponentProps<ComponentProps<"div"> & ProgressOwnProps, ProgressSlots>;
50
50
  export declare function Progress(rawProps: ProgressProps): VNode;
51
- export {};
52
- //# sourceMappingURL=progress.d.ts.map
51
+ export {};
@@ -21,7 +21,7 @@ function Progress(rawProps) {
21
21
  size
22
22
  });
23
23
  const cls = useHuiClasses("Progress", recipe, rawProps);
24
- const sls = useHuiStyles("Progress", rawProps.styles);
24
+ const sls = useHuiStyles("Progress", rawProps);
25
25
  const labelAttrs = progressControl.getLabelAttributes(progress);
26
26
  const barAttrs = progressControl.getBarAttributes(progress);
27
27
  const valueAttrs = progressControl.getValueAttributes();
@@ -1 +1 @@
1
- {"version":3,"file":"progress.js","names":[],"sources":["../../../src/components/progress/progress.tsx"],"sourcesContent":["import {\n cc,\n CSS_VARS,\n progressControl,\n progressRecipe,\n type ProgressSlots,\n type ProgressVariants,\n toStrbool,\n} from \"@hebium-ui/core\";\nimport { type ComponentChildren, type ComponentProps, type VNode } from \"preact\";\nimport { useId } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface ProgressOwnProps {\n /**\n * The minimum value of the progress range.\n *\n * @default 0\n */\n min?: number | undefined;\n /**\n * The maximum value of the progress range.\n *\n * @default 100\n */\n max?: number | undefined;\n /**\n * The current value of the progress. Omit this prop when progress is indeterminate.\n */\n value?: number | undefined;\n /**\n * The human-readable text alternative for the current value.\n */\n valueText?: string | undefined;\n /**\n * The label displayed above the progressbar.\n */\n label?: ComponentChildren | undefined;\n /**\n * The semantic color of the progressbar.\n *\n * @default \"accent\"\n */\n color?: ProgressVariants[\"color\"] | undefined;\n /**\n * The border radius of the progressbar.\n *\n * @default \"rounded\"\n */\n radius?: ProgressVariants[\"radius\"] | undefined;\n /**\n * The size of the progressbar.\n *\n * @default \"md\"\n */\n size?: ProgressVariants[\"size\"] | undefined;\n}\n\nexport type ProgressProps = HuiComponentProps<ComponentProps<\"div\"> & ProgressOwnProps, ProgressSlots>;\n\nexport function Progress(rawProps: ProgressProps): VNode {\n const {\n min,\n max,\n value,\n valueText,\n label,\n color,\n radius,\n size,\n nonce,\n children: _children,\n ...restProps\n } = useHuiProps(\"Progress\", rawProps);\n const progressId = useId();\n const progress = progressControl.resolve({\n progressId,\n hasLabel: Boolean(label),\n min,\n max,\n value,\n valueText,\n });\n\n const recipe = progressRecipe({\n color,\n indeterminate: toStrbool(progress.isIndeterminate),\n radius,\n size,\n });\n const cls = useHuiClasses(\"Progress\", recipe, rawProps);\n const sls = useHuiStyles(\"Progress\", rawProps.styles);\n const labelAttrs = progressControl.getLabelAttributes(progress);\n const barAttrs = progressControl.getBarAttributes(progress);\n const valueAttrs = progressControl.getValueAttributes();\n const valueClassName = `progress-value-${progress.progressId}`;\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n >\n {label\n && (\n <div\n className={cls.label}\n style={sls.label}\n {...labelAttrs}\n >\n {label}\n </div>\n )}\n <div\n className={cls.bar}\n style={sls.bar}\n {...barAttrs}\n {...restProps}\n >\n <style nonce={nonce}>\n {`.${valueClassName} {${CSS_VARS.arbitraryWidth}: ${progress.width}}`}\n </style>\n <div\n className={cc(cls.value, valueClassName)}\n style={sls.value}\n {...valueAttrs}\n >\n {progress.isIndeterminate ? undefined : valueText}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;AA6DA,SAAgB,SAAS,UAAgC;CACvD,MAAM,EACJ,KACA,KACA,OACA,WACA,OACA,OACA,QACA,MACA,OACA,UAAU,WACV,GAAG,cACD,YAAY,YAAY,QAAQ;CACpC,MAAM,aAAa,MAAM;CACzB,MAAM,WAAW,gBAAgB,QAAQ;EACvC;EACA,UAAU,QAAQ,KAAK;EACvB;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,SAAS,eAAe;EAC5B;EACA,eAAe,UAAU,SAAS,eAAe;EACjD;EACA;CACF,CAAC;CACD,MAAM,MAAM,cAAc,YAAY,QAAQ,QAAQ;CACtD,MAAM,MAAM,aAAa,YAAY,SAAS,MAAM;CACpD,MAAM,aAAa,gBAAgB,mBAAmB,QAAQ;CAC9D,MAAM,WAAW,gBAAgB,iBAAiB,QAAQ;CAC1D,MAAM,aAAa,gBAAgB,mBAAmB;CACtD,MAAM,iBAAiB,kBAAkB,SAAS;CAElD,OACE,qBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIG,SAEG,oBAAC,OAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH,UAAA;EACE,CAAA,GAET,qBAAC,OAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GACJ,GAAI;GAJN,UAAA,CAME,oBAAC,SAAD;IAAc;IACX,UAAA,IAAI,eAAe,IAAI,SAAS,eAAe,IAAI,SAAS,MAAM;GAC9D,CAAA,GACP,oBAAC,OAAD;IACE,WAAW,GAAG,IAAI,OAAO,cAAc;IACvC,OAAO,IAAI;IACX,GAAI;IAEH,UAAA,SAAS,kBAAkB,KAAA,IAAY;GACrC,CAAA,CACF;EACF,CAAA,CAAA;;AAET"}
1
+ {"version":3,"file":"progress.js","names":[],"sources":["../../../src/components/progress/progress.tsx"],"sourcesContent":["import {\n cc,\n CSS_VARS,\n progressControl,\n progressRecipe,\n type ProgressSlots,\n type ProgressVariants,\n toStrbool,\n} from \"@hebium-ui/core\";\nimport { type ComponentChildren, type ComponentProps, type VNode } from \"preact\";\nimport { useId } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface ProgressOwnProps {\n /**\n * The minimum value of the progress range.\n *\n * @default 0\n */\n min?: number | undefined;\n /**\n * The maximum value of the progress range.\n *\n * @default 100\n */\n max?: number | undefined;\n /**\n * The current value of the progress. Omit this prop when progress is indeterminate.\n */\n value?: number | undefined;\n /**\n * The human-readable text alternative for the current value.\n */\n valueText?: string | undefined;\n /**\n * The label displayed above the progressbar.\n */\n label?: ComponentChildren | undefined;\n /**\n * The semantic color of the progressbar.\n *\n * @default \"accent\"\n */\n color?: ProgressVariants[\"color\"] | undefined;\n /**\n * The border radius of the progressbar.\n *\n * @default \"rounded\"\n */\n radius?: ProgressVariants[\"radius\"] | undefined;\n /**\n * The size of the progressbar.\n *\n * @default \"md\"\n */\n size?: ProgressVariants[\"size\"] | undefined;\n}\n\nexport type ProgressProps = HuiComponentProps<ComponentProps<\"div\"> & ProgressOwnProps, ProgressSlots>;\n\nexport function Progress(rawProps: ProgressProps): VNode {\n const {\n min,\n max,\n value,\n valueText,\n label,\n color,\n radius,\n size,\n nonce,\n children: _children,\n ...restProps\n } = useHuiProps(\"Progress\", rawProps);\n const progressId = useId();\n const progress = progressControl.resolve({\n progressId,\n hasLabel: Boolean(label),\n min,\n max,\n value,\n valueText,\n });\n\n const recipe = progressRecipe({\n color,\n indeterminate: toStrbool(progress.isIndeterminate),\n radius,\n size,\n });\n const cls = useHuiClasses(\"Progress\", recipe, rawProps);\n const sls = useHuiStyles(\"Progress\", rawProps);\n const labelAttrs = progressControl.getLabelAttributes(progress);\n const barAttrs = progressControl.getBarAttributes(progress);\n const valueAttrs = progressControl.getValueAttributes();\n const valueClassName = `progress-value-${progress.progressId}`;\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n >\n {label\n && (\n <div\n className={cls.label}\n style={sls.label}\n {...labelAttrs}\n >\n {label}\n </div>\n )}\n <div\n className={cls.bar}\n style={sls.bar}\n {...barAttrs}\n {...restProps}\n >\n <style nonce={nonce}>\n {`.${valueClassName} {${CSS_VARS.arbitraryWidth}: ${progress.width}}`}\n </style>\n <div\n className={cc(cls.value, valueClassName)}\n style={sls.value}\n {...valueAttrs}\n >\n {progress.isIndeterminate ? undefined : valueText}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;AA6DA,SAAgB,SAAS,UAAgC;CACvD,MAAM,EACJ,KACA,KACA,OACA,WACA,OACA,OACA,QACA,MACA,OACA,UAAU,WACV,GAAG,cACD,YAAY,YAAY,QAAQ;CACpC,MAAM,aAAa,MAAM;CACzB,MAAM,WAAW,gBAAgB,QAAQ;EACvC;EACA,UAAU,QAAQ,KAAK;EACvB;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,SAAS,eAAe;EAC5B;EACA,eAAe,UAAU,SAAS,eAAe;EACjD;EACA;CACF,CAAC;CACD,MAAM,MAAM,cAAc,YAAY,QAAQ,QAAQ;CACtD,MAAM,MAAM,aAAa,YAAY,QAAQ;CAC7C,MAAM,aAAa,gBAAgB,mBAAmB,QAAQ;CAC9D,MAAM,WAAW,gBAAgB,iBAAiB,QAAQ;CAC1D,MAAM,aAAa,gBAAgB,mBAAmB;CACtD,MAAM,iBAAiB,kBAAkB,SAAS;CAElD,OACE,qBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIG,SAEG,oBAAC,OAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH,UAAA;EACE,CAAA,GAET,qBAAC,OAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GACJ,GAAI;GAJN,UAAA,CAME,oBAAC,SAAD;IAAc;IACX,UAAA,IAAI,eAAe,IAAI,SAAS,eAAe,IAAI,SAAS,MAAM;GAC9D,CAAA,GACP,oBAAC,OAAD;IACE,WAAW,GAAG,IAAI,OAAO,cAAc;IACvC,OAAO,IAAI;IACX,GAAI;IAEH,UAAA,SAAS,kBAAkB,KAAA,IAAY;GACrC,CAAA,CACF;EACF,CAAA,CAAA;;AAET"}
@@ -0,0 +1,2 @@
1
+ import { StatusIcon, StatusIconProps } from "./status-icon.js";
2
+ export { StatusIcon, StatusIconProps };
@@ -0,0 +1,19 @@
1
+ import { HuiComponentProps } from "../../types/hui-component.js";
2
+ import "../../types/index.js";
3
+ import { StatusIconSlots, StatusIconVariants } from "@hebium-ui/core";
4
+ import { ComponentProps, VNode } from "preact";
5
+ interface StatusIconOwnProps {
6
+ /**
7
+ * Status to display.
8
+ */
9
+ status: NonNullable<StatusIconVariants["status"]>;
10
+ /**
11
+ * Icon color.
12
+ *
13
+ * @default "inherit"
14
+ */
15
+ color?: StatusIconVariants["color"] | undefined;
16
+ }
17
+ export type StatusIconProps = HuiComponentProps<Omit<ComponentProps<"span">, "children" | "color"> & StatusIconOwnProps, StatusIconSlots>;
18
+ export declare function StatusIcon(rawProps: StatusIconProps): VNode;
19
+ export {};
@@ -0,0 +1,22 @@
1
+ import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
+ import { statusIconRecipe } from "@hebium-ui/core";
3
+ import { jsx } from "preact/jsx-runtime";
4
+ // src/components/status-icon/status-icon.tsx
5
+ function StatusIcon(rawProps) {
6
+ const { status, color, ...restProps } = useHuiProps("StatusIcon", rawProps);
7
+ const recipe = statusIconRecipe({
8
+ status,
9
+ color
10
+ });
11
+ const cls = useHuiClasses("StatusIcon", recipe, rawProps);
12
+ const sls = useHuiStyles("StatusIcon", rawProps);
13
+ return /* @__PURE__ */ jsx("span", {
14
+ "aria-hidden": true,
15
+ className: cls.root,
16
+ style: sls.root,
17
+ ...restProps
18
+ });
19
+ }
20
+ export { StatusIcon };
21
+
22
+ //# sourceMappingURL=status-icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-icon.js","names":[],"sources":["../../../src/components/status-icon/status-icon.tsx"],"sourcesContent":["import { statusIconRecipe, type StatusIconSlots, type StatusIconVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface StatusIconOwnProps {\n /**\n * Status to display.\n */\n status: NonNullable<StatusIconVariants[\"status\"]>;\n /**\n * Icon color.\n *\n * @default \"inherit\"\n */\n color?: StatusIconVariants[\"color\"] | undefined;\n}\n\nexport type StatusIconProps = HuiComponentProps<\n Omit<ComponentProps<\"span\">, \"children\" | \"color\"> & StatusIconOwnProps,\n StatusIconSlots\n>;\n\nexport function StatusIcon(rawProps: StatusIconProps): VNode {\n const {\n status,\n color,\n ...restProps\n } = useHuiProps(\"StatusIcon\", rawProps);\n const recipe = statusIconRecipe({\n status,\n color,\n });\n\n const cls = useHuiClasses(\"StatusIcon\", recipe, rawProps);\n const sls = useHuiStyles(\"StatusIcon\", rawProps);\n\n return (\n <span\n aria-hidden\n className={cls.root}\n style={sls.root}\n {...restProps}\n />\n );\n}\n"],"mappings":";;;;AAuBA,SAAgB,WAAW,UAAkC;CAC3D,MAAM,EACJ,QACA,OACA,GAAG,cACD,YAAY,cAAc,QAAQ;CACtC,MAAM,SAAS,iBAAiB;EAC9B;EACA;CACF,CAAC;CAED,MAAM,MAAM,cAAc,cAAc,QAAQ,QAAQ;CACxD,MAAM,MAAM,aAAa,cAAc,QAAQ;CAE/C,OACE,oBAAC,QAAD;EACE,eAAA;EACA,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;CACL,CAAA;AAEL"}
@@ -1,2 +1 @@
1
- export type ActivationMode = "manual" | "auto";
2
- //# sourceMappingURL=tabs.context.d.ts.map
1
+ export type ActivationMode = "manual" | "auto";
@@ -54,5 +54,4 @@ export declare const Tabs: typeof TabsRoot & {
54
54
  Tab: typeof Tab;
55
55
  Panel: typeof Panel;
56
56
  };
57
- export {};
58
- //# sourceMappingURL=tabs.d.ts.map
57
+ export {};
@@ -1,5 +1,5 @@
1
- import { unwrapSignalish } from "../../utils/unwrap-signalish.js";
2
1
  import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
+ import { unwrapSignalish } from "../../utils/unwrap-signalish.js";
3
3
  import { TabsContext, useTabsContext } from "./tabs.context.js";
4
4
  import { tabRecipe, tablistRecipe, tabpanelRecipe, tabrootRecipe, tabsControl } from "@hebium-ui/core";
5
5
  import { useCallback, useId, useMemo, useState } from "preact/hooks";
@@ -14,7 +14,7 @@ function TabsRoot(rawProps) {
14
14
  const selectedValue = value ?? uncontrolledValue;
15
15
  const recipe = tabrootRecipe({});
16
16
  const cls = useHuiClasses("Tabs", recipe, rawProps);
17
- const sls = useHuiStyles("Tabs", { root: rawProps.style });
17
+ const sls = useHuiStyles("Tabs", rawProps);
18
18
  const onSelect = useCallback((nextValue) => {
19
19
  if (!values.includes(nextValue)) throw new Error(`[Hebium UI] Unexpected Tab value: ${nextValue}`);
20
20
  const v = nextValue;
@@ -52,7 +52,7 @@ function List(rawProps) {
52
52
  const Component = as ?? "div";
53
53
  const recipe = tablistRecipe({});
54
54
  const cls = useHuiClasses("TabsList", recipe, rawProps);
55
- const sls = useHuiStyles("TabsList", { root: rawProps.style });
55
+ const sls = useHuiStyles("TabsList", rawProps);
56
56
  const { rootId, selectedValue } = useTabsContext();
57
57
  const attrs = tabsControl.getListAttributes({
58
58
  rootId,
@@ -75,7 +75,7 @@ function Tab(rawProps) {
75
75
  const { rootId, selectedValue, onSelect, activation } = useTabsContext();
76
76
  const recipe = tabRecipe({});
77
77
  const cls = useHuiClasses("TabsTab", recipe, rawProps);
78
- const sls = useHuiStyles("TabsTab", { root: rawProps.style });
78
+ const sls = useHuiStyles("TabsTab", rawProps);
79
79
  const attrs = tabsControl.getTabAttributes({
80
80
  rootId,
81
81
  selectedValue
@@ -134,7 +134,7 @@ function Panel(rawProps) {
134
134
  const { rootId, selectedValue } = useTabsContext();
135
135
  const recipe = tabpanelRecipe({});
136
136
  const cls = useHuiClasses("TabsPanel", recipe, rawProps);
137
- const sls = useHuiStyles("TabsPanel", { root: rawProps.style });
137
+ const sls = useHuiStyles("TabsPanel", rawProps);
138
138
  const attrs = tabsControl.getPanelAttributes({
139
139
  rootId,
140
140
  selectedValue
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.js","names":[],"sources":["../../../src/components/tabs/tabs.tsx"],"sourcesContent":["import {\n tablistRecipe,\n type TablistSlots,\n tabpanelRecipe,\n type TabpanelSlots,\n tabRecipe,\n tabrootRecipe,\n type TabrootSlots,\n tabsControl,\n type TabSlots,\n} from \"@hebium-ui/core\";\nimport {\n type JSX,\n type TargetedFocusEvent,\n type TargetedKeyboardEvent,\n type TargetedMouseEvent,\n type VNode,\n} from \"preact\";\nimport { useCallback, useId, useMemo, useState } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\nimport { unwrapSignalish } from \"~/utils\";\nimport { type ActivationMode, TabsContext, type TabsContextValue, useTabsContext } from \"./tabs.context\";\n\ninterface TabsOwnProps<V extends string> {\n /**\n * The list of allowed tab values.\n */\n values: readonly V[];\n /**\n * The currently selected tab value.\n */\n value?: V | undefined;\n /**\n * The initially selected tab value for uncontrolled tabs.\n */\n defaultValue?: V | undefined;\n /**\n * Called when the selected tab value changes.\n */\n onChange?: ((value: V) => void) | undefined;\n /**\n * The activation mode used when focus moves between tabs.\n *\n * @default \"manual\"\n * @see {@link https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_selection_follows_focus | WAI-ARIA APG: Deciding When to Make Selection Automatically Follow Focus}\n */\n activation?: ActivationMode;\n}\nexport type TabsProps<V extends string, E extends JSX.ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n TabsOwnProps<V>,\n TabrootSlots\n>;\n\nfunction TabsRoot<V extends string, E extends JSX.ElementType = \"div\">(\n rawProps: TabsProps<V, E>,\n): VNode {\n const {\n as,\n id,\n values,\n value,\n defaultValue,\n onChange,\n children,\n activation = \"manual\",\n ...restProps\n } = useHuiProps(\"Tabs\", rawProps);\n\n const Component = as ?? \"div\";\n\n const tmpId = useId();\n const rootId = unwrapSignalish(id) || tmpId;\n const [uncontrolledValue, setUncontrolledValue] = useState<V | undefined>(\n () => value ?? defaultValue ?? values[0],\n );\n const selectedValue = value ?? uncontrolledValue;\n const recipe = tabrootRecipe({});\n const cls = useHuiClasses(\"Tabs\", recipe, rawProps);\n const sls = useHuiStyles(\"Tabs\", { root: rawProps.style });\n\n const onSelect = useCallback(\n (nextValue: string) => {\n if (!(values as readonly string[]).includes(nextValue)) {\n throw new Error(`[Hebium UI] Unexpected Tab value: ${nextValue}`);\n }\n\n const v = nextValue as V;\n setUncontrolledValue(v);\n onChange?.(v);\n },\n [onChange, values],\n );\n\n const contextValue = useMemo<TabsContextValue>(\n () => ({\n rootId,\n selectedValue,\n onSelect,\n activation,\n }),\n [\n rootId,\n selectedValue,\n onSelect,\n activation,\n ],\n );\n const attrs = tabsControl.getRootAttributes({ rootId, selectedValue });\n\n return (\n <TabsContext.Provider value={contextValue}>\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n {...restProps}\n >\n {children}\n </Component>\n </TabsContext.Provider>\n );\n}\n\ninterface TabsListOwnProps {}\nexport type TabsListProps<E extends JSX.ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n TabsListOwnProps,\n TablistSlots\n>;\n\nfunction List<E extends JSX.ElementType = \"div\">(rawProps: TabsListProps<E>): VNode {\n const {\n as,\n children,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...restProps\n } = useHuiProps(\"TabsList\", rawProps);\n\n const Component = as ?? \"div\";\n\n const recipe = tablistRecipe({});\n const cls = useHuiClasses(\"TabsList\", recipe, rawProps);\n const sls = useHuiStyles(\"TabsList\", { root: rawProps.style });\n const { rootId, selectedValue } = useTabsContext();\n const attrs = tabsControl.getListAttributes(\n { rootId, selectedValue },\n { ariaLabel: unwrapSignalish(ariaLabel), ariaLabelledBy: unwrapSignalish(ariaLabelledBy) },\n );\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ninterface TabsTabOwnProps {\n /**\n * The value represented by this tab.\n */\n value: string;\n}\nexport type TabsTabProps<E extends JSX.ElementType = \"button\"> = HuiPolymorphicProps<\n E,\n TabsTabOwnProps,\n TabSlots\n>;\n\nfunction Tab<E extends JSX.ElementType = \"button\">(rawProps: TabsTabProps<E>): VNode {\n const {\n as,\n value,\n children,\n onClick,\n onKeyDown,\n onFocus,\n ...restProps\n } = useHuiProps(\"TabsTab\", rawProps);\n\n const Component = as ?? \"button\";\n\n const { rootId, selectedValue, onSelect, activation } = useTabsContext();\n const recipe = tabRecipe({});\n const cls = useHuiClasses(\"TabsTab\", recipe, rawProps);\n const sls = useHuiStyles(\"TabsTab\", { root: rawProps.style });\n const attrs = tabsControl.getTabAttributes(\n { rootId, selectedValue },\n value,\n { isButtonElement: as === undefined },\n );\n\n const handleClick = useCallback(\n (e: TargetedMouseEvent<HTMLButtonElement>): void => {\n onClick?.(e);\n if (e.defaultPrevented) return;\n onSelect(value);\n },\n [onClick, onSelect, value],\n );\n\n const handleKeyDown = useCallback(\n (e: TargetedKeyboardEvent<HTMLButtonElement>): void => {\n onKeyDown?.(e);\n if (e.defaultPrevented) return;\n\n const action = tabsControl.handleTabKeydown(e);\n switch (action) {\n case \"activate\":\n onSelect(value);\n return;\n case \"focus-move\":\n tabsControl.moveFocus(e, rootId);\n return;\n case \"none\":\n return;\n }\n },\n [onKeyDown, onSelect, rootId, value],\n );\n\n const handleFocus = useCallback((e: TargetedFocusEvent<HTMLButtonElement>) => {\n onFocus?.(e);\n if (e.defaultPrevented) return;\n\n if (activation === \"auto\") {\n onSelect(value);\n }\n }, [onFocus, onSelect, activation, value]);\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ninterface TabsPanelOwnProps {\n /**\n * The tab value associated with this panel.\n */\n value: string;\n}\nexport type TabsPanelProps<E extends JSX.ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n TabsPanelOwnProps,\n TabpanelSlots\n>;\n\nfunction Panel<E extends JSX.ElementType = \"div\">(rawProps: TabsPanelProps<E>): VNode {\n const {\n as,\n value,\n children,\n ...restProps\n } = useHuiProps(\"TabsPanel\", rawProps);\n\n const Component = as ?? \"div\";\n\n const { rootId, selectedValue } = useTabsContext();\n const recipe = tabpanelRecipe({});\n const cls = useHuiClasses(\"TabsPanel\", recipe, rawProps);\n const sls = useHuiStyles(\"TabsPanel\", { root: rawProps.style });\n const attrs = tabsControl.getPanelAttributes({ rootId, selectedValue }, value);\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\nexport const Tabs = Object.assign(TabsRoot, {\n List,\n Tab,\n Panel,\n});\n"],"mappings":";;;;;;;AAuDA,SAAS,SACP,UACO;CACP,M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WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EACJ,SAAS;EACT,WAAW;EACX,SAAS;EACT,GAAI;EAEH;CACQ,CAAA;AAEf;AAcA,SAAS,MAAyC,UAAoC;CACpF,MAAM,EACJ,IACA,OACA,UACA,GAAG,cACD,YAAY,aAAa,QAAQ;CAErC,MAAM,YAAY,MAAM;CAExB,MAAM,EAAE,QAAQ,kBAAkB,eAAe;CACjD,MAAM,SAAS,eAAe,CAAC,CAAC;CAChC,MAAM,MAAM,cAAc,aAAa,QAAQ,QAAQ;CACvD,MAAM,MAAM,aAAa,aAAa,EAAE,MAAM,SAAS,MAAM,CAAC;CAC9D,MAAM,QAAQ,YAAY,mBAAmB;EAAE;EAAQ;CAAc,GAAG,KAAK;CAE7E,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EACJ,GAAI;EAEH;CACQ,CAAA;AAEf;AAEA,MAAa,OAAO,OAAO,OAAO,UAAU;CAC1C;CACA;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"tabs.js","names":[],"sources":["../../../src/components/tabs/tabs.tsx"],"sourcesContent":["import {\n tablistRecipe,\n type TablistSlots,\n tabpanelRecipe,\n type TabpanelSlots,\n tabRecipe,\n tabrootRecipe,\n type TabrootSlots,\n tabsControl,\n type TabSlots,\n} from \"@hebium-ui/core\";\nimport {\n type JSX,\n type TargetedFocusEvent,\n type TargetedKeyboardEvent,\n type TargetedMouseEvent,\n type VNode,\n} from \"preact\";\nimport { useCallback, useId, useMemo, useState } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\nimport { unwrapSignalish } from \"~/utils\";\nimport { type ActivationMode, TabsContext, type TabsContextValue, useTabsContext } from \"./tabs.context\";\n\ninterface TabsOwnProps<V extends string> {\n /**\n * The list of allowed tab values.\n */\n values: readonly V[];\n /**\n * The currently selected tab value.\n */\n value?: V | undefined;\n /**\n * The initially selected tab value for uncontrolled tabs.\n */\n defaultValue?: V | undefined;\n /**\n * Called when the selected tab value changes.\n */\n onChange?: ((value: V) => void) | undefined;\n /**\n * The activation mode used when focus moves between tabs.\n *\n * @default \"manual\"\n * @see {@link https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_selection_follows_focus | WAI-ARIA APG: Deciding When to Make Selection Automatically Follow Focus}\n */\n activation?: ActivationMode;\n}\nexport type TabsProps<V extends string, E extends JSX.ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n TabsOwnProps<V>,\n TabrootSlots\n>;\n\nfunction TabsRoot<V extends string, E extends JSX.ElementType = \"div\">(\n rawProps: TabsProps<V, E>,\n): VNode {\n const {\n as,\n id,\n values,\n value,\n defaultValue,\n onChange,\n children,\n activation = \"manual\",\n ...restProps\n } = useHuiProps(\"Tabs\", rawProps);\n\n const Component = as ?? \"div\";\n\n const tmpId = useId();\n const rootId = unwrapSignalish(id) || tmpId;\n const [uncontrolledValue, setUncontrolledValue] = useState<V | undefined>(\n () => value ?? defaultValue ?? values[0],\n );\n const selectedValue = value ?? uncontrolledValue;\n const recipe = tabrootRecipe({});\n const cls = useHuiClasses(\"Tabs\", recipe, rawProps);\n const sls = useHuiStyles(\"Tabs\", rawProps);\n\n const onSelect = useCallback(\n (nextValue: string) => {\n if (!(values as readonly string[]).includes(nextValue)) {\n throw new Error(`[Hebium UI] Unexpected Tab value: ${nextValue}`);\n }\n\n const v = nextValue as V;\n setUncontrolledValue(v);\n onChange?.(v);\n },\n [onChange, values],\n );\n\n const contextValue = useMemo<TabsContextValue>(\n () => ({\n rootId,\n selectedValue,\n onSelect,\n activation,\n }),\n [\n rootId,\n selectedValue,\n onSelect,\n activation,\n ],\n );\n const attrs = tabsControl.getRootAttributes({ rootId, selectedValue });\n\n return (\n <TabsContext.Provider value={contextValue}>\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n {...restProps}\n >\n {children}\n </Component>\n </TabsContext.Provider>\n );\n}\n\ninterface TabsListOwnProps {}\nexport type TabsListProps<E extends JSX.ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n TabsListOwnProps,\n TablistSlots\n>;\n\nfunction List<E extends JSX.ElementType = \"div\">(rawProps: TabsListProps<E>): VNode {\n const {\n as,\n children,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...restProps\n } = useHuiProps(\"TabsList\", rawProps);\n\n const Component = as ?? \"div\";\n\n const recipe = tablistRecipe({});\n const cls = useHuiClasses(\"TabsList\", recipe, rawProps);\n const sls = useHuiStyles(\"TabsList\", rawProps);\n const { rootId, selectedValue } = useTabsContext();\n const attrs = tabsControl.getListAttributes(\n { rootId, selectedValue },\n { ariaLabel: unwrapSignalish(ariaLabel), ariaLabelledBy: unwrapSignalish(ariaLabelledBy) },\n );\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ninterface TabsTabOwnProps {\n /**\n * The value represented by this tab.\n */\n value: string;\n}\nexport type TabsTabProps<E extends JSX.ElementType = \"button\"> = HuiPolymorphicProps<\n E,\n TabsTabOwnProps,\n TabSlots\n>;\n\nfunction Tab<E extends JSX.ElementType = \"button\">(rawProps: TabsTabProps<E>): VNode {\n const {\n as,\n value,\n children,\n onClick,\n onKeyDown,\n onFocus,\n ...restProps\n } = useHuiProps(\"TabsTab\", rawProps);\n\n const Component = as ?? \"button\";\n\n const { rootId, selectedValue, onSelect, activation } = useTabsContext();\n const recipe = tabRecipe({});\n const cls = useHuiClasses(\"TabsTab\", recipe, rawProps);\n const sls = useHuiStyles(\"TabsTab\", rawProps);\n const attrs = tabsControl.getTabAttributes(\n { rootId, selectedValue },\n value,\n { isButtonElement: as === undefined },\n );\n\n const handleClick = useCallback(\n (e: TargetedMouseEvent<HTMLButtonElement>): void => {\n onClick?.(e);\n if (e.defaultPrevented) return;\n onSelect(value);\n },\n [onClick, onSelect, value],\n );\n\n const handleKeyDown = useCallback(\n (e: TargetedKeyboardEvent<HTMLButtonElement>): void => {\n onKeyDown?.(e);\n if (e.defaultPrevented) return;\n\n const action = tabsControl.handleTabKeydown(e);\n switch (action) {\n case \"activate\":\n onSelect(value);\n return;\n case \"focus-move\":\n tabsControl.moveFocus(e, rootId);\n return;\n case \"none\":\n return;\n }\n },\n [onKeyDown, onSelect, rootId, value],\n );\n\n const handleFocus = useCallback((e: TargetedFocusEvent<HTMLButtonElement>) => {\n onFocus?.(e);\n if (e.defaultPrevented) return;\n\n if (activation === \"auto\") {\n onSelect(value);\n }\n }, [onFocus, onSelect, activation, value]);\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ninterface TabsPanelOwnProps {\n /**\n * The tab value associated with this panel.\n */\n value: string;\n}\nexport type TabsPanelProps<E extends JSX.ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n TabsPanelOwnProps,\n TabpanelSlots\n>;\n\nfunction Panel<E extends JSX.ElementType = \"div\">(rawProps: TabsPanelProps<E>): VNode {\n const {\n as,\n value,\n children,\n ...restProps\n } = useHuiProps(\"TabsPanel\", rawProps);\n\n const Component = as ?? \"div\";\n\n const { rootId, selectedValue } = useTabsContext();\n const recipe = tabpanelRecipe({});\n const cls = useHuiClasses(\"TabsPanel\", recipe, rawProps);\n const sls = useHuiStyles(\"TabsPanel\", rawProps);\n const attrs = tabsControl.getPanelAttributes({ rootId, selectedValue }, value);\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\nexport const Tabs = Object.assign(TabsRoot, {\n List,\n Tab,\n Panel,\n});\n"],"mappings":";;;;;;;AAuDA,SAAS,SACP,UACO;CACP,MAAM,EACJ,IACA,IACA,QACA,OACA,cACA,UACA,UACA,aAAa,UACb,GAAG,cACD,YAAY,QAAQ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ACpF,MAAM,EACJ,IACA,OACA,UACA,GAAG,cACD,YAAY,aAAa,QAAQ;CAErC,MAAM,YAAY,MAAM;CAExB,MAAM,EAAE,QAAQ,kBAAkB,eAAe;CACjD,MAAM,SAAS,eAAe,CAAC,CAAC;CAChC,MAAM,MAAM,cAAc,aAAa,QAAQ,QAAQ;CACvD,MAAM,MAAM,aAAa,aAAa,QAAQ;CAC9C,MAAM,QAAQ,YAAY,mBAAmB;EAAE;EAAQ;CAAc,GAAG,KAAK;CAE7E,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EACJ,GAAI;EAEH;CACQ,CAAA;AAEf;AAEA,MAAa,OAAO,OAAO,OAAO,UAAU;CAC1C;CACA;CACA;AACF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -8,14 +8,13 @@ import { Code, CodeProps } from "./components/code/code.js";
8
8
  import { Details, DetailsProps } from "./components/details/details.js";
9
9
  import { Heading, HeadingProps } from "./components/heading/heading.js";
10
10
  import { Dialog, DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps } from "./components/dialog/dialog.js";
11
- import { useDialogId } from "./components/dialog/dialog.context.js";
12
11
  import { DdProps, Dl, DlProps, DtProps } from "./components/dl/dl.js";
13
12
  import { Drawer, DrawerCloseProps, DrawerContentProps, DrawerProps, DrawerTriggerProps } from "./components/drawer/drawer.js";
14
- import { useDrawerId } from "./components/drawer/drawer.context.js";
15
13
  import { Progress, ProgressProps } from "./components/progress/progress.js";
14
+ import { StatusIcon, StatusIconProps } from "./components/status-icon/status-icon.js";
16
15
  import { Tabs, TabsListProps, TabsPanelProps, TabsProps, TabsTabProps } from "./components/tabs/tabs.js";
17
16
  import "./components/index.js";
18
17
  import { HuiComponentPropsMap, HuiProviderContext, HuiProviderContextValue, useHuiClasses, useHuiProps, useHuiProviderContext, useHuiStyles } from "./provider/hui-provider.context.js";
19
18
  import { HuiProvider } from "./provider/hui-provider.js";
20
19
  import "./provider/index.js";
21
- 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, HuiComponentPropsMap, HuiProvider, HuiProviderContext, HuiProviderContextValue, Progress, ProgressProps, Tabs, TabsListProps, TabsPanelProps, TabsProps, TabsTabProps, useDialogId, useDrawerId, useHuiClasses, useHuiProps, useHuiProviderContext, useHuiStyles };
20
+ 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, HuiComponentPropsMap, HuiProvider, HuiProviderContext, HuiProviderContextValue, Progress, ProgressProps, StatusIcon, StatusIconProps, Tabs, TabsListProps, TabsPanelProps, TabsProps, TabsTabProps, useHuiClasses, useHuiProps, useHuiProviderContext, useHuiStyles };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { HuiProviderContext, useHuiClasses, useHuiProps, useHuiProviderContext, useHuiStyles } from "./provider/hui-provider.context.js";
2
2
  import { HuiProvider } from "./provider/hui-provider.js";
3
+ import { StatusIcon } from "./components/status-icon/status-icon.js";
3
4
  import { Alert } from "./components/alert/alert.js";
4
5
  import { Anchor } from "./components/anchor/anchor.js";
5
6
  import { Avatar } from "./components/avatar/avatar.js";
@@ -9,11 +10,9 @@ import { Checkbox } from "./components/checkbox/checkbox.js";
9
10
  import { Code } from "./components/code/code.js";
10
11
  import { Details } from "./components/details/details.js";
11
12
  import { Heading } from "./components/heading/heading.js";
12
- import { useDialogId } from "./components/dialog/dialog.context.js";
13
13
  import { Dialog } from "./components/dialog/dialog.js";
14
14
  import { Dl } from "./components/dl/dl.js";
15
- import { useDrawerId } from "./components/drawer/drawer.context.js";
16
15
  import { Drawer } from "./components/drawer/drawer.js";
17
16
  import { Progress } from "./components/progress/progress.js";
18
17
  import { Tabs } from "./components/tabs/tabs.js";
19
- export { Alert, Anchor, Avatar, Blockquote, Button, Checkbox, Code, Details, Dialog, Dl, Drawer, Heading, HuiProvider, HuiProviderContext, Progress, Tabs, useDialogId, useDrawerId, useHuiClasses, useHuiProps, useHuiProviderContext, useHuiStyles };
18
+ export { Alert, Anchor, Avatar, Blockquote, Button, Checkbox, Code, Details, Dialog, Dl, Drawer, Heading, HuiProvider, HuiProviderContext, Progress, StatusIcon, Tabs, useHuiClasses, useHuiProps, useHuiProviderContext, useHuiStyles };
@@ -1,5 +1,5 @@
1
- import { HuiRootStyleProps, HuiSlotStyleProps, HuiStyles } from "../types/hui-component.js";
2
- import "../types/index.js";
1
+ import { HuiStyleProps } from "../types/hui-component.js";
2
+ import "../components/index.js";
3
3
  import { AlertProps } from "../components/alert/alert.js";
4
4
  import { AnchorProps } from "../components/anchor/anchor.js";
5
5
  import { AvatarProps } from "../components/avatar/avatar.js";
@@ -13,8 +13,9 @@ import { DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps }
13
13
  import { DdProps, DlProps, DtProps } from "../components/dl/dl.js";
14
14
  import { DrawerCloseProps, DrawerContentProps, DrawerProps, DrawerTriggerProps } from "../components/drawer/drawer.js";
15
15
  import { ProgressProps } from "../components/progress/progress.js";
16
+ import { StatusIconProps } from "../components/status-icon/status-icon.js";
16
17
  import { TabsListProps, TabsPanelProps, TabsProps, TabsTabProps } from "../components/tabs/tabs.js";
17
- import "../components/index.js";
18
+ import "../types/index.js";
18
19
  import { CSSProperties, JSX } from "preact";
19
20
  export interface HuiComponentPropsMap {
20
21
  Alert: Partial<AlertProps>;
@@ -38,6 +39,7 @@ export interface HuiComponentPropsMap {
38
39
  DrawerClose: Partial<DrawerCloseProps>;
39
40
  Heading: Partial<HeadingProps>;
40
41
  Progress: Partial<ProgressProps>;
42
+ StatusIcon: Partial<StatusIconProps>;
41
43
  Tabs: Partial<TabsProps<string>>;
42
44
  TabsList: Partial<TabsListProps>;
43
45
  TabsTab: Partial<TabsTabProps>;
@@ -45,6 +47,10 @@ export interface HuiComponentPropsMap {
45
47
  }
46
48
  type HuiComponentName = keyof HuiComponentPropsMap;
47
49
  type HuiDefaultProps = Partial<HuiComponentPropsMap>;
50
+ type HuiComponentSlots<K extends HuiComponentName> = { [P in HuiComponentName]: HuiComponentPropsMap[P] extends {
51
+ classes?: infer C;
52
+ } ? Extract<keyof NonNullable<C>, string> : never; }[K];
53
+ type HuiStyledComponentName = { [K in HuiComponentName]: [HuiComponentSlots<K>] extends [never] ? never : K; }[HuiComponentName];
48
54
  export interface HuiProviderContextValue {
49
55
  defaultProps: HuiDefaultProps;
50
56
  }
@@ -57,8 +63,6 @@ type HuiProps<P extends object, E extends JSX.ElementType> = Omit<P, typeof STYL
57
63
  export declare function useHuiProps<K extends HuiComponentName, P extends object, E extends JSX.ElementType = Extract<P["as" & keyof P], JSX.ElementType>>(key: K, rawProps: P & {
58
64
  as?: E | undefined;
59
65
  }): HuiProps<P, E>;
60
- type HuiClassesProps<S extends string> = Pick<HuiRootStyleProps, "class" | "className"> & Pick<HuiSlotStyleProps<S>, "classes">;
61
- export declare function useHuiClasses<K extends HuiComponentName, S extends string>(key: K, recipe: Record<S, string>, rawProps?: HuiClassesProps<S>): Record<S, string>;
62
- export declare function useHuiStyles<K extends HuiComponentName, S extends string>(key: K, rawStyles?: HuiStyles<S>): Partial<Record<S, CSSProperties>>;
63
- export {};
64
- //# sourceMappingURL=hui-provider.context.d.ts.map
66
+ export declare function useHuiClasses<K extends HuiStyledComponentName>(key: K, recipe: Record<HuiComponentSlots<NoInfer<K>>, string>, rawProps?: Pick<HuiStyleProps<HuiComponentSlots<NoInfer<K>>>, "class" | "className" | "classes">): Record<HuiComponentSlots<K>, string>;
67
+ export declare function useHuiStyles<K extends HuiStyledComponentName>(key: K, rawProps?: Pick<HuiStyleProps<HuiComponentSlots<NoInfer<K>>>, "style" | "styles">): Partial<Record<HuiComponentSlots<K>, CSSProperties>>;
68
+ export {};
@@ -11,6 +11,9 @@ function useHuiProviderContext() {
11
11
  function useHuiDefaultProps(key) {
12
12
  return useHuiProviderContext().defaultProps[key];
13
13
  }
14
+ function useHuiStyleDefaultProps(key) {
15
+ return useHuiDefaultProps(key);
16
+ }
14
17
  const STYLING_PROPS = [
15
18
  "class",
16
19
  "className",
@@ -32,14 +35,15 @@ function resolveSlotValues(values = {}) {
32
35
  return resolved;
33
36
  }
34
37
  function useHuiClasses(key, recipe, rawProps = {}) {
35
- const defaultProps = useHuiDefaultProps(key);
36
- const rootClass = cc(unwrapSignalish(defaultProps?.class), unwrapSignalish(defaultProps?.className), unwrapSignalish(rawProps.class), unwrapSignalish(rawProps.className));
37
- return ccAll(recipe, resolveSlotValues(defaultProps?.classes), { root: rootClass }, resolveSlotValues(rawProps.classes));
38
+ const defaultProps = useHuiStyleDefaultProps(key);
39
+ return ccAll(recipe, { root: cc(unwrapSignalish(defaultProps?.class), unwrapSignalish(defaultProps?.className)) }, resolveSlotValues(defaultProps?.classes), { root: cc(unwrapSignalish(rawProps.class), unwrapSignalish(rawProps.className)) }, resolveSlotValues(rawProps.classes));
38
40
  }
39
- function useHuiStyles(key, rawStyles) {
40
- const defaultProps = useHuiDefaultProps(key);
41
- const defaultStyles = defaultProps?.styles ?? { root: defaultProps?.style };
42
- return msAll(resolveSlotValues(defaultStyles), resolveSlotValues(rawStyles));
41
+ function resolveStyles(props = {}) {
42
+ return msAll({ root: unwrapSignalish(props.style) }, resolveSlotValues(props.styles));
43
+ }
44
+ function useHuiStyles(key, rawProps = {}) {
45
+ const defaultProps = useHuiStyleDefaultProps(key);
46
+ return msAll(resolveStyles(defaultProps), resolveStyles(rawProps));
43
47
  }
44
48
  export { HuiProviderContext, useHuiClasses, useHuiProps, useHuiProviderContext, useHuiStyles };
45
49