@planningcenter/tapestry 4.13.0 → 4.14.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 (261) hide show
  1. package/dist/componentRegistrars.d.ts +1 -0
  2. package/dist/componentRegistrars.d.ts.map +1 -1
  3. package/dist/componentRegistrars.js +7 -1
  4. package/dist/componentRegistrars.js.map +1 -1
  5. package/dist/components/DataTable/ActiveFilterInstance.d.ts +3 -3
  6. package/dist/components/DataTable/ActiveFilterInstance.d.ts.map +1 -1
  7. package/dist/components/DataTable/ActiveFilterInstance.js +5 -5
  8. package/dist/components/DataTable/ActiveFilterInstance.js.map +1 -1
  9. package/dist/components/DataTable/ActiveFilters.d.ts +3 -3
  10. package/dist/components/DataTable/ActiveFilters.d.ts.map +1 -1
  11. package/dist/components/DataTable/ActiveFilters.js +11 -6
  12. package/dist/components/DataTable/ActiveFilters.js.map +1 -1
  13. package/dist/components/DataTable/DataTable.d.ts +49 -28
  14. package/dist/components/DataTable/DataTable.d.ts.map +1 -1
  15. package/dist/components/DataTable/DataTable.js +80 -41
  16. package/dist/components/DataTable/DataTable.js.map +1 -1
  17. package/dist/components/DataTable/DataTableColumn.d.ts +29 -5
  18. package/dist/components/DataTable/DataTableColumn.d.ts.map +1 -1
  19. package/dist/components/DataTable/DataTableColumnTypes.d.ts +2 -2
  20. package/dist/components/DataTable/DataTableColumnTypes.d.ts.map +1 -1
  21. package/dist/components/DataTable/DataTableColumnTypes.js +15 -12
  22. package/dist/components/DataTable/DataTableColumnTypes.js.map +1 -1
  23. package/dist/components/DataTable/DeleteSavedViewAlertDialog.d.ts +1 -1
  24. package/dist/components/DataTable/DeleteSavedViewAlertDialog.d.ts.map +1 -1
  25. package/dist/components/DataTable/DeleteSavedViewAlertDialog.js.map +1 -1
  26. package/dist/components/DataTable/FilterTypes.d.ts +2 -0
  27. package/dist/components/DataTable/FilterTypes.d.ts.map +1 -1
  28. package/dist/components/DataTable/ManageViewsButton.d.ts +9 -0
  29. package/dist/components/DataTable/ManageViewsButton.d.ts.map +1 -0
  30. package/dist/components/DataTable/{ManageSavedViewsButton.js → ManageViewsButton.js} +5 -5
  31. package/dist/components/DataTable/ManageViewsButton.js.map +1 -0
  32. package/dist/components/DataTable/{ManageSavedViewsModal.d.ts → ManageViewsModal.d.ts} +7 -7
  33. package/dist/components/DataTable/ManageViewsModal.d.ts.map +1 -0
  34. package/dist/components/DataTable/{ManageSavedViewsModal.js → ManageViewsModal.js} +10 -10
  35. package/dist/components/DataTable/ManageViewsModal.js.map +1 -0
  36. package/dist/components/DataTable/ManageViewsModal.module.css.js +4 -0
  37. package/dist/components/DataTable/ManageViewsModal.module.css.js.map +1 -0
  38. package/dist/components/DataTable/NewSavedViewButton.js +1 -1
  39. package/dist/components/DataTable/NewSavedViewButton.js.map +1 -1
  40. package/dist/components/DataTable/OperatorSelect.js +4 -1
  41. package/dist/components/DataTable/OperatorSelect.js.map +1 -1
  42. package/dist/components/DataTable/RowActions.d.ts +11 -0
  43. package/dist/components/DataTable/RowActions.d.ts.map +1 -1
  44. package/dist/components/DataTable/RowActions.js +7 -4
  45. package/dist/components/DataTable/RowActions.js.map +1 -1
  46. package/dist/components/DataTable/TableActions.d.ts +5 -0
  47. package/dist/components/DataTable/TableActions.d.ts.map +1 -1
  48. package/dist/components/DataTable/TableActions.js +2 -1
  49. package/dist/components/DataTable/TableActions.js.map +1 -1
  50. package/dist/components/DataTable/ViewMenu.d.ts +18 -0
  51. package/dist/components/DataTable/ViewMenu.d.ts.map +1 -0
  52. package/dist/components/DataTable/{SavedViewMenu.js → ViewMenu.js} +5 -5
  53. package/dist/components/DataTable/ViewMenu.js.map +1 -0
  54. package/dist/components/DataTable/{SavedViewsBar.d.ts → ViewsBar.d.ts} +11 -11
  55. package/dist/components/DataTable/ViewsBar.d.ts.map +1 -0
  56. package/dist/components/DataTable/{SavedViewsBar.js → ViewsBar.js} +34 -28
  57. package/dist/components/DataTable/ViewsBar.js.map +1 -0
  58. package/dist/components/DataTable/dateFilter.d.ts +19 -3
  59. package/dist/components/DataTable/dateFilter.d.ts.map +1 -1
  60. package/dist/components/DataTable/dateFilter.js +36 -11
  61. package/dist/components/DataTable/dateFilter.js.map +1 -1
  62. package/dist/components/DataTable/dayFilter.d.ts.map +1 -1
  63. package/dist/components/DataTable/dayFilter.js +25 -22
  64. package/dist/components/DataTable/dayFilter.js.map +1 -1
  65. package/dist/components/DataTable/index.d.ts +3 -3
  66. package/dist/components/DataTable/index.d.ts.map +1 -1
  67. package/dist/components/DataTable/scopedFilter.d.ts +1 -1
  68. package/dist/components/DataTable/scopedFilter.d.ts.map +1 -1
  69. package/dist/components/DataTable/scopedFilter.js +56 -35
  70. package/dist/components/DataTable/scopedFilter.js.map +1 -1
  71. package/dist/components/DataTable/useActiveView.d.ts +7 -0
  72. package/dist/components/DataTable/useActiveView.d.ts.map +1 -0
  73. package/dist/components/DataTable/{useActiveSavedView.js → useActiveView.js} +5 -5
  74. package/dist/components/DataTable/useActiveView.js.map +1 -0
  75. package/dist/components/DataTable/useColumnVisibility.d.ts +12 -8
  76. package/dist/components/DataTable/useColumnVisibility.d.ts.map +1 -1
  77. package/dist/components/DataTable/useColumnVisibility.js +28 -16
  78. package/dist/components/DataTable/useColumnVisibility.js.map +1 -1
  79. package/dist/components/DataTable/useSaveStatus.d.ts +6 -6
  80. package/dist/components/DataTable/useSaveStatus.d.ts.map +1 -1
  81. package/dist/components/DataTable/useSaveStatus.js +7 -7
  82. package/dist/components/DataTable/useSaveStatus.js.map +1 -1
  83. package/dist/components/DataTable/useSavedViewNameModal.d.ts +2 -2
  84. package/dist/components/DataTable/useSavedViewNameModal.d.ts.map +1 -1
  85. package/dist/components/DataTable/useSavedViewNameModal.js +2 -2
  86. package/dist/components/DataTable/useSavedViewNameModal.js.map +1 -1
  87. package/dist/components/DataTable/useSavedViewsClient.d.ts +3 -3
  88. package/dist/components/DataTable/useSavedViewsClient.d.ts.map +1 -1
  89. package/dist/components/DataTable/useSavedViewsClient.js +1 -1
  90. package/dist/components/DataTable/useSavedViewsClient.js.map +1 -1
  91. package/dist/components/DataTable/useSavedViewsState.d.ts +7 -7
  92. package/dist/components/DataTable/useSavedViewsState.d.ts.map +1 -1
  93. package/dist/components/DataTable/useSavedViewsState.js +1 -1
  94. package/dist/components/DataTable/useSavedViewsState.js.map +1 -1
  95. package/dist/components/DataTable/useSearchFilter.d.ts.map +1 -1
  96. package/dist/components/DataTable/useSearchFilter.js +2 -1
  97. package/dist/components/DataTable/useSearchFilter.js.map +1 -1
  98. package/dist/components/DataTable/useUpdateSavedViewName.d.ts +1 -1
  99. package/dist/components/DataTable/useUpdateSavedViewName.d.ts.map +1 -1
  100. package/dist/components/DataTable/useUpdateSavedViewName.js.map +1 -1
  101. package/dist/components/DataTable/{useVisibleSavedViews.d.ts → useVisibleViews.d.ts} +2 -2
  102. package/dist/components/DataTable/useVisibleViews.d.ts.map +1 -0
  103. package/dist/components/DataTable/{useVisibleSavedViews.js → useVisibleViews.js} +6 -6
  104. package/dist/components/DataTable/useVisibleViews.js.map +1 -0
  105. package/dist/components/DataTable/views.d.ts +56 -0
  106. package/dist/components/DataTable/views.d.ts.map +1 -0
  107. package/dist/components/DataTable/{savedViews.js → views.js} +12 -11
  108. package/dist/components/DataTable/views.js.map +1 -0
  109. package/dist/components/button/ActionsDropdownIconButton.d.ts +2 -2
  110. package/dist/components/button/ActionsDropdownIconButton.d.ts.map +1 -1
  111. package/dist/components/button/ActionsDropdownIconButton.js.map +1 -1
  112. package/dist/components/button/IconButton.d.ts +2 -2
  113. package/dist/components/button/IconButton.d.ts.map +1 -1
  114. package/dist/components/button/IconButton.js.map +1 -1
  115. package/dist/components/checkbox-group/CheckboxGroup.d.ts +3 -1
  116. package/dist/components/checkbox-group/CheckboxGroup.d.ts.map +1 -1
  117. package/dist/components/checkbox-group/CheckboxGroup.js +2 -2
  118. package/dist/components/checkbox-group/CheckboxGroup.js.map +1 -1
  119. package/dist/components/date-picker/DatePicker.d.ts +7 -2
  120. package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
  121. package/dist/components/date-picker/DatePicker.js +69 -14
  122. package/dist/components/date-picker/DatePicker.js.map +1 -1
  123. package/dist/components/dropdown/Dropdown.d.ts.map +1 -1
  124. package/dist/components/dropdown/Dropdown.js +10 -2
  125. package/dist/components/dropdown/Dropdown.js.map +1 -1
  126. package/dist/components/link/BaseLink.js +3 -3
  127. package/dist/components/link/BaseLink.js.map +1 -1
  128. package/dist/components/link/IconLink.js +4 -4
  129. package/dist/components/link/IconLink.js.map +1 -1
  130. package/dist/components/link/Link.js +2 -2
  131. package/dist/components/link/Link.js.map +1 -1
  132. package/dist/components/page-header/defineElements.js +1 -1
  133. package/dist/components/radio-group/RadioGroup.d.ts +7 -1
  134. package/dist/components/radio-group/RadioGroup.d.ts.map +1 -1
  135. package/dist/components/radio-group/RadioGroup.js +2 -2
  136. package/dist/components/radio-group/RadioGroup.js.map +1 -1
  137. package/dist/components/sidenav/defineElements.js +1 -1
  138. package/dist/index.css +107 -27
  139. package/dist/index.css.map +1 -1
  140. package/dist/index.d.ts +1 -0
  141. package/dist/index.d.ts.map +1 -1
  142. package/dist/index.js +1 -0
  143. package/dist/index.js.map +1 -1
  144. package/dist/packages/tapestry-wc/dist/components/{p-CBFtMIxJ.js → p-Bw5XJ46l.js} +2 -2
  145. package/dist/packages/tapestry-wc/dist/components/{p-CBFtMIxJ.js.map → p-Bw5XJ46l.js.map} +1 -1
  146. package/dist/packages/tapestry-wc/dist/components/{p-BbuNAv9q.js → p-C5B21uv6.js} +3 -3
  147. package/dist/packages/tapestry-wc/dist/components/{p-BbuNAv9q.js.map → p-C5B21uv6.js.map} +1 -1
  148. package/dist/packages/tapestry-wc/dist/components/{p-DNHgMtxw.js → p-D4oSihjy.js} +2 -2
  149. package/dist/packages/tapestry-wc/dist/components/{p-DNHgMtxw.js.map → p-D4oSihjy.js.map} +1 -1
  150. package/dist/packages/tapestry-wc/dist/components/{p-A1JK45WV.js → p-DZA99jMW.js} +3 -3
  151. package/dist/packages/tapestry-wc/dist/components/{p-A1JK45WV.js.map → p-DZA99jMW.js.map} +1 -1
  152. package/dist/packages/tapestry-wc/dist/components/{p-CY_DC4d_.js → p-Dt250a7E.js} +3 -3
  153. package/dist/packages/tapestry-wc/dist/components/{p-CY_DC4d_.js.map → p-Dt250a7E.js.map} +1 -1
  154. package/dist/packages/tapestry-wc/dist/components/tds-page-header-nav.js +2 -2
  155. package/dist/packages/tapestry-wc/dist/components/tds-page-header-nav.js.map +1 -1
  156. package/dist/packages/tapestry-wc/dist/components/tds-page-header.js +5 -5
  157. package/dist/packages/tapestry-wc/dist/components/tds-page-header.js.map +1 -1
  158. package/dist/packages/tapestry-wc/dist/components/tds-sidenav-item.js +3 -3
  159. package/dist/packages/tapestry-wc/dist/components/tds-sidenav-item.js.map +1 -1
  160. package/dist/packages/tapestry-wc/dist/components/tds-sidenav-responsive-header.js +2 -2
  161. package/dist/packages/tapestry-wc/dist/components/tds-sidenav-responsive-header.js.map +1 -1
  162. package/dist/packages/tapestry-wc/dist/components/tds-sidenav-section.js +3 -3
  163. package/dist/packages/tapestry-wc/dist/components/tds-sidenav-section.js.map +1 -1
  164. package/dist/packages/tapestry-wc/dist/components/tds-sidenav.js +5 -5
  165. package/dist/packages/tapestry-wc/dist/components/tds-sidenav.js.map +1 -1
  166. package/dist/reactRender.css +864 -765
  167. package/dist/reactRender.css.map +1 -1
  168. package/dist/reactRender.js +1 -1
  169. package/dist/reactRenderLegacy.css +864 -765
  170. package/dist/reactRenderLegacy.css.map +1 -1
  171. package/dist/reactRenderLegacy.js +1 -1
  172. package/dist/tapestryMount.css +864 -765
  173. package/dist/tapestryMount.css.map +1 -1
  174. package/dist/tapestryMount.js +1 -1
  175. package/dist/tapestryMountLegacy.css +864 -765
  176. package/dist/tapestryMountLegacy.css.map +1 -1
  177. package/dist/tapestryMountLegacy.js +1 -1
  178. package/dist/unstable.css +381 -282
  179. package/dist/unstable.css.map +1 -1
  180. package/dist/unstable.js +1 -0
  181. package/dist/unstable.js.map +1 -1
  182. package/dist/utilities/dataHooks.d.ts +8 -0
  183. package/dist/utilities/dataHooks.d.ts.map +1 -0
  184. package/dist/utilities/dataHooks.js +7 -0
  185. package/dist/utilities/dataHooks.js.map +1 -0
  186. package/dist/utilities/locale.d.ts +25 -0
  187. package/dist/utilities/locale.d.ts.map +1 -0
  188. package/dist/utilities/locale.js +48 -0
  189. package/dist/utilities/locale.js.map +1 -0
  190. package/docs/accessibility/accessibility.md +62 -0
  191. package/docs/components/button-group.md +44 -0
  192. package/docs/components/button.md +78 -0
  193. package/docs/components/checkbox-group.md +51 -0
  194. package/docs/components/checkbox.md +55 -0
  195. package/docs/components/combo-box.md +68 -0
  196. package/docs/components/currency-input.md +50 -0
  197. package/docs/components/date-picker.md +67 -0
  198. package/docs/components/dropdown.md +74 -0
  199. package/docs/components/field.md +44 -0
  200. package/docs/components/flex.md +66 -0
  201. package/docs/components/input.md +62 -0
  202. package/docs/components/link.md +46 -0
  203. package/docs/components/modal.md +59 -0
  204. package/docs/components/number-stepper.md +50 -0
  205. package/docs/components/page-header.md +48 -0
  206. package/docs/components/popover.md +45 -0
  207. package/docs/components/radio-group.md +47 -0
  208. package/docs/components/radio.md +62 -0
  209. package/docs/components/search-input.md +46 -0
  210. package/docs/components/segmented-control.md +60 -0
  211. package/docs/components/select.md +62 -0
  212. package/docs/components/sidenav.md +36 -0
  213. package/docs/components/text-area.md +65 -0
  214. package/docs/components/time-field.md +62 -0
  215. package/docs/components/toggle-switch.md +56 -0
  216. package/docs/content/addressing-users-in-products.md +153 -0
  217. package/docs/content/browser-tabs.md +59 -0
  218. package/docs/content/capitalization.md +69 -0
  219. package/docs/content/date-formatting.md +145 -0
  220. package/docs/content/displaying-names.md +139 -0
  221. package/docs/content/editing-and-saving.md +95 -0
  222. package/docs/content/file-size-formatting.md +44 -0
  223. package/docs/content/household-ordering.md +127 -0
  224. package/docs/content/micro-copy.md +135 -0
  225. package/docs/content/prompts.md +271 -0
  226. package/docs/content/punctuation.md +71 -0
  227. package/docs/content/sharing-nomenclature.md +67 -0
  228. package/docs/content/timezones.md +108 -0
  229. package/docs/content/tooltip-usage.md +49 -0
  230. package/docs/content/use-of-emoji.md +63 -0
  231. package/docs/content/voice-and-tone.md +251 -0
  232. package/docs/design/design-tokens.md +70 -0
  233. package/docs/design/iconography.md +60 -0
  234. package/docs/design/layout.md +237 -0
  235. package/docs/design/mobile-design-principles.md +109 -0
  236. package/docs/design/pca-design-language.md +78 -0
  237. package/docs/design/typography.md +94 -0
  238. package/docs/get-started/design-system-philosophy.md +33 -0
  239. package/docs/llms.txt +119 -0
  240. package/package.json +7 -5
  241. package/react-types/index.d.ts +5 -0
  242. package/dist/components/DataTable/ManageSavedViewsButton.d.ts +0 -9
  243. package/dist/components/DataTable/ManageSavedViewsButton.d.ts.map +0 -1
  244. package/dist/components/DataTable/ManageSavedViewsButton.js.map +0 -1
  245. package/dist/components/DataTable/ManageSavedViewsModal.d.ts.map +0 -1
  246. package/dist/components/DataTable/ManageSavedViewsModal.js.map +0 -1
  247. package/dist/components/DataTable/ManageSavedViewsModal.module.css.js +0 -4
  248. package/dist/components/DataTable/ManageSavedViewsModal.module.css.js.map +0 -1
  249. package/dist/components/DataTable/SavedViewMenu.d.ts +0 -18
  250. package/dist/components/DataTable/SavedViewMenu.d.ts.map +0 -1
  251. package/dist/components/DataTable/SavedViewMenu.js.map +0 -1
  252. package/dist/components/DataTable/SavedViewsBar.d.ts.map +0 -1
  253. package/dist/components/DataTable/SavedViewsBar.js.map +0 -1
  254. package/dist/components/DataTable/savedViews.d.ts +0 -45
  255. package/dist/components/DataTable/savedViews.d.ts.map +0 -1
  256. package/dist/components/DataTable/savedViews.js.map +0 -1
  257. package/dist/components/DataTable/useActiveSavedView.d.ts +0 -7
  258. package/dist/components/DataTable/useActiveSavedView.d.ts.map +0 -1
  259. package/dist/components/DataTable/useActiveSavedView.js.map +0 -1
  260. package/dist/components/DataTable/useVisibleSavedViews.d.ts.map +0 -1
  261. package/dist/components/DataTable/useVisibleSavedViews.js.map +0 -1
