@flipdish/ui-library 0.48.3 → 0.50.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 (218) hide show
  1. package/dist/components/atoms/Button/components/ButtonIcon.cjs +17 -0
  2. package/dist/components/atoms/Button/components/ButtonIcon.cjs.map +1 -0
  3. package/dist/components/atoms/Button/components/ButtonIcon.d.ts +14 -0
  4. package/dist/components/atoms/Button/components/ButtonIcon.d.ts.map +1 -0
  5. package/dist/components/atoms/Button/components/ButtonIcon.js +15 -0
  6. package/dist/components/atoms/Button/components/ButtonIcon.js.map +1 -0
  7. package/dist/components/atoms/Button/components/ButtonSpinner.cjs +11 -0
  8. package/dist/components/atoms/Button/components/ButtonSpinner.cjs.map +1 -0
  9. package/dist/components/atoms/Button/components/ButtonSpinner.d.ts +8 -0
  10. package/dist/components/atoms/Button/components/ButtonSpinner.d.ts.map +1 -0
  11. package/dist/components/atoms/Button/components/ButtonSpinner.js +9 -0
  12. package/dist/components/atoms/Button/components/ButtonSpinner.js.map +1 -0
  13. package/dist/components/atoms/Button/index.cjs +6 -6
  14. package/dist/components/atoms/Button/index.cjs.map +1 -1
  15. package/dist/components/atoms/Button/index.d.ts +2 -0
  16. package/dist/components/atoms/Button/index.d.ts.map +1 -1
  17. package/dist/components/atoms/Button/index.js +6 -6
  18. package/dist/components/atoms/Button/index.js.map +1 -1
  19. package/dist/components/atoms/Checkbox/index.cjs +22 -2
  20. package/dist/components/atoms/Checkbox/index.cjs.map +1 -1
  21. package/dist/components/atoms/Checkbox/index.d.ts +23 -4
  22. package/dist/components/atoms/Checkbox/index.d.ts.map +1 -1
  23. package/dist/components/atoms/Checkbox/index.js +24 -5
  24. package/dist/components/atoms/Checkbox/index.js.map +1 -1
  25. package/dist/components/atoms/Input/index.cjs +0 -1
  26. package/dist/components/atoms/Input/index.cjs.map +1 -1
  27. package/dist/components/atoms/Input/index.d.ts.map +1 -1
  28. package/dist/components/atoms/Input/index.js +0 -1
  29. package/dist/components/atoms/Input/index.js.map +1 -1
  30. package/dist/components/atoms/RadioButton/index.cjs.map +1 -1
  31. package/dist/components/atoms/RadioButton/index.d.ts +1 -0
  32. package/dist/components/atoms/RadioButton/index.d.ts.map +1 -1
  33. package/dist/components/atoms/RadioButton/index.js.map +1 -1
  34. package/dist/components/atoms/Slider/index.cjs +9 -3
  35. package/dist/components/atoms/Slider/index.cjs.map +1 -1
  36. package/dist/components/atoms/Slider/index.d.ts +3 -1
  37. package/dist/components/atoms/Slider/index.d.ts.map +1 -1
  38. package/dist/components/atoms/Slider/index.js +10 -4
  39. package/dist/components/atoms/Slider/index.js.map +1 -1
  40. package/dist/components/atoms/Toggle/index.cjs +6 -2
  41. package/dist/components/atoms/Toggle/index.cjs.map +1 -1
  42. package/dist/components/atoms/Toggle/index.d.ts.map +1 -1
  43. package/dist/components/atoms/Toggle/index.js +6 -2
  44. package/dist/components/atoms/Toggle/index.js.map +1 -1
  45. package/dist/components/molecules/EmptyState/index.cjs +8 -0
  46. package/dist/components/molecules/EmptyState/index.cjs.map +1 -1
  47. package/dist/components/molecules/EmptyState/index.d.ts +19 -0
  48. package/dist/components/molecules/EmptyState/index.d.ts.map +1 -1
  49. package/dist/components/molecules/EmptyState/index.js +10 -3
  50. package/dist/components/molecules/EmptyState/index.js.map +1 -1
  51. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.cjs +7 -1
  52. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.cjs.map +1 -1
  53. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.d.ts.map +1 -1
  54. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.js +8 -2
  55. package/dist/components/molecules/RadioGroup/components/RadioGroupAvatar.js.map +1 -1
  56. package/dist/components/molecules/RadioGroup/components/RadioGroupCheckbox.cjs +7 -1
  57. package/dist/components/molecules/RadioGroup/components/RadioGroupCheckbox.cjs.map +1 -1
  58. package/dist/components/molecules/RadioGroup/components/RadioGroupCheckbox.d.ts.map +1 -1
  59. package/dist/components/molecules/RadioGroup/components/RadioGroupCheckbox.js +8 -2
  60. package/dist/components/molecules/RadioGroup/components/RadioGroupCheckbox.js.map +1 -1
  61. package/dist/components/molecules/RadioGroup/components/RadioGroupIconCard.cjs +13 -1
  62. package/dist/components/molecules/RadioGroup/components/RadioGroupIconCard.cjs.map +1 -1
  63. package/dist/components/molecules/RadioGroup/components/RadioGroupIconCard.d.ts.map +1 -1
  64. package/dist/components/molecules/RadioGroup/components/RadioGroupIconCard.js +13 -1
  65. package/dist/components/molecules/RadioGroup/components/RadioGroupIconCard.js.map +1 -1
  66. package/dist/components/molecules/RadioGroup/components/RadioGroupIconSimple.cjs +7 -1
  67. package/dist/components/molecules/RadioGroup/components/RadioGroupIconSimple.cjs.map +1 -1
  68. package/dist/components/molecules/RadioGroup/components/RadioGroupIconSimple.d.ts.map +1 -1
  69. package/dist/components/molecules/RadioGroup/components/RadioGroupIconSimple.js +8 -2
  70. package/dist/components/molecules/RadioGroup/components/RadioGroupIconSimple.js.map +1 -1
  71. package/dist/components/molecules/RadioGroup/components/RadioGroupPaymentIcon.cjs +6 -1
  72. package/dist/components/molecules/RadioGroup/components/RadioGroupPaymentIcon.cjs.map +1 -1
  73. package/dist/components/molecules/RadioGroup/components/RadioGroupPaymentIcon.d.ts.map +1 -1
  74. package/dist/components/molecules/RadioGroup/components/RadioGroupPaymentIcon.js +7 -2
  75. package/dist/components/molecules/RadioGroup/components/RadioGroupPaymentIcon.js.map +1 -1
  76. package/dist/components/molecules/RadioGroup/components/RadioGroupRadioButton.cjs +10 -3
  77. package/dist/components/molecules/RadioGroup/components/RadioGroupRadioButton.cjs.map +1 -1
  78. package/dist/components/molecules/RadioGroup/components/RadioGroupRadioButton.d.ts +6 -4
  79. package/dist/components/molecules/RadioGroup/components/RadioGroupRadioButton.d.ts.map +1 -1
  80. package/dist/components/molecules/RadioGroup/components/RadioGroupRadioButton.js +11 -4
  81. package/dist/components/molecules/RadioGroup/components/RadioGroupRadioButton.js.map +1 -1
  82. package/dist/components/molecules/RadioGroup/hooks/useOptionIds.cjs +24 -0
  83. package/dist/components/molecules/RadioGroup/hooks/useOptionIds.cjs.map +1 -0
  84. package/dist/components/molecules/RadioGroup/hooks/useOptionIds.d.ts +10 -0
  85. package/dist/components/molecules/RadioGroup/hooks/useOptionIds.d.ts.map +1 -0
  86. package/dist/components/molecules/RadioGroup/hooks/useOptionIds.js +22 -0
  87. package/dist/components/molecules/RadioGroup/hooks/useOptionIds.js.map +1 -0
  88. package/dist/components/molecules/RadioGroup/index.d.ts +1 -1
  89. package/dist/components/molecules/RadioGroup/index.d.ts.map +1 -1
  90. package/dist/components/molecules/RadioGroup/radioGroup.types.d.ts +14 -0
  91. package/dist/components/molecules/RadioGroup/radioGroup.types.d.ts.map +1 -1
  92. package/dist/components/molecules/Select/components/Combobox.cjs +2 -1
  93. package/dist/components/molecules/Select/components/Combobox.cjs.map +1 -1
  94. package/dist/components/molecules/Select/components/Combobox.d.ts +2 -1
  95. package/dist/components/molecules/Select/components/Combobox.d.ts.map +1 -1
  96. package/dist/components/molecules/Select/components/Combobox.js +2 -1
  97. package/dist/components/molecules/Select/components/Combobox.js.map +1 -1
  98. package/dist/components/molecules/Select/components/MultiSelect.cjs +3 -2
  99. package/dist/components/molecules/Select/components/MultiSelect.cjs.map +1 -1
  100. package/dist/components/molecules/Select/components/MultiSelect.d.ts +3 -3
  101. package/dist/components/molecules/Select/components/MultiSelect.d.ts.map +1 -1
  102. package/dist/components/molecules/Select/components/MultiSelect.js +5 -4
  103. package/dist/components/molecules/Select/components/MultiSelect.js.map +1 -1
  104. package/dist/components/molecules/Select/components/SelectItem.cjs +8 -0
  105. package/dist/components/molecules/Select/components/SelectItem.cjs.map +1 -1
  106. package/dist/components/molecules/Select/components/SelectItem.d.ts +7 -0
  107. package/dist/components/molecules/Select/components/SelectItem.d.ts.map +1 -1
  108. package/dist/components/molecules/Select/components/SelectItem.js +8 -1
  109. package/dist/components/molecules/Select/components/SelectItem.js.map +1 -1
  110. package/dist/components/molecules/Select/index.cjs +1 -1
  111. package/dist/components/molecules/Select/index.cjs.map +1 -1
  112. package/dist/components/molecules/Select/index.d.ts +3 -3
  113. package/dist/components/molecules/Select/index.d.ts.map +1 -1
  114. package/dist/components/molecules/Select/index.js +2 -2
  115. package/dist/components/molecules/Select/index.js.map +1 -1
  116. package/dist/components/organisms/ColorPicker/colorPicker.utils.cjs +26 -0
  117. package/dist/components/organisms/ColorPicker/colorPicker.utils.cjs.map +1 -1
  118. package/dist/components/organisms/ColorPicker/colorPicker.utils.d.ts +15 -0
  119. package/dist/components/organisms/ColorPicker/colorPicker.utils.d.ts.map +1 -1
  120. package/dist/components/organisms/ColorPicker/colorPicker.utils.js +25 -1
  121. package/dist/components/organisms/ColorPicker/colorPicker.utils.js.map +1 -1
  122. package/dist/components/organisms/ColorPicker/components/ColorPickerDialog.cjs +15 -0
  123. package/dist/components/organisms/ColorPicker/components/ColorPickerDialog.cjs.map +1 -0
  124. package/dist/components/organisms/ColorPicker/components/ColorPickerDialog.d.ts +12 -0
  125. package/dist/components/organisms/ColorPicker/components/ColorPickerDialog.d.ts.map +1 -0
  126. package/dist/components/organisms/ColorPicker/components/ColorPickerDialog.js +13 -0
  127. package/dist/components/organisms/ColorPicker/components/ColorPickerDialog.js.map +1 -0
  128. package/dist/components/organisms/ColorPicker/components/ColorPickerField.cjs +51 -0
  129. package/dist/components/organisms/ColorPicker/components/ColorPickerField.cjs.map +1 -0
  130. package/dist/components/organisms/ColorPicker/components/ColorPickerField.d.ts +48 -0
  131. package/dist/components/organisms/ColorPicker/components/ColorPickerField.d.ts.map +1 -0
  132. package/dist/components/organisms/ColorPicker/components/ColorPickerField.js +49 -0
  133. package/dist/components/organisms/ColorPicker/components/ColorPickerField.js.map +1 -0
  134. package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.cjs +69 -0
  135. package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.cjs.map +1 -0
  136. package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.d.ts +29 -0
  137. package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.d.ts.map +1 -0
  138. package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.js +67 -0
  139. package/dist/components/organisms/ColorPicker/hooks/useColorFieldEdit.js.map +1 -0
  140. package/dist/components/organisms/ColorPicker/index.cjs +6 -7
  141. package/dist/components/organisms/ColorPicker/index.cjs.map +1 -1
  142. package/dist/components/organisms/ColorPicker/index.d.ts +4 -6
  143. package/dist/components/organisms/ColorPicker/index.d.ts.map +1 -1
  144. package/dist/components/organisms/ColorPicker/index.js +6 -7
  145. package/dist/components/organisms/ColorPicker/index.js.map +1 -1
  146. package/dist/components/organisms/DatePicker/components/DateRangePicker.cjs +17 -13
  147. package/dist/components/organisms/DatePicker/components/DateRangePicker.cjs.map +1 -1
  148. package/dist/components/organisms/DatePicker/components/DateRangePicker.d.ts +8 -1
  149. package/dist/components/organisms/DatePicker/components/DateRangePicker.d.ts.map +1 -1
  150. package/dist/components/organisms/DatePicker/components/DateRangePicker.js +17 -13
  151. package/dist/components/organisms/DatePicker/components/DateRangePicker.js.map +1 -1
  152. package/dist/components/organisms/DatePicker/index.cjs +14 -10
  153. package/dist/components/organisms/DatePicker/index.cjs.map +1 -1
  154. package/dist/components/organisms/DatePicker/index.d.ts +8 -1
  155. package/dist/components/organisms/DatePicker/index.d.ts.map +1 -1
  156. package/dist/components/organisms/DatePicker/index.js +14 -10
  157. package/dist/components/organisms/DatePicker/index.js.map +1 -1
  158. package/dist/components/templates/PageHubLayout/components/PageHubLayoutSectionNav.cjs +26 -0
  159. package/dist/components/templates/PageHubLayout/components/PageHubLayoutSectionNav.cjs.map +1 -0
  160. package/dist/components/templates/PageHubLayout/components/PageHubLayoutSectionNav.d.ts +20 -0
  161. package/dist/components/templates/PageHubLayout/components/PageHubLayoutSectionNav.d.ts.map +1 -0
  162. package/dist/components/templates/PageHubLayout/components/PageHubLayoutSectionNav.js +24 -0
  163. package/dist/components/templates/PageHubLayout/components/PageHubLayoutSectionNav.js.map +1 -0
  164. package/dist/components/templates/PageHubLayout/index.cjs +65 -0
  165. package/dist/components/templates/PageHubLayout/index.cjs.map +1 -0
  166. package/dist/components/templates/PageHubLayout/index.d.ts +56 -0
  167. package/dist/components/templates/PageHubLayout/index.d.ts.map +1 -0
  168. package/dist/components/templates/PageHubLayout/index.js +63 -0
  169. package/dist/components/templates/PageHubLayout/index.js.map +1 -0
  170. package/dist/components/templates/PageHubLayout/pageHubLayout.types.d.ts +20 -0
  171. package/dist/components/templates/PageHubLayout/pageHubLayout.types.d.ts.map +1 -0
  172. package/dist/components/templates/PageHubLayout/pageHubLayout.utils.cjs +27 -0
  173. package/dist/components/templates/PageHubLayout/pageHubLayout.utils.cjs.map +1 -0
  174. package/dist/components/templates/PageHubLayout/pageHubLayout.utils.d.ts +21 -0
  175. package/dist/components/templates/PageHubLayout/pageHubLayout.utils.d.ts.map +1 -0
  176. package/dist/components/templates/PageHubLayout/pageHubLayout.utils.js +24 -0
  177. package/dist/components/templates/PageHubLayout/pageHubLayout.utils.js.map +1 -0
  178. package/dist/components/templates/PageLayout/index.cjs +7 -1
  179. package/dist/components/templates/PageLayout/index.cjs.map +1 -1
  180. package/dist/components/templates/PageLayout/index.d.ts +2 -1
  181. package/dist/components/templates/PageLayout/index.d.ts.map +1 -1
  182. package/dist/components/templates/PageLayout/index.js +7 -1
  183. package/dist/components/templates/PageLayout/index.js.map +1 -1
  184. package/dist/components/templates/WidgetLayout/index.cjs +7 -1
  185. package/dist/components/templates/WidgetLayout/index.cjs.map +1 -1
  186. package/dist/components/templates/WidgetLayout/index.d.ts +4 -1
  187. package/dist/components/templates/WidgetLayout/index.d.ts.map +1 -1
  188. package/dist/components/templates/WidgetLayout/index.js +7 -1
  189. package/dist/components/templates/WidgetLayout/index.js.map +1 -1
  190. package/dist/hooks/useFocusAfterRetry/index.cjs +31 -0
  191. package/dist/hooks/useFocusAfterRetry/index.cjs.map +1 -0
  192. package/dist/hooks/useFocusAfterRetry/index.d.ts +13 -0
  193. package/dist/hooks/useFocusAfterRetry/index.d.ts.map +1 -0
  194. package/dist/hooks/useFocusAfterRetry/index.js +29 -0
  195. package/dist/hooks/useFocusAfterRetry/index.js.map +1 -0
  196. package/dist/native/components/atoms/Button/index.d.ts +2 -0
  197. package/dist/native/components/atoms/Button/index.d.ts.map +1 -1
  198. package/dist/native/components/atoms/Button/index.js +5 -3
  199. package/dist/native/components/atoms/Button/index.js.map +1 -1
  200. package/dist/native/components/atoms/Checkbox/index.d.ts +35 -3
  201. package/dist/native/components/atoms/Checkbox/index.d.ts.map +1 -1
  202. package/dist/native/components/atoms/Checkbox/index.js +47 -10
  203. package/dist/native/components/atoms/Checkbox/index.js.map +1 -1
  204. package/dist/native/components/templates/PageHubLayout/index.d.ts +12 -0
  205. package/dist/native/hooks/useFocusAfterRetry/index.d.ts +12 -0
  206. package/dist/utilities/__internal__/ariaIdsUtils/ariaIds.utils.cjs +12 -0
  207. package/dist/utilities/__internal__/ariaIdsUtils/ariaIds.utils.cjs.map +1 -0
  208. package/dist/utilities/__internal__/ariaIdsUtils/ariaIds.utils.d.ts +8 -0
  209. package/dist/utilities/__internal__/ariaIdsUtils/ariaIds.utils.d.ts.map +1 -0
  210. package/dist/utilities/__internal__/ariaIdsUtils/ariaIds.utils.js +10 -0
  211. package/dist/utilities/__internal__/ariaIdsUtils/ariaIds.utils.js.map +1 -0
  212. package/dist/utilities/__internal__/refUtils/ref.utils.cjs +22 -0
  213. package/dist/utilities/__internal__/refUtils/ref.utils.cjs.map +1 -0
  214. package/dist/utilities/__internal__/refUtils/ref.utils.d.ts +15 -0
  215. package/dist/utilities/__internal__/refUtils/ref.utils.d.ts.map +1 -0
  216. package/dist/utilities/__internal__/refUtils/ref.utils.js +20 -0
  217. package/dist/utilities/__internal__/refUtils/ref.utils.js.map +1 -0
  218. package/package.json +2 -2
