@hebium-ui/preact 0.1.0-alpha.3 → 0.1.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/alert/alert.d.ts +3 -4
- package/dist/components/alert/alert.js +3 -10
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/anchor/anchor.d.ts +1 -2
- package/dist/components/anchor/anchor.js +1 -1
- package/dist/components/anchor/anchor.js.map +1 -1
- package/dist/components/avatar/avatar.d.ts +1 -2
- package/dist/components/avatar/avatar.js +2 -2
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/blockquote/blockquote.d.ts +1 -2
- package/dist/components/blockquote/blockquote.js +1 -1
- package/dist/components/blockquote/blockquote.js.map +1 -1
- package/dist/components/button/button.d.ts +12 -2
- package/dist/components/button/button.js +28 -8
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/checkbox/checkbox.d.ts +1 -2
- package/dist/components/checkbox/checkbox.js +2 -2
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/code/code.d.ts +1 -2
- package/dist/components/code/code.js +1 -1
- package/dist/components/code/code.js.map +1 -1
- package/dist/components/details/details.d.ts +1 -2
- package/dist/components/details/details.js +1 -1
- package/dist/components/details/details.js.map +1 -1
- package/dist/components/dialog/dialog.d.ts +4 -5
- package/dist/components/dialog/dialog.js +25 -12
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/dialog/index.d.ts +1 -2
- package/dist/components/dl/dl.d.ts +1 -2
- package/dist/components/dl/dl.js +3 -3
- package/dist/components/dl/dl.js.map +1 -1
- package/dist/components/drawer/drawer.d.ts +4 -5
- package/dist/components/drawer/drawer.js +25 -12
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/drawer/index.d.ts +1 -2
- package/dist/components/heading/heading.d.ts +1 -2
- package/dist/components/heading/heading.js +1 -1
- package/dist/components/heading/heading.js.map +1 -1
- package/dist/components/index.d.ts +7 -7
- package/dist/components/progress/progress.d.ts +1 -2
- package/dist/components/progress/progress.js +1 -1
- package/dist/components/progress/progress.js.map +1 -1
- package/dist/components/status-icon/index.d.ts +2 -0
- package/dist/components/status-icon/status-icon.d.ts +19 -0
- package/dist/components/status-icon/status-icon.js +22 -0
- package/dist/components/status-icon/status-icon.js.map +1 -0
- package/dist/components/tabs/tabs.context.d.ts +1 -2
- package/dist/components/tabs/tabs.d.ts +1 -2
- package/dist/components/tabs/tabs.js +5 -5
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -3
- package/dist/provider/hui-provider.context.d.ts +12 -8
- package/dist/provider/hui-provider.context.js +11 -7
- package/dist/provider/hui-provider.context.js.map +1 -1
- package/dist/provider/hui-provider.d.ts +1 -2
- package/dist/provider/index.d.ts +1 -1
- package/dist/types/hui-component.d.ts +3 -3
- package/dist/types/index.d.ts +2 -2
- package/dist/types/polymorphic.d.ts +7 -5
- package/package.json +11 -11
- package/dist/components/dialog/dialog.context.d.ts +0 -2
- package/dist/components/drawer/drawer.context.d.ts +0 -2
|
@@ -12,9 +12,9 @@ interface AlertOwnProps {
|
|
|
12
12
|
*/
|
|
13
13
|
description?: ComponentChildren | undefined;
|
|
14
14
|
/**
|
|
15
|
-
* The
|
|
15
|
+
* The alert icon. Set to `null` or `false` to hide.
|
|
16
16
|
*
|
|
17
|
-
* @default error
|
|
17
|
+
* @default StatusIcon with status="error"
|
|
18
18
|
*/
|
|
19
19
|
icon?: ComponentChildren | undefined;
|
|
20
20
|
/**
|
|
@@ -38,5 +38,4 @@ interface AlertOwnProps {
|
|
|
38
38
|
}
|
|
39
39
|
export type AlertProps = HuiComponentProps<Omit<ComponentProps<"div">, "children"> & AlertOwnProps, AlertSlots>;
|
|
40
40
|
export declare function Alert(rawProps: AlertProps): VNode;
|
|
41
|
-
export {};
|
|
42
|
-
//# sourceMappingURL=alert.d.ts.map
|
|
41
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { StatusIcon } from "../status-icon/status-icon.js";
|
|
2
3
|
import { alertRecipe } from "@hebium-ui/core";
|
|
3
4
|
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
4
5
|
// src/components/alert/alert.tsx
|
|
@@ -10,21 +11,13 @@ function Alert(rawProps) {
|
|
|
10
11
|
padding
|
|
11
12
|
});
|
|
12
13
|
const cls = useHuiClasses("Alert", recipe, rawProps);
|
|
13
|
-
const sls = useHuiStyles("Alert", rawProps
|
|
14
|
+
const sls = useHuiStyles("Alert", rawProps);
|
|
14
15
|
return /* @__PURE__ */ jsxs("div", {
|
|
15
16
|
className: cls.root,
|
|
16
17
|
style: sls.root,
|
|
17
18
|
role: "alert",
|
|
18
19
|
...restProps,
|
|
19
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
20
|
-
className: cls.icon,
|
|
21
|
-
style: sls.icon,
|
|
22
|
-
children: typeof icon === "undefined" ? /* @__PURE__ */ jsx("span", {
|
|
23
|
-
"aria-hidden": true,
|
|
24
|
-
className: cls.errorIcon,
|
|
25
|
-
style: sls.errorIcon
|
|
26
|
-
}) : icon
|
|
27
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
20
|
+
children: [typeof icon === "undefined" ? /* @__PURE__ */ jsx(StatusIcon, { status: "error" }) : icon, /* @__PURE__ */ jsxs("div", {
|
|
28
21
|
className: cls.content,
|
|
29
22
|
style: sls.content,
|
|
30
23
|
children: [message && /* @__PURE__ */ jsx("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","names":[],"sources":["../../../src/components/alert/alert.tsx"],"sourcesContent":["import { alertRecipe, type AlertSlots, type AlertVariants } from \"@hebium-ui/core\";\nimport { type ComponentChildren, type ComponentProps, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface AlertOwnProps {\n /**\n * The main message displayed in the alert.\n */\n message?: ComponentChildren | undefined;\n /**\n * The description displayed below the alert message.\n */\n description?: ComponentChildren | undefined;\n /**\n * The
|
|
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 ComponentChildren, type ComponentProps, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\nimport { StatusIcon } from \"../status-icon\";\n\ninterface AlertOwnProps {\n /**\n * The main message displayed in the alert.\n */\n message?: ComponentChildren | undefined;\n /**\n * The description displayed below the alert message.\n */\n description?: ComponentChildren | undefined;\n /**\n * The alert icon. Set to `null` or `false` to hide.\n *\n * @default StatusIcon with status=\"error\"\n */\n icon?: ComponentChildren | 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<Omit<ComponentProps<\"div\">, \"children\"> & AlertOwnProps, AlertSlots>;\n\nexport function Alert(rawProps: AlertProps): VNode {\n const {\n description,\n icon,\n variant,\n color,\n padding,\n message,\n ...restProps\n } = useHuiProps(\"Alert\", rawProps);\n\n const recipe = alertRecipe({\n variant,\n color,\n padding,\n });\n const cls = useHuiClasses(\"Alert\", recipe, rawProps);\n const sls = useHuiStyles(\"Alert\", rawProps);\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n role=\"alert\"\n {...restProps}\n >\n {typeof icon === \"undefined\" ? <StatusIcon status=\"error\" /> : icon}\n <div className={cls.content} style={sls.content}>\n {message && <div className={cls.message} style={sls.message}>{message}</div>}\n {description\n && (\n <div className={cls.description} style={sls.description}>\n {description}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;AA2CA,SAAgB,MAAM,UAA6B;CACjD,MAAM,EACJ,aACA,MACA,SACA,OACA,SACA,SACA,GAAG,cACD,YAAY,SAAS,QAAQ;CAEjC,MAAM,SAAS,YAAY;EACzB;EACA;EACA;CACF,CAAC;CACD,MAAM,MAAM,cAAc,SAAS,QAAQ,QAAQ;CACnD,MAAM,MAAM,aAAa,SAAS,QAAQ;CAE1C,OACE,qBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,MAAK;EACL,GAAI;EAJN,UAAA,CAMG,OAAO,SAAS,cAAc,oBAAC,YAAD,EAAY,QAAO,QAAS,CAAA,IAAI,MAC/D,qBAAC,OAAD;GAAK,WAAW,IAAI;GAAS,OAAO,IAAI;GAAxC,UAAA,CACG,WAAW,oBAAC,OAAD;IAAK,WAAW,IAAI;IAAS,OAAO,IAAI;IAAU,UAAA;GAAa,CAAA,GAC1E,eAEG,oBAAC,OAAD;IAAK,WAAW,IAAI;IAAa,OAAO,IAAI;IACzC,UAAA;GACE,CAAA,CAEN;EACF,CAAA,CAAA;;AAET"}
|
|
@@ -24,5 +24,4 @@ interface AnchorOwnProps {
|
|
|
24
24
|
}
|
|
25
25
|
export type AnchorProps<E extends JSX.ElementType = "a"> = HuiPolymorphicProps<E, AnchorOwnProps, AnchorSlots>;
|
|
26
26
|
export declare function Anchor<E extends JSX.ElementType = "a">(rawProps: AnchorProps<E>): VNode;
|
|
27
|
-
export {};
|
|
28
|
-
//# sourceMappingURL=anchor.d.ts.map
|
|
27
|
+
export {};
|
|
@@ -11,7 +11,7 @@ function Anchor(rawProps) {
|
|
|
11
11
|
});
|
|
12
12
|
const Component = as ?? "a";
|
|
13
13
|
const cls = useHuiClasses("Anchor", recipe, rawProps);
|
|
14
|
-
const sls = useHuiStyles("Anchor",
|
|
14
|
+
const sls = useHuiStyles("Anchor", rawProps);
|
|
15
15
|
return /* @__PURE__ */ jsx(Component, {
|
|
16
16
|
className: cls.root,
|
|
17
17
|
style: sls.root,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchor.js","names":[],"sources":["../../../src/components/anchor/anchor.tsx"],"sourcesContent":["import { anchorRecipe, type AnchorSlots, type AnchorVariants } from \"@hebium-ui/core\";\nimport { type JSX, type VNode } from \"preact\";\nimport { useHuiClasses, 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 JSX.ElementType = \"a\"> = HuiPolymorphicProps<\n E,\n AnchorOwnProps,\n AnchorSlots\n>;\n\nexport function Anchor<E extends JSX.ElementType = \"a\">(rawProps: AnchorProps<E>): VNode {\n const {\n as,\n color,\n marker,\n decoration,\n children,\n ...restProps\n } = useHuiProps(\"Anchor\", rawProps);\n\n const recipe = anchorRecipe({ color, marker, decoration });\n const Component = as ?? \"a\";\n\n const cls = useHuiClasses(\"Anchor\", recipe, rawProps);\n const sls = useHuiStyles(\"Anchor\",
|
|
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 JSX, type VNode } from \"preact\";\nimport { useHuiClasses, 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 JSX.ElementType = \"a\"> = HuiPolymorphicProps<\n E,\n AnchorOwnProps,\n AnchorSlots\n>;\n\nexport function Anchor<E extends JSX.ElementType = \"a\">(rawProps: AnchorProps<E>): VNode {\n const {\n as,\n color,\n marker,\n decoration,\n children,\n ...restProps\n } = useHuiProps(\"Anchor\", rawProps);\n\n const recipe = anchorRecipe({ color, marker, decoration });\n const Component = as ?? \"a\";\n\n const cls = useHuiClasses(\"Anchor\", recipe, rawProps);\n const sls = useHuiStyles(\"Anchor\", rawProps);\n\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n"],"mappings":";;;;AAgCA,SAAgB,OAAwC,UAAiC;CACvF,MAAM,EACJ,IACA,OACA,QACA,YACA,UACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,SAAS,aAAa;EAAE;EAAO;EAAQ;CAAW,CAAC;CACzD,MAAM,YAAY,MAAM;CAExB,MAAM,MAAM,cAAc,UAAU,QAAQ,QAAQ;CACpD,MAAM,MAAM,aAAa,UAAU,QAAQ;CAE3C,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
|
|
@@ -14,5 +14,4 @@ interface AvatarOwnProps {
|
|
|
14
14
|
}
|
|
15
15
|
export type AvatarProps = HuiComponentProps<Omit<PartialImgHTMLAttributes<HTMLImageElement>, "role"> & Pick<NativeImageWithAlt, "role"> & AvatarOwnProps, AvatarSlots>;
|
|
16
16
|
export declare function Avatar(rawProps: AvatarProps): VNode;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=avatar.d.ts.map
|
|
17
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { unwrapSignalish } from "../../utils/unwrap-signalish.js";
|
|
2
1
|
import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { unwrapSignalish } from "../../utils/unwrap-signalish.js";
|
|
3
3
|
import { avatartRecipe, getAvatarPlaceholder, shouldShowAvatarPlaceholder } from "@hebium-ui/core";
|
|
4
4
|
import { useCallback, useState } from "preact/hooks";
|
|
5
5
|
import { jsx } from "preact/jsx-runtime";
|
|
@@ -16,7 +16,7 @@ function Avatar(rawProps) {
|
|
|
16
16
|
});
|
|
17
17
|
const recipe = avatartRecipe({ background: shouldShowPlaceholder ? "box" : "transparent" });
|
|
18
18
|
const cls = useHuiClasses("Avatar", recipe, rawProps);
|
|
19
|
-
const sls = useHuiStyles("Avatar", rawProps
|
|
19
|
+
const sls = useHuiStyles("Avatar", rawProps);
|
|
20
20
|
const handleOnError = useCallback((event) => {
|
|
21
21
|
onError?.(event);
|
|
22
22
|
setFailedSource({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","names":[],"sources":["../../../src/components/avatar/avatar.tsx"],"sourcesContent":["import {\n type AvatarSlots,\n type AvatarSource,\n avatartRecipe,\n getAvatarPlaceholder,\n shouldShowAvatarPlaceholder,\n} from \"@hebium-ui/core\";\nimport {\n type ComponentProps,\n type PartialImgHTMLAttributes,\n type Signalish,\n type TargetedEvent,\n type VNode,\n} from \"preact\";\nimport { useCallback, useState } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\nimport { unwrapSignalish } from \"~/utils\";\n\ntype NativeImageWithAlt = Extract<ComponentProps<\"img\">, { alt: unknown }>;\n\ninterface AvatarOwnProps {\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 alt?: Signalish<string | undefined>;\n}\n\n// Avatar supplies the accessible name through the default alt derived from name.\nexport type AvatarProps = HuiComponentProps<\n & Omit<PartialImgHTMLAttributes<HTMLImageElement>, \"role\">\n & Pick<NativeImageWithAlt, \"role\">\n & AvatarOwnProps,\n AvatarSlots\n>;\n\nexport function Avatar(rawProps: AvatarProps): VNode {\n const {\n name,\n src: rawSrc,\n srcSet: rawSrcSet,\n srcset: rawSrcset,\n onError,\n ...restProps\n } = useHuiProps(\"Avatar\", rawProps);\n\n const src = unwrapSignalish(rawSrc);\n const imageSrcSet = unwrapSignalish(rawSrcSet) ?? unwrapSignalish(rawSrcset);\n const [failedSource, setFailedSource] = useState<AvatarSource | null>(null);\n const shouldShowPlaceholder = shouldShowAvatarPlaceholder({ src, srcSet: imageSrcSet, failedSource });\n\n const recipe = avatartRecipe({\n background: shouldShowPlaceholder ? \"box\" : \"transparent\",\n });\n\n const cls = useHuiClasses(\"Avatar\", recipe, rawProps);\n const sls = useHuiStyles(\"Avatar\", rawProps
|
|
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 {\n type ComponentProps,\n type PartialImgHTMLAttributes,\n type Signalish,\n type TargetedEvent,\n type VNode,\n} from \"preact\";\nimport { useCallback, useState } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\nimport { unwrapSignalish } from \"~/utils\";\n\ntype NativeImageWithAlt = Extract<ComponentProps<\"img\">, { alt: unknown }>;\n\ninterface AvatarOwnProps {\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 alt?: Signalish<string | undefined>;\n}\n\n// Avatar supplies the accessible name through the default alt derived from name.\nexport type AvatarProps = HuiComponentProps<\n & Omit<PartialImgHTMLAttributes<HTMLImageElement>, \"role\">\n & Pick<NativeImageWithAlt, \"role\">\n & AvatarOwnProps,\n AvatarSlots\n>;\n\nexport function Avatar(rawProps: AvatarProps): VNode {\n const {\n name,\n src: rawSrc,\n srcSet: rawSrcSet,\n srcset: rawSrcset,\n onError,\n ...restProps\n } = useHuiProps(\"Avatar\", rawProps);\n\n const src = unwrapSignalish(rawSrc);\n const imageSrcSet = unwrapSignalish(rawSrcSet) ?? unwrapSignalish(rawSrcset);\n const [failedSource, setFailedSource] = useState<AvatarSource | null>(null);\n const shouldShowPlaceholder = shouldShowAvatarPlaceholder({ src, srcSet: imageSrcSet, failedSource });\n\n const recipe = avatartRecipe({\n background: shouldShowPlaceholder ? \"box\" : \"transparent\",\n });\n\n const cls = useHuiClasses(\"Avatar\", recipe, rawProps);\n const sls = useHuiStyles(\"Avatar\", rawProps);\n\n const handleOnError = useCallback((event: TargetedEvent<HTMLImageElement>) => {\n onError?.(event);\n\n setFailedSource({ src, srcSet: imageSrcSet });\n }, [onError, src, imageSrcSet]);\n\n const placeholder = getAvatarPlaceholder(name);\n\n const imageAlt = unwrapSignalish(restProps.alt) ?? 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={imageSrcSet}\n {...restProps}\n alt={imageAlt}\n onError={handleOnError}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;AAqCA,SAAgB,OAAO,UAA8B;CACnD,MAAM,EACJ,MACA,KAAK,QACL,QAAQ,WACR,QAAQ,WACR,SACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,MAAM,gBAAgB,MAAM;CAClC,MAAM,cAAc,gBAAgB,SAAS,KAAK,gBAAgB,SAAS;CAC3E,MAAM,CAAC,cAAc,mBAAmB,SAA8B,IAAI;CAC1E,MAAM,wBAAwB,4BAA4B;EAAE;EAAK,QAAQ;EAAa;CAAa,CAAC;CAEpG,MAAM,SAAS,cAAc,EAC3B,YAAY,wBAAwB,QAAQ,cAC9C,CAAC;CAED,MAAM,MAAM,cAAc,UAAU,QAAQ,QAAQ;CACpD,MAAM,MAAM,aAAa,UAAU,QAAQ;CAE3C,MAAM,gBAAgB,aAAa,UAA2C;EAC5E,UAAU,KAAK;EAEf,gBAAgB;GAAE;GAAK,QAAQ;EAAY,CAAC;CAC9C,GAAG;EAAC;EAAS;EAAK;CAAW,CAAC;CAE9B,MAAM,cAAc,qBAAqB,IAAI;CAE7C,MAAM,WAAW,gBAAgB,UAAU,GAAG,KAAK;CAEnD,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;GACL,QAAQ;GACR,GAAI;GACJ,KAAK;GACL,SAAS;EACV,CAAA;CAEF,CAAA;AAET"}
|
|
@@ -21,5 +21,4 @@ interface BlockquoteOwnProps {
|
|
|
21
21
|
}
|
|
22
22
|
export type BlockquoteProps = HuiComponentProps<Omit<ComponentProps<"blockquote">, "color"> & BlockquoteOwnProps, BlockquoteSlots>;
|
|
23
23
|
export declare function Blockquote(rawProps: BlockquoteProps): VNode;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=blockquote.d.ts.map
|
|
24
|
+
export {};
|
|
@@ -6,7 +6,7 @@ function Blockquote(rawProps) {
|
|
|
6
6
|
const { color, caption, captionProps, children, ...restProps } = useHuiProps("Blockquote", rawProps);
|
|
7
7
|
const recipe = blockquoteRecipe({ color });
|
|
8
8
|
const cls = useHuiClasses("Blockquote", recipe, rawProps);
|
|
9
|
-
const sls = useHuiStyles("Blockquote", rawProps
|
|
9
|
+
const sls = useHuiStyles("Blockquote", rawProps);
|
|
10
10
|
return /* @__PURE__ */ jsxs("figure", {
|
|
11
11
|
className: cls.root,
|
|
12
12
|
style: sls.root,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockquote.js","names":[],"sources":["../../../src/components/blockquote/blockquote.tsx"],"sourcesContent":["import { blockquoteRecipe, type BlockquoteSlots, type BlockquoteVariants } from \"@hebium-ui/core\";\nimport { type ComponentChildren, type ComponentProps, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ntype HtmlFigcaptionProps = Omit<ComponentProps<\"figcaption\">, \"children\" | \"class\" | \"className\" | \"style\">;\n\ninterface BlockquoteOwnProps {\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?: ComponentChildren | undefined;\n /**\n * Additional props passed to the caption element.\n */\n captionProps?: HtmlFigcaptionProps | undefined;\n}\n\nexport type BlockquoteProps = HuiComponentProps<\n Omit<ComponentProps<\"blockquote\">, \"color\"> & BlockquoteOwnProps,\n BlockquoteSlots\n>;\n\nexport function Blockquote(rawProps: BlockquoteProps): VNode {\n const {\n color,\n caption,\n captionProps,\n children,\n ...restProps\n } = useHuiProps(\"Blockquote\", rawProps);\n\n const recipe = blockquoteRecipe({ color });\n const cls = useHuiClasses(\"Blockquote\", recipe, rawProps);\n const sls = useHuiStyles(\"Blockquote\", rawProps
|
|
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 ComponentChildren, type ComponentProps, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ntype HtmlFigcaptionProps = Omit<ComponentProps<\"figcaption\">, \"children\" | \"class\" | \"className\" | \"style\">;\n\ninterface BlockquoteOwnProps {\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?: ComponentChildren | undefined;\n /**\n * Additional props passed to the caption element.\n */\n captionProps?: HtmlFigcaptionProps | undefined;\n}\n\nexport type BlockquoteProps = HuiComponentProps<\n Omit<ComponentProps<\"blockquote\">, \"color\"> & BlockquoteOwnProps,\n BlockquoteSlots\n>;\n\nexport function Blockquote(rawProps: BlockquoteProps): VNode {\n const {\n color,\n caption,\n captionProps,\n children,\n ...restProps\n } = useHuiProps(\"Blockquote\", rawProps);\n\n const recipe = blockquoteRecipe({ color });\n const cls = useHuiClasses(\"Blockquote\", recipe, rawProps);\n const sls = useHuiStyles(\"Blockquote\", rawProps);\n\n return (\n <figure\n className={cls.root}\n style={sls.root}\n >\n <blockquote\n className={cls.blockquote}\n style={sls.blockquote}\n {...restProps}\n >\n {children}\n </blockquote>\n {caption != null && (\n <figcaption\n className={cls.caption}\n style={sls.caption}\n {...captionProps}\n >\n {caption}\n </figcaption>\n )}\n </figure>\n );\n}\n"],"mappings":";;;;AA6BA,SAAgB,WAAW,UAAkC;CAC3D,MAAM,EACJ,OACA,SACA,cACA,UACA,GAAG,cACD,YAAY,cAAc,QAAQ;CAEtC,MAAM,SAAS,iBAAiB,EAAE,MAAM,CAAC;CACzC,MAAM,MAAM,cAAc,cAAc,QAAQ,QAAQ;CACxD,MAAM,MAAM,aAAa,cAAc,QAAQ;CAE/C,OACE,qBAAC,UAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIE,oBAAC,cAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH;EACS,CAAA,GACX,WAAW,QACV,oBAAC,cAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH,UAAA;EACS,CAAA,CAER;;AAEZ"}
|
|
@@ -3,6 +3,17 @@ import "../../types/index.js";
|
|
|
3
3
|
import { ButtonSlots, ButtonVariants } from "@hebium-ui/core";
|
|
4
4
|
import { JSX, VNode } from "preact";
|
|
5
5
|
interface ButtonOwnProps {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the button is loading.
|
|
8
|
+
* Provide a descriptive loadingMessage to announce the loading state to screen readers.
|
|
9
|
+
*
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
loading?: boolean | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The visually hidden status message announced only while loading.
|
|
15
|
+
*/
|
|
16
|
+
loadingMessage?: string | undefined;
|
|
6
17
|
/**
|
|
7
18
|
* The visual style of the button.
|
|
8
19
|
*
|
|
@@ -24,5 +35,4 @@ interface ButtonOwnProps {
|
|
|
24
35
|
}
|
|
25
36
|
export type ButtonProps<E extends JSX.ElementType = "button"> = HuiPolymorphicProps<E, ButtonOwnProps, ButtonSlots>;
|
|
26
37
|
export declare function Button<E extends JSX.ElementType = "button">(rawProps: ButtonProps<E>): VNode;
|
|
27
|
-
export {};
|
|
28
|
-
//# sourceMappingURL=button.d.ts.map
|
|
38
|
+
export {};
|
|
@@ -1,23 +1,43 @@
|
|
|
1
1
|
import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
-
import { buttonRecipe } from "@hebium-ui/core";
|
|
3
|
-
import {
|
|
2
|
+
import { buttonControl, buttonRecipe, toStrbool } from "@hebium-ui/core";
|
|
3
|
+
import { useCallback } from "preact/hooks";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
4
5
|
// src/components/button/button.tsx
|
|
5
6
|
function Button(rawProps) {
|
|
6
|
-
const { as, variant, color, shape, children, ...restProps } = useHuiProps("Button", rawProps);
|
|
7
|
+
const { as, variant, color, shape, loading = false, loadingMessage, onClick, children, ...restProps } = useHuiProps("Button", rawProps);
|
|
7
8
|
const Component = as ?? "button";
|
|
9
|
+
const handleClick = useCallback((event) => {
|
|
10
|
+
buttonControl.handleClick(event, loading, () => onClick?.(event));
|
|
11
|
+
}, [loading, onClick]);
|
|
8
12
|
const recipe = buttonRecipe({
|
|
9
13
|
variant,
|
|
10
14
|
color,
|
|
11
|
-
shape
|
|
15
|
+
shape,
|
|
16
|
+
loading: toStrbool(loading)
|
|
12
17
|
});
|
|
13
18
|
const cls = useHuiClasses("Button", recipe, rawProps);
|
|
14
|
-
const sls = useHuiStyles("Button",
|
|
15
|
-
return /* @__PURE__ */
|
|
19
|
+
const sls = useHuiStyles("Button", rawProps);
|
|
20
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Component, {
|
|
16
21
|
className: cls.root,
|
|
17
22
|
style: sls.root,
|
|
23
|
+
...buttonControl.getRootAttributes(loading),
|
|
18
24
|
...restProps,
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
onClick: handleClick,
|
|
26
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
27
|
+
className: cls.content,
|
|
28
|
+
style: sls.content,
|
|
29
|
+
children
|
|
30
|
+
}), loading && /* @__PURE__ */ jsx("span", {
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
className: cls.spinner,
|
|
33
|
+
style: sls.spinner
|
|
34
|
+
})]
|
|
35
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
36
|
+
className: cls.status,
|
|
37
|
+
style: sls.status,
|
|
38
|
+
...buttonControl.getStatusAttributes(),
|
|
39
|
+
children: loading ? loadingMessage : void 0
|
|
40
|
+
})] });
|
|
21
41
|
}
|
|
22
42
|
export { Button };
|
|
23
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":[],"sources":["../../../src/components/button/button.tsx"],"sourcesContent":["import { buttonRecipe, type ButtonSlots, type ButtonVariants } from \"@hebium-ui/core\";\nimport { type JSX, type VNode } from \"preact\";\nimport { useHuiClasses, 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 JSX.ElementType = \"button\"> = HuiPolymorphicProps<\n E,\n ButtonOwnProps,\n ButtonSlots\n>;\n\nexport function Button<E extends JSX.ElementType = \"button\">(rawProps: ButtonProps<E>): VNode {\n const {\n as,\n variant,\n color,\n shape,\n children,\n ...restProps\n } = useHuiProps(\"Button\", rawProps);\n\n const Component = as ?? \"button\";\n const recipe = buttonRecipe({\n variant,\n color,\n shape,\n });\n const cls = useHuiClasses(\"Button\", recipe, rawProps);\n const sls = useHuiStyles(\"Button\",
|
|
1
|
+
{"version":3,"file":"button.js","names":[],"sources":["../../../src/components/button/button.tsx"],"sourcesContent":["import { buttonControl, buttonRecipe, type ButtonSlots, type ButtonVariants, toStrbool } from \"@hebium-ui/core\";\nimport { type JSX, type TargetedMouseEvent, type VNode } from \"preact\";\nimport { useCallback } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface ButtonOwnProps {\n /**\n * Whether the button is loading.\n * Provide a descriptive loadingMessage to announce the loading state to screen readers.\n *\n * @default false\n */\n loading?: boolean | undefined;\n /**\n * The visually hidden status message announced only while loading.\n */\n loadingMessage?: string | undefined;\n /**\n * The visual style of the button.\n *\n * @default \"solid\"\n */\n variant?: ButtonVariants[\"variant\"] | undefined;\n /**\n * The semantic color of the button.\n *\n * @default \"accent\"\n */\n color?: ButtonVariants[\"color\"] | undefined;\n /**\n * The shape of the button.\n *\n * @default \"rectangle\"\n */\n shape?: ButtonVariants[\"shape\"] | undefined;\n}\n\nexport type ButtonProps<E extends JSX.ElementType = \"button\"> = HuiPolymorphicProps<\n E,\n ButtonOwnProps,\n ButtonSlots\n>;\n\nexport function Button<E extends JSX.ElementType = \"button\">(rawProps: ButtonProps<E>): VNode {\n const {\n as,\n variant,\n color,\n shape,\n loading = false,\n loadingMessage,\n onClick,\n children,\n ...restProps\n } = useHuiProps(\"Button\", rawProps);\n\n const Component = as ?? \"button\";\n const handleClick = useCallback((event: TargetedMouseEvent<HTMLElement>): void => {\n buttonControl.handleClick(event, loading, () => onClick?.(event));\n }, [loading, onClick]);\n\n const recipe = buttonRecipe({\n variant,\n color,\n shape,\n loading: toStrbool(loading),\n });\n const cls = useHuiClasses(\"Button\", recipe, rawProps);\n const sls = useHuiStyles(\"Button\", rawProps);\n\n return (\n <>\n <Component\n className={cls.root}\n style={sls.root}\n {...buttonControl.getRootAttributes(loading)}\n {...restProps}\n onClick={handleClick}\n >\n <span\n className={cls.content}\n style={sls.content}\n >\n {children}\n </span>\n {loading && (\n <span\n aria-hidden=\"true\"\n className={cls.spinner}\n style={sls.spinner}\n />\n )}\n </Component>\n <span\n className={cls.status}\n style={sls.status}\n {...buttonControl.getStatusAttributes()}\n >\n {loading ? loadingMessage : undefined}\n </span>\n </>\n );\n}\n"],"mappings":";;;;;AA4CA,SAAgB,OAA6C,UAAiC;CAC5F,MAAM,EACJ,IACA,SACA,OACA,OACA,UAAU,OACV,gBACA,SACA,UACA,GAAG,cACD,YAAY,UAAU,QAAQ;CAElC,MAAM,YAAY,MAAM;CACxB,MAAM,cAAc,aAAa,UAAiD;EAChF,cAAc,YAAY,OAAO,eAAe,UAAU,KAAK,CAAC;CAClE,GAAG,CAAC,SAAS,OAAO,CAAC;CAErB,MAAM,SAAS,aAAa;EAC1B;EACA;EACA;EACA,SAAS,UAAU,OAAO;CAC5B,CAAC;CACD,MAAM,MAAM,cAAc,UAAU,QAAQ,QAAQ;CACpD,MAAM,MAAM,aAAa,UAAU,QAAQ;CAE3C,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,qBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI,cAAc,kBAAkB,OAAO;EAC3C,GAAI;EACJ,SAAS;EALX,UAAA,CAOE,oBAAC,QAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GAEV;EACG,CAAA,GACL,WACC,oBAAC,QAAD;GACE,eAAY;GACZ,WAAW,IAAI;GACf,OAAO,IAAI;EACZ,CAAA,CAEM;CACX,CAAA,GAAA,oBAAC,QAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI,cAAc,oBAAoB;EAErC,UAAA,UAAU,iBAAiB,KAAA;CACxB,CAAA,CACN,EAAA,CAAA;AAEN"}
|
|
@@ -28,5 +28,4 @@ export type CheckboxProps = HuiComponentProps<CheckboxOwnProps & Omit<Extract<Co
|
|
|
28
28
|
type: Signalish<"checkbox">;
|
|
29
29
|
}>, keyof CheckboxOwnProps | "children" | "type">, CheckboxSlots>;
|
|
30
30
|
export declare function Checkbox(rawProps: CheckboxProps): VNode;
|
|
31
|
-
export {};
|
|
32
|
-
//# sourceMappingURL=checkbox.d.ts.map
|
|
31
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { unwrapSignalish } from "../../utils/unwrap-signalish.js";
|
|
2
1
|
import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { unwrapSignalish } from "../../utils/unwrap-signalish.js";
|
|
3
3
|
import { checkboxControl, checkboxRecipe, toBool, toStrbool } from "@hebium-ui/core";
|
|
4
4
|
import { useCallback, useId, useImperativeHandle, useRef } from "preact/hooks";
|
|
5
5
|
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
@@ -44,7 +44,7 @@ function Checkbox(rawProps) {
|
|
|
44
44
|
error: toStrbool(checkboxState.invalid)
|
|
45
45
|
});
|
|
46
46
|
const cls = useHuiClasses("Checkbox", recipe, rawProps);
|
|
47
|
-
const sls = useHuiStyles("Checkbox", rawProps
|
|
47
|
+
const sls = useHuiStyles("Checkbox", rawProps);
|
|
48
48
|
const controlAttrs = checkboxControl.getControlAttributes(checkboxState);
|
|
49
49
|
const labelAttrs = checkboxControl.getLabelAttributes(checkboxState);
|
|
50
50
|
const errorAttrs = checkboxControl.getErrorAttributes(checkboxState);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","names":[],"sources":["../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import {\n checkboxControl,\n checkboxRecipe,\n type CheckboxSlots,\n type CheckboxVariants,\n toBool,\n toStrbool,\n} from \"@hebium-ui/core\";\nimport { type ComponentChildren, type ComponentProps, type Signalish, type TargetedEvent, type VNode } from \"preact\";\nimport { useCallback, useId, useImperativeHandle, useRef } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\nimport { unwrapSignalish } from \"~/utils\";\n\ninterface CheckboxOwnProps {\n /**\n * The label displayed next to the checkbox.\n */\n label?: ComponentChildren | undefined;\n /**\n * The validation error message displayed below the label.\n */\n error?: ComponentChildren | undefined;\n /**\n * The semantic color of the checkbox control.\n *\n * @default \"accent\"\n */\n color?: CheckboxVariants[\"color\"] | undefined;\n /**\n * The controlled indeterminate state. Update this prop in response to user interaction.\n *\n * @default false\n */\n indeterminate?: boolean | undefined;\n}\n\nexport type CheckboxProps = HuiComponentProps<\n & CheckboxOwnProps\n & Omit<\n Extract<ComponentProps<\"input\">, { type: Signalish<\"checkbox\"> }>,\n keyof CheckboxOwnProps | \"children\" | \"type\"\n >,\n CheckboxSlots\n>;\n\nexport function Checkbox(rawProps: CheckboxProps): VNode {\n const {\n id,\n label,\n error,\n color,\n indeterminate,\n onChange,\n ref,\n ...restProps\n } = useHuiProps(\"Checkbox\", rawProps);\n\n const tmpId = useId();\n const committedRef = useRef<\n {\n input: HTMLInputElement;\n indeterminate: boolean;\n } | null\n >(null);\n\n const inputRef = useCallback((input: HTMLInputElement | null): void => {\n if (input === null) {\n committedRef.current = null;\n return;\n }\n\n input.indeterminate = !!indeterminate;\n committedRef.current = { input, indeterminate: !!indeterminate };\n }, [indeterminate]);\n\n useImperativeHandle(ref ?? null, () => {\n const committed = committedRef.current;\n if (committed === null) {\n throw new Error(\"[Hebium UI] Checkbox input ref is not attached\");\n }\n return committed.input;\n }, []);\n\n const handleChange = useCallback((event: TargetedEvent<HTMLInputElement>): void => {\n const input = event.currentTarget;\n onChange?.(event);\n\n // The user handler may have committed new props or unmounted the input.\n const committed = committedRef.current;\n if (committed?.input === input) input.indeterminate = committed.indeterminate;\n }, [onChange]);\n\n const inputId = unwrapSignalish(id);\n const disabled = restProps.disabled;\n const ariaDisabled = restProps[\"aria-disabled\"];\n const checkboxState = {\n id: inputId ?? tmpId,\n invalid: !!error,\n indeterminate: !!indeterminate,\n disabled: toBool(unwrapSignalish(disabled)) || toBool(unwrapSignalish(ariaDisabled)),\n };\n const recipe = checkboxRecipe({\n color,\n error: toStrbool(checkboxState.invalid),\n });\n const cls = useHuiClasses(\"Checkbox\", recipe, rawProps);\n const sls = useHuiStyles(\"Checkbox\", rawProps
|
|
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 { type ComponentChildren, type ComponentProps, type Signalish, type TargetedEvent, type VNode } from \"preact\";\nimport { useCallback, useId, useImperativeHandle, useRef } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\nimport { unwrapSignalish } from \"~/utils\";\n\ninterface CheckboxOwnProps {\n /**\n * The label displayed next to the checkbox.\n */\n label?: ComponentChildren | undefined;\n /**\n * The validation error message displayed below the label.\n */\n error?: ComponentChildren | undefined;\n /**\n * The semantic color of the checkbox control.\n *\n * @default \"accent\"\n */\n color?: CheckboxVariants[\"color\"] | undefined;\n /**\n * The controlled indeterminate state. Update this prop in response to user interaction.\n *\n * @default false\n */\n indeterminate?: boolean | undefined;\n}\n\nexport type CheckboxProps = HuiComponentProps<\n & CheckboxOwnProps\n & Omit<\n Extract<ComponentProps<\"input\">, { type: Signalish<\"checkbox\"> }>,\n keyof CheckboxOwnProps | \"children\" | \"type\"\n >,\n CheckboxSlots\n>;\n\nexport function Checkbox(rawProps: CheckboxProps): VNode {\n const {\n id,\n label,\n error,\n color,\n indeterminate,\n onChange,\n ref,\n ...restProps\n } = useHuiProps(\"Checkbox\", rawProps);\n\n const tmpId = useId();\n const committedRef = useRef<\n {\n input: HTMLInputElement;\n indeterminate: boolean;\n } | null\n >(null);\n\n const inputRef = useCallback((input: HTMLInputElement | null): void => {\n if (input === null) {\n committedRef.current = null;\n return;\n }\n\n input.indeterminate = !!indeterminate;\n committedRef.current = { input, indeterminate: !!indeterminate };\n }, [indeterminate]);\n\n useImperativeHandle(ref ?? null, () => {\n const committed = committedRef.current;\n if (committed === null) {\n throw new Error(\"[Hebium UI] Checkbox input ref is not attached\");\n }\n return committed.input;\n }, []);\n\n const handleChange = useCallback((event: TargetedEvent<HTMLInputElement>): void => {\n const input = event.currentTarget;\n onChange?.(event);\n\n // The user handler may have committed new props or unmounted the input.\n const committed = committedRef.current;\n if (committed?.input === input) input.indeterminate = committed.indeterminate;\n }, [onChange]);\n\n const inputId = unwrapSignalish(id);\n const disabled = restProps.disabled;\n const ariaDisabled = restProps[\"aria-disabled\"];\n const checkboxState = {\n id: inputId ?? tmpId,\n invalid: !!error,\n indeterminate: !!indeterminate,\n disabled: toBool(unwrapSignalish(disabled)) || toBool(unwrapSignalish(ariaDisabled)),\n };\n const recipe = checkboxRecipe({\n color,\n error: toStrbool(checkboxState.invalid),\n });\n const cls = useHuiClasses(\"Checkbox\", recipe, rawProps);\n const sls = useHuiStyles(\"Checkbox\", rawProps);\n const controlAttrs = checkboxControl.getControlAttributes(checkboxState);\n const labelAttrs = checkboxControl.getLabelAttributes(checkboxState);\n const errorAttrs = checkboxControl.getErrorAttributes(checkboxState);\n\n return (\n <div\n className={cls.root}\n style={sls.root}\n >\n <input\n ref={inputRef}\n className={cls.checkbox}\n style={sls.checkbox}\n {...controlAttrs}\n {...restProps}\n onChange={handleChange}\n />\n <div>\n {label && (\n <label\n className={cls.label}\n style={sls.label}\n {...labelAttrs}\n >\n {label}\n </label>\n )}\n {error && (\n <p\n className={cls.error}\n style={sls.error}\n {...errorAttrs}\n >\n <span\n aria-hidden\n className={cls.errorIcon}\n style={sls.errorIcon}\n />\n <span\n className={cls.errorMessage}\n style={sls.errorMessage}\n >\n {error}\n </span>\n </p>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AA8CA,SAAgB,SAAS,UAAgC;CACvD,MAAM,EACJ,IACA,OACA,OACA,OACA,eACA,UACA,KACA,GAAG,cACD,YAAY,YAAY,QAAQ;CAEpC,MAAM,QAAQ,MAAM;CACpB,MAAM,eAAe,OAKnB,IAAI;CAEN,MAAM,WAAW,aAAa,UAAyC;EACrE,IAAI,UAAU,MAAM;GAClB,aAAa,UAAU;GACvB;EACF;EAEA,MAAM,gBAAgB,CAAC,CAAC;EACxB,aAAa,UAAU;GAAE;GAAO,eAAe,CAAC,CAAC;EAAc;CACjE,GAAG,CAAC,aAAa,CAAC;CAElB,oBAAoB,OAAO,YAAY;EACrC,MAAM,YAAY,aAAa;EAC/B,IAAI,cAAc,MAChB,MAAM,IAAI,MAAM,gDAAgD;EAElE,OAAO,UAAU;CACnB,GAAG,CAAC,CAAC;CAEL,MAAM,eAAe,aAAa,UAAiD;EACjF,MAAM,QAAQ,MAAM;EACpB,WAAW,KAAK;EAGhB,MAAM,YAAY,aAAa;EAC/B,IAAI,WAAW,UAAU,OAAO,MAAM,gBAAgB,UAAU;CAClE,GAAG,CAAC,QAAQ,CAAC;CAEb,MAAM,UAAU,gBAAgB,EAAE;CAClC,MAAM,WAAW,UAAU;CAC3B,MAAM,eAAe,UAAU;CAC/B,MAAM,gBAAgB;EACpB,IAAI,WAAW;EACf,SAAS,CAAC,CAAC;EACX,eAAe,CAAC,CAAC;EACjB,UAAU,OAAO,gBAAgB,QAAQ,CAAC,KAAK,OAAO,gBAAgB,YAAY,CAAC;CACrF;CACA,MAAM,SAAS,eAAe;EAC5B;EACA,OAAO,UAAU,cAAc,OAAO;CACxC,CAAC;CACD,MAAM,MAAM,cAAc,YAAY,QAAQ,QAAQ;CACtD,MAAM,MAAM,aAAa,YAAY,QAAQ;CAC7C,MAAM,eAAe,gBAAgB,qBAAqB,aAAa;CACvE,MAAM,aAAa,gBAAgB,mBAAmB,aAAa;CACnE,MAAM,aAAa,gBAAgB,mBAAmB,aAAa;CAEnE,OACE,qBAAC,OAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EAFb,UAAA,CAIE,oBAAC,SAAD;GACE,KAAK;GACL,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GACJ,GAAI;GACJ,UAAU;EACX,CAAA,GACD,qBAAC,OAAD,EAAA,UAAA,CACG,SACC,oBAAC,SAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAEH,UAAA;EACI,CAAA,GAER,SACC,qBAAC,KAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GACX,GAAI;GAHN,UAAA,CAKE,oBAAC,QAAD;IACE,eAAA;IACA,WAAW,IAAI;IACf,OAAO,IAAI;GACZ,CAAA,GACD,oBAAC,QAAD;IACE,WAAW,IAAI;IACf,OAAO,IAAI;IAEV,UAAA;GACG,CAAA,CACL;EAEF,CAAA,CAAA,EAAA,CAAA,CACF;;AAET"}
|
|
@@ -5,5 +5,4 @@ import { JSX, VNode } from "preact";
|
|
|
5
5
|
interface CodeOwnProps {}
|
|
6
6
|
export type CodeProps<E extends JSX.ElementType = "code"> = HuiPolymorphicProps<E, CodeOwnProps, CodeSlots>;
|
|
7
7
|
export declare function Code<E extends JSX.ElementType = "code">(rawProps: CodeProps<E>): VNode;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=code.d.ts.map
|
|
8
|
+
export {};
|
|
@@ -7,7 +7,7 @@ function Code(rawProps) {
|
|
|
7
7
|
const recipe = codeRecipe();
|
|
8
8
|
const Component = as ?? "code";
|
|
9
9
|
const cls = useHuiClasses("Code", recipe, rawProps);
|
|
10
|
-
const sls = useHuiStyles("Code",
|
|
10
|
+
const sls = useHuiStyles("Code", rawProps);
|
|
11
11
|
return /* @__PURE__ */ jsx(Component, {
|
|
12
12
|
className: cls.root,
|
|
13
13
|
style: sls.root,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.js","names":[],"sources":["../../../src/components/code/code.tsx"],"sourcesContent":["import { codeRecipe, type CodeSlots } from \"@hebium-ui/core\";\nimport { type JSX, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface CodeOwnProps {}\n\nexport type CodeProps<E extends JSX.ElementType = \"code\"> = HuiPolymorphicProps<\n E,\n CodeOwnProps,\n CodeSlots\n>;\n\nexport function Code<E extends JSX.ElementType = \"code\">(rawProps: CodeProps<E>): VNode {\n const {\n as,\n children,\n ...restProps\n } = useHuiProps(\"Code\", rawProps);\n\n const recipe = codeRecipe();\n const Component = as ?? \"code\";\n\n const cls = useHuiClasses(\"Code\", recipe, rawProps);\n const sls = useHuiStyles(\"Code\",
|
|
1
|
+
{"version":3,"file":"code.js","names":[],"sources":["../../../src/components/code/code.tsx"],"sourcesContent":["import { codeRecipe, type CodeSlots } from \"@hebium-ui/core\";\nimport { type JSX, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiPolymorphicProps } from \"~/types\";\n\ninterface CodeOwnProps {}\n\nexport type CodeProps<E extends JSX.ElementType = \"code\"> = HuiPolymorphicProps<\n E,\n CodeOwnProps,\n CodeSlots\n>;\n\nexport function Code<E extends JSX.ElementType = \"code\">(rawProps: CodeProps<E>): VNode {\n const {\n as,\n children,\n ...restProps\n } = useHuiProps(\"Code\", rawProps);\n\n const recipe = codeRecipe();\n const Component = as ?? \"code\";\n\n const cls = useHuiClasses(\"Code\", recipe, rawProps);\n const sls = useHuiStyles(\"Code\", rawProps);\n return (\n <Component\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n"],"mappings":";;;;AAaA,SAAgB,KAAyC,UAA+B;CACtF,MAAM,EACJ,IACA,UACA,GAAG,cACD,YAAY,QAAQ,QAAQ;CAEhC,MAAM,SAAS,WAAW;CAC1B,MAAM,YAAY,MAAM;CAExB,MAAM,MAAM,cAAc,QAAQ,QAAQ,QAAQ;CAClD,MAAM,MAAM,aAAa,QAAQ,QAAQ;CACzC,OACE,oBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAEH;CACQ,CAAA;AAEf"}
|
|
@@ -16,5 +16,4 @@ interface DetailsOwnProps {
|
|
|
16
16
|
}
|
|
17
17
|
export type DetailsProps = HuiComponentProps<ComponentProps<"details"> & DetailsOwnProps, DetailsSlots>;
|
|
18
18
|
export declare function Details(rawProps: DetailsProps): VNode;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=details.d.ts.map
|
|
19
|
+
export {};
|
|
@@ -6,7 +6,7 @@ function Details(rawProps) {
|
|
|
6
6
|
const { summary, border, children, ...restProps } = useHuiProps("Details", rawProps);
|
|
7
7
|
const recipe = detailsRecipe({ border });
|
|
8
8
|
const cls = useHuiClasses("Details", recipe, rawProps);
|
|
9
|
-
const sls = useHuiStyles("Details", rawProps
|
|
9
|
+
const sls = useHuiStyles("Details", rawProps);
|
|
10
10
|
return /* @__PURE__ */ jsxs("details", {
|
|
11
11
|
className: cls.root,
|
|
12
12
|
style: sls.root,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"details.js","names":[],"sources":["../../../src/components/details/details.tsx"],"sourcesContent":["import { detailsRecipe, type DetailsSlots, type DetailsVariants } from \"@hebium-ui/core\";\nimport { type ComponentChildren, type ComponentProps, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface DetailsOwnProps {\n /**\n * The summary displayed in the disclosure button.\n */\n summary: ComponentChildren;\n /**\n * The border style of the details container.\n *\n * @default \"block\"\n */\n border?: DetailsVariants[\"border\"] | undefined;\n}\n\nexport type DetailsProps = HuiComponentProps<\n ComponentProps<\"details\"> & DetailsOwnProps,\n DetailsSlots\n>;\n\nexport function Details(rawProps: DetailsProps): VNode {\n const {\n summary,\n border,\n children,\n ...restProps\n } = useHuiProps(\"Details\", rawProps);\n\n const recipe = detailsRecipe({ border });\n const cls = useHuiClasses(\"Details\", recipe, rawProps);\n const sls = useHuiStyles(\"Details\", rawProps
|
|
1
|
+
{"version":3,"file":"details.js","names":[],"sources":["../../../src/components/details/details.tsx"],"sourcesContent":["import { detailsRecipe, type DetailsSlots, type DetailsVariants } from \"@hebium-ui/core\";\nimport { type ComponentChildren, type ComponentProps, type VNode } from \"preact\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps } from \"~/types\";\n\ninterface DetailsOwnProps {\n /**\n * The summary displayed in the disclosure button.\n */\n summary: ComponentChildren;\n /**\n * The border style of the details container.\n *\n * @default \"block\"\n */\n border?: DetailsVariants[\"border\"] | undefined;\n}\n\nexport type DetailsProps = HuiComponentProps<\n ComponentProps<\"details\"> & DetailsOwnProps,\n DetailsSlots\n>;\n\nexport function Details(rawProps: DetailsProps): VNode {\n const {\n summary,\n border,\n children,\n ...restProps\n } = useHuiProps(\"Details\", rawProps);\n\n const recipe = detailsRecipe({ border });\n const cls = useHuiClasses(\"Details\", recipe, rawProps);\n const sls = useHuiStyles(\"Details\", rawProps);\n\n return (\n <details\n className={cls.root}\n style={sls.root}\n {...restProps}\n >\n <summary\n className={cls.summary}\n style={sls.summary}\n >\n {summary}\n </summary>\n {children != null && (\n <div\n className={cls.content}\n style={sls.content}\n >\n {children}\n </div>\n )}\n </details>\n );\n}\n"],"mappings":";;;;AAuBA,SAAgB,QAAQ,UAA+B;CACrD,MAAM,EACJ,SACA,QACA,UACA,GAAG,cACD,YAAY,WAAW,QAAQ;CAEnC,MAAM,SAAS,cAAc,EAAE,OAAO,CAAC;CACvC,MAAM,MAAM,cAAc,WAAW,QAAQ,QAAQ;CACrD,MAAM,MAAM,aAAa,WAAW,QAAQ;CAE5C,OACE,qBAAC,WAAD;EACE,WAAW,IAAI;EACf,OAAO,IAAI;EACX,GAAI;EAHN,UAAA,CAKE,oBAAC,WAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GAEV,UAAA;EACM,CAAA,GACR,YAAY,QACX,oBAAC,OAAD;GACE,WAAW,IAAI;GACf,OAAO,IAAI;GAEV;EACE,CAAA,CAEA;;AAEb"}
|
|
@@ -22,8 +22,8 @@ export interface DialogProps {
|
|
|
22
22
|
}
|
|
23
23
|
declare function DialogRoot(rawProps: DialogProps): VNode;
|
|
24
24
|
interface DialogTriggerOwnProps {}
|
|
25
|
-
export type DialogTriggerProps<E extends JSX.ElementType = typeof Button
|
|
26
|
-
declare function Trigger<E extends JSX.ElementType = typeof Button
|
|
25
|
+
export type DialogTriggerProps<E extends JSX.ElementType = typeof Button<"button">> = HuiPolymorphicProps<E, DialogTriggerOwnProps, ButtonSlots>;
|
|
26
|
+
declare function Trigger<E extends JSX.ElementType = typeof Button<"button">>(rawProps: DialogTriggerProps<E>): VNode;
|
|
27
27
|
interface DialogContentOwnProps {
|
|
28
28
|
/**
|
|
29
29
|
* The heading rendered at the top of the dialog content.
|
|
@@ -42,7 +42,7 @@ interface DialogContentOwnProps {
|
|
|
42
42
|
/**
|
|
43
43
|
* Additional props passed to the internal close button.
|
|
44
44
|
*/
|
|
45
|
-
closeButtonProps?: Omit<DialogCloseProps, "children" | "
|
|
45
|
+
closeButtonProps?: Omit<DialogCloseProps, "children" | "classes" | "styles"> | undefined;
|
|
46
46
|
}
|
|
47
47
|
export type DialogContentProps = HuiComponentProps<Omit<ComponentProps<"dialog">, "id" | "open"> & DialogContentOwnProps, DialogSlots>;
|
|
48
48
|
declare function Content(rawProps: DialogContentProps): VNode;
|
|
@@ -61,5 +61,4 @@ export declare const Dialog: typeof DialogRoot & {
|
|
|
61
61
|
Content: typeof Content;
|
|
62
62
|
Close: typeof Close;
|
|
63
63
|
};
|
|
64
|
-
export {};
|
|
65
|
-
//# sourceMappingURL=dialog.d.ts.map
|
|
64
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { unwrapSignalish } from "../../utils/unwrap-signalish.js";
|
|
2
1
|
import { useHuiClasses, useHuiProps, useHuiStyles } from "../../provider/hui-provider.context.js";
|
|
2
|
+
import { unwrapSignalish } from "../../utils/unwrap-signalish.js";
|
|
3
3
|
import { Button } from "../button/button.js";
|
|
4
4
|
import { Heading } from "../heading/heading.js";
|
|
5
5
|
import { DialogContext, useDialogContext, useDialogId } from "./dialog.context.js";
|
|
@@ -7,6 +7,12 @@ import { dialogControl, dialogRecipe, toStrbool } from "@hebium-ui/core";
|
|
|
7
7
|
import { useCallback, useId, useMemo } from "preact/hooks";
|
|
8
8
|
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
9
9
|
// src/components/dialog/dialog.tsx
|
|
10
|
+
const BUTTON_CLASSES = {
|
|
11
|
+
root: "",
|
|
12
|
+
content: "",
|
|
13
|
+
spinner: "",
|
|
14
|
+
status: ""
|
|
15
|
+
};
|
|
10
16
|
function DialogRoot(rawProps) {
|
|
11
17
|
const { id, modal = false, children } = useHuiProps("Dialog", rawProps);
|
|
12
18
|
const tmpId = useId();
|
|
@@ -31,8 +37,8 @@ function DialogRoot(rawProps) {
|
|
|
31
37
|
function Trigger(rawProps) {
|
|
32
38
|
const { as, children, onClick, ...restProps } = useHuiProps("DialogTrigger", rawProps);
|
|
33
39
|
const Component = as ?? Button;
|
|
34
|
-
const cls = useHuiClasses("DialogTrigger",
|
|
35
|
-
const sls = useHuiStyles("DialogTrigger",
|
|
40
|
+
const cls = useHuiClasses("DialogTrigger", BUTTON_CLASSES, rawProps);
|
|
41
|
+
const sls = useHuiStyles("DialogTrigger", rawProps);
|
|
36
42
|
const { dialogId, modal, open } = useDialogContext();
|
|
37
43
|
const attrs = dialogControl.getTriggerAttributes({ id: dialogId }, {
|
|
38
44
|
modal,
|
|
@@ -49,8 +55,13 @@ function Trigger(rawProps) {
|
|
|
49
55
|
]);
|
|
50
56
|
return /* @__PURE__ */ jsx(Component, {
|
|
51
57
|
...attrs,
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
...Component === Button ? {
|
|
59
|
+
classes: cls,
|
|
60
|
+
styles: sls
|
|
61
|
+
} : {
|
|
62
|
+
className: cls.root,
|
|
63
|
+
style: sls.root
|
|
64
|
+
},
|
|
54
65
|
onClick: handleClick,
|
|
55
66
|
...restProps,
|
|
56
67
|
children
|
|
@@ -71,7 +82,9 @@ function Content(rawProps) {
|
|
|
71
82
|
const headingLevel = headingProps?.level ?? 2;
|
|
72
83
|
const recipe = dialogRecipe({ modal: toStrbool(modal) });
|
|
73
84
|
const cls = useHuiClasses("DialogContent", recipe, rawProps);
|
|
74
|
-
const sls = useHuiStyles("DialogContent", rawProps
|
|
85
|
+
const sls = useHuiStyles("DialogContent", rawProps);
|
|
86
|
+
const closeButtonClasses = useMemo(() => ({ root: cls.closeButton }), [cls.closeButton]);
|
|
87
|
+
const closeButtonStyles = useMemo(() => ({ root: sls.closeButton }), [sls.closeButton]);
|
|
75
88
|
const shouldRenderCloseButton = closeButton !== null && closeButton !== false;
|
|
76
89
|
const shouldRenderHeader = headingId !== void 0 || shouldRenderCloseButton;
|
|
77
90
|
const closeButtonContent = closeButton === void 0 ? /* @__PURE__ */ jsx("span", {
|
|
@@ -96,8 +109,8 @@ function Content(rawProps) {
|
|
|
96
109
|
level: headingLevel,
|
|
97
110
|
children: resolvedHeading
|
|
98
111
|
}), shouldRenderCloseButton && /* @__PURE__ */ jsx(Close, {
|
|
99
|
-
|
|
100
|
-
|
|
112
|
+
classes: closeButtonClasses,
|
|
113
|
+
styles: closeButtonStyles,
|
|
101
114
|
"aria-label": "Close Dialog",
|
|
102
115
|
variant: "ghost",
|
|
103
116
|
color: "neutral",
|
|
@@ -110,15 +123,15 @@ function Content(rawProps) {
|
|
|
110
123
|
}
|
|
111
124
|
function Close(rawProps) {
|
|
112
125
|
const props = useHuiProps("DialogClose", rawProps);
|
|
113
|
-
const cls = useHuiClasses("DialogClose",
|
|
114
|
-
const sls = useHuiStyles("DialogClose",
|
|
126
|
+
const cls = useHuiClasses("DialogClose", BUTTON_CLASSES, rawProps);
|
|
127
|
+
const sls = useHuiStyles("DialogClose", rawProps);
|
|
115
128
|
const dialogId = useDialogId();
|
|
116
129
|
const attrs = dialogControl.getCloseAttributes({ id: dialogId });
|
|
117
130
|
return /* @__PURE__ */ jsx(Button, {
|
|
118
131
|
...attrs,
|
|
119
132
|
...props,
|
|
120
|
-
|
|
121
|
-
|
|
133
|
+
classes: cls,
|
|
134
|
+
styles: sls
|
|
122
135
|
});
|
|
123
136
|
}
|
|
124
137
|
const Dialog = Object.assign(DialogRoot, {
|
|
@@ -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 { type ComponentChildren, type ComponentProps, type JSX, type TargetedMouseEvent, type VNode } from \"preact\";\nimport { useCallback, useId, useMemo } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { unwrapSignalish } 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?: ComponentChildren | undefined;\n}\n\nfunction DialogRoot(rawProps: DialogProps): VNode {\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\ninterface DialogTriggerOwnProps {}\nexport type DialogTriggerProps<E extends JSX.ElementType = typeof Button> = HuiPolymorphicProps<\n E,\n DialogTriggerOwnProps,\n ButtonSlots\n>;\n\nfunction Trigger<E extends JSX.ElementType = typeof Button>(rawProps: DialogTriggerProps<E>): VNode {\n const {\n as,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"DialogTrigger\", rawProps);\n\n const Component = as ?? Button;\n const cls = useHuiClasses(\"DialogTrigger\", { root: \"\" }, rawProps);\n const sls = useHuiStyles(\"DialogTrigger\", { root: rawProps.style });\n const {\n dialogId,\n modal,\n open,\n } = useDialogContext();\n const attrs = dialogControl.getTriggerAttributes(\n { id: dialogId },\n {\n modal,\n isButtonElement: as === undefined,\n },\n );\n\n const handleClick = useCallback((e: TargetedMouseEvent<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\ninterface DialogContentOwnProps {\n /**\n * The heading rendered at the top of the dialog content.\n */\n heading?: ComponentChildren | undefined;\n /**\n * Additional props passed to the internal heading component.\n */\n headingProps?: Omit<HeadingProps, \"children\" | \"id\" | \"class\" | \"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?: ComponentChildren | undefined;\n /**\n * Additional props passed to the internal close button.\n */\n closeButtonProps?: Omit<DialogCloseProps, \"children\" | \"class\" | \"className\" | \"style\"> | undefined;\n}\nexport type DialogContentProps = HuiComponentProps<\n Omit<ComponentProps<\"dialog\">, \"id\" | \"open\"> & DialogContentOwnProps,\n DialogSlots\n>;\n\nfunction Content(rawProps: DialogContentProps): VNode {\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 = dialogControl.getContentAttributes(\n state,\n {\n hasHeading: resolvedHeading !== undefined,\n ariaLabel: unwrapSignalish(ariaLabel),\n ariaLabelledBy: unwrapSignalish(ariaLabelledBy),\n },\n );\n const headingAttrs = 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 = useHuiClasses(\"DialogContent\", recipe, rawProps);\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\ninterface DialogCloseOwnProps {\n /**\n * The command used to close the dialog.\n *\n * @default \"request-close\"\n */\n command?: \"close\" | \"request-close\" | undefined;\n}\nexport type DialogCloseProps = Omit<ButtonProps, \"as\" | keyof DialogCloseOwnProps> & DialogCloseOwnProps;\n\nfunction Close(rawProps: DialogCloseProps): VNode {\n const props = useHuiProps(\"DialogClose\", rawProps);\n const cls = useHuiClasses(\"DialogClose\", { root: \"\" }, rawProps);\n const sls = useHuiStyles(\"DialogClose\", { root: rawProps.style });\n const dialogId = useDialogId();\n const attrs = 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":"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"}
|
|
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 { type ComponentChildren, type ComponentProps, type JSX, type TargetedMouseEvent, type VNode } from \"preact\";\nimport { useCallback, useId, useMemo } from \"preact/hooks\";\nimport { useHuiClasses, useHuiProps, useHuiStyles } from \"~/provider\";\nimport { type HuiComponentProps, type HuiPolymorphicProps } from \"~/types\";\nimport { unwrapSignalish } from \"~/utils\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { Heading, type HeadingProps } from \"../heading\";\nimport { DialogContext, type DialogContextValue, useDialogContext, useDialogId } from \"./dialog.context\";\n\nconst BUTTON_CLASSES = { root: \"\", content: \"\", spinner: \"\", status: \"\" } satisfies Record<ButtonSlots, string>;\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?: ComponentChildren | undefined;\n}\n\nfunction DialogRoot(rawProps: DialogProps): VNode {\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\ninterface DialogTriggerOwnProps {}\nexport type DialogTriggerProps<E extends JSX.ElementType = typeof Button<\"button\">> = HuiPolymorphicProps<\n E,\n DialogTriggerOwnProps,\n ButtonSlots\n>;\n\nfunction Trigger<E extends JSX.ElementType = typeof Button<\"button\">>(rawProps: DialogTriggerProps<E>): VNode {\n const {\n as,\n children,\n onClick,\n ...restProps\n } = useHuiProps(\"DialogTrigger\", rawProps);\n\n const Component = as ?? Button;\n const cls = useHuiClasses(\"DialogTrigger\", BUTTON_CLASSES, rawProps);\n const sls = useHuiStyles(\"DialogTrigger\", rawProps);\n const {\n dialogId,\n modal,\n open,\n } = useDialogContext();\n const attrs = dialogControl.getTriggerAttributes(\n { id: dialogId },\n {\n modal,\n isButtonElement: as === undefined,\n },\n );\n\n const handleClick = useCallback((e: TargetedMouseEvent<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 {...(Component === Button\n ? { classes: cls, styles: sls }\n : { className: cls.root, style: sls.root })}\n onClick={handleClick}\n {...restProps}\n >\n {children}\n </Component>\n );\n}\n\ninterface DialogContentOwnProps {\n /**\n * The heading rendered at the top of the dialog content.\n */\n heading?: ComponentChildren | undefined;\n /**\n * Additional props passed to the internal heading component.\n */\n headingProps?: Omit<HeadingProps, \"children\" | \"id\" | \"class\" | \"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?: ComponentChildren | undefined;\n /**\n * Additional props passed to the internal close button.\n */\n closeButtonProps?: Omit<DialogCloseProps, \"children\" | \"classes\" | \"styles\"> | undefined;\n}\nexport type DialogContentProps = HuiComponentProps<\n Omit<ComponentProps<\"dialog\">, \"id\" | \"open\"> & DialogContentOwnProps,\n DialogSlots\n>;\n\nfunction Content(rawProps: DialogContentProps): VNode {\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 = dialogControl.getContentAttributes(\n state,\n {\n hasHeading: resolvedHeading !== undefined,\n ariaLabel: unwrapSignalish(ariaLabel),\n ariaLabelledBy: unwrapSignalish(ariaLabelledBy),\n },\n );\n const headingAttrs = 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 = useHuiClasses(\"DialogContent\", recipe, rawProps);\n const sls = useHuiStyles(\"DialogContent\", rawProps);\n const closeButtonClasses = useMemo(() => ({ root: cls.closeButton }), [cls.closeButton]);\n const closeButtonStyles = useMemo(() => ({ root: sls.closeButton }), [sls.closeButton]);\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 classes={closeButtonClasses}\n styles={closeButtonStyles}\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\ninterface DialogCloseOwnProps {\n /**\n * The command used to close the dialog.\n *\n * @default \"request-close\"\n */\n command?: \"close\" | \"request-close\" | undefined;\n}\nexport type DialogCloseProps = Omit<ButtonProps, \"as\" | keyof DialogCloseOwnProps> & DialogCloseOwnProps;\n\nfunction Close(rawProps: DialogCloseProps): VNode {\n const props = useHuiProps(\"DialogClose\", rawProps);\n const cls = useHuiClasses(\"DialogClose\", BUTTON_CLASSES, rawProps);\n const sls = useHuiStyles(\"DialogClose\", rawProps);\n const dialogId = useDialogId();\n const attrs = dialogControl.getCloseAttributes({ id: dialogId });\n\n return (\n <Button\n {...attrs}\n {...props}\n classes={cls}\n styles={sls}\n />\n );\n}\n\nexport const Dialog = Object.assign(DialogRoot, {\n Trigger,\n Content,\n Close,\n});\n"],"mappings":"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"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { Dialog, DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps } from "./dialog.js";
|
|
2
|
-
|
|
3
|
-
export { Dialog, DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps, useDialogId };
|
|
2
|
+
export { Dialog, DialogCloseProps, DialogContentProps, DialogProps, DialogTriggerProps };
|
package/dist/components/dl/dl.js
CHANGED
|
@@ -6,7 +6,7 @@ function DlRoot(rawProps) {
|
|
|
6
6
|
const { children, ...restProps } = useHuiProps("Dl", rawProps);
|
|
7
7
|
const recipe = dlRecipe({});
|
|
8
8
|
const cls = useHuiClasses("Dl", recipe, rawProps);
|
|
9
|
-
const sls = useHuiStyles("Dl",
|
|
9
|
+
const sls = useHuiStyles("Dl", rawProps);
|
|
10
10
|
return /* @__PURE__ */ jsx("dl", {
|
|
11
11
|
className: cls.root,
|
|
12
12
|
style: sls.root,
|
|
@@ -18,7 +18,7 @@ function Dt(rawProps) {
|
|
|
18
18
|
const { children, ...restProps } = useHuiProps("DlDt", rawProps);
|
|
19
19
|
const recipe = dtRecipe({});
|
|
20
20
|
const cls = useHuiClasses("DlDt", recipe, rawProps);
|
|
21
|
-
const sls = useHuiStyles("DlDt",
|
|
21
|
+
const sls = useHuiStyles("DlDt", rawProps);
|
|
22
22
|
return /* @__PURE__ */ jsx("dt", {
|
|
23
23
|
className: cls.root,
|
|
24
24
|
style: sls.root,
|
|
@@ -30,7 +30,7 @@ function Dd(rawProps) {
|
|
|
30
30
|
const { children, ...restProps } = useHuiProps("DlDd", rawProps);
|
|
31
31
|
const recipe = ddRecipe({});
|
|
32
32
|
const cls = useHuiClasses("DlDd", recipe, rawProps);
|
|
33
|
-
const sls = useHuiStyles("DlDd",
|
|
33
|
+
const sls = useHuiStyles("DlDd", rawProps);
|
|
34
34
|
return /* @__PURE__ */ jsx("dd", {
|
|
35
35
|
className: cls.root,
|
|
36
36
|
style: sls.root,
|