@burojs/ui-shadcn 0.8.0 → 0.9.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.
Files changed (115) hide show
  1. package/dist/{candidates-relation-picker-CGXItMN0.js → candidates-relation-picker-QvoY2bOQ.js} +3 -3
  2. package/dist/{candidates-relation-picker-CGXItMN0.js.map → candidates-relation-picker-QvoY2bOQ.js.map} +1 -1
  3. package/dist/{candidates-relation-picker-C47mF260.cjs → candidates-relation-picker-pEAWKQEY.cjs} +3 -3
  4. package/dist/{candidates-relation-picker-C47mF260.cjs.map → candidates-relation-picker-pEAWKQEY.cjs.map} +1 -1
  5. package/dist/{check-confirm-dialog-CtiRzOAt.js → check-confirm-dialog-B-CbJTln.js} +59 -6
  6. package/dist/{check-confirm-dialog-CtiRzOAt.js.map → check-confirm-dialog-B-CbJTln.js.map} +1 -1
  7. package/dist/{check-confirm-dialog-BT04Mieo.cjs → check-confirm-dialog-W-8WOmGh.cjs} +64 -5
  8. package/dist/{check-confirm-dialog-BT04Mieo.cjs.map → check-confirm-dialog-W-8WOmGh.cjs.map} +1 -1
  9. package/dist/{filter-builder-z3Axzf9Y.js → filter-builder-04nas3eq.js} +14 -6
  10. package/dist/filter-builder-04nas3eq.js.map +1 -0
  11. package/dist/{filter-builder-ByGhxLf_.cjs → filter-builder-DQX-TMFh.cjs} +14 -6
  12. package/dist/filter-builder-DQX-TMFh.cjs.map +1 -0
  13. package/dist/{flow-runtime-DrUWyTS0.js → flow-runtime-BEIyym7d.js} +3 -3
  14. package/dist/{flow-runtime-DrUWyTS0.js.map → flow-runtime-BEIyym7d.js.map} +1 -1
  15. package/dist/{flow-runtime-BVFjMU5-.cjs → flow-runtime-DyNIYfUP.cjs} +3 -3
  16. package/dist/{flow-runtime-BVFjMU5-.cjs.map → flow-runtime-DyNIYfUP.cjs.map} +1 -1
  17. package/dist/{flow-screen-3fk6J33y.js → flow-screen-DY1Z9PbG.js} +53 -14
  18. package/dist/flow-screen-DY1Z9PbG.js.map +1 -0
  19. package/dist/{flow-screen-6y5E_HT6.cjs → flow-screen-FE5Xhb3t.cjs} +52 -13
  20. package/dist/flow-screen-FE5Xhb3t.cjs.map +1 -0
  21. package/dist/index.cjs +54 -71
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +49 -10
  24. package/dist/index.d.ts +49 -10
  25. package/dist/index.js +54 -72
  26. package/dist/index.js.map +1 -1
  27. package/dist/{inline-flow-host-YnnvWjdU.js → inline-flow-host-D6u-RlsV.js} +3 -3
  28. package/dist/{inline-flow-host-YnnvWjdU.js.map → inline-flow-host-D6u-RlsV.js.map} +1 -1
  29. package/dist/{inline-flow-host-C4KmZIYE.cjs → inline-flow-host-yVLo6-sM.cjs} +3 -3
  30. package/dist/{inline-flow-host-C4KmZIYE.cjs.map → inline-flow-host-yVLo6-sM.cjs.map} +1 -1
  31. package/dist/{lazy-relation-picker-dialog-DN4bvQfg.js → lazy-relation-picker-dialog-BaORufxQ.js} +2 -2
  32. package/dist/{lazy-relation-picker-dialog-DN4bvQfg.js.map → lazy-relation-picker-dialog-BaORufxQ.js.map} +1 -1
  33. package/dist/{lazy-relation-picker-dialog-BAKBRn3V.cjs → lazy-relation-picker-dialog-C_VlGlDz.cjs} +2 -2
  34. package/dist/{lazy-relation-picker-dialog-BAKBRn3V.cjs.map → lazy-relation-picker-dialog-C_VlGlDz.cjs.map} +1 -1
  35. package/dist/{page-flow-route-CtEfqAvU.js → page-flow-route-CyMzUidK.js} +7 -7
  36. package/dist/page-flow-route-CyMzUidK.js.map +1 -0
  37. package/dist/{page-flow-route-DEjAxHe3.cjs → page-flow-route-OFx7h7Ja.cjs} +6 -6
  38. package/dist/page-flow-route-OFx7h7Ja.cjs.map +1 -0
  39. package/dist/{place-node-Bhl8B3fF.cjs → place-node-BZF5Af6x.cjs} +67 -23
  40. package/dist/place-node-BZF5Af6x.cjs.map +1 -0
  41. package/dist/{place-node-BdxT-30h.js → place-node-DRjmJGQ_.js} +69 -25
  42. package/dist/place-node-DRjmJGQ_.js.map +1 -0
  43. package/dist/{related-list-cards-BvkD5OcC.js → related-list-cards-2hLitVkg.js} +3 -3
  44. package/dist/{related-list-cards-BvkD5OcC.js.map → related-list-cards-2hLitVkg.js.map} +1 -1
  45. package/dist/{related-list-cards-Bc_vfCE_.cjs → related-list-cards-xVvgSlu-.cjs} +3 -3
  46. package/dist/{related-list-cards-Bc_vfCE_.cjs.map → related-list-cards-xVvgSlu-.cjs.map} +1 -1
  47. package/dist/{related-list-timeline-DCrwN9oO.js → related-list-timeline-CxJqe6eK.js} +4 -4
  48. package/dist/related-list-timeline-CxJqe6eK.js.map +1 -0
  49. package/dist/{related-list-timeline-k0DtnxTs.cjs → related-list-timeline-Dsf5WewG.cjs} +4 -4
  50. package/dist/related-list-timeline-Dsf5WewG.cjs.map +1 -0
  51. package/dist/{related-rows-BW9Jr07T.cjs → related-rows-DDhp9axl.cjs} +4 -4
  52. package/dist/{related-rows-BW9Jr07T.cjs.map → related-rows-DDhp9axl.cjs.map} +1 -1
  53. package/dist/{related-rows-CPE-9FFr.js → related-rows-DL6CWsrj.js} +4 -4
  54. package/dist/{related-rows-CPE-9FFr.js.map → related-rows-DL6CWsrj.js.map} +1 -1
  55. package/dist/{relation-create-C43cdPQt.js → relation-create-6WicROWA.js} +33 -5
  56. package/dist/relation-create-6WicROWA.js.map +1 -0
  57. package/dist/{relation-create-DDEYcKfw.cjs → relation-create-_SFuPQGM.cjs} +37 -3
  58. package/dist/relation-create-_SFuPQGM.cjs.map +1 -0
  59. package/dist/{relation-many-picker-Br-zBHxT.cjs → relation-many-picker-BBNsmkaX.cjs} +12 -10
  60. package/dist/relation-many-picker-BBNsmkaX.cjs.map +1 -0
  61. package/dist/{relation-many-picker-BlrGRwMV.js → relation-many-picker-mGEQDWo2.js} +12 -10
  62. package/dist/relation-many-picker-mGEQDWo2.js.map +1 -0
  63. package/dist/{relation-picker-x7P5HKie.js → relation-picker-BbO41cFV.js} +13 -10
  64. package/dist/relation-picker-BbO41cFV.js.map +1 -0
  65. package/dist/{relation-picker-dialog-CyKliBkN.js → relation-picker-dialog-BgSG_8bU.js} +5 -5
  66. package/dist/relation-picker-dialog-BgSG_8bU.js.map +1 -0
  67. package/dist/{relation-picker-dialog-DimVQF9Y.cjs → relation-picker-dialog-Duqy2r0n.cjs} +5 -5
  68. package/dist/relation-picker-dialog-Duqy2r0n.cjs.map +1 -0
  69. package/dist/{relation-picker-ADjxI_TI.cjs → relation-picker-jk9D_uwn.cjs} +13 -10
  70. package/dist/relation-picker-jk9D_uwn.cjs.map +1 -0
  71. package/dist/{relation-select-Cr3CfNLy.cjs → relation-select-C3aV18kT.cjs} +2 -2
  72. package/dist/{relation-select-Cr3CfNLy.cjs.map → relation-select-C3aV18kT.cjs.map} +1 -1
  73. package/dist/{relation-select-B8Fq4o-t.js → relation-select-CjQT9LpS.js} +2 -2
  74. package/dist/{relation-select-B8Fq4o-t.js.map → relation-select-CjQT9LpS.js.map} +1 -1
  75. package/dist/{resource-page-router-BRpUnhay.js → resource-page-router-CzaNATSp.js} +71 -19
  76. package/dist/resource-page-router-CzaNATSp.js.map +1 -0
  77. package/dist/{resource-page-router-qEd2xb55.cjs → resource-page-router-dmVIeu5s.cjs} +81 -17
  78. package/dist/resource-page-router-dmVIeu5s.cjs.map +1 -0
  79. package/dist/{success-notices-Dl3M1fZP.cjs → success-notices-Cl4b6MLQ.cjs} +3 -2
  80. package/dist/success-notices-Cl4b6MLQ.cjs.map +1 -0
  81. package/dist/{success-notices-LDEgEkc4.js → success-notices-CrcWOGSo.js} +3 -2
  82. package/dist/success-notices-CrcWOGSo.js.map +1 -0
  83. package/dist/{use-dialog-filter-state-B_MqzHaT.js → use-dialog-filter-state-CJoeY-1j.js} +2 -2
  84. package/dist/{use-dialog-filter-state-B_MqzHaT.js.map → use-dialog-filter-state-CJoeY-1j.js.map} +1 -1
  85. package/dist/{use-dialog-filter-state-tNvqAAjh.cjs → use-dialog-filter-state-lsTJxrB4.cjs} +2 -2
  86. package/dist/{use-dialog-filter-state-tNvqAAjh.cjs.map → use-dialog-filter-state-lsTJxrB4.cjs.map} +1 -1
  87. package/dist/{use-record-subtitle-bfwIoUme.cjs → use-record-subtitle-BJ9rnj6F.cjs} +5 -8
  88. package/dist/use-record-subtitle-BJ9rnj6F.cjs.map +1 -0
  89. package/dist/{use-record-subtitle-gIaCGgbI.js → use-record-subtitle-w3ZhXNlf.js} +5 -8
  90. package/dist/use-record-subtitle-w3ZhXNlf.js.map +1 -0
  91. package/package.json +9 -9
  92. package/dist/filter-builder-ByGhxLf_.cjs.map +0 -1
  93. package/dist/filter-builder-z3Axzf9Y.js.map +0 -1
  94. package/dist/flow-screen-3fk6J33y.js.map +0 -1
  95. package/dist/flow-screen-6y5E_HT6.cjs.map +0 -1
  96. package/dist/page-flow-route-CtEfqAvU.js.map +0 -1
  97. package/dist/page-flow-route-DEjAxHe3.cjs.map +0 -1
  98. package/dist/place-node-BdxT-30h.js.map +0 -1
  99. package/dist/place-node-Bhl8B3fF.cjs.map +0 -1
  100. package/dist/related-list-timeline-DCrwN9oO.js.map +0 -1
  101. package/dist/related-list-timeline-k0DtnxTs.cjs.map +0 -1
  102. package/dist/relation-create-C43cdPQt.js.map +0 -1
  103. package/dist/relation-create-DDEYcKfw.cjs.map +0 -1
  104. package/dist/relation-many-picker-BlrGRwMV.js.map +0 -1
  105. package/dist/relation-many-picker-Br-zBHxT.cjs.map +0 -1
  106. package/dist/relation-picker-ADjxI_TI.cjs.map +0 -1
  107. package/dist/relation-picker-dialog-CyKliBkN.js.map +0 -1
  108. package/dist/relation-picker-dialog-DimVQF9Y.cjs.map +0 -1
  109. package/dist/relation-picker-x7P5HKie.js.map +0 -1
  110. package/dist/resource-page-router-BRpUnhay.js.map +0 -1
  111. package/dist/resource-page-router-qEd2xb55.cjs.map +0 -1
  112. package/dist/success-notices-Dl3M1fZP.cjs.map +0 -1
  113. package/dist/success-notices-LDEgEkc4.js.map +0 -1
  114. package/dist/use-record-subtitle-bfwIoUme.cjs.map +0 -1
  115. package/dist/use-record-subtitle-gIaCGgbI.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { a as namesHiddenField, o as narrowSearchDecl } from "./relation-create-C43cdPQt.js";
