@namroodinc/liquid-editorial 0.6.7 → 0.6.9

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 (171) hide show
  1. package/README.md +108 -2
  2. package/UPGRADING.md +88 -0
  3. package/dist/chunks/CollectionView-BIuOL917.cjs +2 -0
  4. package/dist/chunks/CollectionView-BIuOL917.cjs.map +1 -0
  5. package/dist/chunks/CollectionView-Cr12UFWa.js +179 -0
  6. package/dist/chunks/CollectionView-Cr12UFWa.js.map +1 -0
  7. package/dist/chunks/{EntryPicker-CR8Phuzl.js → EntryPicker-B88N69zH.js} +2 -2
  8. package/dist/chunks/{EntryPicker-CR8Phuzl.js.map → EntryPicker-B88N69zH.js.map} +1 -1
  9. package/dist/chunks/{EntryPicker-D7JIgx23.cjs → EntryPicker-daSkD4aR.cjs} +2 -2
  10. package/dist/chunks/{EntryPicker-D7JIgx23.cjs.map → EntryPicker-daSkD4aR.cjs.map} +1 -1
  11. package/dist/chunks/{FormEditor-DNcSAnRF.cjs → FormEditor-B4mtAxaU.cjs} +2 -2
  12. package/dist/chunks/FormEditor-B4mtAxaU.cjs.map +1 -0
  13. package/dist/chunks/{FormEditor-BSfxVqLn.js → FormEditor-BkBhcYI5.js} +3 -2
  14. package/dist/chunks/FormEditor-BkBhcYI5.js.map +1 -0
  15. package/dist/chunks/LoadState-B7GTDlWv.js +71 -0
  16. package/dist/chunks/LoadState-B7GTDlWv.js.map +1 -0
  17. package/dist/chunks/LoadState-C7tQ6fIP.cjs +2 -0
  18. package/dist/chunks/LoadState-C7tQ6fIP.cjs.map +1 -0
  19. package/dist/chunks/Wizard-B_CPW1V6.cjs +2 -0
  20. package/dist/chunks/Wizard-B_CPW1V6.cjs.map +1 -0
  21. package/dist/chunks/Wizard-C1iR5z44.js +99 -0
  22. package/dist/chunks/Wizard-C1iR5z44.js.map +1 -0
  23. package/dist/chunks/frame-C8TwdWBC.cjs +2 -0
  24. package/dist/chunks/frame-C8TwdWBC.cjs.map +1 -0
  25. package/dist/chunks/frame-DaC03_n-.js +203 -0
  26. package/dist/chunks/frame-DaC03_n-.js.map +1 -0
  27. package/dist/chunks/{group-Ckz4Xya-.js → group-C6EOgTgM.js} +2 -2
  28. package/dist/chunks/{group-Ckz4Xya-.js.map → group-C6EOgTgM.js.map} +1 -1
  29. package/dist/chunks/{group-Bj9ZKc0R.cjs → group-QSnlx4jX.cjs} +2 -2
  30. package/dist/chunks/{group-Bj9ZKc0R.cjs.map → group-QSnlx4jX.cjs.map} +1 -1
  31. package/dist/components/Choice/index.cjs +1 -1
  32. package/dist/components/Choice/index.js +1 -1
  33. package/dist/components/CollectionView/empty.d.cts +15 -0
  34. package/dist/components/CollectionView/empty.d.cts.map +1 -0
  35. package/dist/components/CollectionView/empty.d.ts +15 -0
  36. package/dist/components/CollectionView/empty.d.ts.map +1 -0
  37. package/dist/components/CollectionView/filters.d.cts +6 -0
  38. package/dist/components/CollectionView/filters.d.cts.map +1 -0
  39. package/dist/components/CollectionView/filters.d.ts +6 -0
  40. package/dist/components/CollectionView/filters.d.ts.map +1 -0
  41. package/dist/components/CollectionView/index.cjs +1 -0
  42. package/dist/components/CollectionView/index.d.cts +6 -0
  43. package/dist/components/CollectionView/index.d.cts.map +1 -0
  44. package/dist/components/CollectionView/index.d.ts +6 -0
  45. package/dist/components/CollectionView/index.d.ts.map +1 -0
  46. package/dist/components/CollectionView/index.js +2 -0
  47. package/dist/components/CollectionView/style.css +70 -0
  48. package/dist/components/CollectionView/toolbar.d.cts +5 -0
  49. package/dist/components/CollectionView/toolbar.d.cts.map +1 -0
  50. package/dist/components/CollectionView/toolbar.d.ts +5 -0
  51. package/dist/components/CollectionView/toolbar.d.ts.map +1 -0
  52. package/dist/components/CollectionView/types.d.cts +40 -0
  53. package/dist/components/CollectionView/types.d.cts.map +1 -0
  54. package/dist/components/CollectionView/types.d.ts +40 -0
  55. package/dist/components/CollectionView/types.d.ts.map +1 -0
  56. package/dist/components/EditLayout/style.css +1 -1
  57. package/dist/components/EditSection/index.cjs +2 -0
  58. package/dist/components/EditSection/index.cjs.map +1 -0
  59. package/dist/components/EditSection/index.d.cts +9 -0
  60. package/dist/components/EditSection/index.d.cts.map +1 -0
  61. package/dist/components/EditSection/index.d.ts +9 -0
  62. package/dist/components/EditSection/index.d.ts.map +1 -0
  63. package/dist/components/EditSection/index.js +22 -0
  64. package/dist/components/EditSection/index.js.map +1 -0
  65. package/dist/components/EditSection/style.css +31 -0
  66. package/dist/components/EntryPicker/index.cjs +1 -1
  67. package/dist/components/EntryPicker/index.js +1 -1
  68. package/dist/components/Field/frame.d.cts +1 -1
  69. package/dist/components/Field/frame.d.cts.map +1 -1
  70. package/dist/components/Field/frame.d.ts +1 -1
  71. package/dist/components/Field/frame.d.ts.map +1 -1
  72. package/dist/components/Field/header.d.cts +5 -3
  73. package/dist/components/Field/header.d.cts.map +1 -1
  74. package/dist/components/Field/header.d.ts +5 -3
  75. package/dist/components/Field/header.d.ts.map +1 -1
  76. package/dist/components/Field/index.cjs +1 -1
  77. package/dist/components/Field/index.js +1 -1
  78. package/dist/components/Field/style.css +18 -0
  79. package/dist/components/Field/types.d.cts +2 -0
  80. package/dist/components/Field/types.d.cts.map +1 -1
  81. package/dist/components/Field/types.d.ts +2 -0
  82. package/dist/components/Field/types.d.ts.map +1 -1
  83. package/dist/components/FormEditor/README.md +25 -0
  84. package/dist/components/FormEditor/index.cjs +1 -1
  85. package/dist/components/FormEditor/index.d.cts.map +1 -1
  86. package/dist/components/FormEditor/index.d.ts.map +1 -1
  87. package/dist/components/FormEditor/index.js +1 -1
  88. package/dist/components/FormEditor/model.d.cts +1 -0
  89. package/dist/components/FormEditor/model.d.cts.map +1 -1
  90. package/dist/components/FormEditor/model.d.ts +1 -0
  91. package/dist/components/FormEditor/model.d.ts.map +1 -1
  92. package/dist/components/LoadState/error.d.cts +13 -0
  93. package/dist/components/LoadState/error.d.cts.map +1 -0
  94. package/dist/components/LoadState/error.d.ts +13 -0
  95. package/dist/components/LoadState/error.d.ts.map +1 -0
  96. package/dist/components/LoadState/index.cjs +1 -0
  97. package/dist/components/LoadState/index.d.cts +15 -0
  98. package/dist/components/LoadState/index.d.cts.map +1 -0
  99. package/dist/components/LoadState/index.d.ts +15 -0
  100. package/dist/components/LoadState/index.d.ts.map +1 -0
  101. package/dist/components/LoadState/index.js +1 -0
  102. package/dist/components/LoadState/types.d.cts +3 -0
  103. package/dist/components/LoadState/types.d.cts.map +1 -0
  104. package/dist/components/LoadState/types.d.ts +3 -0
  105. package/dist/components/LoadState/types.d.ts.map +1 -0
  106. package/dist/components/LoadState/useRetryAttempt.d.cts +15 -0
  107. package/dist/components/LoadState/useRetryAttempt.d.cts.map +1 -0
  108. package/dist/components/LoadState/useRetryAttempt.d.ts +15 -0
  109. package/dist/components/LoadState/useRetryAttempt.d.ts.map +1 -0
  110. package/dist/components/MetaList/index.cjs +2 -0
  111. package/dist/components/MetaList/index.cjs.map +1 -0
  112. package/dist/components/MetaList/index.d.cts +7 -0
  113. package/dist/components/MetaList/index.d.cts.map +1 -0
  114. package/dist/components/MetaList/index.d.ts +7 -0
  115. package/dist/components/MetaList/index.d.ts.map +1 -0
  116. package/dist/components/MetaList/index.js +13 -0
  117. package/dist/components/MetaList/index.js.map +1 -0
  118. package/dist/components/MetaList/style.css +19 -0
  119. package/dist/components/PageHeader/index.cjs +2 -0
  120. package/dist/components/PageHeader/index.cjs.map +1 -0
  121. package/dist/components/PageHeader/index.d.cts +9 -0
  122. package/dist/components/PageHeader/index.d.cts.map +1 -0
  123. package/dist/components/PageHeader/index.d.ts +9 -0
  124. package/dist/components/PageHeader/index.d.ts.map +1 -0
  125. package/dist/components/PageHeader/index.js +27 -0
  126. package/dist/components/PageHeader/index.js.map +1 -0
  127. package/dist/components/PageHeader/style.css +39 -0
  128. package/dist/components/SelectionCard/index.cjs +1 -1
  129. package/dist/components/SelectionCard/index.js +1 -1
  130. package/dist/components/Stepper/index.cjs +1 -1
  131. package/dist/components/Stepper/index.cjs.map +1 -1
  132. package/dist/components/Stepper/index.d.cts +8 -0
  133. package/dist/components/Stepper/index.d.cts.map +1 -1
  134. package/dist/components/Stepper/index.d.ts +8 -0
  135. package/dist/components/Stepper/index.d.ts.map +1 -1
  136. package/dist/components/Stepper/index.js +15 -14
  137. package/dist/components/Stepper/index.js.map +1 -1
  138. package/dist/components/Stepper/style.css +53 -0
  139. package/dist/components/Wizard/actions.d.cts +13 -0
  140. package/dist/components/Wizard/actions.d.cts.map +1 -0
  141. package/dist/components/Wizard/actions.d.ts +13 -0
  142. package/dist/components/Wizard/actions.d.ts.map +1 -0
  143. package/dist/components/Wizard/index.cjs +1 -0
  144. package/dist/components/Wizard/index.d.cts +7 -0
  145. package/dist/components/Wizard/index.d.cts.map +1 -0
  146. package/dist/components/Wizard/index.d.ts +7 -0
  147. package/dist/components/Wizard/index.d.ts.map +1 -0
  148. package/dist/components/Wizard/index.js +2 -0
  149. package/dist/components/Wizard/review-table.d.cts +13 -0
  150. package/dist/components/Wizard/review-table.d.cts.map +1 -0
  151. package/dist/components/Wizard/review-table.d.ts +13 -0
  152. package/dist/components/Wizard/review-table.d.ts.map +1 -0
  153. package/dist/components/Wizard/style.css +13 -0
  154. package/dist/components/Wizard/types.d.cts +35 -0
  155. package/dist/components/Wizard/types.d.cts.map +1 -0
  156. package/dist/components/Wizard/types.d.ts +35 -0
  157. package/dist/components/Wizard/types.d.ts.map +1 -0
  158. package/dist/index.cjs +1 -1
  159. package/dist/index.d.cts +13 -1
  160. package/dist/index.d.cts.map +1 -1
  161. package/dist/index.d.ts +13 -1
  162. package/dist/index.d.ts.map +1 -1
  163. package/dist/index.js +36 -30
  164. package/dist/styles.css +5 -0
  165. package/package.json +1 -1
  166. package/dist/chunks/FormEditor-BSfxVqLn.js.map +0 -1
  167. package/dist/chunks/FormEditor-DNcSAnRF.cjs.map +0 -1
  168. package/dist/chunks/frame-BBVQTBcX.cjs +0 -2
  169. package/dist/chunks/frame-BBVQTBcX.cjs.map +0 -1
  170. package/dist/chunks/frame-De6IuTQz.js +0 -189
  171. package/dist/chunks/frame-De6IuTQz.js.map +0 -1
