@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
@@ -6,16 +6,17 @@ import { useId } from "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  // src/components/radiogroup/radiogroup.tsx
8
8
  function Radiogroup(rawProps) {
9
- const { as, direction, label, description, error, labelProps, children, ...restProps } = useHuiProps("Radiogroup", rawProps);
9
+ const props = useHuiProps("Radiogroup", rawProps);
10
+ const { as, direction, label, description, error, labelProps, children, ...restProps } = props;
10
11
  const labelId = useId();
11
12
  const recipe = radiogroupRecipe({ direction });
12
- const cls = useHuiClassNames("Radiogroup", recipe, rawProps.classNames);
13
- const sls = useHuiStyles("Radiogroup", rawProps.styles);
13
+ const cls = useHuiClassNames("Radiogroup", recipe, rawProps);
14
+ const sls = useHuiStyles("Radiogroup", rawProps);
14
15
  const radiogroupState = {
15
16
  labelId,
16
17
  hasLabel: !!label || !!description || !!error,
17
18
  invalid: !!error,
18
- required: toBool(restProps["aria-required"])
19
+ required: toBool(props["aria-required"])
19
20
  };
20
21
  const rootAttrs = normalizeAttributes(radiogroupControl.getRootAttributes(radiogroupState));
21
22
  const labelAttrs = normalizeAttributes(radiogroupControl.getLabelAttributes(radiogroupState));
@@ -1 +1 @@
1
- {"version":3,"file":"radiogroup.js","names":[],"sources":["../../../src/components/radiogroup/radiogroup.tsx"],"sourcesContent":["import {\n radiogroupControl,\n radiogroupRecipe,\n type RadiogroupSlots,\n type RadiogroupVariants,\n toBool,\n} from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement, type ReactNode, useId } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { Label, type LabelProps } from \"../label\";\n\ninterface RadiogroupOwnProps {\n /**\n * The direction in which radio options are laid out.\n *\n * @default \"column\"\n */\n direction?: RadiogroupVariants[\"direction\"] | undefined;\n /**\n * The label displayed above the radio group.\n */\n label?: ReactNode | undefined;\n /**\n * Additional props passed to the internal label component.\n */\n labelProps?: LabelProps<\"div\"> | undefined;\n /**\n * The help text displayed below the label.\n */\n description?: ReactNode | undefined;\n /**\n * The error message displayed below the label.\n */\n error?: ReactNode | undefined;\n}\n\nexport type RadiogroupProps<E extends ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n RadiogroupOwnProps,\n RadiogroupSlots\n>;\n\nexport function Radiogroup<E extends ElementType = \"div\">(rawProps: RadiogroupProps<E>): ReactElement {\n const {\n as,\n direction,\n label,\n description,\n error,\n labelProps,\n children,\n ...restProps\n } = useHuiProps(\"Radiogroup\", rawProps);\n\n const labelId = useId();\n\n const recipe = radiogroupRecipe({ direction });\n const cls = useHuiClassNames(\"Radiogroup\", recipe, rawProps.classNames);\n const sls = useHuiStyles(\"Radiogroup\", rawProps.styles);\n const radiogroupState = {\n labelId,\n hasLabel: !!label || !!description || !!error,\n invalid: !!error,\n required: toBool(restProps[\"aria-required\"]),\n };\n const rootAttrs = normalizeAttributes(radiogroupControl.getRootAttributes(radiogroupState));\n const labelAttrs = normalizeAttributes(radiogroupControl.getLabelAttributes(radiogroupState));\n\n const Component = as ?? \"div\";\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...rootAttrs}\n {...restProps}\n >\n {radiogroupState.hasLabel\n && (\n <Label\n as=\"div\"\n {...labelAttrs}\n description={description}\n error={error}\n {...labelProps}\n >\n {label}\n </Label>\n )}\n <div\n className={cls.group}\n style={sls.group}\n >\n {children}\n </div>\n </Component>\n );\n}\n"],"mappings":";;;;;;;AA4CA,SAAgB,WAA0C,UAA4C;CACpG,MAAM,EACJ,IACA,WACA,OACA,aACA,OACA,YACA,UACA,GAAG,cACD,YAAY,cAAc,QAAQ;CAEtC,MAAM,UAAU,MAAM;CAEtB,MAAM,SAAS,iBAAiB,EAAE,UAAU,CAAC;CAC7C,MAAM,MAAM,iBAAiB,cAAc,QAAQ,SAAS,UAAU;CACtE,MAAM,MAAM,aAAa,cAAc,SAAS,MAAM;CACtD,MAAM,kBAAkB;EACtB;EACA,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAC;EACxC,SAAS,CAAC,CAAC;EACX,UAAU,OAAO,UAAU,gBAAgB;CAC7C;CACA,MAAM,YAAY,oBAAoB,kBAAkB,kBAAkB,eAAe,CAAC;CAC1F,MAAM,aAAa,oBAAoB,kBAAkB,mBAAmB,eAAe,CAAC;CAG5F,OACE,qBAFgB,MAAM,OAEtB;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EACJ,GAAI;EAJN,UAAA,CAMG,gBAAgB,YAEb,oBAAC,OAAD;GACE,IAAG;GACH,GAAI;GACS;GACN;GACP,GAAI;GAEH,UAAA;EACI,CAAA,GAEX,oBAAC,OAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GAEV;EACE,CAAA,CACI;;AAEf"}
1
+ {"version":3,"file":"radiogroup.js","names":[],"sources":["../../../src/components/radiogroup/radiogroup.tsx"],"sourcesContent":["import {\n radiogroupControl,\n radiogroupRecipe,\n type RadiogroupSlots,\n type RadiogroupVariants,\n toBool,\n} from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement, type ReactNode, useId } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { Label, type LabelProps } from \"../label\";\n\ninterface RadiogroupOwnProps {\n /**\n * The direction in which radio options are laid out.\n *\n * @default \"column\"\n */\n direction?: RadiogroupVariants[\"direction\"] | undefined;\n /**\n * The label displayed above the radio group.\n */\n label?: ReactNode | undefined;\n /**\n * Additional props passed to the internal label component.\n */\n labelProps?: LabelProps<\"div\"> | undefined;\n /**\n * The help text displayed below the label.\n */\n description?: ReactNode | undefined;\n /**\n * The error message displayed below the label.\n */\n error?: ReactNode | undefined;\n}\n\nexport type RadiogroupProps<E extends ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n RadiogroupOwnProps,\n RadiogroupSlots\n>;\n\nexport function Radiogroup<E extends ElementType = \"div\">(rawProps: RadiogroupProps<E>): ReactElement {\n const props = useHuiProps(\"Radiogroup\", rawProps);\n const {\n as,\n direction,\n label,\n description,\n error,\n labelProps,\n children,\n ...restProps\n } = props;\n\n const labelId = useId();\n\n const recipe = radiogroupRecipe({ direction });\n const cls = useHuiClassNames(\"Radiogroup\", recipe, rawProps);\n const sls = useHuiStyles(\"Radiogroup\", rawProps);\n const radiogroupState = {\n labelId,\n hasLabel: !!label || !!description || !!error,\n invalid: !!error,\n required: toBool(props[\"aria-required\"]),\n };\n const rootAttrs = normalizeAttributes(radiogroupControl.getRootAttributes(radiogroupState));\n const labelAttrs = normalizeAttributes(radiogroupControl.getLabelAttributes(radiogroupState));\n\n const Component = as ?? \"div\";\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...rootAttrs}\n {...restProps}\n >\n {radiogroupState.hasLabel\n && (\n <Label\n as=\"div\"\n {...labelAttrs}\n description={description}\n error={error}\n {...labelProps}\n >\n {label}\n </Label>\n )}\n <div\n className={cls.group}\n style={sls.group}\n >\n {children}\n </div>\n </Component>\n );\n}\n"],"mappings":";;;;;;;AA4CA,SAAgB,WAA0C,UAA4C;CACpG,MAAM,QAAQ,YAAY,cAAc,QAAQ;CAChD,MAAM,EACJ,IACA,WACA,OACA,aACA,OACA,YACA,UACA,GAAG,cACD;CAEJ,MAAM,UAAU,MAAM;CAEtB,MAAM,SAAS,iBAAiB,EAAE,UAAU,CAAC;CAC7C,MAAM,MAAM,iBAAiB,cAAc,QAAQ,QAAQ;CAC3D,MAAM,MAAM,aAAa,cAAc,QAAQ;CAC/C,MAAM,kBAAkB;EACtB;EACA,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAC;EACxC,SAAS,CAAC,CAAC;EACX,UAAU,OAAO,MAAM,gBAAgB;CACzC;CACA,MAAM,YAAY,oBAAoB,kBAAkB,kBAAkB,eAAe,CAAC;CAC1F,MAAM,aAAa,oBAAoB,kBAAkB,mBAAmB,eAAe,CAAC;CAG5F,OACE,qBAFgB,MAAM,OAEtB;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EACJ,GAAI;EAJN,UAAA,CAMG,gBAAgB,YAEb,oBAAC,OAAD;GACE,IAAG;GACH,GAAI;GACS;GACN;GACP,GAAI;GAEH,UAAA;EACI,CAAA,GAEX,oBAAC,OAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GAEV;EACE,CAAA,CACI;;AAEf"}
@@ -30,5 +30,4 @@ interface SectionOwnProps {
30
30
  }
31
31
  export type SectionProps<E extends ElementType = "section"> = HuiPolymorphicProps<E, SectionOwnProps, SectionSlots>;
32
32
  export declare function Section<E extends ElementType = "section">(rawProps: SectionProps<E>): ReactElement;
33
- export {};
34
- //# sourceMappingURL=section.d.ts.map
33
+ export {};
@@ -11,8 +11,8 @@ function Section(rawProps) {
11
11
  border
12
12
  });
13
13
  const Component = as ?? "section";
