@hebium-ui/react 0.1.0-alpha.2 → 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 (166) hide show
  1. package/dist/components/alert/alert.d.ts +3 -6
  2. package/dist/components/alert/alert.js +6 -14
  3. package/dist/components/alert/alert.js.map +1 -1
  4. package/dist/components/anchor/anchor.d.ts +1 -4
  5. package/dist/components/anchor/anchor.js +4 -5
  6. package/dist/components/anchor/anchor.js.map +1 -1
  7. package/dist/components/avatar/avatar.d.ts +1 -4
  8. package/dist/components/avatar/avatar.js +4 -5
  9. package/dist/components/avatar/avatar.js.map +1 -1
  10. package/dist/components/blockquote/blockquote.d.ts +1 -4
  11. package/dist/components/blockquote/blockquote.js +4 -5
  12. package/dist/components/blockquote/blockquote.js.map +1 -1
  13. package/dist/components/button/button.d.ts +12 -4
  14. package/dist/components/button/button.js +30 -11
  15. package/dist/components/button/button.js.map +1 -1
  16. package/dist/components/checkbox/checkbox.d.ts +2 -5
  17. package/dist/components/checkbox/checkbox.js +29 -16
  18. package/dist/components/checkbox/checkbox.js.map +1 -1
  19. package/dist/components/code/code.d.ts +1 -4
  20. package/dist/components/code/code.js +4 -5
  21. package/dist/components/code/code.js.map +1 -1
  22. package/dist/components/combobox/combobox-option.js +33 -0
  23. package/dist/components/combobox/combobox-option.js.map +1 -0
  24. package/dist/components/combobox/combobox.d.ts +61 -0
  25. package/dist/components/combobox/combobox.js +208 -0
  26. package/dist/components/combobox/combobox.js.map +1 -0
  27. package/dist/components/combobox/index.d.ts +2 -0
  28. package/dist/components/combobox/use-combobox-form.js +33 -0
  29. package/dist/components/combobox/use-combobox-form.js.map +1 -0
  30. package/dist/components/combobox/use-combobox-popover.js +66 -0
  31. package/dist/components/combobox/use-combobox-popover.js.map +1 -0
  32. package/dist/components/combobox/use-combobox-state.js +96 -0
  33. package/dist/components/combobox/use-combobox-state.js.map +1 -0
  34. package/dist/components/details/details.d.ts +1 -4
  35. package/dist/components/details/details.js +4 -5
  36. package/dist/components/details/details.js.map +1 -1
  37. package/dist/components/dialog/dialog.context.js +1 -2
  38. package/dist/components/dialog/dialog.d.ts +4 -7
  39. package/dist/components/dialog/dialog.js +29 -9
  40. package/dist/components/dialog/dialog.js.map +1 -1
  41. package/dist/components/dialog/index.d.ts +1 -2
  42. package/dist/components/dl/dl.d.ts +1 -4
  43. package/dist/components/dl/dl.js +10 -11
  44. package/dist/components/dl/dl.js.map +1 -1
  45. package/dist/components/drawer/drawer.context.js +1 -2
  46. package/dist/components/drawer/drawer.d.ts +4 -7
  47. package/dist/components/drawer/drawer.js +29 -9
  48. package/dist/components/drawer/drawer.js.map +1 -1
  49. package/dist/components/drawer/index.d.ts +1 -2
  50. package/dist/components/fieldset/fieldset.d.ts +1 -4
  51. package/dist/components/fieldset/fieldset.js +4 -5
  52. package/dist/components/fieldset/fieldset.js.map +1 -1
  53. package/dist/components/heading/heading.d.ts +1 -4
  54. package/dist/components/heading/heading.js +4 -5
  55. package/dist/components/heading/heading.js.map +1 -1
  56. package/dist/components/hr/hr.d.ts +1 -4
  57. package/dist/components/hr/hr.js +4 -5
  58. package/dist/components/hr/hr.js.map +1 -1
  59. package/dist/components/index.d.ts +35 -26
  60. package/dist/components/inline-feedback/index.d.ts +2 -0
  61. package/dist/components/inline-feedback/inline-feedback.d.ts +33 -0
  62. package/dist/components/inline-feedback/inline-feedback.js +30 -0
  63. package/dist/components/inline-feedback/inline-feedback.js.map +1 -0
  64. package/dist/components/input/input.d.ts +1 -4
  65. package/dist/components/input/input.js +4 -5
  66. package/dist/components/input/input.js.map +1 -1
  67. package/dist/components/label/label.d.ts +1 -4
  68. package/dist/components/label/label.js +6 -7
  69. package/dist/components/label/label.js.map +1 -1
  70. package/dist/components/menu/index.d.ts +1 -2
  71. package/dist/components/menu/menu.context.js +1 -2
  72. package/dist/components/menu/menu.d.ts +3 -6
  73. package/dist/components/menu/menu.js +23 -9
  74. package/dist/components/menu/menu.js.map +1 -1
  75. package/dist/components/multi-combobox/index.d.ts +2 -0
  76. package/dist/components/multi-combobox/multi-combobox-option.js +42 -0
  77. package/dist/components/multi-combobox/multi-combobox-option.js.map +1 -0
  78. package/dist/components/multi-combobox/multi-combobox-tag.js +54 -0
  79. package/dist/components/multi-combobox/multi-combobox-tag.js.map +1 -0
  80. package/dist/components/multi-combobox/multi-combobox.d.ts +72 -0
  81. package/dist/components/multi-combobox/multi-combobox.js +249 -0
  82. package/dist/components/multi-combobox/multi-combobox.js.map +1 -0
  83. package/dist/components/multi-combobox/use-multi-combobox-state.js +91 -0
  84. package/dist/components/multi-combobox/use-multi-combobox-state.js.map +1 -0
  85. package/dist/components/paragraph/paragraph.d.ts +1 -4
  86. package/dist/components/paragraph/paragraph.js +4 -5
  87. package/dist/components/paragraph/paragraph.js.map +1 -1
  88. package/dist/components/popover/index.d.ts +1 -2
  89. package/dist/components/popover/popover.context.js +1 -2
  90. package/dist/components/popover/popover.d.ts +3 -6
  91. package/dist/components/popover/popover.js +20 -6
  92. package/dist/components/popover/popover.js.map +1 -1
  93. package/dist/components/progress/progress.d.ts +1 -4
  94. package/dist/components/progress/progress.js +4 -5
  95. package/dist/components/progress/progress.js.map +1 -1
  96. package/dist/components/radio/radio.d.ts +1 -4
  97. package/dist/components/radio/radio.js +4 -5
  98. package/dist/components/radio/radio.js.map +1 -1
  99. package/dist/components/radiogroup/radiogroup.d.ts +1 -4
  100. package/dist/components/radiogroup/radiogroup.js +6 -6
  101. package/dist/components/radiogroup/radiogroup.js.map +1 -1
  102. package/dist/components/section/section.d.ts +1 -4
  103. package/dist/components/section/section.js +4 -5
  104. package/dist/components/section/section.js.map +1 -1
  105. package/dist/components/segmented-control/segmented-control.context.js +1 -2
  106. package/dist/components/segmented-control/segmented-control.d.ts +2 -5
  107. package/dist/components/segmented-control/segmented-control.js +13 -9
  108. package/dist/components/segmented-control/segmented-control.js.map +1 -1
  109. package/dist/components/select/select.d.ts +1 -4
  110. package/dist/components/select/select.js +4 -5
  111. package/dist/components/select/select.js.map +1 -1
  112. package/dist/components/skip-link/index.d.ts +2 -0
  113. package/dist/components/skip-link/skip-link.d.ts +6 -0
  114. package/dist/components/skip-link/skip-link.js +20 -0
  115. package/dist/components/skip-link/skip-link.js.map +1 -0
  116. package/dist/components/status-icon/index.d.ts +2 -0
  117. package/dist/components/status-icon/status-icon.d.ts +19 -0
  118. package/dist/components/status-icon/status-icon.js +22 -0
  119. package/dist/components/status-icon/status-icon.js.map +1 -0
  120. package/dist/components/table/table.d.ts +4 -7
  121. package/dist/components/table/table.js +25 -26
  122. package/dist/components/table/table.js.map +1 -1
  123. package/dist/components/tabs/tabs.context.d.ts +1 -4
  124. package/dist/components/tabs/tabs.context.js +1 -2
  125. package/dist/components/tabs/tabs.d.ts +2 -5
  126. package/dist/components/tabs/tabs.js +13 -14
  127. package/dist/components/tabs/tabs.js.map +1 -1
  128. package/dist/components/tag/index.d.ts +2 -0
  129. package/dist/components/tag/tag.d.ts +39 -0
  130. package/dist/components/tag/tag.js +41 -0
  131. package/dist/components/tag/tag.js.map +1 -0
  132. package/dist/components/text/index.d.ts +2 -0
  133. package/dist/components/text/text.d.ts +22 -0
  134. package/dist/components/text/text.js +23 -0
  135. package/dist/components/text/text.js.map +1 -0
  136. package/dist/components/textarea/textarea.d.ts +1 -4
  137. package/dist/components/textarea/textarea.js +4 -5
  138. package/dist/components/textarea/textarea.js.map +1 -1
  139. package/dist/components/tooltip/index.d.ts +1 -2
  140. package/dist/components/tooltip/tooltip.context.js +1 -2
  141. package/dist/components/tooltip/tooltip.d.ts +3 -6
  142. package/dist/components/tooltip/tooltip.js +19 -5
  143. package/dist/components/tooltip/tooltip.js.map +1 -1
  144. package/dist/components/visually-hidden/visually-hidden.d.ts +3 -6
  145. package/dist/components/visually-hidden/visually-hidden.js +4 -5
  146. package/dist/components/visually-hidden/visually-hidden.js.map +1 -1
  147. package/dist/index.d.ts +9 -7
  148. package/dist/index.js +9 -7
  149. package/dist/provider/hui-provider.context.d.ts +34 -10
  150. package/dist/provider/hui-provider.context.js +23 -16
  151. package/dist/provider/hui-provider.context.js.map +1 -1
  152. package/dist/provider/hui-provider.d.ts +1 -4
  153. package/dist/provider/hui-provider.js +1 -2
  154. package/dist/provider/index.d.ts +1 -1
  155. package/dist/provider/merge-props.js +1 -2
  156. package/dist/types/distributive.d.ts +1 -0
  157. package/dist/types/hui-component.d.ts +11 -7
  158. package/dist/types/index.d.ts +3 -2
  159. package/dist/types/polymorphic.d.ts +4 -11
  160. package/dist/utils/attributes/normalize-attributes.js +1 -2
  161. package/package.json +9 -9
  162. package/dist/components/dialog/dialog.context.d.ts +0 -4
  163. package/dist/components/drawer/drawer.context.d.ts +0 -4
  164. package/dist/components/menu/menu.context.d.ts +0 -4
  165. package/dist/components/popover/popover.context.d.ts +0 -4
  166. package/dist/components/tooltip/tooltip.context.d.ts +0 -4
