@entifix/react-controls 0.20.3 → 0.22.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/i18n/catalog/en.d.ts.map +1 -1
- package/dist/i18n/catalog/en.js +7 -0
- package/dist/i18n/catalog/en.js.map +1 -1
- package/dist/i18n/catalog/es.d.ts +7 -0
- package/dist/i18n/catalog/es.d.ts.map +1 -1
- package/dist/i18n/catalog/es.js +7 -0
- package/dist/i18n/catalog/es.js.map +1 -1
- package/dist/i18n/catalog/index.d.ts +14 -0
- package/dist/i18n/catalog/index.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/primitives.d.ts +2 -0
- package/dist/primitives.d.ts.map +1 -1
- package/dist/primitives.js +2 -0
- package/dist/primitives.js.map +1 -1
- package/dist/ui/atoms/cell-value/cell-value.d.ts +6 -0
- package/dist/ui/atoms/cell-value/cell-value.d.ts.map +1 -1
- package/dist/ui/atoms/cell-value/cell-value.js +108 -14
- package/dist/ui/atoms/cell-value/cell-value.js.map +1 -1
- package/dist/ui/atoms/cell-value/index.d.ts +1 -0
- package/dist/ui/atoms/cell-value/index.d.ts.map +1 -1
- package/dist/ui/atoms/cell-value/index.js +1 -0
- package/dist/ui/atoms/cell-value/index.js.map +1 -1
- package/dist/ui/atoms/cell-value/use-record-label.d.ts +16 -0
- package/dist/ui/atoms/cell-value/use-record-label.d.ts.map +1 -0
- package/dist/ui/atoms/cell-value/use-record-label.js +55 -0
- package/dist/ui/atoms/cell-value/use-record-label.js.map +1 -0
- package/dist/ui/atoms/media-image/index.d.ts +2 -0
- package/dist/ui/atoms/media-image/index.d.ts.map +1 -0
- package/dist/ui/atoms/media-image/index.js +3 -0
- package/dist/ui/atoms/media-image/index.js.map +1 -0
- package/dist/ui/atoms/media-image/media-image.d.ts +46 -0
- package/dist/ui/atoms/media-image/media-image.d.ts.map +1 -0
- package/dist/ui/atoms/media-image/media-image.js +57 -0
- package/dist/ui/atoms/media-image/media-image.js.map +1 -0
- package/dist/ui/atoms/status-tag/status-tag.d.ts +6 -2
- package/dist/ui/atoms/status-tag/status-tag.d.ts.map +1 -1
- package/dist/ui/atoms/status-tag/status-tag.js.map +1 -1
- package/dist/ui/atoms/table/table.d.ts +4 -2
- package/dist/ui/atoms/table/table.d.ts.map +1 -1
- package/dist/ui/atoms/table/table.js +3 -1
- package/dist/ui/atoms/table/table.js.map +1 -1
- package/dist/ui/molecules/media-gallery/media-gallery.d.ts +30 -3
- package/dist/ui/molecules/media-gallery/media-gallery.d.ts.map +1 -1
- package/dist/ui/molecules/media-gallery/media-gallery.js +26 -6
- package/dist/ui/molecules/media-gallery/media-gallery.js.map +1 -1
- package/dist/ui/molecules/summary-tile/index.d.ts +2 -0
- package/dist/ui/molecules/summary-tile/index.d.ts.map +1 -0
- package/dist/ui/molecules/summary-tile/index.js +3 -0
- package/dist/ui/molecules/summary-tile/index.js.map +1 -0
- package/dist/ui/molecules/summary-tile/summary-tile.d.ts +57 -0
- package/dist/ui/molecules/summary-tile/summary-tile.d.ts.map +1 -0
- package/dist/ui/molecules/summary-tile/summary-tile.js +114 -0
- package/dist/ui/molecules/summary-tile/summary-tile.js.map +1 -0
- package/dist/ui/organisms/entity-form/entity-form.d.ts +1 -1
- package/dist/ui/organisms/entity-form/entity-form.d.ts.map +1 -1
- package/dist/ui/organisms/entity-form/entity-form.js +7 -6
- package/dist/ui/organisms/entity-form/entity-form.js.map +1 -1
- package/dist/ui/organisms/entity-form/entity-form.types.d.ts +0 -8
- package/dist/ui/organisms/entity-form/entity-form.types.d.ts.map +1 -1
- package/dist/ui/organisms/entity-form/entity-form.types.js.map +1 -1
- package/dist/ui/organisms/entity-table/card-roles.d.ts +10 -0
- package/dist/ui/organisms/entity-table/card-roles.d.ts.map +1 -0
- package/dist/ui/organisms/entity-table/card-roles.js +14 -0
- package/dist/ui/organisms/entity-table/card-roles.js.map +1 -0
- package/dist/ui/organisms/entity-table/entity-table-slots.d.ts +2 -0
- package/dist/ui/organisms/entity-table/entity-table-slots.d.ts.map +1 -1
- package/dist/ui/organisms/entity-table/entity-table-slots.js.map +1 -1
- package/dist/ui/organisms/entity-table/entity-table.d.ts.map +1 -1
- package/dist/ui/organisms/entity-table/entity-table.js +217 -173
- package/dist/ui/organisms/entity-table/entity-table.js.map +1 -1
- package/dist/ui/organisms/entity-table/pivot.d.ts +32 -5
- package/dist/ui/organisms/entity-table/pivot.d.ts.map +1 -1
- package/dist/ui/organisms/entity-table/pivot.js +42 -9
- package/dist/ui/organisms/entity-table/pivot.js.map +1 -1
- package/dist/ui/organisms/entity-table/use-entity-table-columns.d.ts.map +1 -1
- package/dist/ui/organisms/entity-table/use-entity-table-columns.js +6 -3
- package/dist/ui/organisms/entity-table/use-entity-table-columns.js.map +1 -1
- package/dist/ui/utils/reference-labels.d.ts +59 -0
- package/dist/ui/utils/reference-labels.d.ts.map +1 -0
- package/dist/ui/utils/reference-labels.js +49 -0
- package/dist/ui/utils/reference-labels.js.map +1 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/ui/atoms/table/table.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ComponentPropsWithoutRef,\n type ReactNode,\n type RefObject,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport { cn } from '../../utils/cn.js';\n\nexport interface TableProps extends ComponentPropsWithoutRef<'table'> {\n /** Class names for the scroll container wrapping the `<table>`. */\n containerClassName?: string;\n /**\n * What the table holds — \"Clientes, 12 resultados\". It names the table and,\n * once the table overflows its container, the scroll region too.\n */\n caption?: ReactNode;\n /** Class names for the caption; screen-reader only unless overridden. */\n captionClassName?: string;\n}\n\n/**\n * Whether an element's content is larger than its box, on either axis —\n * measured again whenever the box or the content it holds resizes.\n */\nfunction useOverflows(ref: RefObject<HTMLElement | null>): boolean {\n const [overflows, setOverflows] = useState(false);\n useEffect(() => {\n const node = ref.current as HTMLElement;\n const measure = () =>\n setOverflows(\n node.scrollWidth > node.clientWidth ||\n node.scrollHeight > node.clientHeight,\n );\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n // The table grows with its rows while the container keeps its size.\n for (const child of Array.from(node.children)) observer.observe(child);\n return () => observer.disconnect();\n }, [ref]);\n return overflows;\n}\n\n/**\n * Styled table primitive — no entity knowledge, no data fetching. `EntityTable`\n * composes these; anything rendering non-entity tabular data can use them too.\n *\n * Wide tables scroll inside their own container rather than pushing the page\n * sideways. A container that scrolls is a **focusable region** named by the\n * caption, so a keyboard can scroll it — and one that fits is neither, so it\n * adds no tab stop that does nothing.\n */\nexport function Table({\n className,\n containerClassName,\n caption,\n captionClassName = 'sr-only',\n children,\n ...props\n}: TableProps) {\n const container = useRef<HTMLDivElement>(null);\n const captionId = useId();\n const overflows = useOverflows(container);\n const named = caption !== undefined;\n\n return (\n <div\n ref={container}\n data-overflows={overflows || undefined}\n {...(overflows && {\n tabIndex: 0,\n role: named ? 'region' : undefined,\n 'aria-labelledby': named ? captionId : undefined,\n })}\n className={cn(\n 'w-full overflow-auto rounded-xl border border-border bg-surface-elevated focus-ring',\n containerClassName,\n )}\n >\n <table\n className={cn(\n 'w-full border-collapse text-step-0 text-content',\n className,\n )}\n {...props}\n >\n {named && (\n <caption id={captionId} className={captionClassName}>\n {caption}\n </caption>\n )}\n {children}\n </table>\n </div>\n );\n}\n\nexport function TableHead({\n className,\n ...props\n}: ComponentPropsWithoutRef<'thead'>) {\n return (\n <thead\n // Sticky inside a container that scrolls: the column names stay in view\n // over a long page of rows. One layer above the rows, and no higher: a\n // row menu opened under it must still paint over it.\n className={cn(\n 'top-0 sticky z-1 border-b border-border bg-surface',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function TableBody({\n className,\n ...props\n}: ComponentPropsWithoutRef<'tbody'>) {\n return (\n <tbody className={cn('divide-y divide-border', className)} {...props} />\n );\n}\n\nexport function TableRow({\n className,\n ...props\n}: ComponentPropsWithoutRef<'tr'>) {\n return (\n <tr\n className={cn(\n 'transition-colors duration-200 ease-smooth hover:bg-surface',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport type TableCellAlign = 'start' | 'center' | 'end';\n\nconst ALIGN_CLASS: Record<TableCellAlign, string> = {\n start: 'text-left',\n center: 'text-center',\n end: 'text-right',\n};\n\n// `align` shadows the deprecated HTML attribute, which allows a different set\n// of values — omit the native one rather than narrow it.\nexport interface TableHeaderCellProps extends Omit<\n ComponentPropsWithoutRef<'th'>,\n 'align'\n> {\n align?: TableCellAlign;\n}\n\nexport function TableHeaderCell({\n align = 'start',\n className,\n ...props\n}: TableHeaderCellProps) {\n return (\n <th\n scope=\"col\"\n className={cn(\n 'px-s py-2xs text-step-sm font-semibold whitespace-nowrap text-content-muted',\n ALIGN_CLASS[align],\n className,\n )}\n {...props}\n />\n );\n}\n\nexport interface TableCellProps extends Omit<\n ComponentPropsWithoutRef<'td'>,\n 'align'\n> {\n align?: TableCellAlign;\n}\n\nexport function TableCell({\n align = 'start',\n className,\n ...props\n}: TableCellProps) {\n return (\n <td\n className={cn('px-s py-2xs align-middle', ALIGN_CLASS[align], className)}\n {...props}\n />\n );\n}\n\n/** Full-width message row — empty results, an error, a loading state. */\nexport function TableMessageRow({\n colSpan,\n className,\n ...props\n}: ComponentPropsWithoutRef<'td'> & { colSpan: number }) {\n return (\n <tr>\n <td\n colSpan={colSpan}\n className={cn(\n 'px-s py-m text-center text-step-sm text-content-muted',\n className,\n )}\n {...props}\n />\n </tr>\n );\n}\n"],"names":["useEffect","useId","useRef","useState","cn","useOverflows","ref","overflows","setOverflows","node","current","measure","scrollWidth","clientWidth","scrollHeight","clientHeight","observer","ResizeObserver","observe","child","Array","from","children","disconnect","Table","className","containerClassName","caption","captionClassName","props","container","captionId","named","undefined","div","data-overflows","tabIndex","role","table","id","TableHead","thead","TableBody","tbody","TableRow","tr","ALIGN_CLASS","start","center","end","TableHeaderCell","align","th","scope","TableCell","td","TableMessageRow","colSpan"],"mappings":"AAAA;;;;AAEA,
|
|
1
|
+
{"version":3,"sources":["../../../../src/ui/atoms/table/table.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ComponentPropsWithoutRef,\n type CSSProperties,\n type ReactNode,\n type RefObject,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport { cn } from '../../utils/cn.js';\n\nexport interface TableProps extends ComponentPropsWithoutRef<'table'> {\n /** Class names for the scroll container wrapping the `<table>`. */\n containerClassName?: string;\n /** Inline style on that container — the scroll padding a sticky column needs. */\n containerStyle?: CSSProperties;\n /**\n * What the table holds — \"Clientes, 12 resultados\". It names the table and,\n * once the table overflows its container, the scroll region too.\n */\n caption?: ReactNode;\n /** Class names for the caption; screen-reader only unless overridden. */\n captionClassName?: string;\n}\n\n/**\n * Whether an element's content is larger than its box, on either axis —\n * measured again whenever the box or the content it holds resizes.\n */\nfunction useOverflows(ref: RefObject<HTMLElement | null>): boolean {\n const [overflows, setOverflows] = useState(false);\n useEffect(() => {\n const node = ref.current as HTMLElement;\n const measure = () =>\n setOverflows(\n node.scrollWidth > node.clientWidth ||\n node.scrollHeight > node.clientHeight,\n );\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n // The table grows with its rows while the container keeps its size.\n for (const child of Array.from(node.children)) observer.observe(child);\n return () => observer.disconnect();\n }, [ref]);\n return overflows;\n}\n\n/**\n * Styled table primitive — no entity knowledge, no data fetching. `EntityTable`\n * composes these; anything rendering non-entity tabular data can use them too.\n *\n * Wide tables scroll inside their own container rather than pushing the page\n * sideways. A container that scrolls is a **focusable region** named by the\n * caption, so a keyboard can scroll it — and one that fits is neither, so it\n * adds no tab stop that does nothing.\n */\nexport function Table({\n className,\n containerClassName,\n containerStyle,\n caption,\n captionClassName = 'sr-only',\n children,\n ...props\n}: TableProps) {\n const container = useRef<HTMLDivElement>(null);\n const captionId = useId();\n const overflows = useOverflows(container);\n const named = caption !== undefined;\n\n return (\n <div\n ref={container}\n style={containerStyle}\n data-overflows={overflows || undefined}\n {...(overflows && {\n tabIndex: 0,\n role: named ? 'region' : undefined,\n 'aria-labelledby': named ? captionId : undefined,\n })}\n className={cn(\n 'w-full overflow-auto rounded-xl border border-border bg-surface-elevated focus-ring',\n containerClassName,\n )}\n >\n <table\n className={cn(\n 'w-full border-collapse text-step-0 text-content',\n className,\n )}\n {...props}\n >\n {named && (\n <caption id={captionId} className={captionClassName}>\n {caption}\n </caption>\n )}\n {children}\n </table>\n </div>\n );\n}\n\nexport function TableHead({\n className,\n ...props\n}: ComponentPropsWithoutRef<'thead'>) {\n return (\n <thead\n // Sticky inside a container that scrolls: the column names stay in view\n // over a long page of rows. One layer above the rows, and no higher: a\n // row menu opened under it must still paint over it.\n className={cn(\n 'top-0 sticky z-1 border-b border-border bg-surface',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function TableBody({\n className,\n ...props\n}: ComponentPropsWithoutRef<'tbody'>) {\n return (\n <tbody className={cn('divide-y divide-border', className)} {...props} />\n );\n}\n\nexport function TableRow({\n className,\n ...props\n}: ComponentPropsWithoutRef<'tr'>) {\n return (\n <tr\n className={cn(\n 'transition-colors duration-200 ease-smooth hover:bg-surface',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport type TableCellAlign = 'start' | 'center' | 'end';\n\nconst ALIGN_CLASS: Record<TableCellAlign, string> = {\n start: 'text-left',\n center: 'text-center',\n end: 'text-right',\n};\n\n// `align` shadows the deprecated HTML attribute, which allows a different set\n// of values — omit the native one rather than narrow it.\nexport interface TableHeaderCellProps extends Omit<\n ComponentPropsWithoutRef<'th'>,\n 'align'\n> {\n align?: TableCellAlign;\n}\n\nexport function TableHeaderCell({\n align = 'start',\n className,\n ...props\n}: TableHeaderCellProps) {\n return (\n <th\n scope=\"col\"\n className={cn(\n 'px-s py-2xs text-step-sm font-semibold whitespace-nowrap text-content-muted',\n ALIGN_CLASS[align],\n className,\n )}\n {...props}\n />\n );\n}\n\nexport interface TableCellProps extends Omit<\n ComponentPropsWithoutRef<'td'>,\n 'align'\n> {\n align?: TableCellAlign;\n}\n\nexport function TableCell({\n align = 'start',\n className,\n ...props\n}: TableCellProps) {\n return (\n <td\n className={cn('px-s py-2xs align-middle', ALIGN_CLASS[align], className)}\n {...props}\n />\n );\n}\n\n/** Full-width message row — empty results, an error, a loading state. */\nexport function TableMessageRow({\n colSpan,\n className,\n ...props\n}: ComponentPropsWithoutRef<'td'> & { colSpan: number }) {\n return (\n <tr>\n <td\n colSpan={colSpan}\n className={cn(\n 'px-s py-m text-center text-step-sm text-content-muted',\n className,\n )}\n {...props}\n />\n </tr>\n );\n}\n"],"names":["useEffect","useId","useRef","useState","cn","useOverflows","ref","overflows","setOverflows","node","current","measure","scrollWidth","clientWidth","scrollHeight","clientHeight","observer","ResizeObserver","observe","child","Array","from","children","disconnect","Table","className","containerClassName","containerStyle","caption","captionClassName","props","container","captionId","named","undefined","div","style","data-overflows","tabIndex","role","table","id","TableHead","thead","TableBody","tbody","TableRow","tr","ALIGN_CLASS","start","center","end","TableHeaderCell","align","th","scope","TableCell","td","TableMessageRow","colSpan"],"mappings":"AAAA;;;;AAEA,SAKEA,SAAS,EACTC,KAAK,EACLC,MAAM,EACNC,QAAQ,QACH,QAAQ;AAEf,SAASC,EAAE,QAAQ,oBAAoB;AAgBvC;;;CAGC,GACD,SAASC,aAAaC,GAAkC;IACtD,MAAM,CAACC,WAAWC,aAAa,GAAGL,SAAS;IAC3CH,UAAU;QACR,MAAMS,OAAOH,IAAII,OAAO;QACxB,MAAMC,UAAU,IACdH,aACEC,KAAKG,WAAW,GAAGH,KAAKI,WAAW,IACjCJ,KAAKK,YAAY,GAAGL,KAAKM,YAAY;QAE3CJ;QACA,MAAMK,WAAW,IAAIC,eAAeN;QACpCK,SAASE,OAAO,CAACT;QACjB,oEAAoE;QACpE,KAAK,MAAMU,SAASC,MAAMC,IAAI,CAACZ,KAAKa,QAAQ,EAAGN,SAASE,OAAO,CAACC;QAChE,OAAO,IAAMH,SAASO,UAAU;IAClC,GAAG;QAACjB;KAAI;IACR,OAAOC;AACT;AAEA;;;;;;;;CAQC,GACD,OAAO,SAASiB,MAAM,EAQT;QARS,EACpBC,SAAS,EACTC,kBAAkB,EAClBC,cAAc,EACdC,OAAO,EACPC,mBAAmB,SAAS,EAC5BP,QAAQ,EAEG,OADRQ;;;;;;;;IAEH,MAAMC,YAAY7B,OAAuB;IACzC,MAAM8B,YAAY/B;IAClB,MAAMM,YAAYF,aAAa0B;IAC/B,MAAME,QAAQL,YAAYM;IAE1B,qBACE,KAACC;QACC7B,KAAKyB;QACLK,OAAOT;QACPU,kBAAgB9B,aAAa2B;OACxB3B,aAAa;QAChB+B,UAAU;QACVC,MAAMN,QAAQ,WAAWC;QACzB,mBAAmBD,QAAQD,YAAYE;IACzC;QACAT,WAAWrB,GACT,uFACAsB;kBAGF,cAAA,MAACc;YACCf,WAAWrB,GACT,mDACAqB;WAEEK;;gBAEHG,uBACC,KAACL;oBAAQa,IAAIT;oBAAWP,WAAWI;8BAChCD;;gBAGJN;;;;AAIT;AAEA,OAAO,SAASoB,UAAU,EAGU;QAHV,EACxBjB,SAAS,EAEyB,OAD/BK;;;IAEH,qBACE,KAACa;QACC,wEAAwE;QACxE,uEAAuE;QACvE,qDAAqD;QACrDlB,WAAWrB,GACT,sDACAqB;OAEEK;AAGV;AAEA,OAAO,SAASc,UAAU,EAGU;QAHV,EACxBnB,SAAS,EAEyB,OAD/BK;;;IAEH,qBACE,KAACe;QAAMpB,WAAWrB,GAAG,0BAA0BqB;OAAgBK;AAEnE;AAEA,OAAO,SAASgB,SAAS,EAGQ;QAHR,EACvBrB,SAAS,EAEsB,OAD5BK;;;IAEH,qBACE,KAACiB;QACCtB,WAAWrB,GACT,+DACAqB;OAEEK;AAGV;AAIA,MAAMkB,cAA8C;IAClDC,OAAO;IACPC,QAAQ;IACRC,KAAK;AACP;AAWA,OAAO,SAASC,gBAAgB,EAIT;QAJS,EAC9BC,QAAQ,OAAO,EACf5B,SAAS,EAEY,OADlBK;;;;IAEH,qBACE,KAACwB;QACCC,OAAM;QACN9B,WAAWrB,GACT,+EACA4C,WAAW,CAACK,MAAM,EAClB5B;OAEEK;AAGV;AASA,OAAO,SAAS0B,UAAU,EAIT;QAJS,EACxBH,QAAQ,OAAO,EACf5B,SAAS,EAEM,OADZK;;;;IAEH,qBACE,KAAC2B;QACChC,WAAWrB,GAAG,4BAA4B4C,WAAW,CAACK,MAAM,EAAE5B;OAC1DK;AAGV;AAEA,uEAAuE,GACvE,OAAO,SAAS4B,gBAAgB,EAIuB;QAJvB,EAC9BC,OAAO,EACPlC,SAAS,EAE4C,OADlDK;;;;IAEH,qBACE,KAACiB;kBACC,cAAA,KAACU;YACCE,SAASA;YACTlC,WAAWrB,GACT,yDACAqB;WAEEK;;AAIZ"}
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
import { type MediaImageLoader } from '../../atoms/media-image/index.js';
|
|
2
3
|
export interface MediaGalleryItem {
|
|
3
4
|
/** Unique within the gallery; the slide's element id is derived from it. */
|
|
4
5
|
readonly id: string;
|
|
5
6
|
readonly src: string;
|
|
6
7
|
/** What the image shows. Empty only for an image that adds nothing to the text beside it. */
|
|
7
8
|
readonly alt: string;
|
|
9
|
+
/** Intrinsic width in pixels, when known. */
|
|
10
|
+
readonly width?: number;
|
|
11
|
+
/** Intrinsic height in pixels, when known. */
|
|
12
|
+
readonly height?: number;
|
|
13
|
+
}
|
|
14
|
+
/** What the gallery decided for one slide, handed to a host's own renderer. */
|
|
15
|
+
export interface MediaGallerySlide {
|
|
16
|
+
/** The slide's position, from 0. */
|
|
17
|
+
readonly index: number;
|
|
18
|
+
/** The first slide is fetched first and at once; every other one lazily. */
|
|
19
|
+
readonly priority: boolean;
|
|
20
|
+
/** The `sizes` the slide is shown at. */
|
|
21
|
+
readonly sizes: string;
|
|
8
22
|
}
|
|
9
23
|
export interface MediaGalleryLabels {
|
|
10
24
|
/** The gallery's name — usually the product's. */
|
|
@@ -17,8 +31,21 @@ export interface MediaGalleryLabels {
|
|
|
17
31
|
export interface MediaGalleryProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
18
32
|
items: readonly MediaGalleryItem[];
|
|
19
33
|
labels: MediaGalleryLabels;
|
|
20
|
-
/**
|
|
21
|
-
|
|
34
|
+
/**
|
|
35
|
+
* How wide a slide is shown at, as a `sizes` attribute. Defaults to the full
|
|
36
|
+
* viewport width, which is right only when the gallery is.
|
|
37
|
+
*/
|
|
38
|
+
sizes?: string;
|
|
39
|
+
/** Width over height of every slide's box. Defaults to `1`, a square. */
|
|
40
|
+
aspectRatio?: number;
|
|
41
|
+
/** Resizes a slide's image per width, so the browser can fetch a smaller one. */
|
|
42
|
+
loader?: MediaImageLoader;
|
|
43
|
+
/**
|
|
44
|
+
* Renders one image; a {@link MediaImage} when omitted. A host rendering its
|
|
45
|
+
* own sized image receives the gallery's decisions for the slide, and the
|
|
46
|
+
* slide's box stays reserved around whatever it returns.
|
|
47
|
+
*/
|
|
48
|
+
renderMedia?: (item: MediaGalleryItem, slide: MediaGallerySlide) => ReactNode;
|
|
22
49
|
}
|
|
23
50
|
/**
|
|
24
51
|
* Product media as a horizontal scroller that works with scripting off and
|
|
@@ -27,5 +54,5 @@ export interface MediaGalleryProps extends Omit<ComponentPropsWithoutRef<'div'>,
|
|
|
27
54
|
* a figure with its position, and its previous and next links jump to the
|
|
28
55
|
* neighbouring slide's id, which the browser scrolls into view. Server-safe.
|
|
29
56
|
*/
|
|
30
|
-
export declare function MediaGallery({ items, labels, renderMedia, className, ...props }: MediaGalleryProps): import("react").JSX.Element;
|
|
57
|
+
export declare function MediaGallery({ items, labels, sizes, aspectRatio, loader, renderMedia, className, ...props }: MediaGalleryProps): import("react").JSX.Element;
|
|
31
58
|
//# sourceMappingURL=media-gallery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-gallery.d.ts","sourceRoot":"","sources":["../../../../src/ui/molecules/media-gallery/media-gallery.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"media-gallery.d.ts","sourceRoot":"","sources":["../../../../src/ui/molecules/media-gallery/media-gallery.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAC;AAG1C,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,6FAA6F;IAC7F,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,+EAA+E;AAC/E,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,yCAAyC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7D;AAED,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAC7C,wBAAwB,CAAC,KAAK,CAAC,EAC/B,UAAU,CACX;IACC,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnC,MAAM,EAAE,kBAAkB,CAAC;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,iBAAiB,KAAK,SAAS,CAAC;CAC/E;AAOD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,MAAM,EACN,KAAe,EACf,WAAe,EACf,MAAM,EACN,WAAW,EACX,SAAS,EACT,GAAG,KAAK,EACT,EAAE,iBAAiB,+BAuEnB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
2
|
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { MediaImage } from '../../atoms/media-image/index.js';
|
|
4
5
|
import { cn } from '../../utils/cn.js';
|
|
5
6
|
const slideId = (item)=>`media-${item.id}`;
|
|
6
7
|
const STEP = 'flex min-h-(--target-min) items-center rounded-md px-2xs text-step-sm text-content focus-ring hover:underline';
|
|
@@ -11,13 +12,12 @@ const STEP = 'flex min-h-(--target-min) items-center rounded-md px-2xs text-step
|
|
|
11
12
|
* a figure with its position, and its previous and next links jump to the
|
|
12
13
|
* neighbouring slide's id, which the browser scrolls into view. Server-safe.
|
|
13
14
|
*/ export function MediaGallery(_0) {
|
|
14
|
-
let { items, labels, renderMedia =
|
|
15
|
-
src: item.src,
|
|
16
|
-
alt: item.alt,
|
|
17
|
-
className: "h-auto w-full object-contain"
|
|
18
|
-
}), className } = _0, props = _object_without_properties_loose(_0, [
|
|
15
|
+
let { items, labels, sizes = '100vw', aspectRatio = 1, loader, renderMedia, className } = _0, props = _object_without_properties_loose(_0, [
|
|
19
16
|
"items",
|
|
20
17
|
"labels",
|
|
18
|
+
"sizes",
|
|
19
|
+
"aspectRatio",
|
|
20
|
+
"loader",
|
|
21
21
|
"renderMedia",
|
|
22
22
|
"className"
|
|
23
23
|
]);
|
|
@@ -32,11 +32,31 @@ const STEP = 'flex min-h-(--target-min) items-center rounded-md px-2xs text-step
|
|
|
32
32
|
children: items.map((item, index)=>{
|
|
33
33
|
const previous = items[index - 1];
|
|
34
34
|
const next = items[index + 1];
|
|
35
|
+
const slide = {
|
|
36
|
+
index,
|
|
37
|
+
priority: index === 0,
|
|
38
|
+
sizes
|
|
39
|
+
};
|
|
35
40
|
return /*#__PURE__*/ _jsxs("figure", {
|
|
36
41
|
id: slideId(item),
|
|
37
42
|
className: "m-0 flex w-full shrink-0 snap-center flex-col gap-2xs",
|
|
38
43
|
children: [
|
|
39
|
-
|
|
44
|
+
/*#__PURE__*/ _jsx("div", {
|
|
45
|
+
className: "flex w-full items-center justify-center overflow-hidden",
|
|
46
|
+
style: {
|
|
47
|
+
aspectRatio
|
|
48
|
+
},
|
|
49
|
+
children: renderMedia === undefined ? /*#__PURE__*/ _jsx(MediaImage, {
|
|
50
|
+
src: item.src,
|
|
51
|
+
alt: item.alt,
|
|
52
|
+
width: item.width,
|
|
53
|
+
height: item.height,
|
|
54
|
+
aspectRatio: aspectRatio,
|
|
55
|
+
sizes: sizes,
|
|
56
|
+
priority: slide.priority,
|
|
57
|
+
loader: loader
|
|
58
|
+
}) : renderMedia(item, slide)
|
|
59
|
+
}),
|
|
40
60
|
/*#__PURE__*/ _jsxs("figcaption", {
|
|
41
61
|
className: "flex items-center justify-between gap-s text-step-xs text-content-muted",
|
|
42
62
|
children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/ui/molecules/media-gallery/media-gallery.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ReactNode } from 'react';\n\nimport { cn } from '../../utils/cn.js';\n\nexport interface MediaGalleryItem {\n /** Unique within the gallery; the slide's element id is derived from it. */\n readonly id: string;\n readonly src: string;\n /** What the image shows. Empty only for an image that adds nothing to the text beside it. */\n readonly alt: string;\n}\n\nexport interface MediaGalleryLabels {\n /** The gallery's name — usually the product's. */\n readonly region: string;\n readonly previous: string;\n readonly next: string;\n /** A slide's position, e.g. `2 of 5`. */\n readonly position: (index: number, total: number) => string;\n}\n\nexport interface MediaGalleryProps extends Omit<\n ComponentPropsWithoutRef<'div'>,\n 'children'\n> {\n items: readonly MediaGalleryItem[];\n labels: MediaGalleryLabels;\n /** Renders one image; a
|
|
1
|
+
{"version":3,"sources":["../../../../src/ui/molecules/media-gallery/media-gallery.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ReactNode } from 'react';\n\nimport {\n MediaImage,\n type MediaImageLoader,\n} from '../../atoms/media-image/index.js';\nimport { cn } from '../../utils/cn.js';\n\nexport interface MediaGalleryItem {\n /** Unique within the gallery; the slide's element id is derived from it. */\n readonly id: string;\n readonly src: string;\n /** What the image shows. Empty only for an image that adds nothing to the text beside it. */\n readonly alt: string;\n /** Intrinsic width in pixels, when known. */\n readonly width?: number;\n /** Intrinsic height in pixels, when known. */\n readonly height?: number;\n}\n\n/** What the gallery decided for one slide, handed to a host's own renderer. */\nexport interface MediaGallerySlide {\n /** The slide's position, from 0. */\n readonly index: number;\n /** The first slide is fetched first and at once; every other one lazily. */\n readonly priority: boolean;\n /** The `sizes` the slide is shown at. */\n readonly sizes: string;\n}\n\nexport interface MediaGalleryLabels {\n /** The gallery's name — usually the product's. */\n readonly region: string;\n readonly previous: string;\n readonly next: string;\n /** A slide's position, e.g. `2 of 5`. */\n readonly position: (index: number, total: number) => string;\n}\n\nexport interface MediaGalleryProps extends Omit<\n ComponentPropsWithoutRef<'div'>,\n 'children'\n> {\n items: readonly MediaGalleryItem[];\n labels: MediaGalleryLabels;\n /**\n * How wide a slide is shown at, as a `sizes` attribute. Defaults to the full\n * viewport width, which is right only when the gallery is.\n */\n sizes?: string;\n /** Width over height of every slide's box. Defaults to `1`, a square. */\n aspectRatio?: number;\n /** Resizes a slide's image per width, so the browser can fetch a smaller one. */\n loader?: MediaImageLoader;\n /**\n * Renders one image; a {@link MediaImage} when omitted. A host rendering its\n * own sized image receives the gallery's decisions for the slide, and the\n * slide's box stays reserved around whatever it returns.\n */\n renderMedia?: (item: MediaGalleryItem, slide: MediaGallerySlide) => ReactNode;\n}\n\nconst slideId = (item: MediaGalleryItem) => `media-${item.id}`;\n\nconst STEP =\n 'flex min-h-(--target-min) items-center rounded-md px-2xs text-step-sm text-content focus-ring hover:underline';\n\n/**\n * Product media as a horizontal scroller that works with scripting off and\n * with a keyboard. The scroller is a named region and a Tab stop, so arrow\n * keys scroll it (WCAG 2.1.1, axe `scrollable-region-focusable`); each slide is\n * a figure with its position, and its previous and next links jump to the\n * neighbouring slide's id, which the browser scrolls into view. Server-safe.\n */\nexport function MediaGallery({\n items,\n labels,\n sizes = '100vw',\n aspectRatio = 1,\n loader,\n renderMedia,\n className,\n ...props\n}: MediaGalleryProps) {\n return (\n <div\n role=\"region\"\n aria-label={labels.region}\n // A scroller must take focus to be scrolled from the keyboard.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n className={cn(\n 'flex snap-x snap-mandatory gap-s overflow-x-auto scroll-smooth rounded-lg focus-ring motion-reduce:scroll-auto',\n className,\n )}\n {...props}\n >\n {items.map((item, index) => {\n const previous = items[index - 1];\n const next = items[index + 1];\n const slide: MediaGallerySlide = {\n index,\n priority: index === 0,\n sizes,\n };\n return (\n <figure\n key={item.id}\n id={slideId(item)}\n className=\"m-0 flex w-full shrink-0 snap-center flex-col gap-2xs\"\n >\n {/* The box is reserved before any image arrives, whoever renders\n it, so a late image shifts nothing below it. */}\n <div\n className=\"flex w-full items-center justify-center overflow-hidden\"\n style={{ aspectRatio }}\n >\n {renderMedia === undefined ? (\n <MediaImage\n src={item.src}\n alt={item.alt}\n width={item.width}\n height={item.height}\n aspectRatio={aspectRatio}\n sizes={sizes}\n priority={slide.priority}\n loader={loader}\n />\n ) : (\n renderMedia(item, slide)\n )}\n </div>\n <figcaption className=\"flex items-center justify-between gap-s text-step-xs text-content-muted\">\n {previous ? (\n <a href={`#${slideId(previous)}`} className={STEP}>\n {labels.previous}\n </a>\n ) : (\n <span />\n )}\n <span>{labels.position(index + 1, items.length)}</span>\n {next ? (\n <a href={`#${slideId(next)}`} className={STEP}>\n {labels.next}\n </a>\n ) : (\n <span />\n )}\n </figcaption>\n </figure>\n );\n })}\n </div>\n );\n}\n"],"names":["MediaImage","cn","slideId","item","id","STEP","MediaGallery","items","labels","sizes","aspectRatio","loader","renderMedia","className","props","div","role","aria-label","region","tabIndex","map","index","previous","next","slide","priority","figure","style","undefined","src","alt","width","height","figcaption","a","href","span","position","length"],"mappings":";;;AAEA,SACEA,UAAU,QAEL,mCAAmC;AAC1C,SAASC,EAAE,QAAQ,oBAAoB;AAwDvC,MAAMC,UAAU,CAACC,OAA2B,CAAC,MAAM,EAAEA,KAAKC,EAAE,EAAE;AAE9D,MAAMC,OACJ;AAEF;;;;;;CAMC,GACD,OAAO,SAASC,aAAa,EAST;QATS,EAC3BC,KAAK,EACLC,MAAM,EACNC,QAAQ,OAAO,EACfC,cAAc,CAAC,EACfC,MAAM,EACNC,WAAW,EACXC,SAAS,EAES,OADfC;;;;;;;;;IAEH,qBACE,KAACC;QACCC,MAAK;QACLC,cAAYT,OAAOU,MAAM;QACzB,+DAA+D;QAC/D,+DAA+D;QAC/DC,UAAU;QACVN,WAAWZ,GACT,kHACAY;OAEEC;kBAEHP,MAAMa,GAAG,CAAC,CAACjB,MAAMkB;YAChB,MAAMC,WAAWf,KAAK,CAACc,QAAQ,EAAE;YACjC,MAAME,OAAOhB,KAAK,CAACc,QAAQ,EAAE;YAC7B,MAAMG,QAA2B;gBAC/BH;gBACAI,UAAUJ,UAAU;gBACpBZ;YACF;YACA,qBACE,MAACiB;gBAECtB,IAAIF,QAAQC;gBACZU,WAAU;;kCAIV,KAACE;wBACCF,WAAU;wBACVc,OAAO;4BAAEjB;wBAAY;kCAEpBE,gBAAgBgB,0BACf,KAAC5B;4BACC6B,KAAK1B,KAAK0B,GAAG;4BACbC,KAAK3B,KAAK2B,GAAG;4BACbC,OAAO5B,KAAK4B,KAAK;4BACjBC,QAAQ7B,KAAK6B,MAAM;4BACnBtB,aAAaA;4BACbD,OAAOA;4BACPgB,UAAUD,MAAMC,QAAQ;4BACxBd,QAAQA;6BAGVC,YAAYT,MAAMqB;;kCAGtB,MAACS;wBAAWpB,WAAU;;4BACnBS,yBACC,KAACY;gCAAEC,MAAM,CAAC,CAAC,EAAEjC,QAAQoB,WAAW;gCAAET,WAAWR;0CAC1CG,OAAOc,QAAQ;+CAGlB,KAACc;0CAEH,KAACA;0CAAM5B,OAAO6B,QAAQ,CAAChB,QAAQ,GAAGd,MAAM+B,MAAM;;4BAC7Cf,qBACC,KAACW;gCAAEC,MAAM,CAAC,CAAC,EAAEjC,QAAQqB,OAAO;gCAAEV,WAAWR;0CACtCG,OAAOe,IAAI;+CAGd,KAACa;;;;eAvCAjC,KAAKC,EAAE;QA4ClB;;AAGN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/molecules/summary-tile/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/ui/molecules/summary-tile/index.ts"],"sourcesContent":["export * from './summary-tile.js';\n"],"names":[],"mappings":"AAAA,cAAc,oBAAoB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type MoneyUnit } from '../../atoms/money/index.js';
|
|
3
|
+
import { type StatusTagTone } from '../../atoms/status-tag/index.js';
|
|
4
|
+
import { type ClusterProps } from '../../layout/cluster/index.js';
|
|
5
|
+
/** An amount of money a tile states instead of a count. */
|
|
6
|
+
export interface SummaryTileMoney {
|
|
7
|
+
readonly amount: number;
|
|
8
|
+
readonly currency: string;
|
|
9
|
+
readonly unit: MoneyUnit;
|
|
10
|
+
}
|
|
11
|
+
/** What the tile's figure means at a glance, in a tone and in words. */
|
|
12
|
+
export interface SummaryTileStatus {
|
|
13
|
+
readonly tone: StatusTagTone;
|
|
14
|
+
/** The words for it; the tone never stands alone. */
|
|
15
|
+
readonly label: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SummaryTileProps {
|
|
18
|
+
/** What is counted — "Envíos por despachar". The tile's heading. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Where the counted records are: the tile is one link there. */
|
|
21
|
+
href: string;
|
|
22
|
+
/** How many. Ignored when {@link money} is given. */
|
|
23
|
+
count?: number;
|
|
24
|
+
/** An amount instead of a count — "Próximo pago". */
|
|
25
|
+
money?: SummaryTileMoney;
|
|
26
|
+
/** The figure's meaning as a tag beside it. */
|
|
27
|
+
status?: SummaryTileStatus;
|
|
28
|
+
/** Its own source's state: one tile failing leaves every other one standing. */
|
|
29
|
+
state: 'loading' | 'ready' | 'failed';
|
|
30
|
+
/** Reads the tile's source again. Without it, a failed tile offers no Retry. */
|
|
31
|
+
onRetry?: () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Routing escape hatch. It receives the tile's `href`, `className` and
|
|
34
|
+
* content, and must spread `className` onto what it renders; a plain `<a>`
|
|
35
|
+
* when omitted.
|
|
36
|
+
*/
|
|
37
|
+
renderLink?: (link: {
|
|
38
|
+
href: string;
|
|
39
|
+
className: string;
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
}) => ReactNode;
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* One figure that leads somewhere: a heading, a count or an amount, and a
|
|
46
|
+
* status in words. The whole tile is one link to the records it counts, named
|
|
47
|
+
* by its heading and its figure. It loads, and fails, on its own — a failed
|
|
48
|
+
* tile says so in place and offers Retry while its neighbours keep their
|
|
49
|
+
* figures ([ADR 0028](../../../../../../../docs/adr/0028-states-an-organism-must-render.md)).
|
|
50
|
+
* Nothing is announced live: the figure is read once, when the reader
|
|
51
|
+
* reaches it.
|
|
52
|
+
*/
|
|
53
|
+
export declare function SummaryTile({ label, href, count, money, status, state, onRetry, renderLink, className, }: SummaryTileProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
54
|
+
export type SummaryTileListProps = Omit<ClusterProps, 'as' | 'role' | 'align'>;
|
|
55
|
+
/** Tiles side by side, wrapping as the width runs out; a list, so its size is read out. */
|
|
56
|
+
export declare function SummaryTileList({ children, ...props }: SummaryTileListProps): import("react").JSX.Element;
|
|
57
|
+
//# sourceMappingURL=summary-tile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary-tile.d.ts","sourceRoot":"","sources":["../../../../src/ui/molecules/summary-tile/summary-tile.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKjE,OAAO,EAAS,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAa,KAAK,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAG3E,2DAA2D;AAC3D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CAC1B;AAED,wEAAwE;AACxE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,gFAAgF;IAChF,KAAK,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;IACtC,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,SAAS,CAAC;KACrB,KAAK,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAOD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,MAAM,EACN,KAAK,EACL,OAAO,EACP,UAAU,EACV,SAAS,GACV,EAAE,gBAAgB,+TAqElB;AAED,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAE/E,2FAA2F;AAC3F,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,+BAQ3E"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
3
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
|
+
import { Children, isValidElement } from 'react';
|
|
6
|
+
import { useFormatters, useLocale, useT } from '../../../i18n/index.js';
|
|
7
|
+
import { Alert } from '../../atoms/alert/index.js';
|
|
8
|
+
import { Button } from '../../atoms/button/index.js';
|
|
9
|
+
import { Money } from '../../atoms/money/index.js';
|
|
10
|
+
import { Skeleton } from '../../atoms/skeleton/index.js';
|
|
11
|
+
import { StatusTag } from '../../atoms/status-tag/index.js';
|
|
12
|
+
import { Cluster } from '../../layout/cluster/index.js';
|
|
13
|
+
import { cn } from '../../utils/cn.js';
|
|
14
|
+
const SURFACE = 'flex min-h-(--target-min) flex-col gap-2xs rounded-xl border border-border bg-surface-elevated p-s text-content';
|
|
15
|
+
const LINK = 'block rounded-xl text-content no-underline focus-ring hover:shadow-overlay';
|
|
16
|
+
/**
|
|
17
|
+
* One figure that leads somewhere: a heading, a count or an amount, and a
|
|
18
|
+
* status in words. The whole tile is one link to the records it counts, named
|
|
19
|
+
* by its heading and its figure. It loads, and fails, on its own — a failed
|
|
20
|
+
* tile says so in place and offers Retry while its neighbours keep their
|
|
21
|
+
* figures ([ADR 0028](../../../../../../../docs/adr/0028-states-an-organism-must-render.md)).
|
|
22
|
+
* Nothing is announced live: the figure is read once, when the reader
|
|
23
|
+
* reaches it.
|
|
24
|
+
*/ export function SummaryTile({ label, href, count, money, status, state, onRetry, renderLink, className }) {
|
|
25
|
+
const t = useT();
|
|
26
|
+
const formatters = useFormatters();
|
|
27
|
+
const locale = useLocale();
|
|
28
|
+
const link = (content, linkClass)=>renderLink === undefined ? /*#__PURE__*/ _jsx("a", {
|
|
29
|
+
href: href,
|
|
30
|
+
className: linkClass,
|
|
31
|
+
children: content
|
|
32
|
+
}) : renderLink({
|
|
33
|
+
href,
|
|
34
|
+
className: linkClass,
|
|
35
|
+
children: content
|
|
36
|
+
});
|
|
37
|
+
if (state === 'failed') {
|
|
38
|
+
return /*#__PURE__*/ _jsxs("article", {
|
|
39
|
+
className: cn(SURFACE, className),
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ _jsx("h3", {
|
|
42
|
+
className: "text-step-sm font-semibold",
|
|
43
|
+
children: link(label, 'focus-ring rounded-sm text-content hover:underline')
|
|
44
|
+
}),
|
|
45
|
+
/*#__PURE__*/ _jsx(Alert, {
|
|
46
|
+
tone: "danger",
|
|
47
|
+
action: onRetry === undefined ? undefined : /*#__PURE__*/ _jsx(Button, {
|
|
48
|
+
type: "button",
|
|
49
|
+
variant: "secondary",
|
|
50
|
+
size: "sm",
|
|
51
|
+
onClick: onRetry,
|
|
52
|
+
children: t('state.retry')
|
|
53
|
+
}),
|
|
54
|
+
children: t('summary.failed', {
|
|
55
|
+
label
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const figure = state === 'loading' ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
62
|
+
children: [
|
|
63
|
+
/*#__PURE__*/ _jsx(Skeleton, {
|
|
64
|
+
shape: "line",
|
|
65
|
+
className: "w-12"
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ _jsx("span", {
|
|
68
|
+
className: "sr-only",
|
|
69
|
+
children: t('summary.loading')
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
}) : money !== undefined ? /*#__PURE__*/ _jsx(Money, {
|
|
73
|
+
amount: money.amount,
|
|
74
|
+
currency: money.currency,
|
|
75
|
+
unit: money.unit,
|
|
76
|
+
locale: locale
|
|
77
|
+
}) : formatters.number(count != null ? count : 0);
|
|
78
|
+
return link(/*#__PURE__*/ _jsxs("article", {
|
|
79
|
+
className: cn(SURFACE, className),
|
|
80
|
+
children: [
|
|
81
|
+
/*#__PURE__*/ _jsx("h3", {
|
|
82
|
+
className: "text-step-sm font-semibold",
|
|
83
|
+
children: label
|
|
84
|
+
}),
|
|
85
|
+
/*#__PURE__*/ _jsx("div", {
|
|
86
|
+
className: "text-step-2 font-semibold tabular-nums",
|
|
87
|
+
children: figure
|
|
88
|
+
}),
|
|
89
|
+
state === 'ready' && status !== undefined && /*#__PURE__*/ _jsx(StatusTag, {
|
|
90
|
+
tone: status.tone,
|
|
91
|
+
className: "self-start",
|
|
92
|
+
children: status.label
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
}), LINK);
|
|
96
|
+
}
|
|
97
|
+
/** Tiles side by side, wrapping as the width runs out; a list, so its size is read out. */ export function SummaryTileList(_0) {
|
|
98
|
+
let { children } = _0, props = _object_without_properties_loose(_0, [
|
|
99
|
+
"children"
|
|
100
|
+
]);
|
|
101
|
+
return /*#__PURE__*/ _jsx(Cluster, _extends({
|
|
102
|
+
as: "ul",
|
|
103
|
+
role: "list",
|
|
104
|
+
gap: "s",
|
|
105
|
+
align: "stretch"
|
|
106
|
+
}, props, {
|
|
107
|
+
children: Children.map(children, (child)=>/*#__PURE__*/ isValidElement(child) ? /*#__PURE__*/ _jsx("li", {
|
|
108
|
+
className: "min-w-0",
|
|
109
|
+
children: child
|
|
110
|
+
}) : child)
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
//# sourceMappingURL=summary-tile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/ui/molecules/summary-tile/summary-tile.tsx"],"sourcesContent":["'use client';\n\nimport { Children, isValidElement, type ReactNode } from 'react';\n\nimport { useFormatters, useLocale, useT } from '../../../i18n/index.js';\nimport { Alert } from '../../atoms/alert/index.js';\nimport { Button } from '../../atoms/button/index.js';\nimport { Money, type MoneyUnit } from '../../atoms/money/index.js';\nimport { Skeleton } from '../../atoms/skeleton/index.js';\nimport { StatusTag, type StatusTagTone } from '../../atoms/status-tag/index.js';\nimport { Cluster, type ClusterProps } from '../../layout/cluster/index.js';\nimport { cn } from '../../utils/cn.js';\n\n/** An amount of money a tile states instead of a count. */\nexport interface SummaryTileMoney {\n readonly amount: number;\n readonly currency: string;\n readonly unit: MoneyUnit;\n}\n\n/** What the tile's figure means at a glance, in a tone and in words. */\nexport interface SummaryTileStatus {\n readonly tone: StatusTagTone;\n /** The words for it; the tone never stands alone. */\n readonly label: string;\n}\n\nexport interface SummaryTileProps {\n /** What is counted — \"Envíos por despachar\". The tile's heading. */\n label: string;\n /** Where the counted records are: the tile is one link there. */\n href: string;\n /** How many. Ignored when {@link money} is given. */\n count?: number;\n /** An amount instead of a count — \"Próximo pago\". */\n money?: SummaryTileMoney;\n /** The figure's meaning as a tag beside it. */\n status?: SummaryTileStatus;\n /** Its own source's state: one tile failing leaves every other one standing. */\n state: 'loading' | 'ready' | 'failed';\n /** Reads the tile's source again. Without it, a failed tile offers no Retry. */\n onRetry?: () => void;\n /**\n * Routing escape hatch. It receives the tile's `href`, `className` and\n * content, and must spread `className` onto what it renders; a plain `<a>`\n * when omitted.\n */\n renderLink?: (link: {\n href: string;\n className: string;\n children: ReactNode;\n }) => ReactNode;\n className?: string;\n}\n\nconst SURFACE =\n 'flex min-h-(--target-min) flex-col gap-2xs rounded-xl border border-border bg-surface-elevated p-s text-content';\nconst LINK =\n 'block rounded-xl text-content no-underline focus-ring hover:shadow-overlay';\n\n/**\n * One figure that leads somewhere: a heading, a count or an amount, and a\n * status in words. The whole tile is one link to the records it counts, named\n * by its heading and its figure. It loads, and fails, on its own — a failed\n * tile says so in place and offers Retry while its neighbours keep their\n * figures ([ADR 0028](../../../../../../../docs/adr/0028-states-an-organism-must-render.md)).\n * Nothing is announced live: the figure is read once, when the reader\n * reaches it.\n */\nexport function SummaryTile({\n label,\n href,\n count,\n money,\n status,\n state,\n onRetry,\n renderLink,\n className,\n}: SummaryTileProps) {\n const t = useT();\n const formatters = useFormatters();\n const locale = useLocale();\n const link = (content: ReactNode, linkClass: string) =>\n renderLink === undefined ? (\n <a href={href} className={linkClass}>\n {content}\n </a>\n ) : (\n renderLink({ href, className: linkClass, children: content })\n );\n\n if (state === 'failed') {\n return (\n <article className={cn(SURFACE, className)}>\n <h3 className=\"text-step-sm font-semibold\">\n {link(label, 'focus-ring rounded-sm text-content hover:underline')}\n </h3>\n <Alert\n tone=\"danger\"\n action={\n onRetry === undefined ? undefined : (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n onClick={onRetry}\n >\n {t('state.retry')}\n </Button>\n )\n }\n >\n {t('summary.failed', { label })}\n </Alert>\n </article>\n );\n }\n\n const figure =\n state === 'loading' ? (\n <>\n <Skeleton shape=\"line\" className=\"w-12\" />\n <span className=\"sr-only\">{t('summary.loading')}</span>\n </>\n ) : money !== undefined ? (\n <Money\n amount={money.amount}\n currency={money.currency}\n unit={money.unit}\n locale={locale}\n />\n ) : (\n formatters.number(count ?? 0)\n );\n\n return link(\n <article className={cn(SURFACE, className)}>\n <h3 className=\"text-step-sm font-semibold\">{label}</h3>\n <div className=\"text-step-2 font-semibold tabular-nums\">{figure}</div>\n {state === 'ready' && status !== undefined && (\n <StatusTag tone={status.tone} className=\"self-start\">\n {status.label}\n </StatusTag>\n )}\n </article>,\n LINK,\n );\n}\n\nexport type SummaryTileListProps = Omit<ClusterProps, 'as' | 'role' | 'align'>;\n\n/** Tiles side by side, wrapping as the width runs out; a list, so its size is read out. */\nexport function SummaryTileList({ children, ...props }: SummaryTileListProps) {\n return (\n <Cluster as=\"ul\" role=\"list\" gap=\"s\" align=\"stretch\" {...props}>\n {Children.map(children, child =>\n isValidElement(child) ? <li className=\"min-w-0\">{child}</li> : child,\n )}\n </Cluster>\n );\n}\n"],"names":["Children","isValidElement","useFormatters","useLocale","useT","Alert","Button","Money","Skeleton","StatusTag","Cluster","cn","SURFACE","LINK","SummaryTile","label","href","count","money","status","state","onRetry","renderLink","className","t","formatters","locale","link","content","linkClass","undefined","a","children","article","h3","tone","action","type","variant","size","onClick","figure","shape","span","amount","currency","unit","number","div","SummaryTileList","props","as","role","gap","align","map","child","li"],"mappings":"AAAA;;;;AAEA,SAASA,QAAQ,EAAEC,cAAc,QAAwB,QAAQ;AAEjE,SAASC,aAAa,EAAEC,SAAS,EAAEC,IAAI,QAAQ,yBAAyB;AACxE,SAASC,KAAK,QAAQ,6BAA6B;AACnD,SAASC,MAAM,QAAQ,8BAA8B;AACrD,SAASC,KAAK,QAAwB,6BAA6B;AACnE,SAASC,QAAQ,QAAQ,gCAAgC;AACzD,SAASC,SAAS,QAA4B,kCAAkC;AAChF,SAASC,OAAO,QAA2B,gCAAgC;AAC3E,SAASC,EAAE,QAAQ,oBAAoB;AA4CvC,MAAMC,UACJ;AACF,MAAMC,OACJ;AAEF;;;;;;;;CAQC,GACD,OAAO,SAASC,YAAY,EAC1BC,KAAK,EACLC,IAAI,EACJC,KAAK,EACLC,KAAK,EACLC,MAAM,EACNC,KAAK,EACLC,OAAO,EACPC,UAAU,EACVC,SAAS,EACQ;IACjB,MAAMC,IAAIpB;IACV,MAAMqB,aAAavB;IACnB,MAAMwB,SAASvB;IACf,MAAMwB,OAAO,CAACC,SAAoBC,YAChCP,eAAeQ,0BACb,KAACC;YAAEf,MAAMA;YAAMO,WAAWM;sBACvBD;aAGHN,WAAW;YAAEN;YAAMO,WAAWM;YAAWG,UAAUJ;QAAQ;IAG/D,IAAIR,UAAU,UAAU;QACtB,qBACE,MAACa;YAAQV,WAAWZ,GAAGC,SAASW;;8BAC9B,KAACW;oBAAGX,WAAU;8BACXI,KAAKZ,OAAO;;8BAEf,KAACV;oBACC8B,MAAK;oBACLC,QACEf,YAAYS,YAAYA,0BACtB,KAACxB;wBACC+B,MAAK;wBACLC,SAAQ;wBACRC,MAAK;wBACLC,SAASnB;kCAERG,EAAE;;8BAKRA,EAAE,kBAAkB;wBAAET;oBAAM;;;;IAIrC;IAEA,MAAM0B,SACJrB,UAAU,0BACR;;0BACE,KAACZ;gBAASkC,OAAM;gBAAOnB,WAAU;;0BACjC,KAACoB;gBAAKpB,WAAU;0BAAWC,EAAE;;;SAE7BN,UAAUY,0BACZ,KAACvB;QACCqC,QAAQ1B,MAAM0B,MAAM;QACpBC,UAAU3B,MAAM2B,QAAQ;QACxBC,MAAM5B,MAAM4B,IAAI;QAChBpB,QAAQA;SAGVD,WAAWsB,MAAM,CAAC9B,gBAAAA,QAAS;IAG/B,OAAOU,mBACL,MAACM;QAAQV,WAAWZ,GAAGC,SAASW;;0BAC9B,KAACW;gBAAGX,WAAU;0BAA8BR;;0BAC5C,KAACiC;gBAAIzB,WAAU;0BAA0CkB;;YACxDrB,UAAU,WAAWD,WAAWW,2BAC/B,KAACrB;gBAAU0B,MAAMhB,OAAOgB,IAAI;gBAAEZ,WAAU;0BACrCJ,OAAOJ,KAAK;;;QAInBF;AAEJ;AAIA,yFAAyF,GACzF,OAAO,SAASoC,gBAAgB,EAA4C;QAA5C,EAAEjB,QAAQ,EAAkC,OAA7BkB;;;IAC7C,qBACE,KAACxC;QAAQyC,IAAG;QAAKC,MAAK;QAAOC,KAAI;QAAIC,OAAM;OAAcJ;kBACtDlD,SAASuD,GAAG,CAACvB,UAAUwB,CAAAA,sBACtBvD,eAAeuD,uBAAS,KAACC;gBAAGlC,WAAU;0BAAWiC;iBAAcA;;AAIvE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Entity } from '@entifix/core';
|
|
2
2
|
import type { EntityFormProps } from './entity-form.types.js';
|
|
3
|
-
export declare function EntityForm<TEntity extends Entity>({ entityConstructor, entity, values, onFieldChange, linkSources, onLinkChange, mode: modeProp, defaultMode, onModeChange, errors, formError, onSubmit, onDelete, deletePolicy,
|
|
3
|
+
export declare function EntityForm<TEntity extends Entity>({ entityConstructor, entity, values, onFieldChange, linkSources, onLinkChange, mode: modeProp, defaultMode, onModeChange, errors, formError, onSubmit, onDelete, deletePolicy, embedded, isLoading, skeleton, isSaving, isPending, isDeleting, error, onRetry, backHref, renderLink, title, metadata, isMetadataLoading, onUseCase, onClone, children, }: EntityFormProps<TEntity>): import("react").JSX.Element;
|
|
4
4
|
//# sourceMappingURL=entity-form.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-form.d.ts","sourceRoot":"","sources":["../../../../src/ui/organisms/entity-form/entity-form.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,MAAM,EAWZ,MAAM,eAAe,CAAC;AAsCvB,OAAO,KAAK,EAGV,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAqDhC,wBAAgB,UAAU,CAAC,OAAO,SAAS,MAAM,EAAE,EACjD,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,aAAa,EACb,WAAW,EACX,YAAY,EACZ,IAAI,EAAE,QAAQ,EACd,WAAW,EACX,YAAY,EACZ,MAAM,EACN,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,YAAwB,EACxB,
|
|
1
|
+
{"version":3,"file":"entity-form.d.ts","sourceRoot":"","sources":["../../../../src/ui/organisms/entity-form/entity-form.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,MAAM,EAWZ,MAAM,eAAe,CAAC;AAsCvB,OAAO,KAAK,EAGV,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAqDhC,wBAAgB,UAAU,CAAC,OAAO,SAAS,MAAM,EAAE,EACjD,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,aAAa,EACb,WAAW,EACX,YAAY,EACZ,IAAI,EAAE,QAAQ,EACd,WAAW,EACX,YAAY,EACZ,MAAM,EACN,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,YAAwB,EACxB,QAAgB,EAChB,SAAiB,EACjB,QAAe,EACf,QAAgB,EAChB,SAAiB,EACjB,UAAkB,EAClB,KAAK,EACL,OAAO,EACP,QAAQ,EACR,UAAyB,EACzB,KAAK,EACL,QAAQ,EACR,iBAAyB,EACzB,SAAS,EACT,OAAO,EACP,QAAQ,GACT,EAAE,eAAe,CAAC,OAAO,CAAC,+BA6c1B"}
|
|
@@ -7,7 +7,7 @@ import { useEntityNoun, useLocalizedDescriptors, useT, useTranslateKey } from '.
|
|
|
7
7
|
import { availableUseCases, renderAnchor, useCasesForSurface } from '../../actions/index.js';
|
|
8
8
|
import { useVerbInvoker } from '../../actions/use-verb-invoker.js';
|
|
9
9
|
import { Button, button } from '../../atoms/button/index.js';
|
|
10
|
-
import { CellValue } from '../../atoms/cell-value/index.js';
|
|
10
|
+
import { CellValue, useRecordLabel } from '../../atoms/cell-value/index.js';
|
|
11
11
|
import { FieldControl } from '../../atoms/field-control/index.js';
|
|
12
12
|
import { LocalizedFieldControl } from '../../atoms/localized-field-control/index.js';
|
|
13
13
|
import { Skeleton } from '../../atoms/skeleton/index.js';
|
|
@@ -66,7 +66,7 @@ import { resolveEntityFormFields } from './use-entity-form-fields.js';
|
|
|
66
66
|
*/ /** The key the built-in Delete runs under, which no declared verb can take. */ const DELETE_KEY = '$delete';
|
|
67
67
|
/** Save, from anywhere in the form — the caret in a field included. */ const SAVE_SHORTCUT = 'Mod+S';
|
|
68
68
|
/** The footer's declared primary, when it is not Save. */ const PRIMARY_SHORTCUT = 'Mod+Enter';
|
|
69
|
-
export function EntityForm({ entityConstructor, entity, values, onFieldChange, linkSources, onLinkChange, mode: modeProp, defaultMode, onModeChange, errors, formError, onSubmit, onDelete, deletePolicy = 'confirm',
|
|
69
|
+
export function EntityForm({ entityConstructor, entity, values, onFieldChange, linkSources, onLinkChange, mode: modeProp, defaultMode, onModeChange, errors, formError, onSubmit, onDelete, deletePolicy = 'confirm', embedded = false, isLoading = false, skeleton = true, isSaving = false, isPending = false, isDeleting = false, error, onRetry, backHref, renderLink = renderAnchor, title, metadata, isMetadataLoading = false, onUseCase, onClone, children }) {
|
|
70
70
|
const formId = useId();
|
|
71
71
|
const slots = readEntityFormFields(children);
|
|
72
72
|
// The *field* descriptors, which stay local and synchronous — a column is a
|
|
@@ -162,11 +162,12 @@ export function EntityForm({ entityConstructor, entity, values, onFieldChange, l
|
|
|
162
162
|
busy,
|
|
163
163
|
served: metadata == null ? void 0 : metadata.useCases
|
|
164
164
|
});
|
|
165
|
-
// What a confirmation names
|
|
166
|
-
//
|
|
165
|
+
// What a confirmation names — the object in "Delete {record}?" and the text
|
|
166
|
+
// the typed policy asks for — through the one derivation every surface
|
|
167
|
+
// shares: the entity's `labelMember`, resolved if it is a reference.
|
|
167
168
|
const metaEntity = extractMetaEntity(entityConstructor);
|
|
168
|
-
const
|
|
169
|
-
const recordLabel =
|
|
169
|
+
const nameOf = useRecordLabel();
|
|
170
|
+
const recordLabel = nameOf(entityConstructor, draft);
|
|
170
171
|
const invoke = (descriptor)=>verbs.invoke({
|
|
171
172
|
descriptor,
|
|
172
173
|
target: undefined,
|