@@ -3,6 +3,8 @@
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var uiIcons = require('@flipdish/ui-icons');
5
5
  var Button = require('@flipdish/ui-library/components/atoms/Button');
6
+ var Input = require('@flipdish/ui-library/components/atoms/Input');
7
+ var cx = require('@flipdish/ui-library/utilities/cx');
6
8
  var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
7
9
  var date = require('@internationalized/date');
8
10
  var i18n = require('@react-aria/i18n');
@@ -21,7 +23,7 @@ const highlightedDates = [date.today(date.getLocalTimeZone())];
21
23
  *
22
24
  * @summary popover calendar for selecting a single date
23
25
  */
24
- const DatePicker = ({ value: valueProp, defaultValue, onChange, onApply, onCancel, onOpenChange, size = 'sm', placeholder = 'Select date', 'data-testid': dataTestId, ...props }) => {
26
+ const DatePicker = ({ value: valueProp, defaultValue, onChange, onApply, onCancel, onOpenChange, size = 'sm', placeholder = 'Select date', label, hint, className, ref, 'data-testid': dataTestId, ...props }) => {
25
27
  const formatter = i18n.useDateFormatter({
26
28
  month: 'short',
27
29
  day: 'numeric',
@@ -35,7 +37,9 @@ const DatePicker = ({ value: valueProp, defaultValue, onChange, onApply, onCance
35
37
  const [draftValue, setDraftValue] = React.useState(value);
36
38
  const formattedDate = value ? formatter.format(value.toDate(date.getLocalTimeZone())) : placeholder;
37
39
  const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'date-picker', rootName: 'date-picker' });
38
- return (jsxRuntime.jsx(testIdUtils.TestIdProvider, { value: rootTestId, children: jsxRuntime.jsxs(reactAriaComponents.DatePicker, { "aria-label": "Date picker", shouldCloseOnSelect: false, ...props, value: draftValue, onChange: setDraftValue, onOpenChange: (isOpen) => {
40
+ return (jsxRuntime.jsx(testIdUtils.TestIdProvider, { value: rootTestId, children: jsxRuntime.jsx(reactAriaComponents.DatePicker
41
+ // A visible label names the picker; without one this default does, unless `aria-label` is passed.
42
+ , { "aria-label": label ? undefined : 'Date picker', shouldCloseOnSelect: false, ...props, ref: ref, className: (state) => cx.cx('flex flex-col items-start gap-1.5', typeof className === 'function' ? className(state) : className), value: draftValue, onChange: setDraftValue, onOpenChange: (isOpen) => {
39
43
  // Re-seed the draft from the latest committed value every time the popover opens, so
40
44
  // a stale in-progress edit from a previous Cancel/dismiss never leaks in, and a
41
45
  // controlled `value` that changed while closed is always the starting point.
@@ -43,14 +47,14 @@ const DatePicker = ({ value: valueProp, defaultValue, onChange, onApply, onCance
43
47
  setDraftValue(value);
44
48
  }
45
49
  onOpenChange?.(isOpen);
46
- }, "data-testid": rootTestId, children: [jsxRuntime.jsx(reactAriaComponents.Group, { children: jsxRuntime.jsx(Button.Button, { size: size, color: "secondary", iconLeading: uiIcons.Calendar, "data-testid": testIdUtils.joinTestId(rootTestId, 'trigger'), children: formattedDate }) }), jsxRuntime.jsx(CalendarOverlay.CalendarOverlay, { "aria-label": props['aria-label'] ?? 'Date picker', "data-testid": testIdUtils.joinTestId(rootTestId, 'popover'), children: ({ close }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "flex w-full max-w-78 px-4 py-5 sm:max-w-82 sm:px-6", children: jsxRuntime.jsx(Calendar.Calendar, { highlightedDates: highlightedDates }) }), jsxRuntime.jsxs("div", { className: "sticky bottom-0 grid w-full grid-cols-2 gap-3 border-t border-secondary bg-primary px-4 pt-4 pb-[calc(1rem+env(safe-area-inset-bottom))]", children: [jsxRuntime.jsx(Button.Button, { size: "md", color: "secondary", "data-testid": testIdUtils.joinTestId(rootTestId, 'cancel'), onClick: () => {
47
- onCancel?.();
48
- close();
49
- }, children: "Cancel" }), jsxRuntime.jsx(Button.Button, { size: "md", color: "primary", "data-testid": testIdUtils.joinTestId(rootTestId, 'apply'), onClick: () => {
50
- setValue(draftValue);
51
- onApply?.();
52
- close();
53
- }, children: "Apply" })] })] })) })] }) }));
50
+ }, "data-testid": rootTestId, children: ({ isInvalid, isRequired }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [label && jsxRuntime.jsx(Input.Label, { isRequired: isRequired, children: label }), jsxRuntime.jsx(reactAriaComponents.Group, { children: jsxRuntime.jsx(Button.Button, { size: size, color: "secondary", iconLeading: uiIcons.Calendar, className: cx.cx(isInvalid && 'ring-error_subtle'), "aria-label": `Calendar, ${formattedDate}`, "data-testid": testIdUtils.joinTestId(rootTestId, 'trigger'), children: formattedDate }) }), hint && jsxRuntime.jsx(Input.HintText, { isInvalid: isInvalid, children: hint }), jsxRuntime.jsx(CalendarOverlay.CalendarOverlay, { "aria-label": props['aria-label'] ?? label ?? 'Date picker', "data-testid": testIdUtils.joinTestId(rootTestId, 'popover'), children: ({ close }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "flex w-full max-w-78 px-4 py-5 sm:max-w-82 sm:px-6", children: jsxRuntime.jsx(Calendar.Calendar, { highlightedDates: highlightedDates }) }), jsxRuntime.jsxs("div", { className: "sticky bottom-0 grid w-full grid-cols-2 gap-3 border-t border-secondary bg-primary px-4 pt-4 pb-[calc(1rem+env(safe-area-inset-bottom))]", children: [jsxRuntime.jsx(Button.Button, { size: "md", color: "secondary", "data-testid": testIdUtils.joinTestId(rootTestId, 'cancel'), onClick: () => {
51
+ onCancel?.();
52
+ close();
53
+ }, children: "Cancel" }), jsxRuntime.jsx(Button.Button, { size: "md", color: "primary", "data-testid": testIdUtils.joinTestId(rootTestId, 'apply'), onClick: () => {
54
+ setValue(draftValue);
55
+ onApply?.();
56
+ close();
57
+ }, children: "Apply" })] })] })) })] })) }) }));
54
58
  };
