@hjmds/react 1.34.0 → 1.35.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/dist/actions.d.ts +23 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +61 -6
- package/dist/actions.js.map +1 -1
- package/dist/advanced-display.d.ts +35 -2
- package/dist/advanced-display.d.ts.map +1 -1
- package/dist/advanced-display.js +28 -9
- package/dist/advanced-display.js.map +1 -1
- package/dist/anchor.d.ts +3 -1
- package/dist/anchor.d.ts.map +1 -1
- package/dist/anchor.js +5 -5
- package/dist/anchor.js.map +1 -1
- package/dist/auth-screen.d.ts.map +1 -1
- package/dist/auth-screen.js +5 -2
- package/dist/auth-screen.js.map +1 -1
- package/dist/avatar-blobatar-motion.d.ts.map +1 -1
- package/dist/avatar-blobatar-motion.js +2 -1
- package/dist/avatar-blobatar-motion.js.map +1 -1
- package/dist/avatar-blobatar.d.ts.map +1 -1
- package/dist/avatar-blobatar.js +2 -1
- package/dist/avatar-blobatar.js.map +1 -1
- package/dist/bottom-cta.d.ts +8 -1
- package/dist/bottom-cta.d.ts.map +1 -1
- package/dist/bottom-cta.js +6 -2
- package/dist/bottom-cta.js.map +1 -1
- package/dist/carousel-motion.d.ts.map +1 -1
- package/dist/carousel-motion.js +11 -2
- package/dist/carousel-motion.js.map +1 -1
- package/dist/carousel.d.ts +10 -0
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +23 -7
- package/dist/carousel.js.map +1 -1
- package/dist/collapsible.d.ts +6 -0
- package/dist/collapsible.d.ts.map +1 -1
- package/dist/collapsible.js +22 -20
- package/dist/collapsible.js.map +1 -1
- package/dist/collection-rail.d.ts +4 -4
- package/dist/collection-rail.d.ts.map +1 -1
- package/dist/collection-rail.js.map +1 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +4 -1
- package/dist/conversation-row.js.map +1 -1
- package/dist/data-table.d.ts +2 -0
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +2 -2
- package/dist/data-table.js.map +1 -1
- package/dist/display.d.ts +60 -5
- package/dist/display.d.ts.map +1 -1
- package/dist/display.js +32 -9
- package/dist/display.js.map +1 -1
- package/dist/evidence.d.ts +1 -1
- package/dist/evidence.d.ts.map +1 -1
- package/dist/evidence.js +2 -1
- package/dist/evidence.js.map +1 -1
- package/dist/feedback.d.ts +5 -0
- package/dist/feedback.d.ts.map +1 -1
- package/dist/feedback.js +7 -5
- package/dist/feedback.js.map +1 -1
- package/dist/floating-action-button.js +1 -1
- package/dist/floating-action-button.js.map +1 -1
- package/dist/forms.d.ts.map +1 -1
- package/dist/forms.js +4 -4
- package/dist/forms.js.map +1 -1
- package/dist/image-choice.js +3 -3
- package/dist/image-choice.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/initial-focus.d.ts +6 -0
- package/dist/internal/initial-focus.d.ts.map +1 -1
- package/dist/internal/initial-focus.js +6 -0
- package/dist/internal/initial-focus.js.map +1 -1
- package/dist/internal/pending-content.d.ts +19 -0
- package/dist/internal/pending-content.d.ts.map +1 -0
- package/dist/internal/pending-content.js +34 -0
- package/dist/internal/pending-content.js.map +1 -0
- package/dist/internal/screen-footer.d.ts +4 -2
- package/dist/internal/screen-footer.d.ts.map +1 -1
- package/dist/internal/screen-footer.js +2 -2
- package/dist/internal/screen-footer.js.map +1 -1
- package/dist/internal.d.ts +9 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +4 -0
- package/dist/internal.js.map +1 -1
- package/dist/navigation.d.ts.map +1 -1
- package/dist/navigation.js +58 -4
- package/dist/navigation.js.map +1 -1
- package/dist/number-field.d.ts.map +1 -1
- package/dist/number-field.js +4 -3
- package/dist/number-field.js.map +1 -1
- package/dist/overlays.d.ts +4 -0
- package/dist/overlays.d.ts.map +1 -1
- package/dist/overlays.js +46 -18
- package/dist/overlays.js.map +1 -1
- package/dist/public-exports.generated.d.ts +6 -0
- package/dist/public-exports.generated.d.ts.map +1 -1
- package/dist/public-exports.generated.js +18 -0
- package/dist/public-exports.generated.js.map +1 -1
- package/dist/screen-flows.d.ts +12 -5
- package/dist/screen-flows.d.ts.map +1 -1
- package/dist/screen-flows.js +25 -14
- package/dist/screen-flows.js.map +1 -1
- package/dist/screens.d.ts +18 -5
- package/dist/screens.d.ts.map +1 -1
- package/dist/screens.js +22 -11
- package/dist/screens.js.map +1 -1
- package/dist/selection.d.ts +22 -0
- package/dist/selection.d.ts.map +1 -1
- package/dist/selection.js +32 -9
- package/dist/selection.js.map +1 -1
- package/dist/shortcut-rail.d.ts +27 -0
- package/dist/shortcut-rail.d.ts.map +1 -0
- package/dist/shortcut-rail.js +37 -0
- package/dist/shortcut-rail.js.map +1 -0
- package/dist/steps.d.ts +5 -2
- package/dist/steps.d.ts.map +1 -1
- package/dist/steps.js +3 -3
- package/dist/steps.js.map +1 -1
- package/dist/styles.css +223 -48
- package/dist/styles.layered.css +223 -48
- package/dist/task-list.d.ts +3 -1
- package/dist/task-list.d.ts.map +1 -1
- package/dist/task-list.js +2 -2
- package/dist/task-list.js.map +1 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +1 -0
- package/dist/theme.js.map +1 -1
- package/dist/time-picker.d.ts +9 -0
- package/dist/time-picker.d.ts.map +1 -0
- package/dist/time-picker.js +74 -0
- package/dist/time-picker.js.map +1 -0
- package/dist/top-bar.d.ts +4 -0
- package/dist/top-bar.d.ts.map +1 -1
- package/dist/top-bar.js +2 -2
- package/dist/top-bar.js.map +1 -1
- package/package.json +26 -15
package/dist/actions.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ButtonAlign, type ButtonEdge, type ButtonShape, type ButtonSize, type ButtonTone } from "@hjmds/design-contracts/recipes/base";
|
|
2
|
-
export type { ButtonAlign, ButtonEdge, ButtonShape };
|
|
1
|
+
import { type ButtonAppearance, type ButtonAlign, type ButtonEdge, type ButtonShape, type ButtonSize, type ButtonTone } from "@hjmds/design-contracts/recipes/base";
|
|
2
|
+
export type { ButtonAlign, ButtonEdge, ButtonShape, ButtonAppearance };
|
|
3
3
|
import { type IconButtonEdge, type IconButtonShape, type IconButtonSize, type IconButtonTone, type LinkTone, type LinkVariant } from "@hjmds/design-contracts/recipes";
|
|
4
4
|
import { type AnchorHTMLAttributes, type ButtonHTMLAttributes, type ForwardedRef, type ReactElement, type ReactNode } from "react";
|
|
5
5
|
export type { ButtonSize, ButtonTone } from "@hjmds/design-contracts/recipes/base";
|
|
@@ -10,6 +10,8 @@ export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & Readonly<{
|
|
|
10
10
|
size?: ButtonSize;
|
|
11
11
|
/** Frame geometry. `pill` replaces product code that overrode `border-radius`. */
|
|
12
12
|
shape?: ButtonShape;
|
|
13
|
+
appearance?: ButtonAppearance;
|
|
14
|
+
fullWidth?: boolean;
|
|
13
15
|
/** Label placement inside the frame; `leading` suits a full-width row action. */
|
|
14
16
|
align?: ButtonAlign;
|
|
15
17
|
/** Toggle state. Paints the selected treatment and sets `aria-pressed`. */
|
|
@@ -35,6 +37,8 @@ export declare const Button: import("react").ForwardRefExoticComponent<ButtonHTM
|
|
|
35
37
|
size?: ButtonSize;
|
|
36
38
|
/** Frame geometry. `pill` replaces product code that overrode `border-radius`. */
|
|
37
39
|
shape?: ButtonShape;
|
|
40
|
+
appearance?: ButtonAppearance;
|
|
41
|
+
fullWidth?: boolean;
|
|
38
42
|
/** Label placement inside the frame; `leading` suits a full-width row action. */
|
|
39
43
|
align?: ButtonAlign;
|
|
40
44
|
/** Toggle state. Paints the selected treatment and sets `aria-pressed`. */
|
|
@@ -55,6 +59,23 @@ export declare const Button: import("react").ForwardRefExoticComponent<ButtonHTM
|
|
|
55
59
|
/** Canonical layout-only placement. Controlled visual keys are excluded. */
|
|
56
60
|
layoutStyle?: HjmCompositionStyleProp;
|
|
57
61
|
}> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
62
|
+
/** Web navigation with Button paint. Mutation/loading/toggle semantics belong to Button. */
|
|
63
|
+
export type ButtonLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & Pick<ButtonProps, "tone" | "size" | "shape" | "appearance" | "fullWidth" | "align" | "leading" | "trailing" | "edge" | "layoutStyle"> & Readonly<{
|
|
64
|
+
href: string;
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
/** Framework routing adapter; HJM still owns the anchor destination, ref and disabled guards. */
|
|
67
|
+
renderAnchor?: (props: AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
68
|
+
ref: ForwardedRef<HTMLAnchorElement>;
|
|
69
|
+
}) => ReactElement;
|
|
70
|
+
}>;
|
|
71
|
+
export declare const ButtonLink: import("react").ForwardRefExoticComponent<AnchorHTMLAttributes<HTMLAnchorElement> & Pick<ButtonProps, "appearance" | "tone" | "size" | "layoutStyle" | "align" | "leading" | "trailing" | "shape" | "fullWidth" | "edge"> & Readonly<{
|
|
72
|
+
href: string;
|
|
73
|
+
disabled?: boolean;
|
|
74
|
+
/** Framework routing adapter; HJM still owns the anchor destination, ref and disabled guards. */
|
|
75
|
+
renderAnchor?: (props: AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
76
|
+
ref: ForwardedRef<HTMLAnchorElement>;
|
|
77
|
+
}) => ReactElement;
|
|
78
|
+
}> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
58
79
|
export type IconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & Readonly<{
|
|
59
80
|
label: string;
|
|
60
81
|
tone?: IconButtonTone;
|
package/dist/actions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.tsx"],"names":[],"mapp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,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,6FAA6F;IAC7F,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,YAAY,CAAC;IACxD,gGAAgG;IAChG,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACvC,CAAC,CAAC;AAEL,eAAO,MAAM,IAAI;WAXN,QAAQ;cACL,WAAW;eACV,OAAO;cACR,SAAS;eACR,SAAS;IACpB,6FAA6F;mBAC9E,CAAC,KAAK,EAAE,eAAe,KAAK,YAAY;IACvD,gGAAgG;kBAClF,uBAAuB;sDAqDvC,CAAC"}
|
package/dist/actions.js
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { buttonRecipe, } from "@hjmds/design-contracts/recipes/base";
|
|
2
|
+
import { buttonRecipe, resolveButtonDepth, } from "@hjmds/design-contracts/recipes/base";
|
|
3
3
|
import { iconButtonRecipe, linkRecipe, } from "@hjmds/design-contracts/recipes";
|
|
4
|
-
import { Children, forwardRef, } from "react";
|
|
5
|
-
import { classNames } from "./internal.js";
|
|
6
|
-
|
|
4
|
+
import { Children, useContext, forwardRef, } from "react";
|
|
5
|
+
import { DesignProfileContext, classNames } from "./internal.js";
|
|
6
|
+
// Both semantic hosts use the same recipe and product profile; navigation must not
|
|
7
|
+
// recreate button paint in a product or turn an anchor into a nested button.
|
|
8
|
+
function useButtonPaint(tone, size, suppliedShape, suppliedAppearance) {
|
|
9
|
+
const profile = useContext(DesignProfileContext);
|
|
10
|
+
const shape = suppliedShape ?? profile?.controls?.button?.shape ?? buttonRecipe.defaults.shape;
|
|
11
|
+
const appearance = suppliedAppearance ?? profile?.controls?.button?.appearance ?? buttonRecipe.defaults.appearance;
|
|
12
|
+
const depth = resolveButtonDepth(appearance, tone, size);
|
|
13
|
+
const side = tone === "secondary" ? "var(--hjm-color-border-control)" : tone === "danger" ? "var(--hjm-color-danger-fill)" : "var(--hjm-color-primary)";
|
|
14
|
+
return { shape, appearance, depth, style: {
|
|
15
|
+
"--hjm-button-label-lines": buttonRecipe.label.maxLines,
|
|
16
|
+
"--hjm-button-depth": `${depth}px`, "--hjm-button-side": side,
|
|
17
|
+
"--hjm-button-side-shade": `${buttonRecipe.raised.sideShade * 100}%`,
|
|
18
|
+
"--hjm-button-face-padding": `${buttonRecipe.sizes[size].paddingHorizontal}px`,
|
|
19
|
+
"--hjm-button-settle": `${buttonRecipe.raised.settleDuration}ms`,
|
|
20
|
+
} };
|
|
21
|
+
}
|
|
22
|
+
export const Button = forwardRef(function Button({ tone = buttonRecipe.defaults.tone, size = buttonRecipe.defaults.size, shape: suppliedShape, appearance: suppliedAppearance, fullWidth = false, align = buttonRecipe.defaults.align, selected, loading = false, completion, leading, trailing, edge, disabled, onClick, type = "button", className, children, layoutStyle, style, ...props }, ref) {
|
|
23
|
+
const { shape, appearance, depth, style: paintStyle } = useButtonPaint(tone, size, suppliedShape, suppliedAppearance);
|
|
7
24
|
const textParts = completion ? Children.toArray(children) : [];
|
|
8
25
|
if (completion && (!completion.label.trim() || typeof completion.confirmed !== "boolean" || textParts.length === 0 || !textParts.every(part => typeof part === "string" || typeof part === "number"))) {
|
|
9
26
|
throw new TypeError("Button completion requires a nonempty label, a boolean confirmed value and text-only children");
|
|
@@ -21,9 +38,47 @@ export const Button = forwardRef(function Button({ tone = buttonRecipe.defaults.
|
|
|
21
38
|
}
|
|
22
39
|
onClick?.(event);
|
|
23
40
|
};
|
|
24
|
-
|
|
41
|
+
const content = _jsxs(_Fragment, { children: [leading, completion ? _jsxs("span", { style: { display: "inline-grid", minWidth: 0 }, children: [_jsx("span", { "aria-hidden": "true", className: "hjm-button__label", style: { gridArea: "1 / 1", visibility: "hidden" }, children: idleLabel }), _jsx("span", { "aria-hidden": "true", className: "hjm-button__label", style: { gridArea: "1 / 1", visibility: "hidden" }, children: completion.label }), _jsx("span", { className: "hjm-button__label", style: { gridArea: "1 / 1", alignSelf: "center" }, children: currentLabel })] }) : _jsx("span", { className: "hjm-button__label", children: children }), trailing, loading ? _jsx("span", { className: "hjm-button__loading-indicator", "aria-hidden": "true", children: _jsx("span", { className: "hjm-button__spinner" }) }) : null] });
|
|
42
|
+
return (_jsx("button", { ...props,
|
|
25
43
|
// The cap lives in the recipe, not in the stylesheet: one number, one place.
|
|
26
|
-
style: {
|
|
44
|
+
style: { ...paintStyle, ...style, ...layoutStyle }, ref: ref, type: type, className: classNames("hjm-button", className), "data-tone": tone, "data-size": size, "data-shape": shape, "data-appearance": appearance, "data-raised": depth > 0 || undefined, "data-full-width": fullWidth || undefined, "data-align": align, "data-edge": edge, ...(selected === undefined ? {} : { "data-selected": selected, "aria-pressed": selected }), "data-state": loading ? "loading" : unavailable ? "disabled" : "idle", "aria-busy": loading || undefined, "aria-disabled": unavailable || undefined, disabled: disabled && !loading, onClick: handleClick, children: depth > 0 ? _jsx("span", { className: "hjm-button__face", children: content }) : content }));
|
|
45
|
+
});
|
|
46
|
+
export const ButtonLink = forwardRef(function ButtonLink({ href, disabled = false, tone = buttonRecipe.defaults.tone, size = buttonRecipe.defaults.size, shape: suppliedShape, appearance: suppliedAppearance, fullWidth = false, align = buttonRecipe.defaults.align, leading, trailing, edge, layoutStyle, children, className, style, onClick, onAuxClick, tabIndex, renderAnchor, ...props }, ref) {
|
|
47
|
+
const { shape, appearance, depth, style: paintStyle } = useButtonPaint(tone, size, suppliedShape, suppliedAppearance);
|
|
48
|
+
const unavailable = disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
|
|
49
|
+
const activate = (callback) => (event) => {
|
|
50
|
+
if (unavailable) {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
event.stopPropagation();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
callback?.(event);
|
|
56
|
+
};
|
|
57
|
+
const content = _jsxs(_Fragment, { children: [leading, _jsx("span", { className: "hjm-button__label", children: children }), trailing] });
|
|
58
|
+
const anchorProps = {
|
|
59
|
+
...props,
|
|
60
|
+
ref,
|
|
61
|
+
// Adapters must also receive no href while unavailable, including their framework's navigation path.
|
|
62
|
+
href: unavailable ? undefined : href,
|
|
63
|
+
role: unavailable ? "link" : props.role,
|
|
64
|
+
"aria-disabled": unavailable || undefined,
|
|
65
|
+
tabIndex: unavailable ? -1 : tabIndex,
|
|
66
|
+
onClick: activate(onClick),
|
|
67
|
+
onAuxClick: activate(onAuxClick),
|
|
68
|
+
className: classNames("hjm-button", className),
|
|
69
|
+
style: { ...paintStyle, ...style, ...layoutStyle },
|
|
70
|
+
"data-tone": tone,
|
|
71
|
+
"data-size": size,
|
|
72
|
+
"data-shape": shape,
|
|
73
|
+
"data-appearance": appearance,
|
|
74
|
+
"data-raised": depth > 0 || undefined,
|
|
75
|
+
"data-full-width": fullWidth || undefined,
|
|
76
|
+
"data-align": align,
|
|
77
|
+
"data-edge": edge,
|
|
78
|
+
"data-state": unavailable ? "disabled" : "idle",
|
|
79
|
+
children: depth > 0 ? _jsx("span", { className: "hjm-button__face", children: content }) : content,
|
|
80
|
+
};
|
|
81
|
+
return renderAnchor ? renderAnchor(anchorProps) : _jsx("a", { ...anchorProps });
|
|
27
82
|
});
|
|
28
83
|
export const IconButton = forwardRef(function IconButton({ label, tone = iconButtonRecipe.defaults.tone, size = iconButtonRecipe.defaults.size, shape = iconButtonRecipe.defaults.shape, selected, loading = false, edge, disabled, onClick, type = "button", className, children, layoutStyle, style, ...props }, ref) {
|
|
29
84
|
// Preserve a focusable disabled action (e.g. a Carousel boundary).
|
package/dist/actions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,GAMb,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EACL,gBAAgB,EAChB,UAAU,GAOX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,QAAQ,EACR,UAAU,GAQX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AAO,WAAW,GAAI,CAAC;AAC3E,CAAC,CAAC,CAAC","sourcesContent":["import {\n buttonRecipe,\n type ButtonAlign,\n type ButtonEdge,\n type ButtonShape,\n type ButtonSize,\n type ButtonTone,\n} from \"@hjmds/design-contracts/recipes/base\";\n\nexport type { ButtonAlign, ButtonEdge, ButtonShape };\nimport {\n iconButtonRecipe,\n linkRecipe,\n type IconButtonEdge,\n type IconButtonShape,\n type IconButtonSize,\n type IconButtonTone,\n type LinkTone,\n type LinkVariant,\n} from \"@hjmds/design-contracts/recipes\";\nimport {\n Children,\n forwardRef,\n type AnchorHTMLAttributes,\n type CSSProperties,\n type ButtonHTMLAttributes,\n type ForwardedRef,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { classNames } from \"./internal.js\";\n\nexport type { ButtonSize, ButtonTone } from \"@hjmds/design-contracts/recipes/base\";\nexport type {\n IconButtonEdge,\n IconButtonShape,\n IconButtonSize,\n IconButtonTone,\n} from \"@hjmds/design-contracts/recipes\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n Readonly<{\n tone?: ButtonTone;\n size?: ButtonSize;\n /** Frame geometry. `pill` replaces product code that overrode `border-radius`. */\n shape?: ButtonShape;\n /** Label placement inside the frame; `leading` suits a full-width row action. */\n align?: ButtonAlign;\n /** Toggle state. Paints the selected treatment and sets `aria-pressed`. */\n selected?: boolean;\n loading?: boolean;\n /** Explicit confirmed mutation result. Both text labels remain measured in every state. */\n completion?: Readonly<{ confirmed: boolean; label: string }>;\n leading?: ReactNode;\n trailing?: ReactNode;\n /**\n * Container edge(s) this button sits on. A ghost button overhangs that edge by its inline padding so the label\n * or trailing glyph lines up with the container inset (`resolveButtonEdgeOverhang`); framed tones keep their frame.\n */\n edge?: ButtonEdge;\n /** Canonical layout-only placement. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n tone = buttonRecipe.defaults.tone,\n size = buttonRecipe.defaults.size,\n shape = buttonRecipe.defaults.shape,\n align = buttonRecipe.defaults.align,\n selected,\n loading = false,\n completion,\n leading,\n trailing,\n edge,\n disabled,\n onClick,\n type = \"button\",\n className,\n children,\n layoutStyle,\n style,\n ...props\n },\n ref,\n) {\n const textParts = completion ? Children.toArray(children) : [];\n if (completion && (!completion.label.trim() || typeof completion.confirmed !== \"boolean\" || textParts.length === 0 || !textParts.every(part => typeof part === \"string\" || typeof part === \"number\"))) {\n throw new TypeError(\"Button completion requires a nonempty label, a boolean confirmed value and text-only children\");\n }\n const idleLabel = completion ? textParts.join(\"\") : children;\n const currentLabel = completion?.confirmed && !loading ? completion.label : idleLabel;\n // Preserve a focusable disabled action (e.g. a Carousel boundary).\n const ariaDisabled = props[\"aria-disabled\"] === true || props[\"aria-disabled\"] === \"true\";\n const unavailable = disabled === true || loading || ariaDisabled;\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (unavailable) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n onClick?.(event);\n };\n return (\n <button\n {...props}\n // The cap lives in the recipe, not in the stylesheet: one number, one place.\n style={{ \"--hjm-button-label-lines\": buttonRecipe.label.maxLines, ...style, ...layoutStyle } as CSSProperties}\n ref={ref}\n type={type}\n className={classNames(\"hjm-button\", className)}\n data-tone={tone}\n data-size={size}\n data-shape={shape}\n data-align={align}\n data-edge={edge}\n {...(selected === undefined ? {} : { \"data-selected\": selected, \"aria-pressed\": selected })}\n data-state={loading ? \"loading\" : unavailable ? \"disabled\" : \"idle\"}\n aria-busy={loading || undefined}\n aria-disabled={unavailable || undefined}\n disabled={disabled}\n onClick={handleClick}\n >\n {leading}\n {completion ? <span style={{ display: \"inline-grid\", minWidth: 0 }}>\n {/* Both labels contribute intrinsic dimensions, including wrapping/font changes. */}\n <span aria-hidden=\"true\" className=\"hjm-button__label\" style={{ gridArea: \"1 / 1\", visibility: \"hidden\" }}>{idleLabel}</span>\n <span aria-hidden=\"true\" className=\"hjm-button__label\" style={{ gridArea: \"1 / 1\", visibility: \"hidden\" }}>{completion.label}</span>\n <span className=\"hjm-button__label\" style={{ gridArea: \"1 / 1\", alignSelf: \"center\" }}>{currentLabel}</span>\n </span> : <span className=\"hjm-button__label\">{children}</span>}\n {trailing}\n {loading ? <span className=\"hjm-button__loading-indicator\" aria-hidden=\"true\"><span className=\"hjm-button__spinner\" /></span> : null}\n </button>\n );\n});\n\nexport type IconButtonProps = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"aria-label\"\n> &\n Readonly<{\n label: string;\n tone?: IconButtonTone;\n size?: IconButtonSize;\n shape?: IconButtonShape;\n /** Toggle state. Paints the selected treatment and sets `aria-pressed`. */\n selected?: boolean;\n loading?: boolean;\n /**\n * Container edge(s) this button sits on (logical, RTL-aware). A ghost button keeps its touch target but overhangs\n * the edge by (diameter − glyph slot) / 2 so the glyph slot lines up with the container inset\n * (`resolveIconButtonEdgeOverhang`, 2026-10-17 measured audit). Framed tones align their frame and do not move.\n */\n edge?: IconButtonEdge;\n children: ReactNode;\n /** Canonical layout-only placement. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n function IconButton(\n {\n label,\n tone = iconButtonRecipe.defaults.tone,\n size = iconButtonRecipe.defaults.size,\n shape = iconButtonRecipe.defaults.shape,\n selected,\n loading = false,\n edge,\n disabled,\n onClick,\n type = \"button\",\n className,\n children,\n layoutStyle,\n style,\n ...props\n },\n ref,\n ) {\n // Preserve a focusable disabled action (e.g. a Carousel boundary).\n const ariaDisabled = props[\"aria-disabled\"] === true || props[\"aria-disabled\"] === \"true\";\n const unavailable = disabled === true || loading || ariaDisabled;\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (unavailable) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n onClick?.(event);\n };\n return (\n <button\n {...props}\n style={{ ...style, ...layoutStyle }}\n ref={ref}\n type={type}\n className={classNames(\"hjm-icon-button\", className)}\n data-tone={tone}\n data-size={size}\n data-shape={shape}\n data-edge={edge}\n {...(selected === undefined ? {} : { \"data-selected\": selected, \"aria-pressed\": selected })}\n data-state={loading ? \"loading\" : unavailable ? \"disabled\" : \"idle\"}\n aria-label={label}\n aria-busy={loading || undefined}\n aria-disabled={unavailable || undefined}\n disabled={disabled}\n onClick={handleClick}\n >\n {loading ? <span className=\"hjm-button__spinner\" aria-hidden=\"true\" /> : children}\n </button>\n );\n },\n);\n\nexport type LinkRenderProps = AnchorHTMLAttributes<HTMLAnchorElement> &\n Readonly<{\n children: ReactNode;\n ref: ForwardedRef<HTMLAnchorElement>;\n \"data-tone\": LinkTone;\n \"data-variant\": LinkVariant;\n \"data-state\": \"disabled\" | \"idle\";\n }>;\n\nexport type LinkProps = AnchorHTMLAttributes<HTMLAnchorElement> &\n Readonly<{\n tone?: LinkTone;\n variant?: LinkVariant;\n disabled?: boolean;\n leading?: ReactNode;\n trailing?: ReactNode;\n /** Framework adapter, for example Next.js Link, while HJM keeps link semantics and state. */\n renderAnchor?: (props: LinkRenderProps) => ReactElement;\n /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n }>;\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n {\n tone = linkRecipe.defaults.tone,\n variant = linkRecipe.defaults.variant,\n disabled = false,\n leading,\n trailing,\n renderAnchor,\n target,\n rel,\n tabIndex,\n onClick,\n className,\n children,\n layoutStyle,\n ...props\n },\n ref,\n) {\n const handleClick = (event: MouseEvent<HTMLAnchorElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n onClick?.(event);\n };\n const anchorProps: LinkRenderProps = {\n ...props,\n // `renderAnchor` adapters receive the merged placement, so a framework Link\n // gets the same position as the plain <a>.\n ...(props.style === undefined && layoutStyle === undefined ? {} : { style: { ...props.style, ...layoutStyle } }),\n ref,\n className: classNames(\"hjm-link\", className),\n \"data-tone\": tone,\n \"data-variant\": variant,\n \"data-state\": disabled ? \"disabled\" : \"idle\",\n \"aria-disabled\": disabled || undefined,\n tabIndex: disabled ? -1 : tabIndex,\n target,\n rel: rel ?? (target === \"_blank\" ? \"noreferrer noopener\" : undefined),\n onClick: handleClick,\n children: (\n <>\n {leading}\n <span>{children}</span>\n {trailing}\n </>\n ),\n };\n return renderAnchor ? renderAnchor(anchorProps) : <a {...anchorProps} />;\n});\n"]}
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,GAOnB,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EACL,gBAAgB,EAChB,UAAU,GAOX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,UAAU,GAQX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAqCjE,mFAAmF;AACnF,6EAA6E;AAC7E,SAAS,cAAc,CAAC,IAAgB,EAAE,IAAgB,EAAE,aAA2B,EAAE,kBAAqC;IAC5H,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,aAAa,IAAI,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC/F,MAAM,UAAU,GAAG,kBAAkB,IAAI,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,IAAI,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC;IACnH,MAAM,KAAK,GAAG,kBAAkB,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,iCAAiC,CAAC,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KAAK,EAAE,GAAG,WAAW,EAAE,EAAE,CAAC;QAChH,GAAG;QACH,SAAS,EAAE,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC;QAC5C,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE,OAAO;QACvB,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM;QAC5C,eAAe,EAAE,QAAQ,IAAI,SAAS;QACtC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ;QAClC,MAAM;QACN,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,CAAC;QACrE,OAAO,EAAE,WAAW;QACpB,QAAQ,EAAE,CACR,8BACC,OAAO,EACR,yBAAO,QAAQ,GAAQ,EACtB,QAAQ,IACN,CACJ;KACF,CAAC;IACF,OAAO,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,eAAO,WAAW,GAAI,CAAC;AAC3E,CAAC,CAAC,CAAC","sourcesContent":["import {\n buttonRecipe,\n resolveButtonDepth,\n type ButtonAppearance,\n type ButtonAlign,\n type ButtonEdge,\n type ButtonShape,\n type ButtonSize,\n type ButtonTone,\n} from \"@hjmds/design-contracts/recipes/base\";\n\nexport type { ButtonAlign, ButtonEdge, ButtonShape, ButtonAppearance };\nimport {\n iconButtonRecipe,\n linkRecipe,\n type IconButtonEdge,\n type IconButtonShape,\n type IconButtonSize,\n type IconButtonTone,\n type LinkTone,\n type LinkVariant,\n} from \"@hjmds/design-contracts/recipes\";\nimport {\n Children,\n useContext,\n forwardRef,\n type AnchorHTMLAttributes,\n type CSSProperties,\n type ButtonHTMLAttributes,\n type ForwardedRef,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { DesignProfileContext, classNames } from \"./internal.js\";\n\nexport type { ButtonSize, ButtonTone } from \"@hjmds/design-contracts/recipes/base\";\nexport type {\n IconButtonEdge,\n IconButtonShape,\n IconButtonSize,\n IconButtonTone,\n} from \"@hjmds/design-contracts/recipes\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n Readonly<{\n tone?: ButtonTone;\n size?: ButtonSize;\n /** Frame geometry. `pill` replaces product code that overrode `border-radius`. */\n shape?: ButtonShape;\n appearance?: ButtonAppearance;\n fullWidth?: boolean;\n /** Label placement inside the frame; `leading` suits a full-width row action. */\n align?: ButtonAlign;\n /** Toggle state. Paints the selected treatment and sets `aria-pressed`. */\n selected?: boolean;\n loading?: boolean;\n /** Explicit confirmed mutation result. Both text labels remain measured in every state. */\n completion?: Readonly<{ confirmed: boolean; label: string }>;\n leading?: ReactNode;\n trailing?: ReactNode;\n /**\n * Container edge(s) this button sits on. A ghost button overhangs that edge by its inline padding so the label\n * or trailing glyph lines up with the container inset (`resolveButtonEdgeOverhang`); framed tones keep their frame.\n */\n edge?: ButtonEdge;\n /** Canonical layout-only placement. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\n// Both semantic hosts use the same recipe and product profile; navigation must not\n// recreate button paint in a product or turn an anchor into a nested button.\nfunction useButtonPaint(tone: ButtonTone, size: ButtonSize, suppliedShape?: ButtonShape, suppliedAppearance?: ButtonAppearance) {\n const profile = useContext(DesignProfileContext);\n const shape = suppliedShape ?? profile?.controls?.button?.shape ?? buttonRecipe.defaults.shape;\n const appearance = suppliedAppearance ?? profile?.controls?.button?.appearance ?? buttonRecipe.defaults.appearance;\n const depth = resolveButtonDepth(appearance, tone, size);\n const side = tone === \"secondary\" ? \"var(--hjm-color-border-control)\" : tone === \"danger\" ? \"var(--hjm-color-danger-fill)\" : \"var(--hjm-color-primary)\";\n return { shape, appearance, depth, style: {\n \"--hjm-button-label-lines\": buttonRecipe.label.maxLines,\n \"--hjm-button-depth\": `${depth}px`, \"--hjm-button-side\": side,\n \"--hjm-button-side-shade\": `${buttonRecipe.raised.sideShade * 100}%`,\n \"--hjm-button-face-padding\": `${buttonRecipe.sizes[size].paddingHorizontal}px`,\n \"--hjm-button-settle\": `${buttonRecipe.raised.settleDuration}ms`,\n } as CSSProperties };\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n tone = buttonRecipe.defaults.tone,\n size = buttonRecipe.defaults.size,\n shape: suppliedShape,\n appearance: suppliedAppearance,\n fullWidth = false,\n align = buttonRecipe.defaults.align,\n selected,\n loading = false,\n completion,\n leading,\n trailing,\n edge,\n disabled,\n onClick,\n type = \"button\",\n className,\n children,\n layoutStyle,\n style,\n ...props\n },\n ref,\n) {\n const { shape, appearance, depth, style: paintStyle } = useButtonPaint(tone, size, suppliedShape, suppliedAppearance);\n const textParts = completion ? Children.toArray(children) : [];\n if (completion && (!completion.label.trim() || typeof completion.confirmed !== \"boolean\" || textParts.length === 0 || !textParts.every(part => typeof part === \"string\" || typeof part === \"number\"))) {\n throw new TypeError(\"Button completion requires a nonempty label, a boolean confirmed value and text-only children\");\n }\n const idleLabel = completion ? textParts.join(\"\") : children;\n const currentLabel = completion?.confirmed && !loading ? completion.label : idleLabel;\n // Preserve a focusable disabled action (e.g. a Carousel boundary).\n const ariaDisabled = props[\"aria-disabled\"] === true || props[\"aria-disabled\"] === \"true\";\n const unavailable = disabled === true || loading || ariaDisabled;\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (unavailable) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n onClick?.(event);\n };\n const content = <>\n {leading}\n {completion ? <span style={{ display: \"inline-grid\", minWidth: 0 }}>\n {/* Both labels contribute intrinsic dimensions, including wrapping/font changes. */}\n <span aria-hidden=\"true\" className=\"hjm-button__label\" style={{ gridArea: \"1 / 1\", visibility: \"hidden\" }}>{idleLabel}</span>\n <span aria-hidden=\"true\" className=\"hjm-button__label\" style={{ gridArea: \"1 / 1\", visibility: \"hidden\" }}>{completion.label}</span>\n <span className=\"hjm-button__label\" style={{ gridArea: \"1 / 1\", alignSelf: \"center\" }}>{currentLabel}</span>\n </span> : <span className=\"hjm-button__label\">{children}</span>}\n {trailing}\n {loading ? <span className=\"hjm-button__loading-indicator\" aria-hidden=\"true\"><span className=\"hjm-button__spinner\" /></span> : null}\n </>;\n return (\n <button\n {...props}\n // The cap lives in the recipe, not in the stylesheet: one number, one place.\n style={{ ...paintStyle, ...style, ...layoutStyle }}\n ref={ref}\n type={type}\n className={classNames(\"hjm-button\", className)}\n data-tone={tone}\n data-size={size}\n data-shape={shape}\n data-appearance={appearance}\n data-raised={depth > 0 || undefined}\n data-full-width={fullWidth || undefined}\n data-align={align}\n data-edge={edge}\n {...(selected === undefined ? {} : { \"data-selected\": selected, \"aria-pressed\": selected })}\n data-state={loading ? \"loading\" : unavailable ? \"disabled\" : \"idle\"}\n aria-busy={loading || undefined}\n aria-disabled={unavailable || undefined}\n disabled={disabled && !loading}\n onClick={handleClick}\n >\n {depth > 0 ? <span className=\"hjm-button__face\">{content}</span> : content}\n </button>\n );\n});\n\n/** Web navigation with Button paint. Mutation/loading/toggle semantics belong to Button. */\nexport type ButtonLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> &\n Pick<ButtonProps, \"tone\" | \"size\" | \"shape\" | \"appearance\" | \"fullWidth\" | \"align\" | \"leading\" | \"trailing\" | \"edge\" | \"layoutStyle\"> &\n Readonly<{\n href: string;\n disabled?: boolean;\n /** Framework routing adapter; HJM still owns the anchor destination, ref and disabled guards. */\n renderAnchor?: (props: AnchorHTMLAttributes<HTMLAnchorElement> & { ref: ForwardedRef<HTMLAnchorElement> }) => ReactElement;\n }>;\n\nexport const ButtonLink = forwardRef<HTMLAnchorElement, ButtonLinkProps>(function ButtonLink({\n href, disabled = false, tone = buttonRecipe.defaults.tone, size = buttonRecipe.defaults.size,\n shape: suppliedShape, appearance: suppliedAppearance, fullWidth = false,\n align = buttonRecipe.defaults.align, leading, trailing, edge, layoutStyle,\n children, className, style, onClick, onAuxClick, tabIndex, renderAnchor, ...props\n}, ref) {\n const { shape, appearance, depth, style: paintStyle } = useButtonPaint(tone, size, suppliedShape, suppliedAppearance);\n const unavailable = disabled || props[\"aria-disabled\"] === true || props[\"aria-disabled\"] === \"true\";\n const activate = (callback: typeof onClick) => (event: MouseEvent<HTMLAnchorElement>) => {\n if (unavailable) { event.preventDefault(); event.stopPropagation(); return; }\n callback?.(event);\n };\n const content = <>{leading}<span className=\"hjm-button__label\">{children}</span>{trailing}</>;\n const anchorProps = {\n ...props,\n ref,\n // Adapters must also receive no href while unavailable, including their framework's navigation path.\n href: unavailable ? undefined : href,\n role: unavailable ? \"link\" : props.role,\n \"aria-disabled\": unavailable || undefined,\n tabIndex: unavailable ? -1 : tabIndex,\n onClick: activate(onClick),\n onAuxClick: activate(onAuxClick),\n className: classNames(\"hjm-button\", className),\n style: { ...paintStyle, ...style, ...layoutStyle },\n \"data-tone\": tone,\n \"data-size\": size,\n \"data-shape\": shape,\n \"data-appearance\": appearance,\n \"data-raised\": depth > 0 || undefined,\n \"data-full-width\": fullWidth || undefined,\n \"data-align\": align,\n \"data-edge\": edge,\n \"data-state\": unavailable ? \"disabled\" : \"idle\",\n children: depth > 0 ? <span className=\"hjm-button__face\">{content}</span> : content,\n };\n return renderAnchor ? renderAnchor(anchorProps) : <a {...anchorProps} />;\n});\n\nexport type IconButtonProps = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n \"aria-label\"\n> &\n Readonly<{\n label: string;\n tone?: IconButtonTone;\n size?: IconButtonSize;\n shape?: IconButtonShape;\n /** Toggle state. Paints the selected treatment and sets `aria-pressed`. */\n selected?: boolean;\n loading?: boolean;\n /**\n * Container edge(s) this button sits on (logical, RTL-aware). A ghost button keeps its touch target but overhangs\n * the edge by (diameter − glyph slot) / 2 so the glyph slot lines up with the container inset\n * (`resolveIconButtonEdgeOverhang`, 2026-10-17 measured audit). Framed tones align their frame and do not move.\n */\n edge?: IconButtonEdge;\n children: ReactNode;\n /** Canonical layout-only placement. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n function IconButton(\n {\n label,\n tone = iconButtonRecipe.defaults.tone,\n size = iconButtonRecipe.defaults.size,\n shape = iconButtonRecipe.defaults.shape,\n selected,\n loading = false,\n edge,\n disabled,\n onClick,\n type = \"button\",\n className,\n children,\n layoutStyle,\n style,\n ...props\n },\n ref,\n ) {\n // Preserve a focusable disabled action (e.g. a Carousel boundary).\n const ariaDisabled = props[\"aria-disabled\"] === true || props[\"aria-disabled\"] === \"true\";\n const unavailable = disabled === true || loading || ariaDisabled;\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (unavailable) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n onClick?.(event);\n };\n return (\n <button\n {...props}\n style={{ ...style, ...layoutStyle }}\n ref={ref}\n type={type}\n className={classNames(\"hjm-icon-button\", className)}\n data-tone={tone}\n data-size={size}\n data-shape={shape}\n data-edge={edge}\n {...(selected === undefined ? {} : { \"data-selected\": selected, \"aria-pressed\": selected })}\n data-state={loading ? \"loading\" : unavailable ? \"disabled\" : \"idle\"}\n aria-label={label}\n aria-busy={loading || undefined}\n aria-disabled={unavailable || undefined}\n disabled={disabled}\n onClick={handleClick}\n >\n {loading ? <span className=\"hjm-button__spinner\" aria-hidden=\"true\" /> : children}\n </button>\n );\n },\n);\n\nexport type LinkRenderProps = AnchorHTMLAttributes<HTMLAnchorElement> &\n Readonly<{\n children: ReactNode;\n ref: ForwardedRef<HTMLAnchorElement>;\n \"data-tone\": LinkTone;\n \"data-variant\": LinkVariant;\n \"data-state\": \"disabled\" | \"idle\";\n }>;\n\nexport type LinkProps = AnchorHTMLAttributes<HTMLAnchorElement> &\n Readonly<{\n tone?: LinkTone;\n variant?: LinkVariant;\n disabled?: boolean;\n leading?: ReactNode;\n trailing?: ReactNode;\n /** Framework adapter, for example Next.js Link, while HJM keeps link semantics and state. */\n renderAnchor?: (props: LinkRenderProps) => ReactElement;\n /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n }>;\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n {\n tone = linkRecipe.defaults.tone,\n variant = linkRecipe.defaults.variant,\n disabled = false,\n leading,\n trailing,\n renderAnchor,\n target,\n rel,\n tabIndex,\n onClick,\n className,\n children,\n layoutStyle,\n ...props\n },\n ref,\n) {\n const handleClick = (event: MouseEvent<HTMLAnchorElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n onClick?.(event);\n };\n const anchorProps: LinkRenderProps = {\n ...props,\n // `renderAnchor` adapters receive the merged placement, so a framework Link\n // gets the same position as the plain <a>.\n ...(props.style === undefined && layoutStyle === undefined ? {} : { style: { ...props.style, ...layoutStyle } }),\n ref,\n className: classNames(\"hjm-link\", className),\n \"data-tone\": tone,\n \"data-variant\": variant,\n \"data-state\": disabled ? \"disabled\" : \"idle\",\n \"aria-disabled\": disabled || undefined,\n tabIndex: disabled ? -1 : tabIndex,\n target,\n rel: rel ?? (target === \"_blank\" ? \"noreferrer noopener\" : undefined),\n onClick: handleClick,\n children: (\n <>\n {leading}\n <span>{children}</span>\n {trailing}\n </>\n ),\n };\n return renderAnchor ? renderAnchor(anchorProps) : <a {...anchorProps} />;\n});\n"]}
|
|
@@ -10,6 +10,8 @@ export type AccordionItem = Readonly<{
|
|
|
10
10
|
title: ReactNode;
|
|
11
11
|
panel: ReactNode;
|
|
12
12
|
disabled?: boolean;
|
|
13
|
+
/** Include domain values when a decorative indicator carries more than expansion. */
|
|
14
|
+
accessibilityLabel?: string;
|
|
13
15
|
}>;
|
|
14
16
|
export type AccordionProps = Omit<HTMLAttributes<HTMLDivElement>, "onChange"> & Readonly<{
|
|
15
17
|
items: readonly AccordionItem[];
|
|
@@ -19,6 +21,12 @@ export type AccordionProps = Omit<HTMLAttributes<HTMLDivElement>, "onChange"> &
|
|
|
19
21
|
allowsMultipleExpanded?: boolean;
|
|
20
22
|
density?: AccordionDensity;
|
|
21
23
|
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
24
|
+
/** Decorative replacement; interaction and expanded state remain owned by Accordion. */
|
|
25
|
+
renderIndicator?: (props: Readonly<{
|
|
26
|
+
value: string;
|
|
27
|
+
expanded: boolean;
|
|
28
|
+
disabled: boolean;
|
|
29
|
+
}>) => ReactNode;
|
|
22
30
|
/** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */
|
|
23
31
|
layoutStyle?: HjmCompositionStyleProp;
|
|
24
32
|
}>;
|
|
@@ -30,6 +38,12 @@ export declare const Accordion: import("react").ForwardRefExoticComponent<Omit<H
|
|
|
30
38
|
allowsMultipleExpanded?: boolean;
|
|
31
39
|
density?: AccordionDensity;
|
|
32
40
|
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
41
|
+
/** Decorative replacement; interaction and expanded state remain owned by Accordion. */
|
|
42
|
+
renderIndicator?: (props: Readonly<{
|
|
43
|
+
value: string;
|
|
44
|
+
expanded: boolean;
|
|
45
|
+
disabled: boolean;
|
|
46
|
+
}>) => ReactNode;
|
|
33
47
|
/** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */
|
|
34
48
|
layoutStyle?: HjmCompositionStyleProp;
|
|
35
49
|
}> & RefAttributes<HTMLDivElement>>;
|
|
@@ -98,6 +112,13 @@ export declare const Divider: import("react").ForwardRefExoticComponent<HTMLAttr
|
|
|
98
112
|
/** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */
|
|
99
113
|
layoutStyle?: HjmCompositionStyleProp;
|
|
100
114
|
}> & RefAttributes<HTMLElement>>;
|
|
115
|
+
export type ListSeparatorProps = Readonly<{
|
|
116
|
+
separator?: keyof typeof listRecipe.separators;
|
|
117
|
+
leading?: boolean;
|
|
118
|
+
layoutStyle?: HjmCompositionStyleProp;
|
|
119
|
+
}>;
|
|
120
|
+
/** Decorative separator for a product-owned virtual collection. List owns separators for finite rows. */
|
|
121
|
+
export declare function ListSeparator({ separator, leading, layoutStyle }: ListSeparatorProps): import("react").JSX.Element | null;
|
|
101
122
|
export type ListAppearance = "grouped" | "plain";
|
|
102
123
|
export type ListProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & Readonly<{
|
|
103
124
|
label: string;
|
|
@@ -133,24 +154,34 @@ export type StatisticProps<Id extends string = string> = Omit<HTMLAttributes<HTM
|
|
|
133
154
|
contextLabel?: string;
|
|
134
155
|
accessibilityLabel?: string;
|
|
135
156
|
composeAccessibilityLabel?: ComposeStatisticAccessibilityLabel<Id>;
|
|
157
|
+
leading?: ReactNode;
|
|
158
|
+
/** Product-owned series/category color; value text and decorative leading share it. */
|
|
159
|
+
valueColor?: string;
|
|
136
160
|
renderTrendMark?: (props: StatisticTrendMarkRenderProps) => ReactNode;
|
|
137
161
|
/** Optional visual adapter; the descriptor remains the accessible value source. */
|
|
138
162
|
renderValue?: (value: string) => ReactNode;
|
|
139
163
|
/** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */
|
|
140
164
|
layoutStyle?: HjmCompositionStyleProp;
|
|
141
165
|
}>;
|
|
142
|
-
export declare function Statistic<Id extends string = string>(
|
|
166
|
+
export declare function Statistic<Id extends string = string>(props: StatisticProps<Id>): import("react").JSX.Element;
|
|
143
167
|
export type StatisticGroupProps<Id extends string = string> = Omit<HTMLAttributes<HTMLDivElement>, "children"> & Readonly<{
|
|
144
168
|
label: string;
|
|
145
169
|
descriptor: StatisticGroupDescriptor<Id>;
|
|
146
170
|
density?: StatisticDensity;
|
|
147
171
|
presentation?: StatisticPresentation;
|
|
148
172
|
composeAccessibilityLabel?: ComposeStatisticAccessibilityLabel<Id>;
|
|
173
|
+
/** A bar is a single equal-width row for a few short counts; grid retains responsive columns. */
|
|
174
|
+
arrangement?: "grid" | "bar";
|
|
175
|
+
renderLeading?: (item: StatisticDescriptor<Id>, context: {
|
|
176
|
+
color: string;
|
|
177
|
+
size: number;
|
|
178
|
+
}) => ReactNode;
|
|
179
|
+
getValueColor?: (item: StatisticDescriptor<Id>) => string | undefined;
|
|
149
180
|
renderTrendMark?: (props: StatisticTrendMarkRenderProps) => ReactNode;
|
|
150
181
|
/** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */
|
|
151
182
|
layoutStyle?: HjmCompositionStyleProp;
|
|
152
183
|
}>;
|
|
153
|
-
export declare function StatisticGroup<Id extends string = string>({ label, descriptor, density, presentation, composeAccessibilityLabel, renderTrendMark, className, style, layoutStyle, ...props }: StatisticGroupProps<Id>): import("react").JSX.Element;
|
|
184
|
+
export declare function StatisticGroup<Id extends string = string>({ label, descriptor, density, presentation, composeAccessibilityLabel, arrangement, renderLeading, getValueColor, renderTrendMark, className, style, layoutStyle, ...props }: StatisticGroupProps<Id>): import("react").JSX.Element;
|
|
154
185
|
export type DescriptionListProps<Id extends string = string> = Omit<HTMLAttributes<HTMLDListElement>, "children"> & Readonly<{
|
|
155
186
|
items: readonly DescriptionItemDescriptor<Id>[];
|
|
156
187
|
columns?: DescriptionListColumns;
|
|
@@ -184,6 +215,8 @@ export declare const Table: <Row>(props: TableProps<Row> & RefAttributes<HTMLTab
|
|
|
184
215
|
export type TimelineProps<Id extends string = string> = Omit<HTMLAttributes<HTMLOListElement>, "children"> & Readonly<{
|
|
185
216
|
items: readonly TimelineItemDescriptor<Id>[];
|
|
186
217
|
composeAccessibleName: ComposeTimelineAccessibleName;
|
|
218
|
+
renderMetadata?: (item: TimelineItemDescriptor<Id>) => ReactNode;
|
|
219
|
+
renderActions?: (item: TimelineItemDescriptor<Id>) => ReactNode;
|
|
187
220
|
/** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */
|
|
188
221
|
layoutStyle?: HjmCompositionStyleProp;
|
|
189
222
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"advanced-display.d.ts","sourceRoot":"","sources":["../src/advanced-display.tsx"],"names":[],"mappings":"AAAA,O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U,CACX,GACC,QAAQ,CAAC;IACP,KAAK,EAAE,SAAS,sBAAsB,CAAC,EAAE,CAAC,EAAE,CAAC;IAC7C,qBAAqB,EAAE,6BAA6B,CAAC;IACrD,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,sBAAsB,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC;IACjE,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,sBAAsB,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC;IAChE,gGAAgG;IAChG,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACvC,CAAC,CAAC;AA0DL,eAAO,MAAM,QAAQ,EAAgC,CAAC,EAAE,SAAS,MAAM,GAAG,MAAM,EAC9E,KAAK,EAAE,aAAa,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,gBAAgB,CAAC,KACvD,YAAY,CAAC"}
|
package/dist/advanced-display.js
CHANGED
|
@@ -42,7 +42,7 @@ function accordionFocusTarget(items, currentIndex, key) {
|
|
|
42
42
|
}
|
|
43
43
|
return currentIndex;
|
|
44
44
|
}
|
|
45
|
-
export const Accordion = forwardRef(function Accordion({ items, value: valueProp, defaultValue = [], onValueChange, allowsMultipleExpanded = accordionRecipe.defaults.allowsMultipleExpanded, density = accordionRecipe.defaults.density, headingLevel = 3, className, layoutStyle, ...props }, ref) {
|
|
45
|
+
export const Accordion = forwardRef(function Accordion({ items, value: valueProp, defaultValue = [], onValueChange, allowsMultipleExpanded = accordionRecipe.defaults.allowsMultipleExpanded, density = accordionRecipe.defaults.density, headingLevel = 3, renderIndicator, className, layoutStyle, ...props }, ref) {
|
|
46
46
|
validateAccordionItems(items);
|
|
47
47
|
const [storedValue, setValue] = useControllableState({
|
|
48
48
|
...(valueProp === undefined ? {} : { value: valueProp }),
|
|
@@ -105,13 +105,13 @@ export const Accordion = forwardRef(function Accordion({ items, value: valueProp
|
|
|
105
105
|
triggerRefs.current.set(item.id, node);
|
|
106
106
|
else
|
|
107
107
|
triggerRefs.current.delete(item.id);
|
|
108
|
-
}, id: triggerId, type: "button", className: "hjm-accordion__trigger", "aria-expanded": expanded, "aria-controls": panelId, disabled: item.disabled, onClick: () => toggle(item.id), onKeyDown: (event) => {
|
|
108
|
+
}, id: triggerId, type: "button", className: "hjm-accordion__trigger", "aria-expanded": expanded, "aria-label": item.accessibilityLabel, "aria-controls": panelId, disabled: item.disabled, onClick: () => toggle(item.id), onKeyDown: (event) => {
|
|
109
109
|
const target = accordionFocusTarget(items, index, event.key);
|
|
110
110
|
if (target === undefined || target < 0)
|
|
111
111
|
return;
|
|
112
112
|
event.preventDefault();
|
|
113
113
|
triggerRefs.current.get(items[target].id)?.focus();
|
|
114
|
-
}, children: [_jsx("span", { className: "hjm-accordion__title", children: item.title }), _jsx("span", { className: "hjm-accordion__indicator", "aria-hidden": "true", children: expanded ? "−" : "+" })] }));
|
|
114
|
+
}, children: [_jsx("span", { className: "hjm-accordion__title", children: item.title }), _jsx("span", { className: "hjm-accordion__indicator", "aria-hidden": "true", children: renderIndicator ? renderIndicator({ value: item.id, expanded, disabled: item.disabled === true }) : expanded ? "−" : "+" })] }));
|
|
115
115
|
return (_jsxs("div", { onFocusCapture: event => { if (event.target instanceof HTMLElement)
|
|
116
116
|
focused.current = { id: item.id, index, node: event.target }; }, className: "hjm-accordion__item", "data-state": item.disabled ? "disabled" : expanded ? "expanded" : "collapsed", children: [createElement(`h${headingLevel}`, { className: "hjm-accordion__header" }, trigger), _jsx("div", { id: panelId, role: "region", className: "hjm-accordion__panel", "aria-labelledby": triggerId, hidden: !expanded, children: item.panel })] }, item.id));
|
|
117
117
|
}) }));
|
|
@@ -159,6 +159,16 @@ export const Divider = forwardRef(function Divider({ orientation = dividerRecipe
|
|
|
159
159
|
"aria-orientation": decorative ? undefined : orientation,
|
|
160
160
|
});
|
|
161
161
|
});
|
|
162
|
+
/** Decorative separator for a product-owned virtual collection. List owns separators for finite rows. */
|
|
163
|
+
export function ListSeparator({ separator = "content", leading = false, layoutStyle }) {
|
|
164
|
+
if (!listRecipe.separators[separator])
|
|
165
|
+
return null;
|
|
166
|
+
return _jsx("div", { "aria-hidden": "true", role: "presentation", className: "hjm-list-separator", style: {
|
|
167
|
+
marginInlineStart: `var(--hjm-list-separator-${separator}-${leading ? "leading-start" : "start"})`,
|
|
168
|
+
marginInlineEnd: `var(--hjm-list-separator-${separator}-end)`,
|
|
169
|
+
...layoutStyle,
|
|
170
|
+
} });
|
|
171
|
+
}
|
|
162
172
|
/** Semantic list container that owns separators around composed rows. */
|
|
163
173
|
export const List = forwardRef(function List({ label, children, separator = listRecipe.defaults.separator, appearance = "plain", className, layoutStyle, ...props }, ref) {
|
|
164
174
|
if (!label.trim())
|
|
@@ -166,7 +176,10 @@ export const List = forwardRef(function List({ label, children, separator = list
|
|
|
166
176
|
const items = Children.toArray(children);
|
|
167
177
|
return (_jsx("div", { ...props, style: { ...props.style, ...layoutStyle }, ref: ref, "aria-label": label, className: classNames("hjm-list", className), "data-appearance": appearance, "data-separator": separator, role: "list", children: items.map((item, index) => (_jsx("div", { className: "hjm-list__item", role: "listitem", children: item }, isValidElement(item) && item.key !== null ? item.key : `hjm-list-${index}`))) }));
|
|
168
178
|
});
|
|
169
|
-
export function Statistic(
|
|
179
|
+
export function Statistic(props) {
|
|
180
|
+
return _jsx(StatisticView, { ...props });
|
|
181
|
+
}
|
|
182
|
+
function StatisticView({ descriptor, density = "comfortable", presentation = "plain", contextLabel, accessibilityLabel, composeAccessibilityLabel, leading, valueColor, bar = false, renderTrendMark, renderValue, className, layoutStyle, ...props }) {
|
|
170
183
|
const resolved = resolveStatisticDescriptor(descriptor);
|
|
171
184
|
const valueText = `${resolved.prefix ?? ""}${resolved.value}${resolved.suffix ?? ""}`;
|
|
172
185
|
const announcement = accessibilityLabel ?? composeAccessibilityLabel?.({
|
|
@@ -181,13 +194,16 @@ export function Statistic({ descriptor, density = "comfortable", presentation =
|
|
|
181
194
|
const trendName = resolved.trend
|
|
182
195
|
? statisticRecipe.trend.marks[resolved.trend.direction]
|
|
183
196
|
: undefined;
|
|
184
|
-
return (_jsxs("article", { ...props, style: { ...props.style, ...layoutStyle }, "aria-label": announcement, className: classNames("hjm-statistic", className), "data-density": density, "data-presentation": presentation, children: [_jsx("span", { "aria-hidden": "true", className: "hjm-statistic__label", children: resolved.label }), _jsxs("span", { "aria-hidden": "true", className: "hjm-statistic__value-row", children: [resolved.prefix ? _jsx("span", { className: "hjm-statistic__affix", children: resolved.prefix }) : null, _jsx("strong", { className: "hjm-statistic__value", children: renderValue?.(resolved.value) ?? resolved.value }), resolved.suffix ? _jsx("span", { className: "hjm-statistic__affix", children: resolved.suffix }) : null] }), resolved.trend ? (_jsxs("span", { "aria-hidden": "true", className: "hjm-statistic__trend", "data-tone": resolved.trend.tone, children: [_jsx("span", { className: "hjm-statistic__trend-mark", children: renderTrendMark?.({ name: trendName, color: "currentColor", size: 16 }) ?? (resolved.trend.direction === "up" ? "↑" : resolved.trend.direction === "down" ? "↓" : "—") }), resolved.trend.label] })) : null, resolved.hint ? _jsx("span", { "aria-hidden": "true", className: "hjm-statistic__hint", children: resolved.hint }) : null] }));
|
|
197
|
+
return (_jsxs("article", { ...props, style: { ...props.style, ...layoutStyle, ...(valueColor ? { "--hjm-statistic-value-color": valueColor } : {}) }, "aria-label": announcement, className: classNames("hjm-statistic", className), "data-arrangement": bar ? "bar" : undefined, "data-density": density, "data-presentation": presentation, children: [_jsx("span", { "aria-hidden": "true", className: "hjm-statistic__label", children: resolved.label }), _jsxs("span", { "aria-hidden": "true", className: "hjm-statistic__value-row", children: [leading === undefined ? null : _jsx("span", { className: "hjm-statistic__leading", children: leading }), resolved.prefix ? _jsx("span", { className: "hjm-statistic__affix", children: resolved.prefix }) : null, _jsx("strong", { className: "hjm-statistic__value", children: renderValue?.(resolved.value) ?? resolved.value }), resolved.suffix ? _jsx("span", { className: "hjm-statistic__affix", children: resolved.suffix }) : null] }), resolved.trend ? (_jsxs("span", { "aria-hidden": "true", className: "hjm-statistic__trend", "data-tone": resolved.trend.tone, children: [_jsx("span", { className: "hjm-statistic__trend-mark", children: renderTrendMark?.({ name: trendName, color: "currentColor", size: 16 }) ?? (resolved.trend.direction === "up" ? "↑" : resolved.trend.direction === "down" ? "↓" : "—") }), resolved.trend.label] })) : null, resolved.hint ? _jsx("span", { "aria-hidden": "true", className: "hjm-statistic__hint", children: resolved.hint }) : null] }));
|
|
185
198
|
}
|
|
186
|
-
export function StatisticGroup({ label, descriptor, density, presentation, composeAccessibilityLabel, renderTrendMark, className, style, layoutStyle, ...props }) {
|
|
199
|
+
export function StatisticGroup({ label, descriptor, density, presentation, composeAccessibilityLabel, arrangement = "grid", renderLeading, getValueColor, renderTrendMark, className, style, layoutStyle, ...props }) {
|
|
187
200
|
validateStatisticGroup(descriptor);
|
|
188
201
|
if (!label.trim())
|
|
189
202
|
throw new TypeError("StatisticGroup label must not be empty");
|
|
190
|
-
return (_jsx("div", { ...props, "aria-label": label, className: classNames("hjm-statistic-group", className), role: "list", style: { ...style, ...layoutStyle, "--hjm-statistic-columns": descriptor.columns ?? statisticRecipe.defaults.columns }, children: descriptor.items.map((item) =>
|
|
203
|
+
return (_jsx("div", { ...props, "aria-label": label, className: classNames("hjm-statistic-group", className), role: "list", "data-arrangement": arrangement, style: { ...style, ...layoutStyle, "--hjm-statistic-columns": arrangement === "bar" ? descriptor.items.length : descriptor.columns ?? statisticRecipe.defaults.columns }, children: descriptor.items.map((item) => {
|
|
204
|
+
const valueColor = getValueColor?.(item);
|
|
205
|
+
return (_jsx("div", { role: "listitem", children: _jsx(StatisticView, { bar: arrangement === "bar", ...(valueColor ? { valueColor } : {}), ...(renderLeading ? { leading: renderLeading(item, { color: valueColor ?? "currentColor", size: statisticRecipe.group.bar.iconSize }) } : {}), contextLabel: label, descriptor: item, ...(composeAccessibilityLabel === undefined ? {} : { composeAccessibilityLabel }), ...(density === undefined ? {} : { density }), ...(presentation === undefined ? {} : { presentation }), ...(renderTrendMark === undefined ? {} : { renderTrendMark }) }) }, item.id));
|
|
206
|
+
}) }));
|
|
191
207
|
}
|
|
192
208
|
function DescriptionListInner({ items, columns, layout, className, layoutStyle, style, ...props }, forwardedRef) {
|
|
193
209
|
const descriptor = resolveDescriptionListDescriptor({
|
|
@@ -239,9 +255,12 @@ function TableInner({ columns, rows, getRowKey, caption, emptyState, onSortChang
|
|
|
239
255
|
} })) : column.header }, column.id))) }) }), _jsx("tbody", { children: rows.length === 0 ? (_jsx("tr", { children: _jsx("td", { className: "hjm-table__empty", colSpan: columns.length, children: emptyState }) })) : (rows.map((row, rowIndex) => (_jsx("tr", { className: "hjm-table__row", children: columns.map((column) => (_jsx("td", { className: "hjm-table__cell", "data-align": column.align ?? "start", children: column.cell(row, rowIndex) }, column.id))) }, rowKeys[rowIndex])))) })] }) }));
|
|
240
256
|
}
|
|
241
257
|
export const Table = forwardRef(TableInner);
|
|
242
|
-
function TimelineInner({ items, composeAccessibleName, className, layoutStyle, ...props }, ref) {
|
|
258
|
+
function TimelineInner({ items, composeAccessibleName, renderMetadata, renderActions, className, layoutStyle, ...props }, ref) {
|
|
243
259
|
const resolved = resolveTimelineDescriptor({ items }, { composeAccessibleName });
|
|
244
|
-
return (_jsx("ol", { ...props, style: { ...props.style, ...layoutStyle }, ref: ref, className: classNames("hjm-timeline", className), children: resolved.map((item, index) =>
|
|
260
|
+
return (_jsx("ol", { ...props, style: { ...props.style, ...layoutStyle }, ref: ref, className: classNames("hjm-timeline", className), children: resolved.map((item, index) => {
|
|
261
|
+
const actions = renderActions?.(item);
|
|
262
|
+
return (_jsxs("li", { "aria-label": item.accessibleName, className: "hjm-timeline__item", "data-tone": item.tone, "data-emphasized": item.emphasized || undefined, children: [_jsxs("span", { className: "hjm-timeline__rail", "aria-hidden": "true", children: [_jsx("span", { className: "hjm-timeline__dot" }), index < resolved.length - 1 ? (_jsx("span", { className: "hjm-timeline__connector" })) : null] }), _jsxs("span", { className: "hjm-timeline__content", children: [_jsxs("span", { className: "hjm-timeline__heading", children: [_jsx("strong", { className: "hjm-timeline__label", children: item.label }), renderMetadata?.(item)] }), item.description ? (_jsx("span", { className: "hjm-timeline__description", children: item.description })) : null, item.timestamp ? _jsx("time", { className: "hjm-timeline__timestamp", dateTime: item.dateTime, children: item.timestamp }) : null] }), actions ? _jsx("div", { className: "hjm-timeline__actions", children: actions }) : null] }, item.id));
|
|
263
|
+
}) }));
|
|
245
264
|
}
|
|
246
265
|
export const Timeline = forwardRef(TimelineInner);
|
|
247
266
|
//# sourceMappingURL=advanced-display.js.map
|