@entifix/react-controls 0.23.18 → 0.23.20

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.
Files changed (30) hide show
  1. package/dist/i18n/catalog/en.d.ts.map +1 -1
  2. package/dist/i18n/catalog/en.js +3 -7
  3. package/dist/i18n/catalog/en.js.map +1 -1
  4. package/dist/i18n/catalog/es.d.ts +2 -7
  5. package/dist/i18n/catalog/es.d.ts.map +1 -1
  6. package/dist/i18n/catalog/es.js +3 -7
  7. package/dist/i18n/catalog/es.js.map +1 -1
  8. package/dist/i18n/catalog/index.d.ts +4 -6
  9. package/dist/i18n/catalog/index.d.ts.map +1 -1
  10. package/dist/ui/atoms/cell-value/cell-value.d.ts.map +1 -1
  11. package/dist/ui/atoms/cell-value/cell-value.js +25 -5
  12. package/dist/ui/atoms/cell-value/cell-value.js.map +1 -1
  13. package/dist/ui/atoms/cell-value/format-unit.d.ts +9 -0
  14. package/dist/ui/atoms/cell-value/format-unit.d.ts.map +1 -0
  15. package/dist/ui/atoms/cell-value/format-unit.js +34 -0
  16. package/dist/ui/atoms/cell-value/format-unit.js.map +1 -0
  17. package/dist/ui/molecules/pagination/pagination-links.d.ts +1 -1
  18. package/dist/ui/molecules/pagination/pagination-links.d.ts.map +1 -1
  19. package/dist/ui/molecules/pagination/pagination-links.js +6 -1
  20. package/dist/ui/molecules/pagination/pagination-links.js.map +1 -1
  21. package/dist/ui/molecules/pagination/pagination.d.ts.map +1 -1
  22. package/dist/ui/molecules/pagination/pagination.js +2 -1
  23. package/dist/ui/molecules/pagination/pagination.js.map +1 -1
  24. package/dist/ui/organisms/entity-detail-grid/entity-detail-grid.d.ts.map +1 -1
  25. package/dist/ui/organisms/entity-detail-grid/entity-detail-grid.js +2 -1
  26. package/dist/ui/organisms/entity-detail-grid/entity-detail-grid.js.map +1 -1
  27. package/dist/ui/organisms/entity-form/entity-form.d.ts.map +1 -1
  28. package/dist/ui/organisms/entity-form/entity-form.js +8 -1
  29. package/dist/ui/organisms/entity-form/entity-form.js.map +1 -1
  30. package/package.json +5 -5
