@hebium-ui/react 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 (154) hide show
  1. package/dist/components/alert/alert.d.ts +3 -4
  2. package/dist/components/alert/alert.js +4 -11
  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 +2 -2
  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 +2 -2
  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 +29 -9
  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 +2 -2
  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 -2
  35. package/dist/components/details/details.js +2 -2
  36. package/dist/components/details/details.js.map +1 -1
  37. package/dist/components/dialog/dialog.d.ts +4 -5
  38. package/dist/components/dialog/dialog.js +26 -13
  39. package/dist/components/dialog/dialog.js.map +1 -1
  40. package/dist/components/dialog/index.d.ts +1 -2
  41. package/dist/components/dl/dl.d.ts +1 -2
  42. package/dist/components/dl/dl.js +6 -6
  43. package/dist/components/dl/dl.js.map +1 -1
  44. package/dist/components/drawer/drawer.d.ts +4 -5
  45. package/dist/components/drawer/drawer.js +26 -13
  46. package/dist/components/drawer/drawer.js.map +1 -1
  47. package/dist/components/drawer/index.d.ts +1 -2
  48. package/dist/components/fieldset/fieldset.d.ts +1 -2
  49. package/dist/components/fieldset/fieldset.js +2 -2
  50. package/dist/components/fieldset/fieldset.js.map +1 -1
  51. package/dist/components/heading/heading.d.ts +1 -2
  52. package/dist/components/heading/heading.js +2 -2
  53. package/dist/components/heading/heading.js.map +1 -1
  54. package/dist/components/hr/hr.d.ts +1 -2
  55. package/dist/components/hr/hr.js +2 -2
  56. package/dist/components/hr/hr.js.map +1 -1
  57. package/dist/components/index.d.ts +32 -27
  58. package/dist/components/inline-feedback/index.d.ts +2 -0
  59. package/dist/components/inline-feedback/inline-feedback.d.ts +33 -0
  60. package/dist/components/inline-feedback/inline-feedback.js +30 -0
  61. package/dist/components/inline-feedback/inline-feedback.js.map +1 -0
  62. package/dist/components/input/input.d.ts +1 -2
  63. package/dist/components/input/input.js +2 -2
  64. package/dist/components/input/input.js.map +1 -1
  65. package/dist/components/label/label.d.ts +1 -2
  66. package/dist/components/label/label.js +4 -4
  67. package/dist/components/label/label.js.map +1 -1
  68. package/dist/components/menu/index.d.ts +1 -2
  69. package/dist/components/menu/menu.d.ts +3 -4
  70. package/dist/components/menu/menu.js +20 -9
  71. package/dist/components/menu/menu.js.map +1 -1
  72. package/dist/components/multi-combobox/index.d.ts +2 -0
  73. package/dist/components/multi-combobox/multi-combobox-option.js +42 -0
  74. package/dist/components/multi-combobox/multi-combobox-option.js.map +1 -0
  75. package/dist/components/multi-combobox/multi-combobox-tag.js +54 -0
  76. package/dist/components/multi-combobox/multi-combobox-tag.js.map +1 -0
  77. package/dist/components/multi-combobox/multi-combobox.d.ts +72 -0
  78. package/dist/components/multi-combobox/multi-combobox.js +249 -0
  79. package/dist/components/multi-combobox/multi-combobox.js.map +1 -0
  80. package/dist/components/multi-combobox/use-multi-combobox-state.js +91 -0
  81. package/dist/components/multi-combobox/use-multi-combobox-state.js.map +1 -0
  82. package/dist/components/paragraph/paragraph.d.ts +1 -2
  83. package/dist/components/paragraph/paragraph.js +2 -2
  84. package/dist/components/paragraph/paragraph.js.map +1 -1
  85. package/dist/components/popover/index.d.ts +1 -2
  86. package/dist/components/popover/popover.d.ts +3 -4
  87. package/dist/components/popover/popover.js +18 -7
  88. package/dist/components/popover/popover.js.map +1 -1
  89. package/dist/components/progress/progress.d.ts +1 -2
  90. package/dist/components/progress/progress.js +2 -2
  91. package/dist/components/progress/progress.js.map +1 -1
  92. package/dist/components/radio/radio.d.ts +1 -2
  93. package/dist/components/radio/radio.js +2 -2
  94. package/dist/components/radio/radio.js.map +1 -1
  95. package/dist/components/radiogroup/radiogroup.d.ts +1 -2
  96. package/dist/components/radiogroup/radiogroup.js +5 -4
  97. package/dist/components/radiogroup/radiogroup.js.map +1 -1
  98. package/dist/components/section/section.d.ts +1 -2
  99. package/dist/components/section/section.js +2 -2
  100. package/dist/components/section/section.js.map +1 -1
  101. package/dist/components/segmented-control/segmented-control.d.ts +1 -2
  102. package/dist/components/segmented-control/segmented-control.js +10 -5
  103. package/dist/components/segmented-control/segmented-control.js.map +1 -1
  104. package/dist/components/select/select.d.ts +1 -2
  105. package/dist/components/select/select.js +2 -2
  106. package/dist/components/select/select.js.map +1 -1
  107. package/dist/components/skip-link/skip-link.d.ts +1 -2
  108. package/dist/components/skip-link/skip-link.js +2 -2
  109. package/dist/components/skip-link/skip-link.js.map +1 -1
  110. package/dist/components/status-icon/index.d.ts +2 -0
  111. package/dist/components/status-icon/status-icon.d.ts +19 -0
  112. package/dist/components/status-icon/status-icon.js +22 -0
  113. package/dist/components/status-icon/status-icon.js.map +1 -0
  114. package/dist/components/table/table.d.ts +4 -5
  115. package/dist/components/table/table.js +16 -16
  116. package/dist/components/table/table.js.map +1 -1
  117. package/dist/components/tabs/tabs.context.d.ts +1 -2
  118. package/dist/components/tabs/tabs.d.ts +1 -2
  119. package/dist/components/tabs/tabs.js +8 -8
  120. package/dist/components/tabs/tabs.js.map +1 -1
  121. package/dist/components/tag/index.d.ts +2 -0
  122. package/dist/components/tag/tag.d.ts +39 -0
  123. package/dist/components/tag/tag.js +41 -0
  124. package/dist/components/tag/tag.js.map +1 -0
  125. package/dist/components/text/text.d.ts +1 -2
  126. package/dist/components/text/text.js +2 -2
  127. package/dist/components/text/text.js.map +1 -1
  128. package/dist/components/textarea/textarea.d.ts +1 -2
  129. package/dist/components/textarea/textarea.js +2 -2
  130. package/dist/components/textarea/textarea.js.map +1 -1
  131. package/dist/components/tooltip/index.d.ts +1 -2
  132. package/dist/components/tooltip/tooltip.d.ts +3 -4
  133. package/dist/components/tooltip/tooltip.js +17 -6
  134. package/dist/components/tooltip/tooltip.js.map +1 -1
  135. package/dist/components/visually-hidden/visually-hidden.d.ts +1 -2
  136. package/dist/components/visually-hidden/visually-hidden.js +2 -2
  137. package/dist/components/visually-hidden/visually-hidden.js.map +1 -1
  138. package/dist/index.d.ts +7 -7
  139. package/dist/index.js +7 -7
  140. package/dist/provider/hui-provider.context.d.ts +23 -7
  141. package/dist/provider/hui-provider.context.js +13 -12
  142. package/dist/provider/hui-provider.context.js.map +1 -1
  143. package/dist/provider/hui-provider.d.ts +1 -2
  144. package/dist/provider/index.d.ts +1 -1
  145. package/dist/types/distributive.d.ts +1 -0
  146. package/dist/types/hui-component.d.ts +11 -5
  147. package/dist/types/index.d.ts +3 -2
  148. package/dist/types/polymorphic.d.ts +4 -9
  149. package/package.json +9 -9
  150. package/dist/components/dialog/dialog.context.d.ts +0 -2
  151. package/dist/components/drawer/drawer.context.d.ts +0 -2
  152. package/dist/components/menu/menu.context.d.ts +0 -2
  153. package/dist/components/popover/popover.context.d.ts +0 -2
  154. package/dist/components/tooltip/tooltip.context.d.ts +0 -2