@@ -1,12 +1,18 @@
1
1
  import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
- import { Button } from "../button/button.js";
3
2
  import { normalizeAttributes } from "../../utils/attributes/normalize-attributes.js";
3
+ import { Button } from "../button/button.js";
4
4
  import { Heading } from "../heading/heading.js";
5
5
  import { DialogContext, useDialogContext, useDialogId } from "./dialog.context.js";
6
6
  import { dialogControl, dialogRecipe, toStrbool } from "@hebium-ui/core";
7
7
  import { useCallback, useId, useMemo } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
- //#region src/components/dialog/dialog.tsx
9
+ // src/components/dialog/dialog.tsx
10
+ const BUTTON_CLASSES = {
11
+ root: "",
12
+ content: "",
13
+ spinner: "",
14
+ status: ""
15
+ };
10
16
  function DialogRoot(rawProps) {
11
17
  const { id, modal = false, children } = useHuiProps("Dialog", rawProps);
12
18
  const tmpId = useId();
@@ -31,6 +37,8 @@ function DialogRoot(rawProps) {
31
37
  function Trigger(rawProps) {
32
38
  const { as, children, onClick, ...restProps } = useHuiProps("DialogTrigger", rawProps);
33
39
  const Component = as ?? Button;
40
+ const cls = useHuiClassNames("DialogTrigger", BUTTON_CLASSES, rawProps);
41
+ const sls = useHuiStyles("DialogTrigger", rawProps);
34
42
  const { dialogId, modal, open } = useDialogContext();
35
43
  const attrs = normalizeAttributes(dialogControl.getTriggerAttributes({ id: dialogId }, {
36
44
  modal,
@@ -47,13 +55,20 @@ function Trigger(rawProps) {
47
55
  ]);
48
56
  return /* @__PURE__ */ jsx(Component, {
49
57
  ...attrs,
58
+ ...Component === Button ? {
59
+ classNames: cls,
60
+ styles: sls
61
+ } : {
62
+ className: cls.root,
63
+ style: sls.root
64
+ },
50
65
  onClick: handleClick,
51
66
  ...restProps,
52
67
  children
53
68
  });
54
69
  }
55
70
  function Content(rawProps) {
56
- const { classNames, styles, children, heading, headingProps, closeButton, closeButtonProps, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...restProps } = useHuiProps("DialogContent", rawProps);
71
+ const { children, heading, headingProps, closeButton, closeButtonProps, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...restProps } = useHuiProps("DialogContent", rawProps);
57
72
  const { dialogId, modal } = useDialogContext();
58
73
  const resolvedHeading = heading !== void 0 && heading !== null && heading !== false ? heading : void 0;
59
74
  const state = { id: dialogId };
@@ -66,8 +81,10 @@ function Content(rawProps) {
66
81
  const headingId = resolvedHeading !== void 0 ? headingAttrs.id : void 0;
67
82
  const headingLevel = headingProps?.level ?? 2;
68
83
  const recipe = dialogRecipe({ modal: toStrbool(modal) });
69
- const cls = useHuiClassNames("DialogContent", recipe, classNames);
70
- const sls = useHuiStyles("DialogContent", styles);
84
+ const cls = useHuiClassNames("DialogContent", recipe, rawProps);
85
+ const sls = useHuiStyles("DialogContent", rawProps);
86
+ const closeButtonClassNames = useMemo(() => ({ root: cls.closeButton }), [cls.closeButton]);
87
+ const closeButtonStyles = useMemo(() => ({ root: sls.closeButton }), [sls.closeButton]);
71
88
  const shouldRenderCloseButton = closeButton !== null && closeButton !== false;
72
89
  const shouldRenderHeader = headingId !== void 0 || shouldRenderCloseButton;
73
90
  const closeButtonContent = closeButton === void 0 ? /* @__PURE__ */ jsx("span", {
@@ -92,8 +109,8 @@ function Content(rawProps) {
92
109
  level: headingLevel,
93
110
  children: resolvedHeading
94
111
  }), shouldRenderCloseButton && /* @__PURE__ */ jsx(Close, {
95
- className: cls.closeButton,
96
- style: sls.closeButton,
112
+ classNames: closeButtonClassNames,
113
+ styles: closeButtonStyles,
97
114
  "aria-label": "Close Dialog",
98
115
  variant: "ghost",
99
116
  color: "neutral",
@@ -106,11 +123,15 @@ function Content(rawProps) {
106
123
  }
107
124
  function Close(rawProps) {
108
125
  const props = useHuiProps("DialogClose", rawProps);
126
+ const cls = useHuiClassNames("DialogClose", BUTTON_CLASSES, rawProps);
127
+ const sls = useHuiStyles("DialogClose", rawProps);
109
128
  const dialogId = useDialogId();
110
129
  const attrs = normalizeAttributes(dialogControl.getCloseAttributes({ id: dialogId }));
111
130
  return /* @__PURE__ */ jsx(Button, {
112
131
  ...attrs,
113
- ...props
132
+ ...props,
133
+ classNames: cls,
134
+ styles: sls
114
135
  });
115
136
  }
116
137
  const Dialog = Object.assign(DialogRoot, {
@@ -118,7 +139,6 @@ const Dialog = Object.assign(DialogRoot, {
118
139
  Content,
119
140
  Close
120
141
  });
121
- //#endregion
122
142
  export { Dialog };
123
143
 
124
144
  //# sourceMappingURL=dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","names":[],"sources":["../../../src/components/dialog/dialog.tsx"],"sourcesContent":["import { type ButtonSlots, dialogControl, dialogRecipe, type DialogSlots, toStrbool } from \"@hebium-ui/core\";\nimport {\n type ComponentProps,\n type ElementType,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n useCallback,\n useId,\n useMemo,\n} from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { Heading, type HeadingProps } from \"../heading\";\nimport { DialogContext, type DialogContextValue, useDialogContext, useDialogId } from \"./dialog.context\";\n\nexport interface DialogProps {\n /**\n * The id of the dialog content element.\n */\n id?: string | undefined;\n /**\n * Whether the dialog should open as a modal dialog.\n *\n * @default false\n */\n modal?: boolean | undefined;\n children?: ReactNode | undefined;\n}\n\nfunction DialogRoot(rawProps: DialogProps): ReactElement {\n const {\n id,\n modal = false,\n children,\n } = useHuiProps(\"Dialog\", rawProps);\n\n const tmpId = useId();\n const dialogId = id || tmpId;\n const open = useCallback((): void => {\n dialogControl.openDialog(dialogId, modal);\n }, [dialogId, modal]);\n\n const contextValue = useMemo<DialogContextValue>(() => ({\n dialogId,\n modal,\n open,\n }), [dialogId, modal, open]);\n\n return (\n <DialogContext.Provider value={contextValue}>\n {children}\n </DialogContext.Provider>\n );\n}\n\nexport type DialogTriggerProps<E extends ElementType = typeof Button> = HuiPolymorphicProps<\n E,\n {},\n ButtonSlots\n>;\n\nfunction Trigger<E extends ElementType = typeof Button>(rawProps: DialogTriggerProps<E>): ReactNode {\n const {\n as,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"DialogTrigger\", rawProps);\n\n const Component = as ?? Button;\n const {\n dialogId,\n modal,\n open,\n } = useDialogContext();\n const attrs = normalizeAttributes(\n dialogControl.getTriggerAttributes(\n { id: dialogId },\n {\n modal,\n isButtonElement: as === undefined,\n },\n ),\n );\n\n const handleClick = useCallback((e: MouseEvent<HTMLElement>): void => {\n onClick?.(e);\n if (modal || e.defaultPrevented) return;\n\n open();\n }, [modal, onClick, open]);\n\n return (\n <Component\n {...attrs}\n onClick={handleClick}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ntype HtmlDialogProps = Omit<ComponentProps<\"dialog\">, \"children\" | \"id\" | \"open\">;\n\ninterface DialogContentOwnProps extends HtmlDialogProps {\n /**\n * The heading rendered at the top of the dialog content.\n */\n heading?: ReactNode | undefined;\n /**\n * Additional props passed to the internal heading component.\n */\n headingProps?: Omit<HeadingProps, \"children\" | \"id\" | \"className\" | \"style\"> | undefined;\n /**\n * The content rendered inside the internal close button. Set to `null` or `false` to hide the button.\n *\n * @default close icon\n */\n closeButton?: ReactNode | undefined;\n /**\n * Additional props passed to the internal close button.\n */\n closeButtonProps?: Omit<DialogCloseProps, \"children\" | \"className\" | \"style\"> | undefined;\n children?: ReactNode | undefined;\n}\nexport type DialogContentProps = HuiComponentProps<DialogContentOwnProps, DialogSlots>;\n\nfunction Content(rawProps: DialogContentProps): ReactElement {\n const {\n classNames,\n styles,\n children,\n heading,\n headingProps,\n closeButton,\n closeButtonProps,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...restProps\n } = useHuiProps(\"DialogContent\", rawProps);\n\n const {\n dialogId,\n modal,\n } = useDialogContext();\n\n const resolvedHeading = heading !== undefined && heading !== null && heading !== false\n ? heading\n : undefined;\n const state = { id: dialogId };\n const attrs = normalizeAttributes(\n dialogControl.getContentAttributes(\n state,\n {\n hasHeading: resolvedHeading !== undefined,\n ariaLabel,\n ariaLabelledBy,\n },\n ),\n );\n const headingAttrs = normalizeAttributes(dialogControl.getHeadingAttributes(state));\n const headingId = resolvedHeading !== undefined ? headingAttrs.id : undefined;\n const headingLevel = headingProps?.level ?? 2;\n\n const recipe = dialogRecipe({ modal: toStrbool(modal) });\n const cls = useHuiClassNames(\"DialogContent\", recipe, classNames);\n const sls = useHuiStyles(\"DialogContent\", styles);\n\n const shouldRenderCloseButton = closeButton !== null && closeButton !== false;\n const shouldRenderHeader = headingId !== undefined || shouldRenderCloseButton;\n const closeButtonContent = closeButton === undefined\n ? <span aria-hidden className={cls.closeButtonIcon} style={sls.closeButtonIcon} />\n : closeButton;\n\n return (\n <dialog\n {...attrs}\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {shouldRenderHeader && (\n <div className={cls.header} style={sls.header}>\n {headingId && (\n <Heading\n margin=\"none\"\n {...headingProps}\n {...headingAttrs}\n className={cls.heading}\n style={sls.heading}\n level={headingLevel}\n >\n {resolvedHeading}\n </Heading>\n )}\n {shouldRenderCloseButton && (\n <Close\n className={cls.closeButton}\n style={sls.closeButton}\n aria-label=\"Close Dialog\"\n variant=\"ghost\"\n color=\"neutral\"\n shape=\"square\"\n {...closeButtonProps}\n >\n {closeButtonContent}\n </Close>\n )}\n </div>\n )}\n {children}\n </dialog>\n );\n}\n\nexport interface DialogCloseProps extends Omit<ButtonProps, \"as\"> {\n /**\n * The command used to close the dialog.\n *\n * @default \"request-close\"\n */\n command?: \"close\" | \"request-close\" | undefined;\n}\n\nfunction Close(rawProps: DialogCloseProps): ReactNode {\n const props = useHuiProps(\"DialogClose\", rawProps);\n const dialogId = useDialogId();\n const attrs = normalizeAttributes(dialogControl.getCloseAttributes({ id: dialogId }));\n\n return (\n <Button\n {...attrs}\n {...props}\n />\n );\n}\n\nexport const Dialog = Object.assign(DialogRoot, {\n Trigger,\n Content,\n Close,\n});\n"],"mappings":";;;;;;;;;AAgCA,SAAS,WAAW,UAAqC;CACvD,MAAM,EACJ,IACA,QAAQ,OACR,aACE,YAAY,UAAU,QAAQ;CAElC,MAAM,QAAQ,MAAM;CACpB,MAAM,WAAW,MAAM;CACvB,MAAM,OAAO,kBAAwB;EACnC,cAAc,WAAW,UAAU,KAAK;CAC1C,GAAG,CAAC,UAAU,KAAK,CAAC;CAEpB,MAAM,eAAe,eAAmC;EACtD;EACA;EACA;CACF,IAAI;EAAC;EAAU;EAAO;CAAI,CAAC;CAE3B,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;EAC5B;CACqB,CAAA;AAE5B;AAQA,SAAS,QAA+C,UAA4C;CAClG,MAAM,EACJ,IACA,UACA,SACA,GAAG,cACD,YAAY,iBAAiB,QAAQ;CAEzC,MAAM,YAAY,MAAM;CACxB,MAAM,EACJ,UACA,OACA,SACE,iBAAiB;CACrB,MAAM,QAAQ,oBACZ,cAAc,qBACZ,EAAE,IAAI,SAAS,GACf;EACE;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AA,CAMG,sBACC,qBAAC,OAAD;GAAK,WAAW,IAAI;GAAQ,OAAO,IAAI;GAAvC,UAAA,CACG,aACC,oBAAC,SAAD;IACE,QAAO;IACP,GAAI;IACJ,GAAI;IACJ,WAAW,IAAI;IACf,OAAO,IAAI;IACX,OAAO;IAEN,UAAA;GACM,CAAA,GAEV,2BACC,oBAAC,OAAD;IACE,WAAW,IAAI;IACf,OAAO,IAAI;IACX,cAAW;IACX,SAAQ;IACR,OAAM;IACN,OAAM;IACN,GAAI;IAEH,UAAA;GACI,CAAA,CAEN;EAEN,CAAA,GAAA,QACK;;AAEZ;AAWA,SAAS,MAAM,UAAuC;CACpD,MAAM,QAAQ,YAAY,eAAe,QAAQ;CACjD,MAAM,WAAW,YAAY;CAC7B,MAAM,QAAQ,oBAAoB,cAAc,mBAAmB,EAAE,IAAI,SAAS,CAAC,CAAC;CAEpF,OACE,oBAAC,QAAD;EACE,GAAI;EACJ,GAAI;CACL,CAAA;AAEL;AAEA,MAAa,SAAS,OAAO,OAAO,YAAY;CAC9C;CACA;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"dialog.js","names":[],"sources":["../../../src/components/dialog/dialog.tsx"],"sourcesContent":["import { type ButtonSlots, dialogControl, dialogRecipe, type DialogSlots, toStrbool } from \"@hebium-ui/core\";\nimport {\n type ComponentProps,\n type ElementType,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n useCallback,\n useId,\n useMemo,\n} from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { Heading, type HeadingProps } from \"../heading\";\nimport { DialogContext, type DialogContextValue, useDialogContext, useDialogId } from \"./dialog.context\";\n\nconst BUTTON_CLASSES = { root: \"\", content: \"\", spinner: \"\", status: \"\" } satisfies Record<ButtonSlots, string>;\n\nexport interface DialogProps {\n /**\n * The id of the dialog content element.\n */\n id?: string | undefined;\n /**\n * Whether the dialog should open as a modal dialog.\n *\n * @default false\n */\n modal?: boolean | undefined;\n children?: ReactNode | undefined;\n}\n\nfunction DialogRoot(rawProps: DialogProps): ReactElement {\n const {\n id,\n modal = false,\n children,\n } = useHuiProps(\"Dialog\", rawProps);\n\n const tmpId = useId();\n const dialogId = id || tmpId;\n const open = useCallback((): void => {\n dialogControl.openDialog(dialogId, modal);\n }, [dialogId, modal]);\n\n const contextValue = useMemo<DialogContextValue>(() => ({\n dialogId,\n modal,\n open,\n }), [dialogId, modal, open]);\n\n return (\n <DialogContext.Provider value={contextValue}>\n {children}\n </DialogContext.Provider>\n );\n}\n\nexport type DialogTriggerProps<E extends ElementType = typeof Button<\"button\">> = HuiPolymorphicProps<\n E,\n {},\n ButtonSlots\n>;\n\nfunction Trigger<E extends ElementType = typeof Button<\"button\">>(rawProps: DialogTriggerProps<E>): ReactNode {\n const {\n as,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"DialogTrigger\", rawProps);\n\n const Component = as ?? Button;\n const cls = useHuiClassNames(\"DialogTrigger\", BUTTON_CLASSES, rawProps);\n const sls = useHuiStyles(\"DialogTrigger\", rawProps);\n const {\n dialogId,\n modal,\n open,\n } = useDialogContext();\n const attrs = normalizeAttributes(\n dialogControl.getTriggerAttributes(\n { id: dialogId },\n {\n modal,\n isButtonElement: as === undefined,\n },\n ),\n );\n\n const handleClick = useCallback((e: MouseEvent<HTMLElement>): void => {\n onClick?.(e);\n if (modal || e.defaultPrevented) return;\n\n open();\n }, [modal, onClick, open]);\n\n return (\n <Component\n {...attrs}\n {...(Component === Button\n ? { classNames: cls, styles: sls }\n : { className: cls.root, style: sls.root })}\n onClick={handleClick}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ntype HtmlDialogProps = Omit<ComponentProps<\"dialog\">, \"children\" | \"id\" | \"open\">;\n\ninterface DialogContentOwnProps extends HtmlDialogProps {\n /**\n * The heading rendered at the top of the dialog content.\n */\n heading?: ReactNode | undefined;\n /**\n * Additional props passed to the internal heading component.\n */\n headingProps?: Omit<HeadingProps, \"children\" | \"id\" | \"className\" | \"style\"> | undefined;\n /**\n * The content rendered inside the internal close button. Set to `null` or `false` to hide the button.\n *\n * @default close icon\n */\n closeButton?: ReactNode | undefined;\n /**\n * Additional props passed to the internal close button.\n */\n closeButtonProps?: Omit<DialogCloseProps, \"children\" | \"classNames\" | \"styles\"> | undefined;\n children?: ReactNode | undefined;\n}\nexport type DialogContentProps = HuiComponentProps<DialogContentOwnProps, DialogSlots>;\n\nfunction Content(rawProps: DialogContentProps): ReactElement {\n const {\n children,\n heading,\n headingProps,\n closeButton,\n closeButtonProps,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...restProps\n } = useHuiProps(\"DialogContent\", rawProps);\n\n const {\n dialogId,\n modal,\n } = useDialogContext();\n\n const resolvedHeading = heading !== undefined && heading !== null && heading !== false\n ? heading\n : undefined;\n const state = { id: dialogId };\n const attrs = normalizeAttributes(\n dialogControl.getContentAttributes(\n state,\n {\n hasHeading: resolvedHeading !== undefined,\n ariaLabel,\n ariaLabelledBy,\n },\n ),\n );\n const headingAttrs = normalizeAttributes(dialogControl.getHeadingAttributes(state));\n const headingId = resolvedHeading !== undefined ? headingAttrs.id : undefined;\n const headingLevel = headingProps?.level ?? 2;\n\n const recipe = dialogRecipe({ modal: toStrbool(modal) });\n const cls = useHuiClassNames(\"DialogContent\", recipe, rawProps);\n const sls = useHuiStyles(\"DialogContent\", rawProps);\n const closeButtonClassNames = 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 classNames={closeButtonClassNames}\n styles={closeButtonStyles}\n aria-label=\"Close Dialog\"\n variant=\"ghost\"\n color=\"neutral\"\n shape=\"square\"\n {...closeButtonProps}\n >\n {closeButtonContent}\n </Close>\n )}\n </div>\n )}\n {children}\n </dialog>\n );\n}\n\nexport interface DialogCloseProps extends Omit<ButtonProps, \"as\"> {\n /**\n * The command used to close the dialog.\n *\n * @default \"request-close\"\n */\n command?: \"close\" | \"request-close\" | undefined;\n}\n\nfunction Close(rawProps: DialogCloseProps): ReactNode {\n const props = useHuiProps(\"DialogClose\", rawProps);\n const cls = useHuiClassNames(\"DialogClose\", BUTTON_CLASSES, rawProps);\n const sls = useHuiStyles(\"DialogClose\", rawProps);\n const dialogId = useDialogId();\n const attrs = normalizeAttributes(dialogControl.getCloseAttributes({ id: dialogId }));\n\n return (\n <Button\n {...attrs}\n {...props}\n classNames={cls}\n styles={sls}\n />\n );\n}\n\nexport const Dialog = Object.assign(DialogRoot, {\n Trigger,\n Content,\n Close,\n});\n"],"mappings":";;;;;;;;;AAkBA,MAAM,iBAAiB;CAAE,MAAM;CAAI,SAAS;CAAI,SAAS;CAAI,QAAQ;AAAG;AAgBxE,SAAS,WAAW,UAAqC;CACvD,MAAM,EACJ,IACA,QAAQ,OACR,aACE,YAAY,UAAU,QAAQ;CAElC,MAAM,QAAQ,MAAM;CACpB,MAAM,WAAW,MAAM;CACvB,MAAM,OAAO,kBAAwB;EACnC,cAAc,WAAW,UAAU,KAAK;CAC1C,GAAG,CAAC,UAAU,KAAK,CAAC;CAEpB,MAAM,eAAe,eAAmC;EACtD;EACA;EACA;CACF,IAAI;E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,QAAQ,oBAAoB,cAAc,mBAAmB,EAAE,IAAI,SAAS,CAAC,CAAC;CAEpF,OACE,oBAAC,QAAD;EACE,GAAI;EACJ,GAAI;EACJ,YAAY;EACZ,QAAQ;CACT,CAAA;AAEL;AAEA,MAAa,SAAS,OAAO,OAAO,YAAY;CAC9C;CACA;CACA;AACF,CAAC"}
@@ -1,3 +1,2 @@
1
1
  import { Dialog, DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps } from "./dialog.js";
2
- import { useDialogId } from "./dialog.context.js";
3
- export { Dialog, DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps, useDialogId };
2
+ export { Dialog, DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps };
@@ -2,7 +2,6 @@ import { HuiComponentProps } from "../../types/hui-component.js";
2
2
  import "../../types/index.js";
3
3
  import { DdSlots, DlSlots, DtSlots } from "@hebium-ui/core";
4
4
  import { ComponentProps, ReactElement } from "react";
5
- //#region src/components/dl/dl.d.ts
6
5
  export interface DlProps extends HuiComponentProps<ComponentProps<"dl">, DlSlots> {}
7
6
  declare function DlRoot(rawProps: DlProps): ReactElement;
8
7
  export interface DtProps extends HuiComponentProps<ComponentProps<"dt">, DtSlots> {}
@@ -13,6 +12,4 @@ export declare const Dl: typeof DlRoot & {
13
12
  Dt: typeof Dt;
14
13
  Dd: typeof Dd;
15
14
  };
16
- //#endregion
17
- export {};
18
- //# sourceMappingURL=dl.d.ts.map
15
+ export {};
@@ -1,12 +1,12 @@
1
1
  import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
2
  import { ddRecipe, dlRecipe, dtRecipe } from "@hebium-ui/core";
3
3
  import { jsx } from "react/jsx-runtime";
4
- //#region src/components/dl/dl.tsx
4
+ // src/components/dl/dl.tsx
5
5
  function DlRoot(rawProps) {
6
- const { className, style, children, ...restProps } = useHuiProps("Dl", rawProps);
6
+ const { children, ...restProps } = useHuiProps("Dl", rawProps);
7
7
  const recipe = dlRecipe({});
8
- const cls = useHuiClassNames("Dl", recipe, { root: className });
9
- const sls = useHuiStyles("Dl", { root: style });
8
+ const cls = useHuiClassNames("Dl", recipe, rawProps);
9
+ const sls = useHuiStyles("Dl", rawProps);
10
10
  return /* @__PURE__ */ jsx("dl", {
11
11
  className: cls.root,
12
12
  style: sls.root,
@@ -15,10 +15,10 @@ function DlRoot(rawProps) {
15
15
  });
16
16
  }
17
17
  function Dt(rawProps) {
18
- const { className, style, children, ...restProps } = useHuiProps("DlDt", rawProps);
18
+ const { children, ...restProps } = useHuiProps("DlDt", rawProps);
19
19
  const recipe = dtRecipe({});
20
- const cls = useHuiClassNames("DlDt", recipe, { root: className });
21
- const sls = useHuiStyles("DlDt", { root: style });
20
+ const cls = useHuiClassNames("DlDt", recipe, rawProps);
21
+ const sls = useHuiStyles("DlDt", rawProps);
22
22
  return /* @__PURE__ */ jsx("dt", {
23
23
  className: cls.root,
24
24
  style: sls.root,
@@ -27,10 +27,10 @@ function Dt(rawProps) {
27
27
  });
28
28
  }
29
29
  function Dd(rawProps) {
30
- const { className, style, children, ...restProps } = useHuiProps("DlDd", rawProps);
30
+ const { children, ...restProps } = useHuiProps("DlDd", rawProps);
31
31
  const recipe = ddRecipe({});
32
- const cls = useHuiClassNames("DlDd", recipe, { root: className });
33
- const sls = useHuiStyles("DlDd", { root: style });
32
+ const cls = useHuiClassNames("DlDd", recipe, rawProps);
33
+ const sls = useHuiStyles("DlDd", rawProps);
34
34
  return /* @__PURE__ */ jsx("dd", {
35
35
  className: cls.root,
36
36
  style: sls.root,
@@ -42,7 +42,6 @@ const Dl = Object.assign(DlRoot, {
42
42
  Dt,
43
43
  Dd
44
44
  });
45
- //#endregion
46
45
  export { Dl };
47
46
 
48
47
  //# sourceMappingURL=dl.js.map
@@ -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 ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport interface DlProps extends HuiComponentProps<ComponentProps<\"dl\">, DlSlots> {}\n\nfunction DlRoot(rawProps: DlProps): ReactElement {\n const {\n className,\n style,\n children,\n ...restProps\n } = useHuiProps(\"Dl\", rawProps);\n\n const recipe = dlRecipe({});\n const cls = useHuiClassNames(\"Dl\", recipe, { root: className });\n const sls = useHuiStyles(\"Dl\", { root: style });\n return (\n <dl\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </dl>\n );\n}\n\nexport interface DtProps extends HuiComponentProps<ComponentProps<\"dt\">, DtSlots> {}\n\nfunction Dt(rawProps: DtProps): ReactElement {\n const {\n className,\n style,\n children,\n ...restProps\n } = useHuiProps(\"DlDt\", rawProps);\n const recipe = dtRecipe({});\n\n const cls = useHuiClassNames(\"DlDt\", recipe, { root: className });\n const sls = useHuiStyles(\"DlDt\", { root: style });\n return (\n <dt\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </dt>\n );\n}\n\nexport interface DdProps extends HuiComponentProps<ComponentProps<\"dd\">, DdSlots> {}\n\nfunction Dd(rawProps: DdProps): ReactElement {\n const {\n className,\n style,\n children,\n ...restProps\n } = useHuiProps(\"DlDd\", rawProps);\n\n const recipe = ddRecipe({});\n const cls = useHuiClassNames(\"DlDd\", recipe, { root: className });\n const sls = useHuiStyles(\"DlDd\", { root: style });\n\n return (\n <dd\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </dd>\n );\n}\n\nexport const Dl = Object.assign(DlRoot, {\n Dt,\n Dd,\n});\n"],"mappings":";;;;AAOA,SAAS,OAAO,UAAiC;CAC/C,MAAM,EACJ,WACA,OACA,UACA,GAAG,cACD,YAAY,MAAM,QAAQ;CAE9B,MAAM,SAAS,SAAS,CAAC,CAAC;CAC1B,MAAM,MAAM,iBAAiB,MAAM,QAAQ,EAAE,MAAM,UAAU,CAAC;CAC9D,MAAM,MAAM,aAAa,MAAM,EAAE,MAAM,MAAM,CAAC;CAC9C,OACE,oBAAC,MAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACC,CAAA;AAER;AAIA,SAAS,GAAG,UAAiC;CAC3C,MAAM,EACJ,WACA,OACA,UACA,GAAG,cACD,YAAY,QAAQ,QAAQ;CAChC,MAAM,SAAS,SAAS,CAAC,CAAC;CAE1B,MAAM,MAAM,iBAAiB,QAAQ,QAAQ,EAAE,MAAM,UAAU,CAAC;CAChE,MAAM,MAAM,aAAa,QAAQ,EAAE,MAAM,MAAM,CAAC;CAChD,OACE,oBAAC,MAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACC,CAAA;AAER;AAIA,SAAS,GAAG,UAAiC;CAC3C,MAAM,EACJ,WACA,OACA,UACA,GAAG,cACD,YAAY,QAAQ,QAAQ;CAEhC,MAAM,SAAS,SAAS,CAAC,CAAC;CAC1B,MAAM,MAAM,iBAAiB,QAAQ,QAAQ,EAAE,MAAM,UAAU,CAAC;CAChE,MAAM,MAAM,aAAa,QAAQ,EAAE,MAAM,MAAM,CAAC;CAEhD,OACE,oBAAC,MAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACC,CAAA;AAER;AAEA,MAAa,KAAK,OAAO,OAAO,QAAQ;CACtC;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"dl.js","names":[],"sources":["../../../src/components/dl/dl.tsx"],"sourcesContent":["import { ddRecipe, type DdSlots, dlRecipe, type DlSlots, dtRecipe, type DtSlots } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport interface DlProps extends HuiComponentProps<ComponentProps<\"dl\">, DlSlots> {}\n\nfunction DlRoot(rawProps: DlProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"Dl\", rawProps);\n\n const recipe = dlRecipe({});\n const cls = useHuiClassNames(\"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 interface DtProps extends HuiComponentProps<ComponentProps<\"dt\">, DtSlots> {}\n\nfunction Dt(rawProps: DtProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"DlDt\", rawProps);\n const recipe = dtRecipe({});\n\n const cls = useHuiClassNames(\"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 interface DdProps extends HuiComponentProps<ComponentProps<\"dd\">, DdSlots> {}\n\nfunction Dd(rawProps: DdProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"DlDd\", rawProps);\n\n const recipe = ddRecipe({});\n const cls = useHuiClassNames(\"DlDd\", recipe, rawProps);\n const sls = useHuiStyles(\"DlDd\", rawProps);\n\n return (\n <dd\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </dd>\n );\n}\n\nexport const Dl = Object.assign(DlRoot, {\n Dt,\n Dd,\n});\n"],"mappings":";;;;AAOA,SAAS,OAAO,UAAiC;CAC/C,MAAM,EAAE,UAAU,GAAG,cAAc,YAAY,MAAM,QAAQ;CAE7D,MAAM,SAAS,SAAS,CAAC,CAAC;CAC1B,MAAM,MAAM,iBAAiB,MAAM,QAAQ,QAAQ;CACnD,MAAM,MAAM,aAAa,MAAM,QAAQ;CACvC,OACE,oBAAC,MAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACC,CAAA;AAER;AAIA,SAAS,GAAG,UAAiC;CAC3C,MAAM,EAAE,UAAU,GAAG,cAAc,YAAY,QAAQ,QAAQ;CAC/D,MAAM,SAAS,SAAS,CAAC,CAAC;CAE1B,MAAM,MAAM,iBAAiB,QAAQ,QAAQ,QAAQ;CACrD,MAAM,MAAM,aAAa,QAAQ,QAAQ;CACzC,OACE,oBAAC,MAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACC,CAAA;AAER;AAIA,SAAS,GAAG,UAAiC;CAC3C,MAAM,EAAE,UAAU,GAAG,cAAc,YAAY,QAAQ,QAAQ;CAE/D,MAAM,SAAS,SAAS,CAAC,CAAC;CAC1B,MAAM,MAAM,iBAAiB,QAAQ,QAAQ,QAAQ;CACrD,MAAM,MAAM,aAAa,QAAQ,QAAQ;CAEzC,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,5 +1,5 @@
1
1
  import { createContext, useContext } from "react";
2
- //#region src/components/drawer/drawer.context.ts
2
+ // src/components/drawer/drawer.context.ts
3
3
  const DrawerContext = createContext(null);
4
4
  function useDrawerContext() {
5
5
  const context = useContext(DrawerContext);
@@ -9,7 +9,6 @@ function useDrawerContext() {
9
9
  function useDrawerId() {
10
10
  return useDrawerContext().drawerId;
11
11
  }
12
- //#endregion
13
12
  export { DrawerContext, useDrawerContext, useDrawerId };
14
13
 
15
14
  //# sourceMappingURL=drawer.context.js.map
@@ -7,7 +7,6 @@ import { HeadingProps } from "../heading/heading.js";
7
7
  import "../heading/index.js";
8
8
  import { ButtonSlots, DrawerSlots, DrawerVariants } from "@hebium-ui/core";
9
9
  import { ComponentProps, ElementType, ReactElement, ReactNode } from "react";
10
- //#region src/components/drawer/drawer.d.ts
11
10
  export interface DrawerProps {
12
11
  /**
13
12
  * The id of the drawer content element.
@@ -16,8 +15,8 @@ export interface DrawerProps {
16
15
  children?: ReactNode | undefined;
17
16
  }
18
17
  declare function DrawerRoot(rawProps: DrawerProps): ReactElement;
19
- export type DrawerTriggerProps<E extends ElementType = typeof Button> = HuiPolymorphicProps<E, {}, ButtonSlots>;
20
- declare function Trigger<E extends ElementType = typeof Button>(rawProps: DrawerTriggerProps<E>): ReactNode;
18
+ export type DrawerTriggerProps<E extends ElementType = typeof Button<"button">> = HuiPolymorphicProps<E, {}, ButtonSlots>;
19
+ declare function Trigger<E extends ElementType = typeof Button<"button">>(rawProps: DrawerTriggerProps<E>): ReactNode;
21
20
  type HtmlDialogProps = Omit<ComponentProps<"dialog">, "children" | "id" | "open">;
22
21
  interface DrawerContentOwnProps extends HtmlDialogProps {
23
22
  /**
@@ -43,7 +42,7 @@ interface DrawerContentOwnProps extends HtmlDialogProps {
43
42
  /**
44
43
  * Additional props passed to the internal close button.
45
44
  */
46
- closeButtonProps?: Omit<DrawerCloseProps, "children" | "className" | "style"> | undefined;
45
+ closeButtonProps?: Omit<DrawerCloseProps, "children" | "classNames" | "styles"> | undefined;
47
46
  children?: ReactNode | undefined;
48
47
  }
49
48
  export type DrawerContentProps = HuiComponentProps<DrawerContentOwnProps, DrawerSlots>;
@@ -62,6 +61,4 @@ export declare const Drawer: typeof DrawerRoot & {
62
61
  Content: typeof Content;
63
62
  Close: typeof Close;
64
63
  };
65
- //#endregion
66
- export {};
67
- //# sourceMappingURL=drawer.d.ts.map
64
+ export {};
@@ -1,12 +1,18 @@
1
1
  import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
- import { Button } from "../button/button.js";
3
2
  import { normalizeAttributes } from "../../utils/attributes/normalize-attributes.js";
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";
6
6
  import { dialogControl, drawerRecipe } from "@hebium-ui/core";
7
7
  import { useId, useMemo } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
- //#region src/components/drawer/drawer.tsx
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,6 +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;
29
+ const cls = useHuiClassNames("DrawerTrigger", BUTTON_CLASSES, rawProps);
30
+ const sls = useHuiStyles("DrawerTrigger", rawProps);
23
31
  const { drawerId } = useDrawerContext();
24
32
  const attrs = normalizeAttributes(dialogControl.getTriggerAttributes({ id: drawerId }, {
25
33
  modal: true,
@@ -27,13 +35,20 @@ function Trigger(rawProps) {
27
35
  }));
28
36
  return /* @__PURE__ */ jsx(Component, {
29
37
  ...attrs,
38
+ ...Component === Button ? {
39
+ classNames: cls,
40
+ styles: sls
41
+ } : {
42
+ className: cls.root,
43
+ style: sls.root
44
+ },
30
45
  onClick,
31
46
  ...restProps,
32
47
  children
33
48
  });
34
49
  }
35
50
  function Content(rawProps) {
36
- const { placement, classNames, styles, children, heading, headingProps, closeButton, closeButtonProps, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...restProps } = useHuiProps("DrawerContent", rawProps);
51
+ const { placement, children, heading, headingProps, closeButton, closeButtonProps, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...restProps } = useHuiProps("DrawerContent", rawProps);
37
52
  const { drawerId } = useDrawerContext();
38
53
  const resolvedHeading = heading !== void 0 && heading !== null && heading !== false ? heading : void 0;
39
54
  const state = { id: drawerId };
@@ -46,8 +61,10 @@ function Content(rawProps) {
46
61
  const headingId = resolvedHeading !== void 0 ? headingAttrs.id : void 0;
47
62
  const headingLevel = headingProps?.level ?? 2;
48
63
  const recipe = drawerRecipe({ placement });
49
- const cls = useHuiClassNames("DrawerContent", recipe, classNames);
50
- const sls = useHuiStyles("DrawerContent", styles);
64
+ const cls = useHuiClassNames("DrawerContent", recipe, rawProps);
65
+ const sls = useHuiStyles("DrawerContent", rawProps);
66
+ const closeButtonClassNames = useMemo(() => ({ root: cls.closeButton }), [cls.closeButton]);
67
+ const closeButtonStyles = useMemo(() => ({ root: sls.closeButton }), [sls.closeButton]);
51
68
  const shouldRenderCloseButton = closeButton !== null && closeButton !== false;
52
69
  const shouldRenderHeader = headingId !== void 0 || shouldRenderCloseButton;
53
70
  const closeButtonContent = closeButton === void 0 ? /* @__PURE__ */ jsx("span", {
@@ -72,8 +89,8 @@ function Content(rawProps) {
72
89
  level: headingLevel,
73
90
  children: resolvedHeading
74
91
  }), shouldRenderCloseButton && /* @__PURE__ */ jsx(Close, {
75
- className: cls.closeButton,
76
- style: sls.closeButton,
92
+ classNames: closeButtonClassNames,
93
+ styles: closeButtonStyles,
77
94
  "aria-label": "Close Drawer",
78
95
  variant: "ghost",
79
96
  color: "neutral",
@@ -86,11 +103,15 @@ function Content(rawProps) {
86
103
  }
87
104
  function Close(rawProps) {
88
105
  const props = useHuiProps("DrawerClose", rawProps);
106
+ const cls = useHuiClassNames("DrawerClose", BUTTON_CLASSES, rawProps);
107
+ const sls = useHuiStyles("DrawerClose", rawProps);
89
108
  const drawerId = useDrawerId();
90
109
  const attrs = normalizeAttributes(dialogControl.getCloseAttributes({ id: drawerId }));
91
110
  return /* @__PURE__ */ jsx(Button, {
92
111
  ...attrs,
93
- ...props
112
+ ...props,
113
+ classNames: cls,
114
+ styles: sls
94
115
  });
95
116
  }
96
117
  const Drawer = Object.assign(DrawerRoot, {
@@ -98,7 +119,6 @@ const Drawer = Object.assign(DrawerRoot, {
98
119
  Content,
99
120
  Close
100
121
  });
101
- //#endregion
102
122
  export { Drawer };
103
123
 
104
124
  //# sourceMappingURL=drawer.js.map
@@ -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 ComponentProps, type ElementType, type ReactElement, type ReactNode, useId, useMemo } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { Heading, type HeadingProps } from \"../heading\";\nimport { DrawerContext, type DrawerContextValue, useDrawerContext, useDrawerId } from \"./drawer.context\";\n\nexport interface DrawerProps {\n /**\n * The id of the drawer content element.\n */\n id?: string | undefined;\n children?: ReactNode | undefined;\n}\n\nfunction DrawerRoot(rawProps: DrawerProps): ReactElement {\n const {\n id,\n children,\n } = useHuiProps(\"Drawer\", rawProps);\n\n const tmpId = useId();\n const drawerId = id || tmpId;\n\n const contextValue = useMemo<DrawerContextValue>(() => ({\n drawerId,\n }), [drawerId]);\n\n return (\n <DrawerContext.Provider value={contextValue}>\n {children}\n </DrawerContext.Provider>\n );\n}\n\nexport type DrawerTriggerProps<E extends ElementType = typeof Button> = HuiPolymorphicProps<\n E,\n {},\n ButtonSlots\n>;\n\nfunction Trigger<E extends ElementType = typeof Button>(rawProps: DrawerTriggerProps<E>): ReactNode {\n const {\n as,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"DrawerTrigger\", rawProps);\n\n const Component = as ?? Button;\n const {\n drawerId,\n } = useDrawerContext();\n const attrs = normalizeAttributes(\n dialogControl.getTriggerAttributes(\n { id: drawerId },\n {\n modal: true,\n isButtonElement: as === undefined,\n },\n ),\n );\n\n return (\n <Component\n {...attrs}\n onClick={onClick}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ntype HtmlDialogProps = Omit<ComponentProps<\"dialog\">, \"children\" | \"id\" | \"open\">;\ninterface DrawerContentOwnProps extends HtmlDialogProps {\n /**\n * The edge from which the drawer enters.\n *\n * @default \"inline-end\"\n */\n placement?: DrawerVariants[\"placement\"] | undefined;\n /**\n * The heading rendered at the top of the drawer content.\n */\n heading?: ReactNode | undefined;\n /**\n * Additional props passed to the internal heading component.\n */\n headingProps?: Omit<HeadingProps, \"children\" | \"id\" | \"className\" | \"style\"> | undefined;\n /**\n * The content rendered inside the internal close button. Set to `null` or `false` to hide the button.\n *\n * @default close icon\n */\n closeButton?: ReactNode | undefined;\n /**\n * Additional props passed to the internal close button.\n */\n closeButtonProps?: Omit<DrawerCloseProps, \"children\" | \"className\" | \"style\"> | undefined;\n children?: ReactNode | undefined;\n}\nexport type DrawerContentProps = HuiComponentProps<DrawerContentOwnProps, DrawerSlots>;\n\nfunction Content(rawProps: DrawerContentProps): ReactElement {\n const {\n placement,\n classNames,\n styles,\n children,\n heading,\n headingProps,\n closeButton,\n closeButtonProps,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...restProps\n } = useHuiProps(\"DrawerContent\", rawProps);\n\n const {\n drawerId,\n } = useDrawerContext();\n\n const resolvedHeading = heading !== undefined && heading !== null && heading !== false\n ? heading\n : undefined;\n const state = { id: drawerId };\n const attrs = normalizeAttributes(\n dialogControl.getContentAttributes(\n state,\n {\n hasHeading: resolvedHeading !== undefined,\n ariaLabel,\n ariaLabelledBy,\n },\n ),\n );\n const headingAttrs = normalizeAttributes(dialogControl.getHeadingAttributes(state));\n const headingId = resolvedHeading !== undefined ? headingAttrs.id : undefined;\n const headingLevel = headingProps?.level ?? 2;\n const recipe = drawerRecipe({ placement });\n const cls = useHuiClassNames(\"DrawerContent\", recipe, classNames);\n const sls = useHuiStyles(\"DrawerContent\", styles);\n\n const shouldRenderCloseButton = closeButton !== null && closeButton !== false;\n const shouldRenderHeader = headingId !== undefined || shouldRenderCloseButton;\n const closeButtonContent = closeButton === undefined\n ? <span aria-hidden className={cls.closeButtonIcon} style={sls.closeButtonIcon} />\n : closeButton;\n\n return (\n <dialog\n {...attrs}\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {shouldRenderHeader && (\n <div className={cls.header} style={sls.header}>\n {headingId && (\n <Heading\n margin=\"none\"\n {...headingProps}\n {...headingAttrs}\n className={cls.heading}\n style={sls.heading}\n level={headingLevel}\n >\n {resolvedHeading}\n </Heading>\n )}\n {shouldRenderCloseButton && (\n <Close\n className={cls.closeButton}\n style={sls.closeButton}\n aria-label=\"Close Drawer\"\n variant=\"ghost\"\n color=\"neutral\"\n shape=\"square\"\n {...closeButtonProps}\n >\n {closeButtonContent}\n </Close>\n )}\n </div>\n )}\n {children}\n </dialog>\n );\n}\n\nexport interface DrawerCloseProps extends Omit<ButtonProps, \"as\"> {\n /**\n * The command used to close the drawer.\n *\n * @default \"request-close\"\n */\n command?: \"close\" | \"request-close\" | undefined;\n}\n\nfunction Close(rawProps: DrawerCloseProps): ReactNode {\n const props = useHuiProps(\"DrawerClose\", rawProps);\n const drawerId = useDrawerId();\n const attrs = normalizeAttributes(dialogControl.getCloseAttributes({ id: drawerId }));\n\n return (\n <Button\n {...attrs}\n {...props}\n />\n );\n}\n\nexport const Drawer = Object.assign(DrawerRoot, {\n Trigger,\n Content,\n Close,\n});\n"],"mappings":";;;;;;;;;AAiBA,SAAS,WAAW,UAAqC;CACvD,MAAM,EACJ,IACA,aACE,YAAY,UAAU,QAAQ;CAElC,MAAM,QAAQ,MAAM;CACpB,MAAM,WAAW,MAAM;CAEvB,MAAM,eAAe,eAAmC,EACtD,SACF,IAAI,CAAC,QAAQ,CAAC;CAEd,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;EAC5B;CACqB,CAAA;AAE5B;AAQA,SAAS,QAA+C,UAA4C;CAClG,MAAM,EACJ,IACA,UACA,SACA,GAAG,cACD,YAAY,iBAAiB,QAAQ;CAEzC,MAAM,YAAY,MAAM;CACxB,MAAM,EACJ,aACE,iBAAiB;CACrB,MAAM,QAAQ,oBACZ,cAAc,qBACZ,EAAE,IAAI,SAAS,GACf;EACE,OAAO;EACP,iBAAiB,OAAO,KAAA;CAC1B,CACF,CACF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A,GAEV,2BACC,oBAAC,OAAD;IACE,WAAW,IAAI;IACf,OAAO,IAAI;IACX,cAAW;IACX,SAAQ;IACR,OAAM;IACN,OAAM;IACN,GAAI;IAEH,UAAA;GACI,CAAA,CAEN;EAEN,CAAA,GAAA,QACK;;AAEZ;AAWA,SAAS,MAAM,UAAuC;CACpD,MAAM,QAAQ,YAAY,eAAe,QAAQ;CACjD,MAAM,WAAW,YAAY;CAC7B,MAAM,QAAQ,oBAAoB,cAAc,mBAAmB,EAAE,IAAI,SAAS,CAAC,CAAC;CAEpF,OACE,oBAAC,QAAD;EACE,GAAI;EACJ,GAAI;CACL,CAAA;AAEL;AAEA,MAAa,SAAS,OAAO,OAAO,YAAY;CAC9C;CACA;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"drawer.js","names":[],"sources":["../../../src/components/drawer/drawer.tsx"],"sourcesContent":["import { type ButtonSlots, dialogControl, drawerRecipe, type DrawerSlots, type DrawerVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ElementType, type ReactElement, type ReactNode, useId, useMemo } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { Heading, type HeadingProps } from \"../heading\";\nimport { DrawerContext, type DrawerContextValue, useDrawerContext, useDrawerId } from \"./drawer.context\";\n\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?: ReactNode | undefined;\n}\n\nfunction DrawerRoot(rawProps: DrawerProps): ReactElement {\n const {\n id,\n children,\n } = useHuiProps(\"Drawer\", rawProps);\n\n const tmpId = useId();\n const drawerId = id || tmpId;\n\n const contextValue = useMemo<DrawerContextValue>(() => ({\n drawerId,\n }), [drawerId]);\n\n return (\n <DrawerContext.Provider value={contextValue}>\n {children}\n </DrawerContext.Provider>\n );\n}\n\nexport type DrawerTriggerProps<E extends ElementType = typeof Button<\"button\">> = HuiPolymorphicProps<\n E,\n {},\n ButtonSlots\n>;\n\nfunction Trigger<E extends ElementType = typeof Button<\"button\">>(rawProps: DrawerTriggerProps<E>): ReactNode {\n const {\n as,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"DrawerTrigger\", rawProps);\n\n const Component = as ?? Button;\n const cls = useHuiClassNames(\"DrawerTrigger\", BUTTON_CLASSES, rawProps);\n const sls = useHuiStyles(\"DrawerTrigger\", rawProps);\n const {\n drawerId,\n } = useDrawerContext();\n const attrs = normalizeAttributes(\n dialogControl.getTriggerAttributes(\n { id: drawerId },\n {\n modal: true,\n isButtonElement: as === undefined,\n },\n ),\n );\n\n return (\n <Component\n {...attrs}\n {...(Component === Button\n ? { classNames: cls, styles: sls }\n : { className: cls.root, style: sls.root })}\n onClick={onClick}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ntype HtmlDialogProps = Omit<ComponentProps<\"dialog\">, \"children\" | \"id\" | \"open\">;\ninterface DrawerContentOwnProps extends HtmlDialogProps {\n /**\n * The edge from which the drawer enters.\n *\n * @default \"inline-end\"\n */\n placement?: DrawerVariants[\"placement\"] | undefined;\n /**\n * The heading rendered at the top of the drawer content.\n */\n heading?: ReactNode | undefined;\n /**\n * Additional props passed to the internal heading component.\n */\n headingProps?: Omit<HeadingProps, \"children\" | \"id\" | \"className\" | \"style\"> | undefined;\n /**\n * The content rendered inside the internal close button. Set to `null` or `false` to hide the button.\n *\n * @default close icon\n */\n closeButton?: ReactNode | undefined;\n /**\n * Additional props passed to the internal close button.\n */\n closeButtonProps?: Omit<DrawerCloseProps, \"children\" | \"classNames\" | \"styles\"> | undefined;\n children?: ReactNode | undefined;\n}\nexport type DrawerContentProps = HuiComponentProps<DrawerContentOwnProps, DrawerSlots>;\n\nfunction Content(rawProps: DrawerContentProps): ReactElement {\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 = normalizeAttributes(\n dialogControl.getContentAttributes(\n state,\n {\n hasHeading: resolvedHeading !== undefined,\n ariaLabel,\n ariaLabelledBy,\n },\n ),\n );\n const headingAttrs = normalizeAttributes(dialogControl.getHeadingAttributes(state));\n const headingId = resolvedHeading !== undefined ? headingAttrs.id : undefined;\n const headingLevel = headingProps?.level ?? 2;\n const recipe = drawerRecipe({ placement });\n const cls = useHuiClassNames(\"DrawerContent\", recipe, rawProps);\n const sls = useHuiStyles(\"DrawerContent\", rawProps);\n const closeButtonClassNames = 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 classNames={closeButtonClassNames}\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\nexport interface DrawerCloseProps extends Omit<ButtonProps, \"as\"> {\n /**\n * The command used to close the drawer.\n *\n * @default \"request-close\"\n */\n command?: \"close\" | \"request-close\" | undefined;\n}\n\nfunction Close(rawProps: DrawerCloseProps): ReactNode {\n const props = useHuiProps(\"DrawerClose\", rawProps);\n const cls = useHuiClassNames(\"DrawerClose\", BUTTON_CLASSES, rawProps);\n const sls = useHuiStyles(\"DrawerClose\", rawProps);\n const drawerId = useDrawerId();\n const attrs = normalizeAttributes(dialogControl.getCloseAttributes({ id: drawerId }));\n\n return (\n <Button\n {...attrs}\n {...props}\n classNames={cls}\n styles={sls}\n />\n );\n}\n\nexport const Drawer = Object.assign(DrawerRoot, {\n Trigger,\n Content,\n Close,\n});\n"],"mappings":";;;;;;;;;AASA,MAAM,iBAAiB;CAAE,MAAM;CAAI,SAAS;CAAI,SAAS;CAAI,QAAQ;AAAG;AAUxE,SAAS,WAAW,UAAqC;CACvD,MAAM,EACJ,IACA,aACE,YAAY,UAAU,QAAQ;CAElC,MAAM,QAAQ,MAAM;CACpB,MAAM,WAAW,MAAM;CAEvB,MAAM,eAAe,eAAmC,EACtD,SACF,IAAI,CAAC,QAAQ,CAAC;CAEd,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;EAC5B;CACqB,CAAA;AAE5B;AAQA,SAAS,QAAyD,UAA4C;CAC5G,MAAM,EACJ,IACA,UACA,SACA,GAAG,cACD,YAAY,iBAAiB,QAAQ;CAEzC,MAAM,YAAY,MAAM;CACxB,MAAM,MAAM,iBAAiB,iBAAiB,gBAAgB,QAAQ;CACtE,MAAM,MAAM,aAAa,iBAAiB,QAAQ;CAClD,MAAM,EACJ,aACE,iBAAiB;CACrB,MAAM,QAAQ,oBACZ,cAAc,qBACZ,EAAE,IAAI,SAAS,GACf;EACE,OAAO;EACP,iBAAiB,OAAO,KAAA;CAC1B,CACF,CACF;CAEA,OACE,oBAAC,WAAD;EACE,GAAI;EACJ,GAAK,cAAc,SACf;GAAE,YAAY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BACC,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,YAAY;IACZ,QAAQ;IACR,cAAW;IACX,SAAQ;IACR,OAAM;IACN,OAAM;IACN,GAAI;IAEH,UAAA;GACI,CAAA,CAEN;EAEN,CAAA,GAAA,QACK;;AAEZ;AAWA,SAAS,MAAM,UAAuC;CACpD,MAAM,QAAQ,YAAY,eAAe,QAAQ;CACjD,MAAM,MAAM,iBAAiB,eAAe,gBAAgB,QAAQ;CACpE,MAAM,MAAM,aAAa,eAAe,QAAQ;CAChD,MAAM,WAAW,YAAY;CAC7B,MAAM,QAAQ,oBAAoB,cAAc,mBAAmB,EAAE,IAAI,SAAS,CAAC,CAAC;CAEpF,OACE,oBAAC,QAAD;EACE,GAAI;EACJ,GAAI;EACJ,YAAY;EACZ,QAAQ;CACT,CAAA;AAEL;AAEA,MAAa,SAAS,OAAO,OAAO,YAAY;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 };
@@ -2,8 +2,5 @@ import { HuiComponentProps } from "../../types/hui-component.js";
2
2
  import "../../types/index.js";
3
3
  import { FieldsetSlots } from "@hebium-ui/core";
4
4
  import { ComponentProps, ReactElement } from "react";
5
- //#region src/components/fieldset/fieldset.d.ts
6
5
  export type FieldsetProps = HuiComponentProps<ComponentProps<"fieldset">, FieldsetSlots>;
7
- export declare function Fieldset(rawProps: FieldsetProps): ReactElement;
8
- //#endregion
9
- //# sourceMappingURL=fieldset.d.ts.map
6
+ export declare function Fieldset(rawProps: FieldsetProps): ReactElement;
@@ -1,12 +1,12 @@
1
1
  import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
2
  import { fieldsetRecipe } from "@hebium-ui/core";
3
3
  import { jsx } from "react/jsx-runtime";
4
- //#region src/components/fieldset/fieldset.tsx
4
+ // src/components/fieldset/fieldset.tsx
5
5
  function Fieldset(rawProps) {
6
- const { className, style, children, ...restProps } = useHuiProps("Fieldset", rawProps);
6
+ const { children, ...restProps } = useHuiProps("Fieldset", rawProps);
7
7
  const recipe = fieldsetRecipe({});
8
- const cls = useHuiClassNames("Fieldset", recipe, { root: className });
9
- const sls = useHuiStyles("Fieldset", { root: style });
8
+ const cls = useHuiClassNames("Fieldset", recipe, rawProps);
9
+ const sls = useHuiStyles("Fieldset", rawProps);
10
10
  return /* @__PURE__ */ jsx("fieldset", {
11
11
  className: cls.root,
12
12
  style: sls.root,
@@ -14,7 +14,6 @@ function Fieldset(rawProps) {
14
14
  children
15
15
  });
16
16
  }
17
- //#endregion
18
17
  export { Fieldset };
19
18
 
20
19
  //# sourceMappingURL=fieldset.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fieldset.js","names":[],"sources":["../../../src/components/fieldset/fieldset.tsx"],"sourcesContent":["import { fieldsetRecipe, type FieldsetSlots } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport type FieldsetProps = HuiComponentProps<\n ComponentProps<\"fieldset\">,\n FieldsetSlots\n>;\n\nexport function Fieldset(rawProps: FieldsetProps): ReactElement {\n const {\n className,\n style,\n children,\n ...restProps\n } = useHuiProps(\"Fieldset\", rawProps);\n\n const recipe = fieldsetRecipe({});\n const cls = useHuiClassNames(\"Fieldset\", recipe, { root: className });\n const sls = useHuiStyles(\"Fieldset\", { root: style });\n\n return (\n <fieldset\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </fieldset>\n );\n}\n"],"mappings":";;;;AAUA,SAAgB,SAAS,UAAuC;CAC9D,MAAM,EACJ,WACA,OACA,UACA,GAAG,cACD,YAAY,YAAY,QAAQ;CAEpC,MAAM,SAAS,eAAe,CAAC,CAAC;CAChC,MAAM,MAAM,iBAAiB,YAAY,QAAQ,EAAE,MAAM,UAAU,CAAC;CACpE,MAAM,MAAM,aAAa,YAAY,EAAE,MAAM,MAAM,CAAC;CAEpD,OACE,oBAAC,YAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACO,CAAA;AAEd"}
1
+ {"version":3,"file":"fieldset.js","names":[],"sources":["../../../src/components/fieldset/fieldset.tsx"],"sourcesContent":["import { fieldsetRecipe, type FieldsetSlots } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport type FieldsetProps = HuiComponentProps<\n ComponentProps<\"fieldset\">,\n FieldsetSlots\n>;\n\nexport function Fieldset(rawProps: FieldsetProps): ReactElement {\n const {\n children,\n ...restProps\n } = useHuiProps(\"Fieldset\", rawProps);\n\n const recipe = fieldsetRecipe({});\n const cls = useHuiClassNames(\"Fieldset\", recipe, rawProps);\n const sls = useHuiStyles(\"Fieldset\", rawProps);\n\n return (\n <fieldset\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </fieldset>\n );\n}\n"],"mappings":";;;;AAUA,SAAgB,SAAS,UAAuC;CAC9D,MAAM,EACJ,UACA,GAAG,cACD,YAAY,YAAY,QAAQ;CAEpC,MAAM,SAAS,eAAe,CAAC,CAAC;CAChC,MAAM,MAAM,iBAAiB,YAAY,QAAQ,QAAQ;CACzD,MAAM,MAAM,aAAa,YAAY,QAAQ;CAE7C,OACE,oBAAC,YAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACO,CAAA;AAEd"}
@@ -2,7 +2,6 @@ import { HuiComponentProps } from "../../types/hui-component.js";
2
2
  import "../../types/index.js";
3
3
  import { HeadingSlots, HeadingVariants } from "@hebium-ui/core";
4
4
  import { ComponentProps, ReactElement } from "react";
5
- //#region src/components/heading/heading.d.ts
6
5
  export interface HeadingProps extends HuiComponentProps<ComponentProps<"h2">, HeadingSlots> {
7
6
  /**
8
7
  * The heading level used to choose the rendered heading element.
@@ -17,6 +16,4 @@ export interface HeadingProps extends HuiComponentProps<ComponentProps<"h2">, He
17
16
  */
18
17
  margin?: HeadingVariants["margin"] | undefined;
19
18
  }
20
- export declare function Heading(rawProps: HeadingProps): ReactElement;
21
- //#endregion
22
- //# sourceMappingURL=heading.d.ts.map
19
+ export declare function Heading(rawProps: HeadingProps): ReactElement;
@@ -1,16 +1,16 @@
1
1
  import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
2
  import { headingRecipe } from "@hebium-ui/core";
3
3
  import { jsx } from "react/jsx-runtime";
4
- //#region src/components/heading/heading.tsx
4
+ // src/components/heading/heading.tsx
5
5
  function Heading(rawProps) {
6
- const { level = 2, margin, className, style, children, ...restProps } = useHuiProps("Heading", rawProps);
6
+ const { level = 2, margin, children, ...restProps } = useHuiProps("Heading", rawProps);
7
7
  const Component = `h${level}`;
8
8
  const recipe = headingRecipe({
9
9
  level: `${level}`,
10
10
  margin
11
11
  });
12
- const cls = useHuiClassNames("Heading", recipe, { root: className });
13
- const sls = useHuiStyles("Heading", { root: style });
12
+ const cls = useHuiClassNames("Heading", recipe, rawProps);
13
+ const sls = useHuiStyles("Heading", rawProps);
14
14
  return /* @__PURE__ */ jsx(Component, {
15
15
  className: cls.root,
16
16
  style: sls.root,
@@ -18,7 +18,6 @@ function Heading(rawProps) {
18
18
  children
19
19
  });
20
20
  }
21
- //#endregion
22
21
  export { Heading };
23
22
 
24
23
  //# sourceMappingURL=heading.js.map
@@ -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 ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport interface HeadingProps extends HuiComponentProps<ComponentProps<\"h2\">, HeadingSlots> {\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 function Heading(rawProps: HeadingProps): ReactElement {\n const {\n level = 2,\n margin,\n className,\n style,\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 = useHuiClassNames(\"Heading\", recipe, { root: className });\n const sls = useHuiStyles(\"Heading\", { 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":";;;;AAoBA,SAAgB,QAAQ,UAAsC;CAC5D,MAAM,EACJ,QAAQ,GACR,QACA,WACA,OACA,UACA,GAAG,cACD,YAAY,WAAW,QAAQ;CAEnC,MAAM,YAAY,IAAI;CAEtB,MAAM,SAAS,cAAc;EAAE,OAAO,GAAG;EAAS;CAAO,CAAC;CAC1D,MAAM,MAAM,iBAAiB,WAAW,QAAQ,EAAE,MAAM,UAAU,CAAC;CACnE,MAAM,MAAM,aAAa,WAAW,EAAE,MAAM,MAAM,CAAC;CAEnD,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 ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport interface HeadingProps extends HuiComponentProps<ComponentProps<\"h2\">, HeadingSlots> {\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 function Heading(rawProps: HeadingProps): ReactElement {\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 = useHuiClassNames(\"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":";;;;AAoBA,SAAgB,QAAQ,UAAsC;CAC5D,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,iBAAiB,WAAW,QAAQ,QAAQ;CACxD,MAAM,MAAM,aAAa,WAAW,QAAQ;CAE5C,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
@@ -2,10 +2,7 @@ import { HuiPolymorphicProps } from "../../types/polymorphic.js";
2
2
  import "../../types/index.js";
3
3
  import { HrSlots } from "@hebium-ui/core";
4
4
  import { ComponentProps, ElementType, ReactElement } from "react";
5
- //#region src/components/hr/hr.d.ts
6
5
  interface HrOwnProps extends ComponentProps<"hr"> {}
7
6
  export type HrProps<E extends ElementType = "hr"> = HuiPolymorphicProps<E, HrOwnProps, HrSlots>;
8
7
  export declare function Hr<E extends ElementType = "hr">(rawProps: HrProps<E>): ReactElement;
9
- //#endregion
10
- export {};
11
- //# sourceMappingURL=hr.d.ts.map
8
+ export {};
@@ -1,19 +1,18 @@
1
1
  import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
2
  import { hrRecipe } from "@hebium-ui/core";
3
3
  import { jsx } from "react/jsx-runtime";
4
- //#region src/components/hr/hr.tsx
4
+ // src/components/hr/hr.tsx
5
5
  function Hr(rawProps) {
6
- const { as, className, style, ...restProps } = useHuiProps("Hr", rawProps);
6
+ const { as, ...restProps } = useHuiProps("Hr", rawProps);
7
7
  const recipe = hrRecipe();
8
- const cls = useHuiClassNames("Hr", recipe, { root: className });
9
- const sls = useHuiStyles("Hr", { root: style });
8
+ const cls = useHuiClassNames("Hr", recipe, rawProps);
9
+ const sls = useHuiStyles("Hr", rawProps);
10
10
  return /* @__PURE__ */ jsx(as ?? "hr", {
11
11
  className: cls.root,
12
12
  style: sls.root,
13
13
  ...restProps
14
14
  });
15
15
  }
16
- //#endregion
17
16
  export { Hr };
18
17
 
19
18
  //# sourceMappingURL=hr.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hr.js","names":[],"sources":["../../../src/components/hr/hr.tsx"],"sourcesContent":["import { hrRecipe, type HrSlots } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface HrOwnProps extends ComponentProps<\"hr\"> {}\n\nexport type HrProps<E extends ElementType = \"hr\"> = HuiPolymorphicProps<\n E,\n HrOwnProps,\n HrSlots\n>;\n\nexport function Hr<E extends ElementType = \"hr\">(rawProps: HrProps<E>): ReactElement {\n const {\n as,\n className,\n style,\n ...restProps\n } = useHuiProps(\"Hr\", rawProps);\n\n const recipe = hrRecipe();\n const cls = useHuiClassNames(\"Hr\", recipe, { root: className });\n const sls = useHuiStyles(\"Hr\", { root: style });\n\n const Component = as ?? \"hr\";\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...restProps}\n />\n );\n}\n"],"mappings":";;;;AAaA,SAAgB,GAAiC,UAAoC;CACnF,MAAM,EACJ,IACA,WACA,OACA,GAAG,cACD,YAAY,MAAM,QAAQ;CAE9B,MAAM,SAAS,SAAS;CACxB,MAAM,MAAM,iBAAiB,MAAM,QAAQ,EAAE,MAAM,UAAU,CAAC;CAC9D,MAAM,MAAM,aAAa,MAAM,EAAE,MAAM,MAAM,CAAC;CAG9C,OACE,oBAFgB,MAAM,MAEtB;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;CACL,CAAA;AAEL"}
1
+ {"version":3,"file":"hr.js","names":[],"sources":["../../../src/components/hr/hr.tsx"],"sourcesContent":["import { hrRecipe, type HrSlots } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface HrOwnProps extends ComponentProps<\"hr\"> {}\n\nexport type HrProps<E extends ElementType = \"hr\"> = HuiPolymorphicProps<\n E,\n HrOwnProps,\n HrSlots\n>;\n\nexport function Hr<E extends ElementType = \"hr\">(rawProps: HrProps<E>): ReactElement {\n const {\n as,\n ...restProps\n } = useHuiProps(\"Hr\", rawProps);\n\n const recipe = hrRecipe();\n const cls = useHuiClassNames(\"Hr\", recipe, rawProps);\n const sls = useHuiStyles(\"Hr\", rawProps);\n\n const Component = as ?? \"hr\";\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...restProps}\n />\n );\n}\n"],"mappings":";;;;AAaA,SAAgB,GAAiC,UAAoC;CACnF,MAAM,EACJ,IACA,GAAG,cACD,YAAY,MAAM,QAAQ;CAE9B,MAAM,SAAS,SAAS;CACxB,MAAM,MAAM,iBAAiB,MAAM,QAAQ,QAAQ;CACnD,MAAM,MAAM,aAAa,MAAM,QAAQ;CAGvC,OACE,oBAFgB,MAAM,MAEtB;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;CACL,CAAA;AAEL"}