14
- const cls = useHuiClassNames("Section", recipe, { root: rawProps["className"] });
15
- const sls = useHuiStyles("Section", { root: rawProps["style"] });
14
+ const cls = useHuiClassNames("Section", recipe, rawProps);
15
+ const sls = useHuiStyles("Section", rawProps);
16
16
  return /* @__PURE__ */ jsx(Component, {
17
17
  className: cls.root,
18
18
  style: sls.root,
@@ -1 +1 @@
1
- {"version":3,"file":"section.js","names":[],"sources":["../../../src/components/section/section.tsx"],"sourcesContent":["import { sectionRecipe, type SectionSlots, type SectionVariants } from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface SectionOwnProps {\n /**\n * The background color of the section.\n *\n * @default \"section\"\n */\n bg?: SectionVariants[\"bg\"] | undefined;\n /**\n * The border radius of the section.\n *\n * @default \"base\"\n */\n radius?: SectionVariants[\"radius\"] | undefined;\n /**\n * The padding size of the section.\n *\n * @default \"sm\"\n */\n padding?: SectionVariants[\"padding\"] | undefined;\n /**\n * The border style of the section.\n *\n * @default \"none\"\n */\n border?: SectionVariants[\"border\"] | undefined;\n}\n\nexport type SectionProps<E extends ElementType = \"section\"> = HuiPolymorphicProps<\n E,\n SectionOwnProps,\n SectionSlots\n>;\n\nexport function Section<E extends ElementType = \"section\">(rawProps: SectionProps<E>): ReactElement {\n const {\n as,\n bg,\n radius,\n padding,\n border,\n children,\n ...restProps\n } = useHuiProps(\"Section\", rawProps);\n\n const recipe = sectionRecipe({ bg, radius, padding, border });\n const Component = as ?? \"section\";\n const cls = useHuiClassNames(\"Section\", recipe, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"Section\", { 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":";;;;AAsCA,SAAgB,QAA2C,UAAyC;CAClG,MAAM,EACJ,IACA,IACA,QACA,SACA,QACA,UACA,GAAG,cACD,YAAY,WAAW,QAAQ;CAEnC,MAAM,SAAS,cAAc;EAAE;EAAI;EAAQ;EAAS;CAAO,CAAC;CAC5D,MAAM,YAAY,MAAM;CACxB,MAAM,MAAM,iBAAiB,WAAW,QAAQ,EAAE,MAAM,SAAS,aAAa,CAAC;CAC/E,MAAM,MAAM,aAAa,WAAW,EAAE,MAAM,SAAS,SAAS,CAAC;CAE/D,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
1
+ {"version":3,"file":"section.js","names":[],"sources":["../../../src/components/section/section.tsx"],"sourcesContent":["import { sectionRecipe, type SectionSlots, type SectionVariants } from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface SectionOwnProps {\n /**\n * The background color of the section.\n *\n * @default \"section\"\n */\n bg?: SectionVariants[\"bg\"] | undefined;\n /**\n * The border radius of the section.\n *\n * @default \"base\"\n */\n radius?: SectionVariants[\"radius\"] | undefined;\n /**\n * The padding size of the section.\n *\n * @default \"sm\"\n */\n padding?: SectionVariants[\"padding\"] | undefined;\n /**\n * The border style of the section.\n *\n * @default \"none\"\n */\n border?: SectionVariants[\"border\"] | undefined;\n}\n\nexport type SectionProps<E extends ElementType = \"section\"> = HuiPolymorphicProps<\n E,\n SectionOwnProps,\n SectionSlots\n>;\n\nexport function Section<E extends ElementType = \"section\">(rawProps: SectionProps<E>): ReactElement {\n const {\n as,\n bg,\n radius,\n padding,\n border,\n children,\n ...restProps\n } = useHuiProps(\"Section\", rawProps);\n\n const recipe = sectionRecipe({ bg, radius, padding, border });\n const Component = as ?? \"section\";\n const cls = useHuiClassNames(\"Section\", recipe, rawProps);\n const sls = useHuiStyles(\"Section\", 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":";;;;AAsCA,SAAgB,QAA2C,UAAyC;CAClG,MAAM,EACJ,IACA,IACA,QACA,SACA,QACA,UACA,GAAG,cACD,YAAY,WAAW,QAAQ;CAEnC,MAAM,SAAS,cAAc;EAAE;EAAI;EAAQ;EAAS;CAAO,CAAC;CAC5D,MAAM,YAAY,MAAM;CACxB,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"}
@@ -35,5 +35,4 @@ declare function Item<E extends ElementType = "button">(rawProps: SegmentedContr
35
35
  export declare const SegmentedControl: typeof SegmentedControlRoot & {
36
36
  Item: typeof Item;
37
37
  };
38
- export {};
39
- //# sourceMappingURL=segmented-control.d.ts.map
38
+ export {};
@@ -10,14 +10,19 @@ function SegmentedControlRoot(rawProps) {
10
10
  const [uncontrolledValue, setUncontrolledValue] = useState(() => value ?? defaultValue ?? values[0]);
11
11
  const selectedValue = value ?? uncontrolledValue;
12
12
  const recipe = segmentedControlRootRecipe({});
13
- const cls = useHuiClassNames("SegmentedControl", recipe, { root: rawProps.className });
14
- const sls = useHuiStyles("SegmentedControl", { root: rawProps.style });
13
+ const cls = useHuiClassNames("SegmentedControl", recipe, rawProps);
14
+ const sls = useHuiStyles("SegmentedControl", rawProps);
15
15
  const onSelect = useCallback((nextValue) => {
16
16
  if (!values.includes(nextValue)) throw new Error(`[Hebium UI] Unexpected SegmentedControl value: ${nextValue}`);
17
17
  const v = nextValue;
18
+ if (v === selectedValue) return;
18
19
  setUncontrolledValue(v);
19
20
  onChange?.(v);
20
- }, [onChange, values]);
21
+ }, [
22
+ onChange,
23
+ selectedValue,
24
+ values
25
+ ]);
21
26
  const contextValue = useMemo(() => ({
22
27
  selectedValue,
23
28
  onSelect
@@ -37,8 +42,8 @@ function Item(rawProps) {
37
42
  const Component = as ?? "button";
38
43
  const { selectedValue, onSelect } = useSegmentedControlContext();
39
44
  const recipe = segmentedControlItemRecipe({});
40
- const cls = useHuiClassNames("SegmentedControlItem", recipe, { root: rawProps["className"] });
41
- const sls = useHuiStyles("SegmentedControlItem", { root: rawProps["style"] });
45
+ const cls = useHuiClassNames("SegmentedControlItem", recipe, rawProps);
46
+ const sls = useHuiStyles("SegmentedControlItem", rawProps);
42
47
  const attrs = normalizeAttributes(segmentedControl.getItemAttributes({
43
48
  isButtonElement: typeof as === "undefined",
44
49
  selectedValue
@@ -1 +1 @@
1
- {"version":3,"file":"segmented-control.js","names":[],"sources":["../../../src/components/segmented-control/segmented-control.tsx"],"sourcesContent":["import {\n segmentedControl,\n segmentedControlItemRecipe,\n type SegmentedControlItemSlots,\n segmentedControlRootRecipe,\n type SegmentedControlRootSlots,\n} from \"@hebium-ui/core\";\nimport {\n type ComponentProps,\n type ElementType,\n type MouseEvent,\n type ReactElement,\n useCallback,\n useMemo,\n useState,\n} from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport {\n SegmentedControlContext,\n type SegmentedControlContextValue,\n useSegmentedControlContext,\n} from \"./segmented-control.context\";\n\ntype HtmlUlProps = Omit<ComponentProps<\"ul\">, \"onChange\">;\n\ninterface SegmentedControlOwnProps<V extends string> extends HtmlUlProps {\n /**\n * The list of allowed segmented-control values.\n */\n values: readonly V[];\n /**\n * The currently selected segmented-control value.\n */\n value?: V | undefined;\n /**\n * The initially selected segmented-control value for uncontrolled component.\n */\n defaultValue?: V | undefined;\n /**\n * Called when the selected segmented-control value changes.\n */\n onChange?: ((value: V) => void) | undefined;\n}\nexport type SegmentedControlProps<V extends string> = HuiComponentProps<\n SegmentedControlOwnProps<V>,\n SegmentedControlRootSlots\n>;\n\nfunction SegmentedControlRoot<V extends string>(\n rawProps: SegmentedControlProps<V>,\n): ReactElement {\n const {\n values,\n value,\n defaultValue,\n onChange,\n children,\n ...restProps\n } = useHuiProps(\"SegmentedControl\", rawProps);\n\n const [uncontrolledValue, setUncontrolledValue] = useState<V | undefined>(\n () => value ?? defaultValue ?? values[0],\n );\n const selectedValue = value ?? uncontrolledValue;\n const recipe = segmentedControlRootRecipe({});\n const cls = useHuiClassNames(\"SegmentedControl\", recipe, { root: rawProps.className });\n const sls = useHuiStyles(\"SegmentedControl\", { root: rawProps.style });\n\n const onSelect = useCallback(\n (nextValue: string) => {\n if (!(values as readonly string[]).includes(nextValue)) {\n throw new Error(`[Hebium UI] Unexpected SegmentedControl value: ${nextValue}`);\n }\n\n const v = nextValue as V;\n setUncontrolledValue(v);\n onChange?.(v);\n },\n [onChange, values],\n );\n\n const contextValue = useMemo<SegmentedControlContextValue>(\n () => ({\n selectedValue,\n onSelect,\n }),\n [\n selectedValue,\n onSelect,\n ],\n );\n\n return (\n <SegmentedControlContext.Provider value={contextValue}>\n <ul\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </ul>\n </SegmentedControlContext.Provider>\n );\n}\n\ninterface SegmentedControlItemOwnProps {\n /**\n * The value represented by this control.\n */\n value: string;\n}\nexport type SegmentedControlItemProps<E extends ElementType = \"button\"> = HuiPolymorphicProps<\n E,\n SegmentedControlItemOwnProps,\n SegmentedControlItemSlots\n>;\n\nfunction Item<E extends ElementType = \"button\">(rawProps: SegmentedControlItemProps<E>): ReactElement {\n const {\n as,\n value,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"SegmentedControlItem\", rawProps);\n\n const Component = as ?? \"button\";\n\n const { selectedValue, onSelect } = useSegmentedControlContext();\n const recipe = segmentedControlItemRecipe({});\n const cls = useHuiClassNames(\"SegmentedControlItem\", recipe, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"SegmentedControlItem\", { root: rawProps[\"style\"] });\n const attrs = normalizeAttributes(\n segmentedControl.getItemAttributes({\n isButtonElement: typeof as === \"undefined\",\n selectedValue,\n }, value),\n );\n\n const handleClick = useCallback(\n (e: MouseEvent<HTMLButtonElement>): void => {\n onClick?.(e);\n if (e.defaultPrevented) return;\n onSelect(value);\n },\n [onClick, onSelect, value],\n );\n\n return (\n <li>\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n onClick={handleClick}\n {...restProps}\n >\n {children}\n </Component>\n </li>\n );\n}\n\nexport const SegmentedControl = Object.assign(SegmentedControlRoot, {\n Item,\n});\n"],"mappings":";;;;;;;AAkDA,SAAS,qBACP,UACc;CACd,MAAM,EACJ,QACA,OACA,cACA,UACA,UACA,GAAG,cACD,YAAY,oBAAoB,QAAQ;CAE5C,MAAM,CAAC,mBAAmB,wBAAwB,eAC1C,SAAS,gBAAgB,OAAO,EACxC;CACA,MAAM,gBAAgB,SAAS;CAC/B,MAAM,SAAS,2BAA2B,CAAC,CAAC;CAC5C,MAAM,MAAM,iBAAiB,oBAAoB,QAAQ,EAAE,MAAM,SAAS,UAAU,CAAC;CACrF,MAAM,MAAM,aAAa,oBAAoB,EAAE,MAAM,SAAS,MAAM,CAAC;CAErE,MAAM,WAAW,aACd,cAAsB;EACrB,IAAI,CAAE,OAA6B,SAAS,SAAS,GACnD,MAAM,IAAI,MAAM,kDAAkD,WAAW;EAG/E,MAAM,IAAI;EACV,qBAAqB,CAAC;EACtB,WAAW,CAAC;CACd,GACA,CAAC,UAAU,MAAM,CACnB;CAEA,MAAM,eAAe,eACZ;EACL;EACA;CACF,IACA,CACE,eACA,QACF,CACF;CAEA,OACE,oBAAC,wBAAwB,UAAzB;EAAkC,OAAO;EACvC,UAAA,oBAAC,MAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH;EACC,CAAA;CAC4B,CAAA;AAEtC;AAcA,SAAS,KAAuC,UAAsD;CACpG,MAAM,EACJ,IACA,OACA,UACA,SACA,GAAG,cACD,YAAY,wBAAwB,QAAQ;CAEhD,MAAM,YAAY,MAAM;CAExB,MAAM,EAAE,eAAe,aAAa,2BAA2B;CAC/D,MAAM,SAAS,2BAA2B,CAAC,CAAC;CAC5C,MAAM,MAAM,iBAAiB,wBAAwB,QAAQ,EAAE,MAAM,SAAS,aAAa,CAAC;CAC5F,MAAM,MAAM,aAAa,wBAAwB,EAAE,MAAM,SAAS,SAAS,CAAC;CAC5E,MAAM,QAAQ,oBACZ,iBAAiB,kBAAkB;EACjC,iBAAiB,OAAO,OAAO;EAC/B;CACF,GAAG,KAAK,CACV;CAEA,MAAM,cAAc,aACjB,MAA2C;EAC1C,UAAU,CAAC;EACX,IAAI,EAAE,kBAAkB;EACxB,SAAS,KAAK;CAChB,GACA;EAAC;EAAS;EAAU;CAAK,CAC3B;CAEA,OACE,oBAAC,MAAD,EAAA,UACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EACJ,SAAS;EACT,GAAI;EAEH;CACQ,CAAA,EACT,CAAA;AAER;AAEA,MAAa,mBAAmB,OAAO,OAAO,sBAAsB,EAClE,KACF,CAAC"}
1
+ {"version":3,"file":"segmented-control.js","names":[],"sources":["../../../src/components/segmented-control/segmented-control.tsx"],"sourcesContent":["import {\n segmentedControl,\n segmentedControlItemRecipe,\n type SegmentedControlItemSlots,\n segmentedControlRootRecipe,\n type SegmentedControlRootSlots,\n} from \"@hebium-ui/core\";\nimport {\n type ComponentProps,\n type ElementType,\n type MouseEvent,\n type ReactElement,\n useCallback,\n useMemo,\n useState,\n} from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport {\n SegmentedControlContext,\n type SegmentedControlContextValue,\n useSegmentedControlContext,\n} from \"./segmented-control.context\";\n\ntype HtmlUlProps = Omit<ComponentProps<\"ul\">, \"onChange\">;\n\ninterface SegmentedControlOwnProps<V extends string> extends HtmlUlProps {\n /**\n * The list of allowed segmented-control values.\n */\n values: readonly V[];\n /**\n * The currently selected segmented-control value.\n */\n value?: V | undefined;\n /**\n * The initially selected segmented-control value for uncontrolled component.\n */\n defaultValue?: V | undefined;\n /**\n * Called when the selected segmented-control value changes.\n */\n onChange?: ((value: V) => void) | undefined;\n}\nexport type SegmentedControlProps<V extends string> = HuiComponentProps<\n SegmentedControlOwnProps<V>,\n SegmentedControlRootSlots\n>;\n\nfunction SegmentedControlRoot<V extends string>(\n rawProps: SegmentedControlProps<V>,\n): ReactElement {\n const {\n values,\n value,\n defaultValue,\n onChange,\n children,\n ...restProps\n } = useHuiProps(\"SegmentedControl\", rawProps);\n\n const [uncontrolledValue, setUncontrolledValue] = useState<V | undefined>(\n () => value ?? defaultValue ?? values[0],\n );\n const selectedValue = value ?? uncontrolledValue;\n const recipe = segmentedControlRootRecipe({});\n const cls = useHuiClassNames(\"SegmentedControl\", recipe, rawProps);\n const sls = useHuiStyles(\"SegmentedControl\", rawProps);\n\n const onSelect = useCallback(\n (nextValue: string) => {\n if (!(values as readonly string[]).includes(nextValue)) {\n throw new Error(`[Hebium UI] Unexpected SegmentedControl value: ${nextValue}`);\n }\n\n const v = nextValue as V;\n if (v === selectedValue) return;\n\n setUncontrolledValue(v);\n onChange?.(v);\n },\n [onChange, selectedValue, values],\n );\n\n const contextValue = useMemo<SegmentedControlContextValue>(\n () => ({\n selectedValue,\n onSelect,\n }),\n [\n selectedValue,\n onSelect,\n ],\n );\n\n return (\n <SegmentedControlContext.Provider value={contextValue}>\n <ul\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </ul>\n </SegmentedControlContext.Provider>\n );\n}\n\ninterface SegmentedControlItemOwnProps {\n /**\n * The value represented by this control.\n */\n value: string;\n}\nexport type SegmentedControlItemProps<E extends ElementType = \"button\"> = HuiPolymorphicProps<\n E,\n SegmentedControlItemOwnProps,\n SegmentedControlItemSlots\n>;\n\nfunction Item<E extends ElementType = \"button\">(rawProps: SegmentedControlItemProps<E>): ReactElement {\n const {\n as,\n value,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"SegmentedControlItem\", rawProps);\n\n const Component = as ?? \"button\";\n\n const { selectedValue, onSelect } = useSegmentedControlContext();\n const recipe = segmentedControlItemRecipe({});\n const cls = useHuiClassNames(\"SegmentedControlItem\", recipe, rawProps);\n const sls = useHuiStyles(\"SegmentedControlItem\", rawProps);\n const attrs = normalizeAttributes(\n segmentedControl.getItemAttributes({\n isButtonElement: typeof as === \"undefined\",\n selectedValue,\n }, value),\n );\n\n const handleClick = useCallback(\n (e: MouseEvent<HTMLButtonElement>): void => {\n onClick?.(e);\n if (e.defaultPrevented) return;\n onSelect(value);\n },\n [onClick, onSelect, value],\n );\n\n return (\n <li>\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n onClick={handleClick}\n {...restProps}\n >\n {children}\n </Component>\n </li>\n );\n}\n\nexport const SegmentedControl = Object.assign(SegmentedControlRoot, {\n Item,\n});\n"],"mappings":";;;;;;;AAkDA,SAAS,qBACP,UACc;CACd,MAAM,EACJ,QACA,OACA,cACA,UACA,UACA,GAAG,cACD,YAAY,oBAAoB,QAAQ;CAE5C,MAAM,CAAC,mBAAmB,wBAAwB,eAC1C,SAAS,gBAAgB,OAAO,EACxC;CACA,MAAM,gBAAgB,SAAS;CAC/B,MAAM,SAAS,2BAA2B,CAAC,CAAC;CAC5C,MAAM,MAAM,iBAAiB,oBAAoB,QAAQ,QAAQ;CACjE,MAAM,MAAM,aAAa,oBAAoB,QAAQ;CAErD,MAAM,WAAW,aACd,cAAsB;EACrB,IAAI,CAAE,OAA6B,SAAS,SAAS,GACnD,MAAM,IAAI,MAAM,kDAAkD,WAAW;EAG/E,MAAM,IAAI;EACV,IAAI,MAAM,eAAe;EAEzB,qBAAqB,CAAC;EACtB,WAAW,CAAC;CACd,GACA;EAAC;EAAU;EAAe;CAAM,CAClC;CAEA,MAAM,eAAe,eACZ;EACL;EACA;CACF,IACA,CACE,eACA,QACF,CACF;CAEA,OACE,oBAAC,wBAAwB,UAAzB;EAAkC,OAAO;EACvC,UAAA,oBAAC,MAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH;EACC,CAAA;CAC4B,CAAA;AAEtC;AAcA,SAAS,KAAuC,UAAsD;CACpG,MAAM,EACJ,IACA,OACA,UACA,SACA,GAAG,cACD,YAAY,wBAAwB,QAAQ;CAEhD,MAAM,YAAY,MAAM;CAExB,MAAM,EAAE,eAAe,aAAa,2BAA2B;CAC/D,MAAM,SAAS,2BAA2B,CAAC,CAAC;CAC5C,MAAM,MAAM,iBAAiB,wBAAwB,QAAQ,QAAQ;CACrE,MAAM,MAAM,aAAa,wBAAwB,QAAQ;CACzD,MAAM,QAAQ,oBACZ,iBAAiB,kBAAkB;EACjC,iBAAiB,OAAO,OAAO;EAC/B;CACF,GAAG,KAAK,CACV;CAEA,MAAM,cAAc,aACjB,MAA2C;EAC1C,UAAU,CAAC;EACX,IAAI,EAAE,kBAAkB;EACxB,SAAS,KAAK;CAChB,GACA;EAAC;EAAS;EAAU;CAAK,CAC3B;CAEA,OACE,oBAAC,MAAD,EAAA,UACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EACJ,SAAS;EACT,GAAI;EAEH;CACQ,CAAA,EACT,CAAA;AAER;AAEA,MAAa,mBAAmB,OAAO,OAAO,sBAAsB,EAClE,KACF,CAAC"}
@@ -25,5 +25,4 @@ interface SelectOwnProps extends HtmlSelectProps {
25
25
  }
26
26
  export type SelectProps = HuiComponentProps<SelectOwnProps, SelectSlots>;
27
27
  export declare function Select(rawProps: SelectProps): ReactElement;
28
- export {};
29
- //# sourceMappingURL=select.d.ts.map
28
+ export {};
@@ -15,8 +15,8 @@ function Select(rawProps) {
15
15
  disabled: toBool(restProps.disabled) || toBool(restProps["aria-disabled"])
16
16
  };
17
17
  const recipe = selectRecipe({ error: toStrbool(inputState.invalid) });
18
- const cls = useHuiClassNames("Select", recipe, rawProps.classNames);
19
- const sls = useHuiStyles("Select", rawProps.styles);
18
+ const cls = useHuiClassNames("Select", recipe, rawProps);
19
+ const sls = useHuiStyles("Select", rawProps);
20
20
  const hasLabel = !!label || !!description || !!error;
21
21
  const controlAttrs = normalizeAttributes(inputControl.getControlAttributes(inputState));
22
22
  const labelAttrs = normalizeAttributes(inputControl.getLabelAttributes(inputState));
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","names":[],"sources":["../../../src/components/select/select.tsx"],"sourcesContent":["import { inputControl, selectRecipe, type SelectSlots, toBool, toStrbool } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement, type ReactNode, useId } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { Label, type LabelProps } from \"../label\";\n\ntype HtmlSelectProps = ComponentProps<\"select\">;\n\ninterface SelectOwnProps extends HtmlSelectProps {\n /**\n * The label displayed above the select.\n */\n label?: ReactNode | undefined;\n /**\n * Additional props passed to the internal label component.\n */\n labelProps?: LabelProps | undefined;\n /**\n * The help text displayed below the label.\n */\n description?: ReactNode | undefined;\n /**\n * The validation error message displayed below the label.\n */\n error?: ReactNode | undefined;\n}\n\nexport type SelectProps = HuiComponentProps<\n SelectOwnProps,\n SelectSlots\n>;\n\nexport function Select(rawProps: SelectProps): ReactElement {\n const {\n id,\n label,\n description,\n error,\n labelProps,\n ...restProps\n } = useHuiProps(\"Select\", rawProps);\n\n const tmpId = useId();\n\n const inputState = {\n id: id || tmpId,\n invalid: !!error,\n required: restProps.required ?? toBool(restProps[\"aria-required\"]),\n disabled: toBool(restProps.disabled) || toBool(restProps[\"aria-disabled\"]),\n };\n const recipe = selectRecipe({\n error: toStrbool(inputState.invalid),\n });\n const cls = useHuiClassNames(\"Select\", recipe, rawProps.classNames);\n const sls = useHuiStyles(\"Select\", rawProps.styles);\n const hasLabel = !!label || !!description || !!error;\n const controlAttrs = normalizeAttributes(inputControl.getControlAttributes(inputState));\n const labelAttrs = normalizeAttributes(inputControl.getLabelAttributes(inputState));\n\n return (\n <div\n data-disabled={inputState.disabled}\n className={cls.root}\n style={sls.root}\n >\n {hasLabel\n && (\n <Label\n {...labelAttrs}\n description={description}\n error={error}\n {...labelProps}\n >\n {label}\n </Label>\n )}\n <div className={cls.wrapper} style={sls.wrapper}>\n <select\n className={cls.select}\n style={sls.select}\n {...controlAttrs}\n {...restProps}\n />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAiCA,SAAgB,OAAO,UAAqC;CAC1D,MAAM,EACJ,IACA,OACA,aACA,OACA,YACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,QAAQ,MAAM;CAEpB,MAAM,aAAa;EACjB,IAAI,MAAM;EACV,SAAS,CAAC,CAAC;EACX,UAAU,UAAU,YAAY,OAAO,UAAU,gBAAgB;EACjE,UAAU,OAAO,UAAU,QAAQ,KAAK,OAAO,UAAU,gBAAgB;CAC3E;CACA,MAAM,SAAS,aAAa,EAC1B,OAAO,UAAU,WAAW,OAAO,EACrC,CAAC;CACD,MAAM,MAAM,iBAAiB,UAAU,QAAQ,SAAS,UAAU;CAClE,MAAM,MAAM,aAAa,UAAU,SAAS,MAAM;CAClD,MAAM,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAC;CAC/C,MAAM,eAAe,oBAAoB,aAAa,qBAAqB,UAAU,CAAC;CACtF,MAAM,aAAa,oBAAoB,aAAa,mBAAmB,UAAU,CAAC;CAElF,OACE,qBAAC,OAAD;EACE,iBAAe,WAAW;EAC1B,WAAW,IAAI;EACf,OAAO,IAAI;EAHb,UAAA,CAKG,YAEG,oBAAC,OAAD;GACE,GAAI;GACS;GACN;GACP,GAAI;GAEH,UAAA;EACI,CAAA,GAEX,oBAAC,OAAD;GAAK,WAAW,IAAI;GAAS,OAAO,IAAI;GACtC,UAAA,oBAAC,UAAD;IACE,WAAW,IAAI;IACf,OAAO,IAAI;IACX,GAAI;IACJ,GAAI;GACL,CAAA;EACE,CAAA,CACF;;AAET"}
1
+ {"version":3,"file":"select.js","names":[],"sources":["../../../src/components/select/select.tsx"],"sourcesContent":["import { inputControl, selectRecipe, type SelectSlots, toBool, toStrbool } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement, type ReactNode, useId } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { Label, type LabelProps } from \"../label\";\n\ntype HtmlSelectProps = ComponentProps<\"select\">;\n\ninterface SelectOwnProps extends HtmlSelectProps {\n /**\n * The label displayed above the select.\n */\n label?: ReactNode | undefined;\n /**\n * Additional props passed to the internal label component.\n */\n labelProps?: LabelProps | undefined;\n /**\n * The help text displayed below the label.\n */\n description?: ReactNode | undefined;\n /**\n * The validation error message displayed below the label.\n */\n error?: ReactNode | undefined;\n}\n\nexport type SelectProps = HuiComponentProps<\n SelectOwnProps,\n SelectSlots\n>;\n\nexport function Select(rawProps: SelectProps): ReactElement {\n const {\n id,\n label,\n description,\n error,\n labelProps,\n ...restProps\n } = useHuiProps(\"Select\", rawProps);\n\n const tmpId = useId();\n\n const inputState = {\n id: id || tmpId,\n invalid: !!error,\n required: restProps.required ?? toBool(restProps[\"aria-required\"]),\n disabled: toBool(restProps.disabled) || toBool(restProps[\"aria-disabled\"]),\n };\n const recipe = selectRecipe({\n error: toStrbool(inputState.invalid),\n });\n const cls = useHuiClassNames(\"Select\", recipe, rawProps);\n const sls = useHuiStyles(\"Select\", rawProps);\n const hasLabel = !!label || !!description || !!error;\n const controlAttrs = normalizeAttributes(inputControl.getControlAttributes(inputState));\n const labelAttrs = normalizeAttributes(inputControl.getLabelAttributes(inputState));\n\n return (\n <div\n data-disabled={inputState.disabled}\n className={cls.root}\n style={sls.root}\n >\n {hasLabel\n && (\n <Label\n {...labelAttrs}\n description={description}\n error={error}\n {...labelProps}\n >\n {label}\n </Label>\n )}\n <div className={cls.wrapper} style={sls.wrapper}>\n <select\n className={cls.select}\n style={sls.select}\n {...controlAttrs}\n {...restProps}\n />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAiCA,SAAgB,OAAO,UAAqC;CAC1D,MAAM,EACJ,IACA,OACA,aACA,OACA,YACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,QAAQ,MAAM;CAEpB,MAAM,aAAa;EACjB,IAAI,MAAM;EACV,SAAS,CAAC,CAAC;EACX,UAAU,UAAU,YAAY,OAAO,UAAU,gBAAgB;EACjE,UAAU,OAAO,UAAU,QAAQ,KAAK,OAAO,UAAU,gBAAgB;CAC3E;CACA,MAAM,SAAS,aAAa,EAC1B,OAAO,UAAU,WAAW,OAAO,EACrC,CAAC;CACD,MAAM,MAAM,iBAAiB,UAAU,QAAQ,QAAQ;CACvD,MAAM,MAAM,aAAa,UAAU,QAAQ;CAC3C,MAAM,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAC;CAC/C,MAAM,eAAe,oBAAoB,aAAa,qBAAqB,UAAU,CAAC;CACtF,MAAM,aAAa,oBAAoB,aAAa,mBAAmB,UAAU,CAAC;CAElF,OACE,qBAAC,OAAD;EACE,iBAAe,WAAW;EAC1B,WAAW,IAAI;EACf,OAAO,IAAI;EAHb,UAAA,CAKG,YAEG,oBAAC,OAAD;GACE,GAAI;GACS;GACN;GACP,GAAI;GAEH,UAAA;EACI,CAAA,GAEX,oBAAC,OAAD;GAAK,WAAW,IAAI;GAAS,OAAO,IAAI;GACtC,UAAA,oBAAC,UAAD;IACE,WAAW,IAAI;IACf,OAAO,IAAI;IACX,GAAI;IACJ,GAAI;GACL,CAAA;EACE,CAAA,CACF;;AAET"}
@@ -3,5 +3,4 @@ import "../../types/index.js";
3
3
  import { SkipLinkSlots } from "@hebium-ui/core";
4
4
  import { ElementType, ReactElement } from "react";
5
5
  export type SkipLinkProps<E extends ElementType = "div"> = HuiPolymorphicProps<E, {}, SkipLinkSlots>;
6
- export declare function SkipLink<E extends ElementType = "div">(rawProps: SkipLinkProps<E>): ReactElement;
7
- //# sourceMappingURL=skip-link.d.ts.map
6
+ export declare function SkipLink<E extends ElementType = "div">(rawProps: SkipLinkProps<E>): ReactElement;
@@ -6,8 +6,8 @@ function SkipLink(rawProps) {
6
6
  const { as, children, ...restProps } = useHuiProps("SkipLink", rawProps);
7
7
  const Component = as ?? "div";
8
8
  const recipe = skipLinkRecipe({});
9
- const cls = useHuiClassNames("SkipLink", recipe, { root: rawProps["className"] });
10
- const sls = useHuiStyles("SkipLink", { root: rawProps["style"] });
9
+ const cls = useHuiClassNames("SkipLink", recipe, rawProps);
10
+ const sls = useHuiStyles("SkipLink", rawProps);
11
11
  return /* @__PURE__ */ jsx(Component, {
12
12
  className: cls.root,
13
13
  style: sls.root,
@@ -1 +1 @@
1
- {"version":3,"file":"skip-link.js","names":[],"sources":["../../../src/components/skip-link/skip-link.tsx"],"sourcesContent":["import { skipLinkRecipe, type SkipLinkSlots } from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\nexport type SkipLinkProps<E extends ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n {},\n SkipLinkSlots\n>;\n\nexport function SkipLink<E extends ElementType = \"div\">(rawProps: SkipLinkProps<E>): ReactElement {\n const {\n as,\n children,\n ...restProps\n } = useHuiProps(\"SkipLink\", rawProps);\n\n const Component = as ?? \"div\";\n const recipe = skipLinkRecipe({});\n const cls = useHuiClassNames(\"SkipLink\", recipe, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"SkipLink\", { 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":";;;;AAWA,SAAgB,SAAwC,UAA0C;CAChG,MAAM,EACJ,IACA,UACA,GAAG,cACD,YAAY,YAAY,QAAQ;CAEpC,MAAM,YAAY,MAAM;CACxB,MAAM,SAAS,eAAe,CAAC,CAAC;CAChC,MAAM,MAAM,iBAAiB,YAAY,QAAQ,EAAE,MAAM,SAAS,aAAa,CAAC;CAChF,MAAM,MAAM,aAAa,YAAY,EAAE,MAAM,SAAS,SAAS,CAAC;CAEhE,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
1
+ {"version":3,"file":"skip-link.js","names":[],"sources":["../../../src/components/skip-link/skip-link.tsx"],"sourcesContent":["import { skipLinkRecipe, type SkipLinkSlots } from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\nexport type SkipLinkProps<E extends ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n {},\n SkipLinkSlots\n>;\n\nexport function SkipLink<E extends ElementType = \"div\">(rawProps: SkipLinkProps<E>): ReactElement {\n const {\n as,\n children,\n ...restProps\n } = useHuiProps(\"SkipLink\", rawProps);\n\n const Component = as ?? \"div\";\n const recipe = skipLinkRecipe({});\n const cls = useHuiClassNames(\"SkipLink\", recipe, rawProps);\n const sls = useHuiStyles(\"SkipLink\", 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":";;;;AAWA,SAAgB,SAAwC,UAA0C;CAChG,MAAM,EACJ,IACA,UACA,GAAG,cACD,YAAY,YAAY,QAAQ;CAEpC,MAAM,YAAY,MAAM;CACxB,MAAM,SAAS,eAAe,CAAC,CAAC;CAChC,MAAM,MAAM,iBAAiB,YAAY,QAAQ,QAAQ;CACzD,MAAM,MAAM,aAAa,YAAY,QAAQ;CAE7C,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
@@ -0,0 +1,2 @@
1
+ import { StatusIcon, StatusIconProps } from "./status-icon.js";
2
+ export { StatusIcon, StatusIconProps };
@@ -0,0 +1,19 @@
1
+ import { HuiComponentProps } from "../../types/hui-component.js";
2
+ import "../../types/index.js";
3
+ import { StatusIconSlots, StatusIconVariants } from "@hebium-ui/core";
4
+ import { ComponentProps, ReactElement } from "react";
5
+ interface StatusIconOwnProps extends Omit<ComponentProps<"span">, "children" | "color"> {
6
+ /**
7
+ * Status to display.
8
+ */
9
+ status: NonNullable<StatusIconVariants["status"]>;
10
+ /**
11
+ * Icon color.
12
+ *
13
+ * @default "inherit"
14
+ */
15
+ color?: StatusIconVariants["color"] | undefined;
16
+ }
17
+ export type StatusIconProps = HuiComponentProps<StatusIconOwnProps, StatusIconSlots>;
18
+ export declare function StatusIcon(rawProps: StatusIconProps): ReactElement;
19
+ export {};
@@ -0,0 +1,22 @@
1
+ import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
+ import { statusIconRecipe } from "@hebium-ui/core";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/status-icon/status-icon.tsx
5
+ function StatusIcon(rawProps) {
6
+ const { status, color, ...restProps } = useHuiProps("StatusIcon", rawProps);
7
+ const recipe = statusIconRecipe({
8
+ status,
9
+ color
10
+ });
11
+ const cls = useHuiClassNames("StatusIcon", recipe, rawProps);
12
+ const sls = useHuiStyles("StatusIcon", rawProps);
13
+ return /* @__PURE__ */ jsx("span", {
14
+ "aria-hidden": true,
15
+ className: cls.root,
16
+ style: sls.root,
17
+ ...restProps
18
+ });
19
+ }
20
+ export { StatusIcon };
21
+
22
+ //# sourceMappingURL=status-icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-icon.js","names":[],"sources":["../../../src/components/status-icon/status-icon.tsx"],"sourcesContent":["import { statusIconRecipe, type StatusIconSlots, type StatusIconVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface StatusIconOwnProps extends Omit<ComponentProps<\"span\">, \"children\" | \"color\"> {\n /**\n * Status to display.\n */\n status: NonNullable<StatusIconVariants[\"status\"]>;\n /**\n * Icon color.\n *\n * @default \"inherit\"\n */\n color?: StatusIconVariants[\"color\"] | undefined;\n}\n\nexport type StatusIconProps = HuiComponentProps<StatusIconOwnProps, StatusIconSlots>;\n\nexport function StatusIcon(rawProps: StatusIconProps): ReactElement {\n const {\n status,\n color,\n ...restProps\n } = useHuiProps(\"StatusIcon\", rawProps);\n const recipe = statusIconRecipe({\n status,\n color,\n });\n\n const cls = useHuiClassNames(\"StatusIcon\", recipe, rawProps);\n const sls = useHuiStyles(\"StatusIcon\", rawProps);\n\n return (\n <span\n aria-hidden\n className={cls.root}\n style={sls.root}\n {...restProps}\n />\n );\n}\n"],"mappings":";;;;AAoBA,SAAgB,WAAW,UAAyC;CAClE,MAAM,EACJ,QACA,OACA,GAAG,cACD,YAAY,cAAc,QAAQ;CACtC,MAAM,SAAS,iBAAiB;EAC9B;EACA;CACF,CAAC;CAED,MAAM,MAAM,iBAAiB,cAAc,QAAQ,QAAQ;CAC3D,MAAM,MAAM,aAAa,cAAc,QAAQ;CAE/C,OACE,oBAAC,QAAD;EACE,eAAA;EACA,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;CACL,CAAA;AAEL"}
@@ -18,11 +18,11 @@ interface CaptionOwnProps extends ComponentProps<"caption"> {
18
18
  }
19
19
  export interface CaptionProps extends HuiComponentProps<CaptionOwnProps, CaptionSlots> {}
20
20
  declare function Caption(rawProps: CaptionProps): ReactElement;
21
- export type TheadProps = ComponentProps<"thead">;
21
+ export type TheadProps = HuiComponentProps<ComponentProps<"thead">, "root">;
22
22
  declare function Thead(rawProps: TheadProps): ReactElement;
23
- export type TbodyProps = ComponentProps<"tbody">;
23
+ export type TbodyProps = HuiComponentProps<ComponentProps<"tbody">, "root">;
24
24
  declare function Tbody(rawProps: TbodyProps): ReactElement;
25
- export type TfootProps = ComponentProps<"tfoot">;
25
+ export type TfootProps = HuiComponentProps<ComponentProps<"tfoot">, "root">;
26
26
  declare function Tfoot(rawProps: TfootProps): ReactElement;
27
27
  interface TrOwnProps extends ComponentProps<"tr"> {
28
28
  /**
@@ -47,5 +47,4 @@ export declare const Table: typeof TableRoot & {
47
47
  Th: typeof Th;
48
48
  Td: typeof Td;
49
49
  };
50
- export {};
51
- //# sourceMappingURL=table.d.ts.map
50
+ export {};
@@ -5,8 +5,8 @@ import { jsx } from "react/jsx-runtime";
5
5
  function TableRoot(rawProps) {
6
6
  const { border, children, ...restProps } = useHuiProps("Table", rawProps);
7
7
  const recipe = tableRecipe({ border });
8
- const cls = useHuiClassNames("Table", recipe, { root: rawProps.className });
9
- const sls = useHuiStyles("Table", { root: rawProps.style });
8
+ const cls = useHuiClassNames("Table", recipe, rawProps);
9
+ const sls = useHuiStyles("Table", rawProps);
10
10
  return /* @__PURE__ */ jsx("table", {
11
11
  className: cls.root,
12
12
  style: sls.root,
@@ -17,8 +17,8 @@ function TableRoot(rawProps) {
17
17
  function Caption(rawProps) {
18
18
  const { side, children, ...restProps } = useHuiProps("TableCaption", rawProps);
19
19
  const recipe = captionRecipe({ side });
20
- const cls = useHuiClassNames("TableCaption", recipe, { root: rawProps.className });
21
- const sls = useHuiStyles("TableCaption", { root: rawProps.style });
20
+ const cls = useHuiClassNames("TableCaption", recipe, rawProps);
21
+ const sls = useHuiStyles("TableCaption", rawProps);
22
22
  return /* @__PURE__ */ jsx("caption", {
23
23
  className: cls.root,
24
24
  style: sls.root,
@@ -28,8 +28,8 @@ function Caption(rawProps) {
28
28
  }
29
29
  function Thead(rawProps) {
30
30
  const { children, ...restProps } = useHuiProps("TableThead", rawProps);
31
- const cls = useHuiClassNames("TableThead", { root: "" }, { root: rawProps.className });
32
- const sls = useHuiStyles("TableThead", { root: rawProps.style });
31
+ const cls = useHuiClassNames("TableThead", { root: "" }, rawProps);
32
+ const sls = useHuiStyles("TableThead", rawProps);
33
33
  return /* @__PURE__ */ jsx("thead", {
34
34
  className: cls.root,
35
35
  style: sls.root,
@@ -39,8 +39,8 @@ function Thead(rawProps) {
39
39
  }
40
40
  function Tbody(rawProps) {
41
41
  const { children, ...restProps } = useHuiProps("TableTbody", rawProps);
42
- const cls = useHuiClassNames("TableTbody", { root: "" }, { root: rawProps.className });
43
- const sls = useHuiStyles("TableTbody", { root: rawProps.style });
42
+ const cls = useHuiClassNames("TableTbody", { root: "" }, rawProps);
43
+ const sls = useHuiStyles("TableTbody", rawProps);
44
44
  return /* @__PURE__ */ jsx("tbody", {
45
45
  className: cls.root,
46
46
  style: sls.root,
@@ -50,8 +50,8 @@ function Tbody(rawProps) {
50
50
  }
51
51
  function Tfoot(rawProps) {
52
52
  const { children, ...restProps } = useHuiProps("TableTfoot", rawProps);
53
- const cls = useHuiClassNames("TableTfoot", { root: "" }, { root: rawProps.className });
54
- const sls = useHuiStyles("TableTfoot", { root: rawProps.style });
53
+ const cls = useHuiClassNames("TableTfoot", { root: "" }, rawProps);
54
+ const sls = useHuiStyles("TableTfoot", rawProps);
55
55
  return /* @__PURE__ */ jsx("tfoot", {
56
56
  className: cls.root,
57
57
  style: sls.root,
@@ -62,8 +62,8 @@ function Tfoot(rawProps) {
62
62
  function Tr(rawProps) {
63
63
  const { border, children, ...restProps } = useHuiProps("TableTr", rawProps);
64
64
  const recipe = trRecipe({ border });
65
- const cls = useHuiClassNames("TableTr", recipe, { root: rawProps.className });
66
- const sls = useHuiStyles("TableTr", { root: rawProps.style });
65
+ const cls = useHuiClassNames("TableTr", recipe, rawProps);
66
+ const sls = useHuiStyles("TableTr", rawProps);
67
67
  return /* @__PURE__ */ jsx("tr", {
68
68
  className: cls.root,
69
69
  style: sls.root,
@@ -74,8 +74,8 @@ function Tr(rawProps) {
74
74
  function Th(rawProps) {
75
75
  const { children, ...restProps } = useHuiProps("TableTh", rawProps);
76
76
  const recipe = thRecipe({});
77
- const cls = useHuiClassNames("TableTh", recipe, { root: rawProps.className });
78
- const sls = useHuiStyles("TableTh", { root: rawProps.style });
77
+ const cls = useHuiClassNames("TableTh", recipe, rawProps);
78
+ const sls = useHuiStyles("TableTh", rawProps);
79
79
  return /* @__PURE__ */ jsx("th", {
80
80
  className: cls.root,
81
81
  style: sls.root,
@@ -86,8 +86,8 @@ function Th(rawProps) {
86
86
  function Td(rawProps) {
87
87
  const { children, ...restProps } = useHuiProps("TableTd", rawProps);
88
88
  const recipe = tdRecipe({});
89
- const cls = useHuiClassNames("TableTd", recipe, { root: rawProps.className });
90
- const sls = useHuiStyles("TableTd", { root: rawProps.style });
89
+ const cls = useHuiClassNames("TableTd", recipe, rawProps);
90
+ const sls = useHuiStyles("TableTd", rawProps);
91
91
  return /* @__PURE__ */ jsx("td", {
92
92
  className: cls.root,
93
93
  style: sls.root,
@@ -1 +1 @@
1
- {"version":3,"file":"table.js","names":[],"sources":["../../../src/components/table/table.tsx"],"sourcesContent":["import {\n captionRecipe,\n type CaptionSlots,\n type CaptionVariants,\n tableRecipe,\n type TableSlots,\n type TableVariants,\n tdRecipe,\n type TdSlots,\n thRecipe,\n type ThSlots,\n trRecipe,\n type TrSlots,\n type TrVariants,\n} from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface TableOwnProps extends Omit<ComponentProps<\"table\">, \"border\"> {\n /**\n * The border style of the table.\n */\n border?: TableVariants[\"border\"] | undefined;\n}\nexport interface TableProps extends HuiComponentProps<TableOwnProps, TableSlots> {}\n\nfunction TableRoot(rawProps: TableProps): ReactElement {\n const {\n border,\n children,\n ...restProps\n } = useHuiProps(\"Table\", rawProps);\n\n const recipe = tableRecipe({ border });\n const cls = useHuiClassNames(\"Table\", recipe, { root: rawProps.className });\n const sls = useHuiStyles(\"Table\", { root: rawProps.style });\n\n return (\n <table\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </table>\n );\n}\n\ninterface CaptionOwnProps extends ComponentProps<\"caption\"> {\n /**\n * The side on which the caption is displayed.\n */\n side?: CaptionVariants[\"side\"] | undefined;\n}\nexport interface CaptionProps extends HuiComponentProps<CaptionOwnProps, CaptionSlots> {}\n\nfunction Caption(rawProps: CaptionProps): ReactElement {\n const {\n side,\n children,\n ...restProps\n } = useHuiProps(\"TableCaption\", rawProps);\n\n const recipe = captionRecipe({ side });\n const cls = useHuiClassNames(\"TableCaption\", recipe, { root: rawProps.className });\n const sls = useHuiStyles(\"TableCaption\", { root: rawProps.style });\n\n return (\n <caption\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </caption>\n );\n}\n\nexport type TheadProps = ComponentProps<\"thead\">;\n\nfunction Thead(rawProps: TheadProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"TableThead\", rawProps);\n\n const cls = useHuiClassNames(\"TableThead\", { root: \"\" }, { root: rawProps.className });\n const sls = useHuiStyles(\"TableThead\", { root: rawProps.style });\n\n return (\n <thead\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </thead>\n );\n}\n\nexport type TbodyProps = ComponentProps<\"tbody\">;\n\nfunction Tbody(rawProps: TbodyProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"TableTbody\", rawProps);\n\n const cls = useHuiClassNames(\"TableTbody\", { root: \"\" }, { root: rawProps.className });\n const sls = useHuiStyles(\"TableTbody\", { root: rawProps.style });\n\n return (\n <tbody\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </tbody>\n );\n}\n\nexport type TfootProps = ComponentProps<\"tfoot\">;\n\nfunction Tfoot(rawProps: TfootProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"TableTfoot\", rawProps);\n\n const cls = useHuiClassNames(\"TableTfoot\", { root: \"\" }, { root: rawProps.className });\n const sls = useHuiStyles(\"TableTfoot\", { root: rawProps.style });\n\n return (\n <tfoot\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </tfoot>\n );\n}\n\ninterface TrOwnProps extends ComponentProps<\"tr\"> {\n /**\n * The border style of the table row.\n *\n * @default \"block-end\"\n */\n border?: TrVariants[\"border\"] | undefined;\n}\nexport interface TrProps extends HuiComponentProps<TrOwnProps, TrSlots> {}\n\nfunction Tr(rawProps: TrProps): ReactElement {\n const {\n border,\n children,\n ...restProps\n } = useHuiProps(\"TableTr\", rawProps);\n\n const recipe = trRecipe({ border });\n const cls = useHuiClassNames(\"TableTr\", recipe, { root: rawProps.className });\n const sls = useHuiStyles(\"TableTr\", { root: rawProps.style });\n\n return (\n <tr\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </tr>\n );\n}\n\nexport interface ThProps extends HuiComponentProps<ComponentProps<\"th\">, ThSlots> {}\n\nfunction Th(rawProps: ThProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"TableTh\", rawProps);\n\n const recipe = thRecipe({});\n const cls = useHuiClassNames(\"TableTh\", recipe, { root: rawProps.className });\n const sls = useHuiStyles(\"TableTh\", { root: rawProps.style });\n\n return (\n <th\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </th>\n );\n}\n\nexport interface TdProps extends HuiComponentProps<ComponentProps<\"td\">, TdSlots> {}\n\nfunction Td(rawProps: TdProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"TableTd\", rawProps);\n\n const recipe = tdRecipe({});\n const cls = useHuiClassNames(\"TableTd\", recipe, { root: rawProps.className });\n const sls = useHuiStyles(\"TableTd\", { root: rawProps.style });\n\n return (\n <td\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </td>\n );\n}\n\nexport const Table = Object.assign(TableRoot, {\n Caption,\n Thead,\n Tbody,\n Tfoot,\n Tr,\n Th,\n Td,\n});\n"],"mappings":"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"}
1
+ {"version":3,"file":"table.js","names":[],"sources":["../../../src/components/table/table.tsx"],"sourcesContent":["import {\n captionRecipe,\n type CaptionSlots,\n type CaptionVariants,\n tableRecipe,\n type TableSlots,\n type TableVariants,\n tdRecipe,\n type TdSlots,\n thRecipe,\n type ThSlots,\n trRecipe,\n type TrSlots,\n type TrVariants,\n} from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface TableOwnProps extends Omit<ComponentProps<\"table\">, \"border\"> {\n /**\n * The border style of the table.\n */\n border?: TableVariants[\"border\"] | undefined;\n}\nexport interface TableProps extends HuiComponentProps<TableOwnProps, TableSlots> {}\n\nfunction TableRoot(rawProps: TableProps): ReactElement {\n const {\n border,\n children,\n ...restProps\n } = useHuiProps(\"Table\", rawProps);\n\n const recipe = tableRecipe({ border });\n const cls = useHuiClassNames(\"Table\", recipe, rawProps);\n const sls = useHuiStyles(\"Table\", rawProps);\n\n return (\n <table\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </table>\n );\n}\n\ninterface CaptionOwnProps extends ComponentProps<\"caption\"> {\n /**\n * The side on which the caption is displayed.\n */\n side?: CaptionVariants[\"side\"] | undefined;\n}\nexport interface CaptionProps extends HuiComponentProps<CaptionOwnProps, CaptionSlots> {}\n\nfunction Caption(rawProps: CaptionProps): ReactElement {\n const {\n side,\n children,\n ...restProps\n } = useHuiProps(\"TableCaption\", rawProps);\n\n const recipe = captionRecipe({ side });\n const cls = useHuiClassNames(\"TableCaption\", recipe, rawProps);\n const sls = useHuiStyles(\"TableCaption\", rawProps);\n\n return (\n <caption\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </caption>\n );\n}\n\nexport type TheadProps = HuiComponentProps<ComponentProps<\"thead\">, \"root\">;\n\nfunction Thead(rawProps: TheadProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"TableThead\", rawProps);\n\n const cls = useHuiClassNames(\"TableThead\", { root: \"\" }, rawProps);\n const sls = useHuiStyles(\"TableThead\", rawProps);\n\n return (\n <thead\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </thead>\n );\n}\n\nexport type TbodyProps = HuiComponentProps<ComponentProps<\"tbody\">, \"root\">;\n\nfunction Tbody(rawProps: TbodyProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"TableTbody\", rawProps);\n\n const cls = useHuiClassNames(\"TableTbody\", { root: \"\" }, rawProps);\n const sls = useHuiStyles(\"TableTbody\", rawProps);\n\n return (\n <tbody\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </tbody>\n );\n}\n\nexport type TfootProps = HuiComponentProps<ComponentProps<\"tfoot\">, \"root\">;\n\nfunction Tfoot(rawProps: TfootProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"TableTfoot\", rawProps);\n\n const cls = useHuiClassNames(\"TableTfoot\", { root: \"\" }, rawProps);\n const sls = useHuiStyles(\"TableTfoot\", rawProps);\n\n return (\n <tfoot\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </tfoot>\n );\n}\n\ninterface TrOwnProps extends ComponentProps<\"tr\"> {\n /**\n * The border style of the table row.\n *\n * @default \"block-end\"\n */\n border?: TrVariants[\"border\"] | undefined;\n}\nexport interface TrProps extends HuiComponentProps<TrOwnProps, TrSlots> {}\n\nfunction Tr(rawProps: TrProps): ReactElement {\n const {\n border,\n children,\n ...restProps\n } = useHuiProps(\"TableTr\", rawProps);\n\n const recipe = trRecipe({ border });\n const cls = useHuiClassNames(\"TableTr\", recipe, rawProps);\n const sls = useHuiStyles(\"TableTr\", rawProps);\n\n return (\n <tr\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </tr>\n );\n}\n\nexport interface ThProps extends HuiComponentProps<ComponentProps<\"th\">, ThSlots> {}\n\nfunction Th(rawProps: ThProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"TableTh\", rawProps);\n\n const recipe = thRecipe({});\n const cls = useHuiClassNames(\"TableTh\", recipe, rawProps);\n const sls = useHuiStyles(\"TableTh\", rawProps);\n\n return (\n <th\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </th>\n );\n}\n\nexport interface TdProps extends HuiComponentProps<ComponentProps<\"td\">, TdSlots> {}\n\nfunction Td(rawProps: TdProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"TableTd\", rawProps);\n\n const recipe = tdRecipe({});\n const cls = useHuiClassNames(\"TableTd\", recipe, rawProps);\n const sls = useHuiStyles(\"TableTd\", rawProps);\n\n return (\n <td\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </td>\n );\n}\n\nexport const Table = Object.assign(TableRoot, {\n Caption,\n Thead,\n Tbody,\n Tfoot,\n Tr,\n Th,\n Td,\n});\n"],"mappings":"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"}
@@ -1,2 +1 @@
1
- export type ActivationMode = "manual" | "auto";
2
- //# sourceMappingURL=tabs.context.d.ts.map
1
+ export type ActivationMode = "manual" | "auto";
@@ -54,5 +54,4 @@ export declare const Tabs: typeof TabsRoot & {
54
54
  Tab: typeof Tab;
55
55
  Panel: typeof Panel;
56
56
  };
57
- export {};
58
- //# sourceMappingURL=tabs.d.ts.map
57
+ export {};
@@ -13,8 +13,8 @@ function TabsRoot(rawProps) {
13
13
  const [uncontrolledValue, setUncontrolledValue] = useState(() => value ?? defaultValue ?? values[0]);
14
14
  const selectedValue = value ?? uncontrolledValue;
15
15
  const recipe = tabrootRecipe({});
16
- const cls = useHuiClassNames("Tabs", recipe, { root: rawProps["className"] });
17
- const sls = useHuiStyles("Tabs", { root: rawProps["style"] });
16
+ const cls = useHuiClassNames("Tabs", recipe, rawProps);
17
+ const sls = useHuiStyles("Tabs", rawProps);
18
18
  const onSelect = useCallback((nextValue) => {
19
19
  if (!values.includes(nextValue)) throw new Error(`[Hebium UI] Unexpected Tab value: ${nextValue}`);
20
20
  const v = nextValue;
@@ -51,8 +51,8 @@ function List(rawProps) {
51
51
  const { as, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...restProps } = useHuiProps("TabsList", rawProps);
52
52
  const Component = as ?? "div";
53
53
  const recipe = tablistRecipe({});
54
- const cls = useHuiClassNames("TabsList", recipe, { root: rawProps["className"] });
55
- const sls = useHuiStyles("TabsList", { root: rawProps["style"] });
54
+ const cls = useHuiClassNames("TabsList", recipe, rawProps);
55
+ const sls = useHuiStyles("TabsList", rawProps);
56
56
  const { rootId, selectedValue } = useTabsContext();
57
57
  const attrs = normalizeAttributes(tabsControl.getListAttributes({
58
58
  rootId,
@@ -74,8 +74,8 @@ function Tab(rawProps) {
74
74
  const Component = as ?? "button";
75
75
  const { rootId, selectedValue, onSelect, activation } = useTabsContext();
76
76
  const recipe = tabRecipe({});
77
- const cls = useHuiClassNames("TabsTab", recipe, { root: rawProps["className"] });
78
- const sls = useHuiStyles("TabsTab", { root: rawProps["style"] });
77
+ const cls = useHuiClassNames("TabsTab", recipe, rawProps);
78
+ const sls = useHuiStyles("TabsTab", rawProps);
79
79
  const attrs = normalizeAttributes(tabsControl.getTabAttributes({
80
80
  rootId,
81
81
  selectedValue
@@ -133,8 +133,8 @@ function Panel(rawProps) {
133
133
  const Component = as ?? "div";
134
134
  const { rootId, selectedValue } = useTabsContext();
135
135
  const recipe = tabpanelRecipe({});
136
- const cls = useHuiClassNames("TabsPanel", recipe, { root: rawProps["className"] });
137
- const sls = useHuiStyles("TabsPanel", { root: rawProps["style"] });
136
+ const cls = useHuiClassNames("TabsPanel", recipe, rawProps);
137
+ const sls = useHuiStyles("TabsPanel", rawProps);
138
138
  const attrs = normalizeAttributes(tabsControl.getPanelAttributes({
139
139
  rootId,
140
140
  selectedValue
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.js","names":[],"sources":["../../../src/components/tabs/tabs.tsx"],"sourcesContent":["import {\n tablistRecipe,\n type TablistSlots,\n tabpanelRecipe,\n type TabpanelSlots,\n tabRecipe,\n tabrootRecipe,\n type TabrootSlots,\n tabsControl,\n type TabSlots,\n} from \"@hebium-ui/core\";\nimport {\n type ElementType,\n type FocusEvent,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n useCallback,\n useId,\n useMemo,\n useState,\n} from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { type ActivationMode, TabsContext, type TabsContextValue, useTabsContext } from \"./tabs.context\";\n\ninterface TabsOwnProps<V extends string> {\n /**\n * The list of allowed tab values.\n */\n values: readonly V[];\n /**\n * The currently selected tab value.\n */\n value?: V | undefined;\n /**\n * The initially selected tab value for uncontrolled tabs.\n */\n defaultValue?: V | undefined;\n /**\n * Called when the selected tab value changes.\n */\n onChange?: ((value: V) => void) | undefined;\n /**\n * The activation mode used when focus moves between tabs.\n *\n * @default \"manual\"\n * @see {@link https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_selection_follows_focus | WAI-ARIA APG: Deciding When to Make Selection Automatically Follow Focus}\n */\n activation?: ActivationMode;\n}\nexport type TabsProps<V extends string, E extends ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n TabsOwnProps<V>,\n TabrootSlots\n>;\n\nfunction TabsRoot<V extends string, E extends ElementType = \"div\">(\n rawProps: TabsProps<V, E>,\n): ReactElement {\n const {\n as,\n id,\n values,\n value,\n defaultValue,\n onChange,\n children,\n activation = \"manual\",\n ...restProps\n } = useHuiProps(\"Tabs\", rawProps);\n\n const Component = as ?? \"div\";\n\n const tmpId = useId();\n const rootId = id || tmpId;\n const [uncontrolledValue, setUncontrolledValue] = useState<V | undefined>(\n () => value ?? defaultValue ?? values[0],\n );\n const selectedValue = value ?? uncontrolledValue;\n const recipe = tabrootRecipe({});\n const cls = useHuiClassNames(\"Tabs\", recipe, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"Tabs\", { root: rawProps[\"style\"] });\n\n const onSelect = useCallback(\n (nextValue: string) => {\n if (!(values as readonly string[]).includes(nextValue)) {\n throw new Error(`[Hebium UI] Unexpected Tab value: ${nextValue}`);\n }\n\n const v = nextValue as V;\n setUncontrolledValue(v);\n onChange?.(v);\n },\n [onChange, values],\n );\n\n const contextValue = useMemo<TabsContextValue>(\n () => ({\n rootId,\n selectedValue,\n onSelect,\n activation,\n }),\n [\n rootId,\n selectedValue,\n onSelect,\n activation,\n ],\n );\n const attrs = normalizeAttributes(tabsControl.getRootAttributes({ rootId, selectedValue }));\n\n return (\n <TabsContext.Provider value={contextValue}>\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n {...restProps}\n >\n {children}\n </Component>\n </TabsContext.Provider>\n );\n}\n\ninterface TabsListOwnProps {}\nexport type TabsListProps<E extends ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n TabsListOwnProps,\n TablistSlots\n>;\n\nfunction List<E extends ElementType = \"div\">(rawProps: TabsListProps<E>): ReactElement {\n const {\n as,\n children,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...restProps\n } = useHuiProps(\"TabsList\", rawProps);\n\n const Component = as ?? \"div\";\n\n const recipe = tablistRecipe({});\n const cls = useHuiClassNames(\"TabsList\", recipe, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"TabsList\", { root: rawProps[\"style\"] });\n const { rootId, selectedValue } = useTabsContext();\n const attrs = normalizeAttributes(\n tabsControl.getListAttributes(\n { rootId, selectedValue },\n { ariaLabel, ariaLabelledBy },\n ),\n );\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ninterface TabsTabOwnProps {\n /**\n * The value represented by this tab.\n */\n value: string;\n}\nexport type TabsTabProps<E extends ElementType = \"button\"> = HuiPolymorphicProps<\n E,\n TabsTabOwnProps,\n TabSlots\n>;\n\nfunction Tab<E extends ElementType = \"button\">(rawProps: TabsTabProps<E>): ReactElement {\n const {\n as,\n value,\n children,\n onClick,\n onKeyDown,\n onFocus,\n ...restProps\n } = useHuiProps(\"TabsTab\", rawProps);\n\n const Component = as ?? \"button\";\n\n const { rootId, selectedValue, onSelect, activation } = useTabsContext();\n const recipe = tabRecipe({});\n const cls = useHuiClassNames(\"TabsTab\", recipe, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"TabsTab\", { root: rawProps[\"style\"] });\n const attrs = normalizeAttributes(\n tabsControl.getTabAttributes(\n { rootId, selectedValue },\n value,\n { isButtonElement: as === undefined },\n ),\n );\n\n const handleClick = useCallback(\n (e: MouseEvent<HTMLButtonElement>): void => {\n onClick?.(e);\n if (e.defaultPrevented) return;\n onSelect(value);\n },\n [onClick, onSelect, value],\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLButtonElement>): void => {\n onKeyDown?.(e);\n if (e.defaultPrevented) return;\n\n const action = tabsControl.handleTabKeydown(e.nativeEvent);\n switch (action) {\n case \"activate\":\n onSelect(value);\n return;\n case \"focus-move\":\n tabsControl.moveFocus(e.nativeEvent, rootId);\n return;\n case \"none\":\n return;\n }\n },\n [onKeyDown, onSelect, rootId, value],\n );\n\n const handleFocus = useCallback((e: FocusEvent<HTMLButtonElement, HTMLElement>) => {\n onFocus?.(e);\n if (e.defaultPrevented) return;\n\n if (activation === \"auto\") {\n onSelect(value);\n }\n }, [onFocus, onSelect, activation, value]);\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ninterface TabsPanelOwnProps {\n /**\n * The tab value associated with this panel.\n */\n value: string;\n}\nexport type TabsPanelProps<E extends ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n TabsPanelOwnProps,\n TabpanelSlots\n>;\n\nfunction Panel<E extends ElementType = \"div\">(rawProps: TabsPanelProps<E>): ReactElement {\n const {\n as,\n value,\n children,\n ...restProps\n } = useHuiProps(\"TabsPanel\", rawProps);\n\n const Component = as ?? \"div\";\n\n const { rootId, selectedValue } = useTabsContext();\n const recipe = tabpanelRecipe({});\n const cls = useHuiClassNames(\"TabsPanel\", recipe, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"TabsPanel\", { root: rawProps[\"style\"] });\n const attrs = normalizeAttributes(tabsControl.getPanelAttributes({ rootId, selectedValue }, value));\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\nexport const Tabs = Object.assign(TabsRoot, {\n List,\n Tab,\n Panel,\n});\n"],"mappings":"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"}
1
+ {"version":3,"file":"tabs.js","names":[],"sources":["../../../src/components/tabs/tabs.tsx"],"sourcesContent":["import {\n tablistRecipe,\n type TablistSlots,\n tabpanelRecipe,\n type TabpanelSlots,\n tabRecipe,\n tabrootRecipe,\n type TabrootSlots,\n tabsControl,\n type TabSlots,\n} from \"@hebium-ui/core\";\nimport {\n type ElementType,\n type FocusEvent,\n type KeyboardEvent,\n type MouseEvent,\n type ReactElement,\n useCallback,\n useId,\n useMemo,\n useState,\n} from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { type ActivationMode, TabsContext, type TabsContextValue, useTabsContext } from \"./tabs.context\";\n\ninterface TabsOwnProps<V extends string> {\n /**\n * The list of allowed tab values.\n */\n values: readonly V[];\n /**\n * The currently selected tab value.\n */\n value?: V | undefined;\n /**\n * The initially selected tab value for uncontrolled tabs.\n */\n defaultValue?: V | undefined;\n /**\n * Called when the selected tab value changes.\n */\n onChange?: ((value: V) => void) | undefined;\n /**\n * The activation mode used when focus moves between tabs.\n *\n * @default \"manual\"\n * @see {@link https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_selection_follows_focus | WAI-ARIA APG: Deciding When to Make Selection Automatically Follow Focus}\n */\n activation?: ActivationMode;\n}\nexport type TabsProps<V extends string, E extends ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n TabsOwnProps<V>,\n TabrootSlots\n>;\n\nfunction TabsRoot<V extends string, E extends ElementType = \"div\">(\n rawProps: TabsProps<V, E>,\n): ReactElement {\n const {\n as,\n id,\n values,\n value,\n defaultValue,\n onChange,\n children,\n activation = \"manual\",\n ...restProps\n } = useHuiProps(\"Tabs\", rawProps);\n\n const Component = as ?? \"div\";\n\n const tmpId = useId();\n const rootId = id || tmpId;\n const [uncontrolledValue, setUncontrolledValue] = useState<V | undefined>(\n () => value ?? defaultValue ?? values[0],\n );\n const selectedValue = value ?? uncontrolledValue;\n const recipe = tabrootRecipe({});\n const cls = useHuiClassNames(\"Tabs\", recipe, rawProps);\n const sls = useHuiStyles(\"Tabs\", rawProps);\n\n const onSelect = useCallback(\n (nextValue: string) => {\n if (!(values as readonly string[]).includes(nextValue)) {\n throw new Error(`[Hebium UI] Unexpected Tab value: ${nextValue}`);\n }\n\n const v = nextValue as V;\n setUncontrolledValue(v);\n onChange?.(v);\n },\n [onChange, values],\n );\n\n const contextValue = useMemo<TabsContextValue>(\n () => ({\n rootId,\n selectedValue,\n onSelect,\n activation,\n }),\n [\n rootId,\n selectedValue,\n onSelect,\n activation,\n ],\n );\n const attrs = normalizeAttributes(tabsControl.getRootAttributes({ rootId, selectedValue }));\n\n return (\n <TabsContext.Provider value={contextValue}>\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n {...restProps}\n >\n {children}\n </Component>\n </TabsContext.Provider>\n );\n}\n\ninterface TabsListOwnProps {}\nexport type TabsListProps<E extends ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n TabsListOwnProps,\n TablistSlots\n>;\n\nfunction List<E extends ElementType = \"div\">(rawProps: TabsListProps<E>): ReactElement {\n const {\n as,\n children,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...restProps\n } = useHuiProps(\"TabsList\", rawProps);\n\n const Component = as ?? \"div\";\n\n const recipe = tablistRecipe({});\n const cls = useHuiClassNames(\"TabsList\", recipe, rawProps);\n const sls = useHuiStyles(\"TabsList\", rawProps);\n const { rootId, selectedValue } = useTabsContext();\n const attrs = normalizeAttributes(\n tabsControl.getListAttributes(\n { rootId, selectedValue },\n { ariaLabel, ariaLabelledBy },\n ),\n );\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ninterface TabsTabOwnProps {\n /**\n * The value represented by this tab.\n */\n value: string;\n}\nexport type TabsTabProps<E extends ElementType = \"button\"> = HuiPolymorphicProps<\n E,\n TabsTabOwnProps,\n TabSlots\n>;\n\nfunction Tab<E extends ElementType = \"button\">(rawProps: TabsTabProps<E>): ReactElement {\n const {\n as,\n value,\n children,\n onClick,\n onKeyDown,\n onFocus,\n ...restProps\n } = useHuiProps(\"TabsTab\", rawProps);\n\n const Component = as ?? \"button\";\n\n const { rootId, selectedValue, onSelect, activation } = useTabsContext();\n const recipe = tabRecipe({});\n const cls = useHuiClassNames(\"TabsTab\", recipe, rawProps);\n const sls = useHuiStyles(\"TabsTab\", rawProps);\n const attrs = normalizeAttributes(\n tabsControl.getTabAttributes(\n { rootId, selectedValue },\n value,\n { isButtonElement: as === undefined },\n ),\n );\n\n const handleClick = useCallback(\n (e: MouseEvent<HTMLButtonElement>): void => {\n onClick?.(e);\n if (e.defaultPrevented) return;\n onSelect(value);\n },\n [onClick, onSelect, value],\n );\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLButtonElement>): void => {\n onKeyDown?.(e);\n if (e.defaultPrevented) return;\n\n const action = tabsControl.handleTabKeydown(e.nativeEvent);\n switch (action) {\n case \"activate\":\n onSelect(value);\n return;\n case \"focus-move\":\n tabsControl.moveFocus(e.nativeEvent, rootId);\n return;\n case \"none\":\n return;\n }\n },\n [onKeyDown, onSelect, rootId, value],\n );\n\n const handleFocus = useCallback((e: FocusEvent<HTMLButtonElement, HTMLElement>) => {\n onFocus?.(e);\n if (e.defaultPrevented) return;\n\n if (activation === \"auto\") {\n onSelect(value);\n }\n }, [onFocus, onSelect, activation, value]);\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ninterface TabsPanelOwnProps {\n /**\n * The tab value associated with this panel.\n */\n value: string;\n}\nexport type TabsPanelProps<E extends ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n TabsPanelOwnProps,\n TabpanelSlots\n>;\n\nfunction Panel<E extends ElementType = \"div\">(rawProps: TabsPanelProps<E>): ReactElement {\n const {\n as,\n value,\n children,\n ...restProps\n } = useHuiProps(\"TabsPanel\", rawProps);\n\n const Component = as ?? \"div\";\n\n const { rootId, selectedValue } = useTabsContext();\n const recipe = tabpanelRecipe({});\n const cls = useHuiClassNames(\"TabsPanel\", recipe, rawProps);\n const sls = useHuiStyles(\"TabsPanel\", rawProps);\n const attrs = normalizeAttributes(tabsControl.getPanelAttributes({ rootId, selectedValue }, value));\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...attrs}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\nexport const Tabs = Object.assign(TabsRoot, {\n List,\n Tab,\n Panel,\n});\n"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ import { Tag, TagProps } from "./tag.js";
2
+ export { Tag, TagProps };
@@ -0,0 +1,39 @@
1
+ import { HuiComponentProps } from "../../types/hui-component.js";
2
+ import "../../types/index.js";
3
+ import { TagSlots, TagVariants } from "@hebium-ui/core";
4
+ import { ComponentProps, ReactElement, ReactNode } from "react";
5
+ interface TagOwnProps extends Omit<ComponentProps<"span">, "color" | "children"> {
6
+ /**
7
+ * The tag text.
8
+ */
9
+ label: string;
10
+ /**
11
+ * The semantic color of the tag.
12
+ *
13
+ * @default "text"
14
+ */
15
+ color?: TagVariants["color"] | undefined;
16
+ /**
17
+ * How overflowing label text is displayed.
18
+ *
19
+ * @default "unset"
20
+ */
21
+ textOverflow?: TagVariants["textOverflow"] | undefined;
22
+ /**
23
+ * The content of the remove button. Set to `null` or `false` to hide the button.
24
+ *
25
+ * @default close icon
26
+ */
27
+ removeButton?: ReactNode | undefined;
28
+ /**
29
+ * Props forwarded to the remove button, overriding its defaults.
30
+ */
31
+ removeButtonProps?: Omit<ComponentProps<"button">, "children" | "className" | "style"> | undefined;
32
+ /**
33
+ * Called when the remove button is activated. Overridden by `removeButtonProps.onClick`.
34
+ */
35
+ onRemove?: (() => void) | undefined;
36
+ }
37
+ export type TagProps = HuiComponentProps<TagOwnProps, TagSlots>;
38
+ export declare function Tag(rawProps: TagProps): ReactElement;
39
+ export {};