@tensor_1/react 2.52.0 → 2.53.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/components/Card.d.ts +7 -1
- package/dist/components/Card.js +9 -3
- package/dist/index.cjs +7 -2
- package/dist/index.d.cts +7 -2
- package/dist/link.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode, AnchorHTMLAttributes } from 'react';
|
|
3
|
+
import { UixRenderLink } from '../link.js';
|
|
3
4
|
|
|
4
5
|
interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
5
6
|
title?: ReactNode;
|
|
@@ -30,9 +31,14 @@ interface CardLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 't
|
|
|
30
31
|
headerAction?: ReactNode;
|
|
31
32
|
footer?: ReactNode;
|
|
32
33
|
children?: ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Renders the card's anchor with your router's link (HAR-2576), so it keeps client navigation
|
|
36
|
+
* and prefetch: the same `UixRenderLink` adapter as `ButtonLink`. Default: `<a>`.
|
|
37
|
+
*/
|
|
38
|
+
renderLink?: UixRenderLink;
|
|
33
39
|
}
|
|
34
40
|
/** A whole-card anchor with visible hover and keyboard focus affordances. */
|
|
35
|
-
declare function CardLink({ title, subtitle, headerAction, footer, children, className, ...props }: CardLinkProps): react.JSX.Element;
|
|
41
|
+
declare function CardLink({ title, subtitle, headerAction, footer, children, className, href, renderLink, ...props }: CardLinkProps): react.JSX.Element;
|
|
36
42
|
interface InsetProps extends HTMLAttributes<HTMLDivElement> {
|
|
37
43
|
/** `md` (default) pads with `--uix-space-4`; `sm` with `--uix-space-3`, for a dense card. */
|
|
38
44
|
padding?: 'sm' | 'md';
|
package/dist/components/Card.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cx } from "../cx.js";
|
|
3
|
+
import { renderUixLink } from "../link.js";
|
|
3
4
|
import { InfoTip } from "./InfoTip.js";
|
|
4
5
|
import { hasHelp, helpLabelFor } from "../info-tip-model.js";
|
|
5
6
|
function Card({ title, titleAs: TitleTag = "div", titleId, subtitle, help, helpLabel, headerAction, footer, children, className, ...props }) {
|
|
@@ -20,9 +21,10 @@ function Card({ title, titleAs: TitleTag = "div", titleId, subtitle, help, helpL
|
|
|
20
21
|
footer != null && /* @__PURE__ */ jsx("div", { className: "uix-card__footer", children: footer })
|
|
21
22
|
] });
|
|
22
23
|
}
|
|
23
|
-
function CardLink({ title, subtitle, headerAction, footer, children, className, ...props }) {
|
|
24
|
+
function CardLink({ title, subtitle, headerAction, footer, children, className, href, renderLink, ...props }) {
|
|
24
25
|
const hasHeader = title != null || subtitle != null || headerAction != null;
|
|
25
|
-
|
|
26
|
+
const classes = cx("uix-card", "uix-card--interactive", className);
|
|
27
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
28
|
hasHeader && /* @__PURE__ */ jsxs("div", { className: "uix-card__header", children: [
|
|
27
29
|
/* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
|
|
28
30
|
title != null && /* @__PURE__ */ jsx("div", { className: "uix-card__title", children: title }),
|
|
@@ -33,6 +35,10 @@ function CardLink({ title, subtitle, headerAction, footer, children, className,
|
|
|
33
35
|
children != null && /* @__PURE__ */ jsx("div", { className: "uix-card__body", children }),
|
|
34
36
|
footer != null && /* @__PURE__ */ jsx("div", { className: "uix-card__footer", children: footer })
|
|
35
37
|
] });
|
|
38
|
+
if (renderLink && href !== void 0) {
|
|
39
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderUixLink(renderLink, { ...props, href, className: classes, children: body }) });
|
|
40
|
+
}
|
|
41
|
+
return /* @__PURE__ */ jsx("a", { className: classes, href, ...props, children: body });
|
|
36
42
|
}
|
|
37
43
|
function Inset({ padding = "md", tone = "sunken", children, className, ...props }) {
|
|
38
44
|
return /* @__PURE__ */ jsx("div", { className: cx("uix-inset", padding === "sm" && "uix-inset--sm", tone === "surface" && "uix-inset--surface", className), ...props, children });
|
package/dist/index.cjs
CHANGED
|
@@ -7195,9 +7195,10 @@ function Card({ title, titleAs: TitleTag = "div", titleId, subtitle, help, helpL
|
|
|
7195
7195
|
footer != null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uix-card__footer", children: footer })
|
|
7196
7196
|
] });
|
|
7197
7197
|
}
|
|
7198
|
-
function CardLink({ title, subtitle, headerAction, footer, children, className, ...props }) {
|
|
7198
|
+
function CardLink({ title, subtitle, headerAction, footer, children, className, href, renderLink, ...props }) {
|
|
7199
7199
|
const hasHeader = title != null || subtitle != null || headerAction != null;
|
|
7200
|
-
|
|
7200
|
+
const classes = cx("uix-card", "uix-card--interactive", className);
|
|
7201
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
7201
7202
|
hasHeader && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "uix-card__header", children: [
|
|
7202
7203
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { style: { flex: 1 }, children: [
|
|
7203
7204
|
title != null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uix-card__title", children: title }),
|
|
@@ -7208,6 +7209,10 @@ function CardLink({ title, subtitle, headerAction, footer, children, className,
|
|
|
7208
7209
|
children != null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uix-card__body", children }),
|
|
7209
7210
|
footer != null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uix-card__footer", children: footer })
|
|
7210
7211
|
] });
|
|
7212
|
+
if (renderLink && href !== void 0) {
|
|
7213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: renderUixLink(renderLink, { ...props, href, className: classes, children: body }) });
|
|
7214
|
+
}
|
|
7215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("a", { className: classes, href, ...props, children: body });
|
|
7211
7216
|
}
|
|
7212
7217
|
function Inset({ padding = "md", tone = "sunken", children, className, ...props }) {
|
|
7213
7218
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: cx("uix-inset", padding === "sm" && "uix-inset--sm", tone === "surface" && "uix-inset--surface", className), ...props, children });
|
package/dist/index.d.cts
CHANGED
|
@@ -635,7 +635,7 @@ declare function settleDrop(el: HTMLElement | null | undefined): void;
|
|
|
635
635
|
/**
|
|
636
636
|
* What a `renderLink` callback receives (HAR-1348). Spread it onto your router's link
|
|
637
637
|
* so it keeps client navigation and prefetch: `renderLink={(p) => <NextLink {...p} />}`.
|
|
638
|
-
* Every UIx component that can render a link (`ButtonLink`, `Stat href`, `Pagination
|
|
638
|
+
* Every UIx component that can render a link (`ButtonLink`, `CardLink`, `Stat href`, `Pagination
|
|
639
639
|
* hrefFor`, `DetailPage`) takes the same callback, so one adapter serves them all.
|
|
640
640
|
*/
|
|
641
641
|
interface UixLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
@@ -6075,9 +6075,14 @@ interface CardLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 't
|
|
|
6075
6075
|
headerAction?: ReactNode;
|
|
6076
6076
|
footer?: ReactNode;
|
|
6077
6077
|
children?: ReactNode;
|
|
6078
|
+
/**
|
|
6079
|
+
* Renders the card's anchor with your router's link (HAR-2576), so it keeps client navigation
|
|
6080
|
+
* and prefetch: the same `UixRenderLink` adapter as `ButtonLink`. Default: `<a>`.
|
|
6081
|
+
*/
|
|
6082
|
+
renderLink?: UixRenderLink;
|
|
6078
6083
|
}
|
|
6079
6084
|
/** A whole-card anchor with visible hover and keyboard focus affordances. */
|
|
6080
|
-
declare function CardLink({ title, subtitle, headerAction, footer, children, className, ...props }: CardLinkProps): react.JSX.Element;
|
|
6085
|
+
declare function CardLink({ title, subtitle, headerAction, footer, children, className, href, renderLink, ...props }: CardLinkProps): react.JSX.Element;
|
|
6081
6086
|
interface InsetProps extends HTMLAttributes<HTMLDivElement> {
|
|
6082
6087
|
/** `md` (default) pads with `--uix-space-4`; `sm` with `--uix-space-3`, for a dense card. */
|
|
6083
6088
|
padding?: 'sm' | 'md';
|
package/dist/link.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { AnchorHTMLAttributes, ReactNode } from 'react';
|
|
|
3
3
|
/**
|
|
4
4
|
* What a `renderLink` callback receives (HAR-1348). Spread it onto your router's link
|
|
5
5
|
* so it keeps client navigation and prefetch: `renderLink={(p) => <NextLink {...p} />}`.
|
|
6
|
-
* Every UIx component that can render a link (`ButtonLink`, `Stat href`, `Pagination
|
|
6
|
+
* Every UIx component that can render a link (`ButtonLink`, `CardLink`, `Stat href`, `Pagination
|
|
7
7
|
* hrefFor`, `DetailPage`) takes the same callback, so one adapter serves them all.
|
|
8
8
|
*/
|
|
9
9
|
interface UixLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|