1
+ import { a as namesHiddenField, o as narrowSearchDecl } from "./relation-create-6WicROWA.js";
2
2
  import { EMPTY_FILTER_GROUP, composeListFilter, routeResourceKey } from "@burojs/core";
3
3
  import { useApp, useFilterFields, useListAccess } from "@burojs/react";
4
4
  import { useCallback, useMemo, useState } from "react";
@@ -85,4 +85,4 @@ function useDialogFilterState(resourceInput, options) {
85
85
  //#endregion
86
86
  export { useDialogFilterState as t };
87
87
 
88
- //# sourceMappingURL=use-dialog-filter-state-B_MqzHaT.js.map
88
+ //# sourceMappingURL=use-dialog-filter-state-CJoeY-1j.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-dialog-filter-state-B_MqzHaT.js","names":[],"sources":["../src/fields/use-dialog-filter-state.ts"],"sourcesContent":["import {\n EMPTY_FILTER_GROUP,\n composeListFilter,\n type ErasedResourceHandle,\n type FilterExpression,\n type FilterGroup,\n type FixedFilterInput,\n type ResolvedFixedFilter,\n type SearchDecl,\n routeResourceKey,\n type ResourceNameOrRef,\n} from '@burojs/core';\nimport { useApp, useFilterFields, useListAccess, type FilterFieldSpec } from '@burojs/react';\nimport { namesHiddenField, narrowSearchDecl } from './search-access.js';\nimport { useCallback, useMemo, useState } from 'react';\n\n/** The portable erased AST — the only shape this module deals in. */\ntype ErasedExpression = FilterExpression<ErasedResourceHandle>;\n\n/** Options for {@link useDialogFilterState}. */\nexport interface UseDialogFilterStateOptions {\n /** Call-site narrowing (e.g. scope the target list to a product group). */\n readonly fixedFilters?: readonly FixedFilterInput[];\n /**\n * Fallback search field, used ONLY when the target resource declares no\n * `views.list.search`. Wrapped into a single-field `SearchFieldsDecl`\n * (`{ fields: [searchField] }`, implicit `contains` — same degenerate form\n * `searchToFilter` already gives a bare field-name string) so the override\n * goes through the exact same `composeListFilter` → `searchToFilter` path\n * as a real declaration, rather than a second hand-built predicate at the\n * call site. The target's own declaration always wins when present — this\n * is a fallback, not an override of a declared search.\n */\n readonly searchField?: string;\n /**\n * Gates the field-derivation walk (`useFilterFields`'s `categorizeField`\n * pass over every field of the resource). Defaults to `true`. A caller\n * whose UI isn't visible yet (e.g. `RelationPickerDialog` before it's\n * opened) should pass `false` to skip that work on every mount /\n * `fixedFilters`-identity change; the derivation recomputes in full the\n * next render where this flips back to `true`.\n */\n readonly enabled?: boolean;\n}\n\n/** Return shape of {@link useDialogFilterState}. */\nexport interface DialogFilterState {\n readonly group: FilterGroup;\n readonly setGroup: (next: FilterGroup) => void;\n readonly search: string;\n readonly setSearch: (next: string) => void;\n readonly page: number;\n readonly setPage: (page: number) => void;\n readonly available: readonly FilterFieldSpec[];\n readonly fixed: readonly ResolvedFixedFilter[];\n /** The single expression to hand the data provider. */\n readonly filter: ErasedExpression | undefined;\n /** Whether the target has a search for this user (no field left means no search box). */\n readonly searchEnabled: boolean;\n /** The read must not be sent: undecided access, or a filter naming a field the user may not view. */\n readonly blocked: boolean;\n readonly reset: () => void;\n}\n\n/**\n * Local (non-URL) filter state for the relation-picker's advanced-search\n * dialog.\n *\n * `useResourceList` cannot serve this: it unconditionally calls\n * `useResourceUrlState`, which throws without a `RouterAdapterProvider` and,\n * when one IS present, writes to `?<resource>.*`. A picker dialog mounted\n * inside a form for resource A, searching TARGET resource B, would then\n * write B's list state into the URL — clobbering a real B list page open on\n * another tab of the same app, and reading back whatever that page last\n * wrote on open. So this hook keeps `group`/`search`/`page` in plain\n * `useState` and reuses the SAME composition core's list controller uses\n * (`composeListFilter`) so the two never drift on what a filter means.\n *\n * No `pinned` slot: pinned controls are a list-PAGE affordance (permanent\n * screen real estate for a couple of always-visible facets); a modal has no\n * spare real estate to spend on them.\n */\nexport function useDialogFilterState<const N extends string = string>(\n resourceInput: ResourceNameOrRef<N>,\n options: UseDialogFilterStateOptions,\n): DialogFilterState {\n const resource = routeResourceKey(resourceInput);\n const app = useApp();\n const def = app.registry.get(resource);\n const { available, fixed } = useFilterFields(resource, {\n fixedFilters: options.fixedFilters,\n enabled: options.enabled,\n });\n\n const [group, setGroupState] = useState<FilterGroup>(EMPTY_FILTER_GROUP);\n const [search, setSearchState] = useState('');\n const [page, setPage] = useState(1);\n\n // Any change to WHAT is filtered invalidates the current page — the same\n // rule `useResourceList`'s URL-state controller applies to its own\n // group/search setters.\n const setGroup = useCallback((next: FilterGroup) => {\n setGroupState(next);\n setPage(1);\n }, []);\n\n const setSearch = useCallback((next: string) => {\n setSearchState(next);\n setPage(1);\n }, []);\n\n const reset = useCallback(() => {\n setGroupState(EMPTY_FILTER_GROUP);\n setSearchState('');\n setPage(1);\n }, []);\n\n // The target's own declaration always wins; `options.searchField` only\n // fills in when the target declares no search at all. Memoized so an\n // omitted declaration doesn't hand `composeListFilter`'s `filter` memo a\n // fresh `{ fields: [...] }` literal (and therefore a spurious recompute)\n // on every render — see `UseDialogFilterStateOptions.searchField`'s doc.\n const { searchField } = options;\n const access = useListAccess(resource);\n const accessReady = access.status === 'ready';\n const searchDecl = useMemo<SearchDecl | undefined>(() => {\n const declared = def?.views?.list?.search;\n const base =\n declared !== undefined\n ? declared\n : searchField === undefined\n ? undefined\n : { fields: [searchField] };\n return narrowSearchDecl(base, (field) => access.fieldVisible(field));\n }, [def, searchField, access]);\n const searchContext = useMemo(() => ({ resource, def }), [resource, def]);\n\n const filter = useMemo<ErasedExpression | undefined>(\n () => composeListFilter({ fixed, group, search, searchDecl, searchContext }),\n [fixed, group, search, searchDecl, searchContext],\n );\n\n // A read whose composed filter names a field the user may not view is forbidden (an author\n // predicate, or a function search's output); an undecided access sends nothing yet.\n const blocked = !accessReady || namesHiddenField(filter, (field) => access.fieldVisible(field));\n\n return useMemo<DialogFilterState>(\n () => ({\n searchEnabled: searchDecl !== undefined,\n blocked,\n group,\n setGroup,\n search,\n setSearch,\n page,\n setPage,\n available,\n fixed,\n filter,\n re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C,GAC3E;EAAC;EAAO;EAAO;EAAQ;EAAY;CAAa,CAClD;CAIA,MAAM,UAAU,CAAC,eAAe,iBAAiB,SAAS,UAAU,OAAO,aAAa,KAAK,CAAC;CAE9F,OAAO,eACE;EACL,eAAe,eAAe,KAAA;EAC9B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;AACF"}
1
+ {"version":3,"file":"use-dialog-filter-state-CJoeY-1j.js","names":[],"sources":["../src/fields/use-dialog-filter-state.ts"],"sourcesContent":["import {\n EMPTY_FILTER_GROUP,\n composeListFilter,\n type ErasedResourceHandle,\n type FilterExpression,\n type FilterGroup,\n type FixedFilterInput,\n type ResolvedFixedFilter,\n type SearchDecl,\n routeResourceKey,\n type ResourceNameOrRef,\n} from '@burojs/core';\nimport { useApp, useFilterFields, useListAccess, type FilterFieldSpec } from '@burojs/react';\nimport { namesHiddenField, narrowSearchDecl } from './search-access.js';\nimport { useCallback, useMemo, useState } from 'react';\n\n/** The portable erased AST — the only shape this module deals in. */\ntype ErasedExpression = FilterExpression<ErasedResourceHandle>;\n\n/** Options for {@link useDialogFilterState}. */\nexport interface UseDialogFilterStateOptions {\n /** Call-site narrowing (e.g. scope the target list to a product group). */\n readonly fixedFilters?: readonly FixedFilterInput[];\n /**\n * Fallback search field, used ONLY when the target resource declares no\n * `views.list.search`. Wrapped into a single-field `SearchFieldsDecl`\n * (`{ fields: [searchField] }`, implicit `contains` — same degenerate form\n * `searchToFilter` already gives a bare field-name string) so the override\n * goes through the exact same `composeListFilter` → `searchToFilter` path\n * as a real declaration, rather than a second hand-built predicate at the\n * call site. The target's own declaration always wins when present — this\n * is a fallback, not an override of a declared search.\n */\n readonly searchField?: string;\n /**\n * Gates the field-derivation walk (`useFilterFields`'s `categorizeField`\n * pass over every field of the resource). Defaults to `true`. A caller\n * whose UI isn't visible yet (e.g. `RelationPickerDialog` before it's\n * opened) should pass `false` to skip that work on every mount /\n * `fixedFilters`-identity change; the derivation recomputes in full the\n * next render where this flips back to `true`.\n */\n readonly enabled?: boolean;\n}\n\n/** Return shape of {@link useDialogFilterState}. */\nexport interface DialogFilterState {\n readonly group: FilterGroup;\n readonly setGroup: (next: FilterGroup) => void;\n readonly search: string;\n readonly setSearch: (next: string) => void;\n readonly page: number;\n readonly setPage: (page: number) => void;\n readonly available: readonly FilterFieldSpec[];\n readonly fixed: readonly ResolvedFixedFilter[];\n /** The single expression to hand the data provider. */\n readonly filter: ErasedExpression | undefined;\n /** Whether the target has a search for this user (no field left means no search box). */\n readonly searchEnabled: boolean;\n /** The read must not be sent: undecided access, or a filter naming a field the user may not view. */\n readonly blocked: boolean;\n readonly reset: () => void;\n}\n\n/**\n * Local (non-URL) filter state for the relation-picker's advanced-search\n * dialog.\n *\n * `useResourceList` cannot serve this: it unconditionally calls\n * `useResourceUrlState`, which throws without a `RouterAdapterProvider` and,\n * when one IS present, writes to `?<resource>.*`. A picker dialog mounted\n * inside a form for resource A, searching TARGET resource B, would then\n * write B's list state into the URL — clobbering a real B list page open on\n * another tab of the same app, and reading back whatever that page last\n * wrote on open. So this hook keeps `group`/`search`/`page` in plain\n * `useState` and reuses the SAME composition core's list controller uses\n * (`composeListFilter`) so the two never drift on what a filter means.\n *\n * No `pinned` slot: pinned controls are a list-PAGE affordance (permanent\n * screen real estate for a couple of always-visible facets); a modal has no\n * spare real estate to spend on them.\n */\nexport function useDialogFilterState<const N extends string = string>(\n resourceInput: ResourceNameOrRef<N>,\n options: UseDialogFilterStateOptions,\n): DialogFilterState {\n const resource = routeResourceKey(resourceInput);\n const app = useApp();\n const def = app.registry.get(resource);\n const { available, fixed } = useFilterFields(resource, {\n fixedFilters: options.fixedFilters,\n enabled: options.enabled,\n });\n\n const [group, setGroupState] = useState<FilterGroup>(EMPTY_FILTER_GROUP);\n const [search, setSearchState] = useState('');\n const [page, setPage] = useState(1);\n\n // Any change to WHAT is filtered invalidates the current page — the same\n // rule `useResourceList`'s URL-state controller applies to its own\n // group/search setters.\n const setGroup = useCallback((next: FilterGroup) => {\n setGroupState(next);\n setPage(1);\n }, []);\n\n const setSearch = useCallback((next: string) => {\n setSearchState(next);\n setPage(1);\n }, []);\n\n const reset = useCallback(() => {\n setGroupState(EMPTY_FILTER_GROUP);\n setSearchState('');\n setPage(1);\n }, []);\n\n // The target's own declaration always wins; `options.searchField` only\n // fills in when the target declares no search at all. Memoized so an\n // omitted declaration doesn't hand `composeListFilter`'s `filter` memo a\n // fresh `{ fields: [...] }` literal (and therefore a spurious recompute)\n // on every render — see `UseDialogFilterStateOptions.searchField`'s doc.\n const { searchField } = options;\n const access = useListAccess(resource);\n const accessReady = access.status === 'ready';\n const searchDecl = useMemo<SearchDecl | undefined>(() => {\n const declared = def?.views?.list?.search;\n const base =\n declared !== undefined\n ? declared\n : searchField === undefined\n ? undefined\n : { fields: [searchField] };\n return narrowSearchDecl(base, (field) => access.fieldVisible(field));\n }, [def, searchField, access]);\n const searchContext = useMemo(() => ({ resource, def }), [resource, def]);\n\n const filter = useMemo<ErasedExpression | undefined>(\n () => composeListFilter({ fixed, group, search, searchDecl, searchContext }),\n [fixed, group, search, searchDecl, searchContext],\n );\n\n // A read whose composed filter names a field the user may not view is forbidden (an author\n // predicate, or a function search's output); an undecided access sends nothing yet.\n const blocked = !accessReady || namesHiddenField(filter, (field) => access.fieldVisible(field));\n\n return useMemo<DialogFilterState>(\n () => ({\n searchEnabled: searchDecl !== undefined,\n blocked,\n group,\n setGroup,\n search,\n setSearch,\n page,\n setPage,\n available,\n fixed,\n filter,\n reset,\n }),\n [\n group,\n setGroup,\n search,\n setSearch,\n page,\n available,\n fixed,\n filter,\n reset,\n searchDecl,\n blocked,\n ],\n );\n}\n"],"mappings":";;;;;AAkFA,SAAgB,qBACd,eACA,SACmB;CACnB,MAAM,WAAW,iBAAiB,aAAa;CAE/C,MAAM,MADM,OACE,CAAC,CAAC,SAAS,IAAI,QAAQ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IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;AACF"}
@@ -1,4 +1,4 @@
1
- const require_relation_create = require("./relation-create-DDEYcKfw.cjs");
1
+ const require_relation_create = require("./relation-create-_SFuPQGM.cjs");
2
2
  let _burojs_core = require("@burojs/core");
3
3
  let _burojs_react = require("@burojs/react");
4
4
  let react = require("react");
@@ -90,4 +90,4 @@ Object.defineProperty(exports, "useDialogFilterState", {
90
90
  }
91
91
  });
