@planningcenter/tapestry 4.15.0-rc.1 → 4.15.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 (121) hide show
  1. package/dist/components/DataTable/ActiveFilterInstance.d.ts +6 -0
  2. package/dist/components/DataTable/ActiveFilterInstance.d.ts.map +1 -1
  3. package/dist/components/DataTable/ActiveFilterInstance.js +13 -0
  4. package/dist/components/DataTable/ActiveFilterInstance.js.map +1 -1
  5. package/dist/components/DataTable/CollectionEditorsLazy.d.ts +1 -1
  6. package/dist/components/DataTable/CollectionEditorsLazy.d.ts.map +1 -1
  7. package/dist/components/DataTable/CollectionEditorsLazy.js +2 -2
  8. package/dist/components/DataTable/CollectionEditorsLazy.js.map +1 -1
  9. package/dist/components/DataTable/CollectionEditorsShared.d.ts +4 -8
  10. package/dist/components/DataTable/CollectionEditorsShared.d.ts.map +1 -1
  11. package/dist/components/DataTable/CollectionEditorsShared.js +2 -2
  12. package/dist/components/DataTable/CollectionEditorsShared.js.map +1 -1
  13. package/dist/components/DataTable/CollectionEditorsStatic.d.ts +4 -5
  14. package/dist/components/DataTable/CollectionEditorsStatic.d.ts.map +1 -1
  15. package/dist/components/DataTable/CollectionEditorsStatic.js +9 -9
  16. package/dist/components/DataTable/CollectionEditorsStatic.js.map +1 -1
  17. package/dist/components/DataTable/DataTable.d.ts +27 -5
  18. package/dist/components/DataTable/DataTable.d.ts.map +1 -1
  19. package/dist/components/DataTable/DataTable.js +13 -2
  20. package/dist/components/DataTable/DataTable.js.map +1 -1
  21. package/dist/components/DataTable/DataTableRow.d.ts +2 -0
  22. package/dist/components/DataTable/DataTableRow.d.ts.map +1 -1
  23. package/dist/components/DataTable/DataTableRow.js.map +1 -1
  24. package/dist/components/DataTable/RowActions.d.ts +7 -3
  25. package/dist/components/DataTable/RowActions.d.ts.map +1 -1
  26. package/dist/components/DataTable/RowActions.js +7 -2
  27. package/dist/components/DataTable/RowActions.js.map +1 -1
  28. package/dist/components/DataTable/collectionFilter.js +1 -1
  29. package/dist/components/DataTable/collectionFilter.js.map +1 -1
  30. package/dist/components/DataTable/dateFilter.js +5 -5
  31. package/dist/components/DataTable/dateFilter.js.map +1 -1
  32. package/dist/components/DataTable/dayFilter.js +4 -3
  33. package/dist/components/DataTable/dayFilter.js.map +1 -1
  34. package/dist/components/DataTable/index.d.ts +1 -1
  35. package/dist/components/DataTable/index.d.ts.map +1 -1
  36. package/dist/components/DataTable/numberFilter.js +3 -2
  37. package/dist/components/DataTable/numberFilter.js.map +1 -1
  38. package/dist/components/DataTable/scopedFilter.js +5 -1
  39. package/dist/components/DataTable/scopedFilter.js.map +1 -1
  40. package/dist/components/DataTable/textFilter.js +1 -1
  41. package/dist/components/DataTable/textFilter.js.map +1 -1
  42. package/dist/components/button/ActionsDropdownIconButton.js +2 -2
  43. package/dist/components/button/ActionsDropdownIconButton.js.map +1 -1
  44. package/dist/components/button/BaseButton.js +4 -4
  45. package/dist/components/button/BaseButton.js.map +1 -1
  46. package/dist/components/button/Button.js +2 -2
  47. package/dist/components/button/Button.js.map +1 -1
  48. package/dist/components/button/DropdownButton.js +3 -3
  49. package/dist/components/button/DropdownButton.js.map +1 -1
  50. package/dist/components/button/DropdownIconButton.js +2 -2
  51. package/dist/components/button/DropdownIconButton.js.map +1 -1
  52. package/dist/components/button/IconButton.js +4 -4
  53. package/dist/components/button/IconButton.js.map +1 -1
  54. package/dist/components/button/LoadingButton.js +2 -2
  55. package/dist/components/button/LoadingButton.js.map +1 -1
  56. package/dist/components/button/PageHeaderActionsDropdownButton.js +3 -3
  57. package/dist/components/button/PageHeaderActionsDropdownButton.js.map +1 -1
  58. package/dist/components/combo-box/ComboBox.js +31 -31
  59. package/dist/components/combo-box/ComboBox.js.map +1 -1
  60. package/dist/components/date-picker/DatePicker.js +42 -42
  61. package/dist/components/date-picker/DatePicker.js.map +1 -1
  62. package/dist/components/dropdown/Dropdown.js +13 -13
  63. package/dist/components/dropdown/Dropdown.js.map +1 -1
  64. package/dist/components/field/Field.js +5 -5
  65. package/dist/components/field/Field.js.map +1 -1
  66. package/dist/components/internal/LoadingSpinner.js +2 -2
  67. package/dist/components/internal/LoadingSpinner.js.map +1 -1
  68. package/dist/components/internal/tooltip/Tooltip.js +8 -8
  69. package/dist/components/internal/tooltip/Tooltip.js.map +1 -1
  70. package/dist/components/link/BaseLink.js +3 -3
  71. package/dist/components/link/BaseLink.js.map +1 -1
  72. package/dist/components/link/IconLink.js +4 -4
  73. package/dist/components/link/IconLink.js.map +1 -1
  74. package/dist/components/link/Link.js +2 -2
  75. package/dist/components/link/Link.js.map +1 -1
  76. package/dist/components/number-stepper/NumberStepper.js +11 -11
  77. package/dist/components/number-stepper/NumberStepper.js.map +1 -1
  78. package/dist/components/page-header/PageHeader.js +10 -10
  79. package/dist/components/page-header/PageHeader.js.map +1 -1
  80. package/dist/components/search-input/SearchInput.js +6 -6
  81. package/dist/components/search-input/SearchInput.js.map +1 -1
  82. package/dist/components/select/Select.js +6 -6
  83. package/dist/components/select/Select.js.map +1 -1
  84. package/dist/components/select/SelectNative.js +6 -6
  85. package/dist/components/select/SelectNative.js.map +1 -1
  86. package/dist/components/select/SelectOptions.js +9 -9
  87. package/dist/components/select/SelectOptions.js.map +1 -1
  88. package/dist/components/select/SelectPopover.js +14 -14
  89. package/dist/components/select/SelectPopover.js.map +1 -1
  90. package/dist/components/sidenav/Sidenav.js +6 -6
  91. package/dist/components/sidenav/Sidenav.js.map +1 -1
  92. package/dist/components/sidenav/SidenavItem.js +2 -2
  93. package/dist/components/sidenav/SidenavItem.js.map +1 -1
  94. package/dist/components/sidenav/SidenavSection.js +7 -7
  95. package/dist/components/sidenav/SidenavSection.js.map +1 -1
  96. package/dist/components/sidenav/private/SidenavResponsiveHeader.js +6 -6
  97. package/dist/components/sidenav/private/SidenavResponsiveHeader.js.map +1 -1
  98. package/dist/components/sidenav/private/withSlotChildrenAsActions.js +7 -7
  99. package/dist/components/sidenav/private/withSlotChildrenAsActions.js.map +1 -1
  100. package/dist/components/time-field/TimeField.js +8 -8
  101. package/dist/components/time-field/TimeField.js.map +1 -1
  102. package/dist/packages/tapestry-render/dist/buildComponent-DzY2PDMT.js +4 -4
  103. package/dist/packages/tapestry-render/dist/buildComponent-DzY2PDMT.js.map +1 -1
  104. package/dist/reactRender.css +180 -141
  105. package/dist/reactRender.css.map +1 -1
  106. package/dist/reactRenderLegacy.css +180 -141
  107. package/dist/reactRenderLegacy.css.map +1 -1
  108. package/dist/tapestryMount.css +180 -141
  109. package/dist/tapestryMount.css.map +1 -1
  110. package/dist/tapestryMountLegacy.css +180 -141
  111. package/dist/tapestryMountLegacy.css.map +1 -1
  112. package/dist/unstable.css +45 -6
  113. package/dist/unstable.css.map +1 -1
  114. package/dist/utilities/Icon.js +2 -2
  115. package/dist/utilities/Icon.js.map +1 -1
  116. package/dist/utilities/buttonLinkShared.js +2 -2
  117. package/dist/utilities/buttonLinkShared.js.map +1 -1
  118. package/dist/utilities/locale.js +34 -5
  119. package/dist/utilities/locale.js.map +1 -1
  120. package/docs/components/DataTable.md +23 -5
  121. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sources":["../../../src/components/date-picker/DatePicker.tsx"],"sourcesContent":["import \"../button/btn.css\"\nimport \"../field/index.css\"\nimport \"./index.css\"\n\nimport {\n CalendarDate,\n type DateValue,\n getLocalTimeZone,\n isSameDay,\n parseDate,\n today as todayCalendar,\n} from \"@internationalized/date\"\nimport Icon from \"@utilities/Icon\"\nimport { useTapestryLocale } from \"@utilities/locale\"\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport { useDateFieldLocale } from \"@utilities/useDateFieldLocale\"\nimport classNames from \"classnames\"\nimport React, {\n type ReactNode,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport { I18nProvider } from \"react-aria/I18nProvider\"\nimport { CalendarStateContext } from \"react-aria-components/Calendar\"\nimport {\n Button,\n Calendar,\n CalendarCell,\n CalendarGrid,\n CalendarGridBody,\n CalendarGridHeader,\n CalendarHeaderCell,\n DateInput,\n DatePicker as AriaDatePicker,\n type DatePickerProps as AriaDatePickerProps,\n DateSegment,\n Group,\n Label,\n Popover,\n Text,\n} from \"react-aria-components/DatePicker\"\nimport { Dialog } from \"react-aria-components/Dialog\"\nimport { ListBox, ListBoxItem } from \"react-aria-components/ListBox\"\n\nconst _today = todayCalendar(getLocalTimeZone())\nconst MONTHS = Array.from({ length: 12 }, (_, i) => i)\nconst YEARS = Array.from({ length: 131 }, (_, i) => _today.year - 100 + i)\n\nexport type DatePickerSize = \"md\" | \"lg\"\n\nexport type DatePickerDateValue = DateValue | string\n\nfunction toCalendarDate(\n input: DatePickerDateValue | null | undefined\n): DateValue | null | undefined {\n if (input === null) return null\n if (input === undefined) return undefined\n\n if (typeof input === \"object\" && \"calendar\" in input) {\n return input\n }\n\n return parseDate(input)\n}\n\nexport interface DatePickerProps {\n /** If `true`, always shows leading zeros in the year segment for years less than 1000. Defaults to true. */\n alwaysShowFourDigitYear?: boolean\n /** The initial value for uncontrolled usage. Accepts a DateValue or ISO date string. */\n defaultValue?: DatePickerDateValue | null\n /** Helper text displayed below the component. Styled as error text when `invalid` is `true`. */\n description?: ReactNode\n /** Disables the input and calendar button. */\n disabled?: boolean\n /** Sets the first day of the week in the calendar. Defaults to locale-appropriate value. */\n firstDayOfWeek?: \"fri\" | \"mon\" | \"sat\" | \"sun\" | \"thu\" | \"tue\" | \"wed\"\n /**\n * Called on blur with the current complete value, if any, so it can be\n * normalized (e.g. correcting a 2-digit year to 4 digits). If the returned\n * value differs from the current one, the field updates to match.\n */\n formatDateOnBlur?: (date: DateValue) => DateValue\n /** If `true`, the `label` text is rendered as an `aria-label` instead of a visible label element. */\n hideLabel?: boolean\n /** Whether the input is in an invalid state. */\n invalid?: boolean\n /** Callback that returns `true` for dates that should be visible but not selectable. */\n isDateUnavailable?: (date: DateValue) => boolean\n /** Accessible label for the field. */\n label: string\n /** Maximum selectable date. Accepts a DateValue or ISO date string. */\n max?: DatePickerDateValue\n /** Minimum selectable date. Accepts a DateValue or ISO date string. */\n min?: DatePickerDateValue\n /** Called when the selected date changes. */\n onChange?: (value: DateValue | null) => void\n /** If `true`, allows the value to be read but not changed. */\n readOnly?: boolean\n /** If `true`, appends an asterisk at the end of the label text. */\n required?: boolean\n /** The size of the date picker. */\n size?: DatePickerSize\n /**\n * The controlled value. Accepts a DateValue or ISO date string.\n *\n * A partly filled date (e.g. `4/dd/2026`) reports `null` on blur but stays on\n * screen. Setting `null` again won't clear it; remount with a `key` to reset.\n */\n value?: DatePickerDateValue | null\n}\n\ntype AriaDatePickerPropsToOmit =\n | \"children\"\n | \"defaultOpen\"\n | \"granularity\"\n | \"hideTimeZone\"\n | \"hourCycle\"\n | \"pageBehavior\"\n | \"placeholderValue\"\n | \"shouldCloseOnSelect\"\n | \"shouldForceLeadingZeros\"\n | \"slot\"\n\ntype AriaDatePickerPropsToInclude = \"isOpen\" | \"name\" | \"onOpenChange\"\n\nexport type DatePickerElementProps = CombineAriaPropsWithCustomProps<\n AriaDatePickerProps<DateValue>,\n DatePickerProps,\n AriaDatePickerPropsToOmit,\n AriaDatePickerPropsToInclude\n>\n\nfunction DatePickerOverlay({\n children,\n variant,\n}: {\n children: ReactNode\n variant: \"month\" | \"year\"\n}) {\n return (\n <div\n aria-label={`Select ${variant}`}\n aria-modal=\"true\"\n className={`tds-date-picker-overlay tds-date-picker-overlay--${variant}`}\n role=\"dialog\"\n >\n {children}\n </div>\n )\n}\n\nfunction DatePickerCalendarBody({\n activeOverlay,\n setActiveOverlay,\n}: {\n activeOverlay: \"month\" | \"year\" | null\n setActiveOverlay: (overlay: \"month\" | \"year\" | null) => void\n}) {\n // Read and drive Calendar's focused date through its state context. This\n // lets react-aria-components own the \"open to selected month\" behavior:\n // when the popover opens, Calendar mounts and auto-focuses the DatePicker's\n // current value (whether typed into the input segments or set via `value`).\n const state = useContext(CalendarStateContext)!\n const focusedDate = state.focusedDate\n const today = todayCalendar(getLocalTimeZone())\n const locale = useTapestryLocale()\n const shortMonthFormatter = useMemo(\n () => new Intl.DateTimeFormat(locale, { month: \"short\" }),\n [locale]\n )\n const longMonthFormatter = useMemo(\n () => new Intl.DateTimeFormat(locale, { month: \"long\" }),\n [locale]\n )\n\n function handleOverlaySelectionChange(\n keys: \"all\" | Set<number | string>,\n onSelect: (key: number) => void\n ) {\n if (keys === \"all\") return\n const [first] = Array.from(keys)\n if (first !== undefined) onSelect(Number(first))\n }\n\n function handleMonthSelect(monthIndex: number) {\n state.setFocusedDate(new CalendarDate(focusedDate.year, monthIndex + 1, 1))\n setActiveOverlay(null)\n }\n\n function handleYearSelect(year: number) {\n state.setFocusedDate(new CalendarDate(year, focusedDate.month, 1))\n setActiveOverlay(null)\n }\n\n return (\n <>\n <header className=\"tds-date-picker-calendar-header\">\n <div className=\"tds-date-picker-calendar-heading\">\n <Button\n aria-expanded={activeOverlay === \"month\"}\n aria-haspopup=\"dialog\"\n className=\"tds-date-picker-calendar-overlay-trigger\"\n onPress={() =>\n setActiveOverlay(activeOverlay === \"month\" ? null : \"month\")\n }\n slot={null}\n >\n {longMonthFormatter.format(\n new Date(2000, focusedDate.month - 1, 1)\n )}\n </Button>\n <Button\n aria-expanded={activeOverlay === \"year\"}\n aria-haspopup=\"dialog\"\n className=\"tds-date-picker-calendar-overlay-trigger\"\n onPress={() =>\n setActiveOverlay(activeOverlay === \"year\" ? null : \"year\")\n }\n slot={null}\n >\n {focusedDate.year}\n </Button>\n </div>\n {activeOverlay ? (\n <Button\n aria-label={`Close ${activeOverlay} picker`}\n className=\"tds-date-picker-calendar-nav\"\n onPress={() => setActiveOverlay(null)}\n slot={null}\n >\n <Icon aria-hidden symbol=\"general#x\" />\n </Button>\n ) : (\n <>\n <Button\n aria-label=\"Go to today\"\n className=\"tds-date-picker-calendar-nav tds-date-picker-calendar-nav--lg\"\n style={{\n visibility:\n focusedDate.month === today.month &&\n focusedDate.year === today.year\n ? \"hidden\"\n : undefined,\n }}\n onPress={() => {\n state.setFocusedDate(today)\n state.setFocused(true)\n }}\n slot={null}\n >\n {/* TODO: Add to icon library and use Icon once icon is decided on */}\n <svg\n aria-hidden\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n className=\"symbol\"\n >\n <path d=\"M13.444 14.222H2.556V5.667h10.888zm0-12.444h-.777V.222h-1.556v1.556H4.889V.222H3.333v1.556h-.777a1.55 1.55 0 0 0-1.548 1.555L1 14.222a1.555 1.555 0 0 0 1.556 1.556h10.888A1.56 1.56 0 0 0 15 14.222V3.333a1.56 1.56 0 0 0-1.556-1.555\" />\n <circle cx=\"8\" cy=\"9.75\" r=\"2.25\" />\n </svg>\n </Button>\n <Button\n aria-label=\"Previous month\"\n className=\"tds-date-picker-calendar-nav\"\n slot=\"previous\"\n >\n <Icon aria-hidden symbol=\"general#left-chevron\" />\n </Button>\n <Button\n aria-label=\"Next month\"\n className=\"tds-date-picker-calendar-nav\"\n slot=\"next\"\n >\n <Icon aria-hidden symbol=\"general#right-chevron\" />\n </Button>\n </>\n )}\n </header>\n <div className=\"tds-date-picker-calendar-body\">\n {activeOverlay === \"month\" && (\n <DatePickerOverlay variant=\"month\">\n <ListBox\n aria-label=\"Months\"\n // eslint-disable-next-line jsx-a11y/no-autofocus -- focusing the active item on dialog open is required per ARIA authoring practices\n autoFocus\n className=\"tds-date-picker-overlay-list\"\n disallowEmptySelection\n escapeKeyBehavior=\"none\"\n layout=\"grid\"\n onSelectionChange={(keys) =>\n handleOverlaySelectionChange(keys, handleMonthSelect)\n }\n selectedKeys={[String(focusedDate.month - 1)]}\n selectionMode=\"single\"\n >\n {MONTHS.map((i) => {\n const date = new Date(2000, i, 1)\n const shortMonth = shortMonthFormatter.format(date)\n const longMonth = longMonthFormatter.format(date)\n\n return (\n <ListBoxItem\n className=\"tds-date-picker-overlay-cell\"\n id={String(i)}\n key={i}\n aria-label={longMonth}\n textValue={longMonth}\n >\n {shortMonth}\n </ListBoxItem>\n )\n })}\n </ListBox>\n </DatePickerOverlay>\n )}\n {activeOverlay === \"year\" && (\n <DatePickerOverlay variant=\"year\">\n <ListBox\n aria-label=\"Years\"\n // eslint-disable-next-line jsx-a11y/no-autofocus -- focusing the active item on dialog open is required per ARIA authoring practices\n autoFocus\n className=\"tds-date-picker-overlay-list\"\n disallowEmptySelection\n escapeKeyBehavior=\"none\"\n layout=\"grid\"\n onSelectionChange={(keys) =>\n handleOverlaySelectionChange(keys, handleYearSelect)\n }\n selectedKeys={[String(focusedDate.year)]}\n selectionMode=\"single\"\n >\n {YEARS.map((year) => (\n <ListBoxItem\n className=\"tds-date-picker-overlay-cell\"\n id={String(year)}\n key={year}\n textValue={String(year)}\n >\n {year}\n </ListBoxItem>\n ))}\n </ListBox>\n </DatePickerOverlay>\n )}\n <CalendarGrid className=\"tds-date-picker-calendar-grid\">\n <CalendarGridHeader className=\"tds-date-picker-calendar-grid-header\">\n {(day) => (\n <CalendarHeaderCell className=\"tds-date-picker-calendar-header-cell\">\n {day}\n </CalendarHeaderCell>\n )}\n </CalendarGridHeader>\n <CalendarGridBody className=\"tds-date-picker-calendar-grid-body\">\n {(date) => (\n <CalendarCell\n className=\"tds-date-picker-calendar-cell-button\"\n date={date}\n />\n )}\n </CalendarGridBody>\n </CalendarGrid>\n </div>\n </>\n )\n}\n\nfunction useValue({\n defaultValue,\n onChange,\n value,\n}: Pick<DatePickerProps, \"defaultValue\" | \"onChange\" | \"value\">): [\n DateValue | null,\n (value: DateValue | null) => void,\n] {\n const [uncontrolledValue, setUncontrolledValue] = useState(\n () => toCalendarDate(defaultValue) ?? null\n )\n // react-aria rebuilds the segments whenever the value's reference changes,\n // so a new object for the same date would wipe a partly typed one\n const valueKey = value == null ? value : value.toString()\n const controlledValue = useMemo(\n () => toCalendarDate(value) ?? null,\n // eslint-disable-next-line react-hooks/exhaustive-deps -- convert again only when the date changes, not the object\n [valueKey]\n )\n if (value !== undefined) {\n return [controlledValue, (...args) => onChange?.(...args)]\n }\n return [\n uncontrolledValue,\n (value) => {\n onChange?.(value)\n setUncontrolledValue(value)\n },\n ]\n}\n\n// Expands 2-digit years to 4 digits using the POSIX windowing rule: last 80 years and next 19 years.\nfunction expandTwoDigitYearsViaPOSIX(date: DateValue): DateValue {\n if (date.year >= 100) return date\n\n const currentYear = todayCalendar(getLocalTimeZone()).year\n const currentCentury = Math.floor(currentYear / 100) * 100\n const windowStart = currentYear - 80\n\n let fullYear = currentCentury + date.year\n if (fullYear < windowStart) fullYear += 100\n else if (fullYear > windowStart + 99) fullYear -= 100\n\n return date.set({ year: fullYear })\n}\n\nfunction isPartlyFilled(field: HTMLElement | null) {\n const segments = Array.from(\n field?.querySelectorAll('[data-type]:not([data-type=\"literal\"])') ?? []\n )\n const blankCount = segments.filter((segment) =>\n segment.hasAttribute(\"data-placeholder\")\n ).length\n return blankCount > 0 && blankCount < segments.length\n}\n\n/**\n * A date picker allows a user to select a particular date.\n * The input supports keyboard entry of individual day, month, and year segments;\n * the calendar offers month and year quick-pick overlays plus a \"go to today\" shortcut.\n *\n * The date picker automatically displays the value and calendar from the user's locale,\n * and does not require a specific date format.\n *\n * Values are exchanged as `DateValue` from `@internationalized/date`, but\n * `value`, `defaultValue`, `min`, and `max` also accept ISO date strings\n * (`\"YYYY-MM-DD\"`) for convenience. Restrict the selectable range with\n * `min`/`max`, or mark individual dates as unavailable via `isDateUnavailable`.\n *\n * Renders uncontrolled when `value` is omitted: pass `defaultValue` to set\n * the initial date without managing state.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-datepicker--docs | Storybook Documentation}\n * @see {@link https://github.com/planningcenter/tapestry/tree/main/packages/tapestry-migration-cli | Migration CLI: Available}\n */\nexport function DatePicker({\n className,\n defaultValue,\n description,\n disabled,\n firstDayOfWeek,\n formatDateOnBlur = expandTwoDigitYearsViaPOSIX,\n hideLabel,\n invalid,\n isDateUnavailable,\n label,\n max,\n min,\n name,\n onBlur,\n onChange,\n onFocus,\n onOpenChange,\n readOnly,\n required,\n size = \"md\",\n value,\n alwaysShowFourDigitYear = false,\n ...restProps\n}: DatePickerElementProps) {\n const convertedMin = toCalendarDate(min) ?? undefined\n const convertedMax = toCalendarDate(max) ?? undefined\n\n const combinedClassName = classNames(\n \"tds-field tds-date-picker\",\n {\n \"tds-date-picker--lg\": size === \"lg\",\n \"tds-field--lg\": size === \"lg\",\n },\n className\n )\n\n const [activeOverlay, setActiveOverlay] = useState<\"month\" | \"year\" | null>(\n null\n )\n\n const [computedValue, setComputedValue] = useValue({\n defaultValue,\n onChange,\n value,\n })\n\n // react-aria only reports complete dates, and rebuilds the segments whenever\n // its value changes. So once a partly filled date reports null, react-aria\n // keeps the last complete date it held, or it would wipe the partial text.\n // See adobe/react-spectrum#9624 and #9801.\n const [heldValue, setHeldValue] = useState<DateValue | null>(null)\n const valueKey = computedValue?.toString() ?? null\n const [lastValueKey, setLastValueKey] = useState(valueKey)\n if (valueKey !== lastValueKey) {\n setLastValueKey(valueKey)\n if (computedValue) setHeldValue(null)\n }\n // onBlur reads this; react-aria can report a change earlier in the same blur event\n const heldValueRef = useRef(heldValue)\n useEffect(() => {\n heldValueRef.current = heldValue\n }, [heldValue])\n\n const [valueBeforeEdit, setValueBeforeEdit] = useState(computedValue)\n const [openedPartlyFilled, setOpenedPartlyFilled] = useState(false)\n const fieldRef = useRef<HTMLDivElement>(null)\n\n const locale = useTapestryLocale()\n const dateFieldLocale = useDateFieldLocale()\n\n return (\n <I18nProvider locale={locale}>\n <AriaDatePicker\n {...restProps}\n aria-label={hideLabel ? label : undefined}\n className={combinedClassName}\n isDateUnavailable={isDateUnavailable}\n isDisabled={disabled}\n isReadOnly={readOnly}\n isRequired={required}\n maxValue={convertedMax}\n minValue={convertedMin}\n onBlur={(event) => {\n if (isPartlyFilled(fieldRef.current)) {\n if (computedValue) {\n setHeldValue(computedValue)\n setComputedValue(null)\n }\n } else if (heldValueRef.current) {\n // Refilled to the date react-aria still held, so it reported no change\n setHeldValue(null)\n setComputedValue(heldValueRef.current)\n } else if (formatDateOnBlur && computedValue) {\n const formattedValue = formatDateOnBlur(computedValue)\n if (!isSameDay(formattedValue, computedValue)) {\n setComputedValue(formattedValue)\n }\n }\n onBlur?.(event)\n }}\n onChange={(newValue) => {\n heldValueRef.current = null\n setHeldValue(null)\n if (newValue === null && computedValue === null) return\n setComputedValue(newValue)\n }}\n onFocus={(event) => {\n if (!heldValue) setValueBeforeEdit(computedValue)\n onFocus?.(event)\n }}\n onOpenChange={(isOpen) => {\n if (isOpen) setOpenedPartlyFilled(isPartlyFilled(fieldRef.current))\n else setActiveOverlay(null)\n onOpenChange?.(isOpen)\n }}\n validate={() => (heldValue && required ? \"Enter a full date\" : null)}\n value={heldValue ?? computedValue}\n >\n {!hideLabel && <Label className=\"tds-field-label\">{label}</Label>}\n <Group\n aria-invalid={invalid || undefined}\n className=\"tds-field-control tds-date-picker-field\"\n ref={fieldRef}\n >\n <I18nProvider locale={dateFieldLocale}>\n <DateInput className=\"tds-date-picker-input\">\n {(segment) => (\n <DateSegment\n aria-invalid={invalid || undefined}\n className={\n segment.type === \"literal\"\n ? \"tds-field-date-segment-separator\"\n : \"tds-field-date-segment\"\n }\n segment={\n segment.type === \"year\" &&\n !segment.isPlaceholder &&\n segment.value != null &&\n alwaysShowFourDigitYear\n ? {\n ...segment,\n text: new Intl.NumberFormat(undefined, {\n minimumIntegerDigits: 4,\n useGrouping: false,\n }).format(segment.value),\n }\n : segment\n }\n />\n )}\n </DateInput>\n </I18nProvider>\n <Button className=\"tds-btn tds-btn--infield tds-date-picker-button\">\n <Icon aria-hidden symbol=\"general#calendar\" />\n </Button>\n </Group>\n <Popover\n className={classNames(\"tds-date-picker-popover\", {\n \"tds-date-picker-popover--lg\": size === \"lg\",\n })}\n offset={2}\n >\n <Dialog>\n <Calendar\n className=\"tds-date-picker-calendar\"\n defaultFocusedValue={\n openedPartlyFilled ? (valueBeforeEdit ?? undefined) : undefined\n }\n firstDayOfWeek={firstDayOfWeek}\n value={openedPartlyFilled ? null : undefined}\n >\n <DatePickerCalendarBody\n activeOverlay={activeOverlay}\n setActiveOverlay={setActiveOverlay}\n />\n </Calendar>\n </Dialog>\n </Popover>\n {description && (\n <Text\n elementType=\"p\"\n className=\"tds-field-description\"\n slot=\"description\"\n >\n <Icon\n aria-hidden\n className=\"tds-field-description-invalid-icon\"\n symbol=\"general#exclamation-triangle\"\n />\n {description}\n </Text>\n )}\n {name && (\n // Submits the reported value, which react-aria's own input can't while it holds a partly filled date\n <input\n disabled={disabled}\n hidden\n name={name}\n onChange={() => {}}\n type=\"text\"\n value={computedValue?.toString() ?? \"\"}\n />\n )}\n </AriaDatePicker>\n </I18nProvider>\n )\n}\n\nDatePicker.displayName = \"DatePicker\"\n"],"names":["todayCalendar","getLocalTimeZone","parseDate","CalendarDate","AriaDatePicker","isSameDay"],"mappings":";;;;;;;;;;;;;;AA+CA,MAAM,MAAM,GAAGA,yCAAa,CAACC,yCAAgB,EAAE,CAAC;AAChD,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AACtD,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;AAM1E,SAAS,cAAc,CACrB,KAA6C,EAAA;IAE7C,IAAI,KAAK,KAAK,IAAI;AAAE,QAAA,OAAO,IAAI;IAC/B,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS;IAEzC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,UAAU,IAAI,KAAK,EAAE;AACpD,QAAA,OAAO,KAAK;IACd;AAEA,IAAA,OAAOC,wCAAS,CAAC,KAAK,CAAC;AACzB;AAqEA,SAAS,i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 {"version":3,"file":"DatePicker.js","sources":["../../../src/components/date-picker/DatePicker.tsx"],"sourcesContent":["import \"../button/btn.css\"\nimport \"../field/index.css\"\nimport \"./index.css\"\n\nimport {\n CalendarDate,\n type DateValue,\n getLocalTimeZone,\n isSameDay,\n parseDate,\n today as todayCalendar,\n} from \"@internationalized/date\"\nimport Icon from \"@utilities/Icon\"\nimport { useTapestryLocale } from \"@utilities/locale\"\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport { useDateFieldLocale } from \"@utilities/useDateFieldLocale\"\nimport classNames from \"classnames\"\nimport React, {\n type ReactNode,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport { I18nProvider } from \"react-aria/I18nProvider\"\nimport { CalendarStateContext } from \"react-aria-components/Calendar\"\nimport {\n Button,\n Calendar,\n CalendarCell,\n CalendarGrid,\n CalendarGridBody,\n CalendarGridHeader,\n CalendarHeaderCell,\n DateInput,\n DatePicker as AriaDatePicker,\n type DatePickerProps as AriaDatePickerProps,\n DateSegment,\n Group,\n Label,\n Popover,\n Text,\n} from \"react-aria-components/DatePicker\"\nimport { Dialog } from \"react-aria-components/Dialog\"\nimport { ListBox, ListBoxItem } from \"react-aria-components/ListBox\"\n\nconst _today = todayCalendar(getLocalTimeZone())\nconst MONTHS = Array.from({ length: 12 }, (_, i) => i)\nconst YEARS = Array.from({ length: 131 }, (_, i) => _today.year - 100 + i)\n\nexport type DatePickerSize = \"md\" | \"lg\"\n\nexport type DatePickerDateValue = DateValue | string\n\nfunction toCalendarDate(\n input: DatePickerDateValue | null | undefined\n): DateValue | null | undefined {\n if (input === null) return null\n if (input === undefined) return undefined\n\n if (typeof input === \"object\" && \"calendar\" in input) {\n return input\n }\n\n return parseDate(input)\n}\n\nexport interface DatePickerProps {\n /** If `true`, always shows leading zeros in the year segment for years less than 1000. Defaults to true. */\n alwaysShowFourDigitYear?: boolean\n /** The initial value for uncontrolled usage. Accepts a DateValue or ISO date string. */\n defaultValue?: DatePickerDateValue | null\n /** Helper text displayed below the component. Styled as error text when `invalid` is `true`. */\n description?: ReactNode\n /** Disables the input and calendar button. */\n disabled?: boolean\n /** Sets the first day of the week in the calendar. Defaults to locale-appropriate value. */\n firstDayOfWeek?: \"fri\" | \"mon\" | \"sat\" | \"sun\" | \"thu\" | \"tue\" | \"wed\"\n /**\n * Called on blur with the current complete value, if any, so it can be\n * normalized (e.g. correcting a 2-digit year to 4 digits). If the returned\n * value differs from the current one, the field updates to match.\n */\n formatDateOnBlur?: (date: DateValue) => DateValue\n /** If `true`, the `label` text is rendered as an `aria-label` instead of a visible label element. */\n hideLabel?: boolean\n /** Whether the input is in an invalid state. */\n invalid?: boolean\n /** Callback that returns `true` for dates that should be visible but not selectable. */\n isDateUnavailable?: (date: DateValue) => boolean\n /** Accessible label for the field. */\n label: string\n /** Maximum selectable date. Accepts a DateValue or ISO date string. */\n max?: DatePickerDateValue\n /** Minimum selectable date. Accepts a DateValue or ISO date string. */\n min?: DatePickerDateValue\n /** Called when the selected date changes. */\n onChange?: (value: DateValue | null) => void\n /** If `true`, allows the value to be read but not changed. */\n readOnly?: boolean\n /** If `true`, appends an asterisk at the end of the label text. */\n required?: boolean\n /** The size of the date picker. */\n size?: DatePickerSize\n /**\n * The controlled value. Accepts a DateValue or ISO date string.\n *\n * A partly filled date (e.g. `4/dd/2026`) reports `null` on blur but stays on\n * screen. Setting `null` again won't clear it; remount with a `key` to reset.\n */\n value?: DatePickerDateValue | null\n}\n\ntype AriaDatePickerPropsToOmit =\n | \"children\"\n | \"defaultOpen\"\n | \"granularity\"\n | \"hideTimeZone\"\n | \"hourCycle\"\n | \"pageBehavior\"\n | \"placeholderValue\"\n | \"shouldCloseOnSelect\"\n | \"shouldForceLeadingZeros\"\n | \"slot\"\n\ntype AriaDatePickerPropsToInclude = \"isOpen\" | \"name\" | \"onOpenChange\"\n\nexport type DatePickerElementProps = CombineAriaPropsWithCustomProps<\n AriaDatePickerProps<DateValue>,\n DatePickerProps,\n AriaDatePickerPropsToOmit,\n AriaDatePickerPropsToInclude\n>\n\nfunction DatePickerOverlay({\n children,\n variant,\n}: {\n children: ReactNode\n variant: \"month\" | \"year\"\n}) {\n return (\n <div\n aria-label={`Select ${variant}`}\n aria-modal=\"true\"\n className={`tds-date-picker-overlay tds-date-picker-overlay--${variant}`}\n role=\"dialog\"\n >\n {children}\n </div>\n )\n}\n\nfunction DatePickerCalendarBody({\n activeOverlay,\n setActiveOverlay,\n}: {\n activeOverlay: \"month\" | \"year\" | null\n setActiveOverlay: (overlay: \"month\" | \"year\" | null) => void\n}) {\n // Read and drive Calendar's focused date through its state context. This\n // lets react-aria-components own the \"open to selected month\" behavior:\n // when the popover opens, Calendar mounts and auto-focuses the DatePicker's\n // current value (whether typed into the input segments or set via `value`).\n const state = useContext(CalendarStateContext)!\n const focusedDate = state.focusedDate\n const today = todayCalendar(getLocalTimeZone())\n const locale = useTapestryLocale()\n const shortMonthFormatter = useMemo(\n () => new Intl.DateTimeFormat(locale, { month: \"short\" }),\n [locale]\n )\n const longMonthFormatter = useMemo(\n () => new Intl.DateTimeFormat(locale, { month: \"long\" }),\n [locale]\n )\n\n function handleOverlaySelectionChange(\n keys: \"all\" | Set<number | string>,\n onSelect: (key: number) => void\n ) {\n if (keys === \"all\") return\n const [first] = Array.from(keys)\n if (first !== undefined) onSelect(Number(first))\n }\n\n function handleMonthSelect(monthIndex: number) {\n state.setFocusedDate(new CalendarDate(focusedDate.year, monthIndex + 1, 1))\n setActiveOverlay(null)\n }\n\n function handleYearSelect(year: number) {\n state.setFocusedDate(new CalendarDate(year, focusedDate.month, 1))\n setActiveOverlay(null)\n }\n\n return (\n <>\n <header className=\"tds-date-picker-calendar-header\">\n <div className=\"tds-date-picker-calendar-heading\">\n <Button\n aria-expanded={activeOverlay === \"month\"}\n aria-haspopup=\"dialog\"\n className=\"tds-date-picker-calendar-overlay-trigger\"\n onPress={() =>\n setActiveOverlay(activeOverlay === \"month\" ? null : \"month\")\n }\n slot={null}\n >\n {longMonthFormatter.format(\n new Date(2000, focusedDate.month - 1, 1)\n )}\n </Button>\n <Button\n aria-expanded={activeOverlay === \"year\"}\n aria-haspopup=\"dialog\"\n className=\"tds-date-picker-calendar-overlay-trigger\"\n onPress={() =>\n setActiveOverlay(activeOverlay === \"year\" ? null : \"year\")\n }\n slot={null}\n >\n {focusedDate.year}\n </Button>\n </div>\n {activeOverlay ? (\n <Button\n aria-label={`Close ${activeOverlay} picker`}\n className=\"tds-date-picker-calendar-nav\"\n onPress={() => setActiveOverlay(null)}\n slot={null}\n >\n <Icon aria-hidden symbol=\"general#x\" />\n </Button>\n ) : (\n <>\n <Button\n aria-label=\"Go to today\"\n className=\"tds-date-picker-calendar-nav tds-date-picker-calendar-nav--lg\"\n style={{\n visibility:\n focusedDate.month === today.month &&\n focusedDate.year === today.year\n ? \"hidden\"\n : undefined,\n }}\n onPress={() => {\n state.setFocusedDate(today)\n state.setFocused(true)\n }}\n slot={null}\n >\n {/* TODO: Add to icon library and use Icon once icon is decided on */}\n <svg\n aria-hidden\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n className=\"symbol\"\n >\n <path d=\"M13.444 14.222H2.556V5.667h10.888zm0-12.444h-.777V.222h-1.556v1.556H4.889V.222H3.333v1.556h-.777a1.55 1.55 0 0 0-1.548 1.555L1 14.222a1.555 1.555 0 0 0 1.556 1.556h10.888A1.56 1.56 0 0 0 15 14.222V3.333a1.56 1.56 0 0 0-1.556-1.555\" />\n <circle cx=\"8\" cy=\"9.75\" r=\"2.25\" />\n </svg>\n </Button>\n <Button\n aria-label=\"Previous month\"\n className=\"tds-date-picker-calendar-nav\"\n slot=\"previous\"\n >\n <Icon aria-hidden symbol=\"general#left-chevron\" />\n </Button>\n <Button\n aria-label=\"Next month\"\n className=\"tds-date-picker-calendar-nav\"\n slot=\"next\"\n >\n <Icon aria-hidden symbol=\"general#right-chevron\" />\n </Button>\n </>\n )}\n </header>\n <div className=\"tds-date-picker-calendar-body\">\n {activeOverlay === \"month\" && (\n <DatePickerOverlay variant=\"month\">\n <ListBox\n aria-label=\"Months\"\n // eslint-disable-next-line jsx-a11y/no-autofocus -- focusing the active item on dialog open is required per ARIA authoring practices\n autoFocus\n className=\"tds-date-picker-overlay-list\"\n disallowEmptySelection\n escapeKeyBehavior=\"none\"\n layout=\"grid\"\n onSelectionChange={(keys) =>\n handleOverlaySelectionChange(keys, handleMonthSelect)\n }\n selectedKeys={[String(focusedDate.month - 1)]}\n selectionMode=\"single\"\n >\n {MONTHS.map((i) => {\n const date = new Date(2000, i, 1)\n const shortMonth = shortMonthFormatter.format(date)\n const longMonth = longMonthFormatter.format(date)\n\n return (\n <ListBoxItem\n className=\"tds-date-picker-overlay-cell\"\n id={String(i)}\n key={i}\n aria-label={longMonth}\n textValue={longMonth}\n >\n {shortMonth}\n </ListBoxItem>\n )\n })}\n </ListBox>\n </DatePickerOverlay>\n )}\n {activeOverlay === \"year\" && (\n <DatePickerOverlay variant=\"year\">\n <ListBox\n aria-label=\"Years\"\n // eslint-disable-next-line jsx-a11y/no-autofocus -- focusing the active item on dialog open is required per ARIA authoring practices\n autoFocus\n className=\"tds-date-picker-overlay-list\"\n disallowEmptySelection\n escapeKeyBehavior=\"none\"\n layout=\"grid\"\n onSelectionChange={(keys) =>\n handleOverlaySelectionChange(keys, handleYearSelect)\n }\n selectedKeys={[String(focusedDate.year)]}\n selectionMode=\"single\"\n >\n {YEARS.map((year) => (\n <ListBoxItem\n className=\"tds-date-picker-overlay-cell\"\n id={String(year)}\n key={year}\n textValue={String(year)}\n >\n {year}\n </ListBoxItem>\n ))}\n </ListBox>\n </DatePickerOverlay>\n )}\n <CalendarGrid className=\"tds-date-picker-calendar-grid\">\n <CalendarGridHeader className=\"tds-date-picker-calendar-grid-header\">\n {(day) => (\n <CalendarHeaderCell className=\"tds-date-picker-calendar-header-cell\">\n {day}\n </CalendarHeaderCell>\n )}\n </CalendarGridHeader>\n <CalendarGridBody className=\"tds-date-picker-calendar-grid-body\">\n {(date) => (\n <CalendarCell\n className=\"tds-date-picker-calendar-cell-button\"\n date={date}\n />\n )}\n </CalendarGridBody>\n </CalendarGrid>\n </div>\n </>\n )\n}\n\nfunction useValue({\n defaultValue,\n onChange,\n value,\n}: Pick<DatePickerProps, \"defaultValue\" | \"onChange\" | \"value\">): [\n DateValue | null,\n (value: DateValue | null) => void,\n] {\n const [uncontrolledValue, setUncontrolledValue] = useState(\n () => toCalendarDate(defaultValue) ?? null\n )\n // react-aria rebuilds the segments whenever the value's reference changes,\n // so a new object for the same date would wipe a partly typed one\n const valueKey = value == null ? value : value.toString()\n const controlledValue = useMemo(\n () => toCalendarDate(value) ?? null,\n // eslint-disable-next-line react-hooks/exhaustive-deps -- convert again only when the date changes, not the object\n [valueKey]\n )\n if (value !== undefined) {\n return [controlledValue, (...args) => onChange?.(...args)]\n }\n return [\n uncontrolledValue,\n (value) => {\n onChange?.(value)\n setUncontrolledValue(value)\n },\n ]\n}\n\n// Expands 2-digit years to 4 digits using the POSIX windowing rule: last 80 years and next 19 years.\nfunction expandTwoDigitYearsViaPOSIX(date: DateValue): DateValue {\n if (date.year >= 100) return date\n\n const currentYear = todayCalendar(getLocalTimeZone()).year\n const currentCentury = Math.floor(currentYear / 100) * 100\n const windowStart = currentYear - 80\n\n let fullYear = currentCentury + date.year\n if (fullYear < windowStart) fullYear += 100\n else if (fullYear > windowStart + 99) fullYear -= 100\n\n return date.set({ year: fullYear })\n}\n\nfunction isPartlyFilled(field: HTMLElement | null) {\n const segments = Array.from(\n field?.querySelectorAll('[data-type]:not([data-type=\"literal\"])') ?? []\n )\n const blankCount = segments.filter((segment) =>\n segment.hasAttribute(\"data-placeholder\")\n ).length\n return blankCount > 0 && blankCount < segments.length\n}\n\n/**\n * A date picker allows a user to select a particular date.\n * The input supports keyboard entry of individual day, month, and year segments;\n * the calendar offers month and year quick-pick overlays plus a \"go to today\" shortcut.\n *\n * The date picker automatically displays the value and calendar from the user's locale,\n * and does not require a specific date format.\n *\n * Values are exchanged as `DateValue` from `@internationalized/date`, but\n * `value`, `defaultValue`, `min`, and `max` also accept ISO date strings\n * (`\"YYYY-MM-DD\"`) for convenience. Restrict the selectable range with\n * `min`/`max`, or mark individual dates as unavailable via `isDateUnavailable`.\n *\n * Renders uncontrolled when `value` is omitted: pass `defaultValue` to set\n * the initial date without managing state.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-datepicker--docs | Storybook Documentation}\n * @see {@link https://github.com/planningcenter/tapestry/tree/main/packages/tapestry-migration-cli | Migration CLI: Available}\n */\nexport function DatePicker({\n className,\n defaultValue,\n description,\n disabled,\n firstDayOfWeek,\n formatDateOnBlur = expandTwoDigitYearsViaPOSIX,\n hideLabel,\n invalid,\n isDateUnavailable,\n label,\n max,\n min,\n name,\n onBlur,\n onChange,\n onFocus,\n onOpenChange,\n readOnly,\n required,\n size = \"md\",\n value,\n alwaysShowFourDigitYear = false,\n ...restProps\n}: DatePickerElementProps) {\n const convertedMin = toCalendarDate(min) ?? undefined\n const convertedMax = toCalendarDate(max) ?? undefined\n\n const combinedClassName = classNames(\n \"tds-field tds-date-picker\",\n {\n \"tds-date-picker--lg\": size === \"lg\",\n \"tds-field--lg\": size === \"lg\",\n },\n className\n )\n\n const [activeOverlay, setActiveOverlay] = useState<\"month\" | \"year\" | null>(\n null\n )\n\n const [computedValue, setComputedValue] = useValue({\n defaultValue,\n onChange,\n value,\n })\n\n // react-aria only reports complete dates, and rebuilds the segments whenever\n // its value changes. So once a partly filled date reports null, react-aria\n // keeps the last complete date it held, or it would wipe the partial text.\n // See adobe/react-spectrum#9624 and #9801.\n const [heldValue, setHeldValue] = useState<DateValue | null>(null)\n const valueKey = computedValue?.toString() ?? null\n const [lastValueKey, setLastValueKey] = useState(valueKey)\n if (valueKey !== lastValueKey) {\n setLastValueKey(valueKey)\n if (computedValue) setHeldValue(null)\n }\n // onBlur reads this; react-aria can report a change earlier in the same blur event\n const heldValueRef = useRef(heldValue)\n useEffect(() => {\n heldValueRef.current = heldValue\n }, [heldValue])\n\n const [valueBeforeEdit, setValueBeforeEdit] = useState(computedValue)\n const [openedPartlyFilled, setOpenedPartlyFilled] = useState(false)\n const fieldRef = useRef<HTMLDivElement>(null)\n\n const locale = useTapestryLocale()\n const dateFieldLocale = useDateFieldLocale()\n\n return (\n <I18nProvider locale={locale}>\n <AriaDatePicker\n {...restProps}\n aria-label={hideLabel ? label : undefined}\n className={combinedClassName}\n isDateUnavailable={isDateUnavailable}\n isDisabled={disabled}\n isReadOnly={readOnly}\n isRequired={required}\n maxValue={convertedMax}\n minValue={convertedMin}\n onBlur={(event) => {\n if (isPartlyFilled(fieldRef.current)) {\n if (computedValue) {\n setHeldValue(computedValue)\n setComputedValue(null)\n }\n } else if (heldValueRef.current) {\n // Refilled to the date react-aria still held, so it reported no change\n setHeldValue(null)\n setComputedValue(heldValueRef.current)\n } else if (formatDateOnBlur && computedValue) {\n const formattedValue = formatDateOnBlur(computedValue)\n if (!isSameDay(formattedValue, computedValue)) {\n setComputedValue(formattedValue)\n }\n }\n onBlur?.(event)\n }}\n onChange={(newValue) => {\n heldValueRef.current = null\n setHeldValue(null)\n if (newValue === null && computedValue === null) return\n setComputedValue(newValue)\n }}\n onFocus={(event) => {\n if (!heldValue) setValueBeforeEdit(computedValue)\n onFocus?.(event)\n }}\n onOpenChange={(isOpen) => {\n if (isOpen) setOpenedPartlyFilled(isPartlyFilled(fieldRef.current))\n else setActiveOverlay(null)\n onOpenChange?.(isOpen)\n }}\n validate={() => (heldValue && required ? \"Enter a full date\" : null)}\n value={heldValue ?? computedValue}\n >\n {!hideLabel && <Label className=\"tds-field-label\">{label}</Label>}\n <Group\n aria-invalid={invalid || undefined}\n className=\"tds-field-control tds-date-picker-field\"\n ref={fieldRef}\n >\n <I18nProvider locale={dateFieldLocale}>\n <DateInput className=\"tds-date-picker-input\">\n {(segment) => (\n <DateSegment\n aria-invalid={invalid || undefined}\n className={\n segment.type === \"literal\"\n ? \"tds-field-date-segment-separator\"\n : \"tds-field-date-segment\"\n }\n segment={\n segment.type === \"year\" &&\n !segment.isPlaceholder &&\n segment.value != null &&\n alwaysShowFourDigitYear\n ? {\n ...segment,\n text: new Intl.NumberFormat(undefined, {\n minimumIntegerDigits: 4,\n useGrouping: false,\n }).format(segment.value),\n }\n : segment\n }\n />\n )}\n </DateInput>\n </I18nProvider>\n <Button className=\"tds-btn tds-btn--infield tds-date-picker-button\">\n <Icon aria-hidden symbol=\"general#calendar\" />\n </Button>\n </Group>\n <Popover\n className={classNames(\"tds-date-picker-popover\", {\n \"tds-date-picker-popover--lg\": size === \"lg\",\n })}\n offset={2}\n >\n <Dialog>\n <Calendar\n className=\"tds-date-picker-calendar\"\n defaultFocusedValue={\n openedPartlyFilled ? (valueBeforeEdit ?? undefined) : undefined\n }\n firstDayOfWeek={firstDayOfWeek}\n value={openedPartlyFilled ? null : undefined}\n >\n <DatePickerCalendarBody\n activeOverlay={activeOverlay}\n setActiveOverlay={setActiveOverlay}\n />\n </Calendar>\n </Dialog>\n </Popover>\n {description && (\n <Text\n elementType=\"p\"\n className=\"tds-field-description\"\n slot=\"description\"\n >\n <Icon\n aria-hidden\n className=\"tds-field-description-invalid-icon\"\n symbol=\"general#exclamation-triangle\"\n />\n {description}\n </Text>\n )}\n {name && (\n // Submits the reported value, which react-aria's own input can't while it holds a partly filled date\n <input\n disabled={disabled}\n hidden\n name={name}\n onChange={() => {}}\n type=\"text\"\n value={computedValue?.toString() ?? \"\"}\n />\n )}\n </AriaDatePicker>\n </I18nProvider>\n )\n}\n\nDatePicker.displayName = \"DatePicker\"\n"],"names":["todayCalendar","getLocalTimeZone","parseDate","React","CalendarDate","AriaDatePicker","isSameDay"],"mappings":";;;;;;;;;;;;;;AA+CA,MAAM,MAAM,GAAGA,yCAAa,CAACC,yCAAgB,EAAE,CAAC;AAChD,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE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AAW,KACVA,cAAA,CAAA,aAAA,CAAC,IAAI,IACH,WAAW,EAAC,GAAG,EACf,SAAS,EAAC,uBAAuB,EACjC,IAAI,EAAC,aAAa,EAAA;gBAElBA,cAAA,CAAA,aAAA,CAAC,IAAI,yBAEH,SAAS,EAAC,oCAAoC,EAC9C,MAAM,EAAC,8BAA8B,EAAA,CACrC;AACD,gBAAA,WAAW,CACP,CACR;AACA,YAAA,IAAI;;AAEH,YAAAA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EACE,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAA,IAAA,EACN,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAO,CAAC,EAClB,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAA,CACtC,CACH,CACc,CACJ;AAEnB;AAEA,UAAU,CAAC,WAAW,GAAG,YAAY;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { Slot } from '@radix-ui/react-slot';
