@hebium-ui/react 0.0.0-stage → 0.1.0-alpha.0
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/LICENSE +21 -0
- package/README.md +7 -2
- package/dist/components/alert/alert.d.ts +44 -0
- package/dist/components/alert/alert.js +45 -0
- package/dist/components/alert/alert.js.map +1 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/anchor/anchor.d.ts +30 -0
- package/dist/components/anchor/anchor.js +25 -0
- package/dist/components/anchor/anchor.js.map +1 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/avatar/avatar.d.ts +16 -0
- package/dist/components/avatar/avatar.js +50 -0
- package/dist/components/avatar/avatar.js.map +1 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/blockquote/blockquote.d.ts +28 -0
- package/dist/components/blockquote/blockquote.js +29 -0
- package/dist/components/blockquote/blockquote.js.map +1 -0
- package/dist/components/blockquote/index.d.ts +2 -0
- package/dist/components/button/button.d.ts +30 -0
- package/dist/components/button/button.js +25 -0
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/checkbox/checkbox.d.ts +33 -0
- package/dist/components/checkbox/checkbox.js +68 -0
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/code/code.d.ts +11 -0
- package/dist/components/code/code.js +21 -0
- package/dist/components/code/code.js.map +1 -0
- package/dist/components/code/index.d.ts +2 -0
- package/dist/components/details/details.d.ts +22 -0
- package/dist/components/details/details.js +28 -0
- package/dist/components/details/details.js.map +1 -0
- package/dist/components/details/index.d.ts +2 -0
- package/dist/components/dialog/dialog.context.d.ts +4 -0
- package/dist/components/dialog/dialog.context.js +15 -0
- package/dist/components/dialog/dialog.context.js.map +1 -0
- package/dist/components/dialog/dialog.d.ts +67 -0
- package/dist/components/dialog/dialog.js +124 -0
- package/dist/components/dialog/dialog.js.map +1 -0
- package/dist/components/dialog/index.d.ts +3 -0
- package/dist/components/dl/dl.d.ts +18 -0
- package/dist/components/dl/dl.js +48 -0
- package/dist/components/dl/dl.js.map +1 -0
- package/dist/components/dl/index.d.ts +2 -0
- package/dist/components/drawer/drawer.context.d.ts +4 -0
- package/dist/components/drawer/drawer.context.js +15 -0
- package/dist/components/drawer/drawer.context.js.map +1 -0
- package/dist/components/drawer/drawer.d.ts +67 -0
- package/dist/components/drawer/drawer.js +104 -0
- package/dist/components/drawer/drawer.js.map +1 -0
- package/dist/components/drawer/index.d.ts +3 -0
- package/dist/components/fieldset/fieldset.d.ts +9 -0
- package/dist/components/fieldset/fieldset.js +20 -0
- package/dist/components/fieldset/fieldset.js.map +1 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/heading/heading.d.ts +22 -0
- package/dist/components/heading/heading.js +24 -0
- package/dist/components/heading/heading.js.map +1 -0
- package/dist/components/heading/index.d.ts +2 -0
- package/dist/components/hr/hr.d.ts +11 -0
- package/dist/components/hr/hr.js +19 -0
- package/dist/components/hr/hr.js.map +1 -0
- package/dist/components/hr/index.d.ts +2 -0
- package/dist/components/index.d.ts +66 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/input.d.ts +37 -0
- package/dist/components/input/input.js +47 -0
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/label/index.d.ts +2 -0
- package/dist/components/label/label.d.ts +32 -0
- package/dist/components/label/label.js +54 -0
- package/dist/components/label/label.js.map +1 -0
- package/dist/components/menu/index.d.ts +3 -0
- package/dist/components/menu/menu.context.d.ts +4 -0
- package/dist/components/menu/menu.context.js +15 -0
- package/dist/components/menu/menu.context.js.map +1 -0
- package/dist/components/menu/menu.d.ts +82 -0
- package/dist/components/menu/menu.js +133 -0
- package/dist/components/menu/menu.js.map +1 -0
- package/dist/components/paragraph/index.d.ts +2 -0
- package/dist/components/paragraph/paragraph.d.ts +18 -0
- package/dist/components/paragraph/paragraph.js +21 -0
- package/dist/components/paragraph/paragraph.js.map +1 -0
- package/dist/components/popover/index.d.ts +3 -0
- package/dist/components/popover/popover.context.d.ts +4 -0
- package/dist/components/popover/popover.context.js +15 -0
- package/dist/components/popover/popover.context.js.map +1 -0
- package/dist/components/popover/popover.d.ts +53 -0
- package/dist/components/popover/popover.js +60 -0
- package/dist/components/popover/popover.js.map +1 -0
- package/dist/components/progress/index.d.ts +2 -0
- package/dist/components/progress/progress.d.ts +55 -0
- package/dist/components/progress/progress.js +57 -0
- package/dist/components/progress/progress.js.map +1 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/radio.d.ts +27 -0
- package/dist/components/radio/radio.js +57 -0
- package/dist/components/radio/radio.js.map +1 -0
- package/dist/components/radiogroup/index.d.ts +2 -0
- package/dist/components/radiogroup/radiogroup.d.ts +36 -0
- package/dist/components/radiogroup/radiogroup.js +44 -0
- package/dist/components/radiogroup/radiogroup.js.map +1 -0
- package/dist/components/section/index.d.ts +2 -0
- package/dist/components/section/section.d.ts +36 -0
- package/dist/components/section/section.js +26 -0
- package/dist/components/section/section.js.map +1 -0
- package/dist/components/segmented-control/index.d.ts +2 -0
- package/dist/components/segmented-control/segmented-control.context.js +12 -0
- package/dist/components/segmented-control/segmented-control.context.js.map +1 -0
- package/dist/components/segmented-control/segmented-control.d.ts +41 -0
- package/dist/components/segmented-control/segmented-control.js +68 -0
- package/dist/components/segmented-control/segmented-control.js.map +1 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/select.d.ts +31 -0
- package/dist/components/select/select.js +48 -0
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/table.d.ts +53 -0
- package/dist/components/table/table.js +110 -0
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/tabs.context.d.ts +4 -0
- package/dist/components/tabs/tabs.context.js +12 -0
- package/dist/components/tabs/tabs.context.js.map +1 -0
- package/dist/components/tabs/tabs.d.ts +60 -0
- package/dist/components/tabs/tabs.js +158 -0
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/textarea.d.ts +37 -0
- package/dist/components/textarea/textarea.js +48 -0
- package/dist/components/textarea/textarea.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +3 -0
- package/dist/components/tooltip/tooltip.context.d.ts +4 -0
- package/dist/components/tooltip/tooltip.context.js +15 -0
- package/dist/components/tooltip/tooltip.context.js.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +53 -0
- package/dist/components/tooltip/tooltip.js +83 -0
- package/dist/components/tooltip/tooltip.js.map +1 -0
- package/dist/components/visually-hidden/index.d.ts +2 -0
- package/dist/components/visually-hidden/visually-hidden.d.ts +9 -0
- package/dist/components/visually-hidden/visually-hidden.js +21 -0
- package/dist/components/visually-hidden/visually-hidden.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +38 -0
- package/dist/provider/hui-provider.context.d.ts +104 -0
- package/dist/provider/hui-provider.context.js +36 -0
- package/dist/provider/hui-provider.context.js.map +1 -0
- package/dist/provider/hui-provider.d.ts +8 -0
- package/dist/provider/hui-provider.js +17 -0
- package/dist/provider/hui-provider.js.map +1 -0
- package/dist/provider/index.d.ts +3 -0
- package/dist/provider/merge-props.js +16 -0
- package/dist/provider/merge-props.js.map +1 -0
- package/dist/types/hui-component.d.ts +8 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/polymorphic.d.ts +13 -0
- package/dist/utils/attributes/normalize-attributes.js +18 -0
- package/dist/utils/attributes/normalize-attributes.js.map +1 -0
- package/package.json +54 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 wancup
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @hebium-ui/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React bindings for the Hebium UI core components.
|
|
4
|
+
|
|
5
|
+
> [!WARNING]
|
|
6
|
+
> Hebium UI is under active development. Its APIs may change without notice, including breaking changes.
|
|
7
|
+
|
|
8
|
+
The source repository is currently private. Public release is planned, but no timeline has been set.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { HuiComponentProps } from "../../types/hui-component.js";
|
|
2
|
+
import "../../types/index.js";
|
|
3
|
+
import { AlertSlots, AlertVariants } from "@hebium-ui/core";
|
|
4
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
5
|
+
//#region src/components/alert/alert.d.ts
|
|
6
|
+
interface AlertOwnProps extends Omit<ComponentProps<"div">, "children"> {
|
|
7
|
+
/**
|
|
8
|
+
* The main message displayed in the alert.
|
|
9
|
+
*/
|
|
10
|
+
message?: ReactNode | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* The description displayed below the alert message.
|
|
13
|
+
*/
|
|
14
|
+
description?: ReactNode | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The icon displayed beside the alert content. Set to `null` or `false` to hide the icon.
|
|
17
|
+
*
|
|
18
|
+
* @default error icon
|
|
19
|
+
*/
|
|
20
|
+
icon?: ReactNode | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* The visual style of the alert.
|
|
23
|
+
*
|
|
24
|
+
* @default "light"
|
|
25
|
+
*/
|
|
26
|
+
variant?: AlertVariants["variant"] | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The semantic color of the alert.
|
|
29
|
+
*
|
|
30
|
+
* @default "danger"
|
|
31
|
+
*/
|
|
32
|
+
color?: AlertVariants["color"] | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* The padding of the alert.
|
|
35
|
+
*
|
|
36
|
+
* @default "md"
|
|
37
|
+
*/
|
|
38
|
+
padding?: AlertVariants["padding"] | undefined;
|
|
39
|
+
}
|
|
40
|
+
export type AlertProps = HuiComponentProps<AlertOwnProps, AlertSlots>;
|
|
41
|
+
export declare function Alert(rawProps: AlertProps): ReactElement;
|
|
42
|
+
//#endregion
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=alert.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { alertRecipe } from "@hebium-ui/core";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/alert/alert.tsx
|
|
5
|
+
function Alert(rawProps) {
|
|
6
|
+
const { classNames, styles, description, icon, variant, color, padding, message, ...restProps } = useHuiProps("Alert", rawProps);
|
|
7
|
+
const recipe = alertRecipe({
|
|
8
|
+
variant,
|
|
9
|
+
color,
|
|
10
|
+
padding
|
|
11
|
+
});
|
|
12
|
+
const cls = useHuiClassNames("Alert", recipe, classNames);
|
|
13
|
+
const sls = useHuiStyles("Alert", styles);
|
|
14
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
15
|
+
className: cls.root,
|
|
16
|
+
style: sls.root,
|
|
17
|
+
role: "alert",
|
|
18
|
+
...restProps,
|
|
19
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
20
|
+
className: cls.icon,
|
|
21
|
+
style: sls.icon,
|
|
22
|
+
children: typeof icon === "undefined" ? /* @__PURE__ */ jsx("span", {
|
|
23
|
+
"aria-hidden": true,
|
|
24
|
+
className: cls.errorIcon,
|
|
25
|
+
style: sls.errorIcon
|
|
26
|
+
}) : icon
|
|
27
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
28
|
+
className: cls.content,
|
|
29
|
+
style: sls.content,
|
|
30
|
+
children: [message && /* @__PURE__ */ jsx("div", {
|
|
31
|
+
className: cls.message,
|
|
32
|
+
style: sls.message,
|
|
33
|
+
children: message
|
|
34
|
+
}), description && /* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: cls.description,
|
|
36
|
+
style: sls.description,
|
|
37
|
+
children: description
|
|
38
|
+
})]
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { Alert };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.js","names":[],"sources":["../../../src/components/alert/alert.tsx"],"sourcesContent":["import { alertRecipe, type AlertSlots, type AlertVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement, type ReactNode } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface AlertOwnProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n /**\n * The main message displayed in the alert.\n */\n message?: ReactNode | undefined;\n /**\n * The description displayed below the alert message.\n */\n description?: ReactNode | undefined;\n /**\n * The icon displayed beside the alert content. Set to `null` or `false` to hide the icon.\n *\n * @default error icon\n */\n icon?: ReactNode | undefined;\n /**\n * The visual style of the alert.\n *\n * @default \"light\"\n */\n variant?: AlertVariants[\"variant\"] | undefined;\n /**\n * The semantic color of the alert.\n *\n * @default \"danger\"\n */\n color?: AlertVariants[\"color\"] | undefined;\n /**\n * The padding of the alert.\n *\n * @default \"md\"\n */\n padding?: AlertVariants[\"padding\"] | undefined;\n}\n\nexport type AlertProps = HuiComponentProps<\n AlertOwnProps,\n AlertSlots\n>;\n\nexport function Alert(rawProps: AlertProps): ReactElement {\n const {\n classNames,\n styles,\n description,\n icon,\n variant,\n color,\n padding,\n message,\n ...restProps\n } = useHuiProps(\"Alert\", rawProps);\n\n const recipe = alertRecipe({\n variant,\n color,\n padding,\n });\n const cls = useHuiClassNames(\"Alert\", recipe, classNames);\n const sls = useHuiStyles(\"Alert\", styles);\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n role=\"alert\"\n {...restProps}\n >\n <div className={cls.icon} style={sls.icon}>\n {typeof icon === \"undefined\"\n ? (\n <span\n aria-hidden\n className={cls.errorIcon}\n style={sls.errorIcon}\n />\n )\n : icon}\n </div>\n <div className={cls.content} style={sls.content}>\n {message && <div className={cls.message} style={sls.message}>{message}</div>}\n {description\n && (\n <div className={cls.description} style={sls.description}>\n {description}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AA6CA,SAAgB,MAAM,UAAoC;CACxD,MAAM,EACJ,YACA,QACA,aACA,MACA,SACA,OACA,SACA,SACA,GAAG,cACD,YAAY,SAAS,QAAQ;CAEjC,MAAM,SAAS,YAAY;EACzB;EACA;EACA;CACF,CAAC;CACD,MAAM,MAAM,iBAAiB,SAAS,QAAQ,UAAU;CACxD,MAAM,MAAM,aAAa,SAAS,MAAM;CAExC,OACE,qBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,MAAK;EACL,GAAI;EAJN,UAAA,CAME,oBAAC,OAAD;GAAK,WAAW,IAAI;GAAM,OAAO,IAAI;GAClC,UAAA,OAAO,SAAS,cAEb,oBAAC,QAAD;IACE,eAAA;IACA,WAAW,IAAI;IACf,OAAO,IAAI;GACZ,CAAA,IAED;EACD,CAAA,GACL,qBAAC,OAAD;GAAK,WAAW,IAAI;GAAS,OAAO,IAAI;GAAxC,UAAA,CACG,WAAW,oBAAC,OAAD;IAAK,WAAW,IAAI;IAAS,OAAO,IAAI;IAAU,UAAA;GAAa,CAAA,GAC1E,eAEG,oBAAC,OAAD;IAAK,WAAW,IAAI;IAAa,OAAO,IAAI;IACzC,UAAA;GACE,CAAA,CAEN;EACF,CAAA,CAAA;;AAET"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { HuiPolymorphicProps } from "../../types/polymorphic.js";
|
|
2
|
+
import "../../types/index.js";
|
|
3
|
+
import { AnchorSlots, AnchorVariants } from "@hebium-ui/core";
|
|
4
|
+
import { ElementType, ReactElement } from "react";
|
|
5
|
+
//#region src/components/anchor/anchor.d.ts
|
|
6
|
+
interface AnchorOwnProps {
|
|
7
|
+
/**
|
|
8
|
+
* The semantic color of the anchor.
|
|
9
|
+
*
|
|
10
|
+
* @default "accent"
|
|
11
|
+
*/
|
|
12
|
+
color?: AnchorVariants["color"] | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The marker displayed before or after the anchor text.
|
|
15
|
+
* Override `--hui-anchor-marker` to customize the marker content.
|
|
16
|
+
* Include quotes in the CSS variable value because it is used as CSS `content`.
|
|
17
|
+
*/
|
|
18
|
+
marker?: AnchorVariants["marker"] | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* The text decoration style of the anchor.
|
|
21
|
+
*
|
|
22
|
+
* @default "underline"
|
|
23
|
+
*/
|
|
24
|
+
decoration?: AnchorVariants["decoration"] | undefined;
|
|
25
|
+
}
|
|
26
|
+
export type AnchorProps<E extends ElementType = "a"> = HuiPolymorphicProps<E, AnchorOwnProps, AnchorSlots>;
|
|
27
|
+
export declare function Anchor<E extends ElementType = "a">(rawProps: AnchorProps<E>): ReactElement;
|
|
28
|
+
//#endregion
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=anchor.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { anchorRecipe } from "@hebium-ui/core";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/anchor/anchor.tsx
|
|
5
|
+
function Anchor(rawProps) {
|
|
6
|
+
const { as, color, marker, decoration, className, style, children, ...restProps } = useHuiProps("Anchor", rawProps);
|
|
7
|
+
const recipe = anchorRecipe({
|
|
8
|
+
color,
|
|
9
|
+
marker,
|
|
10
|
+
decoration
|
|
11
|
+
});
|
|
12
|
+
const Component = as ?? "a";
|
|
13
|
+
const cls = useHuiClassNames("Anchor", recipe, { root: className });
|
|
14
|
+
const sls = useHuiStyles("Anchor", { root: style });
|
|
15
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
16
|
+
className: cls.root,
|
|
17
|
+
style: sls.root,
|
|
18
|
+
...restProps,
|
|
19
|
+
children
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Anchor };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=anchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchor.js","names":[],"sources":["../../../src/components/anchor/anchor.tsx"],"sourcesContent":["import { anchorRecipe, type AnchorSlots, type AnchorVariants } from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface AnchorOwnProps {\n /**\n * The semantic color of the anchor.\n *\n * @default \"accent\"\n */\n color?: AnchorVariants[\"color\"] | undefined;\n /**\n * The marker displayed before or after the anchor text.\n * Override `--hui-anchor-marker` to customize the marker content.\n * Include quotes in the CSS variable value because it is used as CSS `content`.\n */\n marker?: AnchorVariants[\"marker\"] | undefined;\n /**\n * The text decoration style of the anchor.\n *\n * @default \"underline\"\n */\n decoration?: AnchorVariants[\"decoration\"] | undefined;\n}\n\nexport type AnchorProps<E extends ElementType = \"a\"> = HuiPolymorphicProps<\n E,\n AnchorOwnProps,\n AnchorSlots\n>;\n\nexport function Anchor<E extends ElementType = \"a\">(rawProps: AnchorProps<E>): ReactElement {\n const {\n as,\n color,\n marker,\n decoration,\n className,\n style,\n children,\n ...restProps\n } = useHuiProps(\"Anchor\", rawProps);\n\n const recipe = anchorRecipe({ color, marker, decoration });\n const Component = as ?? \"a\";\n\n const cls = useHuiClassNames(\"Anchor\", recipe, { root: className });\n const sls = useHuiStyles(\"Anchor\", { 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":";;;;AAgCA,SAAgB,OAAoC,UAAwC;CAC1F,MAAM,EACJ,IACA,OACA,QACA,YACA,WACA,OACA,UACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,SAAS,aAAa;EAAE;EAAO;EAAQ;CAAW,CAAC;CACzD,MAAM,YAAY,MAAM;CAExB,MAAM,MAAM,iBAAiB,UAAU,QAAQ,EAAE,MAAM,UAAU,CAAC;CAClE,MAAM,MAAM,aAAa,UAAU,EAAE,MAAM,MAAM,CAAC;CAElD,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HuiComponentProps } from "../../types/hui-component.js";
|
|
2
|
+
import "../../types/index.js";
|
|
3
|
+
import { AvatarSlots } from "@hebium-ui/core";
|
|
4
|
+
import { ComponentProps, ReactElement } from "react";
|
|
5
|
+
//#region src/components/avatar/avatar.d.ts
|
|
6
|
+
interface AvatarOwnProps extends ComponentProps<"img"> {
|
|
7
|
+
/**
|
|
8
|
+
* The name represented by the avatar. It is used as the default image alternative text and to generate placeholder initials.
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
export type AvatarProps = HuiComponentProps<AvatarOwnProps, AvatarSlots>;
|
|
13
|
+
export declare function Avatar(rawProps: AvatarProps): ReactElement;
|
|
14
|
+
//#endregion
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { avatartRecipe, getAvatarPlaceholder, shouldShowAvatarPlaceholder } from "@hebium-ui/core";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/avatar/avatar.tsx
|
|
6
|
+
function Avatar(rawProps) {
|
|
7
|
+
const { classNames, styles, name, src, srcSet, alt, onError, ...restProps } = useHuiProps("Avatar", rawProps);
|
|
8
|
+
const [failedSource, setFailedSource] = useState(null);
|
|
9
|
+
const shouldShowPlaceholder = shouldShowAvatarPlaceholder({
|
|
10
|
+
src,
|
|
11
|
+
srcSet,
|
|
12
|
+
failedSource
|
|
13
|
+
});
|
|
14
|
+
const recipe = avatartRecipe({ background: shouldShowPlaceholder ? "box" : "transparent" });
|
|
15
|
+
const cls = useHuiClassNames("Avatar", recipe, classNames);
|
|
16
|
+
const sls = useHuiStyles("Avatar", styles);
|
|
17
|
+
const handleOnError = useCallback((e) => {
|
|
18
|
+
onError?.(e);
|
|
19
|
+
setFailedSource({
|
|
20
|
+
src,
|
|
21
|
+
srcSet
|
|
22
|
+
});
|
|
23
|
+
}, [
|
|
24
|
+
onError,
|
|
25
|
+
src,
|
|
26
|
+
srcSet
|
|
27
|
+
]);
|
|
28
|
+
const placeholder = getAvatarPlaceholder(name);
|
|
29
|
+
return /* @__PURE__ */ jsx("div", {
|
|
30
|
+
className: cls.root,
|
|
31
|
+
style: sls.root,
|
|
32
|
+
children: shouldShowPlaceholder ? /* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: cls.placeholder,
|
|
34
|
+
style: sls.placeholder,
|
|
35
|
+
children: placeholder
|
|
36
|
+
}) : /* @__PURE__ */ jsx("img", {
|
|
37
|
+
className: cls.img,
|
|
38
|
+
style: sls.img,
|
|
39
|
+
src,
|
|
40
|
+
srcSet,
|
|
41
|
+
...restProps,
|
|
42
|
+
alt: alt ?? name,
|
|
43
|
+
onError: handleOnError
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { Avatar };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.js","names":[],"sources":["../../../src/components/avatar/avatar.tsx"],"sourcesContent":["import {\n type AvatarSlots,\n type AvatarSource,\n avatartRecipe,\n getAvatarPlaceholder,\n shouldShowAvatarPlaceholder,\n} from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement, useCallback, useState } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface AvatarOwnProps extends ComponentProps<\"img\"> {\n /**\n * The name represented by the avatar. It is used as the default image alternative text and to generate placeholder initials.\n */\n name: string;\n}\n\nexport type AvatarProps = HuiComponentProps<\n AvatarOwnProps,\n AvatarSlots\n>;\n\nexport function Avatar(rawProps: AvatarProps): ReactElement {\n const {\n classNames,\n styles,\n name,\n src,\n srcSet,\n alt,\n onError,\n ...restProps\n } = useHuiProps(\"Avatar\", rawProps);\n\n const [failedSource, setFailedSource] = useState<AvatarSource | null>(null);\n const shouldShowPlaceholder = shouldShowAvatarPlaceholder({ src, srcSet, failedSource });\n\n const recipe = avatartRecipe({\n background: shouldShowPlaceholder ? \"box\" : \"transparent\",\n });\n\n const cls = useHuiClassNames(\"Avatar\", recipe, classNames);\n const sls = useHuiStyles(\"Avatar\", styles);\n\n const handleOnError = useCallback((e: React.SyntheticEvent<HTMLImageElement, Event>) => {\n onError?.(e);\n\n setFailedSource({ src, srcSet });\n }, [onError, src, srcSet]);\n\n const placeholder = getAvatarPlaceholder(name);\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n >\n {shouldShowPlaceholder\n ? (\n <span\n className={cls.placeholder}\n style={sls.placeholder}\n >\n {placeholder}\n </span>\n )\n : (\n <img\n className={cls.img}\n style={sls.img}\n src={src}\n srcSet={srcSet}\n {...restProps}\n alt={alt ?? name}\n onError={handleOnError}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;AAuBA,SAAgB,OAAO,UAAqC;CAC1D,MAAM,EACJ,YACA,QACA,MACA,KACA,QACA,KACA,SACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,CAAC,cAAc,mBAAmB,SAA8B,IAAI;CAC1E,MAAM,wBAAwB,4BAA4B;EAAE;EAAK;EAAQ;CAAa,CAAC;CAEvF,MAAM,SAAS,cAAc,EAC3B,YAAY,wBAAwB,QAAQ,cAC9C,CAAC;CAED,MAAM,MAAM,iBAAiB,UAAU,QAAQ,UAAU;CACzD,MAAM,MAAM,aAAa,UAAU,MAAM;CAEzC,MAAM,gBAAgB,aAAa,MAAqD;EACtF,UAAU,CAAC;EAEX,gBAAgB;GAAE;GAAK;EAAO,CAAC;CACjC,GAAG;EAAC;EAAS;EAAK;CAAM,CAAC;CAEzB,MAAM,cAAc,qBAAqB,IAAI;CAE7C,OACE,oBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAEV,UAAA,wBAEG,oBAAC,QAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GAEV,UAAA;EACG,CAAA,IAGN,oBAAC,OAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACN;GACG;GACR,GAAI;GACJ,KAAK,OAAO;GACZ,SAAS;EACV,CAAA;CAEF,CAAA;AAET"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HuiComponentProps } from "../../types/hui-component.js";
|
|
2
|
+
import "../../types/index.js";
|
|
3
|
+
import { BlockquoteSlots, BlockquoteVariants } from "@hebium-ui/core";
|
|
4
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
5
|
+
//#region src/components/blockquote/blockquote.d.ts
|
|
6
|
+
type HtmlBlockquoteProps = ComponentProps<"blockquote">;
|
|
7
|
+
type HtmlFigcaptionProps = Omit<ComponentProps<"figcaption">, "children" | "className" | "style">;
|
|
8
|
+
interface BlockquoteOwnProps extends Omit<HtmlBlockquoteProps, "color"> {
|
|
9
|
+
/**
|
|
10
|
+
* The semantic color of the blockquote accent.
|
|
11
|
+
*
|
|
12
|
+
* @default "neutral"
|
|
13
|
+
*/
|
|
14
|
+
color?: BlockquoteVariants["color"] | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The citation or attribution displayed below the quote.
|
|
17
|
+
*/
|
|
18
|
+
caption?: ReactNode | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Additional props passed to the caption element.
|
|
21
|
+
*/
|
|
22
|
+
captionProps?: HtmlFigcaptionProps | undefined;
|
|
23
|
+
}
|
|
24
|
+
export type BlockquoteProps = HuiComponentProps<BlockquoteOwnProps, BlockquoteSlots>;
|
|
25
|
+
export declare function Blockquote(rawProps: BlockquoteProps): ReactElement;
|
|
26
|
+
//#endregion
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=blockquote.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { blockquoteRecipe } from "@hebium-ui/core";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/blockquote/blockquote.tsx
|
|
5
|
+
function Blockquote(rawProps) {
|
|
6
|
+
const { color, caption, captionProps, classNames, styles, children, ...restProps } = useHuiProps("Blockquote", rawProps);
|
|
7
|
+
const recipe = blockquoteRecipe({ color });
|
|
8
|
+
const cls = useHuiClassNames("Blockquote", recipe, classNames);
|
|
9
|
+
const sls = useHuiStyles("Blockquote", styles);
|
|
10
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
11
|
+
className: cls.root,
|
|
12
|
+
style: sls.root,
|
|
13
|
+
children: [/* @__PURE__ */ jsx("blockquote", {
|
|
14
|
+
className: cls.blockquote,
|
|
15
|
+
style: sls.blockquote,
|
|
16
|
+
...restProps,
|
|
17
|
+
children
|
|
18
|
+
}), caption != null && /* @__PURE__ */ jsx("figcaption", {
|
|
19
|
+
className: cls.caption,
|
|
20
|
+
style: sls.caption,
|
|
21
|
+
...captionProps,
|
|
22
|
+
children: caption
|
|
23
|
+
})]
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { Blockquote };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=blockquote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockquote.js","names":[],"sources":["../../../src/components/blockquote/blockquote.tsx"],"sourcesContent":["import { blockquoteRecipe, type BlockquoteSlots, type BlockquoteVariants } from \"@hebium-ui/core\";\nimport { type ComponentProps, type ReactElement, type ReactNode } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ntype HtmlBlockquoteProps = ComponentProps<\"blockquote\">;\ntype HtmlFigcaptionProps = Omit<ComponentProps<\"figcaption\">, \"children\" | \"className\" | \"style\">;\n\ninterface BlockquoteOwnProps extends Omit<HtmlBlockquoteProps, \"color\"> {\n /**\n * The semantic color of the blockquote accent.\n *\n * @default \"neutral\"\n */\n color?: BlockquoteVariants[\"color\"] | undefined;\n /**\n * The citation or attribution displayed below the quote.\n */\n caption?: ReactNode | undefined;\n /**\n * Additional props passed to the caption element.\n */\n captionProps?: HtmlFigcaptionProps | undefined;\n}\n\nexport type BlockquoteProps = HuiComponentProps<BlockquoteOwnProps, BlockquoteSlots>;\n\nexport function Blockquote(rawProps: BlockquoteProps): ReactElement {\n const {\n color,\n caption,\n captionProps,\n classNames,\n styles,\n children,\n ...restProps\n } = useHuiProps(\"Blockquote\", rawProps);\n\n const recipe = blockquoteRecipe({ color });\n const cls = useHuiClassNames(\"Blockquote\", recipe, classNames);\n const sls = useHuiStyles(\"Blockquote\", styles);\n\n return (\n <figure\n className={cls.root}\n style={sls.root}\n >\n <blockquote\n className={cls.blockquote}\n style={sls.blockquote}\n {...restProps}\n >\n {children}\n </blockquote>\n {caption != null && (\n <figcaption\n className={cls.caption}\n style={sls.caption}\n {...captionProps}\n >\n {caption}\n </figcaption>\n )}\n </figure>\n );\n}\n"],"mappings":";;;;AA2BA,SAAgB,WAAW,UAAyC;CAClE,MAAM,EACJ,OACA,SACA,cACA,YACA,QACA,UACA,GAAG,cACD,YAAY,cAAc,QAAQ;CAEtC,MAAM,SAAS,iBAAiB,EAAE,MAAM,CAAC;CACzC,MAAM,MAAM,iBAAiB,cAAc,QAAQ,UAAU;CAC7D,MAAM,MAAM,aAAa,cAAc,MAAM;CAE7C,OACE,qBAAC,UAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIE,oBAAC,cAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH;EACS,CAAA,GACX,WAAW,QACV,oBAAC,cAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH,UAAA;EACS,CAAA,CAER;;AAEZ"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { HuiPolymorphicProps } from "../../types/polymorphic.js";
|
|
2
|
+
import "../../types/index.js";
|
|
3
|
+
import { ButtonSlots, ButtonVariants } from "@hebium-ui/core";
|
|
4
|
+
import { ElementType, ReactElement } from "react";
|
|
5
|
+
//#region src/components/button/button.d.ts
|
|
6
|
+
interface ButtonOwnProps {
|
|
7
|
+
/**
|
|
8
|
+
* The visual style of the button.
|
|
9
|
+
*
|
|
10
|
+
* @default "solid"
|
|
11
|
+
*/
|
|
12
|
+
variant?: ButtonVariants["variant"] | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The semantic color of the button.
|
|
15
|
+
*
|
|
16
|
+
* @default "accent"
|
|
17
|
+
*/
|
|
18
|
+
color?: ButtonVariants["color"] | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* The shape of the button.
|
|
21
|
+
*
|
|
22
|
+
* @default "rectangle"
|
|
23
|
+
*/
|
|
24
|
+
shape?: ButtonVariants["shape"] | undefined;
|
|
25
|
+
}
|
|
26
|
+
export type ButtonProps<E extends ElementType = "button"> = HuiPolymorphicProps<E, ButtonOwnProps, ButtonSlots>;
|
|
27
|
+
export declare function Button<E extends ElementType = "button">(rawProps: ButtonProps<E>): ReactElement;
|
|
28
|
+
//#endregion
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { buttonRecipe } from "@hebium-ui/core";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/button/button.tsx
|
|
5
|
+
function Button(rawProps) {
|
|
6
|
+
const { as, variant, color, shape, className, style, children, ...restProps } = useHuiProps("Button", rawProps);
|
|
7
|
+
const Component = as ?? "button";
|
|
8
|
+
const recipe = buttonRecipe({
|
|
9
|
+
variant,
|
|
10
|
+
color,
|
|
11
|
+
shape
|
|
12
|
+
});
|
|
13
|
+
const cls = useHuiClassNames("Button", recipe, { root: className });
|
|
14
|
+
const sls = useHuiStyles("Button", { root: style });
|
|
15
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
16
|
+
className: cls.root,
|
|
17
|
+
style: sls.root,
|
|
18
|
+
...restProps,
|
|
19
|
+
children
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Button };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","names":[],"sources":["../../../src/components/button/button.tsx"],"sourcesContent":["import { buttonRecipe, type ButtonSlots, type ButtonVariants } from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface ButtonOwnProps {\n /**\n * The visual style of the button.\n *\n * @default \"solid\"\n */\n variant?: ButtonVariants[\"variant\"] | undefined;\n /**\n * The semantic color of the button.\n *\n * @default \"accent\"\n */\n color?: ButtonVariants[\"color\"] | undefined;\n /**\n * The shape of the button.\n *\n * @default \"rectangle\"\n */\n shape?: ButtonVariants[\"shape\"] | undefined;\n}\n\nexport type ButtonProps<E extends ElementType = \"button\"> = HuiPolymorphicProps<\n E,\n ButtonOwnProps,\n ButtonSlots\n>;\n\nexport function Button<E extends ElementType = \"button\">(rawProps: ButtonProps<E>): ReactElement {\n const {\n as,\n variant,\n color,\n shape,\n className,\n style,\n children,\n ...restProps\n } = useHuiProps(\"Button\", rawProps);\n\n const Component = as ?? \"button\";\n const recipe = buttonRecipe({\n variant,\n color,\n shape,\n });\n const cls = useHuiClassNames(\"Button\", recipe, { root: className });\n const sls = useHuiStyles(\"Button\", { 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":";;;;AAgCA,SAAgB,OAAyC,UAAwC;CAC/F,MAAM,EACJ,IACA,SACA,OACA,OACA,WACA,OACA,UACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,YAAY,MAAM;CACxB,MAAM,SAAS,aAAa;EAC1B;EACA;EACA;CACF,CAAC;CACD,MAAM,MAAM,iBAAiB,UAAU,QAAQ,EAAE,MAAM,UAAU,CAAC;CAClE,MAAM,MAAM,aAAa,UAAU,EAAE,MAAM,MAAM,CAAC;CAElD,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { HuiComponentProps } from "../../types/hui-component.js";
|
|
2
|
+
import "../../types/index.js";
|
|
3
|
+
import { CheckboxSlots, CheckboxVariants } from "@hebium-ui/core";
|
|
4
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
5
|
+
//#region src/components/checkbox/checkbox.d.ts
|
|
6
|
+
type HtmlInputProps = Omit<ComponentProps<"input">, "children" | "type">;
|
|
7
|
+
interface CheckboxOwnProps extends HtmlInputProps {
|
|
8
|
+
/**
|
|
9
|
+
* The label displayed next to the checkbox.
|
|
10
|
+
*/
|
|
11
|
+
label?: ReactNode | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The validation error message displayed below the label.
|
|
14
|
+
*/
|
|
15
|
+
error?: ReactNode | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* The semantic color of the checkbox control.
|
|
18
|
+
*
|
|
19
|
+
* @default "accent"
|
|
20
|
+
*/
|
|
21
|
+
color?: CheckboxVariants["color"] | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the checkbox is displayed in an indeterminate state.
|
|
24
|
+
*
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
indeterminate?: boolean | undefined;
|
|
28
|
+
}
|
|
29
|
+
export type CheckboxProps = HuiComponentProps<CheckboxOwnProps, CheckboxSlots>;
|
|
30
|
+
export declare function Checkbox(rawProps: CheckboxProps): ReactElement;
|
|
31
|
+
//#endregion
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { normalizeAttributes } from "../../utils/attributes/normalize-attributes.js";
|
|
3
|
+
import { checkboxControl, checkboxRecipe, toBool, toStrbool } from "@hebium-ui/core";
|
|
4
|
+
import { useEffect, useId, useImperativeHandle, useRef } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/checkbox/checkbox.tsx
|
|
7
|
+
function Checkbox(rawProps) {
|
|
8
|
+
const { id, classNames, styles, label, error, color, indeterminate, ref, ...restProps } = useHuiProps("Checkbox", rawProps);
|
|
9
|
+
const tmpId = useId();
|
|
10
|
+
const internalRef = useRef(null);
|
|
11
|
+
useImperativeHandle(ref, () => {
|
|
12
|
+
const input = internalRef.current;
|
|
13
|
+
if (input === null) throw new Error("[Hebium UI] Checkbox input ref is not attached");
|
|
14
|
+
return input;
|
|
15
|
+
}, []);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (internalRef.current) internalRef.current.indeterminate = !!indeterminate;
|
|
18
|
+
}, [indeterminate]);
|
|
19
|
+
const checkboxState = {
|
|
20
|
+
id: id ?? tmpId,
|
|
21
|
+
invalid: !!error,
|
|
22
|
+
indeterminate: !!indeterminate,
|
|
23
|
+
disabled: toBool(restProps.disabled) || toBool(restProps["aria-disabled"])
|
|
24
|
+
};
|
|
25
|
+
const recipe = checkboxRecipe({
|
|
26
|
+
color,
|
|
27
|
+
icon: indeterminate ? "indeterminate" : "check",
|
|
28
|
+
error: toStrbool(checkboxState.invalid)
|
|
29
|
+
});
|
|
30
|
+
const cls = useHuiClassNames("Checkbox", recipe, classNames);
|
|
31
|
+
const sls = useHuiStyles("Checkbox", styles);
|
|
32
|
+
const controlAttrs = normalizeAttributes(checkboxControl.getControlAttributes(checkboxState));
|
|
33
|
+
const labelAttrs = normalizeAttributes(checkboxControl.getLabelAttributes(checkboxState));
|
|
34
|
+
const errorAttrs = checkboxControl.getErrorAttributes(checkboxState);
|
|
35
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
36
|
+
className: cls.root,
|
|
37
|
+
style: sls.root,
|
|
38
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
39
|
+
ref: internalRef,
|
|
40
|
+
className: cls.checkbox,
|
|
41
|
+
style: sls.checkbox,
|
|
42
|
+
...controlAttrs,
|
|
43
|
+
...restProps
|
|
44
|
+
}), /* @__PURE__ */ jsxs("div", { children: [label && /* @__PURE__ */ jsx("label", {
|
|
45
|
+
className: cls.label,
|
|
46
|
+
style: sls.label,
|
|
47
|
+
...labelAttrs,
|
|
48
|
+
children: label
|
|
49
|
+
}), error && /* @__PURE__ */ jsxs("p", {
|
|
50
|
+
className: cls.error,
|
|
51
|
+
style: sls?.error,
|
|
52
|
+
...errorAttrs,
|
|
53
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
54
|
+
"aria-hidden": true,
|
|
55
|
+
className: cls.errorIcon,
|
|
56
|
+
style: sls.errorIcon
|
|
57
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
58
|
+
className: cls.errorMessage,
|
|
59
|
+
style: sls.errorMessage,
|
|
60
|
+
children: error
|
|
61
|
+
})]
|
|
62
|
+
})] })]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { Checkbox };
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":[],"sources":["../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import {\n checkboxControl,\n checkboxRecipe,\n type CheckboxSlots,\n type CheckboxVariants,\n toBool,\n toStrbool,\n} from \"@hebium-ui/core\";\nimport {\n type ComponentProps,\n type ReactElement,\n type ReactNode,\n useEffect,\n useId,\n useImperativeHandle,\n useRef,\n} from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\nimport { normalizeAttributes } from \"~/utils\";\n\ntype HtmlInputProps = Omit<ComponentProps<\"input\">, \"children\" | \"type\">;\n\ninterface CheckboxOwnProps extends HtmlInputProps {\n /**\n * The label displayed next to the checkbox.\n */\n label?: ReactNode | undefined;\n /**\n * The validation error message displayed below the label.\n */\n error?: ReactNode | undefined;\n /**\n * The semantic color of the checkbox control.\n *\n * @default \"accent\"\n */\n color?: CheckboxVariants[\"color\"] | undefined;\n /**\n * Whether the checkbox is displayed in an indeterminate state.\n *\n * @default false\n */\n indeterminate?: boolean | undefined;\n}\n\nexport type CheckboxProps = HuiComponentProps<\n CheckboxOwnProps,\n CheckboxSlots\n>;\n\nexport function Checkbox(rawProps: CheckboxProps): ReactElement {\n const {\n id,\n classNames,\n styles,\n label,\n error,\n color,\n indeterminate,\n ref,\n ...restProps\n } = useHuiProps(\"Checkbox\", rawProps);\n\n const tmpId = useId();\n const internalRef = useRef<HTMLInputElement>(null);\n\n useImperativeHandle(ref, () => {\n const input = internalRef.current;\n if (input === null) {\n throw new Error(\"[Hebium UI] Checkbox input ref is not attached\");\n }\n return input;\n }, []);\n\n useEffect(() => {\n if (internalRef.current) {\n internalRef.current.indeterminate = !!indeterminate;\n }\n }, [indeterminate]);\n\n const checkboxState = {\n id: id ?? tmpId,\n invalid: !!error,\n indeterminate: !!indeterminate,\n disabled: toBool(restProps.disabled) || toBool(restProps[\"aria-disabled\"]),\n };\n const recipe = checkboxRecipe({\n color,\n icon: indeterminate ? \"indeterminate\" : \"check\",\n error: toStrbool(checkboxState.invalid),\n });\n const cls = useHuiClassNames(\"Checkbox\", recipe, classNames);\n const sls = useHuiStyles(\"Checkbox\", styles);\n const controlAttrs = normalizeAttributes(checkboxControl.getControlAttributes(checkboxState));\n const labelAttrs = normalizeAttributes(checkboxControl.getLabelAttributes(checkboxState));\n const errorAttrs = checkboxControl.getErrorAttributes(checkboxState);\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n >\n <input\n ref={internalRef}\n className={cls.checkbox}\n style={sls.checkbox}\n {...controlAttrs}\n {...restProps}\n />\n <div>\n {label && (\n <label\n className={cls.label}\n style={sls.label}\n {...labelAttrs}\n >\n {label}\n </label>\n )}\n {error && (\n <p\n className={cls.error}\n style={sls?.error}\n {...errorAttrs}\n >\n <span\n aria-hidden\n className={cls.errorIcon}\n style={sls.errorIcon}\n />\n <span\n className={cls.errorMessage}\n style={sls.errorMessage}\n >\n {error}\n </span>\n </p>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AAmDA,SAAgB,SAAS,UAAuC;CAC9D,MAAM,EACJ,IACA,YACA,QACA,OACA,OACA,OACA,eACA,KACA,GAAG,cACD,YAAY,YAAY,QAAQ;CAEpC,MAAM,QAAQ,MAAM;CACpB,MAAM,cAAc,OAAyB,IAAI;CAEjD,oBAAoB,WAAW;EAC7B,MAAM,QAAQ,YAAY;EAC1B,IAAI,UAAU,MACZ,MAAM,IAAI,MAAM,gDAAgD;EAElE,OAAO;CACT,GAAG,CAAC,CAAC;CAEL,gBAAgB;EACd,IAAI,YAAY,SACd,YAAY,QAAQ,gBAAgB,CAAC,CAAC;CAE1C,GAAG,CAAC,aAAa,CAAC;CAElB,MAAM,gBAAgB;EACpB,IAAI,MAAM;EACV,SAAS,CAAC,CAAC;EACX,eAAe,CAAC,CAAC;EACjB,UAAU,OAAO,UAAU,QAAQ,KAAK,OAAO,UAAU,gBAAgB;CAC3E;CACA,MAAM,SAAS,eAAe;EAC5B;EACA,MAAM,gBAAgB,kBAAkB;EACxC,OAAO,UAAU,cAAc,OAAO;CACxC,CAAC;CACD,MAAM,MAAM,iBAAiB,YAAY,QAAQ,UAAU;CAC3D,MAAM,MAAM,aAAa,YAAY,MAAM;CAC3C,MAAM,eAAe,oBAAoB,gBAAgB,qBAAqB,aAAa,CAAC;CAC5F,MAAM,aAAa,oBAAoB,gBAAgB,mBAAmB,aAAa,CAAC;CACxF,MAAM,aAAa,gBAAgB,mBAAmB,aAAa;CAEnE,OACE,qBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIE,oBAAC,SAAD;GACE,KAAK;GACL,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GACJ,GAAI;EACL,CAAA,GACD,qBAAC,OAAD,EAAA,UAAA,CACG,SACC,oBAAC,SAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH,UAAA;EACI,CAAA,GAER,SACC,qBAAC,KAAD;GACE,WAAW,IAAI;GACf,OAAO,KAAK;GACZ,GAAI;GAHN,UAAA,CAKE,oBAAC,QAAD;IACE,eAAA;IACA,WAAW,IAAI;IACf,OAAO,IAAI;GACZ,CAAA,GACD,oBAAC,QAAD;IACE,WAAW,IAAI;IACf,OAAO,IAAI;IAEV,UAAA;GACG,CAAA,CACL;EAEF,CAAA,CAAA,EAAA,CAAA,CACF;;AAET"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HuiPolymorphicProps } from "../../types/polymorphic.js";
|
|
2
|
+
import "../../types/index.js";
|
|
3
|
+
import { CodeSlots } from "@hebium-ui/core";
|
|
4
|
+
import { ElementType, ReactElement } from "react";
|
|
5
|
+
//#region src/components/code/code.d.ts
|
|
6
|
+
interface CodeOwnProps {}
|
|
7
|
+
export type CodeProps<E extends ElementType = "code"> = HuiPolymorphicProps<E, CodeOwnProps, CodeSlots>;
|
|
8
|
+
export declare function Code<E extends ElementType = "code">(rawProps: CodeProps<E>): ReactElement;
|
|
9
|
+
//#endregion
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=code.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useHuiClassNames, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { codeRecipe } from "@hebium-ui/core";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/code/code.tsx
|
|
5
|
+
function Code(rawProps) {
|
|
6
|
+
const { as, className, style, children, ...restProps } = useHuiProps("Code", rawProps);
|
|
7
|
+
const recipe = codeRecipe();
|
|
8
|
+
const Component = as ?? "code";
|
|
9
|
+
const cls = useHuiClassNames("Code", recipe, { root: className });
|
|
10
|
+
const sls = useHuiStyles("Code", { root: style });
|
|
11
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
12
|
+
className: cls.root,
|
|
13
|
+
style: sls.root,
|
|
14
|
+
...restProps,
|
|
15
|
+
children
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { Code };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.js","names":[],"sources":["../../../src/components/code/code.tsx"],"sourcesContent":["import { codeRecipe, type CodeSlots } from \"@hebium-ui/core\";\nimport { type ElementType, type ReactElement } from \"react\";\nimport { useHuiClassNames, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface CodeOwnProps {}\n\nexport type CodeProps<E extends ElementType = \"code\"> = HuiPolymorphicProps<\n E,\n CodeOwnProps,\n CodeSlots\n>;\n\nexport function Code<E extends ElementType = \"code\">(rawProps: CodeProps<E>): ReactElement {\n const {\n as,\n className,\n style,\n children,\n ...restProps\n } = useHuiProps(\"Code\", rawProps);\n\n const recipe = codeRecipe();\n const Component = as ?? \"code\";\n\n const cls = useHuiClassNames(\"Code\", recipe, { root: className });\n const sls = useHuiStyles(\"Code\", { root: style });\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n"],"mappings":";;;;AAaA,SAAgB,KAAqC,UAAsC;CACzF,MAAM,EACJ,IACA,WACA,OACA,UACA,GAAG,cACD,YAAY,QAAQ,QAAQ;CAEhC,MAAM,SAAS,WAAW;CAC1B,MAAM,YAAY,MAAM;CAExB,MAAM,MAAM,iBAAiB,QAAQ,QAAQ,EAAE,MAAM,UAAU,CAAC;CAChE,MAAM,MAAM,aAAa,QAAQ,EAAE,MAAM,MAAM,CAAC;CAChD,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HuiComponentProps } from "../../types/hui-component.js";
|
|
2
|
+
import "../../types/index.js";
|
|
3
|
+
import { DetailsSlots, DetailsVariants } from "@hebium-ui/core";
|
|
4
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
5
|
+
//#region src/components/details/details.d.ts
|
|
6
|
+
interface DetailsOwnProps extends ComponentProps<"details"> {
|
|
7
|
+
/**
|
|
8
|
+
* The summary displayed in the disclosure button.
|
|
9
|
+
*/
|
|
10
|
+
summary: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* The border style of the details container.
|
|
13
|
+
*
|
|
14
|
+
* @default "block"
|
|
15
|
+
*/
|
|
16
|
+
border?: DetailsVariants["border"] | undefined;
|
|
17
|
+
}
|
|
18
|
+
export type DetailsProps = HuiComponentProps<DetailsOwnProps, DetailsSlots>;
|
|
19
|
+
export declare function Details(rawProps: DetailsProps): ReactElement;
|
|
20
|
+
//#endregion
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=details.d.ts.map
|