92
92
 
93
- //# sourceMappingURL=use-dialog-filter-state-tNvqAAjh.cjs.map
93
+ //# sourceMappingURL=use-dialog-filter-state-lsTJxrB4.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-dialog-filter-state-tNvqAAjh.cjs","names":["routeResourceKey","useApp","useFilterFields","useState","EMPTY_FILTER_GROUP","useCallback","useListAccess","useMemo","narrowSearchDecl","composeListFilter","namesHiddenField"],"sources":["../src/fields/use-dialog-filter-state.ts"],"sourcesContent":["import {\n EMPTY_FILTER_GROUP,\n composeListFilter,\n type ErasedResourceHandle,\n type FilterExpression,\n type FilterGroup,\n type FixedFilterInput,\n type ResolvedFixedFilter,\n type SearchDecl,\n routeResourceKey,\n type ResourceNameOrRef,\n} from '@burojs/core';\nimport { useApp, useFilterFields, useListAccess, type FilterFieldSpec } from '@burojs/react';\nimport { namesHiddenField, narrowSearchDecl } from './search-access.js';\nimport { useCallback, useMemo, useState } from 'react';\n\n/** The portable erased AST — the only shape this module deals in. */\ntype ErasedExpression = FilterExpression<ErasedResourceHandle>;\n\n/** Options for {@link useDialogFilterState}. */\nexport interface UseDialogFilterStateOptions {\n /** Call-site narrowing (e.g. scope the target list to a product group). */\n readonly fixedFilters?: readonly FixedFilterInput[];\n /**\n * Fallback search field, used ONLY when the target resource declares no\n * `views.list.search`. Wrapped into a single-field `SearchFieldsDecl`\n * (`{ fields: [searchField] }`, implicit `contains` — same degenerate form\n * `searchToFilter` already gives a bare field-name string) so the override\n * goes through the exact same `composeListFilter` → `searchToFilter` path\n * as a real declaration, rather than a second hand-built predicate at the\n * call site. The target's own declaration always wins when present — this\n * is a fallback, not an override of a declared search.\n */\n readonly searchField?: string;\n /**\n * Gates the field-derivation walk (`useFilterFields`'s `categorizeField`\n * pass over every field of the resource). Defaults to `true`. A caller\n * whose UI isn't visible yet (e.g. `RelationPickerDialog` before it's\n * opened) should pass `false` to skip that work on every mount /\n * `fixedFilters`-identity change; the derivation recomputes in full the\n * next render where this flips back to `true`.\n */\n readonly enabled?: boolean;\n}\n\n/** Return shape of {@link useDialogFilterState}. */\nexport interface DialogFilterState {\n readonly group: FilterGroup;\n readonly setGroup: (next: FilterGroup) => void;\n readonly search: string;\n readonly setSearch: (next: string) => void;\n readonly page: number;\n readonly setPage: (page: number) => void;\n readonly available: readonly FilterFieldSpec[];\n readonly fixed: readonly ResolvedFixedFilter[];\n /** The single expression to hand the data provider. */\n readonly filter: ErasedExpression | undefined;\n /** Whether the target has a search for this user (no field left means no search box). */\n readonly searchEnabled: boolean;\n /** The read must not be sent: undecided access, or a filter naming a field the user may not view. */\n readonly blocked: boolean;\n readonly reset: () => void;\n}\n\n/**\n * Local (non-URL) filter state for the relation-picker's advanced-search\n * dialog.\n *\n * `useResourceList` cannot serve this: it unconditionally calls\n * `useResourceUrlState`, which throws without a `RouterAdapterProvider` and,\n * when one IS present, writes to `?<resource>.*`. A picker dialog mounted\n * inside a form for resource A, searching TARGET resource B, would then\n * write B's list state into the URL — clobbering a real B list page open on\n * another tab of the same app, and reading back whatever that page last\n * wrote on open. So this hook keeps `group`/`search`/`page` in plain\n * `useState` and reuses the SAME composition core's list controller uses\n * (`composeListFilter`) so the two never drift on what a filter means.\n *\n * No `pinned` slot: pinned controls are a list-PAGE affordance (permanent\n * screen real estate for a couple of always-visible facets); a modal has no\n * spare real estate to spend on them.\n */\nexport function useDialogFilterState<const N extends string = string>(\n resourceInput: ResourceNameOrRef<N>,\n options: UseDialogFilterStateOptions,\n): DialogFilterState {\n const resource = routeResourceKey(resourceInput);\n const app = useApp();\n const def = app.registry.get(resource);\n const { available, fixed } = useFilterFields(resource, {\n fixedFilters: options.fixedFilters,\n enabled: options.enabled,\n });\n\n const [group, setGroupState] = useState<FilterGroup>(EMPTY_FILTER_GROUP);\n const [search, setSearchState] = useState('');\n const [page, setPage] = useState(1);\n\n // Any change to WHAT is filtered invalidates the current page — the same\n // rule `useResourceList`'s URL-state controller applies to its own\n // group/search setters.\n const setGroup = useCallback((next: FilterGroup) => {\n setGroupState(next);\n setPage(1);\n }, []);\n\n const setSearch = useCallback((next: string) => {\n setSearchState(next);\n setPage(1);\n }, []);\n\n const reset = useCallback(() => {\n setGroupState(EMPTY_FILTER_GROUP);\n setSearchState('');\n setPage(1);\n }, []);\n\n // The target's own declaration always wins; `options.searchField` only\n // fills in when the target declares no search at all. Memoized so an\n // omitted declaration doesn't hand `composeListFilter`'s `filter` memo a\n // fresh `{ fields: [...] }` literal (and therefore a spurious recompute)\n // on every render — see `UseDialogFilterStateOptions.searchField`'s doc.\n const { searchField } = options;\n const access = useListAccess(resource);\n const accessReady = access.status === 'ready';\n const searchDecl = useMemo<SearchDecl | undefined>(() => {\n const declared = def?.views?.list?.search;\n const base =\n declared !== undefined\n ? declared\n : searchField === undefined\n ? undefined\n : { fields: [searchField] };\n return narrowSearchDecl(base, (field) => access.fieldVisible(field));\n }, [def, searchField, access]);\n const searchContext = useMemo(() => ({ resource, def }), [resource, def]);\n\n const filter = useMemo<ErasedExpression | undefined>(\n () => composeListFilter({ fixed, group, search, searchDecl, searchContext }),\n [fixed, group, search, searchDecl, searchContext],\n );\n\n // A read whose composed filter names a field the user may not view is forbidden (an author\n // predicate, or a function search's output); an undecided access sends nothing yet.\n const blocked = !accessReady || namesHiddenField(filter, (field) => access.fieldVisible(field));\n\n return useMemo<DialogFilterState>(\n () => ({\n searchEnabled: searchDecl !== undefined,\n blocked,\n group,\n setGroup,\n search,\n setSearch,\n page,\n setPage,\n available,\n fixed,\n filter,\n reset,\n }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AAE,QAAQ,CAAC,WAAW,EAAE,IACD,UAAU,OAAO,aAAa,KAAK,CAAC;CACrE,GAAG;EAAC;EAAK;EAAa;CAAM,CAAC;CAC7B,MAAM,iBAAA,GAAgBD,MAAAA,QAAAA,QAAe;EAAE;EAAU;CAAI,IAAI,CAAC,UAAU,GAAG,CAAC;CAExE,MAAM,UAAA,GAASA,MAAAA,QAAAA,QAAAA,GACPE,aAAAA,kBAAAA,CAAkB;EAAE;EAAO;EAAO;EAAQ;EAAY;CAAc,CAAC,GAC3E;EAAC;EAAO;EAAO;EAAQ;EAAY;CAAa,CAClD;CAIA,MAAM,UAAU,CAAC,eAAeC,wBAAAA,iBAAiB,SAAS,UAAU,OAAO,aAAa,KAAK,CAAC;CAE9F,QAAA,GAAOH,MAAAA,QAAAA,QACE;EACL,eAAe,eAAe,KAAA;EAC9B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;AACF"}
1
+ {"version":3,"file":"use-dialog-filter-state-lsTJxrB4.cjs","names":["routeResourceKey","useApp","useFilterFields","useState","EMPTY_FILTER_GROUP","useCallback","useListAccess","useMemo","narrowSearchDecl","composeListFilter","namesHiddenField"],"sources":["../src/fields/use-dialog-filter-state.ts"],"sourcesContent":["import {\n EMPTY_FILTER_GROUP,\n composeListFilter,\n type ErasedResourceHandle,\n type FilterExpression,\n type FilterGroup,\n type FixedFilterInput,\n type ResolvedFixedFilter,\n type SearchDecl,\n routeResourceKey,\n type ResourceNameOrRef,\n} from '@burojs/core';\nimport { useApp, useFilterFields, useListAccess, type FilterFieldSpec } from '@burojs/react';\nimport { namesHiddenField, narrowSearchDecl } from './search-access.js';\nimport { useCallback, useMemo, useState } from 'react';\n\n/** The portable erased AST — the only shape this module deals in. */\ntype ErasedExpression = FilterExpression<ErasedResourceHandle>;\n\n/** Options for {@link useDialogFilterState}. */\nexport interface UseDialogFilterStateOptions {\n /** Call-site narrowing (e.g. scope the target list to a product group). */\n readonly fixedFilters?: readonly FixedFilterInput[];\n /**\n * Fallback search field, used ONLY when the target resource declares no\n * `views.list.search`. Wrapped into a single-field `SearchFieldsDecl`\n * (`{ fields: [searchField] }`, implicit `contains` — same degenerate form\n * `searchToFilter` already gives a bare field-name string) so the override\n * goes through the exact same `composeListFilter` → `searchToFilter` path\n * as a real declaration, rather than a second hand-built predicate at the\n * call site. The target's own declaration always wins when present — this\n * is a fallback, not an override of a declared search.\n */\n readonly searchField?: string;\n /**\n * Gates the field-derivation walk (`useFilterFields`'s `categorizeField`\n * pass over every field of the resource). Defaults to `true`. A caller\n * whose UI isn't visible yet (e.g. `RelationPickerDialog` before it's\n * opened) should pass `false` to skip that work on every mount /\n * `fixedFilters`-identity change; the derivation recomputes in full the\n * next render where this flips back to `true`.\n */\n readonly enabled?: boolean;\n}\n\n/** Return shape of {@link useDialogFilterState}. */\nexport interface DialogFilterState {\n readonly group: FilterGroup;\n readonly setGroup: (next: FilterGroup) => void;\n readonly search: string;\n readonly setSearch: (next: string) => void;\n readonly page: number;\n readonly setPage: (page: number) => void;\n readonly available: readonly FilterFieldSpec[];\n readonly fixed: readonly ResolvedFixedFilter[];\n /** The single expression to hand the data provider. */\n readonly filter: ErasedExpression | undefined;\n /** Whether the target has a search for this user (no field left means no search box). */\n readonly searchEnabled: boolean;\n /** The read must not be sent: undecided access, or a filter naming a field the user may not view. */\n readonly blocked: boolean;\n readonly reset: () => void;\n}\n\n/**\n * Local (non-URL) filter state for the relation-picker's advanced-search\n * dialog.\n *\n * `useResourceList` cannot serve this: it unconditionally calls\n * `useResourceUrlState`, which throws without a `RouterAdapterProvider` and,\n * when one IS present, writes to `?<resource>.*`. A picker dialog mounted\n * inside a form for resource A, searching TARGET resource B, would then\n * write B's list state into the URL — clobbering a real B list page open on\n * another tab of the same app, and reading back whatever that page last\n * wrote on open. So this hook keeps `group`/`search`/`page` in plain\n * `useState` and reuses the SAME composition core's list controller uses\n * (`composeListFilter`) so the two never drift on what a filter means.\n *\n * No `pinned` slot: pinned controls are a list-PAGE affordance (permanent\n * screen real estate for a couple of always-visible facets); a modal has no\n * spare real estate to spend on them.\n */\nexport function useDialogFilterState<const N extends string = string>(\n resourceInput: ResourceNameOrRef<N>,\n options: UseDialogFilterStateOptions,\n): DialogFilterState {\n const resource = routeResourceKey(resourceInput);\n const app = useApp();\n const def = app.registry.get(resource);\n const { available, fixed } = useFilterFields(resource, {\n fixedFilters: options.fixedFilters,\n enabled: options.enabled,\n });\n\n const [group, setGroupState] = useState<FilterGroup>(EMPTY_FILTER_GROUP);\n const [search, setSearchState] = useState('');\n const [page, setPage] = useState(1);\n\n // Any change to WHAT is filtered invalidates the current page — the same\n // rule `useResourceList`'s URL-state controller applies to its own\n // group/search setters.\n const setGroup = useCallback((next: FilterGroup) => {\n setGroupState(next);\n setPage(1);\n }, []);\n\n const setSearch = useCallback((next: string) => {\n setSearchState(next);\n setPage(1);\n }, []);\n\n const reset = useCallback(() => {\n setGroupState(EMPTY_FILTER_GROUP);\n setSearchState('');\n setPage(1);\n }, []);\n\n // The target's own declaration always wins; `options.searchField` only\n // fills in when the target declares no search at all. Memoized so an\n // omitted declaration doesn't hand `composeListFilter`'s `filter` memo a\n // fresh `{ fields: [...] }` literal (and therefore a spurious recompute)\n // on every render — see `UseDialogFilterStateOptions.searchField`'s doc.\n const { searchField } = options;\n const access = useListAccess(resource);\n const accessReady = access.status === 'ready';\n const searchDecl = useMemo<SearchDecl | undefined>(() => {\n const declared = def?.views?.list?.search;\n const base =\n declared !== undefined\n ? declared\n : searchField === undefined\n ? undefined\n : { fields: [searchField] };\n return narrowSearchDecl(base, (field) => access.fieldVisible(field));\n }, [def, searchField, access]);\n const searchContext = useMemo(() => ({ resource, def }), [resource, def]);\n\n const filter = useMemo<ErasedExpression | undefined>(\n () => composeListFilter({ fixed, group, search, searchDecl, searchContext }),\n [fixed, group, search, searchDecl, searchContext],\n );\n\n // A read whose composed filter names a field the user may not view is forbidden (an author\n // predicate, or a function search's output); an undecided access sends nothing yet.\n const blocked = !accessReady || namesHiddenField(filter, (field) => access.fieldVisible(field));\n\n return useMemo<DialogFilterState>(\n () => ({\n searchEnabled: searchDecl !== undefined,\n blocked,\n group,\n setGroup,\n search,\n setSearch,\n page,\n setPage,\n available,\n fixed,\n filter,\n reset,\n }),\n [\n group,\n setGroup,\n search,\n setSearch,\n page,\n available,\n fixed,\n filter,\n reset,\n searchDecl,\n blocked,\n ],\n );\n}\n"],"mappings":";;;;;AAkFA,SAAgB,qBACd,eACA,SACmB;CACnB,MAAM,YAAA,GAAWA,aAAAA,iBAAAA,CAAiB,aAAa;CAE/C,MAAM,OAAA,GADMC,cAAAA,OAAAA,CACE,CAAC,CAAC,SAAS,IAAI,QAAQ;CACrC,MAAM,EAAE,WAAW,WAAA,GAAUC,cAAAA,gBAAAA,CAAgB,UAAU;EACrD,cAAc,QAAQ;EACtB,SAAS,QAAQ;CACnB,CAAC;CAED,MAAM,CAAC,OAAO,kBAAA,GAAiBC,MAAAA,SAAAA,CAAsBC,aAAAA,kBAAkB;CACvE,MAAM,CAAC,QAAQ,mBAAA,GAAkBD,MAAAA,SAAAA,CAAS,EAAE;CAC5C,MAAM,CAAC,MAAM,YAAA,GAAWA,MAAAA,SAAAA,CAAS,CAAC;CAKlC,MAAM,YAAA,GAAWE,MAAAA,YAAAA,EAAa,SAAsB;EAClD,cAAc,IAAI;EAClB,QAAQ,CAAC;CACX,GAAG,CAAC,CAAC;CAEL,MAAM,aAAA,GAAYA,MAAAA,YAAAA,EAAa,SAAiB;EAC9C,eAAe,IAAI;EACnB,QAAQ,CAAC;CACX,GAAG,CAAC,CAAC;CAEL,MAAM,SAAA,GAAQA,MAAAA,YAAAA,OAAkB;EAC9B,cAAcD,aAAAA,kBAAkB;EAChC,eAAe,EAAE;EACjB,QAAQ,CAAC;CACX,GAAG,CAAC,CAAC;CAOL,MAAM,EAAE,gBAAgB;CACxB,MAAM,UAAA,GAASE,cAAAA,cAAAA,CAAc,QAAQ;CACrC,MAAM,cAAc,OAAO,WAAW;CACtC,MAAM,cAAA,GAAaC,MAAAA,QAAAA,OAAsC;EACvD,MAAM,WAAW,KAAK,OAAO,MAAM;EAOnC,OAAOC,wBAAAA,iBALL,aAAa,KAAA,IACT,WACA,gBAAgB,KAAA,IACd,KAAA,IACA,EAAE,QAAQ,CAAC,WAAW,EAAE,IACD,UAAU,OAAO,aAAa,KAAK,CAAC;CACrE,GAAG;EAAC;EAAK;EAAa;CAAM,CAAC;CAC7B,MAAM,iBAAA,GAAgBD,MAAAA,QAAAA,QAAe;EAAE;EAAU;CAAI,IAAI,CAAC,UAAU,GAAG,CAAC;CAExE,MAAM,UAAA,GAASA,MAAAA,QAAAA,QAAAA,GACPE,aAAAA,kBAAAA,CAAkB;EAAE;EAAO;EAAO;EAAQ;EAAY;CAAc,CAAC,GAC3E;EAAC;EAAO;EAAO;EAAQ;EAAY;CAAa,CAClD;CAIA,MAAM,UAAU,CAAC,eAAeC,wBAAAA,iBAAiB,SAAS,UAAU,OAAO,aAAa,KAAK,CAAC;CAE9F,QAAA,GAAOH,MAAAA,QAAAA,QACE;EACL,eAAe,eAAe,KAAA;EAC9B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;AACF"}
@@ -1,3 +1,4 @@
1
+ const require_relation_create = require("./relation-create-_SFuPQGM.cjs");
1
2
  let _burojs_core = require("@burojs/core");