2
2
  import classNames from 'classnames';
3
- import React, { useRef, useContext, useState, useEffect } from 'react';
3
+ import React__default, { useRef, useContext, useState, useEffect } from 'react';
4
4
  import { useInteractOutside, usePreventScroll, FocusScope } from 'react-aria';
5
5
  import { MenuTrigger, MenuItem, RootMenuTriggerStateContext, Popover, Menu, MenuSection, Header, Separator, Pressable } from 'react-aria-components/Menu';
6
6
  import { PopoverContext } from 'react-aria-components/Popover';
@@ -28,7 +28,7 @@ function Dropdown({ children, onClose, onOpen }) {
28
28
  else
29
29
  onClose?.();
30
30
  };
31
- return React.createElement(MenuTrigger, { onOpenChange: handleOpenChange }, children);
31
+ return React__default.createElement(MenuTrigger, { onOpenChange: handleOpenChange }, children);
32
32
  }
33
33
  function useMenuTriggerRef() {
34
34
  const popoverContext = useContext(PopoverContext);
@@ -79,13 +79,13 @@ function DropdownMenu({ children, id, placement = "bottom start", ...dataAttribu
79
79
  ref: popoverRef,
80
80
  });
81
81
  usePreventScroll({ isDisabled: !state?.isOpen });
82
- return (React.createElement(Popover, { className: "tds-dropdown-popover", isNonModal: true, placement: placement, ref: popoverRef, shouldCloseOnInteractOutside: () => false },
83
- React.createElement(FocusScope, { contain: !isPointerDownOutside },
84
- React.createElement(Menu, { ...dataAttributes, id: id }, children))));
82
+ return (React__default.createElement(Popover, { className: "tds-dropdown-popover", isNonModal: true, placement: placement, ref: popoverRef, shouldCloseOnInteractOutside: () => false },
83
+ React__default.createElement(FocusScope, { contain: !isPointerDownOutside },
84
+ React__default.createElement(Menu, { ...dataAttributes, id: id }, children))));
85
85
  }
