@hebium-ui/react 0.1.0-alpha.1 → 0.1.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/components/alert/alert.d.ts +0 -2
  2. package/dist/components/alert/alert.js +4 -5
  3. package/dist/components/alert/alert.js.map +1 -1
  4. package/dist/components/anchor/anchor.d.ts +0 -2
  5. package/dist/components/anchor/anchor.js +4 -5
  6. package/dist/components/anchor/anchor.js.map +1 -1
  7. package/dist/components/avatar/avatar.d.ts +0 -2
  8. package/dist/components/avatar/avatar.js +4 -5
  9. package/dist/components/avatar/avatar.js.map +1 -1
  10. package/dist/components/blockquote/blockquote.d.ts +0 -2
  11. package/dist/components/blockquote/blockquote.js +4 -5
  12. package/dist/components/blockquote/blockquote.js.map +1 -1
  13. package/dist/components/button/button.d.ts +0 -2
  14. package/dist/components/button/button.js +4 -5
  15. package/dist/components/button/button.js.map +1 -1
  16. package/dist/components/checkbox/checkbox.d.ts +1 -3
  17. package/dist/components/checkbox/checkbox.js +29 -16
  18. package/dist/components/checkbox/checkbox.js.map +1 -1
  19. package/dist/components/code/code.d.ts +0 -2
  20. package/dist/components/code/code.js +4 -5
  21. package/dist/components/code/code.js.map +1 -1
  22. package/dist/components/details/details.d.ts +0 -2
  23. package/dist/components/details/details.js +4 -5
  24. package/dist/components/details/details.js.map +1 -1
  25. package/dist/components/dialog/dialog.context.d.ts +0 -2
  26. package/dist/components/dialog/dialog.context.js +1 -2
  27. package/dist/components/dialog/dialog.d.ts +0 -2
  28. package/dist/components/dialog/dialog.js +13 -6
  29. package/dist/components/dialog/dialog.js.map +1 -1
  30. package/dist/components/dl/dl.d.ts +0 -2
  31. package/dist/components/dl/dl.js +10 -11
  32. package/dist/components/dl/dl.js.map +1 -1
  33. package/dist/components/drawer/drawer.context.d.ts +0 -2
  34. package/dist/components/drawer/drawer.context.js +1 -2
  35. package/dist/components/drawer/drawer.d.ts +0 -2
  36. package/dist/components/drawer/drawer.js +13 -6
  37. package/dist/components/drawer/drawer.js.map +1 -1
  38. package/dist/components/fieldset/fieldset.d.ts +0 -2
  39. package/dist/components/fieldset/fieldset.js +4 -5
  40. package/dist/components/fieldset/fieldset.js.map +1 -1
  41. package/dist/components/heading/heading.d.ts +0 -2
  42. package/dist/components/heading/heading.js +4 -5
  43. package/dist/components/heading/heading.js.map +1 -1
  44. package/dist/components/hr/hr.d.ts +0 -2
  45. package/dist/components/hr/hr.js +4 -5
  46. package/dist/components/hr/hr.js.map +1 -1
  47. package/dist/components/index.d.ts +5 -1
  48. package/dist/components/input/input.d.ts +0 -2
  49. package/dist/components/input/input.js +4 -5
  50. package/dist/components/input/input.js.map +1 -1
  51. package/dist/components/label/label.d.ts +0 -2
  52. package/dist/components/label/label.js +4 -5
  53. package/dist/components/label/label.js.map +1 -1
  54. package/dist/components/menu/menu.context.d.ts +0 -2
  55. package/dist/components/menu/menu.context.js +1 -2
  56. package/dist/components/menu/menu.d.ts +0 -2
  57. package/dist/components/menu/menu.js +11 -8
  58. package/dist/components/menu/menu.js.map +1 -1
  59. package/dist/components/paragraph/paragraph.d.ts +6 -2
  60. package/dist/components/paragraph/paragraph.js +8 -6
  61. package/dist/components/paragraph/paragraph.js.map +1 -1
  62. package/dist/components/popover/popover.context.d.ts +0 -2
  63. package/dist/components/popover/popover.context.js +1 -2
  64. package/dist/components/popover/popover.d.ts +0 -2
  65. package/dist/components/popover/popover.js +8 -5
  66. package/dist/components/popover/popover.js.map +1 -1
  67. package/dist/components/progress/progress.d.ts +0 -2
  68. package/dist/components/progress/progress.js +4 -5
  69. package/dist/components/progress/progress.js.map +1 -1
  70. package/dist/components/radio/radio.d.ts +0 -2
  71. package/dist/components/radio/radio.js +4 -5
  72. package/dist/components/radio/radio.js.map +1 -1
  73. package/dist/components/radiogroup/radiogroup.d.ts +0 -2
  74. package/dist/components/radiogroup/radiogroup.js +4 -5
  75. package/dist/components/radiogroup/radiogroup.js.map +1 -1
  76. package/dist/components/section/section.d.ts +0 -2
  77. package/dist/components/section/section.js +4 -5
  78. package/dist/components/section/section.js.map +1 -1
  79. package/dist/components/segmented-control/segmented-control.context.js +1 -2
  80. package/dist/components/segmented-control/segmented-control.d.ts +1 -3
  81. package/dist/components/segmented-control/segmented-control.js +7 -8
  82. package/dist/components/segmented-control/segmented-control.js.map +1 -1
  83. package/dist/components/select/select.d.ts +0 -2
  84. package/dist/components/select/select.js +4 -5
  85. package/dist/components/select/select.js.map +1 -1
  86. package/dist/components/skip-link/index.d.ts +2 -0
  87. package/dist/components/skip-link/skip-link.d.ts +7 -0
  88. package/dist/components/skip-link/skip-link.js +20 -0
  89. package/dist/components/skip-link/skip-link.js.map +1 -0
  90. package/dist/components/table/table.d.ts +0 -2
  91. package/dist/components/table/table.js +25 -26
  92. package/dist/components/table/table.js.map +1 -1
  93. package/dist/components/tabs/tabs.context.d.ts +0 -2
  94. package/dist/components/tabs/tabs.context.js +1 -2
  95. package/dist/components/tabs/tabs.d.ts +1 -3
  96. package/dist/components/tabs/tabs.js +13 -14
  97. package/dist/components/tabs/tabs.js.map +1 -1
  98. package/dist/components/text/index.d.ts +2 -0
  99. package/dist/components/text/text.d.ts +23 -0
  100. package/dist/components/text/text.js +23 -0
  101. package/dist/components/text/text.js.map +1 -0
  102. package/dist/components/textarea/textarea.d.ts +0 -2
  103. package/dist/components/textarea/textarea.js +4 -5
  104. package/dist/components/textarea/textarea.js.map +1 -1
  105. package/dist/components/tooltip/tooltip.context.d.ts +0 -2
  106. package/dist/components/tooltip/tooltip.context.js +1 -2
  107. package/dist/components/tooltip/tooltip.d.ts +0 -2
  108. package/dist/components/tooltip/tooltip.js +8 -5
  109. package/dist/components/tooltip/tooltip.js.map +1 -1
  110. package/dist/components/visually-hidden/visually-hidden.d.ts +2 -4
  111. package/dist/components/visually-hidden/visually-hidden.js +4 -5
  112. package/dist/components/visually-hidden/visually-hidden.js.map +1 -1
  113. package/dist/index.d.ts +3 -1
  114. package/dist/index.js +3 -1
  115. package/dist/provider/hui-provider.context.d.ts +12 -4
  116. package/dist/provider/hui-provider.context.js +10 -4
  117. package/dist/provider/hui-provider.context.js.map +1 -1
  118. package/dist/provider/hui-provider.d.ts +0 -2
  119. package/dist/provider/hui-provider.js +1 -2
  120. package/dist/provider/merge-props.js +1 -2
  121. package/dist/types/hui-component.d.ts +0 -2
  122. package/dist/types/polymorphic.d.ts +0 -2
  123. package/dist/utils/attributes/normalize-attributes.js +1 -2
  124. package/package.json +9 -9