@@ -13,7 +13,7 @@ import { useState, useRef, useLayoutEffect } from 'react';
13
13
  * The list's items land a render after the list, so call `measure` once
14
14
  * they're in the DOM.
15
15
  */
16
- function useVisibleSavedViews({ activeKey, items, listRef, newViewRef, }) {
16
+ function useVisibleViews({ activeKey, items, listRef, newViewRef, }) {
17
17
  // By `data-key`, which is a string.
18
18
  const [widths, setWidths] = useState(() => new Map());
19
19
  const [overflowWidth, setOverflowWidth] = useState();
@@ -126,9 +126,9 @@ function useVisibleSavedViews({ activeKey, items, listRef, newViewRef, }) {
126
126
  const isCollapsed = visibleItems.length === 1;
127
127
  return { isCollapsed, isMeasuring, measure, overflowItems, visibleItems };
128
128
  }
129
- const ITEM_SELECTOR = ".tds-data-table-saved-view-list-item";
130
- const NAME_SELECTOR = ".tds-data-table-saved-view-name";
131
- const OVERFLOW_SELECTOR = ".tds-btn--data-table-saved-views-overflow";
129
+ const ITEM_SELECTOR = ".tds-data-table-view-list-item";
130
+ const NAME_SELECTOR = ".tds-data-table-view-name";
131
+ const OVERFLOW_SELECTOR = ".tds-btn--data-table-views-overflow";
132
132
  /** The list's width, less the new view button, its save status, and a gap. */
133
133
  function readAvailable(list, newView, gap) {
134
134
  const newViewWidth = widthOf(newView);
@@ -174,5 +174,5 @@ function countFitting({ activeIndex, available, gap, overflowWidth, widths, }) {
174
174
  return Infinity;
175
175
  }
176
176
 
177
- export { useVisibleSavedViews };
178
- //# sourceMappingURL=useVisibleSavedViews.js.map
177
+ export { useVisibleViews };
178
+ //# sourceMappingURL=useVisibleViews.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useVisibleViews.js","sources":["../../../src/components/DataTable/useVisibleViews.ts"],"sourcesContent":["import { type RefObject, useLayoutEffect, useRef, useState } from \"react\"\nimport type { Key } from \"react-aria-components/ListBox\"\n\n/**\n * Splits `items` into the ones that fit on one line in `listRef` and the\n * ones that go in the overflow menu. Items keep their order. The active item\n * always shows, taking the last visible slot when it would otherwise\n * overflow.\n *\n * Item widths are kept from when each item last rendered, and a resize\n * observer on the rendered items, the overflow trigger, the list, and\n * `newViewRef` keeps them current. An item with no width yet, such as a new\n * one, renders every item and the overflow trigger for one measuring pass.\n * The list's items land a render after the list, so call `measure` once\n * they're in the DOM.\n */\nexport function useVisibleViews<T extends { id: Key }>({\n activeKey,\n items,\n listRef,\n newViewRef,\n}: {\n activeKey: Key | null\n items: T[]\n listRef: RefObject<HTMLElement>\n /** The new view button and its save status, which follow the items. */\n newViewRef: RefObject<HTMLElement>\n}) {\n // By `data-key`, which is a string.\n const [widths, setWidths] = useState(() => new Map<string, number>())\n const [overflowWidth, setOverflowWidth] = useState<number>()\n const [available, setAvailable] = useState(0)\n const [gap, setGap] = useState(0)\n const observerRef = useRef<ResizeObserver>()\n const observedRef = useRef(new Set<Element>())\n\n const isMeasuring =\n overflowWidth === undefined ||\n items.some(({ id }) => !widths.has(String(id)))\n\n // Only reads refs and sets state, so the observer can keep the first one.\n const read = () => {\n const list = listRef.current\n if (!list) return\n // Hidden, everything reads 0, so widths from before are kept.\n const isHidden = list.clientWidth === 0\n if (!isHidden) {\n const gap = readGap(list)\n setAvailable(readAvailable(list, newViewRef.current, gap))\n setGap(gap)\n }\n // Its count changes its width, which changes the count, so keep the\n // widest to settle on one count.\n const overflow = list.querySelector(OVERFLOW_SELECTOR)\n if (overflow) {\n const width = widthOf(overflow)\n setOverflowWidth((current) => Math.max(current ?? 0, width))\n }\n const itemElements = list.querySelectorAll<HTMLElement>(ITEM_SELECTOR)\n setWidths((current) => {\n let next = current\n for (const itemElement of itemElements) {\n const key = itemElement.dataset.key\n const width = fullWidthOf(itemElement)\n if (key === undefined || current.get(key) === width) continue\n if (isHidden && current.has(key)) continue\n if (next === current) next = new Map(current)\n next.set(key, width)\n }\n return next\n })\n }\n\n const measure = () => {\n const list = listRef.current\n if (!list) return\n const elements = new Set<Element>([\n list,\n ...(newViewRef.current ? [newViewRef.current] : []),\n ...list.querySelectorAll(`${ITEM_SELECTOR}, ${OVERFLOW_SELECTOR}`),\n ])\n const observed = observedRef.current\n // The observer reads size changes, so only added or removed elements\n // need reading here.\n const isSame =\n elements.size === observed.size &&\n [...elements].every((element) => observed.has(element))\n if (isSame) return\n observedRef.current = elements\n read()\n if (typeof ResizeObserver === \"undefined\") return\n observerRef.current ??= new ResizeObserver(read)\n for (const element of observed) {\n if (!elements.has(element)) observerRef.current.unobserve(element)\n }\n for (const element of elements) {\n if (!observed.has(element)) observerRef.current.observe(element)\n }\n }\n\n // Cleared too, so a remount, such as StrictMode's, observes again.\n useLayoutEffect(\n () => () => {\n observerRef.current?.disconnect()\n observerRef.current = undefined\n observedRef.current = new Set()\n },\n []\n )\n\n // Drops the widths of deleted items.\n useLayoutEffect(() => {\n const keys = new Set(items.map(({ id }) => String(id)))\n if ([...widths.keys()].some((key) => !keys.has(key))) {\n setWidths(new Map([...widths].filter(([key]) => keys.has(key))))\n }\n }, [items, widths])\n\n let visibleItems = items\n let overflowItems: T[] = []\n if (!isMeasuring) {\n let remaining = countFitting({\n activeIndex: items.findIndex(({ id }) => id === activeKey),\n available,\n gap,\n overflowWidth,\n widths: items.map(({ id }) => widths.get(String(id)) ?? 0),\n })\n visibleItems = []\n overflowItems = []\n for (const item of items) {\n if (item.id === activeKey || remaining-- > 0) visibleItems.push(item)\n else overflowItems.push(item)\n }\n }\n // Alone, the view truncates rather than overflow, whether the rest are in\n // the overflow menu or it's the only one.\n const isCollapsed = visibleItems.length === 1\n\n return { isCollapsed, isMeasuring, measure, overflowItems, visibleItems }\n}\n\nconst ITEM_SELECTOR = \".tds-data-table-view-list-item\"\nconst NAME_SELECTOR = \".tds-data-table-view-name\"\nconst OVERFLOW_SELECTOR = \".tds-btn--data-table-views-overflow\"\n\n/** The list's width, less the new view button, its save status, and a gap. */\nfunction readAvailable(\n list: HTMLElement,\n newView: HTMLElement | null,\n gap: number\n) {\n const newViewWidth = widthOf(newView)\n return list.clientWidth - (newViewWidth ? newViewWidth + gap : 0)\n}\n\nfunction readGap(element: Element) {\n return parseFloat(getComputedStyle(element).columnGap) || 0\n}\n\nfunction widthOf(element: Element | null) {\n return element?.getBoundingClientRect().width ?? 0\n}\n\n/** Includes the part of its name cut off by truncation. */\nfunction fullWidthOf(itemElement: Element) {\n const name = itemElement.querySelector(NAME_SELECTOR)\n const truncated = name ? name.scrollWidth - name.clientWidth : 0\n return widthOf(itemElement) + truncated\n}\n\n// Measured widths can be fractional, but the list's width is rounded.\nconst SUBPIXEL_SLACK = 1\n\nfunction countFitting({\n activeIndex,\n available,\n gap,\n overflowWidth,\n widths,\n}: {\n activeIndex: number\n available: number\n gap: number\n overflowWidth: number\n widths: number[]\n}) {\n const limit = available + SUBPIXEL_SLACK\n // Each item counts with the gap after it, which comes before the overflow\n // trigger, or after the last item doesn't exist. The active item's width is\n // set aside first so it always shows.\n let used = activeIndex === -1 ? 0 : widths[activeIndex] + gap\n // Items that still fit with the overflow trigger beside them.\n let fitsWithOverflow = 0\n for (let index = 0; index < widths.length; index++) {\n if (index === activeIndex) continue\n used += widths[index] + gap\n // Out of room, so the overflow trigger is needed. With no active item,\n // the first item shows anyway.\n if (used - gap > limit) {\n return activeIndex === -1\n ? Math.max(fitsWithOverflow, 1)\n : fitsWithOverflow\n }\n if (used + overflowWidth <= limit) fitsWithOverflow++\n }\n // Every item fits, so there's no overflow trigger.\n return Infinity\n}\n"],"names":[],"mappings":";;AAGA;;;;;;;;;;;;AAYG;AACG,SAAU,eAAe,CAAwB,EACrD,SAAS,EACT,KAAK,EACL,OAAO,EACP,UAAU,GAOX,EAAA;;AAEC,IAAA,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,MAAM,IAAI,GAAG,EAAkB,CAAC;IACrE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,EAAU;IAC5D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC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from "./FilterTypes";
3
+ /** A static or saved view. */
4
+ export interface View {
5
+ /** A search (`q`) filter is ignored; applying a view keeps the search. */
6
+ activeFilters: ActiveFilter[];
7
+ /**
8
+ * Required on a static view. A saved view gets one from the consumer once
9
+ * it's saved.
10
+ */
11
+ id?: number | string;
12
+ name: string;
13
+ /** Omit to leave the current sort unchanged when applied. */
14
+ sort?: Sort;
15
+ /**
16
+ * The columns the view shows. A hideable column it doesn't name is hidden,
17
+ * so a column added later stays out of the view until it's saved with it.
18
+ * Omit to leave the current column visibility unchanged when applied.
19
+ */
20
+ visibleColumnNames?: string[];
21
+ }
22
+ /** A user-created view, stored by the consumer. */
23
+ export type SavedView = View;
24
+ /** An app-provided view. Read-only. */
25
+ export type StaticView = View & {
26
+ id: number | string;
27
+ };
28
+ /**
29
+ * Always listed, so there's a view to fall back to. Added before the static
30
+ * views unless one of them uses its id, which replaces it.
31
+ */
32
+ export declare const initialView: StaticView;
33
+ /**
34
+ * A view from the app, without any search. Search isn't part of a view, so
35
+ * views enter the table without it. A view without one is returned as is.
36
+ */
37
+ export declare function withoutSearch<T extends View>(view: T): T;
38
+ /**
39
+ * A duplicate of a view under a new name. It's a new view, so it doesn't keep
40
+ * the original's id.
41
+ */
42
+ export declare function viewDuplicate({ id: _id, ...view }: View, name: string): Omit<SavedView, "id">;
43
+ /**
44
+ * Whether a view can be renamed, deleted, or saved over. Static views can't,
45
+ * and neither can a view that isn't saved yet, since updates are matched by id.
46
+ */
47
+ export declare function isViewEditable(view: View, savedViews: SavedView[]): boolean;
48
+ /**
49
+ * Whether the table's filters, sort, or visible columns differ from a view.
50
+ * Filters match by name, operator, scope, and value, in any order; labels are
51
+ * display-only. Sort and visible columns count only when both the view and the
52
+ * table have them. Column names match as given, in any order, so resolve them
53
+ * against the table's columns first to ignore ones that are gone.
54
+ */
55
+ export declare function isViewModified(view: View, { activeFilters, sort, visibleColumnNames }: Omit<View, "id" | "name">): boolean;
56
+ //# sourceMappingURL=views.d.ts.map
@@ -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AAI,GAAG,MAAM,CAAC,WAoBvE"}
@@ -25,28 +25,29 @@ function withoutSearch(view) {
25
25
  * A duplicate of a view under a new name. It's a new view, so it doesn't keep
26
26
  * the original's id.
27
27
  */
28
- function savedViewDuplicate({ id: _id, ...view }, name) {
28
+ function viewDuplicate({ id: _id, ...view }, name) {
29
29
  return { ...view, name };
30
30
  }
31
31
  /**
32
32
  * Whether a view can be renamed, deleted, or saved over. Static views can't,
33
33
  * and neither can a view that isn't saved yet, since updates are matched by id.
34
34
  */
35
- function isSavedViewEditable(view, savedViews) {
35
+ function isViewEditable(view, savedViews) {
36
36
  return view.id !== undefined && savedViews.includes(view);
37
37
  }
38
38
  /**
39
- * Whether the table's filters, sort, or hidden columns differ from a view.
39
+ * Whether the table's filters, sort, or visible columns differ from a view.
40
40
  * Filters match by name, operator, scope, and value, in any order; labels are
41
- * display-only. Sort and hidden columns count only when both the view and the
42
- * table have them.
41
+ * display-only. Sort and visible columns count only when both the view and the
42
+ * table have them. Column names match as given, in any order, so resolve them
43
+ * against the table's columns first to ignore ones that are gone.
43
44
  */
44
- function isSavedViewModified(view, { activeFilters, hiddenColumnNames, sort }) {
45
+ function isViewModified(view, { activeFilters, sort, visibleColumnNames }) {
45
46
  if (view.sort && sort && !isSameSort(view.sort, sort))
46
47
  return true;
47
- if (view.hiddenColumnNames &&
48
- hiddenColumnNames &&
49
- !isSameNames(view.hiddenColumnNames, hiddenColumnNames))
48
+ if (view.visibleColumnNames &&
49
+ visibleColumnNames &&
50
+ !isSameNames(view.visibleColumnNames, visibleColumnNames))
50
51
  return true;
51
52
  // Each saved filter matches one current filter, so repeats count.
52
53
  const unmatched = [...view.activeFilters];
@@ -79,5 +80,5 @@ function isSameNames(a, b) {
79
80
  return a.length === b.length && a.every((name) => b.includes(name));
80
81
  }
81
82
 
82
- export { initialView, isSavedViewEditable, isSavedViewModified, savedViewDuplicate, withoutSearch };
83
- //# sourceMappingURL=savedViews.js.map
83
+ export { initialView, isViewEditable, isViewModified, viewDuplicate, withoutSearch };
84
+ //# sourceMappingURL=views.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"views.js","sources":["../../../src/components/DataTable/views.ts"],"sourcesContent":["import type { Sort } from \"./DataTable\"\nimport type { ActiveFilter } from \"./FilterTypes\"\nimport { isSearchFilter } from \"./useSearchFilter\"\n\n/** A static or saved view. */\nexport interface View {\n /** A search (`q`) filter is ignored; applying a view keeps the search. */\n activeFilters: ActiveFilter[]\n /**\n * Required on a static view. A saved view gets one from the consumer once\n * it's saved.\n */\n id?: number | string\n name: string\n /** Omit to leave the current sort unchanged when applied. */\n sort?: Sort\n /**\n * The columns the view shows. A hideable column it doesn't name is hidden,\n * so a column added later stays out of the view until it's saved with it.\n * Omit to leave the current column visibility unchanged when applied.\n */\n visibleColumnNames?: string[]\n}\n\n/** A user-created view, stored by the consumer. */\nexport type SavedView = View\n\n/** An app-provided view. Read-only. */\nexport type StaticView = View & { id: number | string }\n\n/**\n * Always listed, so there's a view to fall back to. Added before the static\n * views unless one of them uses its id, which replaces it.\n */\nexport const initialView: StaticView = {\n activeFilters: [],\n id: \"initial\",\n name: \"All\",\n}\n\n/**\n * A view from the app, without any search. Search isn't part of a view, so\n * views enter the table without it. A view without one is returned as is.\n */\nexport function withoutSearch<T extends View>(view: T): T {\n if (!view.activeFilters.some(isSearchFilter)) return view\n return {\n ...view,\n activeFilters: view.activeFilters.filter(\n (filter) => !isSearchFilter(filter)\n ),\n }\n}\n\n/**\n * A duplicate of a view under a new name. It's a new view, so it doesn't keep\n * the original's id.\n */\nexport function viewDuplicate(\n { id: _id, ...view }: View,\n name: string\n): Omit<SavedView, \"id\"> {\n return { ...view, name }\n}\n\n/**\n * Whether a view can be renamed, deleted, or saved over. Static views can't,\n * and neither can a view that isn't saved yet, since updates are matched by id.\n */\nexport function isViewEditable(view: View, savedViews: SavedView[]) {\n return view.id !== undefined && savedViews.includes(view)\n}\n\n/**\n * Whether the table's filters, sort, or visible columns differ from a view.\n * Filters match by name, operator, scope, and value, in any order; labels are\n * display-only. Sort and visible columns count only when both the view and the\n * table have them. Column names match as given, in any order, so resolve them\n * against the table's columns first to ignore ones that are gone.\n */\nexport function isViewModified(\n view: View,\n { activeFilters, sort, visibleColumnNames }: Omit<View, \"id\" | \"name\">\n) {\n if (view.sort && sort && !isSameSort(view.sort, sort)) return true\n if (\n view.visibleColumnNames &&\n visibleColumnNames &&\n !isSameNames(view.visibleColumnNames, visibleColumnNames)\n )\n return true\n // Each saved filter matches one current filter, so repeats count.\n const unmatched = [...view.activeFilters]\n return (\n activeFilters.length !== unmatched.length ||\n !activeFilters.every((filter) => {\n const index = unmatched.findIndex((saved) => isSameFilter(saved, filter))\n if (index === -1) return false\n unmatched.splice(index, 1)\n return true\n })\n )\n}\n\nfunction isSameFilter(a: ActiveFilter, b: ActiveFilter) {\n return (\n a.name === b.name &&\n a.operator === b.operator &&\n a.scope === b.scope &&\n isSameValue(a.value, b.value)\n )\n}\n\n// Filter values are primitives or flat arrays, such as ranges. Arrays match\n// only in the same order.\nfunction isSameValue(a: unknown, b: unknown) {\n if (!Array.isArray(a) || !Array.isArray(b)) return a === b\n return a.length === b.length && a.every((item, index) => item === b[index])\n}\n\nfunction isSameSort(a: Sort, b: Sort) {\n return a.column === b.column && a.direction === b.direction\n}\n\nfunction isSameNames(a: string[], b: string[]) {\n return a.length === b.length && a.every((name) => b.includes(name))\n}\n"],"names":[],"mappings":";;AA8BA;;;AAGG;AACI,MAAM,WAAW,GAAe;AACrC,IAAA,aAAa,EAAE,EAAE;AACjB,IAAA,EAAE,EAAE,SAAS;AACb,IAAA,IAAI,EAAE,KAAK;;AAGb;;;AAGG;AACG,SAAU,aAAa,CAAiB,IAAO,EAAA;IACnD,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC;AAAE,QAAA,OAAO,IAAI;IACzD,OAAO;AACL,QAAA,GAAG,IAAI;AACP,QAAA,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM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AAC;AAEN;AAEA,SAAS,YAAY,CAAC,CAAe,EAAE,CAAe,EAAA;AACpD,IAAA,QACE,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI;AACjB,QAAA,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ;AACzB,QAAA,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;QACnB,WAAW,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC;AAEjC;AAEA;AACA;AACA,SAAS,WAAW,CAAC,CAAU,EAAE,CAAU,EAAA;AACzC,IAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,CAAC,KAAK,CAAC;IAC1D,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;AAC7E;AAEA,SAAS,UAAU,CAAC,CAAO,EAAE,CAAO,EAAA;AAClC,IAAA,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS;AAC7D;AAEA,SAAS,WAAW,CAAC,CAAW,EAAE,CAAW,EAAA;IAC3C,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACrE;;;;"}
@@ -39,7 +39,7 @@ export type ActionsDropdownIconButtonProps = Omit<IconButtonBaseProps, "aria-lab
39
39
  size?: Exclude<ComponentSize, "xs">;
40
40
  /** Not supported — no caret, and nothing else in the suffix slot. */
41
41
  suffix?: never;
42
- /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `"Delete"`, aria-label `"Delete, 3 selected"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. */
42
+ /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `"Delete"`, aria-label `"Delete, 3 selected"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. Never opens on hover while `disabled`, and opens on keyboard focus only with `focusableWhenDisabled`, so don't rely on it to explain why the button is disabled. */
43
43
  tooltip?: string;
44
44
  /** Where the tooltip renders relative to the button. Default `"bottom"`. Has no effect without `tooltip`. */
45
45
  tooltipPlacement?: TooltipPlacement;
@@ -87,7 +87,7 @@ export declare const ActionsDropdownIconButton: React.ForwardRefExoticComponent<
87
87
  size?: Exclude<ComponentSize, "xs">;
88
88
  /** Not supported — no caret, and nothing else in the suffix slot. */
89
89
  suffix?: never;
90
- /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `"Delete"`, aria-label `"Delete, 3 selected"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. */
90
+ /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `"Delete"`, aria-label `"Delete, 3 selected"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. Never opens on hover while `disabled`, and opens on keyboard focus only with `focusableWhenDisabled`, so don't rely on it to explain why the button is disabled. */
91
91
  tooltip?: string;
92
92
  /** Where the tooltip renders relative to the button. Default `"bottom"`. Has no effect without `tooltip`. */
93
93
  tooltipPlacement?: TooltipPlacement;
@@ -1 +1 @@
1
- {"version":3,"file":"ActionsDropdownIconButton.d.ts","sourceRoot":"","sources":["../../../src/components/button/ActionsDropdownIconButton.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO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,ycAAyc;cAC/b,MAAM;IAChB,6GAA6G;uBAC1F,gBAAgB;2CAiDpC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ActionsDropdownIconButton.js","sources":["../../../src/components/button/ActionsDropdownIconButton.tsx"],"sourcesContent":["import { DropdownTriggerContext } from \"@components/dropdown/DropdownTriggerContext\"\nimport { type TooltipPlacement } from \"@components/internal/tooltip\"\nimport { ComponentSize } from \"@utilities/buttonLinkShared\"\nimport Icon from \"@utilities/Icon\"\nimport classNames from \"classnames\"\nimport React, { forwardRef, useContext } from \"react\"\n\nimport { IconButton, IconButtonBaseProps } from \"./IconButton\"\n\nexport type ActionsDropdownIconButtonProps = Omit<\n IconButtonBaseProps,\n \"aria-label\" | \"icon\" | \"kind\" | \"loading\" | \"size\"\n> & {\n /**\n * Accessible name. Defaults to `\"Actions\"` when `tooltip` is not set.\n * Override when a page has several actions menus that need\n * distinguishing (e.g. `\"Actions for Jane Doe\"`).\n */\n \"aria-label\"?: string\n /**\n * Not supported — an actions trigger is a fixed-size icon button and\n * shouldn't stretch to fill a container. Always rendered as `false`.\n */\n fullWidth?: never\n /** Not supported — the vertical ellipsis is the component's identity. */\n icon?: never\n /**\n * Only `\"ghost\"` and `\"neutral\"` are supported treatments for an actions\n * trigger. Defaults to `\"ghost\"`.\n */\n kind?: \"ghost\" | \"neutral\"\n /**\n * Not supported — `.tds-btn--loading` hides every non-spinner child, so a\n * loading actions button would render a bare spinner with no glyph.\n */\n loading?: never\n /**\n * Not supported — same reasoning as `suffix`: total control over the\n * button's contents, and no slot besides the fixed ellipsis icon.\n */\n prefix?: never\n /**\n * `xs` is excluded — at 20px effective height it falls below the WCAG 2.2\n * AA 24×24 minimum target size, and an icon-only button has no text\n * content to widen it past the minimum.\n */\n size?: Exclude<ComponentSize, \"xs\">\n /** Not supported — no caret, and nothing else in the suffix slot. */\n suffix?: never\n /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `\"Delete\"`, aria-label `\"Delete, 3 selected\"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. */\n tooltip?: string\n /** Where the tooltip renders relative to the button. Default `\"bottom\"`. Has no effect without `tooltip`. */\n tooltipPlacement?: TooltipPlacement\n}\n\n/**\n * An icon-only dropdown trigger with a vertical-ellipsis glyph and no\n * caret, for action menus where a caret is visually redundant.\n *\n * @component\n */\nexport const ActionsDropdownIconButton = forwardRef<\n HTMLButtonElement,\n ActionsDropdownIconButtonProps\n>(\n (\n {\n \"aria-label\": ariaLabel,\n className,\n kind = \"ghost\",\n tooltip,\n ...restProps\n }: ActionsDropdownIconButtonProps,\n ref\n ) => {\n const contextProps = useContext(DropdownTriggerContext)\n const nameProps = tooltip\n ? { \"aria-label\": ariaLabel, tooltip }\n : { \"aria-label\": ariaLabel ?? \"Actions\" }\n return (\n <IconButton\n ref={ref}\n {...restProps}\n {...contextProps}\n {...nameProps}\n className={classNames(className, \"tds-btn--actions-dropdown\")}\n fullWidth={false}\n icon={\n <Icon\n className=\"actions-icon\"\n symbol=\"general#three-dots\"\n aria-hidden\n />\n }\n kind={kind}\n loading={undefined}\n prefix={undefined}\n suffix={undefined}\n />\n )\n }\n)\n\nActionsDropdownIconButton.displayName = \"ActionsDropdownIconButton\"\n"],"names":[],"mappings":";;;;;;AAuDA;;;;;AAKG;AACI,MAAM,yBAAyB,GAAG,UAAU,CAIjD,CACE,EACE,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,IAAI,GAAG,OAAO,EACd,OAAO,EACP,GAAG,SAAS,EACmB,EACjC,GAAG,KACD;AACF,IAAA,MAAM,YAAY,GAAG,UAAU,CAAC,sBAAsB,CAAC;IACvD,MAAM,SAAS,GAAG;AAChB,UAAE,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO;UAClC,EAAE,YAAY,EAAE,SAAS,IAAI,SAAS,EAAE;IAC5C,QACE,KAAA,CAAA,aAAA,CAAC,UAAU,EAAA,EACT,GAAG,EAAE,GAAG,EAAA,GACJ,SAAS,EAAA,GACT,YAAY,EAAA,GACZ,SAAS,EACb,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,2BAA2B,CAAC,EAC7D,SAAS,EAAE,KAAK,EAChB,IAAI,EACF,oBAAC,IAAI,EAAA,EACH,SAAS,EAAC,cAAc,EACxB,MAAM,EAAC,oBAAoB,EAAA,aAAA,EAAA,IAAA,EAAA,CAE3B,EAEJ,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,SAAS,EAAA,CACjB;AAEN,CAAC;AAGH,yBAAyB,CAAC,WAAW,GAAG,2BAA2B;;;;"}
1
+ {"version":3,"file":"ActionsDropdownIconButton.js","sources":["../../../src/components/button/ActionsDropdownIconButton.tsx"],"sourcesContent":["import { DropdownTriggerContext } from \"@components/dropdown/DropdownTriggerContext\"\nimport { type TooltipPlacement } from \"@components/internal/tooltip\"\nimport { ComponentSize } from \"@utilities/buttonLinkShared\"\nimport Icon from \"@utilities/Icon\"\nimport classNames from \"classnames\"\nimport React, { forwardRef, useContext } from \"react\"\n\nimport { IconButton, IconButtonBaseProps } from \"./IconButton\"\n\nexport type ActionsDropdownIconButtonProps = Omit<\n IconButtonBaseProps,\n \"aria-label\" | \"icon\" | \"kind\" | \"loading\" | \"size\"\n> & {\n /**\n * Accessible name. Defaults to `\"Actions\"` when `tooltip` is not set.\n * Override when a page has several actions menus that need\n * distinguishing (e.g. `\"Actions for Jane Doe\"`).\n */\n \"aria-label\"?: string\n /**\n * Not supported — an actions trigger is a fixed-size icon button and\n * shouldn't stretch to fill a container. Always rendered as `false`.\n */\n fullWidth?: never\n /** Not supported — the vertical ellipsis is the component's identity. */\n icon?: never\n /**\n * Only `\"ghost\"` and `\"neutral\"` are supported treatments for an actions\n * trigger. Defaults to `\"ghost\"`.\n */\n kind?: \"ghost\" | \"neutral\"\n /**\n * Not supported — `.tds-btn--loading` hides every non-spinner child, so a\n * loading actions button would render a bare spinner with no glyph.\n */\n loading?: never\n /**\n * Not supported — same reasoning as `suffix`: total control over the\n * button's contents, and no slot besides the fixed ellipsis icon.\n */\n prefix?: never\n /**\n * `xs` is excluded — at 20px effective height it falls below the WCAG 2.2\n * AA 24×24 minimum target size, and an icon-only button has no text\n * content to widen it past the minimum.\n */\n size?: Exclude<ComponentSize, \"xs\">\n /** Not supported — no caret, and nothing else in the suffix slot. */\n suffix?: never\n /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `\"Delete\"`, aria-label `\"Delete, 3 selected\"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. Never opens on hover while `disabled`, and opens on keyboard focus only with `focusableWhenDisabled`, so don't rely on it to explain why the button is disabled. */\n tooltip?: string\n /** Where the tooltip renders relative to the button. Default `\"bottom\"`. Has no effect without `tooltip`. */\n tooltipPlacement?: TooltipPlacement\n}\n\n/**\n * An icon-only dropdown trigger with a vertical-ellipsis glyph and no\n * caret, for action menus where a caret is visually redundant.\n *\n * @component\n */\nexport const ActionsDropdownIconButton = forwardRef<\n HTMLButtonElement,\n ActionsDropdownIconButtonProps\n>(\n (\n {\n \"aria-label\": ariaLabel,\n className,\n kind = \"ghost\",\n tooltip,\n ...restProps\n }: ActionsDropdownIconButtonProps,\n ref\n ) => {\n const contextProps = useContext(DropdownTriggerContext)\n const nameProps = tooltip\n ? { \"aria-label\": ariaLabel, tooltip }\n : { \"aria-label\": ariaLabel ?? \"Actions\" }\n return (\n <IconButton\n ref={ref}\n {...restProps}\n {...contextProps}\n {...nameProps}\n className={classNames(className, \"tds-btn--actions-dropdown\")}\n fullWidth={false}\n icon={\n <Icon\n className=\"actions-icon\"\n symbol=\"general#three-dots\"\n aria-hidden\n />\n }\n kind={kind}\n loading={undefined}\n prefix={undefined}\n suffix={undefined}\n />\n )\n }\n)\n\nActionsDropdownIconButton.displayName = \"ActionsDropdownIconButton\"\n"],"names":[],"mappings":";;;;;;AAuDA;;;;;AAKG;AACI,MAAM,yBAAyB,GAAG,UAAU,CAIjD,CACE,EACE,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,IAAI,GAAG,OAAO,EACd,OAAO,EACP,GAAG,SAAS,EACmB,EACjC,GAAG,KACD;AACF,IAAA,MAAM,YAAY,GAAG,UAAU,CAAC,sBAAsB,CAAC;IACvD,MAAM,SAAS,GAAG;AAChB,UAAE,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO;UAClC,EAAE,YAAY,EAAE,SAAS,IAAI,SAAS,EAAE;IAC5C,QACE,KAAA,CAAA,aAAA,CAAC,UAAU,EAAA,EACT,GAAG,EAAE,GAAG,EAAA,GACJ,SAAS,EAAA,GACT,YAAY,EAAA,GACZ,SAAS,EACb,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,2BAA2B,CAAC,EAC7D,SAAS,EAAE,KAAK,EAChB,IAAI,EACF,oBAAC,IAAI,EAAA,EACH,SAAS,EAAC,cAAc,EACxB,MAAM,EAAC,oBAAoB,EAAA,aAAA,EAAA,IAAA,EAAA,CAE3B,EAEJ,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,SAAS,EAAA,CACjB;AAEN,CAAC;AAGH,yBAAyB,CAAC,WAAW,GAAG,2BAA2B;;;;"}
@@ -13,13 +13,13 @@ export type IconButtonBaseProps = IconButtonSharedProps & {
13
13
  type IconButtonTooltipProps = {
14
14
  /** Accessible label. Required for icon-only buttons to provide context about the button's purpose. Not required when `tooltip` is set. When both are set, this is the name and the tooltip is visual only. */
15
15
  "aria-label"?: string;
16
- /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `"Delete"`, aria-label `"Delete, 3 selected"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. */
16
+ /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `"Delete"`, aria-label `"Delete, 3 selected"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. Never opens on hover while `disabled` or `loading`, and opens on keyboard focus only with `focusableWhenDisabled`, so don't rely on it to explain why the button is disabled. */
17
17
  tooltip: string;
18
18
  };
19
19
  type IconButtonAriaLabelProps = {
20
20
  /** Accessible label. Required for icon-only buttons to provide context about the button's purpose. Not required when `tooltip` is set. When both are set, this is the name and the tooltip is visual only. */
21
21
  "aria-label": string;
22
- /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `"Delete"`, aria-label `"Delete, 3 selected"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. */
22
+ /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `"Delete"`, aria-label `"Delete, 3 selected"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. Never opens on hover while `disabled` or `loading`, and opens on keyboard focus only with `focusableWhenDisabled`, so don't rely on it to explain why the button is disabled. */
23
23
  tooltip?: string;
24
24
  };
25
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../src/components/button/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAA;AAElB,OAAO,EAAW,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAE7E,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAc,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAEjE,KAAK,qBAAqB,GAAG,IAAI,CAAC,sBAAsB,EAAE,OAAO,CAAC,GAAG;IACnE,sFAAsF;IACtF,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,GAAG;IACxD,sGAAsG;IACtG,YAAY,EAAE,MAAM,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AAE,MAAM,CAAA;IACpB,sdAAsd;IACtd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;GAIG;AACH,KAAK,mBAAmB,GAAG,wBAAwB,GAAG,sBAAsB,CAAA;AAE5E,MAAM,MAAM,eAAe,GAAG,qBAAqB,GACjD,mBAAmB,GAAG;IACpB,6GAA6G;IAC7G,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC,CAAA;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,2FA0CtB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.js","sources":["../../../src/components/button/IconButton.tsx"],"sourcesContent":["import \"./btn.css\"\n\nimport { Tooltip, type TooltipPlacement } from \"@components/internal/tooltip\"\nimport classNames from \"classnames\"\nimport React, { forwardRef } from \"react\"\n\nimport { BaseButton, BaseButtonElementProps } from \"./BaseButton\"\n\ntype IconButtonSharedProps = Omit<BaseButtonElementProps, \"label\"> & {\n /** The icon to display in the button. Set via story args for non-primitive values. */\n icon: React.ReactNode\n}\n\nexport type IconButtonBaseProps = IconButtonSharedProps & {\n /** Accessible label. Required for icon-only buttons to provide context about the button's purpose. */\n \"aria-label\": string\n}\n\ntype IconButtonTooltipProps = {\n /** Accessible label. Required for icon-only buttons to provide context about the button's purpose. Not required when `tooltip` is set. When both are set, this is the name and the tooltip is visual only. */\n \"aria-label\"?: string\n /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `\"Delete\"`, aria-label `\"Delete, 3 selected\"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. */\n tooltip: string\n}\n\ntype IconButtonAriaLabelProps = {\n /** Accessible label. Required for icon-only buttons to provide context about the button's purpose. Not required when `tooltip` is set. When both are set, this is the name and the tooltip is visual only. */\n \"aria-label\": string\n /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `\"Delete\"`, aria-label `\"Delete, 3 selected\"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. */\n tooltip?: string\n}\n\n/**\n * An icon-only button needs a name: `aria-label`, `tooltip`, or both.\n * `IconButtonAriaLabelProps` is declared last so that a missing name\n * reports \"aria-label is missing\", not \"tooltip is missing\".\n */\ntype IconButtonNameProps = IconButtonAriaLabelProps | IconButtonTooltipProps\n\nexport type IconButtonProps = IconButtonSharedProps &\n IconButtonNameProps & {\n /** Where the tooltip renders relative to the button. Default `\"bottom\"`. Has no effect without `tooltip`. */\n tooltipPlacement?: TooltipPlacement\n }\n\n/**\n * An icon-only button component that renders as a button element.\n * Requires an icon, and an aria-label or tooltip for accessibility.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/buttons-icon-button--docs | Storybook Documentation}\n * @see {@link https://github.com/planningcenter/tapestry/tree/main/packages/tapestry-migration-cli | Migration CLI: Available}\n */\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n className,\n icon,\n tooltip,\n tooltipPlacement = \"bottom\",\n ...restProps\n }: IconButtonProps,\n ref\n ) => {\n const iconOnlyClassName = classNames(\"tds-btn--icononly\", className)\n\n if (tooltip) {\n const {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...buttonProps\n } = restProps\n\n return (\n <Tooltip content={tooltip} placement={tooltipPlacement} visualOnly>\n <BaseButton\n {...buttonProps}\n aria-label={ariaLabel || tooltip}\n label={icon}\n className={iconOnlyClassName}\n ref={ref}\n />\n </Tooltip>\n )\n }\n\n return (\n <BaseButton\n {...restProps}\n label={icon}\n className={iconOnlyClassName}\n ref={ref}\n />\n )\n }\n)\n\nIconButton.displayName = \"IconButton\"\n"],"names":[],"mappings":";;;;;AA6CA;;;;;;;AAOG;AACI,MAAM,UAAU,GAAG,UAAU,CAClC,CACE,EACE,SAAS,EACT,IAAI,EACJ,OAAO,EACP,gBAAgB,GAAG,QAAQ,EAC3B,GAAG,SAAS,EACI,EAClB,GAAG,KACD;IACF,MAAM,iBAAiB,GAAG,UAAU,CAAC,mBAAmB,EAAE,SAAS,CAAC;IAEpE,IAAI,OAAO,EAAE;AACX,QAAA,MAAM,EACJ,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,GAAG,WAAW,EACf,GAAG,SAAS;AAEb,QAAA,QACE,KAAA,CAAA,aAAA,CAAC,OAAO,EAAA,EAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAA,IAAA,EAAA;YAChE,KAAA,CAAA,aAAA,CAAC,UAAU,OACL,WAAW,EAAA,YAAA,EACH,SAAS,IAAI,OAAO,EAChC,KAAK,EAAE,IAAI,EACX,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,GAAG,EAAA,CACR,CACM;IAEd;AAEA,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,UAAU,OACL,SAAS,EACb,KAAK,EAAE,IAAI,EACX,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,GAAG,EAAA,CACR;AAEN,CAAC;AAGH,UAAU,CAAC,WAAW,GAAG,YAAY;;;;"}
1
+ {"version":3,"file":"IconButton.js","sources":["../../../src/components/button/IconButton.tsx"],"sourcesContent":["import \"./btn.css\"\n\nimport { Tooltip, type TooltipPlacement } from \"@components/internal/tooltip\"\nimport classNames from \"classnames\"\nimport React, { forwardRef } from \"react\"\n\nimport { BaseButton, BaseButtonElementProps } from \"./BaseButton\"\n\ntype IconButtonSharedProps = Omit<BaseButtonElementProps, \"label\"> & {\n /** The icon to display in the button. Set via story args for non-primitive values. */\n icon: React.ReactNode\n}\n\nexport type IconButtonBaseProps = IconButtonSharedProps & {\n /** Accessible label. Required for icon-only buttons to provide context about the button's purpose. */\n \"aria-label\": string\n}\n\ntype IconButtonTooltipProps = {\n /** Accessible label. Required for icon-only buttons to provide context about the button's purpose. Not required when `tooltip` is set. When both are set, this is the name and the tooltip is visual only. */\n \"aria-label\"?: string\n /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `\"Delete\"`, aria-label `\"Delete, 3 selected\"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. Never opens on hover while `disabled` or `loading`, and opens on keyboard focus only with `focusableWhenDisabled`, so don't rely on it to explain why the button is disabled. */\n tooltip: string\n}\n\ntype IconButtonAriaLabelProps = {\n /** Accessible label. Required for icon-only buttons to provide context about the button's purpose. Not required when `tooltip` is set. When both are set, this is the name and the tooltip is visual only. */\n \"aria-label\": string\n /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `\"Delete\"`, aria-label `\"Delete, 3 selected\"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. Never opens on hover while `disabled` or `loading`, and opens on keyboard focus only with `focusableWhenDisabled`, so don't rely on it to explain why the button is disabled. */\n tooltip?: string\n}\n\n/**\n * An icon-only button needs a name: `aria-label`, `tooltip`, or both.\n * `IconButtonAriaLabelProps` is declared last so that a missing name\n * reports \"aria-label is missing\", not \"tooltip is missing\".\n */\ntype IconButtonNameProps = IconButtonAriaLabelProps | IconButtonTooltipProps\n\nexport type IconButtonProps = IconButtonSharedProps &\n IconButtonNameProps & {\n /** Where the tooltip renders relative to the button. Default `\"bottom\"`. Has no effect without `tooltip`. */\n tooltipPlacement?: TooltipPlacement\n }\n\n/**\n * An icon-only button component that renders as a button element.\n * Requires an icon, and an aria-label or tooltip for accessibility.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/buttons-icon-button--docs | Storybook Documentation}\n * @see {@link https://github.com/planningcenter/tapestry/tree/main/packages/tapestry-migration-cli | Migration CLI: Available}\n */\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n className,\n icon,\n tooltip,\n tooltipPlacement = \"bottom\",\n ...restProps\n }: IconButtonProps,\n ref\n ) => {\n const iconOnlyClassName = classNames(\"tds-btn--icononly\", className)\n\n if (tooltip) {\n const {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...buttonProps\n } = restProps\n\n return (\n <Tooltip content={tooltip} placement={tooltipPlacement} visualOnly>\n <BaseButton\n {...buttonProps}\n aria-label={ariaLabel || tooltip}\n label={icon}\n className={iconOnlyClassName}\n ref={ref}\n />\n </Tooltip>\n )\n }\n\n return (\n <BaseButton\n {...restProps}\n label={icon}\n className={iconOnlyClassName}\n ref={ref}\n />\n )\n }\n)\n\nIconButton.displayName = \"IconButton\"\n"],"names":[],"mappings":";;;;;AA6CA;;;;;;;AAOG;AACI,MAAM,UAAU,GAAG,UAAU,CAClC,CACE,EACE,SAAS,EACT,IAAI,EACJ,OAAO,EACP,gBAAgB,GAAG,QAAQ,EAC3B,GAAG,SAAS,EACI,EAClB,GAAG,KACD;IACF,MAAM,iBAAiB,GAAG,UAAU,CAAC,mBAAmB,EAAE,SAAS,CAAC;IAEpE,IAAI,OAAO,EAAE;AACX,QAAA,MAAM,EACJ,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,GAAG,WAAW,EACf,GAAG,SAAS;AAEb,QAAA,QACE,KAAA,CAAA,aAAA,CAAC,OAAO,EAAA,EAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAA,IAAA,EAAA;YAChE,KAAA,CAAA,aAAA,CAAC,UAAU,OACL,WAAW,EAAA,YAAA,EACH,SAAS,IAAI,OAAO,EAChC,KAAK,EAAE,IAAI,EACX,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,GAAG,EAAA,CACR,CACM;IAEd;AAEA,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,UAAU,OACL,SAAS,EACb,KAAK,EAAE,IAAI,EACX,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,GAAG,EAAA,CACR;AAEN,CAAC;AAGH,UAAU,CAAC,WAAW,GAAG,YAAY;;;;"}
@@ -4,6 +4,8 @@ export type CheckboxGroupSize = "md" | "sm";
4
4
  export interface CheckboxGroupProps {
5
5
  /** Optional description or error message rendered below the legend. */
6
6
  description?: React.ReactNode;
7
+ /** If true, visually hides the legend while keeping it available to assistive technology. */
8
+ hideLabel?: boolean;
7
9
  /** If true, adds aria-invalid and styles the description as an error. */
8
10
  invalid?: boolean;
9
11
  /** The group label. Renders as <legend>. Required. */
@@ -19,5 +21,5 @@ export type CheckboxGroupElementProps = Omit<FieldsetHTMLAttributes<HTMLFieldSet
19
21
  * @component
20
22
  * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-checkbox-group--docs | Storybook Documentation}
21
23
  */
22
- export declare function CheckboxGroup({ children, className, description, invalid, label, size, ...restProps }: CheckboxGroupElementProps): React.JSX.Element;
24
+ export declare function CheckboxGroup({ children, className, description, hideLabel, invalid, label, size, ...restProps }: CheckboxGroupElementProps): React.JSX.Element;
23
25
  //# sourceMappingURL=CheckboxGroup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox-group/CheckboxGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAKpB,OAAO,KAAK,EAAE,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAErD,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,CAAA;AAE3C,MAAM,WAAW,kBAAkB;IACjC,uEAAuE;IACvE,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,yEAAyE;IACzE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAA;IACb,qDAAqD;IACrD,IAAI,CAAC,EAAE,iBAAiB,CAAA;CACzB;AAED,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,MAAM,kBAAkB,CACzB,GACC,kBAAkB,CAAA;AAEpB;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,WAAW,EACX,OAAO,EACP,KAAK,EACL,IAAW,EACX,GAAG,SAAS,EACb,EAAE,yBAAyB,qBAiC3B"}
1
+ {"version":3,"file":"CheckboxGroup.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox-group/CheckboxGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAKpB,OAAO,KAAK,EAAE,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAErD,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,CAAA;AAE3C,MAAM,WAAW,kBAAkB;IACjC,uEAAuE;IACvE,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,6FAA6F;IAC7F,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,yEAAyE;IACzE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAA;IACb,qDAAqD;IACrD,IAAI,CAAC,EAAE,iBAAiB,CAAA;CACzB;AAED,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,MAAM,kBAAkB,CACzB,GACC,kBAAkB,CAAA;AAEpB;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,WAAW,EACX,SAAiB,EACjB,OAAO,EACP,KAAK,EACL,IAAW,EACX,GAAG,SAAS,EACb,EAAE,yBAAyB,qBAqC3B"}
@@ -10,13 +10,13 @@ import React__default from 'react';
10
10
  * @component
11
11
  * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-checkbox-group--docs | Storybook Documentation}
12
12
  */
13
- function CheckboxGroup({ children, className, description, invalid, label, size = "md", ...restProps }) {
13
+ function CheckboxGroup({ children, className, description, hideLabel = false, invalid, label, size = "md", ...restProps }) {
14
14
  const combinedClassName = classNames("tds-checkbox-group", size === "sm" && "tds-checkbox-group--sm", className);
15
15
  const stableId = useId();
16
16
  const displayDescription = description || (invalid ? "One or more checkboxes are invalid." : undefined);
17
17
  const descriptionId = `tds-checkbox-group-${stableId}-description`;
18
18
  return (React__default.createElement("fieldset", { ...restProps, "aria-describedby": displayDescription ? descriptionId : undefined, "aria-invalid": invalid || undefined, className: combinedClassName },
19
- React__default.createElement("legend", null, label),
19
+ React__default.createElement("legend", { className: hideLabel ? "tds-checkbox-group-legend--hidden" : undefined }, label),
20
20
  displayDescription && (React__default.createElement("p", { id: descriptionId, className: "tds-checkbox-group-description" },
21
21
  React__default.createElement(Icon, { "aria-hidden": true, className: "tds-checkbox-group-description-invalid-icon", symbol: "general#exclamation-triangle" }),
22
22
  displayDescription)),
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup.js","sources":["../../../src/components/checkbox-group/CheckboxGroup.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport Icon from \"@utilities/Icon\"\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, { FieldsetHTMLAttributes } from \"react\"\n\nexport type CheckboxGroupSize = \"md\" | \"sm\"\n\nexport interface CheckboxGroupProps {\n /** Optional description or error message rendered below the legend. */\n description?: React.ReactNode\n /** If true, adds aria-invalid and styles the description as an error. */\n invalid?: boolean\n /** The group label. Renders as <legend>. Required. */\n label: string\n /** Sets font size for the legend and description. */\n size?: CheckboxGroupSize\n}\n\nexport type CheckboxGroupElementProps = Omit<\n FieldsetHTMLAttributes<HTMLFieldSetElement>,\n keyof CheckboxGroupProps\n> &\n CheckboxGroupProps\n\n/**\n * A checkbox group allows a user to select multiple items from a list of options.\n * Use it to group two or more checkboxes that share a common question or label.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-checkbox-group--docs | Storybook Documentation}\n */\nexport function CheckboxGroup({\n children,\n className,\n description,\n invalid,\n label,\n size = \"md\",\n ...restProps\n}: CheckboxGroupElementProps) {\n const combinedClassName = classNames(\n \"tds-checkbox-group\",\n size === \"sm\" && \"tds-checkbox-group--sm\",\n className\n )\n const stableId = useId()\n\n const displayDescription =\n description || (invalid ? \"One or more checkboxes are invalid.\" : undefined)\n const descriptionId = `tds-checkbox-group-${stableId}-description`\n\n return (\n <fieldset\n {...restProps}\n aria-describedby={displayDescription ? descriptionId : undefined}\n aria-invalid={invalid || undefined}\n className={combinedClassName}\n >\n <legend>{label}</legend>\n {displayDescription && (\n <p id={descriptionId} className=\"tds-checkbox-group-description\">\n <Icon\n aria-hidden\n className=\"tds-checkbox-group-description-invalid-icon\"\n symbol=\"general#exclamation-triangle\"\n />\n {displayDescription}\n </p>\n )}\n <div className=\"tds-checkbox-group-fields\">{children}</div>\n </fieldset>\n )\n}\n"],"names":["React"],"mappings":";;;;;AA0BA;;;;;;AAMG;AACG,SAAU,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,WAAW,EACX,OAAO,EACP,KAAK,EACL,IAAI,GAAG,IAAI,EACX,GAAG,SAAS,EACc,EAAA;AAC1B,IAAA,MAAM,iBAAiB,GAAG,UAAU,CAClC,oBAAoB,EACpB,IAAI,KAAK,IAAI,IAAI,wBAAwB,EACzC,SAAS,CACV;AACD,IAAA,MAAM,QAAQ,GAAG,KAAK,EAAE;AAExB,IAAA,MAAM,kBAAkB,GACtB,WAAW,KAAK,OAAO,GAAG,qCAAqC,GAAG,SAAS,CAAC;AAC9E,IAAA,MAAM,aAAa,GAAG,CAAA,mBAAA,EAAsB,QAAQ,cAAc;IAElE,QACEA,8CACM,SAAS,EAAA,kBAAA,EACK,kBAAkB,GAAG,aAAa,GAAG,SAAS,kBAClD,OAAO,IAAI,SAAS,EAClC,SAAS,EAAE,iBAAiB,EAAA;AAE5B,QAAAA,cAAA,CAAA,aAAA,CAAA,QAAA,EAAA,IAAA,EAAS,KAAK,CAAU;QACvB,kBAAkB,KACjBA,cAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAG,EAAE,EAAE,aAAa,EAAE,SAAS,EAAC,gCAAgC,EAAA;YAC9DA,cAAA,CAAA,aAAA,CAAC,IAAI,yBAEH,SAAS,EAAC,6CAA6C,EACvD,MAAM,EAAC,8BAA8B,EAAA,CACrC;AACD,YAAA,kBAAkB,CACjB,CACL;QACDA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,2BAA2B,EAAA,EAAE,QAAQ,CAAO,CAClD;AAEf;;;;"}
1
+ {"version":3,"file":"CheckboxGroup.js","sources":["../../../src/components/checkbox-group/CheckboxGroup.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport Icon from \"@utilities/Icon\"\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, { FieldsetHTMLAttributes } from \"react\"\n\nexport type CheckboxGroupSize = \"md\" | \"sm\"\n\nexport interface CheckboxGroupProps {\n /** Optional description or error message rendered below the legend. */\n description?: React.ReactNode\n /** If true, visually hides the legend while keeping it available to assistive technology. */\n hideLabel?: boolean\n /** If true, adds aria-invalid and styles the description as an error. */\n invalid?: boolean\n /** The group label. Renders as <legend>. Required. */\n label: string\n /** Sets font size for the legend and description. */\n size?: CheckboxGroupSize\n}\n\nexport type CheckboxGroupElementProps = Omit<\n FieldsetHTMLAttributes<HTMLFieldSetElement>,\n keyof CheckboxGroupProps\n> &\n CheckboxGroupProps\n\n/**\n * A checkbox group allows a user to select multiple items from a list of options.\n * Use it to group two or more checkboxes that share a common question or label.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-checkbox-group--docs | Storybook Documentation}\n */\nexport function CheckboxGroup({\n children,\n className,\n description,\n hideLabel = false,\n invalid,\n label,\n size = \"md\",\n ...restProps\n}: CheckboxGroupElementProps) {\n const combinedClassName = classNames(\n \"tds-checkbox-group\",\n size === \"sm\" && \"tds-checkbox-group--sm\",\n className\n )\n const stableId = useId()\n\n const displayDescription =\n description || (invalid ? \"One or more checkboxes are invalid.\" : undefined)\n const descriptionId = `tds-checkbox-group-${stableId}-description`\n\n return (\n <fieldset\n {...restProps}\n aria-describedby={displayDescription ? descriptionId : undefined}\n aria-invalid={invalid || undefined}\n className={combinedClassName}\n >\n <legend\n className={hideLabel ? \"tds-checkbox-group-legend--hidden\" : undefined}\n >\n {label}\n </legend>\n {displayDescription && (\n <p id={descriptionId} className=\"tds-checkbox-group-description\">\n <Icon\n aria-hidden\n className=\"tds-checkbox-group-description-invalid-icon\"\n symbol=\"general#exclamation-triangle\"\n />\n {displayDescription}\n </p>\n )}\n <div className=\"tds-checkbox-group-fields\">{children}</div>\n </fieldset>\n )\n}\n"],"names":["React"],"mappings":";;;;;AA4BA;;;;;;AAMG;AACG,SAAU,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,WAAW,EACX,SAAS,GAAG,KAAK,EACjB,OAAO,EACP,KAAK,EACL,IAAI,GAAG,IAAI,EACX,GAAG,SAAS,EACc,EAAA;AAC1B,IAAA,MAAM,iBAAiB,GAAG,UAAU,CAClC,oBAAoB,EACpB,IAAI,KAAK,IAAI,IAAI,wBAAwB,EACzC,SAAS,CACV;AACD,IAAA,MAAM,QAAQ,GAAG,KAAK,EAAE;AAExB,IAAA,MAAM,kBAAkB,GACtB,WAAW,KAAK,OAAO,GAAG,qCAAqC,GAAG,SAAS,CAAC;AAC9E,IAAA,MAAM,aAAa,GAAG,CAAA,mBAAA,EAAsB,QAAQ,cAAc;IAElE,QACEA,8CACM,SAAS,EAAA,kBAAA,EACK,kBAAkB,GAAG,aAAa,GAAG,SAAS,kBAClD,OAAO,IAAI,SAAS,EAClC,SAAS,EAAE,iBAAiB,EAAA;AAE5B,QAAAA,cAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EACE,SAAS,EAAE,SAAS,GAAG,mCAAmC,GAAG,SAAS,EAAA,EAErE,KAAK,CACC;QACR,kBAAkB,KACjBA,cAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAG,EAAE,EAAE,aAAa,EAAE,SAAS,EAAC,gCAAgC,EAAA;YAC9DA,cAAA,CAAA,aAAA,CAAC,IAAI,yBAEH,SAAS,EAAC,6CAA6C,EACvD,MAAM,EAAC,8BAA8B,EAAA,CACrC;AACD,YAAA,kBAAkB,CACjB,CACL;QACDA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,2BAA2B,EAAA,EAAE,QAAQ,CAAO,CAClD;AAEf;;;;"}
@@ -44,7 +44,12 @@ export interface DatePickerProps {
44
44
  required?: boolean;
45
45
  /** The size of the date picker. */
46
46
  size?: DatePickerSize;
47
- /** The controlled value. Accepts a DateValue or ISO date string. */
47
+ /**
48
+ * The controlled value. Accepts a DateValue or ISO date string.
49
+ *
50
+ * A partly filled date (e.g. `4/dd/2026`) reports `null` on blur but stays on
51
+ * screen. Setting `null` again won't clear it; remount with a `key` to reset.
52
+ */
48
53
  value?: DatePickerDateValue | null;
49
54
  }
50
55
  type AriaDatePickerPropsToOmit = "children" | "defaultOpen" | "granularity" | "hideTimeZone" | "hourCycle" | "pageBehavior" | "placeholderValue" | "shouldCloseOnSelect" | "shouldForceLeadingZeros" | "slot";
@@ -70,7 +75,7 @@ export type DatePickerElementProps = CombineAriaPropsWithCustomProps<AriaDatePic
70
75
  * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-datepicker--docs | Storybook Documentation}
71
76
  * @see {@link https://github.com/planningcenter/tapestry/tree/main/packages/tapestry-migration-cli | Migration CLI: Available}
72
77
  */
73
- export declare function DatePicker({ className, defaultValue, description, disabled, firstDayOfWeek, formatDateOnBlur, hideLabel, invalid, isDateUnavailable, label, max, min, onBlur, onChange, readOnly, required, size, value, alwaysShowFourDigitYear, ...restProps }: DatePickerElementProps): React.JSX.Element;
78
+ export declare function DatePicker({ className, defaultValue, description, disabled, firstDayOfWeek, formatDateOnBlur, hideLabel, invalid, isDateUnavailable, label, max, min, name, onBlur, onChange, onFocus, readOnly, required, size, value, alwaysShowFourDigitYear, ...restProps }: DatePickerElementProps): React.JSX.Element;
74
79
  export declare namespace DatePicker {
75
80
  var displayName: string;
76
81
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAA;AAC1B,OAAO,oBAAoB,CAAA;AAC3B,OAAO,aAAa,CAAA;AAEpB,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAGhF,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAwB,MAAM,OAAO,CAAA;AAGnE,OAAO,EAUL,KAAK,eAAe,IAAI,mBAAmB,EAM5C,MAAM,kCAAkC,CAAA;AAYzC,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAA;AAExC,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,MAAM,CAAA;AAepD,MAAM,WAAW,eAAe;IAC9B,4GAA4G;IAC5G,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,wFAAwF;IACxF,YAAY,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACzC,gGAAgG;IAChG,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,4FAA4F;IAC5F,cAAc,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAA;IACtE;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,SAAS,CAAA;IACjD,qGAAqG;IACrG,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,wFAAwF;IACxF,iBAAiB,CAAC,EAAE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AmB,CAAA;IACzB,uEAAuE;IACvE,GAAG,CAAC,EAAE,mBAAmB,CAAA;IACzB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAA;IAC5C,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mCAAmC;IACnC,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;CACnC;AAED,KAAK,yBAAyB,GAC1B,UAAU,GACV,aAAa,GACb,aAAa,GACb,cAAc,GACd,WAAW,GACX,cAAc,GACd,kBAAkB,GAClB,qBAAqB,GACrB,yBAAyB,GACzB,MAAM,CAAA;AAEV,KAAK,4BAA4B,GAAG,QAAQ,GAAG,MAAM,GAAG,cAAc,CAAA;AAEtE,MAAM,MAAM,sBAAsB,GAAG,+BAA+B,CAClE,mBAAmB,CAAC,SAAS,CAAC,EAC9B,eAAe,EACf,yBAAyB,EACzB,4BAA4B,CAC7B,CAAA;AA4RD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,cAAc,EACd,gBAA8C,EAC9C,SAAS,EACT,OAAO,EACP,iBAAiB,EACjB,KAAK,EACL,GAAG,EACH,GAAG,EACH,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,IAAW,EACX,KAAK,EACL,uBAA+B,EAC/B,GAAG,SAAS,EACb,EAAE,sBAAsB,qBAmLxB;yBA1Me,UAAU"}
@@ -4,7 +4,7 @@ import { parseDate as $58246871e4652552$export$6b862160d295c8e } from './../../e
4
4
  import Icon from '../../utilities/Icon.js';
5
5
  import { useDateFieldLocale } from '../../utilities/useDateFieldLocale.js';
6
6
  import classNames from 'classnames';
7
- import React, { useState, useContext } from 'react';
7
+ import React, { useState, useRef, useEffect, useMemo, useContext } from 'react';
8
8
  import { I18nProvider } from 'react-aria/I18nProvider';
9
9
  import { CalendarStateContext } from 'react-aria-components/Calendar';
10
10
  import { DatePicker as DatePicker$1, Label, Group, DateInput, DateSegment, Button, Popover, Calendar, Text, CalendarGrid, CalendarGridHeader, CalendarHeaderCell, CalendarGridBody, CalendarCell } from 'react-aria-components/DatePicker';
@@ -97,8 +97,14 @@ function DatePickerCalendarBody({ activeOverlay, setActiveOverlay, }) {
97
97
  }
98
98
  function useValue({ defaultValue, onChange, value, }) {
99
99
  const [uncontrolledValue, setUncontrolledValue] = useState(() => toCalendarDate(defaultValue) ?? null);
100
+ // react-aria rebuilds the segments whenever the value's reference changes,
101
+ // so a new object for the same date would wipe a partly typed one
102
+ const valueKey = value == null ? value : value.toString();
103
+ const controlledValue = useMemo(() => toCalendarDate(value) ?? null,
104
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- convert again only when the date changes, not the object
105
+ [valueKey]);
100
106
  if (value !== undefined) {
101
- return [toCalendarDate(value) ?? null, (...args) => onChange?.(...args)];
107
+ return [controlledValue, (...args) => onChange?.(...args)];
102
108
  }
103
109
  return [
104
110
  uncontrolledValue,
@@ -122,6 +128,11 @@ function expandTwoDigitYearsViaPOSIX(date) {
122
128
  fullYear -= 100;
123
129
  return date.set({ year: fullYear });
124
130
  }
131
+ function isPartlyFilled(field) {
132
+ const segments = Array.from(field?.querySelectorAll('[data-type]:not([data-type="literal"])') ?? []);
133
+ const blankCount = segments.filter((segment) => segment.hasAttribute("data-placeholder")).length;
134
+ return blankCount > 0 && blankCount < segments.length;
135
+ }
125
136
  /**
126
137
  * A date picker allows a user to select a particular date.
127
138
  * The input supports keyboard entry of individual day, month, and year segments;
@@ -142,7 +153,7 @@ function expandTwoDigitYearsViaPOSIX(date) {
142
153
  * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-datepicker--docs | Storybook Documentation}
143
154
  * @see {@link https://github.com/planningcenter/tapestry/tree/main/packages/tapestry-migration-cli | Migration CLI: Available}
144
155
  */
145
- function DatePicker({ className, defaultValue, description, disabled, firstDayOfWeek, formatDateOnBlur = expandTwoDigitYearsViaPOSIX, hideLabel, invalid, isDateUnavailable, label, max, min, onBlur, onChange, readOnly, required, size = "md", value, alwaysShowFourDigitYear = false, ...restProps }) {
156
+ function DatePicker({ className, defaultValue, description, disabled, firstDayOfWeek, formatDateOnBlur = expandTwoDigitYearsViaPOSIX, hideLabel, invalid, isDateUnavailable, label, max, min, name, onBlur, onChange, onFocus, readOnly, required, size = "md", value, alwaysShowFourDigitYear = false, ...restProps }) {
146
157
  const convertedMin = toCalendarDate(min) ?? undefined;
147
158
  const convertedMax = toCalendarDate(max) ?? undefined;
148
159
  const combinedClassName = classNames("tds-field tds-date-picker", {
@@ -155,23 +166,64 @@ function DatePicker({ className, defaultValue, description, disabled, firstDayOf
155
166
  onChange,
156
167
  value,
157
168
  });
169
+ // react-aria only reports complete dates, and rebuilds the segments whenever
170
+ // its value changes. So once a partly filled date reports null, react-aria
171
+ // keeps the last complete date it held, or it would wipe the partial text.
172
+ // See adobe/react-spectrum#9624 and #9801.
173
+ const [heldValue, setHeldValue] = useState(null);
174
+ const valueKey = computedValue?.toString() ?? null;
175
+ const [lastValueKey, setLastValueKey] = useState(valueKey);
176
+ if (valueKey !== lastValueKey) {
177
+ setLastValueKey(valueKey);
178
+ if (computedValue)
179
+ setHeldValue(null);
180
+ }
181
+ // onBlur reads this; react-aria can report a change earlier in the same blur event
182
+ const heldValueRef = useRef(heldValue);
183
+ useEffect(() => {
184
+ heldValueRef.current = heldValue;
185
+ }, [heldValue]);
186
+ const [valueBeforeEdit, setValueBeforeEdit] = useState(computedValue);
187
+ const [openedPartlyFilled, setOpenedPartlyFilled] = useState(false);
188
+ const fieldRef = useRef(null);
158
189
  const dateFieldLocale = useDateFieldLocale();
159
190
  return (React.createElement(DatePicker$1, { ...restProps, "aria-label": hideLabel ? label : undefined, className: combinedClassName, isDateUnavailable: isDateUnavailable, isDisabled: disabled, isReadOnly: readOnly, isRequired: required, maxValue: convertedMax, minValue: convertedMin, onBlur: (event) => {
191
+ if (isPartlyFilled(fieldRef.current)) {
192
+ if (computedValue) {
193
+ setHeldValue(computedValue);
194
+ setComputedValue(null);
195
+ }
196
+ }
197
+ else if (heldValueRef.current) {
198
+ // Refilled to the date react-aria still held, so it reported no change
199
+ setHeldValue(null);
200
+ setComputedValue(heldValueRef.current);
201
+ }
202
+ else if (formatDateOnBlur && computedValue) {
203
+ const formattedValue = formatDateOnBlur(computedValue);
204
+ if (!$ad063034c8620db8$export$ea39ec197993aef0(formattedValue, computedValue)) {
205
+ setComputedValue(formattedValue);
206
+ }
207
+ }
160
208
  onBlur?.(event);
161
- if (!formatDateOnBlur || !computedValue)
162
- return;
163
- const formattedValue = formatDateOnBlur(computedValue);
164
- if ($ad063034c8620db8$export$ea39ec197993aef0(formattedValue, computedValue))
165
- return;
166
- setComputedValue(formattedValue);
167
209
  }, onChange: (newValue) => {
210
+ heldValueRef.current = null;
211
+ setHeldValue(null);
212
+ if (newValue === null && computedValue === null)
213
+ return;
168
214
  setComputedValue(newValue);
215
+ }, onFocus: (event) => {
216
+ if (!heldValue)
217
+ setValueBeforeEdit(computedValue);
218
+ onFocus?.(event);
169
219
  }, onOpenChange: (isOpen) => {
170
- if (!isOpen)
220
+ if (isOpen)
221
+ setOpenedPartlyFilled(isPartlyFilled(fieldRef.current));
222
+ else
171
223
  setActiveOverlay(null);
172
- }, value: computedValue },
224
+ }, validate: () => (heldValue && required ? "Enter a full date" : null), value: heldValue ?? computedValue },
173
225
  !hideLabel && React.createElement(Label, { className: "tds-field-label" }, label),
174
- React.createElement(Group, { "aria-invalid": invalid || undefined, className: "tds-field-control tds-date-picker-field" },
226
+ React.createElement(Group, { "aria-invalid": invalid || undefined, className: "tds-field-control tds-date-picker-field", ref: fieldRef },
175
227
  React.createElement(I18nProvider, { locale: dateFieldLocale },
176
228
  React.createElement(DateInput, { className: "tds-date-picker-input" }, (segment) => (React.createElement(DateSegment, { "aria-invalid": invalid || undefined, className: segment.type === "literal"
177
229
  ? "tds-field-date-segment-separator"
@@ -193,11 +245,14 @@ function DatePicker({ className, defaultValue, description, disabled, firstDayOf
193
245
  "tds-date-picker-popover--lg": size === "lg",
194
246
  }), offset: 2 },
195
247
  React.createElement(Dialog, null,
196
- React.createElement(Calendar, { className: "tds-date-picker-calendar", firstDayOfWeek: firstDayOfWeek },
248
+ React.createElement(Calendar, { className: "tds-date-picker-calendar", defaultFocusedValue: openedPartlyFilled ? (valueBeforeEdit ?? undefined) : undefined, firstDayOfWeek: firstDayOfWeek, value: openedPartlyFilled ? null : undefined },
197
249
  React.createElement(DatePickerCalendarBody, { activeOverlay: activeOverlay, setActiveOverlay: setActiveOverlay })))),
198
250
  description && (React.createElement(Text, { elementType: "p", className: "tds-field-description", slot: "description" },
199
251
  React.createElement(Icon, { "aria-hidden": true, className: "tds-field-description-invalid-icon", symbol: "general#exclamation-triangle" }),
200
- description))));
252
+ description)),
253
+ name && (
254
+ // Submits the reported value, which react-aria's own input can't while it holds a partly filled date
255
+ React.createElement("input", { disabled: disabled, hidden: true, name: name, onChange: () => { }, type: "text", value: computedValue?.toString() ?? "" }))));
201
256
  }
202
257
  DatePicker.displayName = "DatePicker";
203
258