package/README.md CHANGED
@@ -77,7 +77,18 @@ Field supplies labels and validation relationships. Button supplies action styli
77
77
 
78
78
  ## Component catalogue
79
79
 
80
- All **44 families** and **94 runtime exports** are listed below, including compound components, hooks, helpers, and compatibility aliases. Each family links to a practical guide and its source stories. Run Storybook locally for interactive examples; this README does not assume a hosted Storybook. Exported TypeScript declarations provide the detailed prop reference.
80
+ All **50 families** and **103 runtime exports** are listed below, including compound components, hooks, helpers, and compatibility aliases. Each family links to a practical guide and its source stories. Run Storybook locally for interactive examples; this README does not assume a hosted Storybook. Exported TypeScript declarations provide the detailed prop reference.
81
+
82
+ ### Collection and editing catalogue
83
+
84
+ | Family / usage | Public exports | Source examples |
85
+ | --- | --- | --- |
86
+ | [CollectionView](#collectionview) | `CollectionView`, `CollectionEmpty` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/CollectionView/CollectionView.stories.tsx) |
87
+ | [EditSection](#editsection) | `EditSection` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/EditSection/EditSection.stories.tsx) |
88
+ | [PageHeader](#pageheader) | `PageHeader` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/PageHeader/PageHeader.stories.tsx) |
89
+ | [MetaList](#metalist) | `MetaList` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/MetaList/MetaList.stories.tsx) |
90
+ | [LoadState](#loadstate) | `LoadState`, `LoadError` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/LoadState/LoadState.stories.tsx) |
91
+ | [Wizard](#wizard) | `Wizard`, `ReviewTable` | [Stories](https://github.com/namroodinc/liquid-editorial/blob/main/src/components/Wizard/Wizard.stories.tsx) |
81
92
 
82
93
  ### Actions and feedback catalogue
83
94
 
@@ -1525,7 +1536,7 @@ Active links use `aria-current`; buttons use `aria-pressed`. Items support an ic
1525
1536
 
1526
1537
  ### Stepper
1527
1538
 
1528
- Progress through ordered steps. `activeStep` is a zero-based index; earlier steps appear complete. Size defaults to `"md"`, with `"sm"` available for compact bands.
1539
+ Progress through ordered steps. `activeStep` is a zero-based index; earlier steps appear complete. Size defaults to `"md"`, with `"sm"` available for compact bands. `orientation` defaults to `"horizontal"`; `"vertical"` stacks steps with each marker beside its label, and `"auto"` stacks them while the stepper is narrower than 28rem, for dialogs, drawers and sidebars. `"auto"` makes the stepper an inline-size container, so give it a definite width rather than sizing it to its content.
1529
1540
 
1530
1541
  ```tsx
1531
1542
  import { useState } from "react";
@@ -1942,3 +1953,98 @@ Validation or version-push failures stop publishing. If publication fails after
1942
1953
  ## License
1943
1954
 
1944
1955
  MIT © Namrood Inc.
1956
+
1957
+ ### CollectionView
1958
+
1959
+ `CollectionView` composes TableFrame, controlled search/filter/Mine/view controls,
1960
+ selection actions, loading feedback and pagination. Supply `title`, `count`,
1961
+ `query`, `onQueryChange`, `status`, `onRetry`, `pagination` and `children`.
1962
+ `pagination` takes Pagination's props: `page`, `pageSize`, `totalResults` and
1963
+ `onChange`, plus any of its options. Its `size`, `menuPlacement` and `isDisabled`
1964
+ override the collection's defaults (`md`, menus opening upward, enabled). Paging
1965
+ stays operable while a page loads, so focus stays on the pressed Next or Previous
1966
+ button; pass `pagination.isDisabled` to lock it. A pending selection also locks it.
1967
+ Optional `filter`, `mine`, `view`, `selection` and `actions` configure the toolbar.
1968
+ The selected count is announced from a status region present before selection.
1969
+ When Clear or a selection action leaves with focus, focus returns to the title.
1970
+ The application owns filtering, records, eligibility, selection and requests.
1971
+ Search retains its native 200-character cap; counts stay exact above 99.
1972
+ `CollectionEmpty` takes `kind="empty" | "no-match"`, a plural `noun`, initial
1973
+ `title`, optional `description`, `icon` and `action`. No-match feedback points
1974
+ back to search. Import both from the root or `components/CollectionView`.
1975
+
1976
+ ### EditSection
1977
+
1978
+ `<EditSection title="Details" actions={<Button>Configure</Button>}>…</EditSection>`
1979
+ groups editor content under a named section and h2. Several actions stay grouped
1980
+ at the header's end. The section and wrapping header use `lg` gaps. FormEditor
1981
+ supplies its own `lg` gap between fields.
1982
+
1983
+ ### PageHeader
1984
+
1985
+ `<PageHeader title={<em>Article</em>} description="Editorial workspace" actions={…} />`
1986
+ renders a wrapping native header and h1, with optional description and actions.
1987
+ Headings clear their own browser margins, so `reset.css` remains optional.
1988
+ It forwards native header attributes and a ref. Routing and back navigation stay
1989
+ with the application; the title accepts React content. Long headings wrap.
1990
+
1991
+ ### MetaList
1992
+
1993
+ `<MetaList items={[["Status", "Draft"], ["Author", <strong>Ada</strong>]]} />`
1994
+ renders read-only facts as a definition list. Terms may repeat. Row spacing stays
1995
+ compact; values wrap and align to the end. Import from the root or
1996
+ `components/MetaList`.
1997
+
1998
+ ### LoadState
1999
+
2000
+ `<LoadState status={status} error={error} onRetry={reload}>{content}</LoadState>`
2001
+ shows a skeleton, failure or ready content. A first error is a quiet note; retries
2002
+ announce progress and repeated failure politely. Keep the component mounted and
2003
+ report `loading` then `error`/`ready` during retries. Report `loading` as the retry
2004
+ starts: a retry that reports no load within a second lapses, so a later load (a
2005
+ new filter, say) shows the skeleton rather than "Trying again…". Retry retains its
2006
+ DOM node and focus while pending, ignores repeat activation, and success renders
2007
+ children.
2008
+ `LoadError` is the standalone Banner composition; its optional `retryState` is
2009
+ `"pending" | "failed"`. Import both from `components/LoadState` or the root.
2010
+ They do not fetch, cache or decide application refresh policy.
2011
+
2012
+ ### Wizard
2013
+
2014
+ `Wizard` requires `isOpen`, `title`, `steps`, `submitLabel`, `onSubmit` and
2015
+ `onClose`. Each step has `id`, `label` and React `content`, with optional
2016
+ `description`, modal `title`/`modalDescription`, `canContinue`, `onInvalid`,
2017
+ `primaryAction` and `hideSecondary`. Multiple steps use controlled `activeStep`
2018
+ and `onStepChange`; one step defaults to index 0. An index past the last step,
2019
+ such as after a conditional step is removed, shows the last step; with no steps,
2020
+ only the dialog frame and its Close button show. `isPending` guards close,
2021
+ progress and actions; `isNavigable={false}` prevents direct progress navigation.
2022
+ Second clicks of double-clicks cannot skip a step or submit a second time. Blocked
2023
+ Back/Cancel and Next/Finish buttons stay focusable with `aria-disabled`, so focus
2024
+ survives a step that cannot continue yet and a pending submission.
2025
+
2026
+ Each step's content mounts fresh when the active step changes, so steps that
2027
+ render the same component type (two FormEditors, say) never share touched,
2028
+ error or uncontrolled state. Keep values in application state above the wizard.
2029
+
2030
+ The default dialog is Modal. Supply a **stable component reference** through
2031
+ `modalComponent: ComponentType<ModalProps>` to retain application dialog hiding
2032
+ or close coordination. It stays mounted and receives `isOpen={false}` when the
2033
+ wizard closes, so it can run exit animations or close bookkeeping. Do not create
2034
+ that component inline during rendering.
2035
+ Applications own validation, persistence and drafts, including whether to confirm
2036
+ leaving. Keep step state above the wizard if closing should preserve it.
2037
+ `ReviewTable` renders `rows: { term, value, step }[]`, `onStepChange` and optional
2038
+ `isDisabled` for review/edit navigation; terms may repeat. Both export from
2039
+ `components/Wizard`.
2040
+
2041
+ Collection, editor, heading, metadata, loading and wizard components compose
2042
+ presentation; they are not FormEditor value controls and need no field adapter.
2043
+ Use `lg` (`var(--space-6)`, normally 24px) between form fields, groups and sections.
2044
+ EditLayout uses the same section gap; Wizard separates progress and step content
2045
+ with `lg` gaps. Label/hint internals, option rows, metadata, tables and button
2046
+ bars keep their compact spacing. General Grid and Stack defaults are unchanged.
2047
+
2048
+ Wizard progress uses Stepper's `orientation="auto"`, stacking vertically when its
2049
+ available width is below 28rem so step labels and descriptions stay readable in
2050
+ narrow dialogs.
package/UPGRADING.md CHANGED
@@ -2,6 +2,94 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.6.9
6
+
7
+ ### Shared collection, editor, loading and wizard presentation
8
+
9
+ Adds CollectionView/CollectionEmpty, EditSection, PageHeader, MetaList,
10
+ LoadState/LoadError and Wizard/ReviewTable, with props/types at the root and
11
+ family imports. Toolbar/filter helpers, retry tracking and wizard actions stay
12
+ private. Composed families can omit a stylesheet when they own no CSS.
13
+
14
+ Stepper gains `orientation: "horizontal" | "vertical" | "auto"` (default
15
+ `horizontal`, exported as `StepperOrientation`). `vertical` stacks steps with
16
+ each marker beside its label; `auto` makes the stepper an inline-size container
17
+ and stacks below 28rem. Wizard progress uses `auto`, so labels and descriptions
18
+ stay readable in narrow dialogs.
19
+
20
+ Behavior to rely on:
21
+
22
+ - CollectionView passes the application's `pagination` options through, so its
23
+ `size`, `menuPlacement` and `isDisabled` win. Paging stays operable while a page
24
+ loads, keeping focus on the pressed button; a pending selection still locks it.
25
+ The selected count is announced from a status region mounted before selection.
26
+ When Clear or a selection action unmounts with focus, focus moves to the title.
27
+ - LoadState lets a retry claim only a load reported within a second; later loads
28
+ show the skeleton instead of the old failure with "Trying again…".
29
+ - Wizard clamps `activeStep` to the last step and shows only its dialog frame
30
+ without steps. Each step's content mounts fresh when the step changes. Blocked
31
+ footer buttons stay focusable with `aria-disabled`. A `modalComponent` stays
32
+ mounted and receives `isOpen={false}` on close.
33
+ - EditSection groups several actions at the header's end. PageHeader and
34
+ EditSection headings clear their own browser margins without `reset.css`.
35
+ - MetaList and ReviewTable accept repeated terms.
36
+
37
+ Adoption: replace equivalent application presentation and CSS with these
38
+ components; keep records, search/filter calculations, routing, permissions,
39
+ requests and workflow state in the application. Import the aggregate stylesheet.
40
+ PageHeader accepts React title content, description, actions and native header
41
+ attributes; it has no router-specific back option. Use required Wizard `isOpen`
42
+ and a stable optional `modalComponent` when bridging application Modal behavior;
43
+ an application modal must render nothing (or its exit state) when `isOpen` is
44
+ false. Keep wizard step values in application state above the wizard. Report
45
+ `loading` as a LoadState retry starts. Pass `pagination.isDisabled` to lock paging
46
+ during application work. Use Stepper `orientation="auto"` or `"vertical"` for
47
+ narrow progress instead of overriding `.ds-stepper__*` internals.
48
+ Layout/feedback components need no FormEditor adapter.
49
+
50
+ EditSection's body/header, EditLayout's section gap and Wizard layout use `lg`
51
+ (`var(--space-6)`, normally 24px). FormEditor's field gap remains `lg`. Audit
52
+ application form-group gaps and remove overlapping margins; preserve compact
53
+ control/option/metadata/toolbar spacing. Grid/Stack defaults are unchanged.
54
+
55
+ Compatibility: additive exports and an additive Stepper prop; no removed APIs,
56
+ dependencies or value changes. Existing EditLayout content now has a 24px
57
+ section gap (previously 32px). Steppers without `orientation` render as before.
58
+ Wizard footer buttons report blocked state with `aria-disabled` rather than the
59
+ native `disabled` attribute; update tests that assert `toBeDisabled()` on them.
60
+
61
+ Verification: run `npm run validate`, consuming lint/typechecks/tests/build,
62
+ check controlled collection selection/count/filter behavior, paging by keyboard
63
+ while pages load, focus after Clear and bulk actions, quiet first failure,
64
+ focused pending Retry and polite repeated failures, wizard validation/pending and
65
+ double-click guards, focus on Next/Finish across blocked steps, per-step form
66
+ state, plus application modal hiding/drag-close integration including its close
67
+ transition. Review all themes at 1440px, 390px and 320px, including long
68
+ headings, narrow wizard progress and forms/dialogs.
69
+
70
+ ## 0.6.8
71
+
72
+ ### Supporting hints beside field labels
73
+
74
+ Field and every FormEditor value field accept optional `labelHint: ReactNode`.
75
+ It renders at the label row's end in muted hint styling, beside any usage counter,
76
+ and wraps to fit narrow containers. Use it for numeric/date bounds or minimum
77
+ selection guidance while counters convey maximum usage. Ordinary authored hints
78
+ stay below controls; errors replace those hints but retain label hints.
79
+
80
+ The hint joins the control or group's accessible description without changing
81
+ its name. Groups retain a direct legend and use only label text for naming.
82
+ Without a label hint or usage counter, existing markup is unchanged. No values,
83
+ validation, dependencies or control adapters change.
84
+
85
+ Adoption: pass `labelHint` to Field or a FormEditor schema field and remove the
86
+ same text from `hint`. Keep domain-specific formatting in the application.
87
+ Style with `.ds-field__label-hint`; `.ds-field__support` holds it and any counter.
88
+
89
+ Verification: check ordinary fields and groups, hints alongside counters,
90
+ errors, zero bounds, long date bounds, narrow and RTL layouts, all themes, and
91
+ accessible names/descriptions. Run library validation and consuming checks.
92
+
5
93
  ## 0.6.7
6
94
 
7
95
  ### Deterministic Field reset regression test
@@ -0,0 +1,2 @@
1
+ const e=require("../components/Button/index.cjs"),t=require("./portalScope-BVA1-Ypu.cjs"),n=require("../components/ButtonGroup/index.cjs"),r=require("../components/Badge/index.cjs"),i=require("../components/SearchField/index.cjs"),a=require("../components/Select/index.cjs"),o=require("../components/Table/index.cjs"),s=require("../components/Pagination/index.cjs"),c=require("./LoadState-C7tQ6fIP.cjs");let l=require("react"),u=require("react/jsx-runtime");function d({title:t,query:r,onQueryChange:o,filter:s,mine:c,view:l,actions:d}){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(i.SearchField,{size:`sm`,maxLength:200,placeholder:`Search ${t.toLowerCase()}`,"aria-label":`Search ${t.toLowerCase()}`,value:r,onChange:e=>o(e.target.value),onClear:()=>o(``)}),s&&(0,u.jsx)(`div`,{className:`ds-collection-view__filter`,children:(0,u.jsx)(a.Select,{size:`sm`,"aria-label":s.label,value:s.value,options:s.options,onValueChange:s.onChange})}),c&&(0,u.jsx)(e.Button,{size:`sm`,iconStart:`user`,variant:c.isPressed?`active`:`neutral`,"aria-pressed":c.isPressed,onClick:()=>c.onChange(!c.isPressed),children:c.label}),l&&(0,u.jsxs)(n.ButtonGroup,{isAttached:!1,"aria-label":`${t} view`,children:[(0,u.jsx)(e.Button,{size:`sm`,isIconOnly:!0,iconStart:`layout-grid`,"aria-label":`Grid view`,"aria-pressed":l.value===`grid`,variant:l.value===`grid`?`active`:`neutral`,onClick:()=>l.onChange(`grid`)}),(0,u.jsx)(e.Button,{size:`sm`,isIconOnly:!0,iconStart:`list`,"aria-label":`Table view`,"aria-pressed":l.value===`table`,variant:l.value===`table`?`active`:`neutral`,onClick:()=>l.onChange(`table`)})]}),d]})}function f({title:n,count:i,query:a,onQueryChange:s,filter:c,mine:f,view:p,selection:m,actions:h}){let g=!!m?.count,_=(0,l.useRef)(null),v=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let e=v.current;!g&&e&&!e.isConnected&&t.i(document.activeElement)&&(v.current=null,_.current?.focus({preventScroll:!0}))},[g]),(0,u.jsx)(o.TableToolbar,{className:`ds-collection-view__toolbar`,"data-selected":g||void 0,onFocus:e=>{v.current=e.target},onBlur:e=>{e.relatedTarget&&(v.current=null)},start:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:`ds-collection-view__selected`,role:`status`,children:g&&`${m.count} selected`}),!g&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{ref:_,className:`ds-table-toolbar__title`,tabIndex:-1,children:n}),(0,u.jsx)(r.Badge,{shape:`count`,appearance:`soft`,isCountExact:!0,className:`ds-collection-view__count`,children:i})]})]}),end:g?(0,u.jsxs)(u.Fragment,{children:[m.reason&&(0,u.jsx)(`span`,{className:`ds-collection-view__reason`,children:m.reason}),m.actions,(0,u.jsx)(e.Button,{size:`sm`,variant:`simple`,isDisabled:m.isPending,onClick:m.onClear,children:`Clear`})]}):(0,u.jsx)(d,{title:n,query:a,onQueryChange:s,filter:c,mine:f,view:p,actions:h})})}function p({kind:e,noun:t,icon:n,title:r,description:i,action:a}){return e===`no-match`?(0,u.jsx)(o.TableEmpty,{icon:`search`,title:`No matching ${t}`,description:`Try a different search or clear a filter.`}):(0,u.jsx)(o.TableEmpty,{icon:n,title:r,description:i,action:a})}function m({title:e,count:t,query:n,onQueryChange:r,status:i,error:a,onRetry:l,pagination:d,filter:p,mine:m,view:h,selection:g,actions:_,children:v}){return(0,u.jsxs)(o.TableFrame,{className:`ds-collection-view`,"aria-busy":i===`loading`||g?.isPending||void 0,children:[(0,u.jsx)(f,{title:e,count:t,query:n,onQueryChange:r,filter:p,mine:m,view:h,selection:g,actions:_}),(0,u.jsx)(`div`,{className:`ds-collection-view__body`,"data-feedback":i!==`ready`||void 0,children:(0,u.jsx)(c.t,{status:i,error:a,onRetry:l,children:v})}),(0,u.jsx)(`div`,{className:`ds-collection-view__footer`,children:(0,u.jsx)(s.Pagination,{size:`md`,menuPlacement:`top`,...d,isDisabled:d.isDisabled||g?.isPending})})]})}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return m}});
2
+ //# sourceMappingURL=CollectionView-BIuOL917.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CollectionView-BIuOL917.cjs","names":["_Fragment","SearchField","Select","Button","ButtonGroup","useRef","cannotHoldFocus","TableToolbar","_Fragment","Badge","Button","TableEmpty","TableFrame","LoadState","Pagination","require_components_Button_index","require_portalScope","require_components_ButtonGroup_index","require_components_Badge_index","require_components_SearchField_index","require_components_Select_index","require_components_Table_index","require_components_Pagination_index","require_LoadState","react","react_jsx_runtime","CollectionFilters","title","query","onQueryChange","event","filter","mine","view","actions","CollectionToolbar","selected","selection","titleRef","focused","previous","count","CollectionEmpty","kind","noun","CollectionView","status","pagination"],"sources":["../../src/components/CollectionView/filters.tsx","../../src/components/CollectionView/toolbar.tsx","../../src/components/CollectionView/empty.tsx","../../src/components/CollectionView/index.tsx"],"sourcesContent":["import { Button } from \"../Button\";\nimport { ButtonGroup } from \"../ButtonGroup\";\nimport { SearchField } from \"../SearchField\";\nimport { Select } from \"../Select\";\nimport type { CollectionViewProps } from \"./types\";\n\ntype FiltersProps = Pick<\n CollectionViewProps,\n \"title\" | \"query\" | \"onQueryChange\" | \"filter\" | \"mine\" | \"view\" | \"actions\"\n>;\n\n/** Search and view controls for a collection without an active selection. */\nexport function CollectionFilters({\n title,\n query,\n onQueryChange,\n filter,\n mine,\n view,\n actions,\n}: FiltersProps) {\n return (\n <>\n <SearchField\n size=\"sm\"\n maxLength={200}\n placeholder={`Search ${title.toLowerCase()}`}\n aria-label={`Search ${title.toLowerCase()}`}\n value={query}\n onChange={(event) => onQueryChange(event.target.value)}\n onClear={() => onQueryChange(\"\")}\n />\n {filter && (\n <div className=\"ds-collection-view__filter\">\n <Select\n size=\"sm\"\n aria-label={filter.label}\n value={filter.value}\n options={filter.options}\n onValueChange={filter.onChange}\n />\n </div>\n )}\n {mine && (\n <Button\n size=\"sm\"\n iconStart=\"user\"\n variant={mine.isPressed ? \"active\" : \"neutral\"}\n aria-pressed={mine.isPressed}\n onClick={() => mine.onChange(!mine.isPressed)}\n >\n {mine.label}\n </Button>\n )}\n {view && (\n <ButtonGroup\n isAttached={false}\n aria-label={`${title} view`}\n >\n <Button\n size=\"sm\"\n isIconOnly\n iconStart=\"layout-grid\"\n aria-label=\"Grid view\"\n aria-pressed={view.value === \"grid\"}\n variant={view.value === \"grid\" ? \"active\" : \"neutral\"}\n onClick={() => view.onChange(\"grid\")}\n />\n <Button\n size=\"sm\"\n isIconOnly\n iconStart=\"list\"\n aria-label=\"Table view\"\n aria-pressed={view.value === \"table\"}\n variant={view.value === \"table\" ? \"active\" : \"neutral\"}\n onClick={() => view.onChange(\"table\")}\n />\n </ButtonGroup>\n )}\n {actions}\n </>\n );\n}\n","import { useEffect, useRef } from \"react\";\nimport { Badge } from \"../Badge\";\nimport { Button } from \"../Button\";\nimport { TableToolbar } from \"../Table\";\nimport { cannotHoldFocus } from \"../../internal/dialogFocus\";\nimport type { CollectionViewProps } from \"./types\";\nimport { CollectionFilters } from \"./filters\";\ntype ToolbarProps = Pick<\n CollectionViewProps,\n | \"title\"\n | \"count\"\n | \"query\"\n | \"onQueryChange\"\n | \"filter\"\n | \"mine\"\n | \"view\"\n | \"selection\"\n | \"actions\"\n>;\nexport function CollectionToolbar({\n title,\n count,\n query,\n onQueryChange,\n filter,\n mine,\n view,\n selection,\n actions,\n}: ToolbarProps) {\n const selected = Boolean(selection?.count);\n const titleRef = useRef<HTMLSpanElement>(null);\n // The toolbar control holding focus. A blur toward the page or a removal\n // keeps it, so the selection ending can tell that it took focus away.\n const focused = useRef<Element | null>(null);\n useEffect(() => {\n const previous = focused.current;\n // Clear, or a selection action, unmounted with focus: return it to the\n // collection's title rather than leave it on the page.\n if (!selected && previous && !previous.isConnected && cannotHoldFocus(document.activeElement)) {\n focused.current = null;\n titleRef.current?.focus({ preventScroll: true });\n }\n }, [selected]);\n return (\n <TableToolbar\n className=\"ds-collection-view__toolbar\"\n data-selected={selected || undefined}\n onFocus={(event) => {\n focused.current = event.target;\n }}\n onBlur={(event) => {\n if (event.relatedTarget) {\n focused.current = null;\n }\n }}\n start={\n <>\n {/* Mounted throughout, so screen readers hear the first selection. */}\n <span\n className=\"ds-collection-view__selected\"\n role=\"status\"\n >\n {selected && `${selection!.count} selected`}\n </span>\n {!selected && (\n <>\n <span\n ref={titleRef}\n className=\"ds-table-toolbar__title\"\n tabIndex={-1}\n >\n {title}\n </span>\n <Badge\n shape=\"count\"\n appearance=\"soft\"\n isCountExact\n className=\"ds-collection-view__count\"\n >\n {count}\n </Badge>\n </>\n )}\n </>\n }\n end={\n selected ? (\n <>\n {selection!.reason && (\n <span className=\"ds-collection-view__reason\">{selection!.reason}</span>\n )}\n {selection!.actions}\n <Button\n size=\"sm\"\n variant=\"simple\"\n isDisabled={selection!.isPending}\n onClick={selection!.onClear}\n >\n Clear\n </Button>\n </>\n ) : (\n <CollectionFilters\n title={title}\n query={query}\n onQueryChange={onQueryChange}\n filter={filter}\n mine={mine}\n view={view}\n actions={actions}\n />\n )\n }\n />\n );\n}\n","import { TableEmpty, type TableEmptyProps } from \"../Table\";\nimport type { CollectionEmptyKind } from \"./types\";\n\nexport interface CollectionEmptyProps extends Pick<\n TableEmptyProps,\n \"icon\" | \"description\" | \"action\"\n> {\n kind: CollectionEmptyKind;\n /** Plural noun for the no-match title, e.g. \"entries\". */\n noun: string;\n /** Shown when the collection itself has no items. */\n title: string;\n}\n\n/**\n * What a searchable collection's frame shows instead of its table: how to\n * start an empty collection, or a pointer back to the search field.\n */\nexport function CollectionEmpty({\n kind,\n noun,\n icon,\n title,\n description,\n action,\n}: CollectionEmptyProps) {\n if (kind === \"no-match\") {\n return (\n <TableEmpty\n icon=\"search\"\n title={`No matching ${noun}`}\n description=\"Try a different search or clear a filter.\"\n />\n );\n }\n return (\n <TableEmpty\n icon={icon}\n title={title}\n description={description}\n action={action}\n />\n );\n}\n","import { Pagination } from \"../Pagination\";\nimport { TableFrame } from \"../Table\";\nimport { CollectionToolbar } from \"./toolbar\";\nimport { LoadState } from \"../LoadState\";\nimport type { CollectionViewProps } from \"./types\";\nimport \"./style.css\";\nexport type { CollectionViewProps, CollectionEmptyKind } from \"./types\";\nexport { CollectionEmpty } from \"./empty\";\nexport type { CollectionEmptyProps } from \"./empty\";\n\nexport function CollectionView({\n title,\n count,\n query,\n onQueryChange,\n status,\n error,\n onRetry,\n pagination,\n filter,\n mine,\n view,\n selection,\n actions,\n children,\n}: CollectionViewProps) {\n return (\n <TableFrame\n className=\"ds-collection-view\"\n aria-busy={status === \"loading\" || selection?.isPending || undefined}\n >\n <CollectionToolbar\n title={title}\n count={count}\n query={query}\n onQueryChange={onQueryChange}\n filter={filter}\n mine={mine}\n view={view}\n selection={selection}\n actions={actions}\n />\n <div\n className=\"ds-collection-view__body\"\n data-feedback={status !== \"ready\" || undefined}\n >\n <LoadState\n status={status}\n error={error}\n onRetry={onRetry}\n >\n {children}\n </LoadState>\n </div>\n <div className=\"ds-collection-view__footer\">\n {/* Paging stays live while a page loads: disabling the pressed Next or\n Previous button would drop its focus on every page change. */}\n <Pagination\n size=\"md\"\n menuPlacement=\"top\"\n {...pagination}\n isDisabled={pagination.isDisabled || selection?.isPending}\n />\n </div>\n </TableFrame>\n );\n}\n"],"mappings":"A,0cAYA,SAAgB0B,EAAkB,CAChC,QACA,QACA,gBACA,SACA,OACA,OACA,WACe,CACf,OACE,EAAAD,EAAA,KAAA,CAAAzB,EAAAA,SAAA,CAAA,SAAA,EACE,EAAAyB,EAAA,IAAA,CAACxB,EAAAA,YAAD,CACE,KAAK,KACL,UAAW,IACX,YAAa,UAAU0B,EAAM,YAAY,IACzC,aAAY,UAAUA,EAAM,YAAY,IACxC,MAAOC,EACP,SAAW,GAAUC,EAAcC,EAAM,OAAO,KAAK,EACrD,YAAeD,EAAc,EAAE,CAChC,CAAA,EACAE,IACC,EAAAN,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,6BACb,UAAA,EAAAA,EAA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ACA,OACA,QACA,cACA,UACuB,CAUvB,OATIC,IAAS,YAET,EAAAlB,EAAA,IAAA,CAACd,EAAAA,WAAD,CACE,KAAK,SACL,MAAO,eAAeiC,IACtB,YAAY,2CACb,CAAA,GAIH,EAAAnB,EAAA,IAAA,CAACd,EAAAA,WAAD,CACQ,OACC,QACM,cACL,QACT,CAAA,CAEL,CCjCA,SAAgBkC,EAAe,CAC7B,QACA,QACA,QACA,gBACA,SACA,QACA,UACA,aACA,SACA,OACA,OACA,YACA,UACA,YACsB,CACtB,OACE,EAAApB,EAAA,KAAA,CAACb,EAAAA,WAAD,CACE,UAAU,qBACV,YAAWkC,IAAW,WAAaT,GAAW,WAAa,IAAA,GAF7D,SAAA,EAIE,EAAAZ,EAAA,IAAA,CAACU,EAAD,CACS,QACA,QACA,QACQ,gBACP,SACF,OACA,OACK,YACF,SACV,CAAA,GACD,EAAAV,EAAA,IAAA,CAAC,MAAD,CACE,UAAU,2BACV,gBAAeqB,IAAW,SAAW,IAAA,GAErC,UAAA,EAAArB,EAAA,IAAA,CAACZ,EAAAA,EAAD,CACU,SACD,QACE,UAER,UACQ,CAAA,CACR,CAAA,GACL,EAAAY,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,6BAGb,UAAA,EAAAA,EAAA,IAAA,CAACX,EAAAA,WAAD,CACE,KAAK,KACL,cAAc,MACd,GAAIiC,EACJ,WAAYA,EAAW,YAAcV,GAAW,SACjD,CAAA,CACE,CAAA,CACK,C,EAEhB,C"}
@@ -0,0 +1,179 @@
1
+ import { Button as e } from "../components/Button/index.js";
2
+ import { i as t } from "./portalScope-AzzPM54i.js";
3
+ import { ButtonGroup as n } from "../components/ButtonGroup/index.js";
4
+ import { Badge as r } from "../components/Badge/index.js";
5
+ import { SearchField as i } from "../components/SearchField/index.js";
6
+ import { Select as a } from "../components/Select/index.js";
7
+ import { TableEmpty as o, TableFrame as s, TableToolbar as c } from "../components/Table/index.js";
8
+ import { Pagination as l } from "../components/Pagination/index.js";
9
+ import { t as u } from "./LoadState-B7GTDlWv.js";
10
+ import { useEffect as d, useRef as f } from "react";
11
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
12
+ //#region src/components/CollectionView/filters.tsx
13
+ function g({ title: t, query: r, onQueryChange: o, filter: s, mine: c, view: l, actions: u }) {
14
+ return /* @__PURE__ */ h(p, { children: [
15
+ /* @__PURE__ */ m(i, {
16
+ size: "sm",
17
+ maxLength: 200,
18
+ placeholder: `Search ${t.toLowerCase()}`,
19
+ "aria-label": `Search ${t.toLowerCase()}`,
20
+ value: r,
21
+ onChange: (e) => o(e.target.value),
22
+ onClear: () => o("")
23
+ }),
24
+ s && /* @__PURE__ */ m("div", {
25
+ className: "ds-collection-view__filter",
26
+ children: /* @__PURE__ */ m(a, {
27
+ size: "sm",
28
+ "aria-label": s.label,
29
+ value: s.value,
30
+ options: s.options,
31
+ onValueChange: s.onChange
32
+ })
33
+ }),
34
+ c && /* @__PURE__ */ m(e, {
35
+ size: "sm",
36
+ iconStart: "user",
37
+ variant: c.isPressed ? "active" : "neutral",
38
+ "aria-pressed": c.isPressed,
39
+ onClick: () => c.onChange(!c.isPressed),
40
+ children: c.label
41
+ }),
42
+ l && /* @__PURE__ */ h(n, {
43
+ isAttached: !1,
44
+ "aria-label": `${t} view`,
45
+ children: [/* @__PURE__ */ m(e, {
46
+ size: "sm",
47
+ isIconOnly: !0,
48
+ iconStart: "layout-grid",
49
+ "aria-label": "Grid view",
50
+ "aria-pressed": l.value === "grid",
51
+ variant: l.value === "grid" ? "active" : "neutral",
52
+ onClick: () => l.onChange("grid")
53
+ }), /* @__PURE__ */ m(e, {
54
+ size: "sm",
55
+ isIconOnly: !0,
56
+ iconStart: "list",
57
+ "aria-label": "Table view",
58
+ "aria-pressed": l.value === "table",
59
+ variant: l.value === "table" ? "active" : "neutral",
60
+ onClick: () => l.onChange("table")
61
+ })]
62
+ }),
63
+ u
64
+ ] });
65
+ }
66
+ //#endregion
67
+ //#region src/components/CollectionView/toolbar.tsx
68
+ function _({ title: n, count: i, query: a, onQueryChange: o, filter: s, mine: l, view: u, selection: _, actions: v }) {
69
+ let y = !!_?.count, b = f(null), x = f(null);
70
+ return d(() => {
71
+ let e = x.current;
72
+ !y && e && !e.isConnected && t(document.activeElement) && (x.current = null, b.current?.focus({ preventScroll: !0 }));
73
+ }, [y]), /* @__PURE__ */ m(c, {
74
+ className: "ds-collection-view__toolbar",
75
+ "data-selected": y || void 0,
76
+ onFocus: (e) => {
77
+ x.current = e.target;
78
+ },
79
+ onBlur: (e) => {
80
+ e.relatedTarget && (x.current = null);
81
+ },
82
+ start: /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("span", {
83
+ className: "ds-collection-view__selected",
84
+ role: "status",
85
+ children: y && `${_.count} selected`
86
+ }), !y && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("span", {
87
+ ref: b,
88
+ className: "ds-table-toolbar__title",
89
+ tabIndex: -1,
90
+ children: n
91
+ }), /* @__PURE__ */ m(r, {
92
+ shape: "count",
93
+ appearance: "soft",
94
+ isCountExact: !0,
95
+ className: "ds-collection-view__count",
96
+ children: i
97
+ })] })] }),
98
+ end: y ? /* @__PURE__ */ h(p, { children: [
99
+ _.reason && /* @__PURE__ */ m("span", {
100
+ className: "ds-collection-view__reason",
101
+ children: _.reason
102
+ }),
103
+ _.actions,
104
+ /* @__PURE__ */ m(e, {
105
+ size: "sm",
106
+ variant: "simple",
107
+ isDisabled: _.isPending,
108
+ onClick: _.onClear,
109
+ children: "Clear"
110
+ })
111
+ ] }) : /* @__PURE__ */ m(g, {
112
+ title: n,
113
+ query: a,
114
+ onQueryChange: o,
115
+ filter: s,
116
+ mine: l,
117
+ view: u,
118
+ actions: v
119
+ })
120
+ });
121
+ }
122
+ //#endregion
123
+ //#region src/components/CollectionView/empty.tsx
124
+ function v({ kind: e, noun: t, icon: n, title: r, description: i, action: a }) {
125
+ return e === "no-match" ? /* @__PURE__ */ m(o, {
126
+ icon: "search",
127
+ title: `No matching ${t}`,
128
+ description: "Try a different search or clear a filter."
129
+ }) : /* @__PURE__ */ m(o, {
130
+ icon: n,
131
+ title: r,
132
+ description: i,
133
+ action: a
134
+ });
135
+ }
136
+ //#endregion
137
+ //#region src/components/CollectionView/index.tsx
138
+ function y({ title: e, count: t, query: n, onQueryChange: r, status: i, error: a, onRetry: o, pagination: c, filter: d, mine: f, view: p, selection: g, actions: v, children: y }) {
139
+ return /* @__PURE__ */ h(s, {
140
+ className: "ds-collection-view",
141
+ "aria-busy": i === "loading" || g?.isPending || void 0,
142
+ children: [
143
+ /* @__PURE__ */ m(_, {
144
+ title: e,
145
+ count: t,
146
+ query: n,
147
+ onQueryChange: r,
148
+ filter: d,
149
+ mine: f,
150
+ view: p,
151
+ selection: g,
152
+ actions: v
153
+ }),
154
+ /* @__PURE__ */ m("div", {
155
+ className: "ds-collection-view__body",
156
+ "data-feedback": i !== "ready" || void 0,
157
+ children: /* @__PURE__ */ m(u, {
158
+ status: i,
159
+ error: a,
160
+ onRetry: o,
161
+ children: y
162
+ })
163
+ }),
164
+ /* @__PURE__ */ m("div", {
165
+ className: "ds-collection-view__footer",
166
+ children: /* @__PURE__ */ m(l, {
167
+ size: "md",
168
+ menuPlacement: "top",
169
+ ...c,
170
+ isDisabled: c.isDisabled || g?.isPending
171
+ })
172
+ })
173
+ ]
174
+ });
175
+ }
176
+ //#endregion
177
+ export { v as n, y as t };
178
+
179
+ //# sourceMappingURL=CollectionView-Cr12UFWa.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CollectionView-Cr12UFWa.js","names":["_Fragment","_Fragment","cannotHoldFocus","LoadState","Fragment$1","CollectionFilters","SearchField","title","query","onQueryChange","event","filter","Select","mine","Button","view","ButtonGroup","actions","CollectionToolbar","selected","selection","titleRef","useRef","focused","useEffect","previous","TableToolbar","Badge","count","CollectionEmpty","kind","TableEmpty","noun","CollectionView","TableFrame","status","Pagination","pagination"],"sources":["../../src/components/CollectionView/filters.tsx","../../src/components/CollectionView/toolbar.tsx","../../src/components/CollectionView/empty.tsx","../../src/components/CollectionView/index.tsx"],"sourcesContent":["import { Button } from \"../Button\";\nimport { ButtonGroup } from \"../ButtonGroup\";\nimport { SearchField } from \"../SearchField\";\nimport { Select } from \"../Select\";\nimport type { CollectionViewProps } from \"./types\";\n\ntype FiltersProps = Pick<\n CollectionViewProps,\n \"title\" | \"query\" | \"onQueryChange\" | \"filter\" | \"mine\" | \"view\" | \"actions\"\n>;\n\n/** Search and view controls for a collection without an active selection. */\nexport function CollectionFilters({\n title,\n query,\n onQueryChange,\n filter,\n mine,\n view,\n actions,\n}: FiltersProps) {\n return (\n <>\n <SearchField\n size=\"sm\"\n maxLength={200}\n placeholder={`Search ${title.toLowerCase()}`}\n aria-label={`Search ${title.toLowerCase()}`}\n value={query}\n onChange={(event) => onQueryChange(event.target.value)}\n onClear={() => onQueryChange(\"\")}\n />\n {filter && (\n <div className=\"ds-collection-view__filter\">\n <Select\n size=\"sm\"\n aria-label={filter.label}\n value={filter.value}\n options={filter.options}\n onValueChange={filter.onChange}\n />\n </div>\n )}\n {mine && (\n <Button\n size=\"sm\"\n iconStart=\"user\"\n variant={mine.isPressed ? \"active\" : \"neutral\"}\n aria-pressed={mine.isPressed}\n onClick={() => mine.onChange(!mine.isPressed)}\n >\n {mine.label}\n </Button>\n )}\n {view && (\n <ButtonGroup\n isAttached={false}\n aria-label={`${title} view`}\n >\n <Button\n size=\"sm\"\n isIconOnly\n iconStart=\"layout-grid\"\n aria-label=\"Grid view\"\n aria-pressed={view.value === \"grid\"}\n variant={view.value === \"grid\" ? \"active\" : \"neutral\"}\n onClick={() => view.onChange(\"grid\")}\n />\n <Button\n size=\"sm\"\n isIconOnly\n iconStart=\"list\"\n aria-label=\"Table view\"\n aria-pressed={view.value === \"table\"}\n variant={view.value === \"table\" ? \"active\" : \"neutral\"}\n onClick={() => view.onChange(\"table\")}\n />\n </ButtonGroup>\n )}\n {actions}\n </>\n );\n}\n","import { useEffect, useRef } from \"react\";\nimport { Badge } from \"../Badge\";\nimport { Button } from \"../Button\";\nimport { TableToolbar } from \"../Table\";\nimport { cannotHoldFocus } from \"../../internal/dialogFocus\";\nimport type { CollectionViewProps } from \"./types\";\nimport { CollectionFilters } from \"./filters\";\ntype ToolbarProps = Pick<\n CollectionViewProps,\n | \"title\"\n | \"count\"\n | \"query\"\n | \"onQueryChange\"\n | \"filter\"\n | \"mine\"\n | \"view\"\n | \"selection\"\n | \"actions\"\n>;\nexport function CollectionToolbar({\n title,\n count,\n query,\n onQueryChange,\n filter,\n mine,\n view,\n selection,\n actions,\n}: ToolbarProps) {\n const selected = Boolean(selection?.count);\n const titleRef = useRef<HTMLSpanElement>(null);\n // The toolbar control holding focus. A blur toward the page or a removal\n // keeps it, so the selection ending can tell that it took focus away.\n const focused = useRef<Element | null>(null);\n useEffect(() => {\n const previous = focused.current;\n // Clear, or a selection action, unmounted with focus: return it to the\n // collection's title rather than leave it on the page.\n if (!selected && previous && !previous.isConnected && cannotHoldFocus(document.activeElement)) {\n focused.current = null;\n titleRef.current?.focus({ preventScroll: true });\n }\n }, [selected]);\n return (\n <TableToolbar\n className=\"ds-collection-view__toolbar\"\n data-selected={selected || undefined}\n onFocus={(event) => {\n focused.current = event.target;\n }}\n onBlur={(event) => {\n if (event.relatedTarget) {\n focused.current = null;\n }\n }}\n start={\n <>\n {/* Mounted throughout, so screen readers hear the first selection. */}\n <span\n className=\"ds-collection-view__selected\"\n role=\"status\"\n >\n {selected && `${selection!.count} selected`}\n </span>\n {!selected && (\n <>\n <span\n ref={titleRef}\n className=\"ds-table-toolbar__title\"\n tabIndex={-1}\n >\n {title}\n </span>\n <Badge\n shape=\"count\"\n appearance=\"soft\"\n isCountExact\n className=\"ds-collection-view__count\"\n >\n {count}\n </Badge>\n </>\n )}\n </>\n }\n end={\n selected ? (\n <>\n {selection!.reason && (\n <span className=\"ds-collection-view__reason\">{selection!.reason}</span>\n )}\n {selection!.actions}\n <Button\n size=\"sm\"\n variant=\"simple\"\n isDisabled={selection!.isPending}\n onClick={selection!.onClear}\n >\n Clear\n </Button>\n </>\n ) : (\n <CollectionFilters\n title={title}\n query={query}\n onQueryChange={onQueryChange}\n filter={filter}\n mine={mine}\n view={view}\n actions={actions}\n />\n )\n }\n />\n );\n}\n","import { TableEmpty, type TableEmptyProps } from \"../Table\";\nimport type { CollectionEmptyKind } from \"./types\";\n\nexport interface CollectionEmptyProps extends Pick<\n TableEmptyProps,\n \"icon\" | \"description\" | \"action\"\n> {\n kind: CollectionEmptyKind;\n /** Plural noun for the no-match title, e.g. \"entries\". */\n noun: string;\n /** Shown when the collection itself has no items. */\n title: string;\n}\n\n/**\n * What a searchable collection's frame shows instead of its table: how to\n * start an empty collection, or a pointer back to the search field.\n */\nexport function CollectionEmpty({\n kind,\n noun,\n icon,\n title,\n description,\n action,\n}: CollectionEmptyProps) {\n if (kind === \"no-match\") {\n return (\n <TableEmpty\n icon=\"search\"\n title={`No matching ${noun}`}\n description=\"Try a different search or clear a filter.\"\n />\n );\n }\n return (\n <TableEmpty\n icon={icon}\n title={title}\n description={description}\n action={action}\n />\n );\n}\n","import { Pagination } from \"../Pagination\";\nimport { TableFrame } from \"../Table\";\nimport { CollectionToolbar } from \"./toolbar\";\nimport { LoadState } from \"../LoadState\";\nimport type { CollectionViewProps } from \"./types\";\nimport \"./style.css\";\nexport type { CollectionViewProps, CollectionEmptyKind } from \"./types\";\nexport { CollectionEmpty } from \"./empty\";\nexport type { CollectionEmptyProps } from \"./empty\";\n\nexport function CollectionView({\n title,\n count,\n query,\n onQueryChange,\n status,\n error,\n onRetry,\n pagination,\n filter,\n mine,\n view,\n selection,\n actions,\n children,\n}: CollectionViewProps) {\n return (\n <TableFrame\n className=\"ds-collection-view\"\n aria-busy={status === \"loading\" || selection?.isPending || undefined}\n >\n <CollectionToolbar\n title={title}\n count={count}\n query={query}\n onQueryChange={onQueryChange}\n filter={filter}\n mine={mine}\n view={view}\n selection={selection}\n actions={actions}\n />\n <div\n className=\"ds-collection-view__body\"\n data-feedback={status !== \"ready\" || undefined}\n >\n <LoadState\n status={status}\n error={error}\n onRetry={onRetry}\n >\n {children}\n </LoadState>\n </div>\n <div className=\"ds-collection-view__footer\">\n {/* Paging stays live while a page loads: disabling the pressed Next or\n Previous button would drop its focus on every page change. */}\n <Pagination\n size=\"md\"\n menuPlacement=\"top\"\n {...pagination}\n isDisabled={pagination.isDisabled || selection?.isPending}\n />\n </div>\n </TableFrame>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAgBK,EAAkB,EAChC,UACA,UACA,kBACA,WACA,SACA,SACA,cACe;CACf,OACE,kBAAAL,GAAA,EAAA,UAAA;EACE,kBAACM,GAAD;GACE,MAAK;GACL,WAAW;GACX,aAAa,UAAUC,EAAM,YAAY;GACzC,cAAY,UAAUA,EAAM,YAAY;GACxC,OAAOC;GACP,WAAW,MAAUC,EAAcC,EAAM,OAAO,KAAK;GACrD,eAAeD,EAAc,EAAE;EAChC,CAAA;EACAE,KACC,kBAAC,OAAD;GAAK,WAAU;GACb,UAAA,kBAACC,GAAD;IACE,MAAK;IACL,cAAYD,EAAO;IACnB,OAAOA,EAAO;IACd,SAASA,EAAO;IAChB,eAAeA,EAAO;GACvB,CAAA;EACE,CAAA;EAENE,KACC,kBAACC,GAAD;GACE,MAAK;GACL,WAAU;GACV,SAASD,EAAK,YAAY,WAAW;GACrC,gBAAcA,EAAK;GACnB,eAAeA,EAAK,SAAS,CAACA,EAAK,SAAS;GAE3C,UAAAA,EAAK;EACA,CAAA;EAETE,KACC,kBAACC,GAAD;GACE,YAAY;GACZ,cAAY,GAAGT,EAAM;GAFvB,UAAA,CAIE,kBAACO,GAAD;IACE,MAAK;IACL,YAAA;IACA,WAAU;IACV,cAAW;IACX,gBAAcC,EAAK,UAAU;IAC7B,SAASA,EAAK,UAAU,SAAS,WAAW;IAC5C,eAAeA,EAAK,SAAS,MAAM;GACpC,CAAA,GACD,kBAACD,GAAD;IACE,MAAK;IACL,YAAA;IACA,WAAU;I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AAD;IACE,MAAK;IACL,SAAQ;IACR,YAAYM,EAAW;IACvB,SAASA,EAAW;IACrB,UAAA;GAEO,CAAA;EACR,EAAA,CAAA,IAEF,kBAACf,GAAD;GACS;GACA;GACQ;GACP;GACF;GACA;GACG;EACV,CAAA;CAGN,CAAA;AAEL;;;AClGA,SAAgBwB,EAAgB,EAC9B,SACA,SACA,SACA,UACA,gBACA,aACuB;CAUvB,OATIC,MAAS,aAET,kBAACC,GAAD;EACE,MAAK;EACL,OAAO,eAAeC;EACtB,aAAY;CACb,CAAA,IAIH,kBAACD,GAAD;EACQ;EACC;EACM;EACL;CACT,CAAA;AAEL;;;ACjCA,SAAgBE,EAAe,EAC7B,UACA,UACA,UACA,kBACA,WACA,UACA,YACA,eACA,WACA,SACA,SACA,cACA,YACA,eACsB;CACtB,OACE,kBAACC,GAAD;EACE,WAAU;EACV,aAAWC,MAAW,aAAaf,GAAW,aAAa,KAAA;EAF7D,UAAA;GAIE,kBAACF,GAAD;IACS;IACA;IACA;IACQ;IACP;IACF;IACA;IACK;IACF;GACV,CAAA;GACD,kBAAC,OAAD;IACE,WAAU;IACV,iBAAeiB,MAAW,WAAW,KAAA;IAErC,UAAA,kBAAChC,GAAD;KACU;KACD;KACE;KAER;IACQ,CAAA;GACR,CAAA;GACL,kBAAC,OAAD;IAAK,WAAU;IAGb,UAAA,kBAACiC,GAAD;KACE,MAAK;KACL,eAAc;KACd,GAAIC;KACJ,YAAYA,EAAW,cAAcjB,GAAW;IACjD,CAAA;GACE,CAAA;EACK;;AAEhB"}
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "./Icon-spaFBU4S.js";
2
2
  import { Button as t } from "../components/Button/index.js";
3
3
  import { Modal as n } from "../components/Modal/index.js";
4
- import { t as r } from "./group-Ckz4Xya-.js";
4
+ import { t as r } from "./group-C6EOgTgM.js";
5
5
  import { SearchField as i } from "../components/SearchField/index.js";
6
6
  import { SortableList as a, SortableListItem as o } from "../components/SortableList/index.js";
7
7
  import { useMemo as s, useState as c } from "react";
@@ -177,4 +177,4 @@ function g({ items: g, value: _, defaultValue: v = [], onValueChange: y, mode: b
177
177
  //#endregion
178
178
  export { f as n, g as t };
179
179
 
180
- //# sourceMappingURL=EntryPicker-CR8Phuzl.js.map
180
+ //# sourceMappingURL=EntryPicker-B88N69zH.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EntryPicker-CR8Phuzl.js","names":["_Fragment","Icon","FieldGroup","Fragment$1","selectionLimit","mode","max","cx","parts","matches","query","item","Thumb","EntryPicker","fieldProps","internal","setInternal","useState","defaultValue","selected","value","isOpen","setOpen","setQuery","byId","useMemo","items","results","atMax","commit","isDisabled","next","onValueChange","toggle","id","chosen","canReorder","isReorderable","row","className","emptyLabel","SortableList","SortableListItem","Button","addLabel","Modal","itemLabel","itemsLabel","SearchField","event","isSelected","isBlocked"],"sources":["../../src/components/EntryPicker/limit.ts","../../src/components/EntryPicker/index.tsx"],"sourcesContent":["import type { FieldLimit } from \"../Field/types\";\nimport type { EntryPickerMode } from \".\";\n\n/**\n * Only an explicitly capped multiple selection has a usage limit. Pure, so\n * FormEditor's model derives the same server-rendered limit the picker reports.\n */\nexport function selectionLimit(\n mode: EntryPickerMode,\n count: number,\n max: number | undefined,\n): FieldLimit | undefined {\n return mode === \"multiple\" && max !== undefined ? { count, max } : undefined;\n}\n","import { useMemo, useState, type ReactNode } from \"react\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { Modal } from \"../Modal\";\nimport { SearchField } from \"../SearchField\";\nimport { SortableList, SortableListItem } from \"../SortableList\";\nimport { selectionLimit } from \"./limit\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface EntryItem {\n id: string;\n title: string;\n /** Second line — a content type, a path, a file size. */\n subtitle?: string;\n /** Main image: an asset thumbnail, or the entry's hero. */\n imageUrl?: string;\n /** Words the search matches on top of the title and subtitle. */\n keywords?: string[];\n isDisabled?: boolean;\n}\n\nexport type EntryPickerMode = \"single\" | \"multiple\";\n\nexport interface EntryPickerProps extends Omit<FieldGroupProps, \"children\" | \"label\" | \"count\"> {\n items: EntryItem[];\n /** Selected ids, in the order they will be stored. */\n value?: string[];\n defaultValue?: string[];\n onValueChange?: (value: string[]) => void;\n mode?: EntryPickerMode;\n /** Cap a multiple selection. Reaching it disables the unpicked rows. */\n max?: number;\n label?: string;\n /** Copy shown when nothing is picked yet. */\n emptyLabel?: string;\n addLabel?: string;\n itemLabel?: string;\n itemsLabel?: string;\n /** Multiple selections are reorderable by default — the stored order is the shown order. */\n isReorderable?: boolean;\n isDisabled?: boolean;\n className?: string;\n}\n\nfunction matches(item: EntryItem, query: string) {\n if (!query) {\n return true;\n }\n const haystack = [item.title, item.subtitle, ...(item.keywords ?? [])]\n .filter(Boolean)\n .join(\" \")\n .toLowerCase();\n return haystack.includes(query.toLowerCase());\n}\n\nfunction Thumb({ item }: { item: EntryItem }) {\n return (\n <span className=\"ds-entry__thumb\">\n {item.imageUrl ? (\n <img\n src={item.imageUrl}\n alt=\"\"\n loading=\"lazy\"\n />\n ) : (\n <Icon\n name=\"file-text\"\n size={20}\n />\n )}\n </span>\n );\n}\n\n/**\n * Pick entries or assets out of a list. Search narrows it, a row toggles,\n * and a multiple selection keeps — and reorders — the order you chose.\n */\nexport function EntryPicker({\n items,\n value,\n defaultValue = [],\n onValueChange,\n mode = \"multiple\",\n max,\n label = \"Entries\",\n emptyLabel = \"Nothing selected yet.\",\n addLabel = \"Choose entries\",\n itemLabel = \"entry\",\n itemsLabel = \"entries\",\n isReorderable = true,\n isDisabled = false,\n className,\n ...fieldProps\n}: EntryPickerProps) {\n const [internal, setInternal] = useState<string[]>(defaultValue);\n const selected = value ?? internal;\n const [isOpen, setOpen] = useState(false);\n const [query, setQuery] = useState(\"\");\n\n const byId = useMemo(() => new Map(items.map((item) => [item.id, item])), [items]);\n const results = useMemo(() => items.filter((item) => matches(item, query)), [items, query]);\n const atMax = mode === \"multiple\" && max !== undefined && selected.length >= max;\n\n const commit = (next: string[]) => {\n if (isDisabled) {\n return;\n }\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n };\n\n const toggle = (id: string) => {\n if (mode === \"single\") {\n commit(selected[0] === id ? [] : [id]);\n setOpen(false);\n return;\n }\n if (selected.includes(id)) {\n commit(selected.filter((item) => item !== id));\n } else if (!atMax) {\n commit([...selected, id]);\n }\n };\n\n const chosen = selected.map((id) => byId.get(id) ?? { id, title: id });\n const canReorder = isReorderable && mode === \"multiple\" && chosen.length > 1;\n\n const row = (item: EntryItem): ReactNode => (\n <>\n <Thumb item={item} />\n <span className=\"ds-entry__body\">\n <span className=\"ds-entry__title\">{item.title}</span>\n {item.subtitle && <span className=\"ds-entry__subtitle\">{item.subtitle}</span>}\n </span>\n </>\n );\n\n return (\n <FieldGroup\n {...fieldProps}\n className={cx(\"ds-entry-picker\", className)}\n label={label}\n count={selected.length}\n limit={fieldProps.limit ?? selectionLimit(mode, selected.length, max)}\n >\n {chosen.length === 0 ? (\n <p className=\"ds-entry-picker__empty\">{emptyLabel}</p>\n ) : canReorder ? (\n <SortableList\n items={selected}\n onReorder={commit}\n isDisabled={isDisabled}\n >\n {chosen.map((item) => (\n <SortableListItem\n key={item.id}\n id={item.id}\n label={item.title}\n action={\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"x\"\n aria-label={`Remove ${item.title}`}\n isDisabled={isDisabled}\n onClick={() => commit(selected.filter((id) => id !== item.id))}\n />\n }\n >\n <div className=\"ds-entry\">{row(item)}</div>\n </SortableListItem>\n ))}\n </SortableList>\n ) : (\n <ul className=\"ds-entry-picker__list\">\n {chosen.map((item) => (\n <li\n key={item.id}\n className=\"ds-entry-picker__row\"\n >\n <div className=\"ds-entry\">{row(item)}</div>\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"x\"\n aria-label={`Remove ${item.title}`}\n isDisabled={isDisabled}\n onClick={() => commit(selected.filter((id) => id !== item.id))}\n />\n </li>\n ))}\n </ul>\n )}\n\n <div className=\"ds-entry-picker__actions\">\n <Button\n variant=\"neutral\"\n size=\"sm\"\n iconStart=\"plus\"\n isDisabled={isDisabled}\n onClick={() => setOpen(true)}\n >\n {addLabel}\n </Button>\n {selected.length > 0 && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isDisabled={isDisabled}\n onClick={() => commit([])}\n >\n Clear\n </Button>\n )}\n </div>\n\n <Modal\n isOpen={isOpen}\n onClose={() => setOpen(false)}\n title={addLabel}\n description={\n mode === \"single\"\n ? `Choose one ${itemLabel}.`\n : max !== undefined\n ? `Choose up to ${max} ${itemsLabel}.`\n : `Choose as many ${itemsLabel} as you need.`\n }\n footer={\n <Button\n variant=\"primary\"\n onClick={() => setOpen(false)}\n >\n Done\n </Button>\n }\n >\n <div className=\"ds-entry-picker__search\">\n <SearchField\n value={query}\n placeholder={`Search ${itemsLabel}`}\n onChange={(event) => setQuery(event.target.value)}\n onClear={() => setQuery(\"\")}\n />\n </div>\n <ul className=\"ds-entry-picker__results\">\n {results.map((item) => {\n const isSelected = selected.includes(item.id);\n const isBlocked = isDisabled || item.isDisabled || (!isSelected && atMax);\n return (\n <li key={item.id}>\n <Button\n variant={isSelected ? \"active\" : \"simple\"}\n size=\"lg\"\n className=\"ds-entry-picker__result\"\n aria-pressed={isSelected}\n isDisabled={Boolean(isBlocked)}\n onClick={() => toggle(item.id)}\n >\n <span className=\"ds-entry\">{row(item)}</span>\n {isSelected && (\n <Icon\n name=\"check\"\n size={20}\n />\n )}\n </Button>\n </li>\n );\n })}\n {results.length === 0 && (\n <li className=\"ds-entry-picker__no-results\">\n No {itemsLabel} match “{query}”.\n </li>\n )}\n </ul>\n </Modal>\n </FieldGroup>\n );\n}\n"],"mappings":";;;;;;;;;AAOA,SAAgBI,EACd,GACA,GACA,GACwB;CACxB,OAAOC,MAAS,cAAcC,MAAQ,KAA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AK,WAAU;KACb,UAAA,kBAAC0B,GAAD;MACE,OAAOtC;MACP,aAAa,UAAUqC;MACvB,WAAW,MAAUxB,EAAS0B,EAAM,OAAO,KAAK;MAChD,eAAe1B,EAAS,EAAE;KAC3B,CAAA;IACE,CAAA,GACL,kBAAC,MAAD;KAAI,WAAU;KAAd,UAAA,CACGI,EAAQ,KAAK,MAAS;MACrB,IAAMuB,IAAa/B,EAAS,SAASR,EAAK,EAAE,GACtCwC,IAAYrB,KAAcnB,EAAK,cAAe,CAACuC,KAActB;MACnE,OACE,kBAAC,MAAD,EAAA,UACE,kBAACe,GAAD;OACE,SAASO,IAAa,WAAW;OACjC,MAAK;OACL,WAAU;OACV,gBAAcA;OACd,YAAY,EAAQC;OACpB,eAAelB,EAAOtB,EAAK,EAAE;OAN/B,UAAA,CAQE,kBAAC,QAAD;QAAM,WAAU;QAAY,UAAA2B,EAAI3B,CAAI;OAAQ,CAAA,GAC3CuC,KACC,kBAACjD,GAAD;QACE,MAAK;QACL,MAAM;OACP,CAAA,CAEG;MACN,CAAA,EAAA,GAjBKU,EAAK,EAiBV;KAER,CAAC,GACAgB,EAAQ,WAAW,KAClB,kBAAC,MAAD;MAAI,WAAU;MAAd,UAAA;OAA4C;OACtCoB;OAAW;OAASrC;OAAM;MAC5B;KAEJ,CAAA,CAAA;IACC,CAAA,CAAA;;EACG;;AAEhB"}
1
+ {"version":3,"file":"EntryPicker-B88N69zH.js","names":["_Fragment","Icon","FieldGroup","Fragment$1","selectionLimit","mode","max","cx","parts","matches","query","item","Thumb","EntryPicker","fieldProps","internal","setInternal","useState","defaultValue","selected","value","isOpen","setOpen","setQuery","byId","useMemo","items","results","atMax","commit","isDisabled","next","onValueChange","toggle","id","chosen","canReorder","isReorderable","row","className","emptyLabel","SortableList","SortableListItem","Button","addLabel","Modal","itemLabel","itemsLabel","SearchField","event","isSelected","isBlocked"],"sources":["../../src/components/EntryPicker/limit.ts","../../src/components/EntryPicker/index.tsx"],"sourcesContent":["import type { FieldLimit } from \"../Field/types\";\nimport type { EntryPickerMode } from \".\";\n\n/**\n * Only an explicitly capped multiple selection has a usage limit. Pure, so\n * FormEditor's model derives the same server-rendered limit the picker reports.\n */\nexport function selectionLimit(\n mode: EntryPickerMode,\n count: number,\n max: number | undefined,\n): FieldLimit | undefined {\n return mode === \"multiple\" && max !== undefined ? { count, max } : undefined;\n}\n","import { useMemo, useState, type ReactNode } from \"react\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { Modal } from \"../Modal\";\nimport { SearchField } from \"../SearchField\";\nimport { SortableList, SortableListItem } from \"../SortableList\";\nimport { selectionLimit } from \"./limit\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface EntryItem {\n id: string;\n title: string;\n /** Second line — a content type, a path, a file size. */\n subtitle?: string;\n /** Main image: an asset thumbnail, or the entry's hero. */\n imageUrl?: string;\n /** Words the search matches on top of the title and subtitle. */\n keywords?: string[];\n isDisabled?: boolean;\n}\n\nexport type EntryPickerMode = \"single\" | \"multiple\";\n\nexport interface EntryPickerProps extends Omit<FieldGroupProps, \"children\" | \"label\" | \"count\"> {\n items: EntryItem[];\n /** Selected ids, in the order they will be stored. */\n value?: string[];\n defaultValue?: string[];\n onValueChange?: (value: string[]) => void;\n mode?: EntryPickerMode;\n /** Cap a multiple selection. Reaching it disables the unpicked rows. */\n max?: number;\n label?: string;\n /** Copy shown when nothing is picked yet. */\n emptyLabel?: string;\n addLabel?: string;\n itemLabel?: string;\n itemsLabel?: string;\n /** Multiple selections are reorderable by default — the stored order is the shown order. */\n isReorderable?: boolean;\n isDisabled?: boolean;\n className?: string;\n}\n\nfunction matches(item: EntryItem, query: string) {\n if (!query) {\n return true;\n }\n const haystack = [item.title, item.subtitle, ...(item.keywords ?? [])]\n .filter(Boolean)\n .join(\" \")\n .toLowerCase();\n return haystack.includes(query.toLowerCase());\n}\n\nfunction Thumb({ item }: { item: EntryItem }) {\n return (\n <span className=\"ds-entry__thumb\">\n {item.imageUrl ? (\n <img\n src={item.imageUrl}\n alt=\"\"\n loading=\"lazy\"\n />\n ) : (\n <Icon\n name=\"file-text\"\n size={20}\n />\n )}\n </span>\n );\n}\n\n/**\n * Pick entries or assets out of a list. Search narrows it, a row toggles,\n * and a multiple selection keeps — and reorders — the order you chose.\n */\nexport function EntryPicker({\n items,\n value,\n defaultValue = [],\n onValueChange,\n mode = \"multiple\",\n max,\n label = \"Entries\",\n emptyLabel = \"Nothing selected yet.\",\n addLabel = \"Choose entries\",\n itemLabel = \"entry\",\n itemsLabel = \"entries\",\n isReorderable = true,\n isDisabled = false,\n className,\n ...fieldProps\n}: EntryPickerProps) {\n const [internal, setInternal] = useState<string[]>(defaultValue);\n const selected = value ?? internal;\n const [isOpen, setOpen] = useState(false);\n const [query, setQuery] = useState(\"\");\n\n const byId = useMemo(() => new Map(items.map((item) => [item.id, item])), [items]);\n const results = useMemo(() => items.filter((item) => matches(item, query)), [items, query]);\n const atMax = mode === \"multiple\" && max !== undefined && selected.length >= max;\n\n const commit = (next: string[]) => {\n if (isDisabled) {\n return;\n }\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n };\n\n const toggle = (id: string) => {\n if (mode === \"single\") {\n commit(selected[0] === id ? [] : [id]);\n setOpen(false);\n return;\n }\n if (selected.includes(id)) {\n commit(selected.filter((item) => item !== id));\n } else if (!atMax) {\n commit([...selected, id]);\n }\n };\n\n const chosen = selected.map((id) => byId.get(id) ?? { id, title: id });\n const canReorder = isReorderable && mode === \"multiple\" && chosen.length > 1;\n\n const row = (item: EntryItem): ReactNode => (\n <>\n <Thumb item={item} />\n <span className=\"ds-entry__body\">\n <span className=\"ds-entry__title\">{item.title}</span>\n {item.subtitle && <span className=\"ds-entry__subtitle\">{item.subtitle}</span>}\n </span>\n </>\n );\n\n return (\n <FieldGroup\n {...fieldProps}\n className={cx(\"ds-entry-picker\", className)}\n label={label}\n count={selected.length}\n limit={fieldProps.limit ?? selectionLimit(mode, selected.length, max)}\n >\n {chosen.length === 0 ? (\n <p className=\"ds-entry-picker__empty\">{emptyLabel}</p>\n ) : canReorder ? (\n <SortableList\n items={selected}\n onReorder={commit}\n isDisabled={isDisabled}\n >\n {chosen.map((item) => (\n <SortableListItem\n key={item.id}\n id={item.id}\n label={item.title}\n action={\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"x\"\n aria-label={`Remove ${item.title}`}\n isDisabled={isDisabled}\n onClick={() => commit(selected.filter((id) => id !== item.id))}\n />\n }\n >\n <div className=\"ds-entry\">{row(item)}</div>\n </SortableListItem>\n ))}\n </SortableList>\n ) : (\n <ul className=\"ds-entry-picker__list\">\n {chosen.map((item) => (\n <li\n key={item.id}\n className=\"ds-entry-picker__row\"\n >\n <div className=\"ds-entry\">{row(item)}</div>\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"x\"\n aria-label={`Remove ${item.title}`}\n isDisabled={isDisabled}\n onClick={() => commit(selected.filter((id) => id !== item.id))}\n />\n </li>\n ))}\n </ul>\n )}\n\n <div className=\"ds-entry-picker__actions\">\n <Button\n variant=\"neutral\"\n size=\"sm\"\n iconStart=\"plus\"\n isDisabled={isDisabled}\n onClick={() => setOpen(true)}\n >\n {addLabel}\n </Button>\n {selected.length > 0 && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isDisabled={isDisabled}\n onClick={() => commit([])}\n >\n Clear\n </Button>\n )}\n </div>\n\n <Modal\n isOpen={isOpen}\n onClose={() => setOpen(false)}\n title={addLabel}\n description={\n mode === \"single\"\n ? `Choose one ${itemLabel}.`\n : max !== undefined\n ? `Choose up to ${max} ${itemsLabel}.`\n : `Choose as many ${itemsLabel} as you need.`\n }\n footer={\n <Button\n variant=\"primary\"\n onClick={() => setOpen(false)}\n >\n Done\n </Button>\n }\n >\n <div className=\"ds-entry-picker__search\">\n <SearchField\n value={query}\n placeholder={`Search ${itemsLabel}`}\n onChange={(event) => setQuery(event.target.value)}\n onClear={() => setQuery(\"\")}\n />\n </div>\n <ul className=\"ds-entry-picker__results\">\n {results.map((item) => {\n const isSelected = selected.includes(item.id);\n const isBlocked = isDisabled || item.isDisabled || (!isSelected && atMax);\n return (\n <li key={item.id}>\n <Button\n variant={isSelected ? \"active\" : \"simple\"}\n size=\"lg\"\n className=\"ds-entry-picker__result\"\n aria-pressed={isSelected}\n isDisabled={Boolean(isBlocked)}\n onClick={() => toggle(item.id)}\n >\n <span className=\"ds-entry\">{row(item)}</span>\n {isSelected && (\n <Icon\n name=\"check\"\n size={20}\n />\n )}\n </Button>\n </li>\n );\n })}\n {results.length === 0 && (\n <li className=\"ds-entry-picker__no-results\">\n No {itemsLabel} match “{query}”.\n </li>\n )}\n </ul>\n </Modal>\n </FieldGroup>\n );\n}\n"],"mappings":";;;;;;;;;AAOA,SAAgBI,EACd,GACA,GACA,GACwB;CACxB,OAAOC,MAAS,cAAcC,MAAQ,KAAA,IAAY;EAAE;EAAO;CAAI,IAAI,KAAA;AACrE;;;ACHA,SAASC,EAAG,GAAGC,GAAuC;CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACvC;AAqCA,SAASC,EAAQ,GAAiB,GAAe;CAQ/C,OAPA,CAAKC,KAGY;EAACC,EAAK;EAAOA,EAAK;EAAU,GAAIA,EAAK,YAAY,CAAC;CAAE,CAAC,CACnE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,CAAC,CACT,YACI,CAAA,CAAS,SAASD,EAAM,YAAY,CAAC;AAC9C;AAEA,SAASE,EAAM,EAAE,WAA6B;CAC5C,OACE,kBAAC,QAAD;EAAM,WAAU;EACb,UAAAD,EAAK,WACJ,kBAAC,OAAD;GACE,KAAKA,EAAK;GACV,KAAI;GACJ,SAAQ;EACT,CAAA,IAED,kBAACV,GAAD;GACE,MAAK;GACL,MAAM;EACP,CAAA;CAEC,CAAA;A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AACjD,GAAD;QACE,MAAK;QACL,MAAM;OACP,CAAA,CAEG;MACN,CAAA,EAAA,GAjBKU,EAAK,EAiBV;KAER,CAAC,GACAgB,EAAQ,WAAW,KAClB,kBAAC,MAAD;MAAI,WAAU;MAAd,UAAA;OAA4C;OACtCoB;OAAW;OAASrC;OAAM;MAC5B;KAEJ,CAAA,CAAA;IACC,CAAA,CAAA;;EACG;;AAEhB"}
@@ -1,2 +1,2 @@
1
- const e=require("./Icon-WOhlu6Rp.cjs"),t=require("../components/Button/index.cjs"),n=require("../components/Modal/index.cjs"),r=require("./group-Bj9ZKc0R.cjs"),i=require("../components/SearchField/index.cjs"),a=require("../components/SortableList/index.cjs");let o=require("react"),s=require("react/jsx-runtime");function c(e,t,n){return e===`multiple`&&n!==void 0?{count:t,max:n}:void 0}function l(...e){return e.filter(Boolean).join(` `)}function u(e,t){return!t||[e.title,e.subtitle,...e.keywords??[]].filter(Boolean).join(` `).toLowerCase().includes(t.toLowerCase())}function d({item:t}){return(0,s.jsx)(`span`,{className:`ds-entry__thumb`,children:t.imageUrl?(0,s.jsx)(`img`,{src:t.imageUrl,alt:``,loading:`lazy`}):(0,s.jsx)(e.t,{name:`file-text`,size:20})})}function f({items:f,value:p,defaultValue:m=[],onValueChange:h,mode:g=`multiple`,max:_,label:v=`Entries`,emptyLabel:y=`Nothing selected yet.`,addLabel:b=`Choose entries`,itemLabel:x=`entry`,itemsLabel:S=`entries`,isReorderable:C=!0,isDisabled:w=!1,className:T,...E}){let[D,O]=(0,o.useState)(m),k=p??D,[A,j]=(0,o.useState)(!1),[M,N]=(0,o.useState)(``),P=(0,o.useMemo)(()=>new Map(f.map(e=>[e.id,e])),[f]),F=(0,o.useMemo)(()=>f.filter(e=>u(e,M)),[f,M]),I=g===`multiple`&&_!==void 0&&k.length>=_,L=e=>{w||(p===void 0&&O(e),h?.(e))},R=e=>{g===`single`?(L(k[0]===e?[]:[e]),j(!1)):k.includes(e)?L(k.filter(t=>t!==e)):I||L([...k,e])},z=k.map(e=>P.get(e)??{id:e,title:e}),B=C&&g===`multiple`&&z.length>1,V=e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d,{item:e}),(0,s.jsxs)(`span`,{className:`ds-entry__body`,children:[(0,s.jsx)(`span`,{className:`ds-entry__title`,children:e.title}),e.subtitle&&(0,s.jsx)(`span`,{className:`ds-entry__subtitle`,children:e.subtitle})]})]});return(0,s.jsxs)(r.t,{...E,className:l(`ds-entry-picker`,T),label:v,count:k.length,limit:E.limit??c(g,k.length,_),children:[z.length===0?(0,s.jsx)(`p`,{className:`ds-entry-picker__empty`,children:y}):B?(0,s.jsx)(a.SortableList,{items:k,onReorder:L,isDisabled:w,children:z.map(e=>(0,s.jsx)(a.SortableListItem,{id:e.id,label:e.title,action:(0,s.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`x`,"aria-label":`Remove ${e.title}`,isDisabled:w,onClick:()=>L(k.filter(t=>t!==e.id))}),children:(0,s.jsx)(`div`,{className:`ds-entry`,children:V(e)})},e.id))}):(0,s.jsx)(`ul`,{className:`ds-entry-picker__list`,children:z.map(e=>(0,s.jsxs)(`li`,{className:`ds-entry-picker__row`,children:[(0,s.jsx)(`div`,{className:`ds-entry`,children:V(e)}),(0,s.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`x`,"aria-label":`Remove ${e.title}`,isDisabled:w,onClick:()=>L(k.filter(t=>t!==e.id))})]},e.id))}),(0,s.jsxs)(`div`,{className:`ds-entry-picker__actions`,children:[(0,s.jsx)(t.Button,{variant:`neutral`,size:`sm`,iconStart:`plus`,isDisabled:w,onClick:()=>j(!0),children:b}),k.length>0&&(0,s.jsx)(t.Button,{variant:`simple`,size:`sm`,isDisabled:w,onClick:()=>L([]),children:`Clear`})]}),(0,s.jsxs)(n.Modal,{isOpen:A,onClose:()=>j(!1),title:b,description:g===`single`?`Choose one ${x}.`:_===void 0?`Choose as many ${S} as you need.`:`Choose up to ${_} ${S}.`,footer:(0,s.jsx)(t.Button,{variant:`primary`,onClick:()=>j(!1),children:`Done`}),children:[(0,s.jsx)(`div`,{className:`ds-entry-picker__search`,children:(0,s.jsx)(i.SearchField,{value:M,placeholder:`Search ${S}`,onChange:e=>N(e.target.value),onClear:()=>N(``)})}),(0,s.jsxs)(`ul`,{className:`ds-entry-picker__results`,children:[F.map(n=>{let r=k.includes(n.id),i=w||n.isDisabled||!r&&I;return(0,s.jsx)(`li`,{children:(0,s.jsxs)(t.Button,{variant:r?`active`:`simple`,size:`lg`,className:`ds-entry-picker__result`,"aria-pressed":r,isDisabled:!!i,onClick:()=>R(n.id),children:[(0,s.jsx)(`span`,{className:`ds-entry`,children:V(n)}),r&&(0,s.jsx)(e.t,{name:`check`,size:20})]})},n.id)}),F.length===0&&(0,s.jsxs)(`li`,{className:`ds-entry-picker__no-results`,children:[`No `,S,` match “`,M,`”.`]})]})]})]})}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
2
- //# sourceMappingURL=EntryPicker-D7JIgx23.cjs.map
1
+ const e=require("./Icon-WOhlu6Rp.cjs"),t=require("../components/Button/index.cjs"),n=require("../components/Modal/index.cjs"),r=require("./group-QSnlx4jX.cjs"),i=require("../components/SearchField/index.cjs"),a=require("../components/SortableList/index.cjs");let o=require("react"),s=require("react/jsx-runtime");function c(e,t,n){return e===`multiple`&&n!==void 0?{count:t,max:n}:void 0}function l(...e){return e.filter(Boolean).join(` `)}function u(e,t){return!t||[e.title,e.subtitle,...e.keywords??[]].filter(Boolean).join(` `).toLowerCase().includes(t.toLowerCase())}function d({item:t}){return(0,s.jsx)(`span`,{className:`ds-entry__thumb`,children:t.imageUrl?(0,s.jsx)(`img`,{src:t.imageUrl,alt:``,loading:`lazy`}):(0,s.jsx)(e.t,{name:`file-text`,size:20})})}function f({items:f,value:p,defaultValue:m=[],onValueChange:h,mode:g=`multiple`,max:_,label:v=`Entries`,emptyLabel:y=`Nothing selected yet.`,addLabel:b=`Choose entries`,itemLabel:x=`entry`,itemsLabel:S=`entries`,isReorderable:C=!0,isDisabled:w=!1,className:T,...E}){let[D,O]=(0,o.useState)(m),k=p??D,[A,j]=(0,o.useState)(!1),[M,N]=(0,o.useState)(``),P=(0,o.useMemo)(()=>new Map(f.map(e=>[e.id,e])),[f]),F=(0,o.useMemo)(()=>f.filter(e=>u(e,M)),[f,M]),I=g===`multiple`&&_!==void 0&&k.length>=_,L=e=>{w||(p===void 0&&O(e),h?.(e))},R=e=>{g===`single`?(L(k[0]===e?[]:[e]),j(!1)):k.includes(e)?L(k.filter(t=>t!==e)):I||L([...k,e])},z=k.map(e=>P.get(e)??{id:e,title:e}),B=C&&g===`multiple`&&z.length>1,V=e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d,{item:e}),(0,s.jsxs)(`span`,{className:`ds-entry__body`,children:[(0,s.jsx)(`span`,{className:`ds-entry__title`,children:e.title}),e.subtitle&&(0,s.jsx)(`span`,{className:`ds-entry__subtitle`,children:e.subtitle})]})]});return(0,s.jsxs)(r.t,{...E,className:l(`ds-entry-picker`,T),label:v,count:k.length,limit:E.limit??c(g,k.length,_),children:[z.length===0?(0,s.jsx)(`p`,{className:`ds-entry-picker__empty`,children:y}):B?(0,s.jsx)(a.SortableList,{items:k,onReorder:L,isDisabled:w,children:z.map(e=>(0,s.jsx)(a.SortableListItem,{id:e.id,label:e.title,action:(0,s.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`x`,"aria-label":`Remove ${e.title}`,isDisabled:w,onClick:()=>L(k.filter(t=>t!==e.id))}),children:(0,s.jsx)(`div`,{className:`ds-entry`,children:V(e)})},e.id))}):(0,s.jsx)(`ul`,{className:`ds-entry-picker__list`,children:z.map(e=>(0,s.jsxs)(`li`,{className:`ds-entry-picker__row`,children:[(0,s.jsx)(`div`,{className:`ds-entry`,children:V(e)}),(0,s.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`x`,"aria-label":`Remove ${e.title}`,isDisabled:w,onClick:()=>L(k.filter(t=>t!==e.id))})]},e.id))}),(0,s.jsxs)(`div`,{className:`ds-entry-picker__actions`,children:[(0,s.jsx)(t.Button,{variant:`neutral`,size:`sm`,iconStart:`plus`,isDisabled:w,onClick:()=>j(!0),children:b}),k.length>0&&(0,s.jsx)(t.Button,{variant:`simple`,size:`sm`,isDisabled:w,onClick:()=>L([]),children:`Clear`})]}),(0,s.jsxs)(n.Modal,{isOpen:A,onClose:()=>j(!1),title:b,description:g===`single`?`Choose one ${x}.`:_===void 0?`Choose as many ${S} as you need.`:`Choose up to ${_} ${S}.`,footer:(0,s.jsx)(t.Button,{variant:`primary`,onClick:()=>j(!1),children:`Done`}),children:[(0,s.jsx)(`div`,{className:`ds-entry-picker__search`,children:(0,s.jsx)(i.SearchField,{value:M,placeholder:`Search ${S}`,onChange:e=>N(e.target.value),onClear:()=>N(``)})}),(0,s.jsxs)(`ul`,{className:`ds-entry-picker__results`,children:[F.map(n=>{let r=k.includes(n.id),i=w||n.isDisabled||!r&&I;return(0,s.jsx)(`li`,{children:(0,s.jsxs)(t.Button,{variant:r?`active`:`simple`,size:`lg`,className:`ds-entry-picker__result`,"aria-pressed":r,isDisabled:!!i,onClick:()=>R(n.id),children:[(0,s.jsx)(`span`,{className:`ds-entry`,children:V(n)}),r&&(0,s.jsx)(e.t,{name:`check`,size:20})]})},n.id)}),F.length===0&&(0,s.jsxs)(`li`,{className:`ds-entry-picker__no-results`,children:[`No `,S,` match “`,M,`”.`]})]})]})]})}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
2
+ //# sourceMappingURL=EntryPicker-daSkD4aR.cjs.map