@planningcenter/tapestry 4.14.0 → 4.14.1-qa-1664.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.
- package/dist/components/DataTable/ActiveFilters.d.ts +6 -1
- package/dist/components/DataTable/ActiveFilters.d.ts.map +1 -1
- package/dist/components/DataTable/ActiveFilters.js +18 -10
- package/dist/components/DataTable/ActiveFilters.js.map +1 -1
- package/dist/components/DataTable/CollectionEditorsStatic.js +2 -2
- package/dist/components/DataTable/CollectionEditorsStatic.js.map +1 -1
- package/dist/components/DataTable/DataTable.d.ts +8 -5
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.js +26 -14
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/DataTable/DataTableColumn.d.ts +12 -3
- package/dist/components/DataTable/DataTableColumn.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableColumnTypes.js +4 -4
- package/dist/components/DataTable/DataTableColumnTypes.js.map +1 -1
- package/dist/components/DataTable/ResultsCount.d.ts +2 -2
- package/dist/components/DataTable/ResultsCount.d.ts.map +1 -1
- package/dist/components/DataTable/ResultsCount.js +8 -7
- package/dist/components/DataTable/ResultsCount.js.map +1 -1
- package/dist/components/DataTable/SelectAllBanner.d.ts.map +1 -1
- package/dist/components/DataTable/SelectAllBanner.js +5 -3
- package/dist/components/DataTable/SelectAllBanner.js.map +1 -1
- package/dist/components/DataTable/TableActions.d.ts.map +1 -1
- package/dist/components/DataTable/TableActions.js +5 -3
- package/dist/components/DataTable/TableActions.js.map +1 -1
- package/dist/components/DataTable/dateFilter.js +28 -10
- package/dist/components/DataTable/dateFilter.js.map +1 -1
- package/dist/components/DataTable/dayFilter.js +4 -3
- package/dist/components/DataTable/dayFilter.js.map +1 -1
- package/dist/components/DataTable/numberFilter.js +2 -2
- package/dist/components/DataTable/numberFilter.js.map +1 -1
- package/dist/components/DataTable/useIsNarrowViewport.d.ts.map +1 -1
- package/dist/components/DataTable/useIsNarrowViewport.js +3 -1
- package/dist/components/DataTable/useIsNarrowViewport.js.map +1 -1
- package/dist/components/DataTable/useResultsAnnouncement.d.ts.map +1 -1
- package/dist/components/DataTable/useResultsAnnouncement.js +3 -1
- package/dist/components/DataTable/useResultsAnnouncement.js.map +1 -1
- package/dist/components/DataTable/useSavedViewsClient.d.ts +9 -2
- package/dist/components/DataTable/useSavedViewsClient.d.ts.map +1 -1
- package/dist/components/DataTable/useSavedViewsClient.js +9 -2
- package/dist/components/DataTable/useSavedViewsClient.js.map +1 -1
- package/dist/components/DataTable/useShelfExpanded.d.ts +4 -3
- package/dist/components/DataTable/useShelfExpanded.d.ts.map +1 -1
- package/dist/components/DataTable/useShelfExpanded.js +21 -5
- package/dist/components/DataTable/useShelfExpanded.js.map +1 -1
- package/dist/components/DataTable/views.js +1 -4
- package/dist/components/DataTable/views.js.map +1 -1
- package/dist/components/button/ActionsDropdownIconButton.js +3 -3
- package/dist/components/button/ActionsDropdownIconButton.js.map +1 -1
- package/dist/components/button/BaseButton.js +4 -4
- package/dist/components/button/BaseButton.js.map +1 -1
- package/dist/components/button/Button.js +2 -2
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/button/DropdownButton.js +3 -3
- package/dist/components/button/DropdownButton.js.map +1 -1
- package/dist/components/button/DropdownIconButton.js +2 -2
- package/dist/components/button/DropdownIconButton.js.map +1 -1
- package/dist/components/button/IconButton.js +5 -5
- package/dist/components/button/IconButton.js.map +1 -1
- package/dist/components/button/LoadingButton.js +2 -2
- package/dist/components/button/LoadingButton.js.map +1 -1
- package/dist/components/button/PageHeaderActionsDropdownButton.js +3 -3
- package/dist/components/button/PageHeaderActionsDropdownButton.js.map +1 -1
- package/dist/components/combo-box/ComboBox.d.ts.map +1 -1
- package/dist/components/combo-box/ComboBox.js +46 -31
- package/dist/components/combo-box/ComboBox.js.map +1 -1
- package/dist/components/currency-input/CurrencyInput.d.ts +1 -1
- package/dist/components/currency-input/CurrencyInput.d.ts.map +1 -1
- package/dist/components/currency-input/CurrencyInput.js +4 -1
- package/dist/components/currency-input/CurrencyInput.js.map +1 -1
- package/dist/components/date-picker/DatePicker.d.ts +1 -1
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +99 -96
- package/dist/components/date-picker/DatePicker.js.map +1 -1
- package/dist/components/dropdown/Dropdown.js +13 -13
- package/dist/components/dropdown/Dropdown.js.map +1 -1
- package/dist/components/field/Field.js +5 -5
- package/dist/components/field/Field.js.map +1 -1
- package/dist/components/internal/LoadingSpinner.js +2 -2
- package/dist/components/internal/LoadingSpinner.js.map +1 -1
- package/dist/components/internal/tooltip/Tooltip.js +8 -8
- package/dist/components/internal/tooltip/Tooltip.js.map +1 -1
- package/dist/components/link/BaseLink.js +3 -3
- package/dist/components/link/BaseLink.js.map +1 -1
- package/dist/components/link/IconLink.js +5 -5
- package/dist/components/link/IconLink.js.map +1 -1
- package/dist/components/link/Link.js +2 -2
- package/dist/components/link/Link.js.map +1 -1
- package/dist/components/number-stepper/NumberStepper.js +11 -11
- package/dist/components/number-stepper/NumberStepper.js.map +1 -1
- package/dist/components/page-header/PageHeader.js +10 -10
- package/dist/components/page-header/PageHeader.js.map +1 -1
- package/dist/components/search-input/SearchInput.js +6 -6
- package/dist/components/search-input/SearchInput.js.map +1 -1
- package/dist/components/segmented-control/IconSegment.js +1 -1
- package/dist/components/segmented-control/IconSegment.js.map +1 -1
- package/dist/components/select/Select.js +6 -6
- package/dist/components/select/Select.js.map +1 -1
- package/dist/components/select/SelectNative.js +6 -6
- package/dist/components/select/SelectNative.js.map +1 -1
- package/dist/components/select/SelectOptions.js +9 -9
- package/dist/components/select/SelectOptions.js.map +1 -1
- package/dist/components/select/SelectPopover.js +14 -14
- package/dist/components/select/SelectPopover.js.map +1 -1
- package/dist/components/sidenav/Sidenav.js +6 -6
- package/dist/components/sidenav/Sidenav.js.map +1 -1
- package/dist/components/sidenav/SidenavItem.js +2 -2
- package/dist/components/sidenav/SidenavItem.js.map +1 -1
- package/dist/components/sidenav/SidenavSection.js +7 -7
- package/dist/components/sidenav/SidenavSection.js.map +1 -1
- package/dist/components/sidenav/private/SidenavResponsiveHeader.js +6 -6
- package/dist/components/sidenav/private/SidenavResponsiveHeader.js.map +1 -1
- package/dist/components/sidenav/private/withSlotChildrenAsActions.js +7 -7
- package/dist/components/sidenav/private/withSlotChildrenAsActions.js.map +1 -1
- package/dist/components/time-field/TimeField.d.ts.map +1 -1
- package/dist/components/time-field/TimeField.js +13 -10
- package/dist/components/time-field/TimeField.js.map +1 -1
- package/dist/packages/tapestry-render/dist/buildComponent-DzY2PDMT.js +4 -4
- package/dist/packages/tapestry-render/dist/buildComponent-DzY2PDMT.js.map +1 -1
- package/dist/reactRender.css +1463 -1460
- package/dist/reactRender.css.map +1 -1
- package/dist/reactRenderLegacy.css +1463 -1460
- package/dist/reactRenderLegacy.css.map +1 -1
- package/dist/tapestryMount.css +1463 -1460
- package/dist/tapestryMount.css.map +1 -1
- package/dist/tapestryMountLegacy.css +1463 -1460
- package/dist/tapestryMountLegacy.css.map +1 -1
- package/dist/unstable.css +3 -0
- package/dist/unstable.css.map +1 -1
- package/dist/utilities/Icon.js +2 -2
- package/dist/utilities/Icon.js.map +1 -1
- package/dist/utilities/buttonLinkShared.js +2 -2
- package/dist/utilities/buttonLinkShared.js.map +1 -1
- package/dist/utilities/locale.d.ts +4 -4
- package/dist/utilities/locale.js +5 -5
- package/dist/utilities/locale.js.map +1 -1
- package/dist/utilities/useDateFieldLocale.js +2 -2
- package/dist/utilities/useDateFieldLocale.js.map +1 -1
- package/docs/components/DataTable.md +158 -0
- package/docs/llms.txt +3 -0
- package/package.json +8 -6
|
@@ -2,9 +2,10 @@ import { CalendarDate as $2aaf608024c21ca1$export$99faa760c7908e4f } from './../
|
|
|
2
2
|
import { today as $ad063034c8620db8$export$d0bdf45af03a6ea3, getLocalTimeZone as $ad063034c8620db8$export$aa8b41735afcabd2, isSameDay as $ad063034c8620db8$export$ea39ec197993aef0 } from './../../ext/@internationalized/date/dist/private/queries.js';
|
|
3
3
|
import { parseDate as $58246871e4652552$export$6b862160d295c8e } from './../../ext/@internationalized/date/dist/private/string.js';
|
|
4
4
|
import Icon from '../../utilities/Icon.js';
|
|
5
|
+
import { useTapestryLocale } from '../../utilities/locale.js';
|
|
5
6
|
import { useDateFieldLocale } from '../../utilities/useDateFieldLocale.js';
|
|
6
7
|
import classNames from 'classnames';
|
|
7
|
-
import
|
|
8
|
+
import React__default, { useState, useRef, useEffect, useMemo, useContext } from 'react';
|
|
8
9
|
import { I18nProvider } from 'react-aria/I18nProvider';
|
|
9
10
|
import { CalendarStateContext } from 'react-aria-components/Calendar';
|
|
10
11
|
import { DatePicker as DatePicker$1, Label, Group, DateInput, DateSegment, Button, Popover, Calendar, Text, CalendarGrid, CalendarGridHeader, CalendarHeaderCell, CalendarGridBody, CalendarCell } from 'react-aria-components/DatePicker';
|
|
@@ -14,10 +15,6 @@ import { ListBox, ListBoxItem } from 'react-aria-components/ListBox';
|
|
|
14
15
|
const _today = $ad063034c8620db8$export$d0bdf45af03a6ea3($ad063034c8620db8$export$aa8b41735afcabd2());
|
|
15
16
|
const MONTHS = Array.from({ length: 12 }, (_, i) => i);
|
|
16
17
|
const YEARS = Array.from({ length: 131 }, (_, i) => _today.year - 100 + i);
|
|
17
|
-
const shortMonthFormatter = new Intl.DateTimeFormat(undefined, {
|
|
18
|
-
month: "short",
|
|
19
|
-
});
|
|
20
|
-
const longMonthFormatter = new Intl.DateTimeFormat(undefined, { month: "long" });
|
|
21
18
|
function toCalendarDate(input) {
|
|
22
19
|
if (input === null)
|
|
23
20
|
return null;
|
|
@@ -29,7 +26,7 @@ function toCalendarDate(input) {
|
|
|
29
26
|
return $58246871e4652552$export$6b862160d295c8e(input);
|
|
30
27
|
}
|
|
31
28
|
function DatePickerOverlay({ children, variant, }) {
|
|
32
|
-
return (
|
|
29
|
+
return (React__default.createElement("div", { "aria-label": `Select ${variant}`, "aria-modal": "true", className: `tds-date-picker-overlay tds-date-picker-overlay--${variant}`, role: "dialog" }, children));
|
|
33
30
|
}
|
|
34
31
|
function DatePickerCalendarBody({ activeOverlay, setActiveOverlay, }) {
|
|
35
32
|
// Read and drive Calendar's focused date through its state context. This
|
|
@@ -39,6 +36,9 @@ function DatePickerCalendarBody({ activeOverlay, setActiveOverlay, }) {
|
|
|
39
36
|
const state = useContext(CalendarStateContext);
|
|
40
37
|
const focusedDate = state.focusedDate;
|
|
41
38
|
const today = $ad063034c8620db8$export$d0bdf45af03a6ea3($ad063034c8620db8$export$aa8b41735afcabd2());
|
|
39
|
+
const locale = useTapestryLocale();
|
|
40
|
+
const shortMonthFormatter = useMemo(() => new Intl.DateTimeFormat(locale, { month: "short" }), [locale]);
|
|
41
|
+
const longMonthFormatter = useMemo(() => new Intl.DateTimeFormat(locale, { month: "long" }), [locale]);
|
|
42
42
|
function handleOverlaySelectionChange(keys, onSelect) {
|
|
43
43
|
if (keys === "all")
|
|
44
44
|
return;
|
|
@@ -54,14 +54,14 @@ function DatePickerCalendarBody({ activeOverlay, setActiveOverlay, }) {
|
|
|
54
54
|
state.setFocusedDate(new $2aaf608024c21ca1$export$99faa760c7908e4f(year, focusedDate.month, 1));
|
|
55
55
|
setActiveOverlay(null);
|
|
56
56
|
}
|
|
57
|
-
return (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
activeOverlay ? (
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
58
|
+
React__default.createElement("header", { className: "tds-date-picker-calendar-header" },
|
|
59
|
+
React__default.createElement("div", { className: "tds-date-picker-calendar-heading" },
|
|
60
|
+
React__default.createElement(Button, { "aria-expanded": activeOverlay === "month", "aria-haspopup": "dialog", className: "tds-date-picker-calendar-overlay-trigger", onPress: () => setActiveOverlay(activeOverlay === "month" ? null : "month"), slot: null }, longMonthFormatter.format(new Date(2000, focusedDate.month - 1, 1))),
|
|
61
|
+
React__default.createElement(Button, { "aria-expanded": activeOverlay === "year", "aria-haspopup": "dialog", className: "tds-date-picker-calendar-overlay-trigger", onPress: () => setActiveOverlay(activeOverlay === "year" ? null : "year"), slot: null }, focusedDate.year)),
|
|
62
|
+
activeOverlay ? (React__default.createElement(Button, { "aria-label": `Close ${activeOverlay} picker`, className: "tds-date-picker-calendar-nav", onPress: () => setActiveOverlay(null), slot: null },
|
|
63
|
+
React__default.createElement(Icon, { "aria-hidden": true, symbol: "general#x" }))) : (React__default.createElement(React__default.Fragment, null,
|
|
64
|
+
React__default.createElement(Button, { "aria-label": "Go to today", className: "tds-date-picker-calendar-nav tds-date-picker-calendar-nav--lg", style: {
|
|
65
65
|
visibility: focusedDate.month === today.month &&
|
|
66
66
|
focusedDate.year === today.year
|
|
67
67
|
? "hidden"
|
|
@@ -70,30 +70,30 @@ function DatePickerCalendarBody({ activeOverlay, setActiveOverlay, }) {
|
|
|
70
70
|
state.setFocusedDate(today);
|
|
71
71
|
state.setFocused(true);
|
|
72
72
|
}, slot: null },
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
activeOverlay === "month" && (
|
|
82
|
-
|
|
73
|
+
React__default.createElement("svg", { "aria-hidden": true, xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 16 16", className: "symbol" },
|
|
74
|
+
React__default.createElement("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" }),
|
|
75
|
+
React__default.createElement("circle", { cx: "8", cy: "9.75", r: "2.25" }))),
|
|
76
|
+
React__default.createElement(Button, { "aria-label": "Previous month", className: "tds-date-picker-calendar-nav", slot: "previous" },
|
|
77
|
+
React__default.createElement(Icon, { "aria-hidden": true, symbol: "general#left-chevron" })),
|
|
78
|
+
React__default.createElement(Button, { "aria-label": "Next month", className: "tds-date-picker-calendar-nav", slot: "next" },
|
|
79
|
+
React__default.createElement(Icon, { "aria-hidden": true, symbol: "general#right-chevron" }))))),
|
|
80
|
+
React__default.createElement("div", { className: "tds-date-picker-calendar-body" },
|
|
81
|
+
activeOverlay === "month" && (React__default.createElement(DatePickerOverlay, { variant: "month" },
|
|
82
|
+
React__default.createElement(ListBox, { "aria-label": "Months",
|
|
83
83
|
// eslint-disable-next-line jsx-a11y/no-autofocus -- focusing the active item on dialog open is required per ARIA authoring practices
|
|
84
84
|
autoFocus: true, className: "tds-date-picker-overlay-list", disallowEmptySelection: true, escapeKeyBehavior: "none", layout: "grid", onSelectionChange: (keys) => handleOverlaySelectionChange(keys, handleMonthSelect), selectedKeys: [String(focusedDate.month - 1)], selectionMode: "single" }, MONTHS.map((i) => {
|
|
85
85
|
const date = new Date(2000, i, 1);
|
|
86
86
|
const shortMonth = shortMonthFormatter.format(date);
|
|
87
87
|
const longMonth = longMonthFormatter.format(date);
|
|
88
|
-
return (
|
|
88
|
+
return (React__default.createElement(ListBoxItem, { className: "tds-date-picker-overlay-cell", id: String(i), key: i, "aria-label": longMonth, textValue: longMonth }, shortMonth));
|
|
89
89
|
})))),
|
|
90
|
-
activeOverlay === "year" && (
|
|
91
|
-
|
|
90
|
+
activeOverlay === "year" && (React__default.createElement(DatePickerOverlay, { variant: "year" },
|
|
91
|
+
React__default.createElement(ListBox, { "aria-label": "Years",
|
|
92
92
|
// eslint-disable-next-line jsx-a11y/no-autofocus -- focusing the active item on dialog open is required per ARIA authoring practices
|
|
93
|
-
autoFocus: true, className: "tds-date-picker-overlay-list", disallowEmptySelection: true, escapeKeyBehavior: "none", layout: "grid", onSelectionChange: (keys) => handleOverlaySelectionChange(keys, handleYearSelect), selectedKeys: [String(focusedDate.year)], selectionMode: "single" }, YEARS.map((year) => (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
autoFocus: true, className: "tds-date-picker-overlay-list", disallowEmptySelection: true, escapeKeyBehavior: "none", layout: "grid", onSelectionChange: (keys) => handleOverlaySelectionChange(keys, handleYearSelect), selectedKeys: [String(focusedDate.year)], selectionMode: "single" }, YEARS.map((year) => (React__default.createElement(ListBoxItem, { className: "tds-date-picker-overlay-cell", id: String(year), key: year, textValue: String(year) }, year)))))),
|
|
94
|
+
React__default.createElement(CalendarGrid, { className: "tds-date-picker-calendar-grid" },
|
|
95
|
+
React__default.createElement(CalendarGridHeader, { className: "tds-date-picker-calendar-grid-header" }, (day) => (React__default.createElement(CalendarHeaderCell, { className: "tds-date-picker-calendar-header-cell" }, day))),
|
|
96
|
+
React__default.createElement(CalendarGridBody, { className: "tds-date-picker-calendar-grid-body" }, (date) => (React__default.createElement(CalendarCell, { className: "tds-date-picker-calendar-cell-button", date: date })))))));
|
|
97
97
|
}
|
|
98
98
|
function useValue({ defaultValue, onChange, value, }) {
|
|
99
99
|
const [uncontrolledValue, setUncontrolledValue] = useState(() => toCalendarDate(defaultValue) ?? null);
|
|
@@ -153,7 +153,7 @@ function isPartlyFilled(field) {
|
|
|
153
153
|
* @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-datepicker--docs | Storybook Documentation}
|
|
154
154
|
* @see {@link https://github.com/planningcenter/tapestry/tree/main/packages/tapestry-migration-cli | Migration CLI: Available}
|
|
155
155
|
*/
|
|
156
|
-
function DatePicker({ className, defaultValue, description, disabled, firstDayOfWeek, formatDateOnBlur = expandTwoDigitYearsViaPOSIX, hideLabel, invalid, isDateUnavailable, label, max, min, name, onBlur, onChange, onFocus, readOnly, required, size = "md", value, alwaysShowFourDigitYear = false, ...restProps }) {
|
|
156
|
+
function DatePicker({ className, defaultValue, description, disabled, firstDayOfWeek, formatDateOnBlur = expandTwoDigitYearsViaPOSIX, hideLabel, invalid, isDateUnavailable, label, max, min, name, onBlur, onChange, onFocus, onOpenChange, readOnly, required, size = "md", value, alwaysShowFourDigitYear = false, ...restProps }) {
|
|
157
157
|
const convertedMin = toCalendarDate(min) ?? undefined;
|
|
158
158
|
const convertedMax = toCalendarDate(max) ?? undefined;
|
|
159
159
|
const combinedClassName = classNames("tds-field tds-date-picker", {
|
|
@@ -186,73 +186,76 @@ function DatePicker({ className, defaultValue, description, disabled, firstDayOf
|
|
|
186
186
|
const [valueBeforeEdit, setValueBeforeEdit] = useState(computedValue);
|
|
187
187
|
const [openedPartlyFilled, setOpenedPartlyFilled] = useState(false);
|
|
188
188
|
const fieldRef = useRef(null);
|
|
189
|
+
const locale = useTapestryLocale();
|
|
189
190
|
const dateFieldLocale = useDateFieldLocale();
|
|
190
|
-
return (
|
|
191
|
-
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
return (React__default.createElement(I18nProvider, { locale: locale },
|
|
192
|
+
React__default.createElement(DatePicker$1, { ...restProps, "aria-label": hideLabel ? label : undefined, className: combinedClassName, isDateUnavailable: isDateUnavailable, isDisabled: disabled, isReadOnly: readOnly, isRequired: required, maxValue: convertedMax, minValue: convertedMin, onBlur: (event) => {
|
|
193
|
+
if (isPartlyFilled(fieldRef.current)) {
|
|
194
|
+
if (computedValue) {
|
|
195
|
+
setHeldValue(computedValue);
|
|
196
|
+
setComputedValue(null);
|
|
197
|
+
}
|
|
195
198
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
setComputedValue(heldValueRef.current);
|
|
201
|
-
}
|
|
202
|
-
else if (formatDateOnBlur && computedValue) {
|
|
203
|
-
const formattedValue = formatDateOnBlur(computedValue);
|
|
204
|
-
if (!$ad063034c8620db8$export$ea39ec197993aef0(formattedValue, computedValue)) {
|
|
205
|
-
setComputedValue(formattedValue);
|
|
199
|
+
else if (heldValueRef.current) {
|
|
200
|
+
// Refilled to the date react-aria still held, so it reported no change
|
|
201
|
+
setHeldValue(null);
|
|
202
|
+
setComputedValue(heldValueRef.current);
|
|
206
203
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
204
|
+
else if (formatDateOnBlur && computedValue) {
|
|
205
|
+
const formattedValue = formatDateOnBlur(computedValue);
|
|
206
|
+
if (!$ad063034c8620db8$export$ea39ec197993aef0(formattedValue, computedValue)) {
|
|
207
|
+
setComputedValue(formattedValue);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
onBlur?.(event);
|
|
211
|
+
}, onChange: (newValue) => {
|
|
212
|
+
heldValueRef.current = null;
|
|
213
|
+
setHeldValue(null);
|
|
214
|
+
if (newValue === null && computedValue === null)
|
|
215
|
+
return;
|
|
216
|
+
setComputedValue(newValue);
|
|
217
|
+
}, onFocus: (event) => {
|
|
218
|
+
if (!heldValue)
|
|
219
|
+
setValueBeforeEdit(computedValue);
|
|
220
|
+
onFocus?.(event);
|
|
221
|
+
}, onOpenChange: (isOpen) => {
|
|
222
|
+
if (isOpen)
|
|
223
|
+
setOpenedPartlyFilled(isPartlyFilled(fieldRef.current));
|
|
224
|
+
else
|
|
225
|
+
setActiveOverlay(null);
|
|
226
|
+
onOpenChange?.(isOpen);
|
|
227
|
+
}, validate: () => (heldValue && required ? "Enter a full date" : null), value: heldValue ?? computedValue },
|
|
228
|
+
!hideLabel && React__default.createElement(Label, { className: "tds-field-label" }, label),
|
|
229
|
+
React__default.createElement(Group, { "aria-invalid": invalid || undefined, className: "tds-field-control tds-date-picker-field", ref: fieldRef },
|
|
230
|
+
React__default.createElement(I18nProvider, { locale: dateFieldLocale },
|
|
231
|
+
React__default.createElement(DateInput, { className: "tds-date-picker-input" }, (segment) => (React__default.createElement(DateSegment, { "aria-invalid": invalid || undefined, className: segment.type === "literal"
|
|
232
|
+
? "tds-field-date-segment-separator"
|
|
233
|
+
: "tds-field-date-segment", segment: segment.type === "year" &&
|
|
234
|
+
!segment.isPlaceholder &&
|
|
235
|
+
segment.value != null &&
|
|
236
|
+
alwaysShowFourDigitYear
|
|
237
|
+
? {
|
|
238
|
+
...segment,
|
|
239
|
+
text: new Intl.NumberFormat(undefined, {
|
|
240
|
+
minimumIntegerDigits: 4,
|
|
241
|
+
useGrouping: false,
|
|
242
|
+
}).format(segment.value),
|
|
243
|
+
}
|
|
244
|
+
: segment })))),
|
|
245
|
+
React__default.createElement(Button, { className: "tds-btn tds-btn--infield tds-date-picker-button" },
|
|
246
|
+
React__default.createElement(Icon, { "aria-hidden": true, symbol: "general#calendar" }))),
|
|
247
|
+
React__default.createElement(Popover, { className: classNames("tds-date-picker-popover", {
|
|
248
|
+
"tds-date-picker-popover--lg": size === "lg",
|
|
249
|
+
}), offset: 2 },
|
|
250
|
+
React__default.createElement(Dialog, null,
|
|
251
|
+
React__default.createElement(Calendar, { className: "tds-date-picker-calendar", defaultFocusedValue: openedPartlyFilled ? (valueBeforeEdit ?? undefined) : undefined, firstDayOfWeek: firstDayOfWeek, value: openedPartlyFilled ? null : undefined },
|
|
252
|
+
React__default.createElement(DatePickerCalendarBody, { activeOverlay: activeOverlay, setActiveOverlay: setActiveOverlay })))),
|
|
253
|
+
description && (React__default.createElement(Text, { elementType: "p", className: "tds-field-description", slot: "description" },
|
|
254
|
+
React__default.createElement(Icon, { "aria-hidden": true, className: "tds-field-description-invalid-icon", symbol: "general#exclamation-triangle" }),
|
|
255
|
+
description)),
|
|
256
|
+
name && (
|
|
257
|
+
// Submits the reported value, which react-aria's own input can't while it holds a partly filled date
|
|
258
|
+
React__default.createElement("input", { disabled: disabled, hidden: true, name: name, onChange: () => { }, type: "text", value: computedValue?.toString() ?? "" })))));
|
|
256
259
|
}
|
|
257
260
|
DatePicker.displayName = "DatePicker";
|
|
258
261
|
|
|
@@ -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 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)\nconst shortMonthFormatter = new Intl.DateTimeFormat(undefined, {\n month: \"short\",\n})\nconst longMonthFormatter = new Intl.DateTimeFormat(undefined, { month: \"long\" })\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\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 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 dateFieldLocale = useDateFieldLocale()\n\n return (\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 }}\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 )\n}\n\nDateP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,aAAA,CAAC,IAAI,yBAEH,SAAS,EAAC,oCAAoC,EAC9C,MAAM,EAAC,8BAA8B,EAAA,CACrC;AACD,YAAA,WAAW,CACP,CACR;AACA,QAAA,IAAI;;AAEH,QAAA,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EACE,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAA,IAAA,EACN,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAK,EAAE,CAAC,EAClB,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAA,CACtC,CACH,CACc;AAErB;AAEA,UAAU,CAAC,WAAW,GAAG,YAAY;;;;"}
|
|
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","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,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,iBAAiB,CAAC,EACzB,QAAQ,EACR,OAAO,GAIR,EAAA;IACC,QACEC,oDACc,CAAA,OAAA,EAAU,OAAO,EAAE,EAAA,YAAA,EACpB,MAAM,EACjB,SAAS,EAAE,oDAAoD,OAAO,CAAA,CAAE,EACxE,IAAI,EAAC,QAAQ,EAAA,EAEZ,QAAQ,CACL;AAEV;AAEA,SAAS,sBAAsB,CAAC,EAC9B,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M,EAAE,CAAC,EAAA;AAET,gBAAAA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,IAAA;AACL,oBAAAA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,EACP,SAAS,EAAC,0BAA0B,EACpC,mBAAmB,EACjB,kBAAkB,IAAI,eAAe,IAAI,SAAS,IAAI,SAAS,EAEjE,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,EAAA;AAE5C,wBAAAA,cAAA,CAAA,aAAA,CAAC,sBAAsB,EAAA,EACrB,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAAA,CAClC,CACO,CACJ,CACD;AACT,YAAA,WAAW,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
|
|
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
|
|
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 (
|
|
83
|
-
|
|
84
|
-
|
|
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 (
|
|
88
|
-
|
|
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 (
|
|
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 (
|
|
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) => (
|
|
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 (
|
|
138
|
-
|
|
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
|
|
148
|
+
return React__default.createElement(Separator, { className: "tds-dropdown-separator" });
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
export { Dropdown, DropdownAction, DropdownLink, DropdownMenu, DropdownSection, DropdownSeparator, DropdownTrigger };
|