2
3
  let _burojs_react = require("@burojs/react");
3
4
  let react = require("react");
@@ -29,13 +30,9 @@ function useRowSubtitle(target, override) {
29
30
  const resolve = useRecordSubtitle(target, override);
30
31
  const declares = override !== void 0 || def?.recordSubtitle !== void 0;
31
32
  return (0, react.useCallback)((row) => {
32
- if (!declares || access.status !== "ready") return void 0;
33
- const declaredId = (def?.data)?.idField;
34
- const idField = typeof declaredId === "string" && declaredId !== "" ? declaredId : "id";
35
- const visible = {};
36
- for (const name of Object.keys(def?.fields ?? {})) if (Object.hasOwn(row, name) && access.fieldVisible(name)) visible[name] = row[name];
37
- if (Object.hasOwn(row, idField)) visible[idField] = row[idField];
38
- return resolve(visible);
33
+ if (!declares) return void 0;
34
+ const visible = require_relation_create.visibleRow(def, access, row);
35
+ return visible === void 0 ? void 0 : resolve(visible);
39
36
  }, [
40
37
  declares,
41
38
  access,
@@ -67,4 +64,4 @@ Object.defineProperty(exports, "useRowSubtitle", {
67
64
  }
68
65
  });
69
66
 
70
- //# sourceMappingURL=use-record-subtitle-bfwIoUme.cjs.map
67
+ //# sourceMappingURL=use-record-subtitle-BJ9rnj6F.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-record-subtitle-BJ9rnj6F.cjs","names":["useApp","useI18nCaps","useCallback","resolveEnumLabel","useListAccess","visibleRow"],"sources":["../src/resource/use-record-subtitle.ts"],"sourcesContent":["'use client';\nimport { type RecordTitleContext, resolveEnumLabel } from '@burojs/core';\nimport { useApp, useI18nCaps, useListAccess } from '@burojs/react';\nimport { useCallback } from 'react';\nimport { visibleRow } from './visible-row.js';\n\n/**\n * A record's second line as code declares it (REF-136): the resource's `recordSubtitle`, or a\n * relation field's `optionSubtitle` for that field's options. A string is the line, `null` says\n * there is none, `undefined` (or a blank string) leaves it to the surface.\n */\nexport type RecordSubtitleFn = (\n record: Readonly<Record<string, unknown>>,\n ctx?: RecordTitleContext,\n) => string | null | undefined;\n\n/** The first of `fns` that decides: a non-blank string, or `null`; else `undefined`. */\nfunction declaredSubtitle(\n fns: readonly (RecordSubtitleFn | undefined)[],\n record: Readonly<Record<string, unknown>>,\n ctx: RecordTitleContext,\n): string | null | undefined {\n for (const fn of fns) {\n const out = fn?.(record, ctx);\n if (out === null) return null;\n if (typeof out === 'string' && out.trim() !== '') return out;\n }\n return undefined;\n}\n\n/**\n * The declared subtitle of one of `resource`'s records: `override` first, then the resource's\n * `recordSubtitle`. Hand it a record as its viewer may read it (projected in record reach); a row of\n * a list goes through {@link useRowSubtitle}. Like `recordTitle`, the hooks are called with an i18n\n * context bound to the resource, so an enum label in the line follows the active locale.\n */\nexport function useRecordSubtitle(\n resource: string,\n override?: RecordSubtitleFn,\n): (record: Readonly<Record<string, unknown>>) => string | null | undefined {\n const app = useApp();\n const caps = useI18nCaps(resource);\n const own: RecordSubtitleFn | undefined = app.registry.get(resource)?.recordSubtitle;\n return useCallback(\n (record) => {\n if (override === undefined && own === undefined) return undefined;\n return declaredSubtitle([override, own], record, {\n resolveEnum: (namespace, value, inlineDefault) =>\n resolveEnumLabel(caps, namespace, value, inlineDefault),\n });\n },\n [override, own, caps],\n );\n}\n\n/**\n * The declared subtitle of a row a list surface shows (picker options, palette results): the hooks\n * see only the row's declared fields its user may view in any-record reach, and its id (P5 spec\n * 3.6, as a list title reads only a visible display field). Undecided access declares nothing.\n */\nexport function useRowSubtitle(\n target: string,\n override?: RecordSubtitleFn,\n): (row: Readonly<Record<string, unknown>>) => string | null | undefined {\n const app = useApp();\n const access = useListAccess(target);\n const def = app.registry.get(target);\n const resolve = useRecordSubtitle(target, override);\n const declares = override !== undefined || def?.recordSubtitle !== undefined;\n return useCallback(\n (row) => {\n if (!declares) return undefined;\n const visible = visibleRow(def, access, row);\n return visible === undefined ? undefined : resolve(visible);\n },\n [declares, access, def, resolve],\n );\n}\n\n/**\n * A picker option's second line: the declared subtitle, else the option's `#<id>` — not drawn when\n * the label already is the id, which would print it twice (REF-40). `null`: none.\n */\nexport function optionSubtitle(\n declared: string | null | undefined,\n label: string,\n id: string,\n): string | null {\n if (declared !== undefined) return declared;\n return label === id ? null : `#${id}`;\n}\n"],"mappings":";;;;;AAiBA,SAAS,iBACP,KACA,QACA,KAC2B;CAC3B,KAAK,MAAM,MAAM,KAAK;EACpB,MAAM,MAAM,KAAK,QAAQ,GAAG;EAC5B,IAAI,QAAQ,MAAM,OAAO;EACzB,IAAI,OAAO,QAAQ,YAAY,IAAI,KAAK,MAA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
3
  import { useApp, useI18nCaps, useListAccess } from "@burojs/react";
3
4
  import { useCallback } from "react";
@@ -29,13 +30,9 @@ function useRowSubtitle(target, override) {
29
30
  const resolve = useRecordSubtitle(target, override);
30
31
  const declares = override !== void 0 || def?.recordSubtitle !== void 0;
31
32
  return useCallback((row) => {
32
- if (!declares || access.status !== "ready") return void 0;
33
- const declaredId = (def?.data)?.idField;
34
- const idField = typeof declaredId === "string" && declaredId !== "" ? declaredId : "id";
35
- const visible = {};
36
- for (const name of Object.keys(def?.fields ?? {})) if (Object.hasOwn(row, name) && access.fieldVisible(name)) visible[name] = row[name];
37
- if (Object.hasOwn(row, idField)) visible[idField] = row[idField];
38
- return resolve(visible);
33
+ if (!declares) return void 0;
34
+ const visible = visibleRow(def, access, row);
35
+ return visible === void 0 ? void 0 : resolve(visible);
39
36
  }, [
40
37
  declares,
41
38
  access,
@@ -50,4 +47,4 @@ function optionSubtitle(declared, label, id) {
50
47
  //#endregion
51
48
  export { useRecordSubtitle as n, useRowSubtitle as r, optionSubtitle as t };
52
49
 
53
- //# sourceMappingURL=use-record-subtitle-gIaCGgbI.js.map
50
+ //# sourceMappingURL=use-record-subtitle-w3ZhXNlf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-record-subtitle-w3ZhXNlf.js","names":[],"sources":["../src/resource/use-record-subtitle.ts"],"sourcesContent":["'use client';\nimport { type RecordTitleContext, resolveEnumLabel } from '@burojs/core';\nimport { useApp, useI18nCaps, useListAccess } from '@burojs/react';\nimport { useCallback } from 'react';\nimport { visibleRow } from './visible-row.js';\n\n/**\n * A record's second line as code declares it (REF-136): the resource's `recordSubtitle`, or a\n * relation field's `optionSubtitle` for that field's options. A string is the line, `null` says\n * there is none, `undefined` (or a blank string) leaves it to the surface.\n */\nexport type RecordSubtitleFn = (\n record: Readonly<Record<string, unknown>>,\n ctx?: RecordTitleContext,\n) => string | null | undefined;\n\n/** The first of `fns` that decides: a non-blank string, or `null`; else `undefined`. */\nfunction declaredSubtitle(\n fns: readonly (RecordSubtitleFn | undefined)[],\n record: Readonly<Record<string, unknown>>,\n ctx: RecordTitleContext,\n): string | null | undefined {\n for (const fn of fns) {\n const out = fn?.(record, ctx);\n if (out === null) return null;\n if (typeof out === 'string' && out.trim() !== '') return out;\n }\n return undefined;\n}\n\n/**\n * The declared subtitle of one of `resource`'s records: `override` first, then the resource's\n * `recordSubtitle`. Hand it a record as its viewer may read it (projected in record reach); a row of\n * a list goes through {@link useRowSubtitle}. Like `recordTitle`, the hooks are called with an i18n\n * context bound to the resource, so an enum label in the line follows the active locale.\n */\nexport function useRecordSubtitle(\n resource: string,\n override?: RecordSubtitleFn,\n): (record: Readonly<Record<string, unknown>>) => string | null | undefined {\n const app = useApp();\n const caps = useI18nCaps(resource);\n const own: RecordSubtitleFn | undefined = app.registry.get(resource)?.recordSubtitle;\n return useCallback(\n (record) => {\n if (override === undefined && own === undefined) return undefined;\n return declaredSubtitle([override, own], record, {\n resolveEnum: (namespace, value, inlineDefault) =>\n resolveEnumLabel(caps, namespace, value, inlineDefault),\n });\n },\n [override, own, caps],\n );\n}\n\n/**\n * The declared subtitle of a row a list surface shows (picker options, palette results): the hooks\n * see only the row's declared fields its user may view in any-record reach, and its id (P5 spec\n * 3.6, as a list title reads only a visible display field). Undecided access declares nothing.\n */\nexport function useRowSubtitle(\n target: string,\n override?: RecordSubtitleFn,\n): (row: Readonly<Record<string, unknown>>) => string | null | undefined {\n const app = useApp();\n const access = useListAccess(target);\n const def = app.registry.get(target);\n const resolve = useRecordSubtitle(target, override);\n const declares = override !== undefined || def?.recordSubtitle !== undefined;\n return useCallback(\n (row) => {\n if (!declares) return undefined;\n const visible = visibleRow(def, access, row);\n return visible === undefined ? undefined : resolve(visible);\n },\n [declares, access, def, resolve],\n );\n}\n\n/**\n * A picker option's second line: the declared subtitle, else the option's `#<id>` — not drawn when\n * the label already is the id, which would print it twice (REF-40). `null`: none.\n */\nexport function optionSubtitle(\n declared: string | null | undefined,\n label: string,\n id: string,\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package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burojs/ui-shadcn",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "license": "MIT",
5
5
  "description": "Buro: default shadcn+Tailwind UI kit with required testid attributes",
6
6
  "type": "module",
@@ -120,11 +120,11 @@
120
120
  "tw-animate-css": "^1.4.0",
121
121
  "unist-util-visit": "^5",
122
122
  "zod": "^3.24.0",
123
- "@burojs/core": "0.8.0",
124
- "@burojs/field-types": "0.8.0",
125
- "@burojs/file-storage": "0.8.0",
126
- "@burojs/i18n-core": "0.8.0",
127
- "@burojs/react": "0.8.0"
123
+ "@burojs/core": "0.9.0",
124
+ "@burojs/field-types": "0.9.0",
125
+ "@burojs/file-storage": "0.9.0",
126
+ "@burojs/i18n-core": "0.9.0",
127
+ "@burojs/react": "0.9.0"
128
128
  },
129
129
  "peerDependencies": {
130
130
  "react": "^19.0.0",
@@ -147,9 +147,9 @@
147
147
  "react-dom": "^19.0.0",
148
148
  "typescript": "^5.5.0",
149
149
  "vitest": "^4.0.0",
150
- "@burojs/context": "0.8.0",
151
- "@burojs/export": "0.8.0",
152
- "@burojs/testing": "0.8.0",
150
+ "@burojs/context": "0.9.0",
151
+ "@burojs/export": "0.9.0",
152
+ "@burojs/testing": "0.9.0",
153
153
  "@burojs/tooling-eslint": "0.0.0",
154
154
  "@burojs/tooling-globals": "0.0.0",
155
155
  "@burojs/tooling-tsconfig": "0.0.0"