@@ -12,9 +12,9 @@ interface AlertOwnProps extends Omit<ComponentProps<"div">, "children"> {
12
12
  */
13
13
  description?: ReactNode | undefined;
14
14
  /**
15
- * The icon displayed beside the alert content. Set to `null` or `false` to hide the icon.
15
+ * The alert icon. Set to `null` or `false` to hide.
16
16
  *
17
- * @default error icon
17
+ * @default StatusIcon with status="error"
18
18
  */
19
19
  icon?: ReactNode | undefined;
20
20
  /**
@@ -38,5 +38,4 @@ interface AlertOwnProps extends Omit<ComponentProps<"div">, "children"> {
38
38
  }
39
39
  export type AlertProps = HuiComponentProps<AlertOwnProps, AlertSlots>;
40
40
  export declare function Alert(rawProps: AlertProps): ReactElement;
41
- export {};
42
- //# sourceMappingURL=alert.d.ts.map
41
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
+ import { StatusIcon } from "../status-icon/status-icon.js";
2
3
  import { alertRecipe } from "@hebium-ui/core";
3
4
  import { jsx, jsxs } from "react/jsx-runtime";
4
5
  // src/components/alert/alert.tsx
@@ -9,22 +10,14 @@ function Alert(rawProps) {
9
10
  color,
10
11
  padding
11
12
  });
12
- const cls = useHuiClassNames("Alert", recipe, rawProps.classNames);
13
- const sls = useHuiStyles("Alert", rawProps.styles);
13
+ const cls = useHuiClassNames("Alert", recipe, rawProps);
14
+ const sls = useHuiStyles("Alert", rawProps);
14
15
  return /* @__PURE__ */ jsxs("div", {
15
16
  className: cls.root,
16
17
  style: sls.root,
17
18
  role: "alert",
18
19
  ...restProps,
19
- children: [/* @__PURE__ */ jsx("div", {
20
- className: cls.icon,
21
- style: sls.icon,
22
- children: typeof icon === "undefined" ? /* @__PURE__ */ jsx("span", {
23
- "aria-hidden": true,
24
- className: cls.errorIcon,
25
- style: sls.errorIcon
26
- }) : icon
27
- }), /* @__PURE__ */ jsxs("div", {
20
+ children: [typeof icon === "undefined" ? /* @__PURE__ */ jsx(StatusIcon, { status: "error" }) : icon, /* @__PURE__ */ jsxs("div", {
28
21
  className: cls.content,
29
22
  style: sls.content,
30
23
  children: [message && /* @__PURE__ */ jsx("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"alert.js","names":[],"sources":["../../../src/components/alert/alert.tsx"],"sourcesContent":["import { alertRecipe, type AlertSlots, type AlertVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement, type ReactNode } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface AlertOwnProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n /**\n * The main message displayed in the alert.\n */\n message?: ReactNode | undefined;\n /**\n * The description displayed below the alert message.\n */\n description?: ReactNode | undefined;\n /**\n * The icon displayed beside the alert content. Set to `null` or `false` to hide the icon.\n *\n * @default error icon\n */\n icon?: ReactNode | undefined;\n /**\n * The visual style of the alert.\n *\n * @default \"light\"\n */\n variant?: AlertVariants[\"variant\"] | undefined;\n /**\n * The semantic color of the alert.\n *\n * @default \"danger\"\n */\n color?: AlertVariants[\"color\"] | undefined;\n /**\n * The padding of the alert.\n *\n * @default \"md\"\n */\n padding?: AlertVariants[\"padding\"] | undefined;\n}\n\nexport type AlertProps = HuiComponentProps<\n AlertOwnProps,\n AlertSlots\n>;\n\nexport function Alert(rawProps: AlertProps): ReactElement {\n const {\n description,\n icon,\n variant,\n color,\n padding,\n message,\n ...restProps\n } = useHuiProps(\"Alert\", rawProps);\n\n const recipe = alertRecipe({\n variant,\n color,\n padding,\n });\n const cls = useHuiClassNames(\"Alert\", recipe, rawProps.classNames);\n const sls = useHuiStyles(\"Alert\", rawProps.styles);\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n role=\"alert\"\n {...restProps}\n >\n <div className={cls.icon} style={sls.icon}>\n {typeof icon === \"undefined\"\n ? (\n <span\n aria-hidden\n className={cls.errorIcon}\n style={sls.errorIcon}\n />\n )\n : icon}\n </div>\n <div className={cls.content} style={sls.content}>\n {message && <div className={cls.message} style={sls.message}>{message}</div>}\n {description\n && (\n <div className={cls.description} style={sls.description}>\n {description}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AA6CA,SAAgB,MAAM,UAAoC;CACxD,MAAM,EACJ,aACA,MACA,SACA,OACA,SACA,SACA,GAAG,cACD,YAAY,SAAS,QAAQ;CAEjC,MAAM,SAAS,YAAY;EACzB;EACA;EACA;CACF,CAAC;CACD,MAAM,MAAM,iBAAiB,SAAS,QAAQ,SAAS,UAAU;CACjE,MAAM,MAAM,aAAa,SAAS,SAAS,MAAM;CAEjD,OACE,qBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,MAAK;EACL,GAAI;EAJN,UAAA,CAME,oBAAC,OAAD;GAAK,WAAW,IAAI;GAAM,OAAO,IAAI;GAClC,UAAA,OAAO,SAAS,cAEb,oBAAC,QAAD;IACE,eAAA;IACA,WAAW,IAAI;IACf,OAAO,IAAI;GACZ,CAAA,IAED;EACD,CAAA,GACL,qBAAC,OAAD;GAAK,WAAW,IAAI;GAAS,OAAO,IAAI;GAAxC,UAAA,CACG,WAAW,oBAAC,OAAD;IAAK,WAAW,IAAI;IAAS,OAAO,IAAI;IAAU,UAAA;GAAa,CAAA,GAC1E,eAEG,oBAAC,OAAD;IAAK,WAAW,IAAI;IAAa,OAAO,IAAI;IACzC,UAAA;GACE,CAAA,CAEN;EACF,CAAA,CAAA;;AAET"}
1
+ {"version":3,"file":"alert.js","names":[],"sources":["../../../src/components/alert/alert.tsx"],"sourcesContent":["import { alertRecipe, type AlertSlots, type AlertVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement, type ReactNode } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\nimport { StatusIcon } from \"../status-icon\";\n\ninterface AlertOwnProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n /**\n * The main message displayed in the alert.\n */\n message?: ReactNode | undefined;\n /**\n * The description displayed below the alert message.\n */\n description?: ReactNode | undefined;\n /**\n * The alert icon. Set to `null` or `false` to hide.\n *\n * @default StatusIcon with status=\"error\"\n */\n icon?: ReactNode | undefined;\n /**\n * The visual style of the alert.\n *\n * @default \"light\"\n */\n variant?: AlertVariants[\"variant\"] | undefined;\n /**\n * The semantic color of the alert.\n *\n * @default \"danger\"\n */\n color?: AlertVariants[\"color\"] | undefined;\n /**\n * The padding of the alert.\n *\n * @default \"md\"\n */\n padding?: AlertVariants[\"padding\"] | undefined;\n}\n\nexport type AlertProps = HuiComponentProps<\n AlertOwnProps,\n AlertSlots\n>;\n\nexport function Alert(rawProps: AlertProps): ReactElement {\n const {\n description,\n icon,\n variant,\n color,\n padding,\n message,\n ...restProps\n } = useHuiProps(\"Alert\", rawProps);\n\n const recipe = alertRecipe({\n variant,\n color,\n padding,\n });\n const cls = useHuiClassNames(\"Alert\", recipe, rawProps);\n const sls = useHuiStyles(\"Alert\", rawProps);\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n role=\"alert\"\n {...restProps}\n >\n {typeof icon === \"undefined\"\n ? <StatusIcon status=\"error\" />\n : icon}\n <div className={cls.content} style={sls.content}>\n {message && <div className={cls.message} style={sls.message}>{message}</div>}\n {description\n && (\n <div className={cls.description} style={sls.description}>\n {description}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;AA8CA,SAAgB,MAAM,UAAoC;CACxD,MAAM,EACJ,aACA,MACA,SACA,OACA,SACA,SACA,GAAG,cACD,YAAY,SAAS,QAAQ;CAEjC,MAAM,SAAS,YAAY;EACzB;EACA;EACA;CACF,CAAC;CACD,MAAM,MAAM,iBAAiB,SAAS,QAAQ,QAAQ;CACtD,MAAM,MAAM,aAAa,SAAS,QAAQ;CAE1C,OACE,qBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,MAAK;EACL,GAAI;EAJN,UAAA,CAMG,OAAO,SAAS,cACb,oBAAC,YAAD,EAAY,QAAO,QAAS,CAAA,IAC5B,MACJ,qBAAC,OAAD;GAAK,WAAW,IAAI;GAAS,OAAO,IAAI;GAAxC,UAAA,CACG,WAAW,oBAAC,OAAD;IAAK,WAAW,IAAI;IAAS,OAAO,IAAI;IAAU,UAAA;GAAa,CAAA,GAC1E,eAEG,oBAAC,OAAD;IAAK,WAAW,IAAI;IAAa,OAAO,IAAI;IACzC,UAAA;GACE,CAAA,CAEN;EACF,CAAA,CAAA;;AAET"}
@@ -24,5 +24,4 @@ interface AnchorOwnProps {
24
24
  }
25
25
  export type AnchorProps<E extends ElementType = "a"> = HuiPolymorphicProps<E, AnchorOwnProps, AnchorSlots>;
26
26
  export declare function Anchor<E extends ElementType = "a">(rawProps: AnchorProps<E>): ReactElement;
27
- export {};
28
- //# sourceMappingURL=anchor.d.ts.map
27
+ export {};
@@ -10,8 +10,8 @@ function Anchor(rawProps) {
10
10
  decoration
11
11
  });
12
12
  const Component = as ?? "a";
13
- const cls = useHuiClassNames("Anchor", recipe, { root: rawProps["className"] });
14
- const sls = useHuiStyles("Anchor", { root: rawProps["style"] });
13
+ const cls = useHuiClassNames("Anchor", recipe, rawProps);
14
+ const sls = useHuiStyles("Anchor", rawProps);
15
15
  return /* @__PURE__ */ jsx(Component, {
16
16
  className: cls.root,
17
17
  style: sls.root,
@@ -1 +1 @@
1
- {"version":3,"file":"anchor.js","names":[],"sources":["../../../src/components/anchor/anchor.tsx"],"sourcesContent":["import { anchorRecipe, type AnchorSlots, type AnchorVariants } from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface AnchorOwnProps {\n /**\n * The semantic color of the anchor.\n *\n * @default \"accent\"\n */\n color?: AnchorVariants[\"color\"] | undefined;\n /**\n * The marker displayed before or after the anchor text.\n * Override `--hui-anchor-marker` to customize the marker content.\n * Include quotes in the CSS variable value because it is used as CSS `content`.\n */\n marker?: AnchorVariants[\"marker\"] | undefined;\n /**\n * The text decoration style of the anchor.\n *\n * @default \"underline\"\n */\n decoration?: AnchorVariants[\"decoration\"] | undefined;\n}\n\nexport type AnchorProps<E extends ElementType = \"a\"> = HuiPolymorphicProps<\n E,\n AnchorOwnProps,\n AnchorSlots\n>;\n\nexport function Anchor<E extends ElementType = \"a\">(rawProps: AnchorProps<E>): ReactElement {\n const {\n as,\n color,\n marker,\n decoration,\n children,\n ...restProps\n } = useHuiProps(\"Anchor\", rawProps);\n\n const recipe = anchorRecipe({ color, marker, decoration });\n const Component = as ?? \"a\";\n\n const cls = useHuiClassNames(\"Anchor\", recipe, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"Anchor\", { root: rawProps[\"style\"] });\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n"],"mappings":";;;;AAgCA,SAAgB,OAAoC,UAAwC;CAC1F,MAAM,EACJ,IACA,OACA,QACA,YACA,UACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,SAAS,aAAa;EAAE;EAAO;EAAQ;CAAW,CAAC;CACzD,MAAM,YAAY,MAAM;CAExB,MAAM,MAAM,iBAAiB,UAAU,QAAQ,EAAE,MAAM,SAAS,aAAa,CAAC;CAC9E,MAAM,MAAM,aAAa,UAAU,EAAE,MAAM,SAAS,SAAS,CAAC;CAE9D,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
1
+ {"version":3,"file":"anchor.js","names":[],"sources":["../../../src/components/anchor/anchor.tsx"],"sourcesContent":["import { anchorRecipe, type AnchorSlots, type AnchorVariants } from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface AnchorOwnProps {\n /**\n * The semantic color of the anchor.\n *\n * @default \"accent\"\n */\n color?: AnchorVariants[\"color\"] | undefined;\n /**\n * The marker displayed before or after the anchor text.\n * Override `--hui-anchor-marker` to customize the marker content.\n * Include quotes in the CSS variable value because it is used as CSS `content`.\n */\n marker?: AnchorVariants[\"marker\"] | undefined;\n /**\n * The text decoration style of the anchor.\n *\n * @default \"underline\"\n */\n decoration?: AnchorVariants[\"decoration\"] | undefined;\n}\n\nexport type AnchorProps<E extends ElementType = \"a\"> = HuiPolymorphicProps<\n E,\n AnchorOwnProps,\n AnchorSlots\n>;\n\nexport function Anchor<E extends ElementType = \"a\">(rawProps: AnchorProps<E>): ReactElement {\n const {\n as,\n color,\n marker,\n decoration,\n children,\n ...restProps\n } = useHuiProps(\"Anchor\", rawProps);\n\n const recipe = anchorRecipe({ color, marker, decoration });\n const Component = as ?? \"a\";\n\n const cls = useHuiClassNames(\"Anchor\", recipe, rawProps);\n const sls = useHuiStyles(\"Anchor\", 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":";;;;AAgCA,SAAgB,OAAoC,UAAwC;CAC1F,MAAM,EACJ,IACA,OACA,QACA,YACA,UACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,SAAS,aAAa;EAAE;EAAO;EAAQ;CAAW,CAAC;CACzD,MAAM,YAAY,MAAM;CAExB,MAAM,MAAM,iBAAiB,UAAU,QAAQ,QAAQ;CACvD,MAAM,MAAM,aAAa,UAAU,QAAQ;CAE3C,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
@@ -10,5 +10,4 @@ interface AvatarOwnProps extends ComponentProps<"img"> {
10
10
  }
11
11
  export type AvatarProps = HuiComponentProps<AvatarOwnProps, AvatarSlots>;
12
12
  export declare function Avatar(rawProps: AvatarProps): ReactElement;
13
- export {};
14
- //# sourceMappingURL=avatar.d.ts.map
13
+ export {};
@@ -12,8 +12,8 @@ function Avatar(rawProps) {
12
12
  failedSource
13
13
  });
14
14
  const recipe = avatartRecipe({ background: shouldShowPlaceholder ? "box" : "transparent" });
15
- const cls = useHuiClassNames("Avatar", recipe, rawProps.classNames);
16
- const sls = useHuiStyles("Avatar", rawProps.styles);
15
+ const cls = useHuiClassNames("Avatar", recipe, rawProps);
16
+ const sls = useHuiStyles("Avatar", rawProps);
17
17
  const handleOnError = useCallback((e) => {
18
18
  onError?.(e);
19
19
  setFailedSource({
@@ -1 +1 @@
1
- {"version":3,"file":"avatar.js","names":[],"sources":["../../../src/components/avatar/avatar.tsx"],"sourcesContent":["import {\n type AvatarSlots,\n type AvatarSource,\n avatartRecipe,\n getAvatarPlaceholder,\n shouldShowAvatarPlaceholder,\n} from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement, useCallback, useState } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface AvatarOwnProps extends ComponentProps<\"img\"> {\n /**\n * The name represented by the avatar. It is used as the default image alternative text and to generate placeholder initials.\n */\n name: string;\n}\n\nexport type AvatarProps = HuiComponentProps<\n AvatarOwnProps,\n AvatarSlots\n>;\n\nexport function Avatar(rawProps: AvatarProps): ReactElement {\n const {\n name,\n src,\n srcSet,\n alt,\n onError,\n ...restProps\n } = useHuiProps(\"Avatar\", rawProps);\n\n const [failedSource, setFailedSource] = useState<AvatarSource | null>(null);\n const shouldShowPlaceholder = shouldShowAvatarPlaceholder({ src, srcSet, failedSource });\n\n const recipe = avatartRecipe({\n background: shouldShowPlaceholder ? \"box\" : \"transparent\",\n });\n\n const cls = useHuiClassNames(\"Avatar\", recipe, rawProps.classNames);\n const sls = useHuiStyles(\"Avatar\", rawProps.styles);\n\n const handleOnError = useCallback((e: React.SyntheticEvent<HTMLImageElement, Event>) => {\n onError?.(e);\n\n setFailedSource({ src, srcSet });\n }, [onError, src, srcSet]);\n\n const placeholder = getAvatarPlaceholder(name);\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n >\n {shouldShowPlaceholder\n ? (\n <span\n className={cls.placeholder}\n style={sls.placeholder}\n >\n {placeholder}\n </span>\n )\n : (\n <img\n className={cls.img}\n style={sls.img}\n src={src}\n srcSet={srcSet}\n {...restProps}\n alt={alt ?? name}\n onError={handleOnError}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;AAuBA,SAAgB,OAAO,UAAqC;CAC1D,MAAM,EACJ,MACA,KACA,QACA,KACA,SACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,CAAC,cAAc,mBAAmB,SAA8B,IAAI;CAC1E,MAAM,wBAAwB,4BAA4B;EAAE;EAAK;EAAQ;CAAa,CAAC;CAEvF,MAAM,SAAS,cAAc,EAC3B,YAAY,wBAAwB,QAAQ,cAC9C,CAAC;CAED,MAAM,MAAM,iBAAiB,UAAU,QAAQ,SAAS,UAAU;CAClE,MAAM,MAAM,aAAa,UAAU,SAAS,MAAM;CAElD,MAAM,gBAAgB,aAAa,MAAqD;EACtF,UAAU,CAAC;EAEX,gBAAgB;GAAE;GAAK;EAAO,CAAC;CACjC,GAAG;EAAC;EAAS;EAAK;CAAM,CAAC;CAEzB,MAAM,cAAc,qBAAqB,IAAI;CAE7C,OACE,oBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAEV,UAAA,wBAEG,oBAAC,QAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GAEV,UAAA;EACG,CAAA,IAGN,oBAAC,OAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACN;GACG;GACR,GAAI;GACJ,KAAK,OAAO;GACZ,SAAS;EACV,CAAA;CAEF,CAAA;AAET"}
1
+ {"version":3,"file":"avatar.js","names":[],"sources":["../../../src/components/avatar/avatar.tsx"],"sourcesContent":["import {\n type AvatarSlots,\n type AvatarSource,\n avatartRecipe,\n getAvatarPlaceholder,\n shouldShowAvatarPlaceholder,\n} from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement, useCallback, useState } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface AvatarOwnProps extends ComponentProps<\"img\"> {\n /**\n * The name represented by the avatar. It is used as the default image alternative text and to generate placeholder initials.\n */\n name: string;\n}\n\nexport type AvatarProps = HuiComponentProps<\n AvatarOwnProps,\n AvatarSlots\n>;\n\nexport function Avatar(rawProps: AvatarProps): ReactElement {\n const {\n name,\n src,\n srcSet,\n alt,\n onError,\n ...restProps\n } = useHuiProps(\"Avatar\", rawProps);\n\n const [failedSource, setFailedSource] = useState<AvatarSource | null>(null);\n const shouldShowPlaceholder = shouldShowAvatarPlaceholder({ src, srcSet, failedSource });\n\n const recipe = avatartRecipe({\n background: shouldShowPlaceholder ? \"box\" : \"transparent\",\n });\n\n const cls = useHuiClassNames(\"Avatar\", recipe, rawProps);\n const sls = useHuiStyles(\"Avatar\", rawProps);\n\n const handleOnError = useCallback((e: React.SyntheticEvent<HTMLImageElement, Event>) => {\n onError?.(e);\n\n setFailedSource({ src, srcSet });\n }, [onError, src, srcSet]);\n\n const placeholder = getAvatarPlaceholder(name);\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n >\n {shouldShowPlaceholder\n ? (\n <span\n className={cls.placeholder}\n style={sls.placeholder}\n >\n {placeholder}\n </span>\n )\n : (\n <img\n className={cls.img}\n style={sls.img}\n src={src}\n srcSet={srcSet}\n {...restProps}\n alt={alt ?? name}\n onError={handleOnError}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;AAuBA,SAAgB,OAAO,UAAqC;CAC1D,MAAM,EACJ,MACA,KACA,QACA,KACA,SACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,CAAC,cAAc,mBAAmB,SAA8B,IAAI;CAC1E,MAAM,wBAAwB,4BAA4B;EAAE;EAAK;EAAQ;CAAa,CAAC;CAEvF,MAAM,SAAS,cAAc,EAC3B,YAAY,wBAAwB,QAAQ,cAC9C,CAAC;CAED,MAAM,MAAM,iBAAiB,UAAU,QAAQ,QAAQ;CACvD,MAAM,MAAM,aAAa,UAAU,QAAQ;CAE3C,MAAM,gBAAgB,aAAa,MAAqD;EACtF,UAAU,CAAC;EAEX,gBAAgB;GAAE;GAAK;EAAO,CAAC;CACjC,GAAG;EAAC;EAAS;EAAK;CAAM,CAAC;CAEzB,MAAM,cAAc,qBAAqB,IAAI;CAE7C,OACE,oBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAEV,UAAA,wBAEG,oBAAC,QAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GAEV,UAAA;EACG,CAAA,IAGN,oBAAC,OAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACN;GACG;GACR,GAAI;GACJ,KAAK,OAAO;GACZ,SAAS;EACV,CAAA;CAEF,CAAA;AAET"}
@@ -22,5 +22,4 @@ interface BlockquoteOwnProps extends Omit<HtmlBlockquoteProps, "color"> {
22
22
  }
23
23
  export type BlockquoteProps = HuiComponentProps<BlockquoteOwnProps, BlockquoteSlots>;
24
24
  export declare function Blockquote(rawProps: BlockquoteProps): ReactElement;
25
- export {};
26
- //# sourceMappingURL=blockquote.d.ts.map
25
+ export {};
@@ -5,8 +5,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
5
5
  function Blockquote(rawProps) {
6
6
  const { color, caption, captionProps, children, ...restProps } = useHuiProps("Blockquote", rawProps);
7
7
  const recipe = blockquoteRecipe({ color });
8
- const cls = useHuiClassNames("Blockquote", recipe, rawProps.classNames);
9
- const sls = useHuiStyles("Blockquote", rawProps.styles);
8
+ const cls = useHuiClassNames("Blockquote", recipe, rawProps);
9
+ const sls = useHuiStyles("Blockquote", rawProps);
10
10
  return /* @__PURE__ */ jsxs("figure", {
11
11
  className: cls.root,
12
12
  style: sls.root,
@@ -1 +1 @@
1
- {"version":3,"file":"blockquote.js","names":[],"sources":["../../../src/components/blockquote/blockquote.tsx"],"sourcesContent":["import { blockquoteRecipe, type BlockquoteSlots, type BlockquoteVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement, type ReactNode } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ntype HtmlBlockquoteProps = ComponentProps<\"blockquote\">;\ntype HtmlFigcaptionProps = Omit<ComponentProps<\"figcaption\">, \"children\" | \"className\" | \"style\">;\n\ninterface BlockquoteOwnProps extends Omit<HtmlBlockquoteProps, \"color\"> {\n /**\n * The semantic color of the blockquote accent.\n *\n * @default \"neutral\"\n */\n color?: BlockquoteVariants[\"color\"] | undefined;\n /**\n * The citation or attribution displayed below the quote.\n */\n caption?: ReactNode | undefined;\n /**\n * Additional props passed to the caption element.\n */\n captionProps?: HtmlFigcaptionProps | undefined;\n}\n\nexport type BlockquoteProps = HuiComponentProps<BlockquoteOwnProps, BlockquoteSlots>;\n\nexport function Blockquote(rawProps: BlockquoteProps): ReactElement {\n const {\n color,\n caption,\n captionProps,\n children,\n ...restProps\n } = useHuiProps(\"Blockquote\", rawProps);\n\n const recipe = blockquoteRecipe({ color });\n const cls = useHuiClassNames(\"Blockquote\", recipe, rawProps.classNames);\n const sls = useHuiStyles(\"Blockquote\", rawProps.styles);\n\n return (\n <figure\n className={cls.root}\n style={sls.root}\n >\n <blockquote\n className={cls.blockquote}\n style={sls.blockquote}\n {...restProps}\n >\n {children}\n </blockquote>\n {caption != null && (\n <figcaption\n className={cls.caption}\n style={sls.caption}\n {...captionProps}\n >\n {caption}\n </figcaption>\n )}\n </figure>\n );\n}\n"],"mappings":";;;;AA2BA,SAAgB,WAAW,UAAyC;CAClE,MAAM,EACJ,OACA,SACA,cACA,UACA,GAAG,cACD,YAAY,cAAc,QAAQ;CAEtC,MAAM,SAAS,iBAAiB,EAAE,MAAM,CAAC;CACzC,MAAM,MAAM,iBAAiB,cAAc,QAAQ,SAAS,UAAU;CACtE,MAAM,MAAM,aAAa,cAAc,SAAS,MAAM;CAEtD,OACE,qBAAC,UAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIE,oBAAC,cAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH;EACS,CAAA,GACX,WAAW,QACV,oBAAC,cAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH,UAAA;EACS,CAAA,CAER;;AAEZ"}
1
+ {"version":3,"file":"blockquote.js","names":[],"sources":["../../../src/components/blockquote/blockquote.tsx"],"sourcesContent":["import { blockquoteRecipe, type BlockquoteSlots, type BlockquoteVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement, type ReactNode } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ntype HtmlBlockquoteProps = ComponentProps<\"blockquote\">;\ntype HtmlFigcaptionProps = Omit<ComponentProps<\"figcaption\">, \"children\" | \"className\" | \"style\">;\n\ninterface BlockquoteOwnProps extends Omit<HtmlBlockquoteProps, \"color\"> {\n /**\n * The semantic color of the blockquote accent.\n *\n * @default \"neutral\"\n */\n color?: BlockquoteVariants[\"color\"] | undefined;\n /**\n * The citation or attribution displayed below the quote.\n */\n caption?: ReactNode | undefined;\n /**\n * Additional props passed to the caption element.\n */\n captionProps?: HtmlFigcaptionProps | undefined;\n}\n\nexport type BlockquoteProps = HuiComponentProps<BlockquoteOwnProps, BlockquoteSlots>;\n\nexport function Blockquote(rawProps: BlockquoteProps): ReactElement {\n const {\n color,\n caption,\n captionProps,\n children,\n ...restProps\n } = useHuiProps(\"Blockquote\", rawProps);\n\n const recipe = blockquoteRecipe({ color });\n const cls = useHuiClassNames(\"Blockquote\", recipe, rawProps);\n const sls = useHuiStyles(\"Blockquote\", rawProps);\n\n return (\n <figure\n className={cls.root}\n style={sls.root}\n >\n <blockquote\n className={cls.blockquote}\n style={sls.blockquote}\n {...restProps}\n >\n {children}\n </blockquote>\n {caption != null && (\n <figcaption\n className={cls.caption}\n style={sls.caption}\n {...captionProps}\n >\n {caption}\n </figcaption>\n )}\n </figure>\n );\n}\n"],"mappings":";;;;AA2BA,SAAgB,WAAW,UAAyC;CAClE,MAAM,EACJ,OACA,SACA,cACA,UACA,GAAG,cACD,YAAY,cAAc,QAAQ;CAEtC,MAAM,SAAS,iBAAiB,EAAE,MAAM,CAAC;CACzC,MAAM,MAAM,iBAAiB,cAAc,QAAQ,QAAQ;CAC3D,MAAM,MAAM,aAAa,cAAc,QAAQ;CAE/C,OACE,qBAAC,UAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIE,oBAAC,cAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH;EACS,CAAA,GACX,WAAW,QACV,oBAAC,cAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH,UAAA;EACS,CAAA,CAER;;AAEZ"}
@@ -3,6 +3,17 @@ import "../../types/index.js";
3
3
  import { ButtonSlots, ButtonVariants } from "@hebium-ui/core";
4
4
  import { ElementType, ReactElement } from "react";
5
5
  interface ButtonOwnProps {
6
+ /**
7
+ * Whether the button is loading.
8
+ * Provide a descriptive loadingMessage to announce the loading state to screen readers.
9
+ *
10
+ * @default false
11
+ */
12
+ loading?: boolean | undefined;
13
+ /**
14
+ * The visually hidden status message announced only while loading.
15
+ */
16
+ loadingMessage?: string | undefined;
6
17
  /**
7
18
  * The visual style of the button.
8
19
  *
@@ -24,5 +35,4 @@ interface ButtonOwnProps {
24
35
  }
25
36
  export type ButtonProps<E extends ElementType = "button"> = HuiPolymorphicProps<E, ButtonOwnProps, ButtonSlots>;
26
37
  export declare function Button<E extends ElementType = "button">(rawProps: ButtonProps<E>): ReactElement;
27
- export {};
28
- //# sourceMappingURL=button.d.ts.map
38
+ export {};
@@ -1,23 +1,43 @@
1
1
  import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
- import { buttonRecipe } from "@hebium-ui/core";
3
- import { jsx } from "react/jsx-runtime";
2
+ import { buttonControl, buttonRecipe, toStrbool } from "@hebium-ui/core";
3
+ import { useCallback } from "react";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
5
  // src/components/button/button.tsx
5
6
  function Button(rawProps) {
6
- const { as, variant, color, shape, children, ...restProps } = useHuiProps("Button", rawProps);
7
+ const { as, variant, color, shape, loading = false, loadingMessage, onClick, children, ...restProps } = useHuiProps("Button", rawProps);
7
8
  const Component = as ?? "button";
9
+ const handleClick = useCallback((event) => {
10
+ buttonControl.handleClick(event, loading, () => onClick?.(event));
11
+ }, [loading, onClick]);
8
12
  const recipe = buttonRecipe({
9
13
  variant,
10
14
  color,
11
- shape
15
+ shape,
16
+ loading: toStrbool(loading)
12
17
  });
13
- const cls = useHuiClassNames("Button", recipe, { root: rawProps["className"] });
14
- const sls = useHuiStyles("Button", { root: rawProps["style"] });
15
- return /* @__PURE__ */ jsx(Component, {
18
+ const cls = useHuiClassNames("Button", recipe, rawProps);
19
+ const sls = useHuiStyles("Button", rawProps);
20
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Component, {
16
21
  className: cls.root,
17
22
  style: sls.root,
23
+ ...buttonControl.getRootAttributes(loading),
18
24
  ...restProps,
19
- children
20
- });
25
+ onClick: handleClick,
26
+ children: [/* @__PURE__ */ jsx("span", {
27
+ className: cls.content,
28
+ style: sls.content,
29
+ children
30
+ }), loading && /* @__PURE__ */ jsx("span", {
31
+ "aria-hidden": "true",
32
+ className: cls.spinner,
33
+ style: sls.spinner
34
+ })]
35
+ }), /* @__PURE__ */ jsx("span", {
36
+ className: cls.status,
37
+ style: sls.status,
38
+ ...buttonControl.getStatusAttributes(),
39
+ children: loading ? loadingMessage : void 0
40
+ })] });
21
41
  }
22
42
  export { Button };
23
43
 
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","names":[],"sources":["../../../src/components/button/button.tsx"],"sourcesContent":["import { buttonRecipe, type ButtonSlots, type ButtonVariants } from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface ButtonOwnProps {\n /**\n * The visual style of the button.\n *\n * @default \"solid\"\n */\n variant?: ButtonVariants[\"variant\"] | undefined;\n /**\n * The semantic color of the button.\n *\n * @default \"accent\"\n */\n color?: ButtonVariants[\"color\"] | undefined;\n /**\n * The shape of the button.\n *\n * @default \"rectangle\"\n */\n shape?: ButtonVariants[\"shape\"] | undefined;\n}\n\nexport type ButtonProps<E extends ElementType = \"button\"> = HuiPolymorphicProps<\n E,\n ButtonOwnProps,\n ButtonSlots\n>;\n\nexport function Button<E extends ElementType = \"button\">(rawProps: ButtonProps<E>): ReactElement {\n const {\n as,\n variant,\n color,\n shape,\n children,\n ...restProps\n } = useHuiProps(\"Button\", rawProps);\n\n const Component = as ?? \"button\";\n const recipe = buttonRecipe({\n variant,\n color,\n shape,\n });\n const cls = useHuiClassNames(\"Button\", recipe, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"Button\", { root: rawProps[\"style\"] });\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n"],"mappings":";;;;AAgCA,SAAgB,OAAyC,UAAwC;CAC/F,MAAM,EACJ,IACA,SACA,OACA,OACA,UACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,YAAY,MAAM;CACxB,MAAM,SAAS,aAAa;EAC1B;EACA;EACA;CACF,CAAC;CACD,MAAM,MAAM,iBAAiB,UAAU,QAAQ,EAAE,MAAM,SAAS,aAAa,CAAC;CAC9E,MAAM,MAAM,aAAa,UAAU,EAAE,MAAM,SAAS,SAAS,CAAC;CAE9D,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
1
+ {"version":3,"file":"button.js","names":[],"sources":["../../../src/components/button/button.tsx"],"sourcesContent":["import { buttonControl, buttonRecipe, type ButtonSlots, type ButtonVariants, toStrbool } from \"@hebium-ui/core\";\nimport { type ElementType, type MouseEvent, type ReactElement, useCallback } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface ButtonOwnProps {\n /**\n * Whether the button is loading.\n * Provide a descriptive loadingMessage to announce the loading state to screen readers.\n *\n * @default false\n */\n loading?: boolean | undefined;\n /**\n * The visually hidden status message announced only while loading.\n */\n loadingMessage?: string | undefined;\n /**\n * The visual style of the button.\n *\n * @default \"solid\"\n */\n variant?: ButtonVariants[\"variant\"] | undefined;\n /**\n * The semantic color of the button.\n *\n * @default \"accent\"\n */\n color?: ButtonVariants[\"color\"] | undefined;\n /**\n * The shape of the button.\n *\n * @default \"rectangle\"\n */\n shape?: ButtonVariants[\"shape\"] | undefined;\n}\n\nexport type ButtonProps<E extends ElementType = \"button\"> = HuiPolymorphicProps<\n E,\n ButtonOwnProps,\n ButtonSlots\n>;\n\nexport function Button<E extends ElementType = \"button\">(rawProps: ButtonProps<E>): ReactElement {\n const {\n as,\n variant,\n color,\n shape,\n loading = false,\n loadingMessage,\n onClick,\n children,\n ...restProps\n } = useHuiProps(\"Button\", rawProps);\n\n const Component = as ?? \"button\";\n const handleClick = useCallback((event: MouseEvent<HTMLElement>): void => {\n buttonControl.handleClick(event, loading, () => onClick?.(event));\n }, [loading, onClick]);\n\n const recipe = buttonRecipe({\n variant,\n color,\n shape,\n loading: toStrbool(loading),\n });\n const cls = useHuiClassNames(\"Button\", recipe, rawProps);\n const sls = useHuiStyles(\"Button\", rawProps);\n\n return (\n <>\n <Component\n className={cls.root}\n style={sls.root}\n {...buttonControl.getRootAttributes(loading)}\n {...restProps}\n onClick={handleClick}\n >\n <span\n className={cls.content}\n style={sls.content}\n >\n {children}\n </span>\n {loading && (\n <span\n aria-hidden=\"true\"\n className={cls.spinner}\n style={sls.spinner}\n />\n )}\n </Component>\n <span\n className={cls.status}\n style={sls.status}\n {...buttonControl.getStatusAttributes()}\n >\n {loading ? loadingMessage : undefined}\n </span>\n </>\n );\n}\n"],"mappings":";;;;;AA2CA,SAAgB,OAAyC,UAAwC;CAC/F,MAAM,EACJ,IACA,SACA,OACA,OACA,UAAU,OACV,gBACA,SACA,UACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,YAAY,MAAM;CACxB,MAAM,cAAc,aAAa,UAAyC;EACxE,cAAc,YAAY,OAAO,eAAe,UAAU,KAAK,CAAC;CAClE,GAAG,CAAC,SAAS,OAAO,CAAC;CAErB,MAAM,SAAS,aAAa;EAC1B;EACA;EACA;EACA,SAAS,UAAU,OAAO;CAC5B,CAAC;CACD,MAAM,MAAM,iBAAiB,UAAU,QAAQ,QAAQ;CACvD,MAAM,MAAM,aAAa,UAAU,QAAQ;CAE3C,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,qBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI,cAAc,kBAAkB,OAAO;EAC3C,GAAI;EACJ,SAAS;EALX,UAAA,CAOE,oBAAC,QAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GAEV;EACG,CAAA,GACL,WACC,oBAAC,QAAD;GACE,eAAY;GACZ,WAAW,IAAI;GACf,OAAO,IAAI;EACZ,CAAA,CAEM;CACX,CAAA,GAAA,oBAAC,QAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI,cAAc,oBAAoB;EAErC,UAAA,UAAU,iBAAiB,KAAA;CACxB,CAAA,CACN,EAAA,CAAA;AAEN"}
@@ -27,5 +27,4 @@ interface CheckboxOwnProps extends HtmlInputProps {
27
27
  }
28
28
  export type CheckboxProps = HuiComponentProps<CheckboxOwnProps, CheckboxSlots>;
29
29
  export declare function Checkbox(rawProps: CheckboxProps): ReactElement;
30
- export {};
31
- //# sourceMappingURL=checkbox.d.ts.map
30
+ export {};
@@ -40,8 +40,8 @@ function Checkbox(rawProps) {
40
40
  color,
41
41
  error: toStrbool(checkboxState.invalid)
42
42
  });
43
- const cls = useHuiClassNames("Checkbox", recipe, rawProps.classNames);
44
- const sls = useHuiStyles("Checkbox", rawProps.styles);
43
+ const cls = useHuiClassNames("Checkbox", recipe, rawProps);
44
+ const sls = useHuiStyles("Checkbox", rawProps);
45
45
  const controlAttrs = normalizeAttributes(checkboxControl.getControlAttributes(checkboxState));
46
46
  const labelAttrs = normalizeAttributes(checkboxControl.getLabelAttributes(checkboxState));
47
47
  const errorAttrs = checkboxControl.getErrorAttributes(checkboxState);
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","names":[],"sources":["../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import {\n checkboxControl,\n checkboxRecipe,\n type CheckboxSlots,\n type CheckboxVariants,\n toBool,\n toStrbool,\n} from \"@hebium-ui/core\";\nimport {\n type ChangeEvent,\n type ComponentProps,\n type ReactElement,\n type ReactNode,\n useCallback,\n useId,\n useImperativeHandle,\n useRef,\n} from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\n\ntype HtmlInputProps = Omit<ComponentProps<\"input\">, \"children\" | \"type\">;\n\ninterface CheckboxOwnProps extends HtmlInputProps {\n /**\n * The label displayed next to the checkbox.\n */\n label?: ReactNode | undefined;\n /**\n * The validation error message displayed below the label.\n */\n error?: ReactNode | undefined;\n /**\n * The semantic color of the checkbox control.\n *\n * @default \"accent\"\n */\n color?: CheckboxVariants[\"color\"] | undefined;\n /**\n * The controlled indeterminate state. Update this prop in response to user interaction.\n *\n * @default false\n */\n indeterminate?: boolean | undefined;\n}\n\nexport type CheckboxProps = HuiComponentProps<\n CheckboxOwnProps,\n CheckboxSlots\n>;\n\nexport function Checkbox(rawProps: CheckboxProps): ReactElement {\n const {\n id,\n label,\n error,\n color,\n indeterminate,\n onChange,\n ref,\n ...restProps\n } = useHuiProps(\"Checkbox\", rawProps);\n\n const tmpId = useId();\n const committedRef = useRef<\n {\n input: HTMLInputElement;\n indeterminate: boolean;\n } | null\n >(null);\n\n const inputRef = useCallback((input: HTMLInputElement | null): void => {\n if (input === null) {\n committedRef.current = null;\n return;\n }\n\n input.indeterminate = !!indeterminate;\n committedRef.current = { input, indeterminate: !!indeterminate };\n }, [indeterminate]);\n\n useImperativeHandle(ref, () => {\n const committed = committedRef.current;\n if (committed === null) {\n throw new Error(\"[Hebium UI] Checkbox input ref is not attached\");\n }\n return committed.input;\n }, []);\n\n const handleChange = useCallback((event: ChangeEvent<HTMLInputElement>): void => {\n const input = event.currentTarget;\n onChange?.(event);\n\n // The user handler may have committed new props or unmounted the input.\n const committed = committedRef.current;\n if (committed?.input === input) input.indeterminate = committed.indeterminate;\n }, [onChange]);\n\n const checkboxState = {\n id: id ?? tmpId,\n invalid: !!error,\n indeterminate: !!indeterminate,\n disabled: toBool(restProps.disabled) || toBool(restProps[\"aria-disabled\"]),\n };\n const recipe = checkboxRecipe({\n color,\n error: toStrbool(checkboxState.invalid),\n });\n const cls = useHuiClassNames(\"Checkbox\", recipe, rawProps.classNames);\n const sls = useHuiStyles(\"Checkbox\", rawProps.styles);\n const controlAttrs = normalizeAttributes(checkboxControl.getControlAttributes(checkboxState));\n const labelAttrs = normalizeAttributes(checkboxControl.getLabelAttributes(checkboxState));\n const errorAttrs = checkboxControl.getErrorAttributes(checkboxState);\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n >\n <input\n ref={inputRef}\n className={cls.checkbox}\n style={sls.checkbox}\n {...controlAttrs}\n {...restProps}\n onChange={handleChange}\n />\n <div>\n {label && (\n <label\n className={cls.label}\n style={sls.label}\n {...labelAttrs}\n >\n {label}\n </label>\n )}\n {error && (\n <p\n className={cls.error}\n style={sls?.error}\n {...errorAttrs}\n >\n <span\n aria-hidden\n className={cls.errorIcon}\n style={sls.errorIcon}\n />\n <span\n className={cls.errorMessage}\n style={sls.errorMessage}\n >\n {error}\n </span>\n </p>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AAoDA,SAAgB,SAAS,UAAuC;CAC9D,MAAM,EACJ,IACA,OACA,OACA,OACA,eACA,UACA,KACA,GAAG,cACD,YAAY,YAAY,QAAQ;CAEpC,MAAM,QAAQ,MAAM;CACpB,MAAM,eAAe,OAKnB,IAAI;CAEN,MAAM,WAAW,aAAa,UAAyC;EACrE,IAAI,UAAU,MAAM;GAClB,aAAa,UAAU;GACvB;EACF;EAEA,MAAM,gBAAgB,CAAC,CAAC;EACxB,aAAa,UAAU;GAAE;GAAO,eAAe,CAAC,CAAC;EAAc;CACjE,GAAG,CAAC,aAAa,CAAC;CAElB,oBAAoB,WAAW;EAC7B,MAAM,YAAY,aAAa;EAC/B,IAAI,cAAc,MAChB,MAAM,IAAI,MAAM,gDAAgD;EAElE,OAAO,UAAU;CACnB,GAAG,CAAC,CAAC;CAEL,MAAM,eAAe,aAAa,UAA+C;EAC/E,MAAM,QAAQ,MAAM;EACpB,WAAW,KAAK;EAGhB,MAAM,YAAY,aAAa;EAC/B,IAAI,WAAW,UAAU,OAAO,MAAM,gBAAgB,UAAU;CAClE,GAAG,CAAC,QAAQ,CAAC;CAEb,MAAM,gBAAgB;EACpB,IAAI,MAAM;EACV,SAAS,CAAC,CAAC;EACX,eAAe,CAAC,CAAC;EACjB,UAAU,OAAO,UAAU,QAAQ,KAAK,OAAO,UAAU,gBAAgB;CAC3E;CACA,MAAM,SAAS,eAAe;EAC5B;EACA,OAAO,UAAU,cAAc,OAAO;CACxC,CAAC;CACD,MAAM,MAAM,iBAAiB,YAAY,QAAQ,SAAS,UAAU;CACpE,MAAM,MAAM,aAAa,YAAY,SAAS,MAAM;CACpD,MAAM,eAAe,oBAAoB,gBAAgB,qBAAqB,aAAa,CAAC;CAC5F,MAAM,aAAa,oBAAoB,gBAAgB,mBAAmB,aAAa,CAAC;CACxF,MAAM,aAAa,gBAAgB,mBAAmB,aAAa;CAEnE,OACE,qBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIE,oBAAC,SAAD;GACE,KAAK;GACL,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GACJ,GAAI;GACJ,UAAU;EACX,CAAA,GACD,qBAAC,OAAD,EAAA,UAAA,CACG,SACC,oBAAC,SAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH,UAAA;EACI,CAAA,GAER,SACC,qBAAC,KAAD;GACE,WAAW,IAAI;GACf,OAAO,KAAK;GACZ,GAAI;GAHN,UAAA,CAKE,oBAAC,QAAD;IACE,eAAA;IACA,WAAW,IAAI;IACf,OAAO,IAAI;GACZ,CAAA,GACD,oBAAC,QAAD;IACE,WAAW,IAAI;IACf,OAAO,IAAI;IAEV,UAAA;GACG,CAAA,CACL;EAEF,CAAA,CAAA,EAAA,CAAA,CACF;;AAET"}
1
+ {"version":3,"file":"checkbox.js","names":[],"sources":["../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import {\n checkboxControl,\n checkboxRecipe,\n type CheckboxSlots,\n type CheckboxVariants,\n toBool,\n toStrbool,\n} from \"@hebium-ui/core\";\nimport {\n type ChangeEvent,\n type ComponentProps,\n type ReactElement,\n type ReactNode,\n useCallback,\n useId,\n useImperativeHandle,\n useRef,\n} from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\n\ntype HtmlInputProps = Omit<ComponentProps<\"input\">, \"children\" | \"type\">;\n\ninterface CheckboxOwnProps extends HtmlInputProps {\n /**\n * The label displayed next to the checkbox.\n */\n label?: ReactNode | undefined;\n /**\n * The validation error message displayed below the label.\n */\n error?: ReactNode | undefined;\n /**\n * The semantic color of the checkbox control.\n *\n * @default \"accent\"\n */\n color?: CheckboxVariants[\"color\"] | undefined;\n /**\n * The controlled indeterminate state. Update this prop in response to user interaction.\n *\n * @default false\n */\n indeterminate?: boolean | undefined;\n}\n\nexport type CheckboxProps = HuiComponentProps<\n CheckboxOwnProps,\n CheckboxSlots\n>;\n\nexport function Checkbox(rawProps: CheckboxProps): ReactElement {\n const {\n id,\n label,\n error,\n color,\n indeterminate,\n onChange,\n ref,\n ...restProps\n } = useHuiProps(\"Checkbox\", rawProps);\n\n const tmpId = useId();\n const committedRef = useRef<\n {\n input: HTMLInputElement;\n indeterminate: boolean;\n } | null\n >(null);\n\n const inputRef = useCallback((input: HTMLInputElement | null): void => {\n if (input === null) {\n committedRef.current = null;\n return;\n }\n\n input.indeterminate = !!indeterminate;\n committedRef.current = { input, indeterminate: !!indeterminate };\n }, [indeterminate]);\n\n useImperativeHandle(ref, () => {\n const committed = committedRef.current;\n if (committed === null) {\n throw new Error(\"[Hebium UI] Checkbox input ref is not attached\");\n }\n return committed.input;\n }, []);\n\n const handleChange = useCallback((event: ChangeEvent<HTMLInputElement>): void => {\n const input = event.currentTarget;\n onChange?.(event);\n\n // The user handler may have committed new props or unmounted the input.\n const committed = committedRef.current;\n if (committed?.input === input) input.indeterminate = committed.indeterminate;\n }, [onChange]);\n\n const checkboxState = {\n id: id ?? tmpId,\n invalid: !!error,\n indeterminate: !!indeterminate,\n disabled: toBool(restProps.disabled) || toBool(restProps[\"aria-disabled\"]),\n };\n const recipe = checkboxRecipe({\n color,\n error: toStrbool(checkboxState.invalid),\n });\n const cls = useHuiClassNames(\"Checkbox\", recipe, rawProps);\n const sls = useHuiStyles(\"Checkbox\", rawProps);\n const controlAttrs = normalizeAttributes(checkboxControl.getControlAttributes(checkboxState));\n const labelAttrs = normalizeAttributes(checkboxControl.getLabelAttributes(checkboxState));\n const errorAttrs = checkboxControl.getErrorAttributes(checkboxState);\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n >\n <input\n ref={inputRef}\n className={cls.checkbox}\n style={sls.checkbox}\n {...controlAttrs}\n {...restProps}\n onChange={handleChange}\n />\n <div>\n {label && (\n <label\n className={cls.label}\n style={sls.label}\n {...labelAttrs}\n >\n {label}\n </label>\n )}\n {error && (\n <p\n className={cls.error}\n style={sls?.error}\n {...errorAttrs}\n >\n <span\n aria-hidden\n className={cls.errorIcon}\n style={sls.errorIcon}\n />\n <span\n className={cls.errorMessage}\n style={sls.errorMessage}\n >\n {error}\n </span>\n </p>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AAoDA,SAAgB,SAAS,UAAuC;CAC9D,MAAM,EACJ,IACA,OACA,OACA,OACA,eACA,UACA,KACA,GAAG,cACD,YAAY,YAAY,QAAQ;CAEpC,MAAM,QAAQ,MAAM;CACpB,MAAM,eAAe,OAKnB,IAAI;CAEN,MAAM,WAAW,aAAa,UAAyC;EACrE,IAAI,UAAU,MAAM;GAClB,aAAa,UAAU;GACvB;EACF;EAEA,MAAM,gBAAgB,CAAC,CAAC;EACxB,aAAa,UAAU;GAAE;GAAO,eAAe,CAAC,CAAC;EAAc;CACjE,GAAG,CAAC,aAAa,CAAC;CAElB,oBAAoB,WAAW;EAC7B,MAAM,YAAY,aAAa;EAC/B,IAAI,cAAc,MAChB,MAAM,IAAI,MAAM,gDAAgD;EAElE,OAAO,UAAU;CACnB,GAAG,CAAC,CAAC;CAEL,MAAM,eAAe,aAAa,UAA+C;EAC/E,MAAM,QAAQ,MAAM;EACpB,WAAW,KAAK;EAGhB,MAAM,YAAY,aAAa;EAC/B,IAAI,WAAW,UAAU,OAAO,MAAM,gBAAgB,UAAU;CAClE,GAAG,CAAC,QAAQ,CAAC;CAEb,MAAM,gBAAgB;EACpB,IAAI,MAAM;EACV,SAAS,CAAC,CAAC;EACX,eAAe,CAAC,CAAC;EACjB,UAAU,OAAO,UAAU,QAAQ,KAAK,OAAO,UAAU,gBAAgB;CAC3E;CACA,MAAM,SAAS,eAAe;EAC5B;EACA,OAAO,UAAU,cAAc,OAAO;CACxC,CAAC;CACD,MAAM,MAAM,iBAAiB,YAAY,QAAQ,QAAQ;CACzD,MAAM,MAAM,aAAa,YAAY,QAAQ;CAC7C,MAAM,eAAe,oBAAoB,gBAAgB,qBAAqB,aAAa,CAAC;CAC5F,MAAM,aAAa,oBAAoB,gBAAgB,mBAAmB,aAAa,CAAC;CACxF,MAAM,aAAa,gBAAgB,mBAAmB,aAAa;CAEnE,OACE,qBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIE,oBAAC,SAAD;GACE,KAAK;GACL,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GACJ,GAAI;GACJ,UAAU;EACX,CAAA,GACD,qBAAC,OAAD,EAAA,UAAA,CACG,SACC,oBAAC,SAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH,UAAA;EACI,CAAA,GAER,SACC,qBAAC,KAAD;GACE,WAAW,IAAI;GACf,OAAO,KAAK;GACZ,GAAI;GAHN,UAAA,CAKE,oBAAC,QAAD;IACE,eAAA;IACA,WAAW,IAAI;IACf,OAAO,IAAI;GACZ,CAAA,GACD,oBAAC,QAAD;IACE,WAAW,IAAI;IACf,OAAO,IAAI;IAEV,UAAA;GACG,CAAA,CACL;EAEF,CAAA,CAAA,EAAA,CAAA,CACF;;AAET"}
@@ -5,5 +5,4 @@ import { ElementType, ReactElement } from "react";
5
5
  interface CodeOwnProps {}
6
6
  export type CodeProps<E extends ElementType = "code"> = HuiPolymorphicProps<E, CodeOwnProps, CodeSlots>;
7
7
  export declare function Code<E extends ElementType = "code">(rawProps: CodeProps<E>): ReactElement;
8
- export {};
9
- //# sourceMappingURL=code.d.ts.map
8
+ export {};
@@ -6,8 +6,8 @@ function Code(rawProps) {
6
6
  const { as, children, ...restProps } = useHuiProps("Code", rawProps);
7
7
  const recipe = codeRecipe();
8
8
  const Component = as ?? "code";
9
- const cls = useHuiClassNames("Code", recipe, { root: rawProps["className"] });
10
- const sls = useHuiStyles("Code", { root: rawProps["style"] });
9
+ const cls = useHuiClassNames("Code", recipe, rawProps);
10
+ const sls = useHuiStyles("Code", rawProps);
11
11
  return /* @__PURE__ */ jsx(Component, {
12
12
  className: cls.root,
13
13
  style: sls.root,
@@ -1 +1 @@
1
- {"version":3,"file":"code.js","names":[],"sources":["../../../src/components/code/code.tsx"],"sourcesContent":["import { codeRecipe, type CodeSlots } from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface CodeOwnProps {}\n\nexport type CodeProps<E extends ElementType = \"code\"> = HuiPolymorphicProps<\n E,\n CodeOwnProps,\n CodeSlots\n>;\n\nexport function Code<E extends ElementType = \"code\">(rawProps: CodeProps<E>): ReactElement {\n const {\n as,\n children,\n ...restProps\n } = useHuiProps(\"Code\", rawProps);\n\n const recipe = codeRecipe();\n const Component = as ?? \"code\";\n\n const cls = useHuiClassNames(\"Code\", recipe, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"Code\", { root: rawProps[\"style\"] });\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n"],"mappings":";;;;AAaA,SAAgB,KAAqC,UAAsC;CACzF,MAAM,EACJ,IACA,UACA,GAAG,cACD,YAAY,QAAQ,QAAQ;CAEhC,MAAM,SAAS,WAAW;CAC1B,MAAM,YAAY,MAAM;CAExB,MAAM,MAAM,iBAAiB,QAAQ,QAAQ,EAAE,MAAM,SAAS,aAAa,CAAC;CAC5E,MAAM,MAAM,aAAa,QAAQ,EAAE,MAAM,SAAS,SAAS,CAAC;CAC5D,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
1
+ {"version":3,"file":"code.js","names":[],"sources":["../../../src/components/code/code.tsx"],"sourcesContent":["import { codeRecipe, type CodeSlots } from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface CodeOwnProps {}\n\nexport type CodeProps<E extends ElementType = \"code\"> = HuiPolymorphicProps<\n E,\n CodeOwnProps,\n CodeSlots\n>;\n\nexport function Code<E extends ElementType = \"code\">(rawProps: CodeProps<E>): ReactElement {\n const {\n as,\n children,\n ...restProps\n } = useHuiProps(\"Code\", rawProps);\n\n const recipe = codeRecipe();\n const Component = as ?? \"code\";\n\n const cls = useHuiClassNames(\"Code\", recipe, rawProps);\n const sls = useHuiStyles(\"Code\", rawProps);\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n"],"mappings":";;;;AAaA,SAAgB,KAAqC,UAAsC;CACzF,MAAM,EACJ,IACA,UACA,GAAG,cACD,YAAY,QAAQ,QAAQ;CAEhC,MAAM,SAAS,WAAW;CAC1B,MAAM,YAAY,MAAM;CAExB,MAAM,MAAM,iBAAiB,QAAQ,QAAQ,QAAQ;CACrD,MAAM,MAAM,aAAa,QAAQ,QAAQ;CACzC,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
@@ -0,0 +1,33 @@
1
+ import { cc, comboboxControl, getComboboxOptionText } from "@hebium-ui/core";
2
+ import { jsx } from "react/jsx-runtime";
3
+ // src/components/combobox/combobox-option.tsx
4
+ function getOptionProps({ option, id, active, className, style, itemProps, select }) {
5
+ const props = itemProps?.(option) ?? {};
6
+ return {
7
+ ...comboboxControl.getItemAttributes(id, active, !!option.disabled),
8
+ ...props,
9
+ className: cc(className, props.className),
10
+ style: {
11
+ ...style,
12
+ ...props.style
13
+ },
14
+ onMouseDown: (event) => {
15
+ props.onMouseDown?.(event);
16
+ if (!event.defaultPrevented && event.button === 0) event.preventDefault();
17
+ },
18
+ onClick: (event) => {
19
+ props.onClick?.(event);
20
+ if (!event.defaultPrevented) select(option.value);
21
+ }
22
+ };
23
+ }
24
+ function ComboboxOption(props) {
25
+ const { option, mode, renderItem } = props;
26
+ return /* @__PURE__ */ jsx("div", {
27
+ ...getOptionProps(props),
28
+ children: renderItem ? renderItem(option) : getComboboxOptionText(mode, option)
29
+ });
30
+ }
31
+ export { ComboboxOption };
32
+
33
+ //# sourceMappingURL=combobox-option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combobox-option.js","names":[],"sources":["../../../src/components/combobox/combobox-option.tsx"],"sourcesContent":["import {\n cc,\n comboboxControl,\n type ComboboxMode,\n type ComboboxSelectOption,\n getComboboxOptionText,\n} from \"@hebium-ui/core\";\nimport { type ComponentProps, type CSSProperties, type ReactElement, type ReactNode } from \"react\";\n\ntype NativeOptionProps = Omit<ComponentProps<\"div\">, \"children\">;\n\ninterface ComboboxOptionProps<O extends ComboboxSelectOption> {\n option: O;\n id: string;\n mode: ComboboxMode;\n active: boolean;\n className: string;\n style: CSSProperties | undefined;\n itemProps: ((option: O) => NativeOptionProps) | undefined;\n renderItem: ((option: O) => ReactNode) | undefined;\n select: (value: string) => void;\n}\n\ntype OptionWrapperProps<O extends ComboboxSelectOption> = Omit<ComboboxOptionProps<O>, \"mode\" | \"renderItem\">;\n\nfunction getOptionProps<O extends ComboboxSelectOption>({\n option,\n id,\n active,\n className,\n style,\n itemProps,\n select,\n}: OptionWrapperProps<O>): NativeOptionProps {\n const props = itemProps?.(option) ?? {};\n return {\n ...comboboxControl.getItemAttributes(id, active, !!option.disabled),\n ...props,\n className: cc(className, props.className),\n style: { ...style, ...props.style },\n onMouseDown: (event): void => {\n props.onMouseDown?.(event);\n if (!event.defaultPrevented && event.button === 0) event.preventDefault();\n },\n onClick: (event): void => {\n props.onClick?.(event);\n if (!event.defaultPrevented) select(option.value);\n },\n };\n}\n\nexport function ComboboxOption<O extends ComboboxSelectOption>(props: ComboboxOptionProps<O>): ReactElement {\n const { option, mode, renderItem } = props;\n return (\n <div {...getOptionProps(props)}>\n {renderItem\n ? renderItem(option)\n : getComboboxOptionText(mode, option)}\n </div>\n );\n}\n"],"mappings":";;;AAyBA,SAAS,eAA+C,EACtD,QACA,IACA,QACA,WACA,OACA,WACA,UAC2C;CAC3C,MAAM,QAAQ,YAAY,MAAM,KAAK,CAAC;CACtC,OAAO;EACL,GAAG,gBAAgB,kBAAkB,IAAI,QAAQ,CAAC,CAAC,OAAO,QAAQ;EAClE,GAAG;EACH,WAAW,GAAG,WAAW,MAAM,SAAS;EACxC,OAAO;GAAE,GAAG;GAAO,GAAG,MAAM;EAAM;EAClC,cAAc,UAAgB;GAC5B,MAAM,cAAc,KAAK;GACzB,IAAI,CAAC,MAAM,oBAAoB,MAAM,WAAW,GAAG,MAAM,eAAe;EAC1E;EACA,UAAU,UAAgB;GACxB,MAAM,UAAU,KAAK;GACrB,IAAI,CAAC,MAAM,kBAAkB,OAAO,OAAO,KAAK;EAClD;CACF;AACF;AAEA,SAAgB,eAA+C,OAA6C;CAC1G,MAAM,EAAE,QAAQ,MAAM,eAAe;CACrC,OACE,oBAAC,OAAD;EAAK,GAAI,eAAe,KAAK;EAC1B,UAAA,aACG,WAAW,MAAM,IACjB,sBAAsB,MAAM,MAAM;CACnC,CAAA;AAET"}
@@ -0,0 +1,61 @@
1
+ import { HuiComponentProps } from "../../types/hui-component.js";
2
+ import "../../types/index.js";
3
+ import { LabelProps } from "../label/label.js";
4
+ import "../label/index.js";
5
+ import { ComboboxFormValueProps, ComboboxFormValueProps as ComboboxFormValueProps$1, ComboboxSelectOption, ComboboxSelectOption as ComboboxSelectOption$1, ComboboxSlots, ComboboxTextOption, ComboboxTextOption as ComboboxTextOption$1, ComboboxVariants } from "@hebium-ui/core";
6
+ import { ComponentProps, ReactElement, ReactNode } from "react";
7
+ interface ComboboxOwnProps<O extends ComboboxSelectOption$1> {
8
+ /** Available options. Values must be unique. */
9
+ options: readonly O[];
10
+ /** The input's semantic color. @default "accent" */
11
+ color?: ComboboxVariants["color"] | undefined;
12
+ /** The label displayed above the input. */
13
+ label?: ReactNode | undefined;
14
+ /** Additional props passed to the label. */
15
+ labelProps?: LabelProps | undefined;
16
+ /** Help text displayed below the label. */
17
+ description?: ReactNode | undefined;
18
+ /** Inline validation feedback. */
19
+ error?: ReactNode | undefined;
20
+ /** The name used for form submission. */
21
+ name?: string | undefined;
22
+ /** The id of the associated form. */
23
+ form?: string | undefined;
24
+ /** Prevents interaction and excludes the value from form submission. */
25
+ disabled?: boolean | undefined;
26
+ /** Prevents editing and opening the list. The value is still submitted. */
27
+ readOnly?: boolean | undefined;
28
+ /** Requires a nonempty committed value. */
29
+ required?: boolean | undefined;
30
+ /** Native validation message. @default "Please fill out this field." */
31
+ requiredMessage?: string | undefined;
32
+ /** Props passed to the input element. */
33
+ inputProps?: Omit<ComponentProps<"input">, "children"> | undefined;
34
+ /** Props passed to the listbox element. */
35
+ listProps?: Omit<ComponentProps<"div">, "children"> | undefined;
36
+ /** Props for each option wrapper. */
37
+ itemProps?: ((option: O) => Omit<ComponentProps<"div">, "children">) | undefined;
38
+ /** Custom option content. */
39
+ renderItem?: ((option: O) => ReactNode) | undefined;
40
+ /** Renders custom form submission elements for the committed value. */
41
+ renderFormValue?: ((props: ComboboxFormValueProps$1) => ReactNode) | undefined;
42
+ }
43
+ type ComboboxValueProps<O extends ComboboxSelectOption$1> = {
44
+ /** Select from options or allow free text. @default "select" */
45
+ mode?: "select" | undefined;
46
+ /** The controlled value. Use null for no selection. */
47
+ value?: string | null | undefined;
48
+ /** The initial uncontrolled value. */
49
+ defaultValue?: string | null | undefined;
50
+ /** Called with the next value. */
51
+ onChange?: ((value: string | null) => void) | undefined;
52
+ } | {
53
+ mode: "text";
54
+ options: readonly (O & ComboboxTextOption$1)[];
55
+ value?: string | undefined;
56
+ defaultValue?: string | undefined;
57
+ onChange?: ((value: string) => void) | undefined;
58
+ };
59
+ export type ComboboxProps<O extends ComboboxSelectOption$1 = ComboboxSelectOption$1> = HuiComponentProps<ComboboxOwnProps<O>, ComboboxSlots> & ComboboxValueProps<O>;
60
+ export declare function Combobox<O extends ComboboxSelectOption$1>(rawProps: ComboboxProps<O>): ReactElement;
61
+ export type { ComboboxFormValueProps, ComboboxSelectOption, ComboboxTextOption };