@@ -0,0 +1,34 @@
1
+ /** From a byte up, each a thousand of the last, as `Intl` names them. */ const BYTE_UNITS = [
2
+ 'byte',
3
+ 'kilobyte',
4
+ 'megabyte',
5
+ 'gigabyte',
6
+ 'terabyte'
7
+ ];
8
+ /**
9
+ * A number in the unit it counts in, as the reader's locale writes it:
10
+ * `12 %` for a rate, `57,8 kB` for a size. `scale` is a fixed scaled
11
+ * member's decimals — a rate stored in basis points is `1250` at scale 2, and
12
+ * reads `12,5 %`. A size climbs to the largest unit that keeps it at least one.
13
+ */ export function formatUnit(stored, unit, locale, scale = 0) {
14
+ const value = stored / 10 ** scale;
15
+ if (unit === 'percent') return new Intl.NumberFormat(locale, {
16
+ style: 'unit',
17
+ unit: 'percent',
18
+ maximumFractionDigits: scale
19
+ }).format(value);
20
+ let index = 0;
21
+ let amount = value;
22
+ while(Math.abs(amount) >= 1000 && index < BYTE_UNITS.length - 1){
23
+ amount /= 1000;
24
+ index += 1;
25
+ }
26
+ return new Intl.NumberFormat(locale, {
27
+ style: 'unit',
28
+ unit: BYTE_UNITS[index],
29
+ unitDisplay: 'short',
30
+ maximumFractionDigits: index === 0 ? 0 : 1
31
+ }).format(amount);
32
+ }
33
+
34
+ //# sourceMappingURL=format-unit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/ui/atoms/cell-value/format-unit.ts"],"sourcesContent":["import type { MemberUnit } from '@entifix/core';\n\n/** From a byte up, each a thousand of the last, as `Intl` names them. */\nconst BYTE_UNITS = [\n 'byte',\n 'kilobyte',\n 'megabyte',\n 'gigabyte',\n 'terabyte',\n] as const;\n\n/**\n * A number in the unit it counts in, as the reader's locale writes it:\n * `12 %` for a rate, `57,8 kB` for a size. `scale` is a fixed scaled\n * member's decimals — a rate stored in basis points is `1250` at scale 2, and\n * reads `12,5 %`. A size climbs to the largest unit that keeps it at least one.\n */\nexport function formatUnit(\n stored: number,\n unit: MemberUnit,\n locale: string,\n scale = 0,\n): string {\n const value = stored / 10 ** scale;\n if (unit === 'percent')\n return new Intl.NumberFormat(locale, {\n style: 'unit',\n unit: 'percent',\n maximumFractionDigits: scale,\n }).format(value);\n let index = 0;\n let amount = value;\n while (Math.abs(amount) >= 1000 && index < BYTE_UNITS.length - 1) {\n amount /= 1000;\n index += 1;\n }\n return new Intl.NumberFormat(locale, {\n style: 'unit',\n unit: BYTE_UNITS[index],\n unitDisplay: 'short',\n maximumFractionDigits: index === 0 ? 0 : 1,\n }).format(amount);\n}\n"],"names":["BYTE_UNITS","formatUnit","stored","unit","locale","scale","value","Intl","NumberFormat","style","maximumFractionDigits","format","index","amount","Math","abs","length","unitDisplay"],"mappings":"AAEA,uEAAuE,GACvE,MAAMA,aAAa;IACjB;IACA;IACA;IACA;IACA;CACD;AAED;;;;;CAKC,GACD,OAAO,SAASC,WACdC,MAAc,EACdC,IAAgB,EAChBC,MAAc,EACdC,QAAQ,CAAC;IAET,MAAMC,QAAQJ,SAAS,MAAMG;IAC7B,IAAIF,SAAS,WACX,OAAO,IAAII,KAAKC,YAAY,CAACJ,QAAQ;QACnCK,OAAO;QACPN,MAAM;QACNO,uBAAuBL;IACzB,GAAGM,MAAM,CAACL;IACZ,IAAIM,QAAQ;IACZ,IAAIC,SAASP;IACb,MAAOQ,KAAKC,GAAG,CAACF,WAAW,QAAQD,QAAQZ,WAAWgB,MAAM,GAAG,EAAG;QAChEH,UAAU;QACVD,SAAS;IACX;IACA,OAAO,IAAIL,KAAKC,YAAY,CAACJ,QAAQ;QACnCK,OAAO;QACPN,MAAMH,UAAU,CAACY,MAAM;QACvBK,aAAa;QACbP,uBAAuBE,UAAU,IAAI,IAAI;IAC3C,GAAGD,MAAM,CAACE;AACZ"}
@@ -29,5 +29,5 @@ export interface PaginationLinksProps {
29
29
  * Previous and Next stay in the layout at the edges, as text marked
30
30
  * `aria-disabled` rather than as links that go nowhere.
31
31
  */
32
- export declare function PaginationLinks({ currentPage, pageSize, totalItems, hrefFor, t, renderLink, radius, className, }: PaginationLinksProps): import("react").JSX.Element;
32
+ export declare function PaginationLinks({ currentPage, pageSize, totalItems, hrefFor, t, renderLink, radius, className, }: PaginationLinksProps): import("react").JSX.Element | null;
33
33
  //# sourceMappingURL=pagination-links.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pagination-links.d.ts","sourceRoot":"","sources":["../../../../src/ui/molecules/pagination/pagination-links.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAS7E,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAClC;;;;OAIG;IACH,CAAC,EAAE,SAAS,CAAC;IACb,wEAAwE;IACxE,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,QAAQ,EACR,UAAU,EACV,OAAO,EACP,CAAC,EACD,UAAyB,EACzB,MAAM,EACN,SAAS,GACV,EAAE,oBAAoB,+BA2EtB"}
1
+ {"version":3,"file":"pagination-links.d.ts","sourceRoot":"","sources":["../../../../src/ui/molecules/pagination/pagination-links.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAS7E,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAClC;;;;OAIG;IACH,CAAC,EAAE,SAAS,CAAC;IACb,wEAAwE;IACxE,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,QAAQ,EACR,UAAU,EACV,OAAO,EACP,CAAC,EACD,UAAyB,EACzB,MAAM,EACN,SAAS,GACV,EAAE,oBAAoB,sCAgFtB"}
@@ -17,6 +17,10 @@ import { pageCount, pageWindow } from './page-math.js';
17
17
  * `aria-disabled` rather than as links that go nowhere.
18
18
  */ export function PaginationLinks({ currentPage, pageSize, totalItems, hrefFor, t, renderLink = renderAnchor, radius, className }) {
19
19
  const totalPages = pageCount(totalItems, pageSize);
20
+ // One page has nowhere to go: no navigation, and the count is the host's to
21
+ // say — a "Page 1 of 1" beside a listing that already said "1 product" only
22
+ // repeats it.
23
+ if (totalPages <= 1) return null;
20
24
  const step = button({
21
25
  variant: 'secondary',
22
26
  size: 'sm'
@@ -49,7 +53,8 @@ import { pageCount, pageWindow } from './page-math.js';
49
53
  children: t('pagination.summary', {
50
54
  current: currentPage,
51
55
  total: totalPages,
52
- items: totalItems
56
+ items: totalItems,
57
+ count: totalItems
53
58
  })
54
59
  }),
55
60
  /*#__PURE__*/ _jsxs("ol", {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/ui/molecules/pagination/pagination-links.tsx"],"sourcesContent":["import type { Translate } from '../../../i18n/index.js';\nimport { renderAnchor, type RenderLink } from '../../actions/render-link.js';\nimport { button } from '../../atoms/button/button-recipe.js';\nimport { Text } from '../../atoms/text/index.js';\nimport { cn } from '../../utils/cn.js';\nimport { pageCount, pageWindow } from './page-math.js';\n\n/** A glyph, not copy: it reads the same in every locale, and it is aria-hidden. */\nconst GAP = '…';\n\nexport interface PaginationLinksProps {\n currentPage: number;\n pageSize: number;\n totalItems: number;\n /** The URL of a page. Page 1 is the host's to spell, usually without `?page`. */\n hrefFor: (page: number) => string;\n /**\n * Resolves this control's keys (`pagination.*`). A server component has no\n * context to read a translator from, so the host hands one over: in a Next\n * host, the server translator for the controls' namespace.\n */\n t: Translate;\n /** Defaults to a plain anchor; a host passes its own link component. */\n renderLink?: RenderLink;\n /** How many page numbers either side of the current one. Defaults to 1. */\n radius?: number;\n className?: string;\n}\n\n/**\n * {@link Pagination} as links, and a **server** component.\n *\n * Every page is an address: a crawler follows it, a visitor middle-clicks it,\n * and the page works with JavaScript off. `Pagination` steps through a\n * callback and carries a `'use client'`, which a server-rendered listing\n * cannot use without turning its pager into a client boundary for no gain.\n *\n * Previous and Next stay in the layout at the edges, as text marked\n * `aria-disabled` rather than as links that go nowhere.\n */\nexport function PaginationLinks({\n currentPage,\n pageSize,\n totalItems,\n hrefFor,\n t,\n renderLink = renderAnchor,\n radius,\n className,\n}: PaginationLinksProps) {\n const totalPages = pageCount(totalItems, pageSize);\n const step = button({ variant: 'secondary', size: 'sm' });\n const number = button({ variant: 'ghost', size: 'sm' });\n const unavailable = cn(step, 'pointer-events-none opacity-50');\n\n const edge = (page: number, label: string, enabled: boolean) =>\n enabled ? (\n renderLink({\n href: hrefFor(page),\n className: step,\n children: label,\n intent: { kind: 'page', page },\n })\n ) : (\n <span aria-disabled=\"true\" className={unavailable}>\n {label}\n </span>\n );\n\n return (\n <nav\n aria-label={t('pagination.label')}\n className={cn(\n 'flex flex-wrap items-center justify-between gap-2xs',\n className,\n )}\n >\n <Text step={-1} tone=\"muted\">\n {t('pagination.summary', {\n current: currentPage,\n total: totalPages,\n items: totalItems,\n })}\n </Text>\n\n <ol className=\"flex flex-wrap items-center gap-3xs\">\n <li>\n {edge(currentPage - 1, t('pagination.previous'), currentPage > 1)}\n </li>\n {pageWindow(currentPage, totalPages, radius).map(entry =>\n entry.kind === 'gap' ? (\n <li key={`gap-${entry.after}`} aria-hidden=\"true\">\n <Text tone=\"muted\">{GAP}</Text>\n </li>\n ) : (\n <li key={entry.page}>\n {entry.page === currentPage ? (\n <span\n aria-current=\"page\"\n className={button({ variant: 'primary', size: 'sm' })}\n >\n {entry.page}\n </span>\n ) : (\n renderLink({\n href: hrefFor(entry.page),\n className: number,\n children: String(entry.page),\n intent: { kind: 'page', page: entry.page },\n })\n )}\n </li>\n ),\n )}\n <li>\n {edge(\n currentPage + 1,\n t('pagination.next'),\n currentPage < totalPages,\n )}\n </li>\n </ol>\n </nav>\n );\n}\n"],"names":["renderAnchor","button","Text","cn","pageCount","pageWindow","GAP","PaginationLinks","currentPage","pageSize","totalItems","hrefFor","t","renderLink","radius","className","totalPages","step","variant","size","number","unavailable","edge","page","label","enabled","href","children","intent","kind","span","aria-disabled","nav","aria-label","tone","current","total","items","ol","li","map","entry","aria-hidden","after","aria-current","String"],"mappings":";AACA,SAASA,YAAY,QAAyB,+BAA+B;AAC7E,SAASC,MAAM,QAAQ,sCAAsC;AAC7D,SAASC,IAAI,QAAQ,4BAA4B;AACjD,SAASC,EAAE,QAAQ,oBAAoB;AACvC,SAASC,SAAS,EAAEC,UAAU,QAAQ,iBAAiB;AAEvD,iFAAiF,GACjF,MAAMC,MAAM;AAqBZ;;;;;;;;;;CAUC,GACD,OAAO,SAASC,gBAAgB,EAC9BC,WAAW,EACXC,QAAQ,EACRC,UAAU,EACVC,OAAO,EACPC,CAAC,EACDC,aAAab,YAAY,EACzBc,MAAM,EACNC,SAAS,EACY;IACrB,MAAMC,aAAaZ,UAAUM,YAAYD;IACzC,MAAMQ,OAAOhB,OAAO;QAAEiB,SAAS;QAAaC,MAAM;IAAK;IACvD,MAAMC,SAASnB,OAAO;QAAEiB,SAAS;QAASC,MAAM;IAAK;IACrD,MAAME,cAAclB,GAAGc,MA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import type { Translate } from '../../../i18n/index.js';\nimport { renderAnchor, type RenderLink } from '../../actions/render-link.js';\nimport { button } from '../../atoms/button/button-recipe.js';\nimport { Text } from '../../atoms/text/index.js';\nimport { cn } from '../../utils/cn.js';\nimport { pageCount, pageWindow } from './page-math.js';\n\n/** A glyph, not copy: it reads the same in every locale, and it is aria-hidden. */\nconst GAP = '…';\n\nexport interface PaginationLinksProps {\n currentPage: number;\n pageSize: number;\n totalItems: number;\n /** The URL of a page. Page 1 is the host's to spell, usually without `?page`. */\n hrefFor: (page: number) => string;\n /**\n * Resolves this control's keys (`pagination.*`). A server component has no\n * context to read a translator from, so the host hands one over: in a Next\n * host, the server translator for the controls' namespace.\n */\n t: Translate;\n /** Defaults to a plain anchor; a host passes its own link component. */\n renderLink?: RenderLink;\n /** How many page numbers either side of the current one. Defaults to 1. */\n radius?: number;\n className?: string;\n}\n\n/**\n * {@link Pagination} as links, and a **server** component.\n *\n * Every page is an address: a crawler follows it, a visitor middle-clicks it,\n * and the page works with JavaScript off. `Pagination` steps through a\n * callback and carries a `'use client'`, which a server-rendered listing\n * cannot use without turning its pager into a client boundary for no gain.\n *\n * Previous and Next stay in the layout at the edges, as text marked\n * `aria-disabled` rather than as links that go nowhere.\n */\nexport function PaginationLinks({\n currentPage,\n pageSize,\n totalItems,\n hrefFor,\n t,\n renderLink = renderAnchor,\n radius,\n className,\n}: PaginationLinksProps) {\n const totalPages = pageCount(totalItems, pageSize);\n // One page has nowhere to go: no navigation, and the count is the host's to\n // say — a \"Page 1 of 1\" beside a listing that already said \"1 product\" only\n // repeats it.\n if (totalPages <= 1) return null;\n const step = button({ variant: 'secondary', size: 'sm' });\n const number = button({ variant: 'ghost', size: 'sm' });\n const unavailable = cn(step, 'pointer-events-none opacity-50');\n\n const edge = (page: number, label: string, enabled: boolean) =>\n enabled ? (\n renderLink({\n href: hrefFor(page),\n className: step,\n children: label,\n intent: { kind: 'page', page },\n })\n ) : (\n <span aria-disabled=\"true\" className={unavailable}>\n {label}\n </span>\n );\n\n return (\n <nav\n aria-label={t('pagination.label')}\n className={cn(\n 'flex flex-wrap items-center justify-between gap-2xs',\n className,\n )}\n >\n <Text step={-1} tone=\"muted\">\n {t('pagination.summary', {\n current: currentPage,\n total: totalPages,\n items: totalItems,\n count: totalItems,\n })}\n </Text>\n\n <ol className=\"flex flex-wrap items-center gap-3xs\">\n <li>\n {edge(currentPage - 1, t('pagination.previous'), currentPage > 1)}\n </li>\n {pageWindow(currentPage, totalPages, radius).map(entry =>\n entry.kind === 'gap' ? (\n <li key={`gap-${entry.after}`} aria-hidden=\"true\">\n <Text tone=\"muted\">{GAP}</Text>\n </li>\n ) : (\n <li key={entry.page}>\n {entry.page === currentPage ? (\n <span\n aria-current=\"page\"\n className={button({ variant: 'primary', size: 'sm' })}\n >\n {entry.page}\n </span>\n ) : (\n renderLink({\n href: hrefFor(entry.page),\n className: number,\n children: String(entry.page),\n intent: { kind: 'page', page: entry.page },\n })\n )}\n </li>\n ),\n )}\n <li>\n {edge(\n currentPage + 1,\n t('pagination.next'),\n currentPage < totalPages,\n )}\n </li>\n </ol>\n </nav>\n );\n}\n"],"names":["renderAnchor","button","Text","cn","pageCount","pageWindow","GAP","PaginationLinks","currentPage","pageSize","totalItems","hrefFor","t","renderLink","radius","className","totalPages","step","variant","size","number","unavailable","edge","page","label","enabled","href","children","intent","kind","span","aria-disabled","nav","aria-label","tone","current","total","items","count","ol","li","map","entry","aria-hidden","after","aria-current","String"],"mappings":";AACA,SAASA,YAAY,QAAyB,+BAA+B;AAC7E,SAASC,MAAM,QAAQ,sCAAsC;AAC7D,SAASC,IAAI,QAAQ,4BAA4B;AACjD,SAASC,EAAE,QAAQ,oBAAoB;AACvC,SAASC,SAAS,EAAEC,UAAU,QAAQ,iBAAiB;AAEvD,iFAAiF,GACjF,MAAMC,MAAM;AAqBZ;;;;;;;;;;CAUC,GACD,OAAO,SAASC,gBAAgB,EAC9BC,WAAW,EACXC,QAAQ,EACRC,UAAU,EACVC,OAAO,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a,MAAMf,QAAQ+B,MAAMnB,IAAI;gCACxBR,WAAWK;gCACXO,UAAUmB,OAAOJ,MAAMnB,IAAI;gCAC3BK,QAAQ;oCAAEC,MAAM;oCAAQN,MAAMmB,MAAMnB,IAAI;gCAAC;4BAC3C;2BAdKmB,MAAMnB,IAAI;kCAmBvB,KAACiB;kCACElB,KACCd,cAAc,GACdI,EAAE,oBACFJ,cAAcQ;;;;;;AAM1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../../src/ui/molecules/pagination/pagination.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,yBAAyB,4BAA6B,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,EACzB,WAAW,EACX,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,eAA2C,EAC3C,SAAS,GACV,EAAE,eAAe,+BAkEjB"}
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../../src/ui/molecules/pagination/pagination.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,yBAAyB,4BAA6B,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,EACzB,WAAW,EACX,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,eAA2C,EAC3C,SAAS,GACV,EAAE,eAAe,+BAmEjB"}
@@ -50,7 +50,8 @@ export const DEFAULT_PAGE_SIZE_OPTIONS = [
50
50
  children: t('pagination.summary', {
51
51
  current: currentPage,
52
52
  total: totalPages,
53
- items: totalItems
53
+ items: totalItems,
54
+ count: totalItems
54
55
  })
55
56
  }),
56
57
  /*#__PURE__*/ _jsx("span", {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/ui/molecules/pagination/pagination.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\n\nimport { useT } from '../../../i18n/index.js';\nimport { Button } from '../../atoms/button/index.js';\nimport { Select } from '../../atoms/field/index.js';\nimport { Text } from '../../atoms/text/index.js';\nimport { cn } from '../../utils/cn.js';\nimport { pageCount } from './page-math.js';\n\nexport const DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100] as const;\n\nexport interface PaginationProps {\n currentPage: number;\n pageSize: number;\n totalItems: number;\n onPageChange: (page: number) => void;\n onPageSizeChange?: (pageSize: number) => void;\n pageSizeOptions?: readonly number[];\n className?: string;\n}\n\n/**\n * Page stepper plus an optional page-size selector, driven by callbacks.\n *\n * A `nav` with First, Previous, Next and Last. An end that goes nowhere stays\n * focusable and says so with `aria-disabled`, rather than dropping out of the\n * tab order under the reader's hand. A page change is announced — \"Page 2 of\n * 5\" — and the first render is not.\n *\n * For a listing whose pages are addresses (server-rendered, crawlable, working\n * without JavaScript) use {@link PaginationLinks} instead.\n */\nexport function Pagination({\n currentPage,\n pageSize,\n totalItems,\n onPageChange,\n onPageSizeChange,\n pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS,\n className,\n}: PaginationProps) {\n const t = useT();\n const totalPages = pageCount(totalItems, pageSize);\n const [announced, setAnnounced] = useState(false);\n\n const step = (label: string, page: number, enabled: boolean) => (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n // Headless UI runs no handler on an `aria-disabled` button, so an end\n // that goes nowhere is inert while it keeps its place in the tab order.\n aria-disabled={enabled ? undefined : true}\n onClick={() => {\n setAnnounced(true);\n onPageChange(page);\n }}\n >\n {label}\n </Button>\n );\n\n return (\n <nav\n aria-label={t('pagination.label')}\n className={cn(\n 'flex flex-wrap items-center justify-between gap-2xs',\n className,\n )}\n >\n <Text step={-1} tone=\"muted\">\n {t('pagination.summary', {\n current: currentPage,\n total: totalPages,\n items: totalItems,\n })}\n </Text>\n <span role=\"status\" className=\"sr-only\">\n {announced\n ? t('pagination.page', { current: currentPage, total: totalPages })\n : ''}\n </span>\n\n <div className=\"flex flex-wrap items-center gap-2xs\">\n {onPageSizeChange && (\n <label className=\"flex items-center gap-3xs text-step-sm text-content-muted\">\n {t('pagination.rows')}\n <Select\n value={pageSize}\n onChange={event => onPageSizeChange(Number(event.target.value))}\n >\n {pageSizeOptions.map(option => (\n <option key={option} value={option}>\n {option}\n </option>\n ))}\n </Select>\n </label>\n )}\n {step(t('pagination.first'), 1, currentPage > 1)}\n {step(t('pagination.previous'), currentPage - 1, currentPage > 1)}\n {step(t('pagination.next'), currentPage + 1, currentPage < totalPages)}\n {step(t('pagination.last'), totalPages, currentPage < totalPages)}\n </div>\n </nav>\n );\n}\n"],"names":["useState","useT","Button","Select","Text","cn","pageCount","DEFAULT_PAGE_SIZE_OPTIONS","Pagination","currentPage","pageSize","totalItems","onPageChange","onPageSizeChange","pageSizeOptions","className","t","totalPages","announced","setAnnounced","step","label","page","enabled","type","variant","size","aria-disabled","undefined","onClick","nav","aria-label","tone","current","total","items","span","role","div","value","onChange","event","Number","target","map","option"],"m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QAAS5B,iBAAiB6B,OAAOD,MAAME,MAAM,CAACJ,KAAK;0CAE5DzB,gBAAgB8B,GAAG,CAACC,CAAAA,uBACnB,KAACA;wCAAoBN,OAAOM;kDACzBA;uCADUA;;;;oBAOpBzB,KAAKJ,EAAE,qBAAqB,GAAGP,cAAc;oBAC7CW,KAAKJ,EAAE,wBAAwBP,cAAc,GAAGA,cAAc;oBAC9DW,KAAKJ,EAAE,oBAAoBP,cAAc,GAAGA,cAAcQ;oBAC1DG,KAAKJ,EAAE,oBAAoBC,YAAYR,cAAcQ;;;;;AAI9D"}
1
+ {"version":3,"sources":["../../../../src/ui/molecules/pagination/pagination.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\n\nimport { useT } from '../../../i18n/index.js';\nimport { Button } from '../../atoms/button/index.js';\nimport { Select } from '../../atoms/field/index.js';\nimport { Text } from '../../atoms/text/index.js';\nimport { cn } from '../../utils/cn.js';\nimport { pageCount } from './page-math.js';\n\nexport const DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100] as const;\n\nexport interface PaginationProps {\n currentPage: number;\n pageSize: number;\n totalItems: number;\n onPageChange: (page: number) => void;\n onPageSizeChange?: (pageSize: number) => void;\n pageSizeOptions?: readonly number[];\n className?: string;\n}\n\n/**\n * Page stepper plus an optional page-size selector, driven by callbacks.\n *\n * A `nav` with First, Previous, Next and Last. An end that goes nowhere stays\n * focusable and says so with `aria-disabled`, rather than dropping out of the\n * tab order under the reader's hand. A page change is announced — \"Page 2 of\n * 5\" — and the first render is not.\n *\n * For a listing whose pages are addresses (server-rendered, crawlable, working\n * without JavaScript) use {@link PaginationLinks} instead.\n */\nexport function Pagination({\n currentPage,\n pageSize,\n totalItems,\n onPageChange,\n onPageSizeChange,\n pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS,\n className,\n}: PaginationProps) {\n const t = useT();\n const totalPages = pageCount(totalItems, pageSize);\n const [announced, setAnnounced] = useState(false);\n\n const step = (label: string, page: number, enabled: boolean) => (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n // Headless UI runs no handler on an `aria-disabled` button, so an end\n // that goes nowhere is inert while it keeps its place in the tab order.\n aria-disabled={enabled ? undefined : true}\n onClick={() => {\n setAnnounced(true);\n onPageChange(page);\n }}\n >\n {label}\n </Button>\n );\n\n return (\n <nav\n aria-label={t('pagination.label')}\n className={cn(\n 'flex flex-wrap items-center justify-between gap-2xs',\n className,\n )}\n >\n <Text step={-1} tone=\"muted\">\n {t('pagination.summary', {\n current: currentPage,\n total: totalPages,\n items: totalItems,\n count: totalItems,\n })}\n </Text>\n <span role=\"status\" className=\"sr-only\">\n {announced\n ? t('pagination.page', { current: currentPage, total: totalPages })\n : ''}\n </span>\n\n <div className=\"flex flex-wrap items-center gap-2xs\">\n {onPageSizeChange && (\n <label className=\"flex items-center gap-3xs text-step-sm text-content-muted\">\n {t('pagination.rows')}\n <Select\n value={pageSize}\n onChange={event => onPageSizeChange(Number(event.target.value))}\n >\n {pageSizeOptions.map(option => (\n <option key={option} value={option}>\n {option}\n </option>\n ))}\n </Select>\n </label>\n )}\n {step(t('pagination.first'), 1, currentPage > 1)}\n {step(t('pagination.previous'), currentPage - 1, currentPage > 1)}\n {step(t('pagination.next'), currentPage + 1, currentPage < totalPages)}\n {step(t('pagination.last'), totalPages, currentPage < totalPages)}\n </div>\n </nav>\n );\n}\n"],"names":["useState","useT","Button","Select","Text","cn","pageCount","DEFAULT_PAGE_SIZE_OPTIONS","Pagination","currentPage","pageSize","totalItems","onPageChange","onPageSizeChange","pageSizeOptions","className","t","totalPages","announced","setAnnounced","step","label","page","enabled","type","variant","size","aria-disabled","undefined","onClick","nav","aria-label","tone","current","total","items","count","span","role","div","value","onChange","event","Number","target","map","option"],"mappings":"AAAA;;AAEA,SAASA,QAAQ,QAAQ,QAAQ;AAEjC,SAASC,IAAI,QAAQ,yBAAyB;AAC9C,SAASC,MAAM,QAAQ,8BAA8B;AACrD,SAASC,MAAM,QAAQ,6BAA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BA;uCADUA;;;;oBAOpB1B,KAAKJ,EAAE,qBAAqB,GAAGP,cAAc;oBAC7CW,KAAKJ,EAAE,wBAAwBP,cAAc,GAAGA,cAAc;oBAC9DW,KAAKJ,EAAE,oBAAoBP,cAAc,GAAGA,cAAcQ;oBAC1DG,KAAKJ,EAAE,oBAAoBC,YAAYR,cAAcQ;;;;;AAI9D"}
@@ -1 +1 @@
1
- {"version":3,"file":"entity-detail-grid.d.ts","sourceRoot":"","sources":["../../../../src/ui/organisms/entity-detail-grid/entity-detail-grid.tsx"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAK3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,OAAe,EACf,SAAiB,EACjB,QAAe,EACf,MAAM,EACN,SAAS,GACV,EAAE,qBAAqB,+BA6MvB"}
1
+ {"version":3,"file":"entity-detail-grid.d.ts","sourceRoot":"","sources":["../../../../src/ui/organisms/entity-detail-grid/entity-detail-grid.tsx"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAK3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,OAAe,EACf,SAAiB,EACjB,QAAe,EACf,MAAM,EACN,SAAS,GACV,EAAE,qBAAqB,+BAiNvB"}
@@ -55,7 +55,8 @@ import { cn } from '../../utils/cn.js';
55
55
  var _columns_;
56
56
  const t = useT();
57
57
  const gridId = useId();
58
- const described = useMemo(()=>descriptor.childType === undefined ? [] : editableChildColumns(describeChildColumns(descriptor.childType)), [
58
+ const described = useMemo(()=>descriptor.childType === undefined ? [] : // grid never drops a key it was handed — and gets no column.
59
+ editableChildColumns(describeChildColumns(descriptor.childType)).filter((column)=>column.presentation !== 'none'), [
59
60
  descriptor.childType
60
61
  ]);
61
62
  const columns = useLocalizedDescriptors(described);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/ui/organisms/entity-detail-grid/entity-detail-grid.tsx"],"sourcesContent":["'use client';\n\nimport {\n describeChildColumns,\n editableChildColumns,\n type EntityFieldDescriptor,\n type EntityRowDraft,\n newRowKey,\n parseRowFieldPath,\n ROW_KEY,\n rowFieldPath,\n} from '@entifix/core';\nimport { type KeyboardEvent, useId, useMemo } from 'react';\n\nimport { useLocalizedDescriptors, useT } from '../../../i18n/index.js';\nimport { Button } from '../../atoms/button/index.js';\nimport { CellValue } from '../../atoms/cell-value/index.js';\nimport { FieldControl } from '../../atoms/field-control/index.js';\nimport { Skeleton } from '../../atoms/skeleton/index.js';\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeaderCell,\n TableMessageRow,\n TableRow,\n} from '../../atoms/table/index.js';\nimport { Stack } from '../../molecules/stack/index.js';\nimport { cn } from '../../utils/cn.js';\nimport type { EntityDetailGridProps } from './entity-detail-grid.types.js';\n\n/** Rows the placeholder stands in for. Enough to read as a grid, not a page. */\nconst SKELETON_ROW_COUNT = 3;\n\n/**\n * The rows a record **owns**, edited in place.\n *\n * A `composition` — an order and its lines — where the rows have no life outside\n * the master and go out in the same write\n *. Not\n * a `linkCollection`, which is association to records that exist on their own\n * and save separately; that editor is still #26.\n *\n * ## Why this is not `EntityTable`\n *\n * `EntityTable` is a *server* listing: pages, RSQL filtering and sorting,\n * column personalization, a selection model and a bulk bar. A detail grid has\n * none of those and cannot have them — its rows are local, unsaved, and\n * unqueryable by construction, since a collection member is never `filterable`.\n * Sharing the organism would mean every one of those features growing a\n * \"detail\" branch. It shares the `Table` **atoms** instead, which is the level\n * the two actually have in common.\n *\n * ## Inline cells, and why Enter is free\n *\n * Each cell is a {@link FieldControl}, the same descriptor→input map the form\n * uses, so a child's `enum` gets a select and its `date` a date input with no\n * code here. `Tab` walks the row natively and crosses into the next; `Enter` on\n * the last row appends and focuses the new row's first cell.\n *\n * That last binding is available only because `EntityForm` renders a `<Card>`\n * with a `<button onClick>` Save rather than a `<form>` — inside a real form,\n * `Enter` in a text input submits, and appending a row would fight the browser\n * for it. Wrapping the form in a `<form>` element later would break this, which\n * is the one thing worth knowing before doing it.\n *\n * ## Errors\n *\n * A cell carries `aria-invalid` and points at its own message; the grid carries\n * **one** summary above it, which is the only `role=\"alert\"` in the component.\n * A live region per cell would announce the whole grid on every keystroke, and\n * a message rendered only in the cell is unreachable when the failing row is\n * scrolled out — the case a long grid always meets.\n */\nexport function EntityDetailGrid({\n descriptor,\n rows,\n onRowsChange,\n errors,\n editing = false,\n isLoading = false,\n skeleton = true,\n footer,\n className,\n}: EntityDetailGridProps) {\n const t = useT();\n const gridId = useId();\n\n const described = useMemo(\n () =>\n descriptor.childType === undefined\n ? []\n : editableChildColumns(describeChildColumns(descriptor.childType)),\n [descriptor.childType],\n );\n const columns = useLocalizedDescriptors(described);\n\n // Only the messages that name *this* member. The form hands over its whole\n // error map so a record with two owned collections needs no bookkeeping at\n // the call site, and a grid that filtered nothing would show the other's.\n const rowErrors = useMemo(\n () => readRowErrors(descriptor.name, errors),\n [descriptor.name, errors],\n );\n\n const showSkeleton = isLoading && skeleton !== false;\n const customSkeleton = typeof skeleton === 'boolean' ? undefined : skeleton;\n // One more than the columns: every row carries its remove control.\n const columnCount = columns.length + (editing ? 1 : 0);\n\n const setRow = (index: number, member: string, value: string) => {\n onRowsChange(\n rows.map((row, position) =>\n position === index ? { ...row, [member]: value } : row,\n ),\n );\n };\n\n const firstColumn = columns[0]?.name;\n\n const appendRow = () => {\n onRowsChange([...rows, seedEmptyRow(columns)]);\n focusCell(gridId, rows.length, firstColumn);\n };\n\n const removeRow = (index: number) => {\n onRowsChange(rows.filter((_row, position) => position !== index));\n // Focus the row that slid into this position, or the one above it when the\n // removed row was last — never nothing, which drops the user to the page.\n focusCell(gridId, Math.min(index, rows.length - 2), firstColumn);\n };\n\n /**\n * `Enter` anywhere in the **last row** appends the next one.\n *\n * Bound to the row rather than to its final cell, which is what it looked\n * like it should be: the last *column* is whatever the child declared last,\n * and a read-only member there renders a disabled input that never receives a\n * key at all — so the binding would exist and be unreachable, on exactly the\n * entities that have a computed column. The row is the unit the user is\n * finishing anyway.\n *\n * Only from a text input: a `<select>` opens on Enter and a checkbox toggles\n * on Space, so taking the key from those would break a control's own\n * behaviour to add a row the user did not ask for. A read-only column needs\n * no test of its own — its input is `disabled`, so it never takes focus and\n * never raises a key here at all.\n */\n const onLastRowKeyDown = (event: KeyboardEvent<HTMLTableRowElement>) => {\n if (event.key !== 'Enter') return;\n if (!(event.target instanceof HTMLInputElement)) return;\n event.preventDefault();\n appendRow();\n };\n\n return (\n <Stack gap=\"2xs\" className={className}>\n <div className=\"flex items-center justify-between gap-s\">\n <span className=\"text-step-sm font-medium text-content-muted\">\n {descriptor.label}\n </span>\n {editing && (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n onClick={appendRow}\n disabled={isLoading}\n >\n {t('detail.addRow')}\n </Button>\n )}\n </div>\n\n {editing && rowErrors.size > 0 && (\n <div role=\"alert\" className=\"text-step-sm text-danger\">\n {t('detail.errorSummary', { count: rowErrors.size })}\n </div>\n )}\n\n <Table aria-label={descriptor.label} aria-busy={isLoading || undefined}>\n <TableHead>\n <TableRow>\n {columns.map(column => (\n <TableHeaderCell\n key={column.name}\n id={`${gridId}-${column.name}`}\n >\n {column.label}\n </TableHeaderCell>\n ))}\n {editing && (\n <TableHeaderCell align=\"end\">\n <span className=\"sr-only\">{t('detail.rowActions')}</span>\n </TableHeaderCell>\n )}\n </TableRow>\n </TableHead>\n\n <TableBody>\n {showSkeleton\n ? (customSkeleton ?? (\n <SkeletonRows\n columns={columns.length}\n extra={editing ? 1 : 0}\n />\n ))\n : rows.map((row, index) => (\n <TableRow\n key={row[ROW_KEY]}\n onKeyDown={\n editing && index === rows.length - 1\n ? onLastRowKeyDown\n : undefined\n }\n >\n {columns.map(column => {\n const error = rowErrors.get(\n rowFieldPath(descriptor.name, index, column.name),\n );\n const cellId = `${gridId}-${index}-${column.name}`;\n return (\n <TableCell key={column.name}>\n {editing ? (\n <FieldControl\n descriptor={column}\n value={row[column.name] ?? ''}\n id={cellId}\n aria-labelledby={`${gridId}-${column.name}`}\n aria-invalid={error !== undefined || undefined}\n aria-describedby={\n error === undefined\n ? undefined\n : `${cellId}-error`\n }\n onChange={next => setRow(index, column.name, next)}\n record={row}\n />\n ) : column.money === undefined &&\n column.scaled === undefined ? (\n <span>{row[column.name] ?? ''}</span>\n ) : (\n <CellValue\n value={row[column.name]}\n descriptor={column}\n record={row}\n />\n )}\n {editing && error !== undefined && (\n <span\n id={`${cellId}-error`}\n className=\"mt-3xs block text-step-sm text-danger\"\n >\n {error}\n </span>\n )}\n </TableCell>\n );\n })}\n {editing && (\n <TableCell align=\"end\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => removeRow(index)}\n >\n {t('detail.removeRow', { row: index + 1 })}\n </Button>\n </TableCell>\n )}\n </TableRow>\n ))}\n\n {!showSkeleton && rows.length === 0 && (\n <TableMessageRow colSpan={Math.max(columnCount, 1)}>\n {t('detail.empty')}\n </TableMessageRow>\n )}\n </TableBody>\n </Table>\n\n {footer !== undefined && !showSkeleton && (\n <div className={cn('flex justify-end text-step-sm text-content')}>\n {footer(rows)}\n </div>\n )}\n </Stack>\n );\n}\n\n/** The placeholder, shaped like the grid it stands in for. */\nfunction SkeletonRows({ columns, extra }: { columns: number; extra: number }) {\n return (\n <>\n {Array.from({ length: SKELETON_ROW_COUNT }, (_row, index) => (\n <TableRow key={index}>\n {Array.from({ length: columns + extra }, (_cell, cellIndex) => (\n <TableCell key={cellIndex}>\n <Skeleton className=\"h-8 w-full\" />\n </TableCell>\n ))}\n </TableRow>\n ))}\n </>\n );\n}\n\n/**\n * A blank row, seeded with every column the grid edits.\n *\n * Every member is present and empty rather than absent, for the reason a form's\n * seed carries every key: a control handed `undefined` flips from controlled to\n * uncontrolled the moment the user types into it.\n */\nfunction seedEmptyRow(\n columns: readonly EntityFieldDescriptor[],\n): EntityRowDraft {\n const row: EntityRowDraft = { [ROW_KEY]: newRowKey() };\n for (const column of columns) row[column.name] = '';\n return row;\n}\n\n/**\n * Moves focus into a cell after the list changed.\n *\n * By element id rather than through a ref into the `<tbody>`, because the row\n * being focused does not exist yet when this is called — it is the row the\n * caller has just asked React to render. Deferring to a microtask lets that\n * render commit first; `getElementById` then finds the input the same way the\n * cell's own `aria-describedby` does.\n *\n * A row index that names nothing simply focuses nothing, which is the right\n * outcome for removing the only row: there is no cell to land in, and stealing\n * focus somewhere arbitrary is worse than leaving it where the user put it.\n */\nfunction focusCell(gridId: string, index: number, column?: string): void {\n if (column === undefined || index < 0) return;\n\n queueMicrotask(() => {\n document.getElementById(`${gridId}-${index}-${column}`)?.focus();\n });\n}\n\n/** The messages naming a row of `member`, keyed by their full path. */\nfunction readRowErrors(\n member: string,\n errors: Record<string, string> | undefined,\n): Map<string, string> {\n const found = new Map<string, string>();\n if (errors === undefined) return found;\n\n for (const [path, message] of Object.entries(errors)) {\n if (parseRowFieldPath(path)?.member === member) found.set(path, message);\n }\n return found;\n}\n"],"names":["describeChildColumns","editableChildColumns","newRowKey","parseRowFieldPath","ROW_KEY","rowFieldPath","useId","useMemo","useLocalizedDescriptors","useT","Button","CellValue","FieldControl","Skeleton","Table","TableBody","TableCell","TableHead","TableHeaderCell","TableMessageRow","TableRow","Stack","cn","SKELETON_ROW_COUNT","EntityDetailGrid","descriptor","rows","onRowsChange","errors","editing","isLoading","skeleton","footer","className","columns","t","gridId","described","childType","undefined","rowErrors","readRowErrors","name","showSkeleton","customSkeleton","columnCount","length","setRow","index","member","value","map","row","position","firstColumn","appendRow","seedEmptyRow","focusCell","removeRow","filter","_row","Math","min","onLastRowKeyDown","event","key","target","HTMLInputElement","preventDefault","gap","div","span","label","type","variant","size","onClick","disabled","role","count","aria-label","aria-busy","column","id","align","SkeletonRows","extra","onKeyDown","error","get","cellId","aria-labelledby","aria-invalid","aria-describedby","onChange","next","record","money","scaled","colSpan","max","Array","from","_cell","cellIndex","queueMicrotask","document","getElementById","focus","found","Map","path","message","Object","entries","set"],"mappings":"AAAA;;;AAEA,SACEA,oBAAoB,EACpBC,oBAAoB,EAGpBC,SAAS,EACTC,iBAAiB,EACjBC,OAAO,EACPC,YAAY,QACP,gBAAgB;AACvB,SAA6BC,KAAK,EAAEC,OAAO,QAAQ,QAAQ;AAE3D,SAASC,uBAAuB,EAAEC,IAAI,QAAQ,yBAAyB;AACvE,SAASC,MAAM,QAAQ,8BAA8B;AACrD,SAASC,SAAS,QAAQ,kCAAkC;AAC5D,SAASC,YAAY,QAAQ,qCAAqC;AAClE,SAASC,QAAQ,QAAQ,gCAAgC;AACzD,SACEC,KAAK,EACLC,SAAS,EACTC,SAAS,EACTC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,QAAQ,QACH,6BAA6B;AACpC,SAASC,KAAK,QAAQ,iCAAiC;AACvD,SAASC,EAAE,QAAQ,oBAAoB;AAGvC,8EAA8E,GAC9E,MAAMC,qBAAqB;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCC,GACD,OAAO,SAASC,iBAAiB,EAC/BC,UAAU,EACVC,IAAI,EACJC,YAAY,EACZC,MAAM,EACNC,UAAU,KAAK,EACfC,YAAY,KAAK,EACjBC,WAAW,IAAI,EACfC,MAAM,EACNC,SAAS,EACa;QAkCFC;IAjCpB,MAAMC,IAAI1B;IACV,MAAM2B,SAAS9B;IAEf,MAAM+B,YAAY9B,QAChB,IACEkB,WAAWa,SAAS,KAAKC,YACrB,EAAE,GACFtC,qBAAqBD,qBAAqByB,WAAWa,SAAS,IACpE;QAACb,WAAWa,SAAS;KAAC;IAExB,MAAMJ,UAAU1B,wBAAwB6B;IAExC,2EAA2E;IA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;0BACEiF,MAAMC,IAAI,CAAC;oBAAExD,QAAQZ,UAAUoD;gBAAM,GAAG,CAACiB,OAAOC,0BAC/C,KAACxF;kCACC,cAAA,KAACH;4BAASoB,WAAU;;uBADNuE;eAFLxD;;AAUvB;AAEA;;;;;;CAMC,GACD,SAASQ,aACPtB,OAAyC;IAEzC,MAAMkB,MAAsB;QAAE,CAAChD,QAAQ,EAAEF;IAAY;IACrD,KAAK,MAAMgF,UAAUhD,QAASkB,GAAG,CAAC8B,OAAOxC,IAAI,CAAC,GAAG;IACjD,OAAOU;AACT;AAEA;;;;;;;;;;;;CAYC,GACD,SAASK,UAAUrB,MAAc,EAAEY,KAAa,EAAEkC,MAAe;IAC/D,IAAIA,WAAW3C,aAAaS,QAAQ,GAAG;IAEvCyD,eAAe;YACbC;SAAAA,2BAAAA,SAASC,cAAc,CAAC,GAAGvE,OAAO,CAAC,EAAEY,MAAM,CAAC,EAAEkC,QAAQ,sBAAtDwB,yBAAyDE,KAAK;IAChE;AACF;AAEA,qEAAqE,GACrE,SAASnE,cACPQ,MAAc,EACdrB,MAA0C;IAE1C,MAAMiF,QAAQ,IAAIC;IAClB,IAAIlF,WAAWW,WAAW,OAAOsE;IAEjC,KAAK,MAAM,CAACE,MAAMC,QAAQ,IAAIC,OAAOC,OAAO,CAACtF,QAAS;YAChDzB;QAAJ,IAAIA,EAAAA,qBAAAA,kBAAkB4G,0BAAlB5G,mBAAyB8C,MAAM,MAAKA,QAAQ4D,MAAMM,GAAG,CAACJ,MAAMC;IAClE;IACA,OAAOH;AACT"}
1
+ {"version":3,"sources":["../../../../src/ui/organisms/entity-detail-grid/entity-detail-grid.tsx"],"sourcesContent":["'use client';\n\nimport {\n describeChildColumns,\n editableChildColumns,\n type EntityFieldDescriptor,\n type EntityRowDraft,\n newRowKey,\n parseRowFieldPath,\n ROW_KEY,\n rowFieldPath,\n} from '@entifix/core';\nimport { type KeyboardEvent, useId, useMemo } from 'react';\n\nimport { useLocalizedDescriptors, useT } from '../../../i18n/index.js';\nimport { Button } from '../../atoms/button/index.js';\nimport { CellValue } from '../../atoms/cell-value/index.js';\nimport { FieldControl } from '../../atoms/field-control/index.js';\nimport { Skeleton } from '../../atoms/skeleton/index.js';\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeaderCell,\n TableMessageRow,\n TableRow,\n} from '../../atoms/table/index.js';\nimport { Stack } from '../../molecules/stack/index.js';\nimport { cn } from '../../utils/cn.js';\nimport type { EntityDetailGridProps } from './entity-detail-grid.types.js';\n\n/** Rows the placeholder stands in for. Enough to read as a grid, not a page. */\nconst SKELETON_ROW_COUNT = 3;\n\n/**\n * The rows a record **owns**, edited in place.\n *\n * A `composition` — an order and its lines — where the rows have no life outside\n * the master and go out in the same write\n *. Not\n * a `linkCollection`, which is association to records that exist on their own\n * and save separately; that editor is still #26.\n *\n * ## Why this is not `EntityTable`\n *\n * `EntityTable` is a *server* listing: pages, RSQL filtering and sorting,\n * column personalization, a selection model and a bulk bar. A detail grid has\n * none of those and cannot have them — its rows are local, unsaved, and\n * unqueryable by construction, since a collection member is never `filterable`.\n * Sharing the organism would mean every one of those features growing a\n * \"detail\" branch. It shares the `Table` **atoms** instead, which is the level\n * the two actually have in common.\n *\n * ## Inline cells, and why Enter is free\n *\n * Each cell is a {@link FieldControl}, the same descriptor→input map the form\n * uses, so a child's `enum` gets a select and its `date` a date input with no\n * code here. `Tab` walks the row natively and crosses into the next; `Enter` on\n * the last row appends and focuses the new row's first cell.\n *\n * That last binding is available only because `EntityForm` renders a `<Card>`\n * with a `<button onClick>` Save rather than a `<form>` — inside a real form,\n * `Enter` in a text input submits, and appending a row would fight the browser\n * for it. Wrapping the form in a `<form>` element later would break this, which\n * is the one thing worth knowing before doing it.\n *\n * ## Errors\n *\n * A cell carries `aria-invalid` and points at its own message; the grid carries\n * **one** summary above it, which is the only `role=\"alert\"` in the component.\n * A live region per cell would announce the whole grid on every keystroke, and\n * a message rendered only in the cell is unreachable when the failing row is\n * scrolled out — the case a long grid always meets.\n */\nexport function EntityDetailGrid({\n descriptor,\n rows,\n onRowsChange,\n errors,\n editing = false,\n isLoading = false,\n skeleton = true,\n footer,\n className,\n}: EntityDetailGridProps) {\n const t = useT();\n const gridId = useId();\n\n const described = useMemo(\n () =>\n descriptor.childType === undefined\n ? []\n : // A member declared `display: 'none'` stays in the row's draft — the\n // grid never drops a key it was handed — and gets no column.\n editableChildColumns(\n describeChildColumns(descriptor.childType),\n ).filter(column => column.presentation !== 'none'),\n [descriptor.childType],\n );\n const columns = useLocalizedDescriptors(described);\n\n // Only the messages that name *this* member. The form hands over its whole\n // error map so a record with two owned collections needs no bookkeeping at\n // the call site, and a grid that filtered nothing would show the other's.\n const rowErrors = useMemo(\n () => readRowErrors(descriptor.name, errors),\n [descriptor.name, errors],\n );\n\n const showSkeleton = isLoading && skeleton !== false;\n const customSkeleton = typeof skeleton === 'boolean' ? undefined : skeleton;\n // One more than the columns: every row carries its remove control.\n const columnCount = columns.length + (editing ? 1 : 0);\n\n const setRow = (index: number, member: string, value: string) => {\n onRowsChange(\n rows.map((row, position) =>\n position === index ? { ...row, [member]: value } : row,\n ),\n );\n };\n\n const firstColumn = columns[0]?.name;\n\n const appendRow = () => {\n onRowsChange([...rows, seedEmptyRow(columns)]);\n focusCell(gridId, rows.length, firstColumn);\n };\n\n const removeRow = (index: number) => {\n onRowsChange(rows.filter((_row, position) => position !== index));\n // Focus the row that slid into this position, or the one above it when the\n // removed row was last — never nothing, which drops the user to the page.\n focusCell(gridId, Math.min(index, rows.length - 2), firstColumn);\n };\n\n /**\n * `Enter` anywhere in the **last row** appends the next one.\n *\n * Bound to the row rather than to its final cell, which is what it looked\n * like it should be: the last *column* is whatever the child declared last,\n * and a read-only member there renders a disabled input that never receives a\n * key at all — so the binding would exist and be unreachable, on exactly the\n * entities that have a computed column. The row is the unit the user is\n * finishing anyway.\n *\n * Only from a text input: a `<select>` opens on Enter and a checkbox toggles\n * on Space, so taking the key from those would break a control's own\n * behaviour to add a row the user did not ask for. A read-only column needs\n * no test of its own — its input is `disabled`, so it never takes focus and\n * never raises a key here at all.\n */\n const onLastRowKeyDown = (event: KeyboardEvent<HTMLTableRowElement>) => {\n if (event.key !== 'Enter') return;\n if (!(event.target instanceof HTMLInputElement)) return;\n event.preventDefault();\n appendRow();\n };\n\n return (\n <Stack gap=\"2xs\" className={className}>\n <div className=\"flex items-center justify-between gap-s\">\n <span className=\"text-step-sm font-medium text-content-muted\">\n {descriptor.label}\n </span>\n {editing && (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n onClick={appendRow}\n disabled={isLoading}\n >\n {t('detail.addRow')}\n </Button>\n )}\n </div>\n\n {editing && rowErrors.size > 0 && (\n <div role=\"alert\" className=\"text-step-sm text-danger\">\n {t('detail.errorSummary', { count: rowErrors.size })}\n </div>\n )}\n\n <Table aria-label={descriptor.label} aria-busy={isLoading || undefined}>\n <TableHead>\n <TableRow>\n {columns.map(column => (\n <TableHeaderCell\n key={column.name}\n id={`${gridId}-${column.name}`}\n >\n {column.label}\n </TableHeaderCell>\n ))}\n {editing && (\n <TableHeaderCell align=\"end\">\n <span className=\"sr-only\">{t('detail.rowActions')}</span>\n </TableHeaderCell>\n )}\n </TableRow>\n </TableHead>\n\n <TableBody>\n {showSkeleton\n ? (customSkeleton ?? (\n <SkeletonRows\n columns={columns.length}\n extra={editing ? 1 : 0}\n />\n ))\n : rows.map((row, index) => (\n <TableRow\n key={row[ROW_KEY]}\n onKeyDown={\n editing && index === rows.length - 1\n ? onLastRowKeyDown\n : undefined\n }\n >\n {columns.map(column => {\n const error = rowErrors.get(\n rowFieldPath(descriptor.name, index, column.name),\n );\n const cellId = `${gridId}-${index}-${column.name}`;\n return (\n <TableCell key={column.name}>\n {editing ? (\n <FieldControl\n descriptor={column}\n value={row[column.name] ?? ''}\n id={cellId}\n aria-labelledby={`${gridId}-${column.name}`}\n aria-invalid={error !== undefined || undefined}\n aria-describedby={\n error === undefined\n ? undefined\n : `${cellId}-error`\n }\n onChange={next => setRow(index, column.name, next)}\n record={row}\n />\n ) : column.money === undefined &&\n column.scaled === undefined ? (\n <span>{row[column.name] ?? ''}</span>\n ) : (\n <CellValue\n value={row[column.name]}\n descriptor={column}\n record={row}\n />\n )}\n {editing && error !== undefined && (\n <span\n id={`${cellId}-error`}\n className=\"mt-3xs block text-step-sm text-danger\"\n >\n {error}\n </span>\n )}\n </TableCell>\n );\n })}\n {editing && (\n <TableCell align=\"end\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => removeRow(index)}\n >\n {t('detail.removeRow', { row: index + 1 })}\n </Button>\n </TableCell>\n )}\n </TableRow>\n ))}\n\n {!showSkeleton && rows.length === 0 && (\n <TableMessageRow colSpan={Math.max(columnCount, 1)}>\n {t('detail.empty')}\n </TableMessageRow>\n )}\n </TableBody>\n </Table>\n\n {footer !== undefined && !showSkeleton && (\n <div className={cn('flex justify-end text-step-sm text-content')}>\n {footer(rows)}\n </div>\n )}\n </Stack>\n );\n}\n\n/** The placeholder, shaped like the grid it stands in for. */\nfunction SkeletonRows({ columns, extra }: { columns: number; extra: number }) {\n return (\n <>\n {Array.from({ length: SKELETON_ROW_COUNT }, (_row, index) => (\n <TableRow key={index}>\n {Array.from({ length: columns + extra }, (_cell, cellIndex) => (\n <TableCell key={cellIndex}>\n <Skeleton className=\"h-8 w-full\" />\n </TableCell>\n ))}\n </TableRow>\n ))}\n </>\n );\n}\n\n/**\n * A blank row, seeded with every column the grid edits.\n *\n * Every member is present and empty rather than absent, for the reason a form's\n * seed carries every key: a control handed `undefined` flips from controlled to\n * uncontrolled the moment the user types into it.\n */\nfunction seedEmptyRow(\n columns: readonly EntityFieldDescriptor[],\n): EntityRowDraft {\n const row: EntityRowDraft = { [ROW_KEY]: newRowKey() };\n for (const column of columns) row[column.name] = '';\n return row;\n}\n\n/**\n * Moves focus into a cell after the list changed.\n *\n * By element id rather than through a ref into the `<tbody>`, because the row\n * being focused does not exist yet when this is called — it is the row the\n * caller has just asked React to render. Deferring to a microtask lets that\n * render commit first; `getElementById` then finds the input the same way the\n * cell's own `aria-describedby` does.\n *\n * A row index that names nothing simply focuses nothing, which is the right\n * outcome for removing the only row: there is no cell to land in, and stealing\n * focus somewhere arbitrary is worse than leaving it where the user put it.\n */\nfunction focusCell(gridId: string, index: number, column?: string): void {\n if (column === undefined || index < 0) return;\n\n queueMicrotask(() => {\n document.getElementById(`${gridId}-${index}-${column}`)?.focus();\n });\n}\n\n/** The messages naming a row of `member`, keyed by their full path. */\nfunction readRowErrors(\n member: string,\n errors: Record<string, string> | undefined,\n): Map<string, string> {\n const found = new Map<string, string>();\n if (errors === undefined) return found;\n\n for (const [path, message] of Object.entries(errors)) {\n if (parseRowFieldPath(path)?.member === member) found.set(path, message);\n }\n return found;\n}\n"],"names":["describeChildColumns","editableChildColumns","newRowKey","parseRowFieldPath","ROW_KEY","rowFieldPath","useId","useMemo","useLocalizedDescriptors","useT","Button","CellValue","FieldControl","Skeleton","Table","TableBody","TableCell","TableHead","TableHeaderCell","TableMessageRow","TableRow","Stack","cn","SKELETON_ROW_COUNT","EntityDetailGrid","descriptor","rows","onRowsChange","errors","editing","isLoading","skeleton","footer","className","columns","t","gridId","described","childType","undefined","filter","column","presentation","rowErrors","readRowErrors","name","showSkeleton","customSkeleton","columnCount","length","setRow","index","member","value","map","row","position","firstColumn","appendRow","seedEmptyRow","focusCell","removeRow","_row","Math","min","onLastRowKeyDown","event","key","target","HTMLInputElement","preventDefault","gap","div","span","label","type","variant","size","onClick","disabled","role","count","aria-label","aria-busy","id","align","SkeletonRows","extra","onKeyDown","error","get","cellId","aria-labelledby","aria-invalid","aria-describedby","onChange","next","record","money","scaled","colSpan","max","Array","from","_cell","cellIndex","queueMicrotask","document","getElementById","focus","found","Map","path","message","Object","entries","set"],"mappings":"AAAA;;;AAEA,SACEA,oBAAoB,EACpBC,oBAAoB,EAGpBC,SAAS,EACTC,iBAAiB,EACjBC,OAAO,EACPC,YAAY,QACP,gBAAgB;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KAAK,MAAMuC,UAAUP,QAASqB,GAAG,CAACd,OAAOI,IAAI,CAAC,GAAG;IACjD,OAAOU;AACT;AAEA;;;;;;;;;;;;CAYC,GACD,SAASK,UAAUxB,MAAc,EAAEe,KAAa,EAAEV,MAAe;IAC/D,IAAIA,WAAWF,aAAaY,QAAQ,GAAG;IAEvCuD,eAAe;YACbC;SAAAA,2BAAAA,SAASC,cAAc,CAAC,GAAGxE,OAAO,CAAC,EAAEe,MAAM,CAAC,EAAEV,QAAQ,sBAAtDkE,yBAAyDE,KAAK;IAChE;AACF;AAEA,qEAAqE,GACrE,SAASjE,cACPQ,MAAc,EACdxB,MAA0C;IAE1C,MAAMkF,QAAQ,IAAIC;IAClB,IAAInF,WAAWW,WAAW,OAAOuE;IAEjC,KAAK,MAAM,CAACE,MAAMC,QAAQ,IAAIC,OAAOC,OAAO,CAACvF,QAAS;YAChDzB;QAAJ,IAAIA,EAAAA,qBAAAA,kBAAkB6G,0BAAlB7G,mBAAyBiD,MAAM,MAAKA,QAAQ0D,MAAMM,GAAG,CAACJ,MAAMC;IAClE;IACA,OAAOH;AACT"}
@@ -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,EAcZ,MAAM,eAAe,CAAC;AAwCvB,OAAO,KAAK,EAGV,eAAe,EAChB,MAAM,wBAAwB,CAAC;AA+DhC,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,UAAU,EACV,aAAa,EACb,QAAQ,EACR,UAAyB,EACzB,KAAK,EACL,QAAQ,EACR,iBAAyB,EACzB,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,GACT,EAAE,eAAe,CAAC,OAAO,CAAC,+BA0jB1B"}
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,EAcZ,MAAM,eAAe,CAAC;AAwCvB,OAAO,KAAK,EAGV,eAAe,EAChB,MAAM,wBAAwB,CAAC;AA+DhC,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,UAAU,EACV,aAAa,EACb,QAAQ,EACR,UAAyB,EACzB,KAAK,EACL,QAAQ,EACR,iBAAyB,EACzB,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,GACT,EAAE,eAAe,CAAC,OAAO,CAAC,+BAukB1B"}
@@ -306,7 +306,11 @@ export function EntityForm({ entityConstructor, entity, values, onFieldChange, l
306
306
  // A real form while editing, so Enter in a field saves; an embedded one
307
307
  // belongs to its host's flow, and a caller who may not write has no Save.
308
308
  const asForm = editing && !embedded && may('write');
309
- const rows = fields.map((field)=>/*#__PURE__*/ _jsx(FieldRow, {
309
+ // A member drawn only once set is left out of a record being read while it
310
+ // is empty: an order awaiting payment is not thirty dashes. A custom read
311
+ // display decides for itself.
312
+ const shown = editing ? fields : fields.filter((field)=>field.presentation !== 'whenSet' || field.readRender !== undefined || !isUnset(entity == null ? void 0 : entity[field.name]));
313
+ const rows = shown.map((field)=>/*#__PURE__*/ _jsx(FieldRow, {
310
314
  field: field,
311
315
  entity: entity,
312
316
  draft: draft,
@@ -521,6 +525,9 @@ export function EntityForm({ entityConstructor, entity, values, onFieldChange, l
521
525
  ]
522
526
  });
523
527
  }
528
+ /** Nothing to read: no value, an empty text, or an empty collection. */ function isUnset(value) {
529
+ return value === undefined || value === null || value === '' || Array.isArray(value) && value.length === 0;
530
+ }
524
531
  /**
525
532
  * A member the detail grid renders rather than the field stack.
526
533
  *