@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.
- package/dist/components/alert/alert.d.ts +0 -2
- package/dist/components/alert/alert.js +4 -5
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/anchor/anchor.d.ts +0 -2
- package/dist/components/anchor/anchor.js +4 -5
- package/dist/components/anchor/anchor.js.map +1 -1
- package/dist/components/avatar/avatar.d.ts +0 -2
- package/dist/components/avatar/avatar.js +4 -5
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/blockquote/blockquote.d.ts +0 -2
- package/dist/components/blockquote/blockquote.js +4 -5
- package/dist/components/blockquote/blockquote.js.map +1 -1
- package/dist/components/button/button.d.ts +0 -2
- package/dist/components/button/button.js +4 -5
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/checkbox/checkbox.d.ts +1 -3
- package/dist/components/checkbox/checkbox.js +29 -16
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/code/code.d.ts +0 -2
- package/dist/components/code/code.js +4 -5
- package/dist/components/code/code.js.map +1 -1
- package/dist/components/details/details.d.ts +0 -2
- package/dist/components/details/details.js +4 -5
- package/dist/components/details/details.js.map +1 -1
- package/dist/components/dialog/dialog.context.d.ts +0 -2
- package/dist/components/dialog/dialog.context.js +1 -2
- package/dist/components/dialog/dialog.d.ts +0 -2
- package/dist/components/dialog/dialog.js +13 -6
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/dl/dl.d.ts +0 -2
- package/dist/components/dl/dl.js +10 -11
- package/dist/components/dl/dl.js.map +1 -1
- package/dist/components/drawer/drawer.context.d.ts +0 -2
- package/dist/components/drawer/drawer.context.js +1 -2
- package/dist/components/drawer/drawer.d.ts +0 -2
- package/dist/components/drawer/drawer.js +13 -6
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/fieldset/fieldset.d.ts +0 -2
- package/dist/components/fieldset/fieldset.js +4 -5
- package/dist/components/fieldset/fieldset.js.map +1 -1
- package/dist/components/heading/heading.d.ts +0 -2
- package/dist/components/heading/heading.js +4 -5
- package/dist/components/heading/heading.js.map +1 -1
- package/dist/components/hr/hr.d.ts +0 -2
- package/dist/components/hr/hr.js +4 -5
- package/dist/components/hr/hr.js.map +1 -1
- package/dist/components/index.d.ts +5 -1
- package/dist/components/input/input.d.ts +0 -2
- package/dist/components/input/input.js +4 -5
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/label/label.d.ts +0 -2
- package/dist/components/label/label.js +4 -5
- package/dist/components/label/label.js.map +1 -1
- package/dist/components/menu/menu.context.d.ts +0 -2
- package/dist/components/menu/menu.context.js +1 -2
- package/dist/components/menu/menu.d.ts +0 -2
- package/dist/components/menu/menu.js +11 -8
- package/dist/components/menu/menu.js.map +1 -1
- package/dist/components/paragraph/paragraph.d.ts +6 -2
- package/dist/components/paragraph/paragraph.js +8 -6
- package/dist/components/paragraph/paragraph.js.map +1 -1
- package/dist/components/popover/popover.context.d.ts +0 -2
- package/dist/components/popover/popover.context.js +1 -2
- package/dist/components/popover/popover.d.ts +0 -2
- package/dist/components/popover/popover.js +8 -5
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/progress/progress.d.ts +0 -2
- package/dist/components/progress/progress.js +4 -5
- package/dist/components/progress/progress.js.map +1 -1
- package/dist/components/radio/radio.d.ts +0 -2
- package/dist/components/radio/radio.js +4 -5
- package/dist/components/radio/radio.js.map +1 -1
- package/dist/components/radiogroup/radiogroup.d.ts +0 -2
- package/dist/components/radiogroup/radiogroup.js +4 -5
- package/dist/components/radiogroup/radiogroup.js.map +1 -1
- package/dist/components/section/section.d.ts +0 -2
- package/dist/components/section/section.js +4 -5
- package/dist/components/section/section.js.map +1 -1
- package/dist/components/segmented-control/segmented-control.context.js +1 -2
- package/dist/components/segmented-control/segmented-control.d.ts +1 -3
- package/dist/components/segmented-control/segmented-control.js +7 -8
- package/dist/components/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/select/select.d.ts +0 -2
- package/dist/components/select/select.js +4 -5
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/skip-link/index.d.ts +2 -0
- package/dist/components/skip-link/skip-link.d.ts +7 -0
- package/dist/components/skip-link/skip-link.js +20 -0
- package/dist/components/skip-link/skip-link.js.map +1 -0
- package/dist/components/table/table.d.ts +0 -2
- package/dist/components/table/table.js +25 -26
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/tabs/tabs.context.d.ts +0 -2
- package/dist/components/tabs/tabs.context.js +1 -2
- package/dist/components/tabs/tabs.d.ts +1 -3
- package/dist/components/tabs/tabs.js +13 -14
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/text/index.d.ts +2 -0
- package/dist/components/text/text.d.ts +23 -0
- package/dist/components/text/text.js +23 -0
- package/dist/components/text/text.js.map +1 -0
- package/dist/components/textarea/textarea.d.ts +0 -2
- package/dist/components/textarea/textarea.js +4 -5
- package/dist/components/textarea/textarea.js.map +1 -1
- package/dist/components/tooltip/tooltip.context.d.ts +0 -2
- package/dist/components/tooltip/tooltip.context.js +1 -2
- package/dist/components/tooltip/tooltip.d.ts +0 -2
- package/dist/components/tooltip/tooltip.js +8 -5
- package/dist/components/tooltip/tooltip.js.map +1 -1
- package/dist/components/visually-hidden/visually-hidden.d.ts +2 -4
- package/dist/components/visually-hidden/visually-hidden.js +4 -5
- package/dist/components/visually-hidden/visually-hidden.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/provider/hui-provider.context.d.ts +12 -4
- package/dist/provider/hui-provider.context.js +10 -4
- package/dist/provider/hui-provider.context.js.map +1 -1
- package/dist/provider/hui-provider.d.ts +0 -2
- package/dist/provider/hui-provider.js +1 -2
- package/dist/provider/merge-props.js +1 -2
- package/dist/types/hui-component.d.ts +0 -2
- package/dist/types/polymorphic.d.ts +0 -2
- package/dist/utils/attributes/normalize-attributes.js +1 -2
- package/package.json +9 -9
|
@@ -6,7 +6,7 @@ import { DialogContext, useDialogContext, useDialogId } from "./dialog.context.j
|
|
|
6
6
|
import { dialogControl, dialogRecipe, toStrbool } from "@hebium-ui/core";
|
|
7
7
|
import { useCallback, useId, useMemo } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
|
|
9
|
+
// src/components/dialog/dialog.tsx
|
|
10
10
|
function DialogRoot(rawProps) {
|
|
11
11
|
const { id, modal = false, children } = useHuiProps("Dialog", rawProps);
|
|
12
12
|
const tmpId = useId();
|
|
@@ -31,6 +31,8 @@ function DialogRoot(rawProps) {
|
|
|
31
31
|
function Trigger(rawProps) {
|
|
32
32
|
const { as, children, onClick, ...restProps } = useHuiProps("DialogTrigger", rawProps);
|
|
33
33
|
const Component = as ?? Button;
|
|
34
|
+
const cls = useHuiClassNames("DialogTrigger", { root: "" }, { root: rawProps["className"] });
|
|
35
|
+
const sls = useHuiStyles("DialogTrigger", { root: rawProps["style"] });
|
|
34
36
|
const { dialogId, modal, open } = useDialogContext();
|
|
35
37
|
const attrs = normalizeAttributes(dialogControl.getTriggerAttributes({ id: dialogId }, {
|
|
36
38
|
modal,
|
|
@@ -47,13 +49,15 @@ function Trigger(rawProps) {
|
|
|
47
49
|
]);
|
|
48
50
|
return /* @__PURE__ */ jsx(Component, {
|
|
49
51
|
...attrs,
|
|
52
|
+
className: cls.root,
|
|
53
|
+
style: sls.root,
|
|
50
54
|
onClick: handleClick,
|
|
51
55
|
...restProps,
|
|
52
56
|
children
|
|
53
57
|
});
|
|
54
58
|
}
|
|
55
59
|
function Content(rawProps) {
|
|
56
|
-
const {
|
|
60
|
+
const { children, heading, headingProps, closeButton, closeButtonProps, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...restProps } = useHuiProps("DialogContent", rawProps);
|
|
57
61
|
const { dialogId, modal } = useDialogContext();
|
|
58
62
|
const resolvedHeading = heading !== void 0 && heading !== null && heading !== false ? heading : void 0;
|
|
59
63
|
const state = { id: dialogId };
|
|
@@ -66,8 +70,8 @@ function Content(rawProps) {
|
|
|
66
70
|
const headingId = resolvedHeading !== void 0 ? headingAttrs.id : void 0;
|
|
67
71
|
const headingLevel = headingProps?.level ?? 2;
|
|
68
72
|
const recipe = dialogRecipe({ modal: toStrbool(modal) });
|
|
69
|
-
const cls = useHuiClassNames("DialogContent", recipe, classNames);
|
|
70
|
-
const sls = useHuiStyles("DialogContent", styles);
|
|
73
|
+
const cls = useHuiClassNames("DialogContent", recipe, rawProps.classNames);
|
|
74
|
+
const sls = useHuiStyles("DialogContent", rawProps.styles);
|
|
71
75
|
const shouldRenderCloseButton = closeButton !== null && closeButton !== false;
|
|
72
76
|
const shouldRenderHeader = headingId !== void 0 || shouldRenderCloseButton;
|
|
73
77
|
const closeButtonContent = closeButton === void 0 ? /* @__PURE__ */ jsx("span", {
|
|
@@ -106,11 +110,15 @@ function Content(rawProps) {
|
|
|
106
110
|
}
|
|
107
111
|
function Close(rawProps) {
|
|
108
112
|
const props = useHuiProps("DialogClose", rawProps);
|
|
113
|
+
const cls = useHuiClassNames("DialogClose", { root: "" }, { root: rawProps.className });
|
|
114
|
+
const sls = useHuiStyles("DialogClose", { root: rawProps.style });
|
|
109
115
|
const dialogId = useDialogId();
|
|
110
116
|
const attrs = normalizeAttributes(dialogControl.getCloseAttributes({ id: dialogId }));
|
|
111
117
|
return /* @__PURE__ */ jsx(Button, {
|
|
112
118
|
...attrs,
|
|
113
|
-
...props
|
|
119
|
+
...props,
|
|
120
|
+
className: cls.root,
|
|
121
|
+
style: sls.root
|
|
114
122
|
});
|
|
115
123
|
}
|
|
116
124
|
const Dialog = Object.assign(DialogRoot, {
|
|
@@ -118,7 +126,6 @@ const Dialog = Object.assign(DialogRoot, {
|
|
|
118
126
|
Content,
|
|
119
127
|
Close
|
|
120
128
|
});
|
|
121
|
-
//#endregion
|
|
122
129
|
export { Dialog };
|
|
123
130
|
|
|
124
131
|
//# sourceMappingURL=dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","names":[],"sources":["../../../src/components/dialog/dialog.tsx"],"sourcesContent":["import { type ButtonSlots, dialogControl, dialogRecipe, type DialogSlots, toStrbool } from \"@hebium-ui/core\";\nimport {\n type ComponentProps,\n type ElementType,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n useCallback,\n useId,\n useMemo,\n} from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { Heading, type HeadingProps } from \"../heading\";\nimport { DialogContext, type DialogContextValue, useDialogContext, useDialogId } from \"./dialog.context\";\n\nexport interface DialogProps {\n /**\n * The id of the dialog content element.\n */\n id?: string | undefined;\n /**\n * Whether the dialog should open as a modal dialog.\n *\n * @default false\n */\n modal?: boolean | undefined;\n children?: ReactNode | undefined;\n}\n\nfunction DialogRoot(rawProps: DialogProps): ReactElement {\n const {\n id,\n modal = false,\n children,\n } = useHuiProps(\"Dialog\", rawProps);\n\n const tmpId = useId();\n const dialogId = id || tmpId;\n const open = useCallback((): void => {\n dialogControl.openDialog(dialogId, modal);\n }, [dialogId, modal]);\n\n const contextValue = useMemo<DialogContextValue>(() => ({\n dialogId,\n modal,\n open,\n }), [dialogId, modal, open]);\n\n return (\n <DialogContext.Provider value={contextValue}>\n {children}\n </DialogContext.Provider>\n );\n}\n\nexport type DialogTriggerProps<E extends ElementType = typeof Button> = HuiPolymorphicProps<\n E,\n {},\n ButtonSlots\n>;\n\nfunction Trigger<E extends ElementType = typeof Button>(rawProps: DialogTriggerProps<E>): ReactNode {\n const {\n as,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"DialogTrigger\", rawProps);\n\n const Component = as ?? Button;\n const {\n dialogId,\n modal,\n open,\n } = useDialogContext();\n const attrs = normalizeAttributes(\n dialogControl.getTriggerAttributes(\n { id: dialogId },\n {\n modal,\n isButtonElement: as === undefined,\n },\n ),\n );\n\n const handleClick = useCallback((e: MouseEvent<HTMLElement>): void => {\n onClick?.(e);\n if (modal || e.defaultPrevented) return;\n\n open();\n }, [modal, onClick, open]);\n\n return (\n <Component\n {...attrs}\n onClick={handleClick}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ntype HtmlDialogProps = Omit<ComponentProps<\"dialog\">, \"children\" | \"id\" | \"open\">;\n\ninterface DialogContentOwnProps extends HtmlDialogProps {\n /**\n * The heading rendered at the top of the dialog content.\n */\n heading?: ReactNode | undefined;\n /**\n * Additional props passed to the internal heading component.\n */\n headingProps?: Omit<HeadingProps, \"children\" | \"id\" | \"className\" | \"style\"> | undefined;\n /**\n * The content rendered inside the internal close button. Set to `null` or `false` to hide the button.\n *\n * @default close icon\n */\n closeButton?: ReactNode | undefined;\n /**\n * Additional props passed to the internal close button.\n */\n closeButtonProps?: Omit<DialogCloseProps, \"children\" | \"className\" | \"style\"> | undefined;\n children?: ReactNode | undefined;\n}\nexport type DialogContentProps = HuiComponentProps<DialogContentOwnProps, DialogSlots>;\n\nfunction Content(rawProps: DialogContentProps): ReactElement {\n const {\n
|
|
1
|
+
{"version":3,"file":"dialog.js","names":[],"sources":["../../../src/components/dialog/dialog.tsx"],"sourcesContent":["import { type ButtonSlots, dialogControl, dialogRecipe, type DialogSlots, toStrbool } from \"@hebium-ui/core\";\nimport {\n type ComponentProps,\n type ElementType,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n useCallback,\n useId,\n useMemo,\n} from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { Heading, type HeadingProps } from \"../heading\";\nimport { DialogContext, type DialogContextValue, useDialogContext, useDialogId } from \"./dialog.context\";\n\nexport interface DialogProps {\n /**\n * The id of the dialog content element.\n */\n id?: string | undefined;\n /**\n * Whether the dialog should open as a modal dialog.\n *\n * @default false\n */\n modal?: boolean | undefined;\n children?: ReactNode | undefined;\n}\n\nfunction DialogRoot(rawProps: DialogProps): ReactElement {\n const {\n id,\n modal = false,\n children,\n } = useHuiProps(\"Dialog\", rawProps);\n\n const tmpId = useId();\n const dialogId = id || tmpId;\n const open = useCallback((): void => {\n dialogControl.openDialog(dialogId, modal);\n }, [dialogId, modal]);\n\n const contextValue = useMemo<DialogContextValue>(() => ({\n dialogId,\n modal,\n open,\n }), [dialogId, modal, open]);\n\n return (\n <DialogContext.Provider value={contextValue}>\n {children}\n </DialogContext.Provider>\n );\n}\n\nexport type DialogTriggerProps<E extends ElementType = typeof Button> = HuiPolymorphicProps<\n E,\n {},\n ButtonSlots\n>;\n\nfunction Trigger<E extends ElementType = typeof Button>(rawProps: DialogTriggerProps<E>): ReactNode {\n const {\n as,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"DialogTrigger\", rawProps);\n\n const Component = as ?? Button;\n const cls = useHuiClassNames(\"DialogTrigger\", { root: \"\" }, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"DialogTrigger\", { root: rawProps[\"style\"] });\n const {\n dialogId,\n modal,\n open,\n } = useDialogContext();\n const attrs = normalizeAttributes(\n dialogControl.getTriggerAttributes(\n { id: dialogId },\n {\n modal,\n isButtonElement: as === undefined,\n },\n ),\n );\n\n const handleClick = useCallback((e: MouseEvent<HTMLElement>): void => {\n onClick?.(e);\n if (modal || e.defaultPrevented) return;\n\n open();\n }, [modal, onClick, open]);\n\n return (\n <Component\n {...attrs}\n className={cls.root}\n style={sls.root}\n onClick={handleClick}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ntype HtmlDialogProps = Omit<ComponentProps<\"dialog\">, \"children\" | \"id\" | \"open\">;\n\ninterface DialogContentOwnProps extends HtmlDialogProps {\n /**\n * The heading rendered at the top of the dialog content.\n */\n heading?: ReactNode | undefined;\n /**\n * Additional props passed to the internal heading component.\n */\n headingProps?: Omit<HeadingProps, \"children\" | \"id\" | \"className\" | \"style\"> | undefined;\n /**\n * The content rendered inside the internal close button. Set to `null` or `false` to hide the button.\n *\n * @default close icon\n */\n closeButton?: ReactNode | undefined;\n /**\n * Additional props passed to the internal close button.\n */\n closeButtonProps?: Omit<DialogCloseProps, \"children\" | \"className\" | \"style\"> | undefined;\n children?: ReactNode | undefined;\n}\nexport type DialogContentProps = HuiComponentProps<DialogContentOwnProps, DialogSlots>;\n\nfunction Content(rawProps: DialogContentProps): ReactElement {\n const {\n children,\n heading,\n headingProps,\n closeButton,\n closeButtonProps,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...restProps\n } = useHuiProps(\"DialogContent\", rawProps);\n\n const {\n dialogId,\n modal,\n } = useDialogContext();\n\n const resolvedHeading = heading !== undefined && heading !== null && heading !== false\n ? heading\n : undefined;\n const state = { id: dialogId };\n const attrs = normalizeAttributes(\n dialogControl.getContentAttributes(\n state,\n {\n hasHeading: resolvedHeading !== undefined,\n ariaLabel,\n ariaLabelledBy,\n },\n ),\n );\n const headingAttrs = normalizeAttributes(dialogControl.getHeadingAttributes(state));\n const headingId = resolvedHeading !== undefined ? headingAttrs.id : undefined;\n const headingLevel = headingProps?.level ?? 2;\n\n const recipe = dialogRecipe({ modal: toStrbool(modal) });\n const cls = useHuiClassNames(\"DialogContent\", recipe, rawProps.classNames);\n const sls = useHuiStyles(\"DialogContent\", rawProps.styles);\n\n const shouldRenderCloseButton = closeButton !== null && closeButton !== false;\n const shouldRenderHeader = headingId !== undefined || shouldRenderCloseButton;\n const closeButtonContent = closeButton === undefined\n ? <span aria-hidden className={cls.closeButtonIcon} style={sls.closeButtonIcon} />\n : closeButton;\n\n return (\n <dialog\n {...attrs}\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {shouldRenderHeader && (\n <div className={cls.header} style={sls.header}>\n {headingId && (\n <Heading\n margin=\"none\"\n {...headingProps}\n {...headingAttrs}\n className={cls.heading}\n style={sls.heading}\n level={headingLevel}\n >\n {resolvedHeading}\n </Heading>\n )}\n {shouldRenderCloseButton && (\n <Close\n className={cls.closeButton}\n style={sls.closeButton}\n aria-label=\"Close Dialog\"\n variant=\"ghost\"\n color=\"neutral\"\n shape=\"square\"\n {...closeButtonProps}\n >\n {closeButtonContent}\n </Close>\n )}\n </div>\n )}\n {children}\n </dialog>\n );\n}\n\nexport interface DialogCloseProps extends Omit<ButtonProps, \"as\"> {\n /**\n * The command used to close the dialog.\n *\n * @default \"request-close\"\n */\n command?: \"close\" | \"request-close\" | undefined;\n}\n\nfunction Close(rawProps: DialogCloseProps): ReactNode {\n const props = useHuiProps(\"DialogClose\", rawProps);\n const cls = useHuiClassNames(\"DialogClose\", { root: \"\" }, { root: rawProps.className });\n const sls = useHuiStyles(\"DialogClose\", { root: rawProps.style });\n const dialogId = useDialogId();\n const attrs = normalizeAttributes(dialogControl.getCloseAttributes({ id: dialogId }));\n\n return (\n <Button\n {...attrs}\n {...props}\n className={cls.root}\n style={sls.root}\n />\n );\n}\n\nexport const Dialog = Object.assign(DialogRoot, {\n Trigger,\n Content,\n Close,\n});\n"],"mappings":";;;;;;;;;AAgCA,SAAS,WAAW,UAAqC;CACvD,MAAM,EACJ,IACA,QAAQ,OACR,aACE,YAAY,UAAU,QAAQ;CAElC,MAAM,QAAQ,MAAM;CACpB,MAAM,WAAW,MAAM;CACvB,MAAM,OAAO,kBAAwB;EACnC,cAAc,WAAW,UAAU,KAAK;CAC1C,GAAG,CAAC,UAAU,KAAK,CAAC;CAEpB,MAAM,eAAe,eAAmC;EACtD;EACA;EACA;CACF,IAAI;EAAC;EAAU;EAAO;CAAI,CAAC;CAE3B,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;EAC5B;CACqB,CAAA;AAE5B;AAQA,SAAS,QAA+C,UAA4C;CAClG,MAAM,EACJ,IACA,UACA,SACA,GAAG,cACD,YAAY,iBAAiB,QAAQ;CAEzC,MAAM,YAAY,MAAM;CACx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|
3
3
|
import { DdSlots, DlSlots, DtSlots } from "@hebium-ui/core";
|
|
4
4
|
import { ComponentProps, ReactElement } from "react";
|
|
5
|
-
//#region src/components/dl/dl.d.ts
|
|
6
5
|
export interface DlProps extends HuiComponentProps<ComponentProps<"dl">, DlSlots> {}
|
|
7
6
|
declare function DlRoot(rawProps: DlProps): ReactElement;
|
|
8
7
|
export interface DtProps extends HuiComponentProps<ComponentProps<"dt">, DtSlots> {}
|
|
@@ -13,6 +12,5 @@ export declare const Dl: typeof DlRoot & {
|
|
|
13
12
|
Dt: typeof Dt;
|
|
14
13
|
Dd: typeof Dd;
|
|
15
14
|
};
|
|
16
|
-
//#endregion
|
|
17
15
|
export {};
|
|
18
16
|
//# sourceMappingURL=dl.d.ts.map
|
package/dist/components/dl/dl.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
2
|
import { ddRecipe, dlRecipe, dtRecipe } from "@hebium-ui/core";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/components/dl/dl.tsx
|
|
5
5
|
function DlRoot(rawProps) {
|
|
6
|
-
const {
|
|
6
|
+
const { children, ...restProps } = useHuiProps("Dl", rawProps);
|
|
7
7
|
const recipe = dlRecipe({});
|
|
8
|
-
const cls = useHuiClassNames("Dl", recipe, { root: className });
|
|
9
|
-
const sls = useHuiStyles("Dl", { root: style });
|
|
8
|
+
const cls = useHuiClassNames("Dl", recipe, { root: rawProps.className });
|
|
9
|
+
const sls = useHuiStyles("Dl", { root: rawProps.style });
|
|
10
10
|
return /* @__PURE__ */ jsx("dl", {
|
|
11
11
|
className: cls.root,
|
|
12
12
|
style: sls.root,
|
|
@@ -15,10 +15,10 @@ function DlRoot(rawProps) {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
function Dt(rawProps) {
|
|
18
|
-
const {
|
|
18
|
+
const { children, ...restProps } = useHuiProps("DlDt", rawProps);
|
|
19
19
|
const recipe = dtRecipe({});
|
|
20
|
-
const cls = useHuiClassNames("DlDt", recipe, { root: className });
|
|
21
|
-
const sls = useHuiStyles("DlDt", { root: style });
|
|
20
|
+
const cls = useHuiClassNames("DlDt", recipe, { root: rawProps.className });
|
|
21
|
+
const sls = useHuiStyles("DlDt", { root: rawProps.style });
|
|
22
22
|
return /* @__PURE__ */ jsx("dt", {
|
|
23
23
|
className: cls.root,
|
|
24
24
|
style: sls.root,
|
|
@@ -27,10 +27,10 @@ function Dt(rawProps) {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
function Dd(rawProps) {
|
|
30
|
-
const {
|
|
30
|
+
const { children, ...restProps } = useHuiProps("DlDd", rawProps);
|
|
31
31
|
const recipe = ddRecipe({});
|
|
32
|
-
const cls = useHuiClassNames("DlDd", recipe, { root: className });
|
|
33
|
-
const sls = useHuiStyles("DlDd", { root: style });
|
|
32
|
+
const cls = useHuiClassNames("DlDd", recipe, { root: rawProps.className });
|
|
33
|
+
const sls = useHuiStyles("DlDd", { root: rawProps.style });
|
|
34
34
|
return /* @__PURE__ */ jsx("dd", {
|
|
35
35
|
className: cls.root,
|
|
36
36
|
style: sls.root,
|
|
@@ -42,7 +42,6 @@ const Dl = Object.assign(DlRoot, {
|
|
|
42
42
|
Dt,
|
|
43
43
|
Dd
|
|
44
44
|
});
|
|
45
|
-
//#endregion
|
|
46
45
|
export { Dl };
|
|
47
46
|
|
|
48
47
|
//# sourceMappingURL=dl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dl.js","names":[],"sources":["../../../src/components/dl/dl.tsx"],"sourcesContent":["import { ddRecipe, type DdSlots, dlRecipe, type DlSlots, dtRecipe, type DtSlots } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport interface DlProps extends HuiComponentProps<ComponentProps<\"dl\">, DlSlots> {}\n\nfunction DlRoot(rawProps: DlProps): ReactElement {\n const {
|
|
1
|
+
{"version":3,"file":"dl.js","names":[],"sources":["../../../src/components/dl/dl.tsx"],"sourcesContent":["import { ddRecipe, type DdSlots, dlRecipe, type DlSlots, dtRecipe, type DtSlots } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport interface DlProps extends HuiComponentProps<ComponentProps<\"dl\">, DlSlots> {}\n\nfunction DlRoot(rawProps: DlProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"Dl\", rawProps);\n\n const recipe = dlRecipe({});\n const cls = useHuiClassNames(\"Dl\", recipe, { root: rawProps.className });\n const sls = useHuiStyles(\"Dl\", { root: rawProps.style });\n return (\n <dl\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </dl>\n );\n}\n\nexport interface DtProps extends HuiComponentProps<ComponentProps<\"dt\">, DtSlots> {}\n\nfunction Dt(rawProps: DtProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"DlDt\", rawProps);\n const recipe = dtRecipe({});\n\n const cls = useHuiClassNames(\"DlDt\", recipe, { root: rawProps.className });\n const sls = useHuiStyles(\"DlDt\", { root: rawProps.style });\n return (\n <dt\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </dt>\n );\n}\n\nexport interface DdProps extends HuiComponentProps<ComponentProps<\"dd\">, DdSlots> {}\n\nfunction Dd(rawProps: DdProps): ReactElement {\n const { children, ...restProps } = useHuiProps(\"DlDd\", rawProps);\n\n const recipe = ddRecipe({});\n const cls = useHuiClassNames(\"DlDd\", recipe, { root: rawProps.className });\n const sls = useHuiStyles(\"DlDd\", { root: rawProps.style });\n\n return (\n <dd\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </dd>\n );\n}\n\nexport const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drawer/drawer.context.ts
|
|
3
3
|
const DrawerContext = createContext(null);
|
|
4
4
|
function useDrawerContext() {
|
|
5
5
|
const context = useContext(DrawerContext);
|
|
@@ -9,7 +9,6 @@ function useDrawerContext() {
|
|
|
9
9
|
function useDrawerId() {
|
|
10
10
|
return useDrawerContext().drawerId;
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
12
|
export { DrawerContext, useDrawerContext, useDrawerId };
|
|
14
13
|
|
|
15
14
|
//# sourceMappingURL=drawer.context.js.map
|
|
@@ -7,7 +7,6 @@ import { HeadingProps } from "../heading/heading.js";
|
|
|
7
7
|
import "../heading/index.js";
|
|
8
8
|
import { ButtonSlots, DrawerSlots, DrawerVariants } from "@hebium-ui/core";
|
|
9
9
|
import { ComponentProps, ElementType, ReactElement, ReactNode } from "react";
|
|
10
|
-
//#region src/components/drawer/drawer.d.ts
|
|
11
10
|
export interface DrawerProps {
|
|
12
11
|
/**
|
|
13
12
|
* The id of the drawer content element.
|
|
@@ -62,6 +61,5 @@ export declare const Drawer: typeof DrawerRoot & {
|
|
|
62
61
|
Content: typeof Content;
|
|
63
62
|
Close: typeof Close;
|
|
64
63
|
};
|
|
65
|
-
//#endregion
|
|
66
64
|
export {};
|
|
67
65
|
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -6,7 +6,7 @@ import { DrawerContext, useDrawerContext, useDrawerId } from "./drawer.context.j
|
|
|
6
6
|
import { dialogControl, drawerRecipe } from "@hebium-ui/core";
|
|
7
7
|
import { useId, useMemo } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
|
|
9
|
+
// src/components/drawer/drawer.tsx
|
|
10
10
|
function DrawerRoot(rawProps) {
|
|
11
11
|
const { id, children } = useHuiProps("Drawer", rawProps);
|
|
12
12
|
const tmpId = useId();
|
|
@@ -20,6 +20,8 @@ function DrawerRoot(rawProps) {
|
|
|
20
20
|
function Trigger(rawProps) {
|
|
21
21
|
const { as, children, onClick, ...restProps } = useHuiProps("DrawerTrigger", rawProps);
|
|
22
22
|
const Component = as ?? Button;
|
|
23
|
+
const cls = useHuiClassNames("DrawerTrigger", { root: "" }, { root: rawProps["className"] });
|
|
24
|
+
const sls = useHuiStyles("DrawerTrigger", { root: rawProps["style"] });
|
|
23
25
|
const { drawerId } = useDrawerContext();
|
|
24
26
|
const attrs = normalizeAttributes(dialogControl.getTriggerAttributes({ id: drawerId }, {
|
|
25
27
|
modal: true,
|
|
@@ -27,13 +29,15 @@ function Trigger(rawProps) {
|
|
|
27
29
|
}));
|
|
28
30
|
return /* @__PURE__ */ jsx(Component, {
|
|
29
31
|
...attrs,
|
|
32
|
+
className: cls.root,
|
|
33
|
+
style: sls.root,
|
|
30
34
|
onClick,
|
|
31
35
|
...restProps,
|
|
32
36
|
children
|
|
33
37
|
});
|
|
34
38
|
}
|
|
35
39
|
function Content(rawProps) {
|
|
36
|
-
const { placement,
|
|
40
|
+
const { placement, children, heading, headingProps, closeButton, closeButtonProps, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...restProps } = useHuiProps("DrawerContent", rawProps);
|
|
37
41
|
const { drawerId } = useDrawerContext();
|
|
38
42
|
const resolvedHeading = heading !== void 0 && heading !== null && heading !== false ? heading : void 0;
|
|
39
43
|
const state = { id: drawerId };
|
|
@@ -46,8 +50,8 @@ function Content(rawProps) {
|
|
|
46
50
|
const headingId = resolvedHeading !== void 0 ? headingAttrs.id : void 0;
|
|
47
51
|
const headingLevel = headingProps?.level ?? 2;
|
|
48
52
|
const recipe = drawerRecipe({ placement });
|
|
49
|
-
const cls = useHuiClassNames("DrawerContent", recipe, classNames);
|
|
50
|
-
const sls = useHuiStyles("DrawerContent", styles);
|
|
53
|
+
const cls = useHuiClassNames("DrawerContent", recipe, rawProps.classNames);
|
|
54
|
+
const sls = useHuiStyles("DrawerContent", rawProps.styles);
|
|
51
55
|
const shouldRenderCloseButton = closeButton !== null && closeButton !== false;
|
|
52
56
|
const shouldRenderHeader = headingId !== void 0 || shouldRenderCloseButton;
|
|
53
57
|
const closeButtonContent = closeButton === void 0 ? /* @__PURE__ */ jsx("span", {
|
|
@@ -86,11 +90,15 @@ function Content(rawProps) {
|
|
|
86
90
|
}
|
|
87
91
|
function Close(rawProps) {
|
|
88
92
|
const props = useHuiProps("DrawerClose", rawProps);
|
|
93
|
+
const cls = useHuiClassNames("DrawerClose", { root: "" }, { root: rawProps.className });
|
|
94
|
+
const sls = useHuiStyles("DrawerClose", { root: rawProps.style });
|
|
89
95
|
const drawerId = useDrawerId();
|
|
90
96
|
const attrs = normalizeAttributes(dialogControl.getCloseAttributes({ id: drawerId }));
|
|
91
97
|
return /* @__PURE__ */ jsx(Button, {
|
|
92
98
|
...attrs,
|
|
93
|
-
...props
|
|
99
|
+
...props,
|
|
100
|
+
className: cls.root,
|
|
101
|
+
style: sls.root
|
|
94
102
|
});
|
|
95
103
|
}
|
|
96
104
|
const Drawer = Object.assign(DrawerRoot, {
|
|
@@ -98,7 +106,6 @@ const Drawer = Object.assign(DrawerRoot, {
|
|
|
98
106
|
Content,
|
|
99
107
|
Close
|
|
100
108
|
});
|
|
101
|
-
//#endregion
|
|
102
109
|
export { Drawer };
|
|
103
110
|
|
|
104
111
|
//# sourceMappingURL=drawer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.js","names":[],"sources":["../../../src/components/drawer/drawer.tsx"],"sourcesContent":["import { type ButtonSlots, dialogControl, drawerRecipe, type DrawerSlots, type DrawerVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ElementType, type ReactElement, type ReactNode, useId, useMemo } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { Heading, type HeadingProps } from \"../heading\";\nimport { DrawerContext, type DrawerContextValue, useDrawerContext, useDrawerId } from \"./drawer.context\";\n\nexport interface DrawerProps {\n /**\n * The id of the drawer content element.\n */\n id?: string | undefined;\n children?: ReactNode | undefined;\n}\n\nfunction DrawerRoot(rawProps: DrawerProps): ReactElement {\n const {\n id,\n children,\n } = useHuiProps(\"Drawer\", rawProps);\n\n const tmpId = useId();\n const drawerId = id || tmpId;\n\n const contextValue = useMemo<DrawerContextValue>(() => ({\n drawerId,\n }), [drawerId]);\n\n return (\n <DrawerContext.Provider value={contextValue}>\n {children}\n </DrawerContext.Provider>\n );\n}\n\nexport type DrawerTriggerProps<E extends ElementType = typeof Button> = HuiPolymorphicProps<\n E,\n {},\n ButtonSlots\n>;\n\nfunction Trigger<E extends ElementType = typeof Button>(rawProps: DrawerTriggerProps<E>): ReactNode {\n const {\n as,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"DrawerTrigger\", rawProps);\n\n const Component = as ?? Button;\n const {\n drawerId,\n } = useDrawerContext();\n const attrs = normalizeAttributes(\n dialogControl.getTriggerAttributes(\n { id: drawerId },\n {\n modal: true,\n isButtonElement: as === undefined,\n },\n ),\n );\n\n return (\n <Component\n {...attrs}\n onClick={onClick}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ntype HtmlDialogProps = Omit<ComponentProps<\"dialog\">, \"children\" | \"id\" | \"open\">;\ninterface DrawerContentOwnProps extends HtmlDialogProps {\n /**\n * The edge from which the drawer enters.\n *\n * @default \"inline-end\"\n */\n placement?: DrawerVariants[\"placement\"] | undefined;\n /**\n * The heading rendered at the top of the drawer content.\n */\n heading?: ReactNode | undefined;\n /**\n * Additional props passed to the internal heading component.\n */\n headingProps?: Omit<HeadingProps, \"children\" | \"id\" | \"className\" | \"style\"> | undefined;\n /**\n * The content rendered inside the internal close button. Set to `null` or `false` to hide the button.\n *\n * @default close icon\n */\n closeButton?: ReactNode | undefined;\n /**\n * Additional props passed to the internal close button.\n */\n closeButtonProps?: Omit<DrawerCloseProps, \"children\" | \"className\" | \"style\"> | undefined;\n children?: ReactNode | undefined;\n}\nexport type DrawerContentProps = HuiComponentProps<DrawerContentOwnProps, DrawerSlots>;\n\nfunction Content(rawProps: DrawerContentProps): ReactElement {\n const {\n placement,\n
|
|
1
|
+
{"version":3,"file":"drawer.js","names":[],"sources":["../../../src/components/drawer/drawer.tsx"],"sourcesContent":["import { type ButtonSlots, dialogControl, drawerRecipe, type DrawerSlots, type DrawerVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ElementType, type ReactElement, type ReactNode, useId, useMemo } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { Heading, type HeadingProps } from \"../heading\";\nimport { DrawerContext, type DrawerContextValue, useDrawerContext, useDrawerId } from \"./drawer.context\";\n\nexport interface DrawerProps {\n /**\n * The id of the drawer content element.\n */\n id?: string | undefined;\n children?: ReactNode | undefined;\n}\n\nfunction DrawerRoot(rawProps: DrawerProps): ReactElement {\n const {\n id,\n children,\n } = useHuiProps(\"Drawer\", rawProps);\n\n const tmpId = useId();\n const drawerId = id || tmpId;\n\n const contextValue = useMemo<DrawerContextValue>(() => ({\n drawerId,\n }), [drawerId]);\n\n return (\n <DrawerContext.Provider value={contextValue}>\n {children}\n </DrawerContext.Provider>\n );\n}\n\nexport type DrawerTriggerProps<E extends ElementType = typeof Button> = HuiPolymorphicProps<\n E,\n {},\n ButtonSlots\n>;\n\nfunction Trigger<E extends ElementType = typeof Button>(rawProps: DrawerTriggerProps<E>): ReactNode {\n const {\n as,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"DrawerTrigger\", rawProps);\n\n const Component = as ?? Button;\n const cls = useHuiClassNames(\"DrawerTrigger\", { root: \"\" }, { root: rawProps[\"className\"] });\n const sls = useHuiStyles(\"DrawerTrigger\", { root: rawProps[\"style\"] });\n const {\n drawerId,\n } = useDrawerContext();\n const attrs = normalizeAttributes(\n dialogControl.getTriggerAttributes(\n { id: drawerId },\n {\n modal: true,\n isButtonElement: as === undefined,\n },\n ),\n );\n\n return (\n <Component\n {...attrs}\n className={cls.root}\n style={sls.root}\n onClick={onClick}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ntype HtmlDialogProps = Omit<ComponentProps<\"dialog\">, \"children\" | \"id\" | \"open\">;\ninterface DrawerContentOwnProps extends HtmlDialogProps {\n /**\n * The edge from which the drawer enters.\n *\n * @default \"inline-end\"\n */\n placement?: DrawerVariants[\"placement\"] | undefined;\n /**\n * The heading rendered at the top of the drawer content.\n */\n heading?: ReactNode | undefined;\n /**\n * Additional props passed to the internal heading component.\n */\n headingProps?: Omit<HeadingProps, \"children\" | \"id\" | \"className\" | \"style\"> | undefined;\n /**\n * The content rendered inside the internal close button. Set to `null` or `false` to hide the button.\n *\n * @default close icon\n */\n closeButton?: ReactNode | undefined;\n /**\n * Additional props passed to the internal close button.\n */\n closeButtonProps?: Omit<DrawerCloseProps, \"children\" | \"className\" | \"style\"> | undefined;\n children?: ReactNode | undefined;\n}\nexport type DrawerContentProps = HuiComponentProps<DrawerContentOwnProps, DrawerSlots>;\n\nfunction Content(rawProps: DrawerContentProps): ReactElement {\n const {\n placement,\n children,\n heading,\n headingProps,\n closeButton,\n closeButtonProps,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...restProps\n } = useHuiProps(\"DrawerContent\", rawProps);\n\n const {\n drawerId,\n } = useDrawerContext();\n\n const resolvedHeading = heading !== undefined && heading !== null && heading !== false\n ? heading\n : undefined;\n const state = { id: drawerId };\n const attrs = normalizeAttributes(\n dialogControl.getContentAttributes(\n state,\n {\n hasHeading: resolvedHeading !== undefined,\n ariaLabel,\n ariaLabelledBy,\n },\n ),\n );\n const headingAttrs = normalizeAttributes(dialogControl.getHeadingAttributes(state));\n const headingId = resolvedHeading !== undefined ? headingAttrs.id : undefined;\n const headingLevel = headingProps?.level ?? 2;\n const recipe = drawerRecipe({ placement });\n const cls = useHuiClassNames(\"DrawerContent\", recipe, rawProps.classNames);\n const sls = useHuiStyles(\"DrawerContent\", rawProps.styles);\n\n const shouldRenderCloseButton = closeButton !== null && closeButton !== false;\n const shouldRenderHeader = headingId !== undefined || shouldRenderCloseButton;\n const closeButtonContent = closeButton === undefined\n ? <span aria-hidden className={cls.closeButtonIcon} style={sls.closeButtonIcon} />\n : closeButton;\n\n return (\n <dialog\n {...attrs}\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {shouldRenderHeader && (\n <div className={cls.header} style={sls.header}>\n {headingId && (\n <Heading\n margin=\"none\"\n {...headingProps}\n {...headingAttrs}\n className={cls.heading}\n style={sls.heading}\n level={headingLevel}\n >\n {resolvedHeading}\n </Heading>\n )}\n {shouldRenderCloseButton && (\n <Close\n className={cls.closeButton}\n style={sls.closeButton}\n aria-label=\"Close Drawer\"\n variant=\"ghost\"\n color=\"neutral\"\n shape=\"square\"\n {...closeButtonProps}\n >\n {closeButtonContent}\n </Close>\n )}\n </div>\n )}\n {children}\n </dialog>\n );\n}\n\nexport interface DrawerCloseProps extends Omit<ButtonProps, \"as\"> {\n /**\n * The command used to close the drawer.\n *\n * @default \"request-close\"\n */\n command?: \"close\" | \"request-close\" | undefined;\n}\n\nfunction Close(rawProps: DrawerCloseProps): ReactNode {\n const props = useHuiProps(\"DrawerClose\", rawProps);\n const cls = useHuiClassNames(\"DrawerClose\", { root: \"\" }, { root: rawProps.className });\n const sls = useHuiStyles(\"DrawerClose\", { root: rawProps.style });\n const drawerId = useDrawerId();\n const attrs = normalizeAttributes(dialogControl.getCloseAttributes({ id: drawerId }));\n\n return (\n <Button\n {...attrs}\n {...props}\n className={cls.root}\n style={sls.root}\n />\n );\n}\n\nexport const Drawer = Object.assign(DrawerRoot, {\n Trigger,\n Content,\n Close,\n});\n"],"mappings":";;;;;;;;;AAiBA,SAAS,WAAW,UAAqC;CACvD,MAAM,EACJ,IACA,aACE,YAAY,UAAU,QAAQ;CAElC,MAAM,Q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AAO,YAAY;CAC9C;CACA;CACA;AACF,CAAC"}
|
|
@@ -2,8 +2,6 @@ import { HuiComponentProps } from "../../types/hui-component.js";
|
|
|
2
2
|
import "../../types/index.js";
|
|
3
3
|
import { FieldsetSlots } from "@hebium-ui/core";
|
|
4
4
|
import { ComponentProps, ReactElement } from "react";
|
|
5
|
-
//#region src/components/fieldset/fieldset.d.ts
|
|
6
5
|
export type FieldsetProps = HuiComponentProps<ComponentProps<"fieldset">, FieldsetSlots>;
|
|
7
6
|
export declare function Fieldset(rawProps: FieldsetProps): ReactElement;
|
|
8
|
-
//#endregion
|
|
9
7
|
//# sourceMappingURL=fieldset.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
2
|
import { fieldsetRecipe } from "@hebium-ui/core";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/components/fieldset/fieldset.tsx
|
|
5
5
|
function Fieldset(rawProps) {
|
|
6
|
-
const {
|
|
6
|
+
const { children, ...restProps } = useHuiProps("Fieldset", rawProps);
|
|
7
7
|
const recipe = fieldsetRecipe({});
|
|
8
|
-
const cls = useHuiClassNames("Fieldset", recipe, { root: className });
|
|
9
|
-
const sls = useHuiStyles("Fieldset", { root: style });
|
|
8
|
+
const cls = useHuiClassNames("Fieldset", recipe, { root: rawProps.className });
|
|
9
|
+
const sls = useHuiStyles("Fieldset", { root: rawProps.style });
|
|
10
10
|
return /* @__PURE__ */ jsx("fieldset", {
|
|
11
11
|
className: cls.root,
|
|
12
12
|
style: sls.root,
|
|
@@ -14,7 +14,6 @@ function Fieldset(rawProps) {
|
|
|
14
14
|
children
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
//#endregion
|
|
18
17
|
export { Fieldset };
|
|
19
18
|
|
|
20
19
|
//# sourceMappingURL=fieldset.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldset.js","names":[],"sources":["../../../src/components/fieldset/fieldset.tsx"],"sourcesContent":["import { fieldsetRecipe, type FieldsetSlots } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport type FieldsetProps = HuiComponentProps<\n ComponentProps<\"fieldset\">,\n FieldsetSlots\n>;\n\nexport function Fieldset(rawProps: FieldsetProps): ReactElement {\n const {\n
|
|
1
|
+
{"version":3,"file":"fieldset.js","names":[],"sources":["../../../src/components/fieldset/fieldset.tsx"],"sourcesContent":["import { fieldsetRecipe, type FieldsetSlots } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport type FieldsetProps = HuiComponentProps<\n ComponentProps<\"fieldset\">,\n FieldsetSlots\n>;\n\nexport function Fieldset(rawProps: FieldsetProps): ReactElement {\n const {\n children,\n ...restProps\n } = useHuiProps(\"Fieldset\", rawProps);\n\n const recipe = fieldsetRecipe({});\n const cls = useHuiClassNames(\"Fieldset\", recipe, { root: rawProps.className });\n const sls = useHuiStyles(\"Fieldset\", { root: rawProps.style });\n\n return (\n <fieldset\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </fieldset>\n );\n}\n"],"mappings":";;;;AAUA,SAAgB,SAAS,UAAuC;CAC9D,MAAM,EACJ,UACA,GAAG,cACD,YAAY,YAAY,QAAQ;CAEpC,MAAM,SAAS,eAAe,CAAC,CAAC;CAChC,MAAM,MAAM,iBAAiB,YAAY,QAAQ,EAAE,MAAM,SAAS,UAAU,CAAC;CAC7E,MAAM,MAAM,aAAa,YAAY,EAAE,MAAM,SAAS,MAAM,CAAC;CAE7D,OACE,oBAAC,YAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACO,CAAA;AAEd"}
|
|
@@ -2,7 +2,6 @@ import { HuiComponentProps } from "../../types/hui-component.js";
|
|
|
2
2
|
import "../../types/index.js";
|
|
3
3
|
import { HeadingSlots, HeadingVariants } from "@hebium-ui/core";
|
|
4
4
|
import { ComponentProps, ReactElement } from "react";
|
|
5
|
-
//#region src/components/heading/heading.d.ts
|
|
6
5
|
export interface HeadingProps extends HuiComponentProps<ComponentProps<"h2">, HeadingSlots> {
|
|
7
6
|
/**
|
|
8
7
|
* The heading level used to choose the rendered heading element.
|
|
@@ -18,5 +17,4 @@ export interface HeadingProps extends HuiComponentProps<ComponentProps<"h2">, He
|
|
|
18
17
|
margin?: HeadingVariants["margin"] | undefined;
|
|
19
18
|
}
|
|
20
19
|
export declare function Heading(rawProps: HeadingProps): ReactElement;
|
|
21
|
-
//#endregion
|
|
22
20
|
//# sourceMappingURL=heading.d.ts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
2
|
import { headingRecipe } from "@hebium-ui/core";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/components/heading/heading.tsx
|
|
5
5
|
function Heading(rawProps) {
|
|
6
|
-
const { level = 2, margin,
|
|
6
|
+
const { level = 2, margin, children, ...restProps } = useHuiProps("Heading", rawProps);
|
|
7
7
|
const Component = `h${level}`;
|
|
8
8
|
const recipe = headingRecipe({
|
|
9
9
|
level: `${level}`,
|
|
10
10
|
margin
|
|
11
11
|
});
|
|
12
|
-
const cls = useHuiClassNames("Heading", recipe, { root: className });
|
|
13
|
-
const sls = useHuiStyles("Heading", { root: style });
|
|
12
|
+
const cls = useHuiClassNames("Heading", recipe, { root: rawProps.className });
|
|
13
|
+
const sls = useHuiStyles("Heading", { root: rawProps.style });
|
|
14
14
|
return /* @__PURE__ */ jsx(Component, {
|
|
15
15
|
className: cls.root,
|
|
16
16
|
style: sls.root,
|
|
@@ -18,7 +18,6 @@ function Heading(rawProps) {
|
|
|
18
18
|
children
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { Heading };
|
|
23
22
|
|
|
24
23
|
//# sourceMappingURL=heading.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.js","names":[],"sources":["../../../src/components/heading/heading.tsx"],"sourcesContent":["import { headingRecipe, type HeadingSlots, type HeadingVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport interface HeadingProps extends HuiComponentProps<ComponentProps<\"h2\">, HeadingSlots> {\n /**\n * The heading level used to choose the rendered heading element.\n *\n * @default 2\n */\n level?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;\n /**\n * The block margin applied to the heading.\n *\n * @default \"none\"\n */\n margin?: HeadingVariants[\"margin\"] | undefined;\n}\n\nexport function Heading(rawProps: HeadingProps): ReactElement {\n const {\n level = 2,\n margin,\n
|
|
1
|
+
{"version":3,"file":"heading.js","names":[],"sources":["../../../src/components/heading/heading.tsx"],"sourcesContent":["import { headingRecipe, type HeadingSlots, type HeadingVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\nexport interface HeadingProps extends HuiComponentProps<ComponentProps<\"h2\">, HeadingSlots> {\n /**\n * The heading level used to choose the rendered heading element.\n *\n * @default 2\n */\n level?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;\n /**\n * The block margin applied to the heading.\n *\n * @default \"none\"\n */\n margin?: HeadingVariants[\"margin\"] | undefined;\n}\n\nexport function Heading(rawProps: HeadingProps): ReactElement {\n const {\n level = 2,\n margin,\n children,\n ...restProps\n } = useHuiProps(\"Heading\", rawProps);\n\n const Component = `h${level}` as const;\n\n const recipe = headingRecipe({ level: `${level}`, margin });\n const cls = useHuiClassNames(\"Heading\", recipe, { root: rawProps.className });\n const sls = useHuiStyles(\"Heading\", { root: rawProps.style });\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n"],"mappings":";;;;AAoBA,SAAgB,QAAQ,UAAsC;CAC5D,MAAM,EACJ,QAAQ,GACR,QACA,UACA,GAAG,cACD,YAAY,WAAW,QAAQ;CAEnC,MAAM,YAAY,IAAI;CAEtB,MAAM,SAAS,cAAc;EAAE,OAAO,GAAG;EAAS;CAAO,CAAC;CAC1D,MAAM,MAAM,iBAAiB,WAAW,QAAQ,EAAE,MAAM,SAAS,UAAU,CAAC;CAC5E,MAAM,MAAM,aAAa,WAAW,EAAE,MAAM,SAAS,MAAM,CAAC;CAE5D,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
|
|
@@ -2,10 +2,8 @@ import { HuiPolymorphicProps } from "../../types/polymorphic.js";
|
|
|
2
2
|
import "../../types/index.js";
|
|
3
3
|
import { HrSlots } from "@hebium-ui/core";
|
|
4
4
|
import { ComponentProps, ElementType, ReactElement } from "react";
|
|
5
|
-
//#region src/components/hr/hr.d.ts
|
|
6
5
|
interface HrOwnProps extends ComponentProps<"hr"> {}
|
|
7
6
|
export type HrProps<E extends ElementType = "hr"> = HuiPolymorphicProps<E, HrOwnProps, HrSlots>;
|
|
8
7
|
export declare function Hr<E extends ElementType = "hr">(rawProps: HrProps<E>): ReactElement;
|
|
9
|
-
//#endregion
|
|
10
8
|
export {};
|
|
11
9
|
//# sourceMappingURL=hr.d.ts.map
|
package/dist/components/hr/hr.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
2
|
import { hrRecipe } from "@hebium-ui/core";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/components/hr/hr.tsx
|
|
5
5
|
function Hr(rawProps) {
|
|
6
|
-
const { as,
|
|
6
|
+
const { as, ...restProps } = useHuiProps("Hr", rawProps);
|
|
7
7
|
const recipe = hrRecipe();
|
|
8
|
-
const cls = useHuiClassNames("Hr", recipe, { root: className });
|
|
9
|
-
const sls = useHuiStyles("Hr", { root: style });
|
|
8
|
+
const cls = useHuiClassNames("Hr", recipe, { root: rawProps.className });
|
|
9
|
+
const sls = useHuiStyles("Hr", { root: rawProps.style });
|
|
10
10
|
return /* @__PURE__ */ jsx(as ?? "hr", {
|
|
11
11
|
className: cls.root,
|
|
12
12
|
style: sls.root,
|
|
13
13
|
...restProps
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { Hr };
|
|
18
17
|
|
|
19
18
|
//# sourceMappingURL=hr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hr.js","names":[],"sources":["../../../src/components/hr/hr.tsx"],"sourcesContent":["import { hrRecipe, type HrSlots } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface HrOwnProps extends ComponentProps<\"hr\"> {}\n\nexport type HrProps<E extends ElementType = \"hr\"> = HuiPolymorphicProps<\n E,\n HrOwnProps,\n HrSlots\n>;\n\nexport function Hr<E extends ElementType = \"hr\">(rawProps: HrProps<E>): ReactElement {\n const {\n as,\n
|
|
1
|
+
{"version":3,"file":"hr.js","names":[],"sources":["../../../src/components/hr/hr.tsx"],"sourcesContent":["import { hrRecipe, type HrSlots } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface HrOwnProps extends ComponentProps<\"hr\"> {}\n\nexport type HrProps<E extends ElementType = \"hr\"> = HuiPolymorphicProps<\n E,\n HrOwnProps,\n HrSlots\n>;\n\nexport function Hr<E extends ElementType = \"hr\">(rawProps: HrProps<E>): ReactElement {\n const {\n as,\n ...restProps\n } = useHuiProps(\"Hr\", rawProps);\n\n const recipe = hrRecipe();\n const cls = useHuiClassNames(\"Hr\", recipe, { root: rawProps.className });\n const sls = useHuiStyles(\"Hr\", { root: rawProps.style });\n\n const Component = as ?? \"hr\";\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...restProps}\n />\n );\n}\n"],"mappings":";;;;AAaA,SAAgB,GAAiC,UAAoC;CACnF,MAAM,EACJ,IACA,GAAG,cACD,YAAY,MAAM,QAAQ;CAE9B,MAAM,SAAS,SAAS;CACxB,MAAM,MAAM,iBAAiB,MAAM,QAAQ,EAAE,MAAM,SAAS,UAAU,CAAC;CACvE,MAAM,MAAM,aAAa,MAAM,EAAE,MAAM,SAAS,MAAM,CAAC;CAGvD,OACE,oBAFgB,MAAM,MAEtB;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -52,10 +52,14 @@ import { SegmentedControl, SegmentedControlItemProps, SegmentedControlProps } fr
|
|
|
52
52
|
import "./segmented-control/index.js";
|
|
53
53
|
import { Select, SelectProps } from "./select/select.js";
|
|
54
54
|
import "./select/index.js";
|
|
55
|
+
import { SkipLink, SkipLinkProps } from "./skip-link/skip-link.js";
|
|
56
|
+
import "./skip-link/index.js";
|
|
55
57
|
import { CaptionProps, Table, TableProps, TbodyProps, TdProps, TfootProps, ThProps, TheadProps, TrProps } from "./table/table.js";
|
|
56
58
|
import "./table/index.js";
|
|
57
59
|
import { Tabs, TabsListProps, TabsPanelProps, TabsProps, TabsTabProps } from "./tabs/tabs.js";
|
|
58
60
|
import "./tabs/index.js";
|
|
61
|
+
import { Text, TextProps } from "./text/text.js";
|
|
62
|
+
import "./text/index.js";
|
|
59
63
|
import { Textarea, TextareaProps } from "./textarea/textarea.js";
|
|
60
64
|
import "./textarea/index.js";
|
|
61
65
|
import { Tooltip, TooltipContentProps, TooltipProps, TooltipTriggerProps } from "./tooltip/tooltip.js";
|
|
@@ -63,4 +67,4 @@ import { useTooltipId } from "./tooltip/tooltip.context.js";
|
|
|
63
67
|
import "./tooltip/index.js";
|
|
64
68
|
import { VisuallyHidden, VisuallyHiddenProps } from "./visually-hidden/visually-hidden.js";
|
|
65
69
|
import "./visually-hidden/index.js";
|
|
66
|
-
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, 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, useMenuId, usePopoverId, useTooltipId };
|
|
70
|
+
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, 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, useMenuId, usePopoverId, useTooltipId };
|
|
@@ -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/input/input.d.ts
|
|
8
7
|
type HtmlInputProps = Omit<ComponentProps<"input">, "children" | "color">;
|
|
9
8
|
interface InputOwnProps extends HtmlInputProps {
|
|
10
9
|
/**
|
|
@@ -32,6 +31,5 @@ interface InputOwnProps extends HtmlInputProps {
|
|
|
32
31
|
}
|
|
33
32
|
export type InputProps = HuiComponentProps<InputOwnProps, InputSlots>;
|
|
34
33
|
export declare function Input(rawProps: InputProps): ReactElement;
|
|
35
|
-
//#endregion
|
|
36
34
|
export {};
|
|
37
35
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -4,10 +4,10 @@ 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
|
-
|
|
7
|
+
// src/components/input/input.tsx
|
|
8
8
|
function Input(rawProps) {
|
|
9
9
|
const tmpId = useId();
|
|
10
|
-
const { id,
|
|
10
|
+
const { id, color, label, description, error, labelProps, ...restProps } = useHuiProps("Input", rawProps);
|
|
11
11
|
const inputState = {
|
|
12
12
|
id: id || tmpId,
|
|
13
13
|
invalid: !!error,
|
|
@@ -19,8 +19,8 @@ function Input(rawProps) {
|
|
|
19
19
|
color,
|
|
20
20
|
error: toStrbool(inputState.invalid)
|
|
21
21
|
});
|
|
22
|
-
const cls = useHuiClassNames("Input", recipe, classNames);
|
|
23
|
-
const sls = useHuiStyles("Input", styles);
|
|
22
|
+
const cls = useHuiClassNames("Input", recipe, rawProps.classNames);
|
|
23
|
+
const sls = useHuiStyles("Input", rawProps.styles);
|
|
24
24
|
const hasLabel = !!label || !!description || !!error;
|
|
25
25
|
const controlAttrs = normalizeAttributes(inputControl.getControlAttributes(inputState));
|
|
26
26
|
const labelAttrs = normalizeAttributes(inputControl.getLabelAttributes(inputState));
|
|
@@ -41,7 +41,6 @@ function Input(rawProps) {
|
|
|
41
41
|
})]
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { Input };
|
|
46
45
|
|
|
47
46
|
//# sourceMappingURL=input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","names":[],"sources":["../../../src/components/input/input.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 HtmlInputProps = Omit<ComponentProps<\"input\">, \"children\" | \"color\">;\n\ninterface InputOwnProps extends HtmlInputProps {\n /**\n * The semantic color of the input.\n *\n * @default \"accent\"\n */\n color?: InputVariants[\"color\"] | undefined;\n /**\n * The label displayed above the input.\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 InputProps = HuiComponentProps<\n InputOwnProps,\n InputSlots\n>;\n\nexport function Input(rawProps: InputProps): ReactElement {\n const tmpId = useId();\n const {\n id,\n
|
|
1
|
+
{"version":3,"file":"input.js","names":[],"sources":["../../../src/components/input/input.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 HtmlInputProps = Omit<ComponentProps<\"input\">, \"children\" | \"color\">;\n\ninterface InputOwnProps extends HtmlInputProps {\n /**\n * The semantic color of the input.\n *\n * @default \"accent\"\n */\n color?: InputVariants[\"color\"] | undefined;\n /**\n * The label displayed above the input.\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 InputProps = HuiComponentProps<\n InputOwnProps,\n InputSlots\n>;\n\nexport function Input(rawProps: InputProps): ReactElement {\n const tmpId = useId();\n const {\n id,\n color,\n label,\n description,\n error,\n labelProps,\n ...restProps\n } = useHuiProps(\"Input\", rawProps);\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 error: toStrbool(inputState.invalid),\n });\n const cls = useHuiClassNames(\"Input\", recipe, rawProps.classNames);\n const sls = useHuiStyles(\"Input\", rawProps.styles);\n\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 <input\n className={cls.input}\n style={sls.input}\n {...controlAttrs}\n {...restProps}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;AAuCA,SAAgB,MAAM,UAAoC;CACxD,MAAM,QAAQ,MAAM;CACpB,MAAM,EACJ,IACA,OACA,OACA,aACA,OACA,YACA,GAAG,cACD,YAAY,SAAS,QAAQ;CAEjC,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,OAAO,UAAU,WAAW,OAAO;CACrC,CAAC;CACD,MAAM,MAAM,iBAAiB,SAAS,QAAQ,SAAS,UAAU;CACjE,MAAM,MAAM,aAAa,SAAS,SAAS,MAAM;CAEjD,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,SAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GACJ,GAAI;EACL,CAAA,CACE;;AAET"}
|