@@ -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: 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 className,\n style,\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: className });\n const sls = useHuiStyles(\"Tabs\", { root: style });\n\n const onSelect = useCallback(\n (nextValue: string) => {\n if (!(values as 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 className,\n style,\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: className });\n const sls = useHuiStyles(\"TabsList\", { root: 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 className,\n style,\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: className });\n const sls = useHuiStyles(\"TabsTab\", { root: 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 className,\n style,\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: className });\n const sls = useHuiStyles(\"TabsPanel\", { root: 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":";;;;;;;AA0DA,SAAS,SACP,UACc;CACd,MAAM,EACJ,IACA,IACA,QACA,OACA,cACA,UACA,WACA,OACA,UACA,aAAa,UACb,GAAG,cACD,YAAY,QAAQ,QAAQ;CAEhC,MAAM,YAAY,MAAM;CAExB,MAAM,QAAQ,MAAM;CACpB,MAAM,SAAS,MAAM;CACrB,MAAM,CAAC,mBAAmB,wBAAwB,eAC1C,SAAS,gBAAgB,OAAO,EACxC;CACA,MAAM,gBAAgB,SAAS;CAC/B,MAAM,SAAS,cAAc,CAAC,CAAC;CAC/B,MAAM,MAAM,iBAAiB,QAAQ,QAAQ,EAAE,MAAM,UAAU,CAAC;CAChE,MAAM,MAAM,aAAa,QAAQ,EAAE,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Aa,QAAQ,EAAE,MAAM,UAAU,CAAC;CACrE,MAAM,MAAM,aAAa,aAAa,EAAE,MAAM,MAAM,CAAC;CACrD,MAAM,QAAQ,oBAAoB,YAAY,mBAAmB;EAAE;EAAQ;CAAc,GAAG,KAAK,CAAC;CAElG,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EACJ,GAAI;EAEH;CACQ,CAAA;AAEf;AAEA,MAAa,OAAO,OAAO,OAAO,UAAU;CAC1C;CACA;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"tabs.js","names":[],"sources":["../../../src/components/tabs/tabs.tsx"],"sourcesContent":["import {\n tablistRecipe,\n type TablistSlots,\n tabpanelRecipe,\n type TabpanelSlots,\n tabRecipe,\n tabrootRecipe,\n type TabrootSlots,\n tabsControl,\n type TabSlots,\n} from \"@hebium-ui/core\";\nimport {\n type 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":";;;;;;;AA0DA,SAAS,SACP,UACc;CACd,MAAM,EACJ,IACA,IACA,QACA,OACA,cACA,UACA,UACA,aAAa,UACb,GAAG,cACD,YAAY,QAAQ,QAAQ;CAEhC,MAAM,YAAY,MAAM;CAExB,MAAM,QAAQ,MAAM;CACpB,MAAM,SAAS,MAAM;CACrB,MAAM,CAAC,mBAAmB,wBAAwB,eAC1C,SAAS,gBAAgB,OAAO,EACxC;CACA,MAAM,gBAAgB,SAAS;CAC/B,MAAM,SAAS,cAAc,CAAC,CAAC;CAC/B,MAAM,MAAM,iBAAiB,QAA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,kBAAkB,eAAe;CACjD,MAAM,SAAS,eAAe,CAAC,CAAC;CAChC,MAAM,MAAM,iBAAiB,aAAa,QAAQ,EAAE,MAAM,SAAS,aAAa,CAAC;CACjF,MAAM,MAAM,aAAa,aAAa,EAAE,MAAM,SAAS,SAAS,CAAC;CACjE,MAAM,QAAQ,oBAAoB,YAAY,mBAAmB;EAAE;EAAQ;CAAc,GAAG,KAAK,CAAC;CAElG,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EACJ,GAAI;EAEH;CACQ,CAAA;AAEf;AAEA,MAAa,OAAO,OAAO,OAAO,UAAU;CAC1C;CACA;CACA;AACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Text, TextProps } from "./text.js";
2
+ export { Text, TextProps };
@@ -0,0 +1,23 @@
1
+ import { HuiPolymorphicProps } from "../../types/polymorphic.js";
2
+ import "../../types/index.js";
3
+ import { TextSlots, TextVariants } from "@hebium-ui/core";
4
+ import { ElementType, ReactElement } from "react";
5
+ interface TextOwnProps {
6
+ /**
7
+ * The semantic color of the text.
8
+ *
9
+ * @default "text"
10
+ */
11
+ color?: TextVariants["color"] | undefined;
12
+ /**
13
+ * How overflowing text is displayed.
14
+ * Use "ellipsis" to truncate text to a single line with an ellipsis.
15
+ *
16
+ * @default "unset"
17
+ */
18
+ textOverflow?: TextVariants["textOverflow"] | undefined;
19
+ }
20
+ export type TextProps<E extends ElementType = "span"> = HuiPolymorphicProps<E, TextOwnProps, TextSlots>;
21
+ export declare function Text<E extends ElementType = "span">(rawProps: TextProps<E>): ReactElement;
22
+ export {};
23
+ //# sourceMappingURL=text.d.ts.map
@@ -0,0 +1,23 @@
1
+ import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
+ import { textRecipe } from "@hebium-ui/core";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/text/text.tsx
5
+ function Text(rawProps) {
6
+ const { as, color, textOverflow, children, ...restProps } = useHuiProps("Text", rawProps);
7
+ const Component = as ?? "span";
8
+ const recipe = textRecipe({
9
+ color,
10
+ textOverflow
11
+ });
12
+ const cls = useHuiClassNames("Text", recipe, { root: rawProps["className"] });
13
+ const sls = useHuiStyles("Text", { root: rawProps["style"] });
14
+ return /* @__PURE__ */ jsx(Component, {
15
+ className: cls.root,
16
+ style: sls.root,
17
+ ...restProps,
18
+ children
19
+ });
20
+ }
21
+ export { Text };
22
+
23
+ //# sourceMappingURL=text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.js","names":[],"sources":["../../../src/components/text/text.tsx"],"sourcesContent":["import { textRecipe, type TextSlots, type TextVariants } from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface TextOwnProps {\n /**\n * The semantic color of the text.\n *\n * @default \"text\"\n */\n color?: TextVariants[\"color\"] | undefined;\n /**\n * How overflowing text is displayed.\n * Use \"ellipsis\" to truncate text to a single line with an ellipsis.\n *\n * @default \"unset\"\n */\n textOverflow?: TextVariants[\"textOverflow\"] | undefined;\n}\n\nexport type TextProps<E extends ElementType = \"span\"> = HuiPolymorphicProps<\n E,\n TextOwnProps,\n TextSlots\n>;\n\nexport function Text<E extends ElementType = \"span\">(rawProps: TextProps<E>): ReactElement {\n const {\n as,\n color,\n textOverflow,\n children,\n ...restProps\n } = useHuiProps(\"Text\", rawProps);\n\n const Component = as ?? \"span\";\n const recipe = textRecipe({\n color,\n textOverflow,\n });\n const cls = useHuiClassNames(\"Text\", recipe, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"Text\", { 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":";;;;AA2BA,SAAgB,KAAqC,UAAsC;CACzF,MAAM,EACJ,IACA,OACA,cACA,UACA,GAAG,cACD,YAAY,QAAQ,QAAQ;CAEhC,MAAM,YAAY,MAAM;CACxB,MAAM,SAAS,WAAW;EACxB;EACA;CACF,CAAC;CACD,MAAM,MAAM,iBAAiB,QAAQ,QAAQ,EAAE,MAAM,SAAS,aAAa,CAAC;CAC5E,MAAM,MAAM,aAAa,QAAQ,EAAE,MAAM,SAAS,SAAS,CAAC;CAE5D,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
@@ -4,7 +4,6 @@ import { LabelProps } from "../label/label.js";
4
4
  import "../label/index.js";
5
5
  import { InputSlots, InputVariants } from "@hebium-ui/core";
6
6
  import { ComponentProps, ReactElement, ReactNode } from "react";
7
- //#region src/components/textarea/textarea.d.ts
8
7
  type HtmlTextareaProps = Omit<ComponentProps<"textarea">, "children" | "color">;
9
8
  interface TextareaOwnProps extends HtmlTextareaProps {
10
9
  /**
@@ -32,6 +31,5 @@ interface TextareaOwnProps extends HtmlTextareaProps {
32
31
  }
33
32
  export type TextareaProps = HuiComponentProps<TextareaOwnProps, InputSlots>;
34
33
  export declare function Textarea(rawProps: TextareaProps): ReactElement;
35
- //#endregion
36
34
  export {};
37
35
  //# sourceMappingURL=textarea.d.ts.map
@@ -4,9 +4,9 @@ import { Label } from "../label/label.js";
4
4
  import { inputControl, inputRecipe, toBool, toStrbool } from "@hebium-ui/core";
5
5
  import { useId } from "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
- //#region src/components/textarea/textarea.tsx
7
+ // src/components/textarea/textarea.tsx
8
8
  function Textarea(rawProps) {
9
- const { id, classNames, styles, color, label, description, error, labelProps, ...restProps } = useHuiProps("Textarea", rawProps);
9
+ const { id, color, label, description, error, labelProps, ...restProps } = useHuiProps("Textarea", rawProps);
10
10
  const tmpId = useId();
11
11
  const inputState = {
12
12
  id: id || tmpId,
@@ -20,8 +20,8 @@ function Textarea(rawProps) {
20
20
  height: "auto",
21
21
  error: toStrbool(inputState.invalid)
22
22
  });
23
- const cls = useHuiClassNames("Textarea", recipe, classNames);
24
- const sls = useHuiStyles("Textarea", styles);
23
+ const cls = useHuiClassNames("Textarea", recipe, rawProps.classNames);
24
+ const sls = useHuiStyles("Textarea", rawProps.styles);
25
25
  const hasLabel = !!label || !!description || !!error;
26
26
  const controlAttrs = normalizeAttributes(inputControl.getControlAttributes(inputState));
27
27
  const labelAttrs = normalizeAttributes(inputControl.getLabelAttributes(inputState));
@@ -42,7 +42,6 @@ function Textarea(rawProps) {
42
42
  })]
43
43
  });
44
44
  }
45
- //#endregion
46
45
  export { Textarea };
47
46
 
48
47
  //# sourceMappingURL=textarea.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"textarea.js","names":[],"sources":["../../../src/components/textarea/textarea.tsx"],"sourcesContent":["import { inputControl, inputRecipe, type InputSlots, type InputVariants, 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 HtmlTextareaProps = Omit<ComponentProps<\"textarea\">, \"children\" | \"color\">;\n\ninterface TextareaOwnProps extends HtmlTextareaProps {\n /**\n * The semantic color of the textarea.\n *\n * @default \"accent\"\n */\n color?: InputVariants[\"color\"] | undefined;\n /**\n * The label displayed above the textarea.\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 TextareaProps = HuiComponentProps<\n TextareaOwnProps,\n InputSlots\n>;\n\nexport function Textarea(rawProps: TextareaProps): ReactElement {\n const {\n id,\n classNames,\n styles,\n color,\n label,\n description,\n error,\n labelProps,\n ...restProps\n } = useHuiProps(\"Textarea\", 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 readOnly: toBool(restProps.readOnly) || toBool(restProps[\"aria-readonly\"]),\n };\n const recipe = inputRecipe({\n color,\n height: \"auto\",\n error: toStrbool(inputState.invalid),\n });\n const cls = useHuiClassNames(\"Textarea\", recipe, classNames);\n const sls = useHuiStyles(\"Textarea\", 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 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 <textarea\n className={cls.input}\n style={sls.input}\n {...controlAttrs}\n {...restProps}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;AAuCA,SAAgB,SAAS,UAAuC;CAC9D,MAAM,EACJ,IACA,YACA,QACA,OACA,OACA,aACA,OACA,YACA,GAAG,cACD,YAAY,YAAY,QAAQ;CAEpC,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;EACzE,UAAU,OAAO,UAAU,QAAQ,KAAK,OAAO,UAAU,gBAAgB;CAC3E;CACA,MAAM,SAAS,YAAY;EACzB;EACA,QAAQ;EACR,OAAO,UAAU,WAAW,OAAO;CACrC,CAAC;CACD,MAAM,MAAM,iBAAiB,YAAY,QAAQ,UAAU;CAC3D,MAAM,MAAM,aAAa,YAAY,MAAM;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,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIG,YAEG,oBAAC,OAAD;GACE,GAAI;GACS;GACN;GACP,GAAI;GAEH,UAAA;EACI,CAAA,GAEX,oBAAC,YAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GACJ,GAAI;EACL,CAAA,CACE;;AAET"}
1
+ {"version":3,"file":"textarea.js","names":[],"sources":["../../../src/components/textarea/textarea.tsx"],"sourcesContent":["import { inputControl, inputRecipe, type InputSlots, type InputVariants, 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 HtmlTextareaProps = Omit<ComponentProps<\"textarea\">, \"children\" | \"color\">;\n\ninterface TextareaOwnProps extends HtmlTextareaProps {\n /**\n * The semantic color of the textarea.\n *\n * @default \"accent\"\n */\n color?: InputVariants[\"color\"] | undefined;\n /**\n * The label displayed above the textarea.\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 TextareaProps = HuiComponentProps<\n TextareaOwnProps,\n InputSlots\n>;\n\nexport function Textarea(rawProps: TextareaProps): ReactElement {\n const {\n id,\n color,\n label,\n description,\n error,\n labelProps,\n ...restProps\n } = useHuiProps(\"Textarea\", 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 readOnly: toBool(restProps.readOnly) || toBool(restProps[\"aria-readonly\"]),\n };\n const recipe = inputRecipe({\n color,\n height: \"auto\",\n error: toStrbool(inputState.invalid),\n });\n const cls = useHuiClassNames(\"Textarea\", recipe, rawProps.classNames);\n const sls = useHuiStyles(\"Textarea\", 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 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 <textarea\n className={cls.input}\n style={sls.input}\n {...controlAttrs}\n {...restProps}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;AAuCA,SAAgB,SAAS,UAAuC;CAC9D,MAAM,EACJ,IACA,OACA,OACA,aACA,OACA,YACA,GAAG,cACD,YAAY,YAAY,QAAQ;CAEpC,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;EACzE,UAAU,OAAO,UAAU,QAAQ,KAAK,OAAO,UAAU,gBAAgB;CAC3E;CACA,MAAM,SAAS,YAAY;EACzB;EACA,QAAQ;EACR,OAAO,UAAU,WAAW,OAAO;CACrC,CAAC;CACD,MAAM,MAAM,iBAAiB,YAAY,QAAQ,SAAS,UAAU;CACpE,MAAM,MAAM,aAAa,YAAY,SAAS,MAAM;CACpD,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,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIG,YAEG,oBAAC,OAAD;GACE,GAAI;GACS;GACN;GACP,GAAI;GAEH,UAAA;EACI,CAAA,GAEX,oBAAC,YAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GACJ,GAAI;EACL,CAAA,CACE;;AAET"}
@@ -1,4 +1,2 @@
1
- //#region src/components/tooltip/tooltip.context.d.ts
2
1
  export declare function useTooltipId(): string;
3
- //#endregion
4
2
  //# sourceMappingURL=tooltip.context.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { createContext, useContext } from "react";
2
- //#region src/components/tooltip/tooltip.context.ts
2
+ // src/components/tooltip/tooltip.context.ts
3
3
  const TooltipContext = createContext(null);
4
4
  function useTooltipContext() {
5
5
  const context = useContext(TooltipContext);
@@ -9,7 +9,6 @@ function useTooltipContext() {
9
9
  function useTooltipId() {
10
10
  return useTooltipContext().tooltipId;
11
11
  }
12
- //#endregion
13
12
  export { TooltipContext, useTooltipContext, useTooltipId };
14
13
 
15
14
  //# sourceMappingURL=tooltip.context.js.map
@@ -4,7 +4,6 @@ import { Button } from "../button/button.js";
4
4
  import "../button/index.js";
5
5
  import { ButtonSlots, PopoverSlots, PopoverVariants } from "@hebium-ui/core";
6
6
  import { ElementType, ReactElement, ReactNode } from "react";
7
- //#region src/components/tooltip/tooltip.d.ts
8
7
  export interface TooltipProps {
9
8
  /**
10
9
  * The id of the tooltip content element.
@@ -48,6 +47,5 @@ export declare const Tooltip: typeof TooltipRoot & {
48
47
  Trigger: typeof Trigger;
49
48
  Content: typeof Content;
50
49
  };
51
- //#endregion
52
50
  export {};
53
51
  //# sourceMappingURL=tooltip.d.ts.map
@@ -4,7 +4,7 @@ import { TooltipContext, useTooltipId } from "./tooltip.context.js";
4
4
  import { popoverRecipe, tooltipControl } from "@hebium-ui/core";
5
5
  import { useCallback, useId, useMemo } from "react";
6
6
  import { jsx } from "react/jsx-runtime";
7
- //#region src/components/tooltip/tooltip.tsx
7
+ // src/components/tooltip/tooltip.tsx
8
8
  function TooltipRoot(rawProps) {
9
9
  const { id, children } = useHuiProps("Tooltip", rawProps);
10
10
  const tmpId = useId();
@@ -20,6 +20,8 @@ function TooltipRoot(rawProps) {
20
20
  function Trigger(rawProps) {
21
21
  const { as, onPointerEnter, onPointerLeave, onFocus, onBlur, ...restProps } = useHuiProps("TooltipTrigger", rawProps);
22
22
  const Component = as ?? Button;
23
+ const cls = useHuiClassNames("TooltipTrigger", { root: "" }, { root: rawProps["className"] });
24
+ const sls = useHuiStyles("TooltipTrigger", { root: rawProps["style"] });
23
25
  const tooltipId = useTooltipId();
24
26
  const attrs = tooltipControl.getTriggerAttributes({ tooltipId }, { isButtonElement: as === void 0 });
25
27
  const handlePointerEnter = useCallback((e) => {
@@ -40,6 +42,8 @@ function Trigger(rawProps) {
40
42
  }, [onBlur, tooltipId]);
41
43
  return /* @__PURE__ */ jsx(Component, {
42
44
  ...attrs,
45
+ className: cls.root,
46
+ style: sls.root,
43
47
  onPointerEnter: handlePointerEnter,
44
48
  onPointerLeave: handlePointerLeave,
45
49
  onFocus: handleFocus,
@@ -48,7 +52,7 @@ function Trigger(rawProps) {
48
52
  });
49
53
  }
50
54
  function Content(rawProps) {
51
- const { as, position, fallbacks, visibility, padding, className, style, children, onPointerLeave, ...restProps } = useHuiProps("TooltipContent", rawProps);
55
+ const { as, position, fallbacks, visibility, padding, children, onPointerLeave, ...restProps } = useHuiProps("TooltipContent", rawProps);
52
56
  const Component = as ?? "div";
53
57
  const tooltipId = useTooltipId();
54
58
  const recipe = popoverRecipe({
@@ -57,8 +61,8 @@ function Content(rawProps) {
57
61
  visibility,
58
62
  padding
59
63
  });
60
- const cls = useHuiClassNames("TooltipContent", recipe, { root: className });
61
- const sls = useHuiStyles("TooltipContent", { root: style });
64
+ const cls = useHuiClassNames("TooltipContent", recipe, { root: rawProps["className"] });
65
+ const sls = useHuiStyles("TooltipContent", { root: rawProps["style"] });
62
66
  const attrs = tooltipControl.getContentAttributes({ tooltipId });
63
67
  const handlePointerLeave = useCallback((e) => {
64
68
  onPointerLeave?.(e);
@@ -77,7 +81,6 @@ const Tooltip = Object.assign(TooltipRoot, {
77
81
  Trigger,
78
82
  Content
79
83
  });
80
- //#endregion
81
84
  export { Tooltip };
82
85
 
83
86
  //# sourceMappingURL=tooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","names":[],"sources":["../../../src/components/tooltip/tooltip.tsx"],"sourcesContent":["import {\n type ButtonSlots,\n popoverRecipe,\n type PopoverSlots,\n type PopoverVariants,\n tooltipControl,\n} from \"@hebium-ui/core\";\nimport {\n type ElementType,\n type PointerEvent,\n type ReactElement,\n type ReactNode,\n useCallback,\n useId,\n useMemo,\n} from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\nimport { Button } from \"../button\";\nimport { TooltipContext, type TooltipContextValue, useTooltipId } from \"./tooltip.context\";\n\nexport interface TooltipProps {\n /**\n * The id of the tooltip content element.\n */\n id?: string | undefined;\n children?: ReactNode | undefined;\n}\n\nfunction TooltipRoot(rawProps: TooltipProps): ReactElement {\n const {\n id,\n children,\n } = useHuiProps(\"Tooltip\", rawProps);\n\n const tmpId = useId();\n const tooltipId = id || tmpId;\n\n const contextValue = useMemo<TooltipContextValue>(() => {\n return {\n tooltipId,\n };\n }, [tooltipId]);\n\n return (\n <TooltipContext.Provider\n value={contextValue}\n >\n {children}\n </TooltipContext.Provider>\n );\n}\n\nexport type TooltipTriggerProps<E extends ElementType = typeof Button> = HuiPolymorphicProps<\n E,\n {},\n ButtonSlots\n>;\n\nfunction Trigger<E extends ElementType = typeof Button>(rawProps: TooltipTriggerProps<E>): ReactNode {\n const {\n as,\n onPointerEnter,\n onPointerLeave,\n onFocus,\n onBlur,\n ...restProps\n } = useHuiProps(\"TooltipTrigger\", rawProps);\n\n const Component = as ?? Button;\n\n const tooltipId = useTooltipId();\n const attrs = tooltipControl.getTriggerAttributes(\n { tooltipId },\n { isButtonElement: as === undefined },\n );\n\n const handlePointerEnter = useCallback((e: PointerEvent<HTMLElement>): void => {\n onPointerEnter?.(e);\n tooltipControl.showTooltip(tooltipId, e.currentTarget);\n }, [onPointerEnter, tooltipId]);\n\n const handlePointerLeave = useCallback((e: PointerEvent<HTMLElement>): void => {\n onPointerLeave?.(e);\n tooltipControl.hideTooltip(tooltipId);\n }, [onPointerLeave, tooltipId]);\n\n const handleFocus = useCallback((e: React.FocusEvent<HTMLElement>): void => {\n onFocus?.(e);\n tooltipControl.showTooltip(tooltipId, e.currentTarget);\n }, [onFocus, tooltipId]);\n\n const handleBlur = useCallback((e: React.FocusEvent<HTMLElement>): void => {\n onBlur?.(e);\n tooltipControl.hideTooltip(tooltipId);\n }, [onBlur, tooltipId]);\n\n return (\n <Component\n {...attrs}\n onPointerEnter={handlePointerEnter}\n onPointerLeave={handlePointerLeave}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...restProps}\n />\n );\n}\n\ninterface TooltipContentOwnProps {\n /**\n * The preferred anchor position of the tooltip.\n *\n * @default \"block-start\"\n */\n position?: PopoverVariants[\"position\"] | undefined;\n /**\n * The fallback strategy used when the preferred position overflows.\n *\n * @default \"flip\"\n */\n fallbacks?: PopoverVariants[\"fallbacks\"] | undefined;\n /**\n * The visibility behavior when the anchor is off-screen or overflows.\n *\n * @default \"anchors-visible\"\n * @see This setting depends on browser support for {@link https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/position-visibility | MDN: position-visibility}.\n */\n visibility?: PopoverVariants[\"visibility\"] | undefined;\n /**\n * The padding size of the tooltip content.\n *\n * @default \"md\"\n */\n padding?: PopoverVariants[\"padding\"] | undefined;\n}\nexport type TooltipContentProps<E extends ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n TooltipContentOwnProps,\n PopoverSlots\n>;\n\nfunction Content<E extends ElementType = \"div\">(rawProps: TooltipContentProps<E>): ReactElement {\n const {\n as,\n position,\n fallbacks,\n visibility,\n padding,\n className,\n style,\n children,\n onPointerLeave,\n ...restProps\n } = useHuiProps(\"TooltipContent\", rawProps);\n const Component = as ?? \"div\";\n\n const tooltipId = useTooltipId();\n const recipe = popoverRecipe({ position, fallbacks, visibility, padding });\n const cls = useHuiClassNames(\"TooltipContent\", recipe, { root: className });\n const sls = useHuiStyles(\"TooltipContent\", { root: style });\n const attrs = tooltipControl.getContentAttributes({ tooltipId });\n\n const handlePointerLeave = useCallback((e: PointerEvent<HTMLElement>): void => {\n onPointerLeave?.(e);\n tooltipControl.hideTooltip(tooltipId);\n }, [onPointerLeave, tooltipId]);\n\n return (\n <Component\n {...attrs}\n className={cls.root}\n style={sls.root}\n onPointerLeave={handlePointerLeave}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\nexport const Tooltip = Object.assign(TooltipRoot, {\n Trigger,\n Content,\n});\n"],"mappings":";;;;;;;AA6BA,SAAS,YAAY,UAAsC;CACzD,MAAM,EACJ,IACA,aACE,YAAY,WAAW,QAAQ;CAEnC,MAAM,QAAQ,MAAM;CACpB,MAAM,YAAY,MAAM;CAExB,MAAM,eAAe,cAAmC;EACtD,OAAO,EACL,UACF;CACF,GAAG,CAAC,SAAS,CAAC;CAEd,OACE,oBAAC,eAAe,UAAhB;EACE,OAAO;EAEN;CACsB,CAAA;AAE7B;AAQA,SAAS,QAA+C,UAA6C;CACnG,MAAM,EACJ,IACA,gBACA,gBACA,SACA,QACA,GAAG,cACD,YAAY,kBAAkB,QAAQ;CAE1C,MAAM,YAAY,MAAM;CAExB,MAAM,YAAY,aAAa;CAC/B,MAAM,QAAQ,eAAe,qBAC3B,EAAE,UAAU,GACZ,EAAE,iBAAiB,OAAO,KAAA,EAAU,CACtC;CAEA,MAAM,qBAAqB,aAAa,MAAuC;EAC7E,iBA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AAO,aAAa;CAChD;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"tooltip.js","names":[],"sources":["../../../src/components/tooltip/tooltip.tsx"],"sourcesContent":["import {\n type ButtonSlots,\n popoverRecipe,\n type PopoverSlots,\n type PopoverVariants,\n tooltipControl,\n} from \"@hebium-ui/core\";\nimport {\n type ElementType,\n type PointerEvent,\n type ReactElement,\n type ReactNode,\n useCallback,\n useId,\n useMemo,\n} from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\nimport { Button } from \"../button\";\nimport { TooltipContext, type TooltipContextValue, useTooltipId } from \"./tooltip.context\";\n\nexport interface TooltipProps {\n /**\n * The id of the tooltip content element.\n */\n id?: string | undefined;\n children?: ReactNode | undefined;\n}\n\nfunction TooltipRoot(rawProps: TooltipProps): ReactElement {\n const {\n id,\n children,\n } = useHuiProps(\"Tooltip\", rawProps);\n\n const tmpId = useId();\n const tooltipId = id || tmpId;\n\n const contextValue = useMemo<TooltipContextValue>(() => {\n return {\n tooltipId,\n };\n }, [tooltipId]);\n\n return (\n <TooltipContext.Provider\n value={contextValue}\n >\n {children}\n </TooltipContext.Provider>\n );\n}\n\nexport type TooltipTriggerProps<E extends ElementType = typeof Button> = HuiPolymorphicProps<\n E,\n {},\n ButtonSlots\n>;\n\nfunction Trigger<E extends ElementType = typeof Button>(rawProps: TooltipTriggerProps<E>): ReactNode {\n const {\n as,\n onPointerEnter,\n onPointerLeave,\n onFocus,\n onBlur,\n ...restProps\n } = useHuiProps(\"TooltipTrigger\", rawProps);\n\n const Component = as ?? Button;\n const cls = useHuiClassNames(\"TooltipTrigger\", { root: \"\" }, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"TooltipTrigger\", { root: rawProps[\"style\"] });\n\n const tooltipId = useTooltipId();\n const attrs = tooltipControl.getTriggerAttributes(\n { tooltipId },\n { isButtonElement: as === undefined },\n );\n\n const handlePointerEnter = useCallback((e: PointerEvent<HTMLElement>): void => {\n onPointerEnter?.(e);\n tooltipControl.showTooltip(tooltipId, e.currentTarget);\n }, [onPointerEnter, tooltipId]);\n\n const handlePointerLeave = useCallback((e: PointerEvent<HTMLElement>): void => {\n onPointerLeave?.(e);\n tooltipControl.hideTooltip(tooltipId);\n }, [onPointerLeave, tooltipId]);\n\n const handleFocus = useCallback((e: React.FocusEvent<HTMLElement>): void => {\n onFocus?.(e);\n tooltipControl.showTooltip(tooltipId, e.currentTarget);\n }, [onFocus, tooltipId]);\n\n const handleBlur = useCallback((e: React.FocusEvent<HTMLElement>): void => {\n onBlur?.(e);\n tooltipControl.hideTooltip(tooltipId);\n }, [onBlur, tooltipId]);\n\n return (\n <Component\n {...attrs}\n className={cls.root}\n style={sls.root}\n onPointerEnter={handlePointerEnter}\n onPointerLeave={handlePointerLeave}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...restProps}\n />\n );\n}\n\ninterface TooltipContentOwnProps {\n /**\n * The preferred anchor position of the tooltip.\n *\n * @default \"block-start\"\n */\n position?: PopoverVariants[\"position\"] | undefined;\n /**\n * The fallback strategy used when the preferred position overflows.\n *\n * @default \"flip\"\n */\n fallbacks?: PopoverVariants[\"fallbacks\"] | undefined;\n /**\n * The visibility behavior when the anchor is off-screen or overflows.\n *\n * @default \"anchors-visible\"\n * @see This setting depends on browser support for {@link https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/position-visibility | MDN: position-visibility}.\n */\n visibility?: PopoverVariants[\"visibility\"] | undefined;\n /**\n * The padding size of the tooltip content.\n *\n * @default \"md\"\n */\n padding?: PopoverVariants[\"padding\"] | undefined;\n}\nexport type TooltipContentProps<E extends ElementType = \"div\"> = HuiPolymorphicProps<\n E,\n TooltipContentOwnProps,\n PopoverSlots\n>;\n\nfunction Content<E extends ElementType = \"div\">(rawProps: TooltipContentProps<E>): ReactElement {\n const {\n as,\n position,\n fallbacks,\n visibility,\n padding,\n children,\n onPointerLeave,\n ...restProps\n } = useHuiProps(\"TooltipContent\", rawProps);\n const Component = as ?? \"div\";\n\n const tooltipId = useTooltipId();\n const recipe = popoverRecipe({ position, fallbacks, visibility, padding });\n const cls = useHuiClassNames(\"TooltipContent\", recipe, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"TooltipContent\", { root: rawProps[\"style\"] });\n const attrs = tooltipControl.getContentAttributes({ tooltipId });\n\n const handlePointerLeave = useCallback((e: PointerEvent<HTMLElement>): void => {\n onPointerLeave?.(e);\n tooltipControl.hideTooltip(tooltipId);\n }, [onPointerLeave, tooltipId]);\n\n return (\n <Component\n {...attrs}\n className={cls.root}\n style={sls.root}\n onPointerLeave={handlePointerLeave}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\nexport const Tooltip = Object.assign(TooltipRoot, {\n Trigger,\n Content,\n});\n"],"mappings":";;;;;;;AA6BA,SAAS,YAAY,UAAsC;CACzD,MAAM,EACJ,IACA,aACE,YAAY,WAAW,QAAQ;CAEnC,MAAM,QAAQ,MAAM;CACpB,MAAM,YAAY,MAAM;CAExB,MAAM,eAAe,cAAmC;EACtD,OAAO,EACL,UACF;CACF,GAAG,CAAC,SAAS,CAAC;CAEd,OACE,oBAAC,eAAe,UAAhB;EACE,OAAO;EAEN;CACsB,CAAA;AAE7B;AAQA,SAAS,QAA+C,UAA6C;CACnG,MAAM,EACJ,IACA,gBACA,gBACA,SACA,QACA,GAAG,cACD,YAAY,kBAAkB,QAAQ;CAE1C,MAAM,YAAY,MAAM;CACxB,MAAM,MAAM,iBAAiB,kBAAkB,EAAE,MAAM,GAAG,GAAG,EAAE,MAAM,SAAS,aAAa,CAAC;CAC5F,MAAM,MAAM,aAAa,kBAAkB,EAAE,MAAM,SAAS,SAAS,CAAC;CAEtE,MAAM,YAAY,aAAa;CAC/B,MAAM,QAAQ,eAAe,qBAC3B,EAAE,UAAU,GACZ,EAAE,iBAAiB,OAAO,KAAA,EAAU,CACtC;CAEA,MAAM,qBAAqB,aAAa,MAAuC;EAC7E,iBAAiB,CAAC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AEA,MAAa,UAAU,OAAO,OAAO,aAAa;CAChD;CACA;AACF,CAAC"}
@@ -1,9 +1,7 @@
1
1
  import { HuiPolymorphicProps } from "../../types/polymorphic.js";
2
2
  import "../../types/index.js";
3
- import { ParagraphSlots } from "@hebium-ui/core";
3
+ import { VisuallyHiddenSlots } from "@hebium-ui/core";
4
4
  import { ElementType, ReactElement } from "react";
5
- //#region src/components/visually-hidden/visually-hidden.d.ts
6
- export type VisuallyHiddenProps<E extends ElementType = "span"> = HuiPolymorphicProps<E, {}, ParagraphSlots>;
5
+ export type VisuallyHiddenProps<E extends ElementType = "span"> = HuiPolymorphicProps<E, {}, VisuallyHiddenSlots>;
7
6
  export declare function VisuallyHidden<E extends ElementType = "span">(rawProps: VisuallyHiddenProps<E>): ReactElement;
8
- //#endregion
9
7
  //# sourceMappingURL=visually-hidden.d.ts.map
@@ -1,13 +1,13 @@
1
1
  import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
2
2
  import { visuallyHiddenRecipe } from "@hebium-ui/core";
3
3
  import { jsx } from "react/jsx-runtime";
4
- //#region src/components/visually-hidden/visually-hidden.tsx
4
+ // src/components/visually-hidden/visually-hidden.tsx
5
5
  function VisuallyHidden(rawProps) {
6
- const { as, className, style, children, ...restProps } = useHuiProps("VisuallyHidden", rawProps);
6
+ const { as, children, ...restProps } = useHuiProps("VisuallyHidden", rawProps);
7
7
  const Component = as ?? "span";
8
8
  const recipe = visuallyHiddenRecipe({});
9
- const cls = useHuiClassNames("VisuallyHidden", recipe, { root: className });
10
- const sls = useHuiStyles("VisuallyHidden", { root: style });
9
+ const cls = useHuiClassNames("VisuallyHidden", recipe, { root: rawProps["className"] });
10
+ const sls = useHuiStyles("VisuallyHidden", { root: rawProps["style"] });
11
11
  return /* @__PURE__ */ jsx(Component, {
12
12
  className: cls.root,
13
13
  style: sls.root,
@@ -15,7 +15,6 @@ function VisuallyHidden(rawProps) {
15
15
  children
16
16
  });
17
17
  }
18
- //#endregion
19
18
  export { VisuallyHidden };
20
19
 
21
20
  //# sourceMappingURL=visually-hidden.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"visually-hidden.js","names":[],"sources":["../../../src/components/visually-hidden/visually-hidden.tsx"],"sourcesContent":["import { type ParagraphSlots, visuallyHiddenRecipe } 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 VisuallyHiddenProps<E extends ElementType = \"span\"> = HuiPolymorphicProps<\n E,\n {},\n ParagraphSlots\n>;\n\nexport function VisuallyHidden<E extends ElementType = \"span\">(rawProps: VisuallyHiddenProps<E>): ReactElement {\n const {\n as,\n className,\n style,\n children,\n ...restProps\n } = useHuiProps(\"VisuallyHidden\", rawProps);\n\n const Component = as ?? \"span\";\n const recipe = visuallyHiddenRecipe({});\n const cls = useHuiClassNames(\"VisuallyHidden\", recipe, { root: className });\n const sls = useHuiStyles(\"VisuallyHidden\", { root: style });\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n"],"mappings":";;;;AAWA,SAAgB,eAA+C,UAAgD;CAC7G,MAAM,EACJ,IACA,WACA,OACA,UACA,GAAG,cACD,YAAY,kBAAkB,QAAQ;CAE1C,MAAM,YAAY,MAAM;CACxB,MAAM,SAAS,qBAAqB,CAAC,CAAC;CACtC,MAAM,MAAM,iBAAiB,kBAAkB,QAAQ,EAAE,MAAM,UAAU,CAAC;CAC1E,MAAM,MAAM,aAAa,kBAAkB,EAAE,MAAM,MAAM,CAAC;CAE1D,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
1
+ {"version":3,"file":"visually-hidden.js","names":[],"sources":["../../../src/components/visually-hidden/visually-hidden.tsx"],"sourcesContent":["import { visuallyHiddenRecipe, type VisuallyHiddenSlots } 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 VisuallyHiddenProps<E extends ElementType = \"span\"> = HuiPolymorphicProps<\n E,\n {},\n VisuallyHiddenSlots\n>;\n\nexport function VisuallyHidden<E extends ElementType = \"span\">(rawProps: VisuallyHiddenProps<E>): ReactElement {\n const {\n as,\n children,\n ...restProps\n } = useHuiProps(\"VisuallyHidden\", rawProps);\n\n const Component = as ?? \"span\";\n const recipe = visuallyHiddenRecipe({});\n const cls = useHuiClassNames(\"VisuallyHidden\", recipe, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"VisuallyHidden\", { 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,eAA+C,UAAgD;CAC7G,MAAM,EACJ,IACA,UACA,GAAG,cACD,YAAY,kBAAkB,QAAQ;CAE1C,MAAM,YAAY,MAAM;CACxB,MAAM,SAAS,qBAAqB,CAAC,CAAC;CACtC,MAAM,MAAM,iBAAiB,kBAAkB,QAAQ,EAAE,MAAM,SAAS,aAAa,CAAC;CACtF,MAAM,MAAM,aAAa,kBAAkB,EAAE,MAAM,SAAS,SAAS,CAAC;CAEtE,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
package/dist/index.d.ts CHANGED
@@ -27,8 +27,10 @@ import { Radiogroup, RadiogroupProps } from "./components/radiogroup/radiogroup.
27
27
  import { Section, SectionProps } from "./components/section/section.js";
28
28
  import { SegmentedControl, SegmentedControlItemProps, SegmentedControlProps } from "./components/segmented-control/segmented-control.js";
29
29
  import { Select, SelectProps } from "./components/select/select.js";
30
+ import { SkipLink, SkipLinkProps } from "./components/skip-link/skip-link.js";
30
31
  import { CaptionProps, Table, TableProps, TbodyProps, TdProps, TfootProps, ThProps, TheadProps, TrProps } from "./components/table/table.js";
31
32
  import { Tabs, TabsListProps, TabsPanelProps, TabsProps, TabsTabProps } from "./components/tabs/tabs.js";
33
+ import { Text, TextProps } from "./components/text/text.js";
32
34
  import { Textarea, TextareaProps } from "./components/textarea/textarea.js";
33
35
  import { Tooltip, TooltipContentProps, TooltipProps, TooltipTriggerProps } from "./components/tooltip/tooltip.js";
34
36
  import { useTooltipId } from "./components/tooltip/tooltip.context.js";
@@ -37,4 +39,4 @@ import "./components/index.js";
37
39
  import { HuiComponentPropsMap, HuiProviderContext, HuiProviderContextValue, useHuiClassNames, useHuiProps, useHuiProviderContext, useHuiStyles } from "./provider/hui-provider.context.js";
38
40
  import { HuiProvider } from "./provider/hui-provider.js";
39
41
  import "./provider/index.js";
40
- export { Alert, AlertProps, Anchor, AnchorProps, Avatar, AvatarProps, Blockquote, BlockquoteProps, Button, ButtonProps, CaptionProps, Checkbox, CheckboxProps, Code, CodeProps, DdProps, Details, DetailsProps, Dialog, DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps, Dl, DlProps, Drawer, DrawerCloseProps, DrawerContentProps, DrawerProps, DrawerTriggerProps, DtProps, Fieldset, FieldsetProps, Heading, HeadingProps, Hr, HrProps, HuiComponentPropsMap, HuiProvider, HuiProviderContext, HuiProviderContextValue, Input, InputProps, Label, LabelProps, Menu, MenuContentProps, MenuItemProps, MenuProps, MenuTriggerProps, Paragraph, ParagraphProps, Popover, PopoverContentProps, PopoverProps, PopoverTriggerProps, Progress, ProgressProps, Radio, RadioProps, Radiogroup, RadiogroupProps, Section, SectionProps, SegmentedControl, SegmentedControlItemProps, SegmentedControlProps, Select, SelectProps, Table, TableProps, Tabs, TabsListProps, TabsPanelProps, TabsProps, TabsTabProps, TbodyProps, TdProps, Textarea, TextareaProps, TfootProps, ThProps, TheadProps, Tooltip, TooltipContentProps, TooltipProps, TooltipTriggerProps, TrProps, VisuallyHidden, VisuallyHiddenProps, useDialogId, useDrawerId, useHuiClassNames, useHuiProps, useHuiProviderContext, useHuiStyles, useMenuId, usePopoverId, useTooltipId };
42
+ export { Alert, AlertProps, Anchor, AnchorProps, Avatar, AvatarProps, Blockquote, BlockquoteProps, Button, ButtonProps, CaptionProps, Checkbox, CheckboxProps, Code, CodeProps, DdProps, Details, DetailsProps, Dialog, DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps, Dl, DlProps, Drawer, DrawerCloseProps, DrawerContentProps, DrawerProps, DrawerTriggerProps, DtProps, Fieldset, FieldsetProps, Heading, HeadingProps, Hr, HrProps, HuiComponentPropsMap, HuiProvider, HuiProviderContext, HuiProviderContextValue, Input, InputProps, Label, LabelProps, Menu, MenuContentProps, MenuItemProps, MenuProps, MenuTriggerProps, Paragraph, ParagraphProps, Popover, PopoverContentProps, PopoverProps, PopoverTriggerProps, Progress, ProgressProps, Radio, RadioProps, Radiogroup, RadiogroupProps, Section, SectionProps, SegmentedControl, SegmentedControlItemProps, SegmentedControlProps, Select, SelectProps, SkipLink, SkipLinkProps, Table, TableProps, Tabs, TabsListProps, TabsPanelProps, TabsProps, TabsTabProps, TbodyProps, TdProps, Text, TextProps, Textarea, TextareaProps, TfootProps, ThProps, TheadProps, Tooltip, TooltipContentProps, TooltipProps, TooltipTriggerProps, TrProps, VisuallyHidden, VisuallyHiddenProps, useDialogId, useDrawerId, useHuiClassNames, useHuiProps, useHuiProviderContext, useHuiStyles, useMenuId, usePopoverId, useTooltipId };
package/dist/index.js CHANGED
@@ -29,10 +29,12 @@ import { Radiogroup } from "./components/radiogroup/radiogroup.js";
29
29
  import { Section } from "./components/section/section.js";
30
30
  import { SegmentedControl } from "./components/segmented-control/segmented-control.js";
31
31
  import { Select } from "./components/select/select.js";
32
+ import { SkipLink } from "./components/skip-link/skip-link.js";
32
33
  import { Table } from "./components/table/table.js";
33
34
  import { Tabs } from "./components/tabs/tabs.js";
35
+ import { Text } from "./components/text/text.js";
34
36
  import { Textarea } from "./components/textarea/textarea.js";
35
37
  import { useTooltipId } from "./components/tooltip/tooltip.context.js";
36
38
  import { Tooltip } from "./components/tooltip/tooltip.js";
37
39
  import { VisuallyHidden } from "./components/visually-hidden/visually-hidden.js";
38
- export { Alert, Anchor, Avatar, Blockquote, Button, Checkbox, Code, Details, Dialog, Dl, Drawer, Fieldset, Heading, Hr, HuiProvider, HuiProviderContext, Input, Label, Menu, Paragraph, Popover, Progress, Radio, Radiogroup, Section, SegmentedControl, Select, Table, Tabs, Textarea, Tooltip, VisuallyHidden, useDialogId, useDrawerId, useHuiClassNames, useHuiProps, useHuiProviderContext, useHuiStyles, useMenuId, usePopoverId, useTooltipId };
40
+ export { Alert, Anchor, Avatar, Blockquote, Button, Checkbox, Code, Details, Dialog, Dl, Drawer, Fieldset, Heading, Hr, HuiProvider, HuiProviderContext, Input, Label, Menu, Paragraph, Popover, Progress, Radio, Radiogroup, Section, SegmentedControl, Select, SkipLink, Table, Tabs, Text, Textarea, Tooltip, VisuallyHidden, useDialogId, useDrawerId, useHuiClassNames, useHuiProps, useHuiProviderContext, useHuiStyles, useMenuId, usePopoverId, useTooltipId };
@@ -23,14 +23,15 @@ import { RadiogroupProps } from "../components/radiogroup/radiogroup.js";
23
23
  import { SectionProps } from "../components/section/section.js";
24
24
  import { SegmentedControlItemProps, SegmentedControlProps } from "../components/segmented-control/segmented-control.js";
25
25
  import { SelectProps } from "../components/select/select.js";
26
+ import { SkipLinkProps } from "../components/skip-link/skip-link.js";
26
27
  import { CaptionProps, TableProps, TbodyProps, TdProps, TfootProps, ThProps, TheadProps, TrProps } from "../components/table/table.js";
27
28
  import { TabsListProps, TabsPanelProps, TabsProps, TabsTabProps } from "../components/tabs/tabs.js";
29
+ import { TextProps } from "../components/text/text.js";
28
30
  import { TextareaProps } from "../components/textarea/textarea.js";
29
31
  import { TooltipContentProps, TooltipProps, TooltipTriggerProps } from "../components/tooltip/tooltip.js";
30
32
  import { VisuallyHiddenProps } from "../components/visually-hidden/visually-hidden.js";
31
33
  import "../components/index.js";
32
- import { CSSProperties } from "react";
33
- //#region src/provider/hui-provider.context.d.ts
34
+ import { CSSProperties, ElementType } from "react";
34
35
  export interface HuiComponentPropsMap {
35
36
  Alert: Partial<AlertProps>;
36
37
  Anchor: Partial<AnchorProps>;
@@ -71,6 +72,7 @@ export interface HuiComponentPropsMap {
71
72
  Select: Partial<SelectProps>;
72
73
  SegmentedControlItem: Partial<SegmentedControlItemProps>;
73
74
  SegmentedControl: Partial<SegmentedControlProps<string>>;
75
+ SkipLink: Partial<SkipLinkProps>;
74
76
  Table: Partial<TableProps>;
75
77
  TableCaption: Partial<CaptionProps>;
76
78
  TableThead: Partial<TheadProps>;
@@ -83,6 +85,7 @@ export interface HuiComponentPropsMap {
83
85
  TabsList: Partial<TabsListProps>;
84
86
  TabsTab: Partial<TabsTabProps>;
85
87
  TabsPanel: Partial<TabsPanelProps>;
88
+ Text: Partial<TextProps>;
86
89
  Textarea: Partial<TextareaProps>;
87
90
  Tooltip: Partial<TooltipProps>;
88
91
  TooltipTrigger: Partial<TooltipTriggerProps>;
@@ -96,9 +99,14 @@ export interface HuiProviderContextValue {
96
99
  }
97
100
  export declare const HuiProviderContext: import("react").Context<HuiProviderContextValue | null>;
98
101
  export declare function useHuiProviderContext(): HuiProviderContextValue;
99
- export declare function useHuiProps<K extends HuiComponentName, P extends object>(key: K, rawProps: P): P;
102
+ declare const STYLING_PROPS: readonly ["className", "style", "classNames", "styles"];
103
+ type HuiProps<P extends object, E extends ElementType> = Omit<P, typeof STYLING_PROPS[number] | "as"> & Pick<{
104
+ as?: E | undefined;
105
+ }, "as" & keyof P>;
106
+ export declare function useHuiProps<K extends HuiComponentName, P extends object, E extends ElementType = Extract<P["as" & keyof P], ElementType>>(key: K, rawProps: P & {
107
+ as?: E | undefined;
108
+ }): HuiProps<P, E>;
100
109
  export declare function useHuiClassNames<K extends HuiComponentName, S extends string>(key: K, recipe: Record<S, string>, rawClassNames?: Partial<Record<S, string | undefined>>): Record<S, string>;
101
110
  export declare function useHuiStyles<K extends HuiComponentName, S extends string>(key: K, rawStyles?: Partial<Record<S, CSSProperties | undefined>>): Partial<Record<S, CSSProperties>>;
102
- //#endregion
103
111
  export {};
104
112
  //# sourceMappingURL=hui-provider.context.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { mergeProps } from "./merge-props.js";
2
2
  import { ccAll, msAll } from "@hebium-ui/core";
3
3
  import { createContext, useContext, useMemo } from "react";
4
- //#region src/provider/hui-provider.context.ts
4
+ // src/provider/hui-provider.context.ts
5
5
  const HuiProviderContext = createContext(null);
6
6
  function useHuiProviderContext() {
7
7
  return useContext(HuiProviderContext) ?? { defaultProps: {} };
@@ -9,11 +9,18 @@ function useHuiProviderContext() {
9
9
  function useHuiDefaultProps(key) {
10
10
  return useHuiProviderContext().defaultProps[key];
11
11
  }
12
+ const STYLING_PROPS = [
13
+ "className",
14
+ "style",
15
+ "classNames",
16
+ "styles"
17
+ ];
12
18
  function useHuiProps(key, rawProps) {
13
19
  const defaultProps = useHuiDefaultProps(key);
14
20
  return useMemo(() => {
15
- if (typeof defaultProps === "undefined") return rawProps;
16
- return mergeProps(defaultProps, rawProps);
21
+ const props = mergeProps(defaultProps ?? {}, rawProps);
22
+ for (const prop of STYLING_PROPS) delete props[prop];
23
+ return props;
17
24
  }, [defaultProps, rawProps]);
18
25
  }
19
26
  function useHuiClassNames(key, recipe, rawClassNames = {}) {
@@ -30,7 +37,6 @@ function useHuiStyles(key, rawStyles = {}) {
30
37
  else if ("style" in defaultProps && defaultProps.style) return msAll({ root: defaultProps.style }, rawStyles);
31
38
  else return rawStyles ?? {};
32
39
  }
33
- //#endregion
34
40
  export { HuiProviderContext, useHuiClassNames, useHuiProps, useHuiProviderContext, useHuiStyles };
35
41
 
36
42
  //# sourceMappingURL=hui-provider.context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hui-provider.context.js","names":[],"sources":["../../src/provider/hui-provider.context.ts"],"sourcesContent":["import { ccAll, msAll } from \"@hebium-ui/core\";\nimport { createContext, type CSSProperties, useContext, useMemo } from \"react\";\nimport type {\n AlertProps,\n AnchorProps,\n AvatarProps,\n BlockquoteProps,\n ButtonProps,\n CaptionProps,\n CheckboxProps,\n CodeProps,\n DdProps,\n DetailsProps,\n DialogCloseProps,\n DialogContentProps,\n DialogProps,\n DialogTriggerProps,\n DlProps,\n DrawerCloseProps,\n DrawerContentProps,\n DrawerProps,\n DrawerTriggerProps,\n DtProps,\n FieldsetProps,\n HeadingProps,\n HrProps,\n InputProps,\n LabelProps,\n MenuContentProps,\n MenuItemProps,\n MenuProps,\n MenuTriggerProps,\n ParagraphProps,\n PopoverContentProps,\n PopoverProps,\n PopoverTriggerProps,\n ProgressProps,\n RadiogroupProps,\n RadioProps,\n SectionProps,\n SegmentedControlItemProps,\n SegmentedControlProps,\n SelectProps,\n TableProps,\n TabsListProps,\n TabsPanelProps,\n TabsProps,\n TabsTabProps,\n TbodyProps,\n TdProps,\n TextareaProps,\n TfootProps,\n TheadProps,\n ThProps,\n TooltipContentProps,\n TooltipProps,\n TooltipTriggerProps,\n TrProps,\n VisuallyHiddenProps,\n} from \"~/components\";\nimport { mergeProps } from \"./merge-props\";\n\nexport interface HuiComponentPropsMap {\n Alert: Partial<AlertProps>;\n Anchor: Partial<AnchorProps>;\n Avatar: Partial<AvatarProps>;\n Blockquote: Partial<BlockquoteProps>;\n Button: Partial<ButtonProps>;\n Checkbox: Partial<CheckboxProps>;\n Code: Partial<CodeProps>;\n Details: Partial<DetailsProps>;\n Dialog: Partial<DialogProps>;\n DialogTrigger: Partial<DialogTriggerProps>;\n DialogContent: Partial<DialogContentProps>;\n DialogClose: Partial<DialogCloseProps>;\n Drawer: Partial<DrawerProps>;\n DrawerTrigger: Partial<DrawerTriggerProps>;\n DrawerContent: Partial<DrawerContentProps>;\n DrawerClose: Partial<DrawerCloseProps>;\n Dl: Partial<DlProps>;\n DlDt: Partial<DtProps>;\n DlDd: Partial<DdProps>;\n Fieldset: Partial<FieldsetProps>;\n Heading: Partial<HeadingProps>;\n Hr: Partial<HrProps>;\n Input: Partial<InputProps>;\n Label: Partial<LabelProps>;\n Menu: Partial<MenuProps>;\n MenuContent: Partial<MenuContentProps>;\n MenuItem: Partial<MenuItemProps>;\n MenuTrigger: Partial<MenuTriggerProps>;\n Paragraph: Partial<ParagraphProps>;\n Popover: Partial<PopoverProps>;\n PopoverTrigger: Partial<PopoverTriggerProps>;\n PopoverContent: Partial<PopoverContentProps>;\n Progress: Partial<ProgressProps>;\n Radio: Partial<RadioProps>;\n Radiogroup: Partial<RadiogroupProps>;\n Section: Partial<SectionProps>;\n Select: Partial<SelectProps>;\n SegmentedControlItem: Partial<SegmentedControlItemProps>;\n SegmentedControl: Partial<SegmentedControlProps<string>>;\n Table: Partial<TableProps>;\n TableCaption: Partial<CaptionProps>;\n TableThead: Partial<TheadProps>;\n TableTbody: Partial<TbodyProps>;\n TableTfoot: Partial<TfootProps>;\n TableTr: Partial<TrProps>;\n TableTh: Partial<ThProps>;\n TableTd: Partial<TdProps>;\n Tabs: Partial<TabsProps<string>>;\n TabsList: Partial<TabsListProps>;\n TabsTab: Partial<TabsTabProps>;\n TabsPanel: Partial<TabsPanelProps>;\n Textarea: Partial<TextareaProps>;\n Tooltip: Partial<TooltipProps>;\n TooltipTrigger: Partial<TooltipTriggerProps>;\n TooltipContent: Partial<TooltipContentProps>;\n VisuallyHidden: Partial<VisuallyHiddenProps>;\n}\n\ntype HuiComponentName = keyof HuiComponentPropsMap;\ntype HuiDefaultProps = Partial<HuiComponentPropsMap>;\n\nexport interface HuiProviderContextValue {\n defaultProps: HuiDefaultProps;\n}\n\nexport const HuiProviderContext = createContext<HuiProviderContextValue | null>(null);\n\nexport function useHuiProviderContext(): HuiProviderContextValue {\n const context = useContext(HuiProviderContext);\n return context ?? { defaultProps: {} };\n}\n\nfunction useHuiDefaultProps<K extends HuiComponentName>(key: K): HuiDefaultProps[K] {\n const ctx = useHuiProviderContext();\n return ctx.defaultProps[key];\n}\n\nexport function useHuiProps<K extends HuiComponentName, P extends object>(\n key: K,\n rawProps: P,\n): P {\n const defaultProps = useHuiDefaultProps(key);\n const props = useMemo(() => {\n if (typeof defaultProps === \"undefined\") {\n return rawProps;\n }\n\n return mergeProps(defaultProps as Partial<P>, rawProps);\n }, [defaultProps, rawProps]);\n return props as P;\n}\n\nexport function useHuiClassNames<K extends HuiComponentName, S extends string>(\n key: K,\n recipe: Record<S, string>,\n rawClassNames: Partial<Record<S, string | undefined>> = {},\n): Record<S, string> {\n const defaultProps = useHuiDefaultProps(key);\n if (!defaultProps) return ccAll(recipe, rawClassNames);\n\n if (\"classNames\" in defaultProps && defaultProps.classNames) {\n return ccAll(recipe, defaultProps.classNames as Record<S, string>, rawClassNames);\n } else if (\"className\" in defaultProps && defaultProps.className) {\n return ccAll(recipe, { root: defaultProps.className } as Record<S, string>, rawClassNames);\n } else {\n return ccAll(recipe, rawClassNames);\n }\n}\n\nexport function useHuiStyles<K extends HuiComponentName, S extends string>(\n key: K,\n rawStyles: Partial<Record<S, CSSProperties | undefined>> = {},\n): Partial<Record<S, CSSProperties>> {\n const defaultProps = useHuiDefaultProps(key);\n if (!defaultProps) return rawStyles ?? {};\n\n if (\"styles\" in defaultProps && defaultProps.styles) {\n return msAll(defaultProps.styles as Partial<Record<S, CSSProperties>>, rawStyles);\n } else if (\"style\" in defaultProps && defaultProps.style) {\n return msAll({ root: defaultProps.style } as Partial<Record<S, CSSProperties>>, rawStyles);\n } else {\n return rawStyles ?? {};\n }\n}\n"],"mappings":";;;;AAgIA,MAAa,qBAAqB,cAA8C,IAAI;AAEpF,SAAgB,wBAAiD;CAE/D,OADgB,WAAW,kBACd,KAAK,EAAE,cAAc,CAAC,EAAE;AACvC;AAEA,SAAS,mBAA+C,KAA4B;CAElF,OADY,sBACH,CAAC,CAAC,aAAa;AAC1B;AAEA,SAAgB,YACd,KACA,UACG;CACH,MAAM,eAAe,mBAAmB,GAAG;CAQ3C,OAPc,cAAc;EAC1B,IAAI,OAAO,iBAAiB,aAC1B,OAAO;EAGT,OAAO,WAAW,cAA4B,QAAQ;CACxD,GAAG,CAAC,cAAc,QAAQ,CACf;AACb;AAEA,SAAgB,iBACd,KACA,QACA,gBAAwD,CAAC,GACtC;CACnB,MAAM,eAAe,mBAAmB,GAAG;CAC3C,IAAI,CAAC,cAAc,OAAO,MAAM,QAAQ,aAAa;CAErD,IAAI,gBAAgB,gBAAgB,aAAa,YAC/C,OAAO,MAAM,QAAQ,aAAa,YAAiC,aAAa;MAC3E,IAAI,eAAe,gBAAgB,aAAa,WACrD,OAAO,MAAM,QAAQ,EAAE,MAAM,aAAa,UAAU,GAAwB,aAAa;MAEzF,OAAO,MAAM,QAAQ,aAAa;AAEtC;AAEA,SAAgB,aACd,KACA,YAA2D,CAAC,GACzB;CACnC,MAAM,eAAe,mBAAmB,GAAG;CAC3C,IAAI,CAAC,cAAc,OAAO,aAAa,CAAC;CAExC,IAAI,YAAY,gBAAgB,aAAa,QAC3C,OAAO,MAAM,aAAa,QAA6C,SAAS;MAC3E,IAAI,WAAW,gBAAgB,aAAa,OACjD,OAAO,MAAM,EAAE,MAAM,aAAa,MAAM,GAAwC,SAAS;MAEzF,OAAO,aAAa,CAAC;AAEzB"}
1
+ {"version":3,"file":"hui-provider.context.js","names":[],"sources":["../../src/provider/hui-provider.context.ts"],"sourcesContent":["import { ccAll, msAll } from \"@hebium-ui/core\";\nimport { createContext, type CSSProperties, type ElementType, useContext, useMemo } from \"react\";\nimport type {\n AlertProps,\n AnchorProps,\n AvatarProps,\n BlockquoteProps,\n ButtonProps,\n CaptionProps,\n CheckboxProps,\n CodeProps,\n DdProps,\n DetailsProps,\n DialogCloseProps,\n DialogContentProps,\n DialogProps,\n DialogTriggerProps,\n DlProps,\n DrawerCloseProps,\n DrawerContentProps,\n DrawerProps,\n DrawerTriggerProps,\n DtProps,\n FieldsetProps,\n HeadingProps,\n HrProps,\n InputProps,\n LabelProps,\n MenuContentProps,\n MenuItemProps,\n MenuProps,\n MenuTriggerProps,\n ParagraphProps,\n PopoverContentProps,\n PopoverProps,\n PopoverTriggerProps,\n ProgressProps,\n RadiogroupProps,\n RadioProps,\n SectionProps,\n SegmentedControlItemProps,\n SegmentedControlProps,\n SelectProps,\n SkipLinkProps,\n TableProps,\n TabsListProps,\n TabsPanelProps,\n TabsProps,\n TabsTabProps,\n TbodyProps,\n TdProps,\n TextareaProps,\n TextProps,\n TfootProps,\n TheadProps,\n ThProps,\n TooltipContentProps,\n TooltipProps,\n TooltipTriggerProps,\n TrProps,\n VisuallyHiddenProps,\n} from \"~/components\";\nimport { mergeProps } from \"./merge-props\";\n\nexport interface HuiComponentPropsMap {\n Alert: Partial<AlertProps>;\n Anchor: Partial<AnchorProps>;\n Avatar: Partial<AvatarProps>;\n Blockquote: Partial<BlockquoteProps>;\n Button: Partial<ButtonProps>;\n Checkbox: Partial<CheckboxProps>;\n Code: Partial<CodeProps>;\n Details: Partial<DetailsProps>;\n Dialog: Partial<DialogProps>;\n DialogTrigger: Partial<DialogTriggerProps>;\n DialogContent: Partial<DialogContentProps>;\n DialogClose: Partial<DialogCloseProps>;\n Drawer: Partial<DrawerProps>;\n DrawerTrigger: Partial<DrawerTriggerProps>;\n DrawerContent: Partial<DrawerContentProps>;\n DrawerClose: Partial<DrawerCloseProps>;\n Dl: Partial<DlProps>;\n DlDt: Partial<DtProps>;\n DlDd: Partial<DdProps>;\n Fieldset: Partial<FieldsetProps>;\n Heading: Partial<HeadingProps>;\n Hr: Partial<HrProps>;\n Input: Partial<InputProps>;\n Label: Partial<LabelProps>;\n Menu: Partial<MenuProps>;\n MenuContent: Partial<MenuContentProps>;\n MenuItem: Partial<MenuItemProps>;\n MenuTrigger: Partial<MenuTriggerProps>;\n Paragraph: Partial<ParagraphProps>;\n Popover: Partial<PopoverProps>;\n PopoverTrigger: Partial<PopoverTriggerProps>;\n PopoverContent: Partial<PopoverContentProps>;\n Progress: Partial<ProgressProps>;\n Radio: Partial<RadioProps>;\n Radiogroup: Partial<RadiogroupProps>;\n Section: Partial<SectionProps>;\n Select: Partial<SelectProps>;\n SegmentedControlItem: Partial<SegmentedControlItemProps>;\n SegmentedControl: Partial<SegmentedControlProps<string>>;\n SkipLink: Partial<SkipLinkProps>;\n Table: Partial<TableProps>;\n TableCaption: Partial<CaptionProps>;\n TableThead: Partial<TheadProps>;\n TableTbody: Partial<TbodyProps>;\n TableTfoot: Partial<TfootProps>;\n TableTr: Partial<TrProps>;\n TableTh: Partial<ThProps>;\n TableTd: Partial<TdProps>;\n Tabs: Partial<TabsProps<string>>;\n TabsList: Partial<TabsListProps>;\n TabsTab: Partial<TabsTabProps>;\n TabsPanel: Partial<TabsPanelProps>;\n Text: Partial<TextProps>;\n Textarea: Partial<TextareaProps>;\n Tooltip: Partial<TooltipProps>;\n TooltipTrigger: Partial<TooltipTriggerProps>;\n TooltipContent: Partial<TooltipContentProps>;\n VisuallyHidden: Partial<VisuallyHiddenProps>;\n}\n\ntype HuiComponentName = keyof HuiComponentPropsMap;\ntype HuiDefaultProps = Partial<HuiComponentPropsMap>;\n\nexport interface HuiProviderContextValue {\n defaultProps: HuiDefaultProps;\n}\n\nexport const HuiProviderContext = createContext<HuiProviderContextValue | null>(null);\n\nexport function useHuiProviderContext(): HuiProviderContextValue {\n const context = useContext(HuiProviderContext);\n return context ?? { defaultProps: {} };\n}\n\nfunction useHuiDefaultProps<K extends HuiComponentName>(key: K): HuiDefaultProps[K] {\n const ctx = useHuiProviderContext();\n return ctx.defaultProps[key];\n}\n\nconst STYLING_PROPS = [\"className\", \"style\", \"classNames\", \"styles\"] as const;\n\n// Keep `as` explicit so JSX element inference survives omission of generic props.\ntype HuiProps<P extends object, E extends ElementType> =\n & Omit<P, typeof STYLING_PROPS[number] | \"as\">\n & Pick<{ as?: E | undefined }, \"as\" & keyof P>;\n\nexport function useHuiProps<\n K extends HuiComponentName,\n P extends object,\n E extends ElementType = Extract<P[\"as\" & keyof P], ElementType>,\n>(\n key: K,\n rawProps: P & { as?: E | undefined },\n): HuiProps<P, E> {\n const defaultProps = useHuiDefaultProps(key);\n return useMemo(() => {\n const props = mergeProps((defaultProps ?? {}) as Partial<P>, rawProps);\n // Styling helpers resolve Provider and local values separately from rawProps.\n for (const prop of STYLING_PROPS) {\n delete props[prop as keyof P];\n }\n return props as HuiProps<P, E>;\n }, [defaultProps, rawProps]);\n}\n\nexport function useHuiClassNames<K extends HuiComponentName, S extends string>(\n key: K,\n recipe: Record<S, string>,\n rawClassNames: Partial<Record<S, string | undefined>> = {},\n): Record<S, string> {\n const defaultProps = useHuiDefaultProps(key);\n if (!defaultProps) return ccAll(recipe, rawClassNames);\n\n if (\"classNames\" in defaultProps && defaultProps.classNames) {\n return ccAll(recipe, defaultProps.classNames as Record<S, string>, rawClassNames);\n } else if (\"className\" in defaultProps && defaultProps.className) {\n return ccAll(recipe, { root: defaultProps.className } as Record<S, string>, rawClassNames);\n } else {\n return ccAll(recipe, rawClassNames);\n }\n}\n\nexport function useHuiStyles<K extends HuiComponentName, S extends string>(\n key: K,\n rawStyles: Partial<Record<S, CSSProperties | undefined>> = {},\n): Partial<Record<S, CSSProperties>> {\n const defaultProps = useHuiDefaultProps(key);\n if (!defaultProps) return rawStyles ?? {};\n\n if (\"styles\" in defaultProps && defaultProps.styles) {\n return msAll(defaultProps.styles as Partial<Record<S, CSSProperties>>, rawStyles);\n } else if (\"style\" in defaultProps && defaultProps.style) {\n return msAll({ root: defaultProps.style } as Partial<Record<S, CSSProperties>>, rawStyles);\n } else {\n return rawStyles ?? {};\n }\n}\n"],"mappings":";;;;AAoIA,MAAa,qBAAqB,cAA8C,IAAI;AAEpF,SAAgB,wBAAiD;CAE/D,OADgB,WAAW,kBACd,KAAK,EAAE,cAAc,CAAC,EAAE;AACvC;AAEA,SAAS,mBAA+C,KAA4B;CAElF,OADY,sBACH,CAAC,CAAC,aAAa;AAC1B;AAEA,MAAM,gBAAgB;CAAC;CAAa;CAAS;CAAc;AAAQ;AAOnE,SAAgB,YAKd,KACA,UACgB;CAChB,MAAM,eAAe,mBAAmB,GAAG;CAC3C,OAAO,cAAc;EACnB,MAAM,QAAQ,WAAY,gBAAgB,CAAC,GAAkB,QAAQ;EAErE,KAAK,MAAM,QAAQ,eACjB,OAAO,MAAM;EAEf,OAAO;CACT,GAAG,CAAC,cAAc,QAAQ,CAAC;AAC7B;AAEA,SAAgB,iBACd,KACA,QACA,gBAAwD,CAAC,GACtC;CACnB,MAAM,eAAe,mBAAmB,GAAG;CAC3C,IAAI,CAAC,cAAc,OAAO,MAAM,QAAQ,aAAa;CAErD,IAAI,gBAAgB,gBAAgB,aAAa,YAC/C,OAAO,MAAM,QAAQ,aAAa,YAAiC,aAAa;MAC3E,IAAI,eAAe,gBAAgB,aAAa,WACrD,OAAO,MAAM,QAAQ,EAAE,MAAM,aAAa,UAAU,GAAwB,aAAa;MAEzF,OAAO,MAAM,QAAQ,aAAa;AAEtC;AAEA,SAAgB,aACd,KACA,YAA2D,CAAC,GACzB;CACnC,MAAM,eAAe,mBAAmB,GAAG;CAC3C,IAAI,CAAC,cAAc,OAAO,aAAa,CAAC;CAExC,IAAI,YAAY,gBAAgB,aAAa,QAC3C,OAAO,MAAM,aAAa,QAA6C,SAAS;MAC3E,IAAI,WAAW,gBAAgB,aAAa,OACjD,OAAO,MAAM,EAAE,MAAM,aAAa,MAAM,GAAwC,SAAS;MAEzF,OAAO,aAAa,CAAC;AAEzB"}
@@ -1,8 +1,6 @@
1
1
  import { HuiProviderContextValue } from "./hui-provider.context.js";
2
2
  import { PropsWithChildren, ReactElement } from "react";
3
- //#region src/provider/hui-provider.d.ts
4
3
  interface HuiProviderProps extends Partial<HuiProviderContextValue>, PropsWithChildren {}
5
4
  export declare function HuiProvider({ defaultProps, children }: HuiProviderProps): ReactElement;
6
- //#endregion
7
5
  export {};
8
6
  //# sourceMappingURL=hui-provider.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { HuiProviderContext } from "./hui-provider.context.js";
2
2
  import { useMemo } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
- //#region src/provider/hui-provider.tsx
4
+ // src/provider/hui-provider.tsx
5
5
  function HuiProvider({ defaultProps, children }) {
6
6
  const context = useMemo(() => {
7
7
  return { defaultProps: defaultProps ?? {} };
@@ -11,7 +11,6 @@ function HuiProvider({ defaultProps, children }) {
11
11
  children
12
12
  });
13
13
  }
14
- //#endregion
15
14
  export { HuiProvider };
16
15
 
17
16
  //# sourceMappingURL=hui-provider.js.map
@@ -1,4 +1,4 @@
1
- //#region src/provider/merge-props.ts
1
+ // src/provider/merge-props.ts
2
2
  function mergeProps(defaultProps, rawProps) {
3
3
  const filteredProps = {};
4
4
  for (const key of Object.keys(rawProps)) {
@@ -10,7 +10,6 @@ function mergeProps(defaultProps, rawProps) {
10
10
  ...filteredProps
11
11
  };
12
12
  }
13
- //#endregion
14
13
  export { mergeProps };
15
14
 
16
15
  //# sourceMappingURL=merge-props.js.map
@@ -1,8 +1,6 @@
1
1
  import { CSSProperties } from "react";
2
- //#region src/types/hui-component.d.ts
3
2
  export type HuiComponentProps<Props extends object, Slots extends string> = [Slots] extends ["root"] ? Props : Omit<Props, "className" | "style"> & {
4
3
  classNames?: Partial<Record<Slots, string>> | undefined;
5
4
  styles?: Partial<Record<Slots, CSSProperties>> | undefined;
6
5
  };
7
- //#endregion
8
6
  //# sourceMappingURL=hui-component.d.ts.map
@@ -1,5 +1,4 @@
1
1
  import { CSSProperties, ComponentProps, ElementType } from "react";
2
- //#region src/types/polymorphic.d.ts
3
2
  export type PolymorphicComponentProps<E extends ElementType, OwnProps extends object> = OwnProps & {
4
3
  as?: E | undefined;
5
4
  } & Omit<ComponentProps<E>, keyof OwnProps | "as" | "className" | "style">;
@@ -9,5 +8,4 @@ export type HuiPolymorphicProps<E extends ElementType, OwnProps extends object,
9
8
  classNames?: Partial<Record<Slots, string | undefined>> | undefined;
10
9
  styles?: Partial<Record<Slots, CSSProperties | undefined>> | undefined;
11
10
  }>;
12
- //#endregion
13
11
  //# sourceMappingURL=polymorphic.d.ts.map
@@ -1,4 +1,4 @@
1
- //#region src/utils/attributes/normalize-attributes.ts
1
+ // src/utils/attributes/normalize-attributes.ts
2
2
  const reactAttributeNames = {
3
3
  for: "htmlFor",
4
4
  popovertarget: "popoverTarget",
@@ -12,7 +12,6 @@ function normalizeAttributes(attributes) {
12
12
  }
13
13
  return normalized;
14
14
  }
15
- //#endregion
16
15
  export { normalizeAttributes };
17
16
 
18
17
  //# sourceMappingURL=normalize-attributes.js.map