86
86
  function DropdownTrigger({ children, disabled }) {
87
- return (React.createElement(DropdownTriggerContext.Provider, { value: { disabled } },
88
- React.createElement(Pressable, { isDisabled: disabled }, children)));
87
+ return (React__default.createElement(DropdownTriggerContext.Provider, { value: { disabled } },
88
+ React__default.createElement(Pressable, { isDisabled: disabled }, children)));
89
89
  }
90
90
  /**
91
91
  * A `<Dropdown>` item that fires a callback when activated. Renders an RA
@@ -96,7 +96,7 @@ function DropdownTrigger({ children, disabled }) {
96
96
  * @component
97
97
  */
98
98
  function DropdownAction({ className, destructive, disabled, staffOnly, ...restProps }) {
99
- return (React.createElement(MenuItem, { ...restProps, className: classNames("tds-dropdown-item", {
99
+ return (React__default.createElement(MenuItem, { ...restProps, className: classNames("tds-dropdown-item", {
100
100
  "tds-dropdown-item--destructive": destructive,
101
101
  "tds-dropdown-item--staff-only": staffOnly,
102
102
  }, className), isDisabled: disabled }));
@@ -120,11 +120,11 @@ function DropdownLink({ asChild = false, children, className, destructive, exter
120
120
  const externalProps = external
121
121
  ? { rel: "noreferrer noopener", target: "_blank" }
122
122
  : null;
123
- return (React.createElement(MenuItem, { ...restProps, ...externalProps, className: classNames("tds-dropdown-item", {
123
+ return (React__default.createElement(MenuItem, { ...restProps, ...externalProps, className: classNames("tds-dropdown-item", {
124
124
  "tds-dropdown-item--destructive": destructive,
125
125
  "tds-dropdown-item--staff-only": staffOnly,
126
126
  }, className), render: asChild
127
- ? (props) => (React.createElement(Slot, { ...omitUndefinedValues(props) }, children))
127
+ ? (props) => (React__default.createElement(Slot, { ...omitUndefinedValues(props) }, children))
128
128
  : undefined }, asChild ? undefined : children));
129
129
  }
130
130
  /**
@@ -134,8 +134,8 @@ function DropdownLink({ asChild = false, children, className, destructive, exter
134
134
  * @component
135
135
  */
136
136
  function DropdownSection({ children, className, title, ...restProps }) {
137
- return (React.createElement(MenuSection, { ...restProps, className: classNames("tds-dropdown-section", className) },
138
- React.createElement(Header, { className: "tds-dropdown-section-label" }, title),
137
+ return (React__default.createElement(MenuSection, { ...restProps, className: classNames("tds-dropdown-section", className) },
138
+ React__default.createElement(Header, { className: "tds-dropdown-section-label" }, title),
139
139
  children));
140
140
  }
141
141
  /**
@@ -145,7 +145,7 @@ function DropdownSection({ children, className, title, ...restProps }) {
145
145
  * @component
146
146
  */
147
147
  function DropdownSeparator() {
148
- return React.createElement(Separator, { className: "tds-dropdown-separator" });
148
+ return React__default.createElement(Separator, { className: "tds-dropdown-separator" });
149
149
  }
150
150
 
151
151
  export { Dropdown, DropdownAction, DropdownLink, DropdownMenu, DropdownSection, DropdownSeparator, DropdownTrigger };
@@ -1 +1 @@
1
- {"version":3,"file":"Dropdown.js","sources":["../../../src/components/dropdown/Dropdown.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport { Slot } from \"@radix-ui/react-slot\"\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport classNames from \"classnames\"\nimport React, {\n type ComponentProps,\n type ReactElement,\n type ReactNode,\n type RefObject,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport { FocusScope, useInteractOutside, usePreventScroll } from \"react-aria\"\nimport type {\n Key,\n MenuItemProps,\n MenuSectionProps,\n PopoverProps,\n} from \"react-aria-components\"\nimport {\n Header,\n Menu,\n MenuItem,\n MenuSection,\n MenuTrigger,\n Popover,\n Pressable,\n RootMenuTriggerStateContext,\n Separator,\n} from \"react-aria-components/Menu\"\nimport { PopoverContext } from \"react-aria-components/Popover\"\n\nimport { DropdownTriggerContext } from \"./DropdownTriggerContext\"\n\nexport type DropdownPlacement = NonNullable<PopoverProps[\"placement\"]>\n\nexport interface DropdownProps {\n /**\n * A `<DropdownTrigger>` followed by a `<DropdownMenu>` containing the items.\n */\n children: ReactNode\n /** Fires when the menu closes. */\n onClose?: () => void\n /** Fires when the menu opens. Useful for analytics or lazy data prep. */\n onOpen?: () => void\n}\n\nexport type DropdownElementProps = DropdownProps\n\n/**\n * An action menu — a button that, when activated, reveals a list of actions or\n * navigation links. Composed of a `<DropdownTrigger>` wrapping a Tapestry\n * dropdown-trigger button (`DropdownButton`, `DropdownIconButton`, or\n * `PageHeaderActionsDropdownButton`) and a `<DropdownMenu>` containing\n * `<DropdownAction>`, `<DropdownLink>`, `<DropdownSection>`, and\n * `<DropdownSeparator>` items.\n *\n * Built on React Aria's `MenuTrigger` primitive; popover positioning and menu\n * identity live on `<DropdownMenu>`.\n *\n * @component\n * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/menu/ | W3C APG Menu Pattern}\n * @see {@link https://github.com/planningcenter/tapestry/tree/main/packages/tapestry-migration-cli | Migration CLI: Available}\n */\nexport function Dropdown({ children, onClose, onOpen }: DropdownElementProps) {\n const handleOpenChange = (isOpen: boolean) => {\n if (isOpen) onOpen?.()\n else onClose?.()\n }\n\n return <MenuTrigger onOpenChange={handleOpenChange}>{children}</MenuTrigger>\n}\n\nexport interface DropdownMenuProps {\n /** Arbitrary `data-*` attributes are forwarded to the menu element. */\n [key: `data-${string}`]: boolean | number | string | undefined\n /**\n * `<DropdownAction>` / `<DropdownLink>` / `<DropdownSection>` /\n * `<DropdownSeparator>` elements.\n */\n children: ReactNode\n /** Override for the underlying `<Menu>` element id. */\n id?: string\n /**\n * Popover position relative to the trigger. Uses React Aria's\n * space-separated format (e.g., `\"bottom start\"`, `\"top end\"`,\n * `\"left top\"`). Defaults to `\"bottom start\"`.\n */\n placement?: DropdownPlacement\n}\n\nexport type DropdownMenuElementProps = DropdownMenuProps\n\nfunction useMenuTriggerRef() {\n const popoverContext = useContext(PopoverContext)\n return popoverContext && \"triggerRef\" in popoverContext\n ? popoverContext.triggerRef\n : undefined\n}\n\nfunction isTouchOnTrigger({\n event,\n menuTriggerRef,\n pointerType,\n}: {\n event: PointerEvent\n menuTriggerRef: RefObject<Element | null> | undefined\n pointerType: string | null\n}) {\n const isTouch = pointerType === \"touch\"\n const isOnMenuTrigger =\n event.target instanceof Node &&\n Boolean(menuTriggerRef?.current?.contains(event.target))\n return isTouch && isOnMenuTrigger\n}\n\n/**\n * The popover surface for a `<Dropdown>`. Wraps React Aria's `<Popover>` and\n * `<Menu>` and contains the menu items.\n *\n * @component\n */\nexport function DropdownMenu({\n children,\n id,\n placement = \"bottom start\",\n ...dataAttributes\n}: DropdownMenuElementProps) {\n const popoverRef = useRef<HTMLElement>(null)\n const state = useContext(RootMenuTriggerStateContext)\n const menuTriggerRef = useMenuTriggerRef()\n const lastPointerType = useRef<string | null>(null)\n // Release focus containment once a press starts outside the menu, so focus\n // can land on whatever was pressed instead of being pulled back into the menu.\n const [isPointerDownOutside, setIsPointerDownOutside] = useState(false)\n\n useEffect(() => {\n if (!state?.isOpen) setIsPointerDownOutside(false)\n }, [state?.isOpen])\n\n useInteractOutside({\n isDisabled: !state?.isOpen,\n onInteractOutside: (event) => {\n const triggerWillToggleClosed = isTouchOnTrigger({\n event,\n menuTriggerRef,\n pointerType: lastPointerType.current,\n })\n if (triggerWillToggleClosed) return\n\n state?.close()\n },\n onInteractOutsideStart: (event) => {\n lastPointerType.current = event.pointerType\n setIsPointerDownOutside(true)\n },\n ref: popoverRef,\n })\n usePreventScroll({ isDisabled: !state?.isOpen })\n\n return (\n <Popover\n className=\"tds-dropdown-popover\"\n isNonModal\n placement={placement}\n ref={popoverRef}\n shouldCloseOnInteractOutside={() => false}\n >\n <FocusScope contain={!isPointerDownOutside}>\n <Menu {...dataAttributes} id={id}>\n {children}\n </Menu>\n </FocusScope>\n </Popover>\n )\n}\n\nexport interface DropdownTriggerProps {\n /**\n * A single Tapestry dropdown-trigger button element (`DropdownButton`,\n * `DropdownIconButton`, or `PageHeaderActionsDropdownButton`).\n */\n children: ReactElement\n /**\n * Whether the trigger is disabled. This is the single source of truth for the\n * trigger's disabled state — a `disabled` set directly on the child button\n * does not win.\n */\n disabled?: boolean\n}\n\n/**\n * Wraps a single Tapestry dropdown-trigger button and bridges it to React\n * Aria's `MenuTrigger` via `<Pressable>`.\n * Uses context to pass `disabled` to the trigger button.\n *\n * @component\n */\ntype PressableChild = ComponentProps<typeof Pressable>[\"children\"]\n\nexport function DropdownTrigger({ children, disabled }: DropdownTriggerProps) {\n return (\n <DropdownTriggerContext.Provider value={{ disabled }}>\n <Pressable isDisabled={disabled}>{children as PressableChild}</Pressable>\n </DropdownTriggerContext.Provider>\n )\n}\n\nexport interface DropdownItemBaseProps {\n /** Applies destructive styling. */\n destructive?: boolean\n /** Applies staff-only visual treatment. */\n staffOnly?: boolean\n}\n\nexport interface DropdownActionProps extends DropdownItemBaseProps {\n /**\n * Disables the item. Renamed to React Aria's `isDisabled` inside the\n * wrapper. Disabled items are skipped by keyboard traversal and won't fire\n * `onAction`.\n */\n disabled?: boolean\n /**\n * Stable identifier — required by React Aria's collection model for keying\n * and focus tracking.\n */\n id: Key\n /**\n * Callback fired when the item is activated.\n *\n * React Aria closes the menu and returns focus to the trigger after this\n * runs, which can override a focus change made here — e.g. focusing a\n * nearby input. If `onAction` needs to move focus elsewhere, wrap that\n * part in `queueMicrotask` to defer it until after React Aria's\n * focus-restore has finished: `queueMicrotask(() => inputRef.current?.focus())`.\n */\n onAction: () => void\n /** Whether activating the item closes the menu. Defaults to `true`. */\n shouldCloseOnSelect?: boolean\n}\n\ntype AriaActionPropsToOmit =\n | \"href\"\n | \"isDisabled\"\n | \"rel\"\n | \"routerOptions\"\n | \"target\"\n | \"value\"\ntype AriaActionPropsToInclude = \"textValue\"\n\nexport type DropdownActionElementProps<T extends object = object> =\n CombineAriaPropsWithCustomProps<\n MenuItemProps<T>,\n DropdownActionProps,\n AriaActionPropsToOmit,\n AriaActionPropsToInclude\n >\n\n/**\n * A `<Dropdown>` item that fires a callback when activated. Renders an RA\n * `<MenuItem>` (`role=\"menuitem\"`). Children are passed through and can use\n * the slot convention (`slot=\"label\" | \"prefix\" | \"suffix\" | \"description\"`)\n * for structured content.\n *\n * @component\n */\nexport function DropdownAction<T extends object>({\n className,\n destructive,\n disabled,\n staffOnly,\n ...restProps\n}: DropdownActionElementProps<T>) {\n return (\n <MenuItem\n {...restProps}\n className={classNames(\n \"tds-dropdown-item\",\n {\n \"tds-dropdown-item--destructive\": destructive,\n \"tds-dropdown-item--staff-only\": staffOnly,\n },\n className\n )}\n isDisabled={disabled}\n />\n )\n}\n\nexport interface DropdownLinkBaseProps extends DropdownItemBaseProps {\n /** If `true`, sets `target=\"_blank\"` and `rel=\"noreferrer noopener\"`. */\n external?: boolean\n /**\n * Stable identifier — required by React Aria's collection model for keying\n * and focus tracking.\n */\n id: Key\n}\n\nexport interface DropdownLinkAsChildProps extends DropdownLinkBaseProps {\n /**\n * Merge menu item behavior onto a single child element (e.g. a router\n * `Link`) instead of rendering an `<a>`. When true, `href` must not be set.\n * **Not supported in Rails.**\n */\n asChild: true\n href?: never\n}\n\nexport interface DropdownLinkHrefProps extends DropdownLinkBaseProps {\n asChild?: false\n /** Destination URL. */\n href: string\n}\n\nexport type DropdownLinkProps = DropdownLinkAsChildProps | DropdownLinkHrefProps\n\ntype AriaLinkPropsToOmit =\n | \"isDisabled\"\n | \"onAction\"\n | \"rel\"\n | \"render\"\n | \"target\"\n | \"value\"\ntype AriaLinkPropsToInclude = \"routerOptions\" | \"textValue\"\n\nexport type DropdownLinkElementProps<T extends object = object> =\n CombineAriaPropsWithCustomProps<\n MenuItemProps<T>,\n DropdownLinkProps,\n AriaLinkPropsToOmit,\n AriaLinkPropsToInclude\n >\n\n/** Strips RAC-injected `undefined` values (e.g. `href`) that would otherwise clobber a child's own prop of the same name via `Slot`. */\nfunction omitUndefinedValues<T extends object>(props: T): Partial<T> {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined)\n ) as Partial<T>\n}\n\n/**\n * A `<Dropdown>` item that navigates to a URL. Renders an RA `<MenuItem>` as\n * an anchor (`<a role=\"menuitem\" href=\"…\">`). Pass `external` to open in a\n * new tab with `rel=\"noreferrer noopener\"`.\n *\n * `disabled` is intentionally not accepted — HTML has no native disabled state\n * for anchors, and a \"disabled link\" has no accessible analog. If a link\n * shouldn't be activatable, omit it.\n *\n * @component\n */\nexport function DropdownLink<T extends object>({\n asChild = false,\n children,\n className,\n destructive,\n external,\n staffOnly,\n ...restProps\n}: DropdownLinkElementProps<T>) {\n const externalProps = external\n ? { rel: \"noreferrer noopener\", target: \"_blank\" as const }\n : null\n return (\n <MenuItem\n {...restProps}\n {...externalProps}\n className={classNames(\n \"tds-dropdown-item\",\n {\n \"tds-dropdown-item--destructive\": destructive,\n \"tds-dropdown-item--staff-only\": staffOnly,\n },\n className\n )}\n render={\n asChild\n ? (props) => (\n <Slot {...omitUndefinedValues(props)}>\n {children as ReactElement}\n </Slot>\n )\n : undefined\n }\n >\n {asChild ? undefined : children}\n </MenuItem>\n )\n}\n\nexport interface DropdownSectionProps {\n /** The items rendered within the section. */\n children: ReactNode\n /**\n * Heading rendered above the section's items. Required — RA renders the\n * section as `role=\"group\"` and the heading provides the group's\n * accessible name via `aria-labelledby`.\n */\n title: string\n}\n\nexport type DropdownSectionElementProps<T extends object = object> =\n CombineAriaPropsWithCustomProps<\n MenuSectionProps<T>,\n DropdownSectionProps,\n \"value\",\n never\n >\n\n/**\n * A grouped section within a `<Dropdown>`. Renders an RA `<MenuSection>`\n * (`role=\"group\"`) with an optional `<Header>` heading when `title` is set.\n *\n * @component\n */\nexport function DropdownSection<T extends object>({\n children,\n className,\n title,\n ...restProps\n}: DropdownSectionElementProps<T>) {\n return (\n <MenuSection\n {...restProps}\n className={classNames(\"tds-dropdown-section\", className)}\n >\n <Header className=\"tds-dropdown-section-label\">{title}</Header>\n {children}\n </MenuSection>\n )\n}\n\nexport type DropdownSeparatorElementProps = Record<string, never>\n\n/**\n * A divider between items in a `<Dropdown>`. Renders an RA `<Separator>`\n * (`role=\"separator\"`).\n *\n * @component\n */\nexport function DropdownSeparator() {\n return <Separator className=\"tds-dropdown-separator\" />\n}\n"],"names":[],"mappings":";;;;;;;;AAoDA;;;;;;;;;;;;;;AAcG;AACG,SAAU,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAwB,EAAA;AAC1E,IAAA,MAAM,gBAAgB,GAAG,CAAC,MAAe,KAAI;AAC3C,QAAA,IAAI,MAAM;YAAE,MAAM,IAAI;;YACjB,OAAO,IAAI;AAClB,IAAA,CAAC;IAED,OAAO,KAAA,CAAA,aAAA,CAAC,WAAW,EAAA,EAAC,YAAY,EAAE,gBAAgB,EAAA,EAAG,QAAQ,CAAe;AAC9E;AAsBA,SAAS,iBAAiB,GAAA;AACxB,IAAA,MAAM,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;AACjD,IAAA,OAAO,cAAc,IAAI,YAAY,IAAI;UACrC,cAAc,CAAC;UACf,SAAS;AACf;AAEA,SAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,cAAc,EACd,WAAW,GAKZ,EAAA;AACC,IAAA,MAAM,OAAO,GAAG,WAAW,KAAK,OAAO;AACvC,IAAA,MAAM,eAAe,GACnB,KAAK,CAAC,MAAM,YAAY,IAAI;AAC5B,QAAA,OAAO,CAAC,cAAc,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1D,OAAO,OAAO,IAAI,eAAe;AACnC;AAEA;;;;;AAKG;AACG,SAAU,YAAY,CAAC,EAC3B,QAAQ,EACR,EAAE,EACF,SAAS,GAAG,cAAc,EAC1B,GAAG,cAAc,EACQ,EAAA;AACzB,IAAA,MAAM,UAAU,GAAG,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AACR,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,EAAA,GACH,SAAS,EAAA,GACT,aAAa,EACjB,SAAS,EAAE,UAAU,CACnB,mBAAmB,EACnB;AACE,YAAA,gCAAgC,EAAE,WAAW;AAC7C,YAAA,+BAA+B,EAAE,SAAS;AAC3C,SAAA,EACD,SAAS,CACV,EACD,MAAM,EACJ;AACE,cAAE,CAAC,KAAK,MACJ,KAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAA,GAAK,mBAAmB,CAAC,KAAK,CAAC,EAAA,EACjC,QAAwB,CACpB;AAEX,cAAE,SAAS,EAAA,EAGd,OAAO,GAAG,SAAS,GAAG,QAAQ,CACtB;AAEf;AAqBA;;;;;AAKG;AACG,SAAU,eAAe,CAAmB,EAChD,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,SAAS,EACmB,EAAA;AAC/B,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,WAAW,EAAA,EAAA,GACN,SAAS,EACb,SAAS,EAAE,UAAU,CAAC,sBAAsB,EAAE,SAAS,CAAC,EAAA;AAExD,QAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,SAAS,EAAC,4BAA4B,EAAA,EAAE,KAAK,CAAU;QAC9D,QAAQ,CACG;AAElB;AAIA;;;;;AAKG;SACa,iBAAiB,GAAA;AAC/B,IAAA,OAAO,oBAAC,SAAS,EAAA,EAAC,SAAS,EAAC,wBAAwB,GAAG;AACzD;;;;"}
1
+ {"version":3,"file":"Dropdown.js","sources":["../../../src/components/dropdown/Dropdown.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport { Slot } from \"@radix-ui/react-slot\"\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport classNames from \"classnames\"\nimport React, {\n type ComponentProps,\n type ReactElement,\n type ReactNode,\n type RefObject,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport { FocusScope, useInteractOutside, usePreventScroll } from \"react-aria\"\nimport type {\n Key,\n MenuItemProps,\n MenuSectionProps,\n PopoverProps,\n} from \"react-aria-components\"\nimport {\n Header,\n Menu,\n MenuItem,\n MenuSection,\n MenuTrigger,\n Popover,\n Pressable,\n RootMenuTriggerStateContext,\n Separator,\n} from \"react-aria-components/Menu\"\nimport { PopoverContext } from \"react-aria-components/Popover\"\n\nimport { DropdownTriggerContext } from \"./DropdownTriggerContext\"\n\nexport type DropdownPlacement = NonNullable<PopoverProps[\"placement\"]>\n\nexport interface DropdownProps {\n /**\n * A `<DropdownTrigger>` followed by a `<DropdownMenu>` containing the items.\n */\n children: ReactNode\n /** Fires when the menu closes. */\n onClose?: () => void\n /** Fires when the menu opens. Useful for analytics or lazy data prep. */\n onOpen?: () => void\n}\n\nexport type DropdownElementProps = DropdownProps\n\n/**\n * An action menu — a button that, when activated, reveals a list of actions or\n * navigation links. Composed of a `<DropdownTrigger>` wrapping a Tapestry\n * dropdown-trigger button (`DropdownButton`, `DropdownIconButton`, or\n * `PageHeaderActionsDropdownButton`) and a `<DropdownMenu>` containing\n * `<DropdownAction>`, `<DropdownLink>`, `<DropdownSection>`, and\n * `<DropdownSeparator>` items.\n *\n * Built on React Aria's `MenuTrigger` primitive; popover positioning and menu\n * identity live on `<DropdownMenu>`.\n *\n * @component\n * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/menu/ | W3C APG Menu Pattern}\n * @see {@link https://github.com/planningcenter/tapestry/tree/main/packages/tapestry-migration-cli | Migration CLI: Available}\n */\nexport function Dropdown({ children, onClose, onOpen }: DropdownElementProps) {\n const handleOpenChange = (isOpen: boolean) => {\n if (isOpen) onOpen?.()\n else onClose?.()\n }\n\n return <MenuTrigger onOpenChange={handleOpenChange}>{children}</MenuTrigger>\n}\n\nexport interface DropdownMenuProps {\n /** Arbitrary `data-*` attributes are forwarded to the menu element. */\n [key: `data-${string}`]: boolean | number | string | undefined\n /**\n * `<DropdownAction>` / `<DropdownLink>` / `<DropdownSection>` /\n * `<DropdownSeparator>` elements.\n */\n children: ReactNode\n /** Override for the underlying `<Menu>` element id. */\n id?: string\n /**\n * Popover position relative to the trigger. Uses React Aria's\n * space-separated format (e.g., `\"bottom start\"`, `\"top end\"`,\n * `\"left top\"`). Defaults to `\"bottom start\"`.\n */\n placement?: DropdownPlacement\n}\n\nexport type DropdownMenuElementProps = DropdownMenuProps\n\nfunction useMenuTriggerRef() {\n const popoverContext = useContext(PopoverContext)\n return popoverContext && \"triggerRef\" in popoverContext\n ? popoverContext.triggerRef\n : undefined\n}\n\nfunction isTouchOnTrigger({\n event,\n menuTriggerRef,\n pointerType,\n}: {\n event: PointerEvent\n menuTriggerRef: RefObject<Element | null> | undefined\n pointerType: string | null\n}) {\n const isTouch = pointerType === \"touch\"\n const isOnMenuTrigger =\n event.target instanceof Node &&\n Boolean(menuTriggerRef?.current?.contains(event.target))\n return isTouch && isOnMenuTrigger\n}\n\n/**\n * The popover surface for a `<Dropdown>`. Wraps React Aria's `<Popover>` and\n * `<Menu>` and contains the menu items.\n *\n * @component\n */\nexport function DropdownMenu({\n children,\n id,\n placement = \"bottom start\",\n ...dataAttributes\n}: DropdownMenuElementProps) {\n const popoverRef = useRef<HTMLElement>(null)\n const state = useContext(RootMenuTriggerStateContext)\n const menuTriggerRef = useMenuTriggerRef()\n const lastPointerType = useRef<string | null>(null)\n // Release focus containment once a press starts outside the menu, so focus\n // can land on whatever was pressed instead of being pulled back into the menu.\n const [isPointerDownOutside, setIsPointerDownOutside] = useState(false)\n\n useEffect(() => {\n if (!state?.isOpen) setIsPointerDownOutside(false)\n }, [state?.isOpen])\n\n useInteractOutside({\n isDisabled: !state?.isOpen,\n onInteractOutside: (event) => {\n const triggerWillToggleClosed = isTouchOnTrigger({\n event,\n menuTriggerRef,\n pointerType: lastPointerType.current,\n })\n if (triggerWillToggleClosed) return\n\n state?.close()\n },\n onInteractOutsideStart: (event) => {\n lastPointerType.current = event.pointerType\n setIsPointerDownOutside(true)\n },\n ref: popoverRef,\n })\n usePreventScroll({ isDisabled: !state?.isOpen })\n\n return (\n <Popover\n className=\"tds-dropdown-popover\"\n isNonModal\n placement={placement}\n ref={popoverRef}\n shouldCloseOnInteractOutside={() => false}\n >\n <FocusScope contain={!isPointerDownOutside}>\n <Menu {...dataAttributes} id={id}>\n {children}\n </Menu>\n </FocusScope>\n </Popover>\n )\n}\n\nexport interface DropdownTriggerProps {\n /**\n * A single Tapestry dropdown-trigger button element (`DropdownButton`,\n * `DropdownIconButton`, or `PageHeaderActionsDropdownButton`).\n */\n children: ReactElement\n /**\n * Whether the trigger is disabled. This is the single source of truth for the\n * trigger's disabled state — a `disabled` set directly on the child button\n * does not win.\n */\n disabled?: boolean\n}\n\n/**\n * Wraps a single Tapestry dropdown-trigger button and bridges it to React\n * Aria's `MenuTrigger` via `<Pressable>`.\n * Uses context to pass `disabled` to the trigger button.\n *\n * @component\n */\ntype PressableChild = ComponentProps<typeof Pressable>[\"children\"]\n\nexport function DropdownTrigger({ children, disabled }: DropdownTriggerProps) {\n return (\n <DropdownTriggerContext.Provider value={{ disabled }}>\n <Pressable isDisabled={disabled}>{children as PressableChild}</Pressable>\n </DropdownTriggerContext.Provider>\n )\n}\n\nexport interface DropdownItemBaseProps {\n /** Applies destructive styling. */\n destructive?: boolean\n /** Applies staff-only visual treatment. */\n staffOnly?: boolean\n}\n\nexport interface DropdownActionProps extends DropdownItemBaseProps {\n /**\n * Disables the item. Renamed to React Aria's `isDisabled` inside the\n * wrapper. Disabled items are skipped by keyboard traversal and won't fire\n * `onAction`.\n */\n disabled?: boolean\n /**\n * Stable identifier — required by React Aria's collection model for keying\n * and focus tracking.\n */\n id: Key\n /**\n * Callback fired when the item is activated.\n *\n * React Aria closes the menu and returns focus to the trigger after this\n * runs, which can override a focus change made here — e.g. focusing a\n * nearby input. If `onAction` needs to move focus elsewhere, wrap that\n * part in `queueMicrotask` to defer it until after React Aria's\n * focus-restore has finished: `queueMicrotask(() => inputRef.current?.focus())`.\n */\n onAction: () => void\n /** Whether activating the item closes the menu. Defaults to `true`. */\n shouldCloseOnSelect?: boolean\n}\n\ntype AriaActionPropsToOmit =\n | \"href\"\n | \"isDisabled\"\n | \"rel\"\n | \"routerOptions\"\n | \"target\"\n | \"value\"\ntype AriaActionPropsToInclude = \"textValue\"\n\nexport type DropdownActionElementProps<T extends object = object> =\n CombineAriaPropsWithCustomProps<\n MenuItemProps<T>,\n DropdownActionProps,\n AriaActionPropsToOmit,\n AriaActionPropsToInclude\n >\n\n/**\n * A `<Dropdown>` item that fires a callback when activated. Renders an RA\n * `<MenuItem>` (`role=\"menuitem\"`). Children are passed through and can use\n * the slot convention (`slot=\"label\" | \"prefix\" | \"suffix\" | \"description\"`)\n * for structured content.\n *\n * @component\n */\nexport function DropdownAction<T extends object>({\n className,\n destructive,\n disabled,\n staffOnly,\n ...restProps\n}: DropdownActionElementProps<T>) {\n return (\n <MenuItem\n {...restProps}\n className={classNames(\n \"tds-dropdown-item\",\n {\n \"tds-dropdown-item--destructive\": destructive,\n \"tds-dropdown-item--staff-only\": staffOnly,\n },\n className\n )}\n isDisabled={disabled}\n />\n )\n}\n\nexport interface DropdownLinkBaseProps extends DropdownItemBaseProps {\n /** If `true`, sets `target=\"_blank\"` and `rel=\"noreferrer noopener\"`. */\n external?: boolean\n /**\n * Stable identifier — required by React Aria's collection model for keying\n * and focus tracking.\n */\n id: Key\n}\n\nexport interface DropdownLinkAsChildProps extends DropdownLinkBaseProps {\n /**\n * Merge menu item behavior onto a single child element (e.g. a router\n * `Link`) instead of rendering an `<a>`. When true, `href` must not be set.\n * **Not supported in Rails.**\n */\n asChild: true\n href?: never\n}\n\nexport interface DropdownLinkHrefProps extends DropdownLinkBaseProps {\n asChild?: false\n /** Destination URL. */\n href: string\n}\n\nexport type DropdownLinkProps = DropdownLinkAsChildProps | DropdownLinkHrefProps\n\ntype AriaLinkPropsToOmit =\n | \"isDisabled\"\n | \"onAction\"\n | \"rel\"\n | \"render\"\n | \"target\"\n | \"value\"\ntype AriaLinkPropsToInclude = \"routerOptions\" | \"textValue\"\n\nexport type DropdownLinkElementProps<T extends object = object> =\n CombineAriaPropsWithCustomProps<\n MenuItemProps<T>,\n DropdownLinkProps,\n AriaLinkPropsToOmit,\n AriaLinkPropsToInclude\n >\n\n/** Strips RAC-injected `undefined` values (e.g. `href`) that would otherwise clobber a child's own prop of the same name via `Slot`. */\nfunction omitUndefinedValues<T extends object>(props: T): Partial<T> {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined)\n ) as Partial<T>\n}\n\n/**\n * A `<Dropdown>` item that navigates to a URL. Renders an RA `<MenuItem>` as\n * an anchor (`<a role=\"menuitem\" href=\"…\">`). Pass `external` to open in a\n * new tab with `rel=\"noreferrer noopener\"`.\n *\n * `disabled` is intentionally not accepted — HTML has no native disabled state\n * for anchors, and a \"disabled link\" has no accessible analog. If a link\n * shouldn't be activatable, omit it.\n *\n * @component\n */\nexport function DropdownLink<T extends object>({\n asChild = false,\n children,\n className,\n destructive,\n external,\n staffOnly,\n ...restProps\n}: DropdownLinkElementProps<T>) {\n const externalProps = external\n ? { rel: \"noreferrer noopener\", target: \"_blank\" as const }\n : null\n return (\n <MenuItem\n {...restProps}\n {...externalProps}\n className={classNames(\n \"tds-dropdown-item\",\n {\n \"tds-dropdown-item--destructive\": destructive,\n \"tds-dropdown-item--staff-only\": staffOnly,\n },\n className\n )}\n render={\n asChild\n ? (props) => (\n <Slot {...omitUndefinedValues(props)}>\n {children as ReactElement}\n </Slot>\n )\n : undefined\n }\n >\n {asChild ? undefined : children}\n </MenuItem>\n )\n}\n\nexport interface DropdownSectionProps {\n /** The items rendered within the section. */\n children: ReactNode\n /**\n * Heading rendered above the section's items. Required — RA renders the\n * section as `role=\"group\"` and the heading provides the group's\n * accessible name via `aria-labelledby`.\n */\n title: string\n}\n\nexport type DropdownSectionElementProps<T extends object = object> =\n CombineAriaPropsWithCustomProps<\n MenuSectionProps<T>,\n DropdownSectionProps,\n \"value\",\n never\n >\n\n/**\n * A grouped section within a `<Dropdown>`. Renders an RA `<MenuSection>`\n * (`role=\"group\"`) with an optional `<Header>` heading when `title` is set.\n *\n * @component\n */\nexport function DropdownSection<T extends object>({\n children,\n className,\n title,\n ...restProps\n}: DropdownSectionElementProps<T>) {\n return (\n <MenuSection\n {...restProps}\n className={classNames(\"tds-dropdown-section\", className)}\n >\n <Header className=\"tds-dropdown-section-label\">{title}</Header>\n {children}\n </MenuSection>\n )\n}\n\nexport type DropdownSeparatorElementProps = Record<string, never>\n\n/**\n * A divider between items in a `<Dropdown>`. Renders an RA `<Separator>`\n * (`role=\"separator\"`).\n *\n * @component\n */\nexport function DropdownSeparator() {\n return <Separator className=\"tds-dropdown-separator\" />\n}\n"],"names":["React"],"mappings":";;;;;;;;AAoDA;;;;;;;;;;;;;;AAcG;AACG,SAAU,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAwB,EAAA;AAC1E,IAAA,MAAM,gBAAgB,GAAG,CAAC,MAAe,KAAI;AAC3C,QAAA,IAAI,MAAM;YAAE,MAAM,IAAI;;YACjB,OAAO,IAAI;AAClB,IAAA,CAAC;IAED,OAAOA,cAAA,CAAA,aAAA,CAAC,WAAW,EAAA,EAAC,YAAY,EAAE,gBAAgB,EAAA,EAAG,QAAQ,CAAe;AAC9E;AAsBA,SAAS,iBAAiB,GAAA;AACxB,IAAA,MAAM,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;AACjD,IAAA,OAAO,cAAc,IAAI,YAAY,IAAI;UACrC,cAAc,CAAC;UACf,SAAS;AACf;AAEA,SAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,cAAc,EACd,WAAW,GAKZ,EAAA;AACC,IAAA,MAAM,OAAO,GAAG,WAAW,KAAK,OAAO;AACvC,IAAA,MAAM,eAAe,GACnB,KAAK,CAAC,MAAM,YAAY,IAAI;AAC5B,QAAA,OAAO,CAAC,cAAc,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;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,GAAG,KAAK,EACf,QAAQ,EACR,SAAS,EACT,WAAW,EACX,QAAQ,EACR,SAAS,EACT,GAAG,SAAS,EACgB,EAAA;IAC5B,MAAM,aAAa,GAAG;UAClB,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,EAAE,QAAiB;UACvD,IAAI;AACR,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,EAAA,GACH,SAAS,EAAA,GACT,aAAa,EACjB,SAAS,EAAE,UAAU,CACnB,mBAAmB,EACnB;AACE,YAAA,gCAAgC,EAAE,WAAW;AAC7C,YAAA,+BAA+B,EAAE,SAAS;AAC3C,SAAA,EACD,SAAS,CACV,EACD,MAAM,EACJ;AACE,cAAE,CAAC,KAAK,MACJA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAA,GAAK,mBAAmB,CAAC,KAAK,CAAC,EAAA,EACjC,QAAwB,CACpB;AAEX,cAAE,SAAS,EAAA,EAGd,OAAO,GAAG,SAAS,GAAG,QAAQ,CACtB;AAEf;AAqBA;;;;;AAKG;AACG,SAAU,eAAe,CAAmB,EAChD,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,SAAS,EACmB,EAAA;AAC/B,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,WAAW,EAAA,EAAA,GACN,SAAS,EACb,SAAS,EAAE,UAAU,CAAC,sBAAsB,EAAE,SAAS,CAAC,EAAA;AAExD,QAAAA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,SAAS,EAAC,4BAA4B,EAAA,EAAE,KAAK,CAAU;QAC9D,QAAQ,CACG;AAElB;AAIA;;;;;AAKG;SACa,iBAAiB,GAAA;AAC/B,IAAA,OAAOA,6BAAC,SAAS,EAAA,EAAC,SAAS,EAAC,wBAAwB,GAAG;AACzD;;;;"}
@@ -1,6 +1,6 @@
1
1
  import Icon from '../../utilities/Icon.js';
2
2
  import classNames from 'classnames';
3
- import React from 'react';
3
+ import React__default from 'react';
4
4
 
5
5
  /**
6
6
  * A layout primitive that wraps a single form control with a label,
@@ -19,11 +19,11 @@ import React from 'react';
19
19
  */
20
20
  function Field({ "aria-labelledby": ariaLabelledBy, children, className, description, expand, hideLabel, id, label, }) {
21
21
  const descriptionId = `${id}-description`;
22
- return (React.createElement("div", { className: classNames("tds-field", className), "data-flex-expand": expand || undefined },
23
- label && !ariaLabelledBy && (React.createElement("label", { className: classNames("tds-field-label", hideLabel && "tds-field-label--hidden"), htmlFor: id }, label)),
22
+ return (React__default.createElement("div", { className: classNames("tds-field", className), "data-flex-expand": expand || undefined },
23
+ label && !ariaLabelledBy && (React__default.createElement("label", { className: classNames("tds-field-label", hideLabel && "tds-field-label--hidden"), htmlFor: id }, label)),
24
24
  children,
25
- description && (React.createElement("p", { className: "tds-field-description", id: descriptionId },
26
- React.createElement(Icon, { "aria-hidden": true, className: "tds-field-description-invalid-icon", symbol: "general#exclamation-triangle" }),
25
+ description && (React__default.createElement("p", { className: "tds-field-description", id: descriptionId },
26
+ React__default.createElement(Icon, { "aria-hidden": true, className: "tds-field-description-invalid-icon", symbol: "general#exclamation-triangle" }),
27
27
  description))));
28
28
  }
29
29
 
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../../src/components/field/Field.tsx"],"sourcesContent":["import Icon from \"@utilities/Icon\"\nimport classNames from \"classnames\"\nimport React, { ReactNode } from \"react\"\n\ninterface FieldBaseProps {\n children: ReactNode\n className?: string\n description?: ReactNode\n /** If true, sets `data-flex-expand` on the wrapper so it grows/shrinks to fill a `Flex` row. */\n expand?: boolean\n id: string\n}\n\ninterface FieldLabeledProps extends FieldBaseProps {\n \"aria-labelledby\"?: never\n hideLabel?: boolean\n label: ReactNode\n}\n\ninterface FieldExternallyLabeledProps extends FieldBaseProps {\n \"aria-labelledby\": string\n hideLabel?: never\n label?: never\n}\n\nexport type FieldProps = FieldExternallyLabeledProps | FieldLabeledProps\n\n/**\n * A layout primitive that wraps a single form control with a label,\n * optional description, and state-driven styling (required, invalid, disabled).\n *\n * **Wiring contract** — Field renders children completely untouched. The caller\n * is responsible for:\n * - Setting `id` on the control to match the `id` prop passed to Field.\n * - Setting `aria-describedby=\"{id}-description\"` on the control when\n * `description` is provided.\n * - Setting `aria-labelledby` on the control when using `aria-labelledby` mode.\n * - Setting state attributes (`required`, `disabled`, `aria-invalid`) directly\n * on the control — Field's CSS detects them via `:has()`.\n *\n * @component\n */\nexport function Field({\n \"aria-labelledby\": ariaLabelledBy,\n children,\n className,\n description,\n expand,\n hideLabel,\n id,\n label,\n}: FieldProps) {\n const descriptionId = `${id}-description`\n\n return (\n <div\n className={classNames(\"tds-field\", className)}\n data-flex-expand={expand || undefined}\n >\n {label && !ariaLabelledBy && (\n <label\n className={classNames(\n \"tds-field-label\",\n hideLabel && \"tds-field-label--hidden\"\n )}\n htmlFor={id}\n >\n {label}\n </label>\n )}\n {children}\n {description && (\n <p className=\"tds-field-description\" id={descriptionId}>\n <Icon\n aria-hidden\n className=\"tds-field-description-invalid-icon\"\n symbol=\"general#exclamation-triangle\"\n />\n {description}\n </p>\n )}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;AA2BA;;;;;;;;;;;;;;AAcG;AACG,SAAU,KAAK,CAAC,EACpB,iBAAiB,EAAE,cAAc,EACjC,QAAQ,EACR,SAAS,EACT,WAAW,EACX,MAAM,EACN,SAAS,EACT,EAAE,EACF,KAAK,GACM,EAAA;AACX,IAAA,MAAM,aAAa,GAAG,CAAA,EAAG,EAAE,cAAc;AAEzC,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,UAAU,CAAC,WAAW,EAAE,SAAS,CAAC,EAAA,kBAAA,EAC3B,MAAM,IAAI,SAAS,EAAA;QAEpC,KAAK,IAAI,CAAC,cAAc,KACvB,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EACE,SAAS,EAAE,UAAU,CACnB,iBAAiB,EACjB,SAAS,IAAI,yBAAyB,CACvC,EACD,OAAO,EAAE,EAAE,EAAA,EAEV,KAAK,CACA,CACT;QACA,QAAQ;QACR,WAAW,KACV,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,uBAAuB,EAAC,EAAE,EAAE,aAAa,EAAA;YACpD,KAAA,CAAA,aAAA,CAAC,IAAI,yBAEH,SAAS,EAAC,oCAAoC,EAC9C,MAAM,EAAC,8BAA8B,EAAA,CACrC;AACD,YAAA,WAAW,CACV,CACL,CACG;AAEV;;;;"}
1
+ {"version":3,"file":"Field.js","sources":["../../../src/components/field/Field.tsx"],"sourcesContent":["import Icon from \"@utilities/Icon\"\nimport classNames from \"classnames\"\nimport React, { ReactNode } from \"react\"\n\ninterface FieldBaseProps {\n children: ReactNode\n className?: string\n description?: ReactNode\n /** If true, sets `data-flex-expand` on the wrapper so it grows/shrinks to fill a `Flex` row. */\n expand?: boolean\n id: string\n}\n\ninterface FieldLabeledProps extends FieldBaseProps {\n \"aria-labelledby\"?: never\n hideLabel?: boolean\n label: ReactNode\n}\n\ninterface FieldExternallyLabeledProps extends FieldBaseProps {\n \"aria-labelledby\": string\n hideLabel?: never\n label?: never\n}\n\nexport type FieldProps = FieldExternallyLabeledProps | FieldLabeledProps\n\n/**\n * A layout primitive that wraps a single form control with a label,\n * optional description, and state-driven styling (required, invalid, disabled).\n *\n * **Wiring contract** — Field renders children completely untouched. The caller\n * is responsible for:\n * - Setting `id` on the control to match the `id` prop passed to Field.\n * - Setting `aria-describedby=\"{id}-description\"` on the control when\n * `description` is provided.\n * - Setting `aria-labelledby` on the control when using `aria-labelledby` mode.\n * - Setting state attributes (`required`, `disabled`, `aria-invalid`) directly\n * on the control — Field's CSS detects them via `:has()`.\n *\n * @component\n */\nexport function Field({\n \"aria-labelledby\": ariaLabelledBy,\n children,\n className,\n description,\n expand,\n hideLabel,\n id,\n label,\n}: FieldProps) {\n const descriptionId = `${id}-description`\n\n return (\n <div\n className={classNames(\"tds-field\", className)}\n data-flex-expand={expand || undefined}\n >\n {label && !ariaLabelledBy && (\n <label\n className={classNames(\n \"tds-field-label\",\n hideLabel && \"tds-field-label--hidden\"\n )}\n htmlFor={id}\n >\n {label}\n </label>\n )}\n {children}\n {description && (\n <p className=\"tds-field-description\" id={descriptionId}>\n <Icon\n aria-hidden\n className=\"tds-field-description-invalid-icon\"\n symbol=\"general#exclamation-triangle\"\n />\n {description}\n </p>\n )}\n </div>\n )\n}\n"],"names":["React"],"mappings":";;;;AA2BA;;;;;;;;;;;;;;AAcG;AACG,SAAU,KAAK,CAAC,EACpB,iBAAiB,EAAE,cAAc,EACjC,QAAQ,EACR,SAAS,EACT,WAAW,EACX,MAAM,EACN,SAAS,EACT,EAAE,EACF,KAAK,GACM,EAAA;AACX,IAAA,MAAM,aAAa,GAAG,CAAA,EAAG,EAAE,cAAc;AAEzC,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,UAAU,CAAC,WAAW,EAAE,SAAS,CAAC,EAAA,kBAAA,EAC3B,MAAM,IAAI,SAAS,EAAA;QAEpC,KAAK,IAAI,CAAC,cAAc,KACvBA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EACE,SAAS,EAAE,UAAU,CACnB,iBAAiB,EACjB,SAAS,IAAI,yBAAyB,CACvC,EACD,OAAO,EAAE,EAAE,EAAA,EAEV,KAAK,CACA,CACT;QACA,QAAQ;QACR,WAAW,KACVA,cAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,uBAAuB,EAAC,EAAE,EAAE,aAAa,EAAA;YACpDA,cAAA,CAAA,aAAA,CAAC,IAAI,yBAEH,SAAS,EAAC,oCAAoC,EAC9C,MAAM,EAAC,8BAA8B,EAAA,CACrC;AACD,YAAA,WAAW,CACV,CACL,CACG;AAEV;;;;"}
@@ -1,7 +1,7 @@
1
- import React from 'react';
1
+ import React__default from 'react';
2
2
 
3
3
  function LoadingSpinner() {
4
- return React.createElement("div", { className: "tds-loading-spinner" });
4
+ return React__default.createElement("div", { className: "tds-loading-spinner" });
5
5
  }
6
6
 
7
7
  export { LoadingSpinner as default };
@@ -1 +1 @@
1
- {"version":3,"file":"LoadingSpinner.js","sources":["../../../src/components/internal/LoadingSpinner.tsx"],"sourcesContent":["import \"./LoadingSpinner.css\"\n\nimport React from \"react\"\n\nexport default function LoadingSpinner() {\n return <div className=\"tds-loading-spinner\" />\n}\n"],"names":[],"mappings":";;AAIc,SAAU,cAAc,GAAA;AACpC,IAAA,OAAO,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,qBAAqB,GAAG;AAChD;;;;"}
1
+ {"version":3,"file":"LoadingSpinner.js","sources":["../../../src/components/internal/LoadingSpinner.tsx"],"sourcesContent":["import \"./LoadingSpinner.css\"\n\nimport React from \"react\"\n\nexport default function LoadingSpinner() {\n return <div className=\"tds-loading-spinner\" />\n}\n"],"names":["React"],"mappings":";;AAIc,SAAU,cAAc,GAAA;AACpC,IAAA,OAAOA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,qBAAqB,GAAG;AAChD;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { tokens } from '@planningcenter/tapestry-tokens/tokens';
2
2
  import { useId } from '../../../utilities/useId.js';
3
3
  import classNames from 'classnames';
4
- import React, { useRef } from 'react';
4
+ import React__default, { useRef } from 'react';
5
5
  import { Overlay } from 'react-aria/Overlay';
6
6
  import { useOverlayPosition } from 'react-aria/useOverlayPosition';
7
7
  import { useTooltipTrigger, useTooltip } from 'react-aria/useTooltipTrigger';
@@ -46,10 +46,10 @@ function Tooltip({ children, content, placement = "bottom start", visualOnly = f
46
46
  "aria-describedby": visualOnly ? undefined : tooltipId,
47
47
  },
48
48
  };
49
- return (React.createElement(React.Fragment, null,
50
- React.createElement(TooltipTriggerContext.Provider, { value: contextValue }, children),
51
- React.createElement(Overlay, { disableFocusManagement: true },
52
- React.createElement("div", { ...ariaTooltipProps, ...overlayProps, ref: overlayRef, "aria-hidden": visualOnly || undefined, className: classNames("tds-tooltip", {
49
+ return (React__default.createElement(React__default.Fragment, null,
50
+ React__default.createElement(TooltipTriggerContext.Provider, { value: contextValue }, children),
51
+ React__default.createElement(Overlay, { disableFocusManagement: true },
52
+ React__default.createElement("div", { ...ariaTooltipProps, ...overlayProps, ref: overlayRef, "aria-hidden": visualOnly || undefined, className: classNames("tds-tooltip", {
53
53
  "tds-tooltip--open": state.isOpen,
54
54
  }), "data-placement": resolvedPlacement, style: {
55
55
  ...overlayProps.style,
@@ -57,9 +57,9 @@ function Tooltip({ children, content, placement = "bottom start", visualOnly = f
57
57
  "--tds-tooltip-arrow-size-raw": `${ARROW_SIZE}px`,
58
58
  } },
59
59
  content,
60
- React.createElement("div", { className: "tds-tooltip-arrow", ...arrowProps },
61
- React.createElement("svg", { "aria-hidden": true, className: "tds-tooltip-arrow-icon", role: "img", viewBox: `0 0 ${ARROW_SIZE} ${ARROW_DEPTH}` },
62
- React.createElement("polygon", { points: `${ARROW_SIZE / 2},0 0,${ARROW_DEPTH} ${ARROW_SIZE},${ARROW_DEPTH}` })))))));
60
+ React__default.createElement("div", { className: "tds-tooltip-arrow", ...arrowProps },
61
+ React__default.createElement("svg", { "aria-hidden": true, className: "tds-tooltip-arrow-icon", role: "img", viewBox: `0 0 ${ARROW_SIZE} ${ARROW_DEPTH}` },
62
+ React__default.createElement("polygon", { points: `${ARROW_SIZE / 2},0 0,${ARROW_DEPTH} ${ARROW_SIZE},${ARROW_DEPTH}` })))))));
63
63
  }
64
64
  Tooltip.displayName = "Tooltip";
65
65
 
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../../../src/components/internal/tooltip/Tooltip.tsx"],"sourcesContent":["import { tokens } from \"@planningcenter/tapestry-tokens/tokens\"\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, { type ReactElement, useRef } from \"react\"\nimport { Overlay } from \"react-aria/Overlay\"\nimport {\n type Placement,\n useOverlayPosition,\n} from \"react-aria/useOverlayPosition\"\nimport { useTooltip, useTooltipTrigger } from \"react-aria/useTooltipTrigger\"\nimport { useTooltipTriggerState } from \"react-stately/useTooltipTriggerState\"\n\nimport { TooltipTriggerContext } from \"./TooltipTriggerContext\"\n\n// Single source of truth for the arrow's dimensions -- index.css reads these\n// via --tds-tooltip-arrow-size/--tds-tooltip-arrow-depth instead of its own literals.\nconst ARROW_SIZE = 10\nconst ARROW_DEPTH = 5\nconst FOCUS_RING_REACH =\n parseFloat(tokens[\"--t-focus-ring-offset\"]) +\n parseFloat(tokens[\"--t-focus-ring-width\"])\n\n/** Where a tooltip renders relative to its trigger. */\nexport type TooltipPlacement = Placement\n\nexport interface TooltipProps {\n /**\n * A single `BaseButton`- or `BaseLink`-derived element (e.g. `IconButton`, `Button`, `IconLink`) to\n * act as the trigger. Must be exactly one trigger — nothing enforces this\n * at runtime, so a fragment with more than one child would silently hand\n * every child the same ref and trigger props.\n */\n children: ReactElement\n /**\n * The hint text. Best used with information beyond the trigger's accessible name\n * (e.g. its `aria-label` or visible label).\n */\n content: string\n /** Where the tooltip renders relative to the trigger. Default `'bottom start'`. */\n placement?: TooltipPlacement\n /**\n * Shows the tooltip on screen only. The tooltip is hidden from assistive\n * tech and not linked to the trigger, so the trigger must carry its own\n * name (e.g. `aria-label`).\n */\n visualOnly?: boolean\n}\n\n/**\n * Shows a short hover/focus hint next to a trigger. Built from React Aria's\n * tooltip hooks rather than `react-aria-components`'s `<Tooltip>`, because\n * that component unmounts its content entirely while closed, so a screen\n * reader's virtual cursor never gets access to the description unless real\n * DOM focus lands on the trigger. This keeps the tooltip content always\n * mounted and wires `aria-describedby` (unless `visualOnly`), toggling only\n * CSS visibility.\n */\nexport function Tooltip({\n children,\n content,\n placement = \"bottom start\",\n visualOnly = false,\n}: TooltipProps) {\n const triggerRef = useRef<HTMLElement>(null)\n const overlayRef = useRef<HTMLDivElement>(null)\n const tooltipId = `tds-tooltip-${useId()}`\n\n const state = useTooltipTriggerState()\n const { triggerProps } = useTooltipTrigger({}, state, triggerRef)\n const { tooltipProps: ariaTooltipProps } = useTooltip(\n { id: tooltipId },\n state\n )\n\n const {\n arrowProps,\n overlayProps,\n placement: resolvedPlacement,\n } = useOverlayPosition({\n arrowSize: ARROW_SIZE,\n isOpen: state.isOpen,\n offset: ARROW_DEPTH + FOCUS_RING_REACH,\n onClose: () => state.close(true),\n overlayRef,\n placement,\n targetRef: triggerRef,\n })\n\n const contextValue = {\n ref: triggerRef,\n triggerProps: {\n ...triggerProps,\n \"aria-describedby\": visualOnly ? undefined : tooltipId,\n },\n }\n\n return (\n <>\n <TooltipTriggerContext.Provider value={contextValue}>\n {children}\n </TooltipTriggerContext.Provider>\n <Overlay disableFocusManagement>\n <div\n {...ariaTooltipProps}\n {...overlayProps}\n ref={overlayRef}\n aria-hidden={visualOnly || undefined}\n className={classNames(\"tds-tooltip\", {\n \"tds-tooltip--open\": state.isOpen,\n })}\n data-placement={resolvedPlacement}\n style={\n {\n ...overlayProps.style,\n \"--tds-tooltip-arrow-depth-raw\": `${ARROW_DEPTH}px`,\n \"--tds-tooltip-arrow-size-raw\": `${ARROW_SIZE}px`,\n } as React.CSSProperties\n }\n >\n {content}\n <div className=\"tds-tooltip-arrow\" {...arrowProps}>\n <svg\n aria-hidden\n className=\"tds-tooltip-arrow-icon\"\n role=\"img\"\n viewBox={`0 0 ${ARROW_SIZE} ${ARROW_DEPTH}`}\n >\n <polygon\n points={`${ARROW_SIZE / 2},0 0,${ARROW_DEPTH} ${ARROW_SIZE},${ARROW_DEPTH}`}\n />\n </svg>\n </div>\n </div>\n </Overlay>\n </>\n )\n}\n\nTooltip.displayName = \"Tooltip\"\n"],"names":[],"mappings":";;;;;;;;;;AAcA;AACA;AACA,MAAM,UAAU,GAAG,EAAE;AACrB,MAAM,WAAW,GAAG,CAAC;AACrB,MAAM,gBAAgB,GACpB,UAAU,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAC3C,IAAA,UAAU,CAAC,MAAM,CAAC,sB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ChD,QAAQ,CACsB;QACjC,KAAA,CAAA,aAAA,CAAC,OAAO,IAAC,sBAAsB,EAAA,IAAA,EAAA;AAC7B,YAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GACM,gBAAgB,EAAA,GAChB,YAAY,EAChB,GAAG,EAAE,UAAU,EAAA,aAAA,EACF,UAAU,IAAI,SAAS,EACpC,SAAS,EAAE,UAAU,CAAC,aAAa,EAAE;oBACnC,mBAAmB,EAAE,KAAK,CAAC,MAAM;AAClC,iBAAA,CAAC,EAAA,gBAAA,EACc,iBAAiB,EACjC,KAAK,EACH;oBACE,GAAG,YAAY,CAAC,KAAK;oBACrB,+BAA+B,EAAE,CAAA,EAAG,WAAW,CAAA,EAAA,CAAI;oBACnD,8BAA8B,EAAE,CAAA,EAAG,UAAU,CAAA,EAAA,CAAI;AAC3B,iBAAA,EAAA;gBAGzB,OAAO;AACR,gBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,mBAAmB,EAAA,GAAK,UAAU,EAAA;AAC/C,oBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EAAA,IAAA,EAEE,SAAS,EAAC,wBAAwB,EAClC,IAAI,EAAC,KAAK,EACV,OAAO,EAAE,CAAA,IAAA,EAAO,UAAU,CAAA,CAAA,EAAI,WAAW,CAAA,CAAE,EAAA;wBAE3C,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EACE,MAAM,EAAE,CAAA,EAAG,UAAU,GAAG,CAAC,CAAA,KAAA,EAAQ,WAAW,CAAA,CAAA,EAAI,UAAU,IAAI,WAAW,CAAA,CAAE,GAC3E,CACE,CACF,CACF,CACE,CACT;AAEP;AAEA,OAAO,CAAC,WAAW,GAAG,SAAS;;;;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../../../src/components/internal/tooltip/Tooltip.tsx"],"sourcesContent":["import { tokens } from \"@planningcenter/tapestry-tokens/tokens\"\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, { type ReactElement, useRef } from \"react\"\nimport { Overlay } from \"react-aria/Overlay\"\nimport {\n type Placement,\n useOverlayPosition,\n} from \"react-aria/useOverlayPosition\"\nimport { useTooltip, useTooltipTrigger } from \"react-aria/useTooltipTrigger\"\nimport { useTooltipTriggerState } from \"react-stately/useTooltipTriggerState\"\n\nimport { TooltipTriggerContext } from \"./TooltipTriggerContext\"\n\n// Single source of truth for the arrow's dimensions -- index.css reads these\n// via --tds-tooltip-arrow-size/--tds-tooltip-arrow-depth instead of its own literals.\nconst ARROW_SIZE = 10\nconst ARROW_DEPTH = 5\nconst FOCUS_RING_REACH =\n parseFloat(tokens[\"--t-focus-ring-offset\"]) +\n parseFloat(tokens[\"--t-focus-ring-width\"])\n\n/** Where a tooltip renders relative to its trigger. */\nexport type TooltipPlacement = Placement\n\nexport interface TooltipProps {\n /**\n * A single `BaseButton`- or `BaseLink`-derived element (e.g. `IconButton`, `Button`, `IconLink`) to\n * act as the trigger. Must be exactly one trigger — nothing enforces this\n * at runtime, so a fragment with more than one child would silently hand\n * every child the same ref and trigger props.\n */\n children: ReactElement\n /**\n * The hint text. Best used with information beyond the trigger's accessible name\n * (e.g. its `aria-label` or visible label).\n */\n content: string\n /** Where the tooltip renders relative to the trigger. Default `'bottom start'`. */\n placement?: TooltipPlacement\n /**\n * Shows the tooltip on screen only. The tooltip is hidden from assistive\n * tech and not linked to the trigger, so the trigger must carry its own\n * name (e.g. `aria-label`).\n */\n visualOnly?: boolean\n}\n\n/**\n * Shows a short hover/focus hint next to a trigger. Built from React Aria's\n * tooltip hooks rather than `react-aria-components`'s `<Tooltip>`, because\n * that component unmounts its content entirely while closed, so a screen\n * reader's virtual cursor never gets access to the description unless real\n * DOM focus lands on the trigger. This keeps the tooltip content always\n * mounted and wires `aria-describedby` (unless `visualOnly`), toggling only\n * CSS visibility.\n */\nexport function Tooltip({\n children,\n content,\n placement = \"bottom start\",\n visualOnly = false,\n}: TooltipProps) {\n const triggerRef = useRef<HTMLElement>(null)\n const overlayRef = useRef<HTMLDivElement>(null)\n const tooltipId = `tds-tooltip-${useId()}`\n\n const state = useTooltipTriggerState()\n const { triggerProps } = useTooltipTrigger({}, state, triggerRef)\n const { tooltipProps: ariaTooltipProps } = useTooltip(\n { id: tooltipId },\n state\n )\n\n const {\n arrowProps,\n overlayProps,\n placement: resolvedPlacement,\n } = useOverlayPosition({\n arrowSize: ARROW_SIZE,\n isOpen: state.isOpen,\n offset: ARROW_DEPTH + FOCUS_RING_REACH,\n onClose: () => state.close(true),\n overlayRef,\n placement,\n targetRef: triggerRef,\n })\n\n const contextValue = {\n ref: triggerRef,\n triggerProps: {\n ...triggerProps,\n \"aria-describedby\": visualOnly ? undefined : tooltipId,\n },\n }\n\n return (\n <>\n <TooltipTriggerContext.Provider value={contextValue}>\n {children}\n </TooltipTriggerContext.Provider>\n <Overlay disableFocusManagement>\n <div\n {...ariaTooltipProps}\n {...overlayProps}\n ref={overlayRef}\n aria-hidden={visualOnly || undefined}\n className={classNames(\"tds-tooltip\", {\n \"tds-tooltip--open\": state.isOpen,\n })}\n data-placement={resolvedPlacement}\n style={\n {\n ...overlayProps.style,\n \"--tds-tooltip-arrow-depth-raw\": `${ARROW_DEPTH}px`,\n \"--tds-tooltip-arrow-size-raw\": `${ARROW_SIZE}px`,\n } as React.CSSProperties\n }\n >\n {content}\n <div className=\"tds-tooltip-arrow\" {...arrowProps}>\n <svg\n aria-hidden\n className=\"tds-tooltip-arrow-icon\"\n role=\"img\"\n viewBox={`0 0 ${ARROW_SIZE} ${ARROW_DEPTH}`}\n >\n <polygon\n points={`${ARROW_SIZE / 2},0 0,${ARROW_DEPTH} ${ARROW_SIZE},${ARROW_DEPTH}`}\n />\n </svg>\n </div>\n </div>\n </Overlay>\n </>\n )\n}\n\nTooltip.displayName = \"Tooltip\"\n"],"names":["React"],"mappings":";;;;;;;;;;AAcA;AACA;AACA,MAAM,UAAU,GAAG,EAAE;AACrB,MAAM,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,SAAS;;;;"}
@@ -2,7 +2,7 @@ import { useTooltipTriggerProps } from '../internal/tooltip/useTooltipTriggerPro
2
2
  import { Slot, Slottable } from '@radix-ui/react-slot';
3
3
  import { COMPONENT_SIZE_CLASS_MAP, COMPONENT_KIND_CLASS_MAP, wrapStringWithSpan } from '../../utilities/buttonLinkShared.js';
4
4
  import classNames from 'classnames';
5
- import React, { forwardRef } from 'react';
5
+ import React__default, { forwardRef } from 'react';
6
6
 
7
7
  const BaseLink = forwardRef(({ asChild = false, "aria-describedby": ariaDescribedBy, children, className, external = false, fullWidth, href, kind, label, prefix, size, suffix, ...restProps }, ref) => {
8
8
  const { describedBy, mergedProps, mergedRef } = useTooltipTriggerProps(restProps, ref, ariaDescribedBy);
@@ -11,9 +11,9 @@ const BaseLink = forwardRef(({ asChild = false, "aria-describedby": ariaDescribe
11
11
  ? { rel: "noopener noreferrer", target: "_blank" }
12
12
  : {};
13
13
  const Comp = asChild ? Slot : "a";
14
- return (React.createElement(Comp, { ...(!asChild && { href }), className: combinedClassName, ref: mergedRef, ...mergedProps, "aria-describedby": describedBy, ...externalProps },
14
+ return (React__default.createElement(Comp, { ...(!asChild && { href }), className: combinedClassName, ref: mergedRef, ...mergedProps, "aria-describedby": describedBy, ...externalProps },
15
15
  wrapStringWithSpan(prefix),
16
- React.createElement(Slottable, null, label || children),
16
+ React__default.createElement(Slottable, null, label || children),
17
17
  wrapStringWithSpan(suffix)));
18
18
  });
19
19
  BaseLink.displayName = "BaseLink";
@@ -1 +1 @@
1
- {"version":3,"file":"BaseLink.js","sources":["../../../src/components/link/BaseLink.tsx"],"sourcesContent":["import \"../button/btn.css\"\n\nimport { useTooltipTriggerProps } from \"@components/internal/tooltip/useTooltipTriggerProps\"\nimport { Slot, Slottable } from \"@radix-ui/react-slot\"\nimport {\n BaseComponentProps,\n COMPONENT_KIND_CLASS_MAP,\n COMPONENT_SIZE_CLASS_MAP,\n ComponentKind,\n wrapStringWithSpan,\n} from \"@utilities/buttonLinkShared\"\nimport { Simplify } from \"@utilities/typeUtils\"\nimport classNames from \"classnames\"\nimport React, { AnchorHTMLAttributes, forwardRef } from \"react\"\n\ntype BaseLinkBaseProps = BaseComponentProps &\n Omit<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n keyof BaseComponentProps | \"children\" | \"href\"\n > & {\n children?: React.ReactNode\n external?: boolean\n kind?: ComponentKind\n label?: React.ReactNode\n }\n\nexport type BaseLinkElementProps =\n | Simplify<\n BaseLinkBaseProps & {\n /**\n * When true, merges the link's styling onto the child element instead\n * of rendering an `<a>`. Use to wrap a router link (e.g. react-router,\n * Next.js) or any link-like component. The `external` prop still\n * applies — it spreads `rel`/`target` onto the child element.\n */\n asChild: true\n href?: never\n }\n >\n | Simplify<BaseLinkBaseProps & { asChild?: false; href: string }>\n\nexport const BaseLink = forwardRef<HTMLAnchorElement, BaseLinkElementProps>(\n (\n {\n asChild = false,\n \"aria-describedby\": ariaDescribedBy,\n children,\n className,\n external = false,\n fullWidth,\n href,\n kind,\n label,\n prefix,\n size,\n suffix,\n ...restProps\n }: BaseLinkElementProps,\n ref\n ) => {\n const { describedBy, mergedProps, mergedRef } = useTooltipTriggerProps(\n restProps,\n ref,\n ariaDescribedBy\n )\n\n const combinedClassName = classNames(\n kind && \"tds-btn\",\n size && size !== \"md\" && kind && COMPONENT_SIZE_CLASS_MAP[size],\n kind && COMPONENT_KIND_CLASS_MAP[kind],\n fullWidth && \"tds-btn--full-width\",\n className,\n { \"tds-btn--prefix\": prefix, \"tds-btn--suffix\": suffix }\n )\n\n const externalProps = external\n ? { rel: \"noopener noreferrer\", target: \"_blank\" }\n : {}\n\n const Comp = asChild ? Slot : \"a\"\n\n return (\n <Comp\n {...(!asChild && { href })}\n className={combinedClassName}\n ref={mergedRef}\n {...mergedProps}\n aria-describedby={describedBy}\n {...externalProps}\n >\n {wrapStringWithSpan(prefix)}\n <Slottable>{label || children}</Slottable>\n {wrapStringWithSpan(suffix)}\n </Comp>\n )\n }\n)\n\nBase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AEX,CAAC;AAGH,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}
1
+ {"version":3,"file":"BaseLink.js","sources":["../../../src/components/link/BaseLink.tsx"],"sourcesContent":["import \"../button/btn.css\"\n\nimport { useTooltipTriggerProps } from \"@components/internal/tooltip/useTooltipTriggerProps\"\nimport { Slot, Slottable } from \"@radix-ui/react-slot\"\nimport {\n BaseComponentProps,\n COMPONENT_KIND_CLASS_MAP,\n COMPONENT_SIZE_CLASS_MAP,\n ComponentKind,\n wrapStringWithSpan,\n} from \"@utilities/buttonLinkShared\"\nimport { Simplify } from \"@utilities/typeUtils\"\nimport classNames from \"classnames\"\nimport React, { AnchorHTMLAttributes, forwardRef } from \"react\"\n\ntype BaseLinkBaseProps = BaseComponentProps &\n Omit<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n keyof BaseComponentProps | \"children\" | \"href\"\n > & {\n children?: React.ReactNode\n external?: boolean\n kind?: ComponentKind\n label?: React.ReactNode\n }\n\nexport type BaseLinkElementProps =\n | Simplify<\n BaseLinkBaseProps & {\n /**\n * When true, merges the link's styling onto the child element instead\n * of rendering an `<a>`. Use to wrap a router link (e.g. react-router,\n * Next.js) or any link-like component. The `external` prop still\n * applies — it spreads `rel`/`target` onto the child element.\n */\n asChild: true\n href?: never\n }\n >\n | Simplify<BaseLinkBaseProps & { asChild?: false; href: string }>\n\nexport const BaseLink = forwardRef<HTMLAnchorElement, BaseLinkElementProps>(\n (\n {\n asChild = false,\n \"aria-describedby\": ariaDescribedBy,\n children,\n className,\n external = false,\n fullWidth,\n href,\n kind,\n label,\n prefix,\n size,\n suffix,\n ...restProps\n }: BaseLinkElementProps,\n ref\n ) => {\n const { describedBy, mergedProps, mergedRef } = useTooltipTriggerProps(\n restProps,\n ref,\n ariaDescribedBy\n )\n\n const combinedClassName = classNames(\n kind && \"tds-btn\",\n size && size !== \"md\" && kind && COMPONENT_SIZE_CLASS_MAP[size],\n kind && COMPONENT_KIND_CLASS_MAP[kind],\n fullWidth && \"tds-btn--full-width\",\n className,\n { \"tds-btn--prefix\": prefix, \"tds-btn--suffix\": suffix }\n )\n\n const externalProps = external\n ? { rel: \"noopener noreferrer\", target: \"_blank\" }\n : {}\n\n const Comp = asChild ? Slot : \"a\"\n\n return (\n <Comp\n {...(!asChild && { href })}\n className={combinedClassName}\n ref={mergedRef}\n {...mergedProps}\n aria-describedby={describedBy}\n {...externalProps}\n >\n {wrapStringWithSpan(prefix)}\n <Slottable>{label || children}</Slottable>\n {wrapStringWithSpan(suffix)}\n </Comp>\n )\n }\n)\n\nBaseLink.displayName = \"BaseLink\"\n"],"names":["React"],"mappings":";;;;;;MAyCa,QAAQ,GAAG,UAAU,CAChC,CACE,EACE,OAAO,GAAG,KAAK,EACf,kBAAkB,EAAE,eAAe,EACnC,QAAQ,EACR,SAAS,EACT,QAAQ,GAAG,KAAK,EAChB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,MAAM,EACN,IAAI,EACJ,MAAM,EACN,GAAG,SAAS,EACS,EACvB,GAAG,KACD;AACF,IAAA,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,sBAAsB,CACpE,SAAS,EACT,GAAG,EACH,eAAe,CAChB;IAED,MAAM,iBAAiB,GAAG,UAAU,CAClC,IAAI,IAAI,SAAS,EACjB,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI,wBAAwB,CAAC,IAAI,CAAC,EAC/D,IAAI,IAAI,wBAAwB,CAAC,IAAI,CAAC,EACtC,SAAS,IAAI,qBAAqB,EAClC,SAAS,EACT,EAAE,iBAAiB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,CACzD;IAED,MAAM,aAAa,GAAG;UAClB,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,EAAE,QAAQ;UAC9C,EAAE;IAEN,MAAM,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,GAAG;IAEjC,QACEA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAA,IACE,CAAC,OAAO,IAAI,EAAE,IAAI,EAAE,CAAC,EAC1B,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,SAAS,EAAA,GACV,WAAW,EAAA,kBAAA,EACG,WAAW,EAAA,GACzB,aAAa,EAAA;QAEhB,kBAAkB,CAAC,MAAM,CAAC;AAC3B,QAAAA,cAAA,CAAA,aAAA,CAAC,SAAS,EAAA,IAAA,EAAE,KAAK,IAAI,QAAQ,CAAa;AACzC,QAAA,kBAAkB,CAAC,MAAM,CAAC,CACtB;AAEX,CAAC;AAGH,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { Tooltip } from '../internal/tooltip/Tooltip.js';
2
2
  import classNames from 'classnames';
3
- import React, { forwardRef } from 'react';
3
+ import React__default, { forwardRef } from 'react';
4
4
  import { BaseLink } from './BaseLink.js';
5
5
 
6
6
  /**
@@ -15,10 +15,10 @@ const IconLink = forwardRef(({ className, href, icon, tooltip, tooltipPlacement
15
15
  const iconOnlyClassName = classNames("tds-btn--icononly", className);
16
16
  if (tooltip?.trim()) {
17
17
  const { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...linkProps } = restProps;
18
- return (React.createElement(Tooltip, { content: tooltip, placement: tooltipPlacement, visualOnly: true },
19
- React.createElement(BaseLink, { href: href, label: icon, className: iconOnlyClassName, ref: ref, ...linkProps, "aria-label": ariaLabel || tooltip })));
18
+ return (React__default.createElement(Tooltip, { content: tooltip, placement: tooltipPlacement, visualOnly: true },
19
+ React__default.createElement(BaseLink, { href: href, label: icon, className: iconOnlyClassName, ref: ref, ...linkProps, "aria-label": ariaLabel || tooltip })));
20
20
  }
21
- return (React.createElement(BaseLink, { href: href, label: icon, className: iconOnlyClassName, ref: ref, ...restProps }));
21
+ return (React__default.createElement(BaseLink, { href: href, label: icon, className: iconOnlyClassName, ref: ref, ...restProps }));
22
22
  });
23
23
  IconLink.displayName = "IconLink";
24
24
 
@@ -1 +1 @@
1
- {"version":3,"file":"IconLink.js","sources":["../../../src/components/link/IconLink.tsx"],"sourcesContent":["import \"../button/btn.css\"\n\nimport { Tooltip, type TooltipPlacement } from \"@components/internal/tooltip\"\nimport classNames from \"classnames\"\nimport React, { forwardRef } from \"react\"\n\nimport { BaseLink, BaseLinkElementProps } from \"./BaseLink\"\n\ntype IconLinkSharedProps = Omit<\n Extract<BaseLinkElementProps, { asChild?: false }>,\n \"label\" | \"children\"\n> & {\n /** The icon element to display. */\n icon: React.ReactNode\n}\n\ntype IconLinkTooltipProps = {\n /** Accessible label. Required for icon-only links to provide context about the link'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 `\"Download\"`, aria-label `\"Download, report.pdf\"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. */\n tooltip: string\n}\n\ntype IconLinkAriaLabelProps = {\n /** Accessible label. Required for icon-only links to provide context about the link'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 `\"Download\"`, aria-label `\"Download, report.pdf\"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. */\n tooltip?: string\n}\n\n/**\n * An icon-only link needs a name: `aria-label`, `tooltip`, or both.\n * `IconLinkAriaLabelProps` is declared last so that a missing name\n * reports \"aria-label is missing\", not \"tooltip is missing\".\n */\ntype IconLinkNameProps = IconLinkAriaLabelProps | IconLinkTooltipProps\n\nexport type IconLinkProps = IconLinkSharedProps &\n IconLinkNameProps & {\n /** Where the tooltip renders relative to the link. Default `\"bottom\"`. Has no effect without `tooltip`. */\n tooltipPlacement?: TooltipPlacement\n }\n\n/**\n * An icon-only link component that renders as an HTML `<a>` element with\n * button-like styling. Requires an `icon`, and an `aria-label` or `tooltip`\n * for accessibility.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/links-icon-link--docs | Storybook Documentation}\n */\nexport const IconLink = forwardRef<HTMLAnchorElement, IconLinkProps>(\n (\n {\n className,\n href,\n icon,\n tooltip,\n tooltipPlacement = \"bottom\",\n ...restProps\n }: IconLinkProps,\n ref\n ) => {\n const iconOnlyClassName = classNames(\"tds-btn--icononly\", className)\n\n if (tooltip?.trim()) {\n const {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...linkProps\n } = restProps\n\n return (\n <Tooltip content={tooltip} placement={tooltipPlacement} visualOnly>\n <BaseLink\n href={href}\n label={icon}\n className={iconOnlyClassName}\n ref={ref}\n {...linkProps}\n aria-label={ariaLabel || tooltip}\n />\n </Tooltip>\n )\n }\n\n return (\n <BaseLink\n href={href}\n label={icon}\n className={iconOnlyClassName}\n ref={ref}\n {...restProps}\n />\n )\n }\n)\n\nIconLink.displayName = \"IconLink\"\n"],"names":[],"mappings":";;;;;AA2CA;;;;;;;AAOG;AACI,MAAM,QAAQ,GAAG,UAAU,CAChC,CACE,EACE,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,gBAAgB,GAAG,QAAQ,EAC3B,GAAG,SAAS,EACE,EAChB,GAAG,KACD;IACF,MAAM,iBAAiB,GAAG,UAAU,CAAC,mBAAmB,EAAE,SAAS,CAAC;AAEpE,IAAA,IAAI,OAAO,EAAE,IAAI,EAAE,EAAE;AACnB,QAAA,MAAM,EACJ,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,GAAG,SAAS,EACb,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,QAAQ,EAAA,EACP,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,IAAI,EACX,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,GAAG,EAAA,GACJ,SAAS,EAAA,YAAA,EACD,SAAS,IAAI,OAAO,EAAA,CAChC,CACM;IAEd;IAEA,QACE,oBAAC,QAAQ,EAAA,EACP,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,IAAI,EACX,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,GAAG,EAAA,GACJ,SAAS,EAAA,CACb;AAEN,CAAC;AAGH,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}
1
+ {"version":3,"file":"IconLink.js","sources":["../../../src/components/link/IconLink.tsx"],"sourcesContent":["import \"../button/btn.css\"\n\nimport { Tooltip, type TooltipPlacement } from \"@components/internal/tooltip\"\nimport classNames from \"classnames\"\nimport React, { forwardRef } from \"react\"\n\nimport { BaseLink, BaseLinkElementProps } from \"./BaseLink\"\n\ntype IconLinkSharedProps = Omit<\n Extract<BaseLinkElementProps, { asChild?: false }>,\n \"label\" | \"children\"\n> & {\n /** The icon element to display. */\n icon: React.ReactNode\n}\n\ntype IconLinkTooltipProps = {\n /** Accessible label. Required for icon-only links to provide context about the link'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 `\"Download\"`, aria-label `\"Download, report.pdf\"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. */\n tooltip: string\n}\n\ntype IconLinkAriaLabelProps = {\n /** Accessible label. Required for icon-only links to provide context about the link'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 `\"Download\"`, aria-label `\"Download, report.pdf\"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. */\n tooltip?: string\n}\n\n/**\n * An icon-only link needs a name: `aria-label`, `tooltip`, or both.\n * `IconLinkAriaLabelProps` is declared last so that a missing name\n * reports \"aria-label is missing\", not \"tooltip is missing\".\n */\ntype IconLinkNameProps = IconLinkAriaLabelProps | IconLinkTooltipProps\n\nexport type IconLinkProps = IconLinkSharedProps &\n IconLinkNameProps & {\n /** Where the tooltip renders relative to the link. Default `\"bottom\"`. Has no effect without `tooltip`. */\n tooltipPlacement?: TooltipPlacement\n }\n\n/**\n * An icon-only link component that renders as an HTML `<a>` element with\n * button-like styling. Requires an `icon`, and an `aria-label` or `tooltip`\n * for accessibility.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/links-icon-link--docs | Storybook Documentation}\n */\nexport const IconLink = forwardRef<HTMLAnchorElement, IconLinkProps>(\n (\n {\n className,\n href,\n icon,\n tooltip,\n tooltipPlacement = \"bottom\",\n ...restProps\n }: IconLinkProps,\n ref\n ) => {\n const iconOnlyClassName = classNames(\"tds-btn--icononly\", className)\n\n if (tooltip?.trim()) {\n const {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...linkProps\n } = restProps\n\n return (\n <Tooltip content={tooltip} placement={tooltipPlacement} visualOnly>\n <BaseLink\n href={href}\n label={icon}\n className={iconOnlyClassName}\n ref={ref}\n {...linkProps}\n aria-label={ariaLabel || tooltip}\n />\n </Tooltip>\n )\n }\n\n return (\n <BaseLink\n href={href}\n label={icon}\n className={iconOnlyClassName}\n ref={ref}\n {...restProps}\n />\n )\n }\n)\n\nIconLink.displayName = \"IconLink\"\n"],"names":["React"],"mappings":";;;;;AA2CA;;;;;;;AAOG;AACI,MAAM,QAAQ,GAAG,UAAU,CAChC,CACE,EACE,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,gBAAgB,GAAG,QAAQ,EAC3B,GAAG,SAAS,EACE,EAChB,GAAG,KACD;IACF,MAAM,iBAAiB,GAAG,UAAU,CAAC,mBAAmB,EAAE,SAAS,CAAC;AAEpE,IAAA,IAAI,OAAO,EAAE,IAAI,EAAE,EAAE;AACnB,QAAA,MAAM,EACJ,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,GAAG,SAAS,EACb,GAAG,SAAS;AAEb,QAAA,QACEA,cAAA,CAAA,aAAA,CAAC,OAAO,EAAA,EAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAA,IAAA,EAAA;YAChEA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,EACP,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,IAAI,EACX,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,GAAG,EAAA,GACJ,SAAS,EAAA,YAAA,EACD,SAAS,IAAI,OAAO,EAAA,CAChC,CACM;IAEd;IAEA,QACEA,6BAAC,QAAQ,EAAA,EACP,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,IAAI,EACX,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,GAAG,EAAA,GACJ,SAAS,EAAA,CACb;AAEN,CAAC;AAGH,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}
@@ -1,4 +1,4 @@
1
- import React, { forwardRef } from 'react';
1
+ import React__default, { forwardRef } from 'react';
2
2
  import { BaseLink } from './BaseLink.js';
3
3
 
4
4
  /**
@@ -11,7 +11,7 @@ import { BaseLink } from './BaseLink.js';
11
11
  */
12
12
  const Link = forwardRef((props, ref) => {
13
13
  // eslint-disable-next-line tapestry/valid-href
14
- return React.createElement(BaseLink, { ref: ref, ...props });
14
+ return React__default.createElement(BaseLink, { ref: ref, ...props });
15
15
  });
16
16
  Link.displayName = "Link";
17
17