55
59
 
56
60
  exports.DateRangePicker = DateRangePicker.DateRangePicker;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/DatePicker/index.tsx"],"sourcesContent":[null],"names":["today","getLocalTimeZone","useDateFormatter","useControlledState","useState","useResolvedTestId","_jsx","TestIdProvider","_jsxs","AriaDatePicker","AriaGroup","Button","CalendarIcon","joinTestId","CalendarOverlay","_Fragment","Calendar"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAM,gB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AE;wCACT,CAAC,EAAA,QAAA,EAAA,OAAA,EAAA,CAGM,IACL,CAAA,EAAA,CACL,CACJ,GACe,CAAA,EAAA,CACH,EAAA,CACF;AAErB;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/DatePicker/index.tsx"],"sourcesContent":[null],"names":["today","getLocalTimeZone","useDateFormatter","useControlledState","useState","useResolvedTestId","_jsx","TestIdProvider","AriaDatePicker","cx","_jsxs","_Fragment","Label","AriaGroup","Button","CalendarIcon","joinTestId","HintText","CalendarOverlay","Calendar"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAM,gBAAgB,GAAG,CAACA,UAAK,CAACC,qBAAgB,EAAE,CAAC,CAAC;AAqBpD;;;;;AAKG;MACU,UAAU,GAAG,CAAC,EACzB,KAAK,EAAE,SAAS,EAChB,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,IAAI,GAAG,IAAI,EACX,WAAW,GAAG,aAAa,EAC3B,KAAK,EACL,IAAI,EACJ,SAAS,EACT,GAAG,EACH,aAAa,EAAE,UAAU,EACzB,GAAG,KAAK,EACQ,KAAI;IACpB,MAAM,SAAS,GAAGC,qBAAgB,CAAC;AACjC,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,GAAG,EAAE,SAAS;AACd,QAAA,IAAI,EAAE,SAAS;AAChB,KAAA,CAAC;;;;;AAKF,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAGC,wBAAkB,CAAC,SAAS,EAAE,YAAY,IAAI,IAAI,EAAE,QAAQ,CAAC;IACvF,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGC,cAAQ,CAAmB,KAAK,CAAC;IAErE,MAAM,aAAa,GAAG,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAACH,qBAAgB,EAAE,CAAC,CAAC,GAAG,WAAW;AAE9F,IAAA,MAAM,UAAU,GAAGI,6BAAiB,CA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components/atoms/Button';
2
+ import { type ReactNode, type Ref } from 'react';
2
3
  import type { DatePickerProps as AriaDatePickerProps, DateValue } from 'react-aria-components';
3
4
  export { DateRangePicker, type DateRangePickerProps } from './components/DateRangePicker';
4
5
  export { RangeCalendar, type RangeCalendarProps } from './components/RangeCalendar';
5
6
  export interface DatePickerProps extends AriaDatePickerProps<DateValue> {
7
+ /** Visible label above the trigger; it names the trigger and the calendar. When omitted, pass `aria-label`. */
8
+ label?: string;
9
+ /** Helper text beneath the trigger, read out as its description; shown as an error while `isInvalid` is set. */
10
+ hint?: ReactNode;
11
+ /** Ref forwarded to the root element, which holds the label, trigger and hint. */
12
+ ref?: Ref<HTMLDivElement>;
6
13
  /** The function to call when the apply button is clicked. */
7
14
  onApply?: () => void;
8
15
  /** The function to call when the cancel button is clicked. */
@@ -20,5 +27,5 @@ export interface DatePickerProps extends AriaDatePickerProps<DateValue> {
20
27
  *
21
28
  * @summary popover calendar for selecting a single date
22
29
  */
23
- export declare const DatePicker: ({ value: valueProp, defaultValue, onChange, onApply, onCancel, onOpenChange, size, placeholder, "data-testid": dataTestId, ...props }: DatePickerProps) => import("react").JSX.Element;
30
+ export declare const DatePicker: ({ value: valueProp, defaultValue, onChange, onApply, onCancel, onOpenChange, size, placeholder, label, hint, className, ref, "data-testid": dataTestId, ...props }: DatePickerProps) => import("react").JSX.Element;
24
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/DatePicker/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAMxF,OAAO,KAAK,EAAE,eAAe,IAAI,mBAAmB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAK/F,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAA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M,IAAI,CAAC;IACtB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sHAAsH;IACtH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,oKAexB,eAAe,gCAiGjB,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { Calendar } from '@flipdish/ui-icons';
3
3
  import { Button } from '@flipdish/ui-library/components/atoms/Button';
4
+ import { Label, HintText } from '@flipdish/ui-library/components/atoms/Input';
5
+ import { cx } from '@flipdish/ui-library/utilities/cx';
4
6
  import { useResolvedTestId, TestIdProvider, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
5
7
  import { today, getLocalTimeZone } from '@internationalized/date';
6
8
  import { useDateFormatter } from '@react-aria/i18n';
@@ -19,7 +21,7 @@ const highlightedDates = [today(getLocalTimeZone())];
19
21
  *
20
22
  * @summary popover calendar for selecting a single date
21
23
  */
22
- const DatePicker = ({ value: valueProp, defaultValue, onChange, onApply, onCancel, onOpenChange, size = 'sm', placeholder = 'Select date', 'data-testid': dataTestId, ...props }) => {
24
+ const DatePicker = ({ value: valueProp, defaultValue, onChange, onApply, onCancel, onOpenChange, size = 'sm', placeholder = 'Select date', label, hint, className, ref, 'data-testid': dataTestId, ...props }) => {
23
25
  const formatter = useDateFormatter({
24
26
  month: 'short',
25
27
  day: 'numeric',
@@ -33,7 +35,9 @@ const DatePicker = ({ value: valueProp, defaultValue, onChange, onApply, onCance
33
35
  const [draftValue, setDraftValue] = useState(value);
34
36
  const formattedDate = value ? formatter.format(value.toDate(getLocalTimeZone())) : placeholder;
35
37
  const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'date-picker', rootName: 'date-picker' });
36
- return (jsx(TestIdProvider, { value: rootTestId, children: jsxs(DatePicker$1, { "aria-label": "Date picker", shouldCloseOnSelect: false, ...props, value: draftValue, onChange: setDraftValue, onOpenChange: (isOpen) => {
38
+ return (jsx(TestIdProvider, { value: rootTestId, children: jsx(DatePicker$1
39
+ // A visible label names the picker; without one this default does, unless `aria-label` is passed.
40
+ , { "aria-label": label ? undefined : 'Date picker', shouldCloseOnSelect: false, ...props, ref: ref, className: (state) => cx('flex flex-col items-start gap-1.5', typeof className === 'function' ? className(state) : className), value: draftValue, onChange: setDraftValue, onOpenChange: (isOpen) => {
37
41
  // Re-seed the draft from the latest committed value every time the popover opens, so
38
42
  // a stale in-progress edit from a previous Cancel/dismiss never leaks in, and a
39
43
  // controlled `value` that changed while closed is always the starting point.
@@ -41,14 +45,14 @@ const DatePicker = ({ value: valueProp, defaultValue, onChange, onApply, onCance
41
45
  setDraftValue(value);
42
46
  }
43
47
  onOpenChange?.(isOpen);
44
- }, "data-testid": rootTestId, children: [jsx(Group, { children: jsx(Button, { size: size, color: "secondary", iconLeading: Calendar, "data-testid": joinTestId(rootTestId, 'trigger'), children: formattedDate }) }), jsx(CalendarOverlay, { "aria-label": props['aria-label'] ?? 'Date picker', "data-testid": joinTestId(rootTestId, 'popover'), children: ({ close }) => (jsxs(Fragment, { children: [jsx("div", { className: "flex w-full max-w-78 px-4 py-5 sm:max-w-82 sm:px-6", children: jsx(Calendar$1, { highlightedDates: highlightedDates }) }), jsxs("div", { className: "sticky bottom-0 grid w-full grid-cols-2 gap-3 border-t border-secondary bg-primary px-4 pt-4 pb-[calc(1rem+env(safe-area-inset-bottom))]", children: [jsx(Button, { size: "md", color: "secondary", "data-testid": joinTestId(rootTestId, 'cancel'), onClick: () => {
45
- onCancel?.();
46
- close();
47
- }, children: "Cancel" }), jsx(Button, { size: "md", color: "primary", "data-testid": joinTestId(rootTestId, 'apply'), onClick: () => {
48
- setValue(draftValue);
49
- onApply?.();
50
- close();
51
- }, children: "Apply" })] })] })) })] }) }));
48
+ }, "data-testid": rootTestId, children: ({ isInvalid, isRequired }) => (jsxs(Fragment, { children: [label && jsx(Label, { isRequired: isRequired, children: label }), jsx(Group, { children: jsx(Button, { size: size, color: "secondary", iconLeading: Calendar, className: cx(isInvalid && 'ring-error_subtle'), "aria-label": `Calendar, ${formattedDate}`, "data-testid": joinTestId(rootTestId, 'trigger'), children: formattedDate }) }), hint && jsx(HintText, { isInvalid: isInvalid, children: hint }), jsx(CalendarOverlay, { "aria-label": props['aria-label'] ?? label ?? 'Date picker', "data-testid": joinTestId(rootTestId, 'popover'), children: ({ close }) => (jsxs(Fragment, { children: [jsx("div", { className: "flex w-full max-w-78 px-4 py-5 sm:max-w-82 sm:px-6", children: jsx(Calendar$1, { highlightedDates: highlightedDates }) }), jsxs("div", { className: "sticky bottom-0 grid w-full grid-cols-2 gap-3 border-t border-secondary bg-primary px-4 pt-4 pb-[calc(1rem+env(safe-area-inset-bottom))]", children: [jsx(Button, { size: "md", color: "secondary", "data-testid": joinTestId(rootTestId, 'cancel'), onClick: () => {
49
+ onCancel?.();
50
+ close();
51
+ }, children: "Cancel" }), jsx(Button, { size: "md", color: "primary", "data-testid": joinTestId(rootTestId, 'apply'), onClick: () => {
52
+ setValue(draftValue);
53
+ onApply?.();
54
+ close();
55
+ }, children: "Apply" })] })] })) })] })) }) }));
52
56
  };
53
57
 
54
58
  export { DatePicker };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/organisms/DatePicker/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","AriaDatePicker","AriaGroup","CalendarIcon","_Fragment","Calendar"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAepD;;;;;AAKG;AACI,MAAM,UAAU,GAAG,CAAC,EACzB,KAAK,EAAE,SAAS,EAChB,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,IAAI,GAAG,IAAI,EACX,WAAW,GAAG,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aAAA,EAAe,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,EAAA,QAAA,EAC5G,aAAa,GACP,EAAA,CACC,EACZJ,GAAA,CAAC,eAAe,EAAA,EAAA,YAAA,EAAa,KAAK,CAAC,YAAY,CAAC,IAAI,aAAa,EAAA,aAAA,EAAe,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,EAAA,QAAA,EAC9G,CAAC,EAAE,KAAK,EAAE,MACTC,IAAA,CAAAI,QAAA,EAAA,EAAA,QAAA,EAAA,CAEEL,aAAK,SAAS,EAAC,oDAAoD,EAAA,QAAA,EACjEA,GAAA,CAACM,UAAQ,EAAA,EAAC,gBAAgB,EAAE,gBAAgB,EAAA,CAAI,EAAA,CAC5C,EACNL,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,0IAA0I,EAAA,QAAA,EAAA,CACvJD,IAAC,MAAM,EAAA,EACL,IAAI,EAAC,IAAI,EACT,KAAK,EAAC,WAAW,iBACJ,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC7C,OAAO,EAAE,MAAK;4CACZ,QAAQ,IAAI;AACZ,4CAAA,KAAK,EAAE;wCACT,CAAC,EAAA,QAAA,EAAA,QAAA,EAAA,CAGM,EACTA,GAAA,CAAC,MAAM,IACL,IAAI,EAAC,IAAI,EACT,KAAK,EAAC,SAAS,EAAA,aAAA,EACF,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,EAC5C,OAAO,EAAE,MAAK;4CACZ,QAAQ,CAAC,UAAU,CAAC;4CACpB,OAAO,IAAI;AACX,4CAAA,KAAK,EAAE;wCACT,CAAC,EAAA,QAAA,EAAA,OAAA,EAAA,CAGM,IACL,CAAA,EAAA,CACL,CACJ,GACe,CAAA,EAAA,CACH,EAAA,CACF;AAErB;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/organisms/DatePicker/index.tsx"],"sourcesContent":[null],"names":["_jsx","AriaDatePicker","_jsxs","_Fragment","AriaGroup","CalendarIcon","Cal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K,SAAS,EAAC,oDAAoD,EAAA,QAAA,EACjEA,GAAA,CAACM,UAAQ,EAAA,EAAC,gBAAgB,EAAE,gBAAgB,EAAA,CAAI,EAAA,CAC5C,EACNJ,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,0IAA0I,EAAA,QAAA,EAAA,CACvJF,GAAA,CAAC,MAAM,EAAA,EACL,IAAI,EAAC,IAAI,EACT,KAAK,EAAC,WAAW,iBACJ,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC7C,OAAO,EAAE,MAAK;gDACZ,QAAQ,IAAI;AACZ,gDAAA,KAAK,EAAE;4CACT,CAAC,EAAA,QAAA,EAAA,QAAA,EAAA,CAGM,EACTA,GAAA,CAAC,MAAM,IACL,IAAI,EAAC,IAAI,EACT,KAAK,EAAC,SAAS,EAAA,aAAA,EACF,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,EAC5C,OAAO,EAAE,MAAK;gDACZ,QAAQ,CAAC,UAAU,CAAC;gDACpB,OAAO,IAAI;AACX,gDAAA,KAAK,EAAE;4CACT,CAAC,EAAA,QAAA,EAAA,OAAA,EAAA,CAGM,CAAA,EAAA,CACL,CAAA,EAAA,CACL,CACJ,EAAA,CACe,IACjB,CACJ,EAAA,CACc,EAAA,CACF;AAErB;;"}
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var Badge = require('@flipdish/ui-library/components/atoms/Badge');
5
+ var Tabs = require('@flipdish/ui-library/components/molecules/Tabs');
6
+ var cx = require('@flipdish/ui-library/utilities/cx');
7
+ var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
8
+ var reactAriaComponents = require('react-aria-components');
9
+
10
+ const PageHubLayoutSectionNavItem = ({ section, isSelected, onSelect, 'data-testid': testId }) => {
11
+ const itemClassName = ({ isHovered, isFocusVisible, isDisabled }) => cx.cx('flex h-max flex-1 cursor-pointer items-center justify-start text-left text-quaternary transition duration-100 ease-linear', Tabs.tabSizes.sm.base, Tabs.tabSizes.sm.line, Tabs.getTabStyles({ isSelected, isHovered, isFocusVisible }).line, isDisabled && 'cursor-not-allowed opacity-50');
12
+ const content = ({ isHovered }) => (jsxRuntime.jsxs("span", { className: "flex items-center gap-1.5", children: [section.label, section.badge !== undefined && (jsxRuntime.jsx(Badge.Badge, { size: "sm", type: "pill-color", color: isHovered || isSelected ? 'brand' : 'gray', className: "-my-px transition-inherit-all", children: section.badge }))] }));
13
+ if (section.href) {
14
+ return (jsxRuntime.jsx(reactAriaComponents.Link, { href: section.href, isDisabled: section.isDisabled, "aria-current": isSelected ? 'page' : undefined, className: itemClassName, "data-testid": testId, children: content }));
15
+ }
16
+ return (jsxRuntime.jsx(reactAriaComponents.Button, { isDisabled: section.isDisabled, "aria-current": isSelected ? 'true' : undefined, className: itemClassName, onPress: () => onSelect(section.id), "data-testid": testId, children: content }));
17
+ };
18
+ /**
19
+ * Desktop section list for `PageHubLayout`, styled via the Tabs `line` class maps but rendered as a
20
+ * `<nav>` rather than a `tablist`: sections are routes or page-level views, and a `tab` would point
21
+ * `aria-controls` at a `tabpanel` this list does not own.
22
+ */
23
+ const PageHubLayoutSectionNav = ({ sections, selectedSection, onSelect, 'aria-label': ariaLabel, className, 'data-testid': testId, }) => (jsxRuntime.jsx("nav", { "aria-label": ariaLabel, "data-testid": testId, className: cx.cx('shrink-0', className), children: jsxRuntime.jsx("ul", { className: "flex w-max max-w-60 flex-col gap-2", children: sections.map((section) => (jsxRuntime.jsx("li", { className: "flex", children: jsxRuntime.jsx(PageHubLayoutSectionNavItem, { section: section, isSelected: section.id === selectedSection, onSelect: onSelect, "data-testid": testIdUtils.joinTestId(testId, `section-${testIdUtils.slugifyTestId(section.id)}`) }) }, section.id))) }) }));
24
+
25
+ exports.PageHubLayoutSectionNav = PageHubLayoutSectionNav;
26
+ //# sourceMappingURL=PageHubLayoutSectionNav.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageHubLayoutSectionNav.cjs","sources":["../../../../../src/components/templates/PageHubLayout/components/PageHubLayoutSectionNav.tsx"],"sourcesContent":[null],"names":["cx","tabSizes","getTabStyles","_jsxs","_jsx","Badge","AriaLink","AriaButton","joinTestId","slugifyTestId"],"mappings":";;;;;;;;;AAiCA,MAAM,2BAA2B,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAoC,KAAI;IACjI,MAAM,aAAa,GAAG,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAoB,KAChFA,KAAE,CACA,2HAA2H,EAC3HC,aAAQ,CAAC,EAAE,CAAC,IAAI,EAChBA,aAAQ,CAAC,EAAE,CAAC,IAAI,EAChBC,iBAAY,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC,IAAI,EAC5D,UAAU,IAAI,+BAA+B,CAC9C;AAEH,IAAA,MAAM,OAAO,GAAG,CAAC,EAAE,SAAS,EAAuC,MACjEC,eAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,2BAA2B,EAAA,QAAA,EAAA,CACxC,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,KAAK,KAAK,SAAS,KAC1BC,cAAA,CAACC,WAAK,IAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,YAAY,EAAC,KAAK,EAAE,SAAS,IAAI,UAAU,GAAG,OAAO,GAAG,MAAM,EAAE,SAAS,EAAC,+BAA+B,EAAA,QAAA,EAC5H,OAAO,CAAC,KAAK,EAAA,CACR,CACT,CAAA,EAAA,CACI,CACR;AAED,IAAA,IAAI,OAAO,CAAC,IAAI,EAAE;AAChB,QAAA,QACED,cAAA,CAACE,wBAAQ,EAAA,EACP,IAAI,EAAE,OAAO,CAAC,IAAI,EAClB,UAAU,EAAE,OAAO,CAAC,UAAU,EAAA,cAAA,EAChB,UAAU,GAAG,MAAM,GAAG,SAAS,EAC7C,SAAS,EAAE,aAAa,iBACX,MAAM,EAAA,QAAA,EAElB,OAAO,EAAA,CACC;IAEf;AAEA,IAAA,QACEF,cAAA,CAACG,0BAAU,IACT,UAAU,EAAE,OAAO,CAAC,UAAU,EAAA,cAAA,EAChB,UAAU,GAAG,MAAM,GAAG,SAAS,EAC7C,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,MAAM,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAA,aAAA,EACtB,MAAM,YAElB,OAAO,EAAA,CACG;AAEjB,CAAC;AAED;;;;AAIG;MACU,uBAAuB,GAAG,CAAC,EACtC,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,aAAa,EAAE,MAAM,GACQ,MAC7BH,cAAA,CAAA,KAAA,EAAA,EAAA,YAAA,EAAiB,SAAS,EAAA,aAAA,EAAe,MAAM,EAAE,SAAS,EAAEJ,KAAE,CAAC,UAAU,EAAE,SAAS,CAAC,EAAA,QAAA,EAEnFI,cAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,oCAAoC,YAC/C,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,MACpBA,cAAA,CAAA,IAAA,EAAA,EAAqB,SAAS,EAAC,MAAM,EAAA,QAAA,EACnCA,cAAA,CAAC,2BAA2B,EAAA,EAC1B,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,OAAO,CAAC,EAAE,KAAK,eAAe,EAC1C,QAAQ,EAAE,QAAQ,iBACLI,sBAAU,CAAC,MAAM,EAAE,CAAA,QAAA,EAAWC,yBAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAE,CAAC,EAAA,CACvE,EAAA,EANK,OAAO,CAAC,EAAE,CAOd,CACN,CAAC,EAAA,CACC,EAAA,CACD;;"}
@@ -0,0 +1,20 @@
1
+ import type { PageHubLayoutSection } from '../pageHubLayout.types';
2
+ interface PageHubLayoutSectionNavProps {
3
+ sections: PageHubLayoutSection[];
4
+ /** Id of the section whose content is showing. */
5
+ selectedSection: string | undefined;
6
+ /** Called with the id of a pressed section that has no `href`. */
7
+ onSelect: (id: string) => void;
8
+ /** Accessible name for the `<nav>` landmark. */
9
+ 'aria-label': string;
10
+ className?: string;
11
+ 'data-testid': string;
12
+ }
13
+ /**
14
+ * Desktop section list for `PageHubLayout`, styled via the Tabs `line` class maps but rendered as a
15
+ * `<nav>` rather than a `tablist`: sections are routes or page-level views, and a `tab` would point
16
+ * `aria-controls` at a `tabpanel` this list does not own.
17
+ */
18
+ export declare const PageHubLayoutSectionNav: ({ sections, selectedSection, onSelect, "aria-label": ariaLabel, className, "data-testid": testId, }: PageHubLayoutSectionNavProps) => import("react").JSX.Element;
19
+ export {};
20
+ //# sourceMappingURL=PageHubLayoutSectionNav.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageHubLayoutSectionNav.d.ts","sourceRoot":"","sources":["../../../../../src/components/templates/PageHubLayout/components/PageHubLayoutSectionNav.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,UAAU,4BAA4B;IACpC,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC,kDAAkD;IAClD,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,kEAAkE;IAClE,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AA+DD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAAI,qGAOrC,4BAA4B,gCAgB9B,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { Badge } from '@flipdish/ui-library/components/atoms/Badge';
3
+ import { tabSizes, getTabStyles } from '@flipdish/ui-library/components/molecules/Tabs';
4
+ import { cx } from '@flipdish/ui-library/utilities/cx';
5
+ import { joinTestId, slugifyTestId } from '@flipdish/ui-library/utilities/testIdUtils';
6
+ import { Link, Button } from 'react-aria-components';
7
+
8
+ const PageHubLayoutSectionNavItem = ({ section, isSelected, onSelect, 'data-testid': testId }) => {
9
+ const itemClassName = ({ isHovered, isFocusVisible, isDisabled }) => cx('flex h-max flex-1 cursor-pointer items-center justify-start text-left text-quaternary transition duration-100 ease-linear', tabSizes.sm.base, tabSizes.sm.line, getTabStyles({ isSelected, isHovered, isFocusVisible }).line, isDisabled && 'cursor-not-allowed opacity-50');
10
+ const content = ({ isHovered }) => (jsxs("span", { className: "flex items-center gap-1.5", children: [section.label, section.badge !== undefined && (jsx(Badge, { size: "sm", type: "pill-color", color: isHovered || isSelected ? 'brand' : 'gray', className: "-my-px transition-inherit-all", children: section.badge }))] }));
11
+ if (section.href) {
12
+ return (jsx(Link, { href: section.href, isDisabled: section.isDisabled, "aria-current": isSelected ? 'page' : undefined, className: itemClassName, "data-testid": testId, children: content }));
13
+ }
14
+ return (jsx(Button, { isDisabled: section.isDisabled, "aria-current": isSelected ? 'true' : undefined, className: itemClassName, onPress: () => onSelect(section.id), "data-testid": testId, children: content }));
15
+ };
16
+ /**
17
+ * Desktop section list for `PageHubLayout`, styled via the Tabs `line` class maps but rendered as a
18
+ * `<nav>` rather than a `tablist`: sections are routes or page-level views, and a `tab` would point
19
+ * `aria-controls` at a `tabpanel` this list does not own.
20
+ */
21
+ const PageHubLayoutSectionNav = ({ sections, selectedSection, onSelect, 'aria-label': ariaLabel, className, 'data-testid': testId, }) => (jsx("nav", { "aria-label": ariaLabel, "data-testid": testId, className: cx('shrink-0', className), children: jsx("ul", { className: "flex w-max max-w-60 flex-col gap-2", children: sections.map((section) => (jsx("li", { className: "flex", children: jsx(PageHubLayoutSectionNavItem, { section: section, isSelected: section.id === selectedSection, onSelect: onSelect, "data-testid": joinTestId(testId, `section-${slugifyTestId(section.id)}`) }) }, section.id))) }) }));
22
+
23
+ export { PageHubLayoutSectionNav };
24
+ //# sourceMappingURL=PageHubLayoutSectionNav.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageHubLayoutSectionNav.js","sources":["../../../../../src/components/templates/PageHubLayout/components/PageHubLayoutSectionNav.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","AriaLink","AriaButton"],"mappings":";;;;;;;AAiCA,MAAM,2BAA2B,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAoC,KAAI;IACjI,MAAM,aAAa,GAAG,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAoB,KAChF,EAAE,CACA,2HAA2H,EAC3H,QAAQ,CAAC,EAAE,CAAC,IAAI,EAChB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAChB,YAAY,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC,IAAI,EAC5D,UAAU,IAAI,+BAA+B,CAC9C;AAEH,IAAA,MAAM,OAAO,GAAG,CAAC,EAAE,SAAS,EAAuC,MACjEA,IAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,2BAA2B,EAAA,QAAA,EAAA,CACxC,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,KAAK,KAAK,SAAS,KAC1BC,GAAA,CAAC,KAAK,IAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,YAAY,EAAC,KAAK,EAAE,SAAS,IAAI,UAAU,GAAG,OAAO,GAAG,MAAM,EAAE,SAAS,EAAC,+BAA+B,EAAA,QAAA,EAC5H,OAAO,CAAC,KAAK,EAAA,CACR,CACT,CAAA,EAAA,CACI,CACR;AAED,IAAA,IAAI,OAAO,CAAC,IAAI,EAAE;AAChB,QAAA,QACEA,GAAA,CAACC,IAAQ,EAAA,EACP,IAAI,EAAE,OAAO,CAAC,IAAI,EAClB,UAAU,EAAE,OAAO,CAAC,UAAU,EAAA,cAAA,EAChB,UAAU,GAAG,MAAM,GAA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atoms/Skeleton');
5
+ var Select = require('@flipdish/ui-library/components/molecules/Select');
6
+ var PageLayout = require('@flipdish/ui-library/components/templates/PageLayout');
7
+ var ErrorBoundary = require('@flipdish/ui-library/providers/ErrorBoundary');
8
+ var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
9
+ var React = require('react');
10
+ var PageHubLayoutSectionNav = require('./components/PageHubLayoutSectionNav.cjs');
11
+ var pageHubLayout_utils = require('./pageHubLayout.utils.cjs');
12
+
13
+ /** English fallback copy — consumers localise via `renderError`. TODO(i18n): source from ui-library's translation layer once one exists. */
14
+ const DefaultSectionError = ({ testId }) => (jsxRuntime.jsxs("div", { role: "alert", "data-testid": testId, className: "flex w-full flex-col items-center gap-2 py-2xl text-center", children: [jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-primary", children: "Something went wrong" }), jsxRuntime.jsx("p", { className: "text-md text-tertiary", children: "An unexpected error occurred while loading this section." })] }));
15
+ /** English status copy — consumers localise via `sectionFallback`. TODO(i18n): source from ui-library's translation layer once one exists. */
16
+ const DEFAULT_SECTION_LOADING_TEXT = 'Loading section';
17
+ const DefaultSectionFallback = ({ testId, onShownChange }) => {
18
+ React.useEffect(() => {
19
+ onShownChange(true);
20
+ return () => onShownChange(false);
21
+ }, [onShownChange]);
22
+ return (jsxRuntime.jsxs("div", { "aria-busy": "true", "data-testid": testId, className: "flex w-full flex-col gap-4", children: [jsxRuntime.jsx(Skeleton.Skeleton, { width: "40%", height: 20 }), jsxRuntime.jsx(Skeleton.SkeletonText, { lines: 4 })] }));
23
+ };
24
+ /** Runs `render` as a component, so a throw lands in the section boundary rather than in the layout's own render. */
25
+ const PageHubLayoutSectionContent = ({ render }) => render();
26
+ /**
27
+ * Page template for a hub of sections: a `PageLayout` whose content is a section navigation beside
28
+ * the selected section, each section rendered from config inside its own error and Suspense boundary. Reach for
29
+ * it instead of `PageLayout` when one page hosts several feature areas picked from a left-hand list,
30
+ * such as a settings hub; the list becomes a select below `lg`.
31
+ *
32
+ * @summary page template with section navigation and content
33
+ */
34
+ const PageHubLayout = ({ pageName, sections, navigationLabel, selectedSection, defaultSelectedSection, onSectionChange, sectionFallback, renderError, onError, 'data-testid': dataTestId, ...pageLayoutProps }) => {
35
+ const pageHubLayoutTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'page-hub-layout', rootName: 'page-hub-layout' });
36
+ // Uncontrolled fallback so the desktop navigation and the mobile select always agree on the selection.
37
+ const [internalSelectedSection, setInternalSelectedSection] = React.useState(defaultSelectedSection);
38
+ const [isDefaultFallbackShown, setIsDefaultFallbackShown] = React.useState(false);
39
+ const activeSection = pageHubLayout_utils.resolveSelectedSection(sections, selectedSection ?? internalSelectedSection);
40
+ const selectSection = (id) => {
41
+ setInternalSelectedSection(id);
42
+ // Re-picking the current section is not a change; the select already ignores it, so the navigation does too.
43
+ if (id !== activeSection?.id)
44
+ onSectionChange?.(id);
45
+ };
46
+ const selectFromSelect = (key) => {
47
+ const pickedId = pageHubLayout_utils.resolvePickedSectionId(sections, key);
48
+ if (pickedId !== undefined)
49
+ selectSection(pickedId);
50
+ };
51
+ return (jsxRuntime.jsx(PageLayout.PageLayout, { ...pageLayoutProps, pageName: pageName, renderError: renderError, onError: onError, "data-testid": pageHubLayoutTestId, children: jsxRuntime.jsxs("div", { className: "flex w-full flex-col gap-md lg:flex-row lg:items-start", children: [jsxRuntime.jsx(PageHubLayoutSectionNav.PageHubLayoutSectionNav, { className: "max-lg:hidden", sections: sections, selectedSection: activeSection?.id, onSelect: selectSection, "aria-label": navigationLabel, "data-testid": testIdUtils.joinTestId(pageHubLayoutTestId, 'sections') }), jsxRuntime.jsx(Select.Select, { className: "w-full lg:hidden", size: "md", "aria-label": navigationLabel, value: activeSection?.id ?? null, onChange: selectFromSelect, "data-testid": testIdUtils.joinTestId(pageHubLayoutTestId, 'sections-select'), children: sections.map((section) => (
52
+ // Spread, not `href={section.href}`: react-aria copies an `href` key that is present but undefined onto the option as `href=""`.
53
+ jsxRuntime.jsx(Select.Select.Item, { id: section.id, label: section.label, isDisabled: section.isDisabled, ...(section.href ? { href: section.href } : {}) }, section.id))) }), jsxRuntime.jsxs("div", { "data-testid": testIdUtils.joinTestId(pageHubLayoutTestId, 'content'), className: "w-full min-w-0 flex-1", children: [jsxRuntime.jsx("output", { className: "sr-only", children: isDefaultFallbackShown ? DEFAULT_SECTION_LOADING_TEXT : '' }), activeSection && (
54
+ // Keyed by section so a section that threw is replaced, not left showing its fallback, when the user moves on.
55
+ jsxRuntime.jsx(ErrorBoundary.ErrorBoundary, { identifier: `${pageName}/${activeSection.id}`, onError: onError, renderFallback: (error) => {
56
+ // `undefined`, not nullish: an explicit `null` from `renderError` is honoured as "render nothing".
57
+ const customFallback = renderError?.({ error, pageName, sectionId: activeSection.id });
58
+ if (customFallback !== undefined)
59
+ return customFallback;
60
+ return jsxRuntime.jsx(DefaultSectionError, { testId: testIdUtils.joinTestId(pageHubLayoutTestId, 'section-error') });
61
+ }, children: jsxRuntime.jsx(React.Suspense, { fallback: sectionFallback !== undefined ? (sectionFallback) : (jsxRuntime.jsx(DefaultSectionFallback, { testId: testIdUtils.joinTestId(pageHubLayoutTestId, 'section-loading'), onShownChange: setIsDefaultFallbackShown })), children: jsxRuntime.jsx(PageHubLayoutSectionContent, { render: activeSection.render }) }) }, activeSection.id))] })] }) }));
62
+ };
63
+
64
+ exports.PageHubLayout = PageHubLayout;
65
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../../src/components/templates/PageHubLayout/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","useEffect","Skeleton","SkeletonText","useResolvedTestId","useState","resolveSelectedSection","resolvePickedSectionId","PageLayout","PageHubLayoutSectionNav","joinTestId","Select","ErrorBoundary","Suspense"],"mappings":";;;;;;;;;;;;AAsDA;AACA,MAAM,mBAAmB,GAAG,CAAC,EAAE,MAAM,EAAuB,MAC1DA,eAAA,CAAA,KAAA,EAAA,EAAK,I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CAAI;4BAC1F,CAAC,EAAA,QAAA,EAEDV,cAAA,CAACa,cAAQ,EAAA,EACP,QAAQ,EACN,eAAe,KAAK,SAAS,IAC3B,eAAe,KAEfb,cAAA,CAAC,sBAAsB,EAAA,EAAC,MAAM,EAAEU,sBAAU,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,EAAE,aAAa,EAAE,yBAAyB,EAAA,CAAI,CACjI,EAAA,QAAA,EAGHV,cAAA,CAAC,2BAA2B,EAAA,EAAC,MAAM,EAAE,aAAa,CAAC,MAAM,EAAA,CAAI,EAAA,CACpD,EAAA,EApBN,aAAa,CAAC,EAAE,CAqBP,CACjB,CAAA,EAAA,CACG,CAAA,EAAA,CACF,EAAA,CACK;AAEjB;;"}
@@ -0,0 +1,56 @@
1
+ import { type PageLayoutProps } from '@flipdish/ui-library/components/templates/PageLayout';
2
+ import type { ReactNode } from 'react';
3
+ import type { PageHubLayoutSection } from './pageHubLayout.types';
4
+ export type { PageHubLayoutSection } from './pageHubLayout.types';
5
+ export interface PageHubLayoutProps extends Omit<PageLayoutProps, 'children' | 'renderError' | 'data-testid'> {
6
+ /**
7
+ * The hub's sections, in navigation order. Each one is an entry in the section navigation and a
8
+ * `render` for its content; only the selected section's `render` runs.
9
+ */
10
+ sections: PageHubLayoutSection[];
11
+ /**
12
+ * Accessible name for the section navigation and its mobile select, e.g. "Settings sections". Must
13
+ * differ from the header's title, which already names the `PageHeader` tab navigation.
14
+ */
15
+ navigationLabel: string;
16
+ /**
17
+ * Controlled selected section id, usually read from the router. An id that matches no enabled
18
+ * section falls back to the first enabled one.
19
+ */
20
+ selectedSection?: string;
21
+ /** Initially selected section id (uncontrolled). Defaults to the first enabled section. */
22
+ defaultSelectedSection?: string;
23
+ /**
24
+ * Called with the section id when the user picks a different section that has no `href`, from the
25
+ * navigation or the mobile select. Re-picking the current section does not call it, and a section
26
+ * with `href` navigates as a link instead and never calls it.
27
+ */
28
+ onSectionChange?: (id: string) => void;
29
+ /**
30
+ * Shown in the content pane while the selected section suspends, such as a `React.lazy` section
31
+ * whose chunk is loading. Replaces the default skeleton; the header and navigation stay in place.
32
+ */
33
+ sectionFallback?: ReactNode;
34
+ /**
35
+ * Replaces the default fallback shown when content throws. Receives the thrown error, `pageName`
36
+ * and, when the selected section threw, its `sectionId`; without one the page-level boundary caught it.
37
+ * Return `null` to render nothing, or `undefined` to keep the default fallback.
38
+ */
39
+ renderError?: (props: {
40
+ error: Error;
41
+ pageName: string;
42
+ sectionId?: string;
43
+ }) => ReactNode;
44
+ /** Overrides the `data-testid` (defaults to `fd-page-hub-layout`). */
45
+ 'data-testid'?: string;
46
+ }
47
+ /**
48
+ * Page template for a hub of sections: a `PageLayout` whose content is a section navigation beside
49
+ * the selected section, each section rendered from config inside its own error and Suspense boundary. Reach for
50
+ * it instead of `PageLayout` when one page hosts several feature areas picked from a left-hand list,
51
+ * such as a settings hub; the list becomes a select below `lg`.
52
+ *
53
+ * @summary page template with section navigation and content
54
+ */
55
+ export declare const PageHubLayout: ({ pageName, sections, navigationLabel, selectedSection, defaultSelectedSection, onSectionChange, sectionFallback, renderError, onError, "data-testid": dataTestId, ...pageLayoutProps }: PageHubLayoutProps) => ReactNode;
56
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/PageHubLayout/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,sDAAsD,CAAC;AAGxG,OAAO,KAAK,EAAO,SAAS,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGlE,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,aAAa,GAAG,aAAa,CAAC;IAC3G;;;OAGG;IACH,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2FAA2F;IAC3F,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,SAAS,CAAC;IAC3F,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAoCD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,yLAY3B,kBAAkB,KAAG,SAmFvB,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { Skeleton, SkeletonText } from '@flipdish/ui-library/components/atoms/Skeleton';
3
+ import { Select } from '@flipdish/ui-library/components/molecules/Select';
4
+ import { PageLayout } from '@flipdish/ui-library/components/templates/PageLayout';
5
+ import { ErrorBoundary } from '@flipdish/ui-library/providers/ErrorBoundary';
6
+ import { useResolvedTestId, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
7
+ import { useState, Suspense, useEffect } from 'react';
8
+ import { PageHubLayoutSectionNav } from './components/PageHubLayoutSectionNav.js';
9
+ import { resolveSelectedSection, resolvePickedSectionId } from './pageHubLayout.utils.js';
10
+
11
+ /** English fallback copy — consumers localise via `renderError`. TODO(i18n): source from ui-library's translation layer once one exists. */
12
+ const DefaultSectionError = ({ testId }) => (jsxs("div", { role: "alert", "data-testid": testId, className: "flex w-full flex-col items-center gap-2 py-2xl text-center", children: [jsx("h2", { className: "text-lg font-semibold text-primary", children: "Something went wrong" }), jsx("p", { className: "text-md text-tertiary", children: "An unexpected error occurred while loading this section." })] }));
13
+ /** English status copy — consumers localise via `sectionFallback`. TODO(i18n): source from ui-library's translation layer once one exists. */
14
+ const DEFAULT_SECTION_LOADING_TEXT = 'Loading section';
15
+ const DefaultSectionFallback = ({ testId, onShownChange }) => {
16
+ useEffect(() => {
17
+ onShownChange(true);
18
+ return () => onShownChange(false);
19
+ }, [onShownChange]);
20
+ return (jsxs("div", { "aria-busy": "true", "data-testid": testId, className: "flex w-full flex-col gap-4", children: [jsx(Skeleton, { width: "40%", height: 20 }), jsx(SkeletonText, { lines: 4 })] }));
21
+ };
22
+ /** Runs `render` as a component, so a throw lands in the section boundary rather than in the layout's own render. */
23
+ const PageHubLayoutSectionContent = ({ render }) => render();
24
+ /**
25
+ * Page template for a hub of sections: a `PageLayout` whose content is a section navigation beside
26
+ * the selected section, each section rendered from config inside its own error and Suspense boundary. Reach for
27
+ * it instead of `PageLayout` when one page hosts several feature areas picked from a left-hand list,
28
+ * such as a settings hub; the list becomes a select below `lg`.
29
+ *
30
+ * @summary page template with section navigation and content
31
+ */
32
+ const PageHubLayout = ({ pageName, sections, navigationLabel, selectedSection, defaultSelectedSection, onSectionChange, sectionFallback, renderError, onError, 'data-testid': dataTestId, ...pageLayoutProps }) => {
33
+ const pageHubLayoutTestId = useResolvedTestId({ testId: dataTestId, segment: 'page-hub-layout', rootName: 'page-hub-layout' });
34
+ // Uncontrolled fallback so the desktop navigation and the mobile select always agree on the selection.
35
+ const [internalSelectedSection, setInternalSelectedSection] = useState(defaultSelectedSection);
36
+ const [isDefaultFallbackShown, setIsDefaultFallbackShown] = useState(false);
37
+ const activeSection = resolveSelectedSection(sections, selectedSection ?? internalSelectedSection);
38
+ const selectSection = (id) => {
39
+ setInternalSelectedSection(id);
40
+ // Re-picking the current section is not a change; the select already ignores it, so the navigation does too.
41
+ if (id !== activeSection?.id)
42
+ onSectionChange?.(id);
43
+ };
44
+ const selectFromSelect = (key) => {
45
+ const pickedId = resolvePickedSectionId(sections, key);
46
+ if (pickedId !== undefined)
47
+ selectSection(pickedId);
48
+ };
49
+ return (jsx(PageLayout, { ...pageLayoutProps, pageName: pageName, renderError: renderError, onError: onError, "data-testid": pageHubLayoutTestId, children: jsxs("div", { className: "flex w-full flex-col gap-md lg:flex-row lg:items-start", children: [jsx(PageHubLayoutSectionNav, { className: "max-lg:hidden", sections: sections, selectedSection: activeSection?.id, onSelect: selectSection, "aria-label": navigationLabel, "data-testid": joinTestId(pageHubLayoutTestId, 'sections') }), jsx(Select, { className: "w-full lg:hidden", size: "md", "aria-label": navigationLabel, value: activeSection?.id ?? null, onChange: selectFromSelect, "data-testid": joinTestId(pageHubLayoutTestId, 'sections-select'), children: sections.map((section) => (
50
+ // Spread, not `href={section.href}`: react-aria copies an `href` key that is present but undefined onto the option as `href=""`.
51
+ jsx(Select.Item, { id: section.id, label: section.label, isDisabled: section.isDisabled, ...(section.href ? { href: section.href } : {}) }, section.id))) }), jsxs("div", { "data-testid": joinTestId(pageHubLayoutTestId, 'content'), className: "w-full min-w-0 flex-1", children: [jsx("output", { className: "sr-only", children: isDefaultFallbackShown ? DEFAULT_SECTION_LOADING_TEXT : '' }), activeSection && (
52
+ // Keyed by section so a section that threw is replaced, not left showing its fallback, when the user moves on.
53
+ jsx(ErrorBoundary, { identifier: `${pageName}/${activeSection.id}`, onError: onError, renderFallback: (error) => {
54
+ // `undefined`, not nullish: an explicit `null` from `renderError` is honoured as "render nothing".
55
+ const customFallback = renderError?.({ error, pageName, sectionId: activeSection.id });
56
+ if (customFallback !== undefined)
57
+ return customFallback;
58
+ return jsx(DefaultSectionError, { testId: joinTestId(pageHubLayoutTestId, 'section-error') });
59
+ }, children: jsx(Suspense, { fallback: sectionFallback !== undefined ? (sectionFallback) : (jsx(DefaultSectionFallback, { testId: joinTestId(pageHubLayoutTestId, 'section-loading'), onShownChange: setIsDefaultFallbackShown })), children: jsx(PageHubLayoutSectionContent, { render: activeSection.render }) }) }, activeSection.id))] })] }) }));
60
+ };
61
+
62
+ export { PageHubLayout };
63
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/templates/PageHubLayout/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;AAsDA;AACA,MAAM,mBAAmB,GAAG,CAAC,EAAE,MAAM,EAAuB,MAC1DA,IAAA,CAAA,KAAA,EAAA,EAAK,IAAI,EAAC,OAAO,iBAAc,MAAM,EAAE,SAAS,EAAC,4DAA4D,EAAA,QAAA,EAAA,CAC3GC,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAAA,sBAAA,EAAA,CAA0B,EAC5EA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,uBAAuB,EAAA,QAAA,EAAA,0DAAA,EAAA,CAA6D,CAAA,EAAA,CAC7F,CACP;AAED;AACA,MAAM,4BAA4B,GAAG,iBAAiB;AAQtD,MAAM,sBAAsB,GAAG,CAAC,EAAE,MAAM,EAAE,aAAa,EAA+B,KAAe;IACnG,SAAS,CAAC,MAAK;QACb,aAAa,CAAC,IAAI,CAAC;AACnB,QAAA,OAAO,MAAM,aAAa,CAAC,KAAK,CAAC;AACnC,IAAA,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;AAEnB,IAAA,QACED,IAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EAAe,MAAM,EAAA,aAAA,EAAc,MAAM,EAAE,SAAS,EAAC,4BAA4B,EAAA,QAAA,EAAA,CAC/EC,GAAA,CAAC,QAAQ,IAAC,KAAK,EAAC,KAAK,EAAC,MAAM,EAAE,EAAE,EAAA,CAAI,EACpCA,GAAA,CAAC,YAAY,EAAA,EAAC,KAAK,EAAE,CAAC,EAAA,CAAI,CAAA,EAAA,CACtB;AAEV,CAAC;AAED;AACA,MAAM,2BAA2B,GAAG,CAAC,EAAE,MAAM,EAA+B,KAAgB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A,MAAM,cAAc,GAAG,WAAW,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAC,EAAE,EAAE,CAAC;gCACtF,IAAI,cAAc,KAAK,SAAS;AAAE,oCAAA,OAAO,cAAc;AACvD,gCAAA,OAAOA,GAAA,CAAC,mBAAmB,EAAA,EAAC,MAAM,EAAE,UAAU,CAAC,mBAAmB,EAAE,eAAe,CAAC,EAAA,CAAI;4BAC1F,CAAC,EAAA,QAAA,EAEDA,GAAA,CAAC,QAAQ,EAAA,EACP,QAAQ,EACN,eAAe,KAAK,SAAS,IAC3B,eAAe,KAEfA,GAAA,CAAC,sBAAsB,EAAA,EAAC,MAAM,EAAE,UAAU,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,EAAE,aAAa,EAAE,yBAAyB,EAAA,CAAI,CACjI,EAAA,QAAA,EAGHA,GAAA,CAAC,2BAA2B,EAAA,EAAC,MAAM,EAAE,aAAa,CAAC,MAAM,EAAA,CAAI,EAAA,CACpD,EAAA,EApBN,aAAa,CAAC,EAAE,CAqBP,CACjB,CAAA,EAAA,CACG,CAAA,EAAA,CACF,EAAA,CACK;AAEjB;;"}
@@ -0,0 +1,20 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface PageHubLayoutSection {
3
+ /** Stable identifier, matched against `selectedSection`, passed to `onSectionChange` and used in the derived `data-testid`. */
4
+ id: string;
5
+ /** Visible label in the section navigation and in the mobile select. */
6
+ label: string;
7
+ /** Optional count/status badge shown after the label (desktop only). */
8
+ badge?: number | string;
9
+ /**
10
+ * Makes the section a route: the desktop item and the mobile select option render as links to this
11
+ * URL, with `aria-current="page"` on the selected desktop item. Drive `selectedSection` from the
12
+ * router, since a link never calls `onSectionChange`.
13
+ */
14
+ href?: string;
15
+ /** Prevents the section from being selected. */
16
+ isDisabled?: boolean;
17
+ /** Returns the section's content. Called only while the section is selected, inside its own error boundary. */
18
+ render: () => ReactNode;
19
+ }
20
+ //# sourceMappingURL=pageHubLayout.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pageHubLayout.types.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/PageHubLayout/pageHubLayout.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,oBAAoB;IACnC,+HAA+H;IAC/H,EAAE,EAAE,MAAM,CAAC;IACX,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+GAA+G;IAC/G,MAAM,EAAE,MAAM,SAAS,CAAC;CACzB"}
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Resolves an option picked in the mobile select to a section the layout selects itself. Arrow keys and typeahead on
5
+ * the closed select pick an option directly, skipping a link option's navigation, so a routed section is left to its link.
6
+ *
7
+ * @param sections The hub's sections, in navigation order.
8
+ * @param key The key the select reported; `null` when it has no selection.
9
+ * @returns The id of the matching section when it has no `href`, else `undefined`.
10
+ */
11
+ const resolvePickedSectionId = (sections, key) => {
12
+ const section = sections.find((candidate) => candidate.id === key);
13
+ return section && !section.href ? section.id : undefined;
14
+ };
15
+ /**
16
+ * Picks the section a hub renders, so a stale or disabled id (an old bookmark, a section the user lost
17
+ * access to) lands on a usable section instead of an empty page.
18
+ *
19
+ * @param sections The hub's sections, in navigation order.
20
+ * @param selectedId The requested section id, from the router or the hub's own state; may match nothing.
21
+ * @returns The enabled section with that id, else the first enabled section, else `undefined` when none is enabled.
22
+ */
23
+ const resolveSelectedSection = (sections, selectedId) => sections.find((section) => section.id === selectedId && !section.isDisabled) ?? sections.find((section) => !section.isDisabled);
24
+
25
+ exports.resolvePickedSectionId = resolvePickedSectionId;
26
+ exports.resolveSelectedSection = resolveSelectedSection;
27
+ //# sourceMappingURL=pageHubLayout.utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pageHubLayout.utils.cjs","sources":["../../../../src/components/templates/PageHubLayout/pageHubLayout.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;;;;;;;AAOG;MACU,sBAAsB,GAAG,CAAC,QAAgC,EAAE,GAAe,KAAwB;AAC9G,IAAA,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,EAAE,KAAK,GAAG,CAAC;AAClE,IAAA,OAAO,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS;AAC1D;AAEA;;;;;;;AAOG;MACU,sBAAsB,GAAG,CAAC,QAAgC,EAAE,UAA8B,KACrG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,EAAE,KAAK,UAAU,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU;;;"}
@@ -0,0 +1,21 @@
1
+ import type { Key } from 'react';
2
+ import type { PageHubLayoutSection } from './pageHubLayout.types';
3
+ /**
4
+ * Resolves an option picked in the mobile select to a section the layout selects itself. Arrow keys and typeahead on
5
+ * the closed select pick an option directly, skipping a link option's navigation, so a routed section is left to its link.
6
+ *
7
+ * @param sections The hub's sections, in navigation order.
8
+ * @param key The key the select reported; `null` when it has no selection.
9
+ * @returns The id of the matching section when it has no `href`, else `undefined`.
10
+ */
11
+ export declare const resolvePickedSectionId: (sections: PageHubLayoutSection[], key: Key | null) => string | undefined;
12
+ /**
13
+ * Picks the section a hub renders, so a stale or disabled id (an old bookmark, a section the user lost
14
+ * access to) lands on a usable section instead of an empty page.
15
+ *
16
+ * @param sections The hub's sections, in navigation order.
17
+ * @param selectedId The requested section id, from the router or the hub's own state; may match nothing.
18
+ * @returns The enabled section with that id, else the first enabled section, else `undefined` when none is enabled.
19
+ */
20
+ export declare const resolveSelectedSection: (sections: PageHubLayoutSection[], selectedId: string | undefined) => PageHubLayoutSection | undefined;
21
+ //# sourceMappingURL=pageHubLayout.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pageHubLayout.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/PageHubLayout/pageHubLayout.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,UAAU,oBAAoB,EAAE,EAAE,KAAK,GAAG,GAAG,IAAI,KAAG,MAAM,GAAG,SAGnG,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,UAAU,oBAAoB,EAAE,EAAE,YAAY,MAAM,GAAG,SAAS,KAAG,oBAAoB,GAAG,SACA,CAAC"}