@planningcenter/tapestry 3.3.1-qa-887.0 → 3.3.1-qa-891.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 (49) hide show
  1. package/dist/components/button/DropdownButton.d.ts +11 -4
  2. package/dist/components/button/DropdownButton.d.ts.map +1 -1
  3. package/dist/components/button/DropdownButton.js.map +1 -1
  4. package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
  5. package/dist/components/date-picker/DatePicker.js +8 -136
  6. package/dist/components/date-picker/DatePicker.js.map +1 -1
  7. package/dist/components/dropdown/Dropdown.d.ts +139 -0
  8. package/dist/components/dropdown/Dropdown.d.ts.map +1 -0
  9. package/dist/components/dropdown/Dropdown.js +97 -0
  10. package/dist/components/dropdown/Dropdown.js.map +1 -0
  11. package/dist/components/dropdown/index.d.ts +4 -0
  12. package/dist/components/dropdown/index.d.ts.map +1 -0
  13. package/dist/components/page-header/index.js +3 -3
  14. package/dist/components/sidenav/index.js +5 -5
  15. package/dist/ext/@internationalized/date/dist/string.js +1 -19
  16. package/dist/ext/@internationalized/date/dist/string.js.map +1 -1
  17. package/dist/reactRender.css +938 -813
  18. package/dist/reactRender.css.map +1 -1
  19. package/dist/reactRenderLegacy.css +938 -813
  20. package/dist/reactRenderLegacy.css.map +1 -1
  21. package/dist/unstable.css +125 -0
  22. package/dist/unstable.css.map +1 -1
  23. package/dist/unstable.d.ts +1 -0
  24. package/dist/unstable.d.ts.map +1 -1
  25. package/dist/unstable.js +2 -0
  26. package/dist/unstable.js.map +1 -1
  27. package/package.json +5 -5
  28. package/dist/tapestry-wc/dist/components/p-B00sJe3H.js +0 -41
  29. package/dist/tapestry-wc/dist/components/p-B00sJe3H.js.map +0 -1
  30. package/dist/tapestry-wc/dist/components/p-Bn0hHWDB.js +0 -22
  31. package/dist/tapestry-wc/dist/components/p-Bn0hHWDB.js.map +0 -1
  32. package/dist/tapestry-wc/dist/components/p-Dq8WF4tc.js +0 -886
  33. package/dist/tapestry-wc/dist/components/p-Dq8WF4tc.js.map +0 -1
  34. package/dist/tapestry-wc/dist/components/p-T7x-WXUY.js +0 -51
  35. package/dist/tapestry-wc/dist/components/p-T7x-WXUY.js.map +0 -1
  36. package/dist/tapestry-wc/dist/components/p-nyMzpSUR.js +0 -1736
  37. package/dist/tapestry-wc/dist/components/p-nyMzpSUR.js.map +0 -1
  38. package/dist/tapestry-wc/dist/components/tds-page-header-nav.js +0 -10
  39. package/dist/tapestry-wc/dist/components/tds-page-header-nav.js.map +0 -1
  40. package/dist/tapestry-wc/dist/components/tds-page-header.js +0 -63
  41. package/dist/tapestry-wc/dist/components/tds-page-header.js.map +0 -1
  42. package/dist/tapestry-wc/dist/components/tds-sidenav-item.js +0 -96
  43. package/dist/tapestry-wc/dist/components/tds-sidenav-item.js.map +0 -1
  44. package/dist/tapestry-wc/dist/components/tds-sidenav-responsive-header.js +0 -10
  45. package/dist/tapestry-wc/dist/components/tds-sidenav-responsive-header.js.map +0 -1
  46. package/dist/tapestry-wc/dist/components/tds-sidenav-section.js +0 -52
  47. package/dist/tapestry-wc/dist/components/tds-sidenav-section.js.map +0 -1
  48. package/dist/tapestry-wc/dist/components/tds-sidenav.js +0 -74
  49. package/dist/tapestry-wc/dist/components/tds-sidenav.js.map +0 -1
@@ -1,10 +1,17 @@
1
1
  import "./btn.css";
2
2
  import React from "react";
3
3
  export type DropdownButtonProps = {
4
- /** ID of the element controlled by this dropdown button. */
5
- "aria-controls": string;
6
- /** Whether the dropdown is expanded or not. */
7
- "aria-expanded": boolean;
4
+ /**
5
+ * ID of the element controlled by this dropdown button. Optional when wrapped
6
+ * in `<DropdownTrigger>` (RA's `<Pressable>` injects it from
7
+ * `PressResponderContext`); required when used standalone to drive a custom popover.
8
+ */
9
+ "aria-controls"?: string;
10
+ /**
11
+ * Whether the dropdown is expanded or not. Optional when wrapped in
12
+ * `<DropdownTrigger>`; required when used standalone.
13
+ */
14
+ "aria-expanded"?: boolean;
8
15
  suffix?: never;
9
16
  };
10
17
  export declare function dropdownProps({ className }: {
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownButton.d.ts","sourceRoot":"","sources":["../../../src/components/button/DropdownButton.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAA;AAIlB,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,MAAM,MAAM,mBAAmB,GAAG;IAChC,4DAA4D;IAC5D,eAAe,EAAE,MAAM,CAAA;IACvB,+CAA+C;IAC/C,eAAe,EAAE,OAAO,CAAA;IACxB,MAAM,CAAC,EAAE,KAAK,CAAA;CACf,CAAA;AAED,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE;;;EAKlE;AAED,eAAO,MAAM,cAAc,yPAKzB,CAAA"}
1
+ {"version":3,"file":"DropdownButton.d.ts","sourceRoot":"","sources":["../../../src/components/button/DropdownButton.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAA;AAIlB,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,MAAM,CAAC,EAAE,KAAK,CAAA;CACf,CAAA;AAED,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE;;;EAKlE;AAED,eAAO,MAAM,cAAc,yPAKzB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownButton.js","sources":["../../../src/components/button/DropdownButton.tsx"],"sourcesContent":["import \"./btn.css\"\n\nimport Icon from \"@utilities/Icon\"\nimport classNames from \"classnames\"\nimport React, { forwardRef } from \"react\"\n\nimport { BaseButton, BaseButtonElementProps } from \"./BaseButton\"\n\nexport type DropdownButtonProps = {\n /** ID of the element controlled by this dropdown button. */\n \"aria-controls\": string\n /** Whether the dropdown is expanded or not. */\n \"aria-expanded\": boolean\n suffix?: never\n}\n\nexport function dropdownProps({ className }: { className?: string }) {\n return {\n className: classNames(className, \"tds-btn--dropdown\"),\n suffix: <Icon symbol=\"general#down-caret\" aria-hidden />,\n }\n}\n\nexport const DropdownButton = forwardRef<\n HTMLButtonElement,\n BaseButtonElementProps & DropdownButtonProps\n>((props, ref) => {\n return <BaseButton ref={ref} {...props} {...dropdownProps(props)} />\n})\n\nDropdownButton.displayName = \"DropdownButton\"\n"],"names":["React"],"mappings":";;;;;AAgBM,SAAU,aAAa,CAAC,EAAE,SAAS,EAA0B,EAAA;IACjE,OAAO;AACL,QAAA,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,mBAAmB,CAAC;AACrD,QAAA,MAAM,EAAEA,cAAA,CAAA,aAAA,CAAC,IAAI,IAAC,MAAM,EAAC,oBAAoB,EAAA,aAAA,EAAA,IAAA,EAAA,CAAe;KACzD;AACH;AAEO,MAAM,cAAc,GAAG,UAAU,CAGtC,CAAC,KAAK,EAAE,GAAG,KAAI;AACf,IAAA,OAAOA,cAAA,CAAA,aAAA,CAAC,UAAU,EAAA,EAAC,GAAG,EAAE,GAAG,EAAA,GAAM,KAAK,EAAA,GAAM,aAAa,CAAC,KAAK,CAAC,GAAI;AACtE,CAAC;AAED,cAAc,CAAC,WAAW,GAAG,gBAAgB;;;;"}
1
+ {"version":3,"file":"DropdownButton.js","sources":["../../../src/components/button/DropdownButton.tsx"],"sourcesContent":["import \"./btn.css\"\n\nimport Icon from \"@utilities/Icon\"\nimport classNames from \"classnames\"\nimport React, { forwardRef } from \"react\"\n\nimport { BaseButton, BaseButtonElementProps } from \"./BaseButton\"\n\nexport type DropdownButtonProps = {\n /**\n * ID of the element controlled by this dropdown button. Optional when wrapped\n * in `<DropdownTrigger>` (RA's `<Pressable>` injects it from\n * `PressResponderContext`); required when used standalone to drive a custom popover.\n */\n \"aria-controls\"?: string\n /**\n * Whether the dropdown is expanded or not. Optional when wrapped in\n * `<DropdownTrigger>`; required when used standalone.\n */\n \"aria-expanded\"?: boolean\n suffix?: never\n}\n\nexport function dropdownProps({ className }: { className?: string }) {\n return {\n className: classNames(className, \"tds-btn--dropdown\"),\n suffix: <Icon symbol=\"general#down-caret\" aria-hidden />,\n }\n}\n\nexport const DropdownButton = forwardRef<\n HTMLButtonElement,\n BaseButtonElementProps & DropdownButtonProps\n>((props, ref) => {\n return <BaseButton ref={ref} {...props} {...dropdownProps(props)} />\n})\n\nDropdownButton.displayName = \"DropdownButton\"\n"],"names":["React"],"mappings":";;;;;AAuBM,SAAU,aAAa,CAAC,EAAE,SAAS,EAA0B,EAAA;IACjE,OAAO;AACL,QAAA,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,mBAAmB,CAAC;AACrD,QAAA,MAAM,EAAEA,cAAA,CAAA,aAAA,CAAC,IAAI,IAAC,MAAM,EAAC,oBAAoB,EAAA,aAAA,EAAA,IAAA,EAAA,CAAe;KACzD;AACH;AAEO,MAAM,cAAc,GAAG,UAAU,CAGtC,CAAC,KAAK,EAAE,GAAG,KAAI;AACf,IAAA,OAAOA,cAAA,CAAA,aAAA,CAAC,UAAU,EAAA,EAAC,GAAG,EAAE,GAAG,EAAA,GAAM,KAAK,EAAA,GAAM,aAAa,CAAC,KAAK,CAAC,GAAI;AACtE,CAAC;AAED,cAAc,CAAC,WAAW,GAAG,gBAAgB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAA;AAC1B,OAAO,8BAA8B,CAAA;AACrC,OAAO,aAAa,CAAA;AAEpB,OAAO,EAEL,KAAK,SAAS,EAIf,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,KAAwD,MAAM,OAAO,CAAA;AAC5E,OA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R,IAAW,EACX,KAAK,EACL,GAAG,SAAS,EACb,EAAE,sBAAsB,qBAwFxB;yBAzGe,UAAU"}
@@ -1,139 +1,11 @@
1
- import { CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f } from './../../ext/@internationalized/date/dist/CalendarDate.js';
2
1
  import { today as $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3, getLocalTimeZone as $14e0f24ef4ac5c92$export$aa8b41735afcabd2 } from './../../ext/@internationalized/date/dist/queries.js';
3
- import { parseDate as $fae977aafc393c5c$export$6b862160d295c8e } from './../../ext/@internationalized/date/dist/string.js';
4
- import Icon from '../../utilities/Icon.js';
5
- import classNames from 'classnames';
6
- import React__default, { useState, useContext, useMemo } from 'react';
7
- import { DatePicker as DatePicker$1, Label, Group, DateInput, DateSegment, Button, Popover, Dialog, Calendar, Text, CalendarStateContext, ListBox, ListBoxItem, CalendarGrid, CalendarGridHeader, CalendarHeaderCell, CalendarGridBody, CalendarCell } from 'react-aria-components';
2
+ import '@planningcenter/icons/sprites/general.svg';
3
+ import '@planningcenter/icons/symbol';
4
+ import 'react';
5
+ import 'classnames';
6
+ import 'react-aria-components';
8
7
 
9
- function toCalendarDate(input) {
10
- if (input === null)
11
- return null;
12
- if (input === undefined)
13
- return undefined;
14
- if (typeof input === "object" && "calendar" in input) {
15
- return input;
16
- }
17
- return $fae977aafc393c5c$export$6b862160d295c8e(input);
18
- }
19
- function DatePickerOverlay({ children, variant, }) {
20
- 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));
21
- }
22
- function DatePickerCalendarBody({ activeOverlay, setActiveOverlay, }) {
23
- // Read and drive Calendar's focused date through its state context. This
24
- // lets react-aria-components own the "open to selected month" behavior:
25
- // when the popover opens, Calendar mounts and auto-focuses the DatePicker's
26
- // current value (whether typed into the input segments or set via `value`).
27
- const state = useContext(CalendarStateContext);
28
- const focusedDate = state.focusedDate;
29
- const today = $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2());
30
- const MONTHS = Array.from({ length: 12 }, (_, i) => i);
31
- const YEARS = Array.from({ length: 131 }, (_, i) => today.year - 100 + i);
32
- const shortMonthFormatter = useMemo(() => new Intl.DateTimeFormat(undefined, { month: "short" }), []);
33
- const longMonthFormatter = useMemo(() => new Intl.DateTimeFormat(undefined, { month: "long" }), []);
34
- function handleOverlaySelectionChange(keys, onSelect) {
35
- if (keys === "all")
36
- return;
37
- const [first] = Array.from(keys);
38
- if (first !== undefined)
39
- onSelect(Number(first));
40
- }
41
- function handleMonthSelect(monthIndex) {
42
- state.setFocusedDate(new $35ea8db9cb2ccb90$export$99faa760c7908e4f(focusedDate.year, monthIndex + 1, 1));
43
- setActiveOverlay(null);
44
- }
45
- function handleYearSelect(year) {
46
- state.setFocusedDate(new $35ea8db9cb2ccb90$export$99faa760c7908e4f(year, focusedDate.month, 1));
47
- setActiveOverlay(null);
48
- }
49
- return (React__default.createElement(React__default.Fragment, null,
50
- React__default.createElement("header", { className: "tds-date-picker-calendar-header" },
51
- React__default.createElement("div", { className: "tds-date-picker-calendar-heading" },
52
- 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))),
53
- 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)),
54
- activeOverlay ? (React__default.createElement(Button, { "aria-label": `Close ${activeOverlay} picker`, className: "tds-date-picker-calendar-nav", onPress: () => setActiveOverlay(null), slot: null },
55
- React__default.createElement(Icon, { "aria-hidden": true, symbol: "general#x" }))) : (React__default.createElement(React__default.Fragment, null,
56
- React__default.createElement(Button, { "aria-label": "Go to today", className: "tds-date-picker-calendar-nav tds-date-picker-calendar-nav--lg", style: {
57
- visibility: focusedDate.month === today.month &&
58
- focusedDate.year === today.year
59
- ? "hidden"
60
- : undefined,
61
- }, onPress: () => {
62
- state.setFocusedDate(today);
63
- state.setFocused(true);
64
- }, slot: null },
65
- React__default.createElement("svg", { "aria-hidden": true, xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 16 16", className: "symbol" },
66
- 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" }),
67
- React__default.createElement("circle", { cx: "8", cy: "9.75", r: "2.25" }))),
68
- React__default.createElement(Button, { "aria-label": "Previous month", className: "tds-date-picker-calendar-nav", slot: "previous" },
69
- React__default.createElement(Icon, { "aria-hidden": true, symbol: "general#left-chevron" })),
70
- React__default.createElement(Button, { "aria-label": "Next month", className: "tds-date-picker-calendar-nav", slot: "next" },
71
- React__default.createElement(Icon, { "aria-hidden": true, symbol: "general#right-chevron" }))))),
72
- React__default.createElement("div", { className: "tds-date-picker-calendar-body" },
73
- activeOverlay === "month" && (React__default.createElement(DatePickerOverlay, { variant: "month" },
74
- React__default.createElement(ListBox, { "aria-label": "Months",
75
- // eslint-disable-next-line jsx-a11y/no-autofocus -- focusing the active item on dialog open is required per ARIA authoring practices
76
- 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) => {
77
- const date = new Date(2000, i, 1);
78
- const shortMonth = shortMonthFormatter.format(date);
79
- const longMonth = longMonthFormatter.format(date);
80
- return (React__default.createElement(ListBoxItem, { className: "tds-date-picker-overlay-cell", id: String(i), key: i, "aria-label": longMonth, textValue: longMonth }, shortMonth));
81
- })))),
82
- activeOverlay === "year" && (React__default.createElement(DatePickerOverlay, { variant: "year" },
83
- React__default.createElement(ListBox, { "aria-label": "Years",
84
- // eslint-disable-next-line jsx-a11y/no-autofocus -- focusing the active item on dialog open is required per ARIA authoring practices
85
- 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)))))),
86
- React__default.createElement(CalendarGrid, { className: "tds-date-picker-calendar-grid" },
87
- React__default.createElement(CalendarGridHeader, { className: "tds-date-picker-calendar-grid-header" }, (day) => (React__default.createElement(CalendarHeaderCell, { className: "tds-date-picker-calendar-header-cell" }, day))),
88
- 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 })))))));
89
- }
90
- /**
91
- * A date picker allows a user to select a particular date.
92
- * The input supports keyboard entry of individual day, month, and year segments;
93
- * the calendar offers month and year quick-pick overlays plus a "go to today" shortcut.
94
- *
95
- * The date picker automatically displays the value and calendar from the user's locale,
96
- * and does not require a specific date format.
97
- *
98
- * Values are exchanged as `DateValue` from `@internationalized/date`, but
99
- * `value`, `min`, and `max` also accept ISO date strings (`"YYYY-MM-DD"`) for
100
- * convenience. Restrict the selectable range with `min`/`max`, or mark
101
- * individual dates as unavailable via `isDateUnavailable`.
102
- *
103
- * @component
104
- * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/components-datepicker--docs | Storybook Documentation}
105
- */
106
- function DatePicker({ className, description, disabled, firstDayOfWeek, hideLabel, invalid, isDateUnavailable, label, max, min, onChange, readOnly, required, size = "md", value, ...restProps }) {
107
- const convertedValue = toCalendarDate(value);
108
- const convertedMin = toCalendarDate(min) ?? undefined;
109
- const convertedMax = toCalendarDate(max) ?? undefined;
110
- const combinedClassName = classNames("tds-field tds-date-picker", {
111
- "tds-date-picker--lg": size === "lg",
112
- "tds-field--lg": size === "lg",
113
- }, className);
114
- const [activeOverlay, setActiveOverlay] = useState(null);
115
- return (React__default.createElement(DatePicker$1, { ...restProps, "aria-label": hideLabel ? label : undefined, className: combinedClassName, isDateUnavailable: isDateUnavailable, isDisabled: disabled, isInvalid: invalid, isReadOnly: readOnly, isRequired: required, maxValue: convertedMax, minValue: convertedMin, onChange: onChange ?? undefined, onOpenChange: (isOpen) => {
116
- if (!isOpen)
117
- setActiveOverlay(null);
118
- }, value: convertedValue },
119
- !hideLabel && React__default.createElement(Label, { className: "tds-field-label" }, label),
120
- React__default.createElement(Group, { className: "tds-field-control tds-date-picker-field" },
121
- React__default.createElement(DateInput, { className: "tds-date-picker-input" }, (segment) => (React__default.createElement(DateSegment, { className: segment.type === "literal"
122
- ? "tds-field-date-segment-separator"
123
- : "tds-field-date-segment", segment: segment }))),
124
- React__default.createElement(Button, { className: "tds-btn tds-btn--infield tds-date-picker-button" },
125
- React__default.createElement(Icon, { "aria-hidden": true, symbol: "general#calendar" }))),
126
- React__default.createElement(Popover, { className: classNames("tds-date-picker-popover", {
127
- "tds-date-picker-popover--lg": size === "lg",
128
- }), offset: 2 },
129
- React__default.createElement(Dialog, null,
130
- React__default.createElement(Calendar, { className: "tds-date-picker-calendar", firstDayOfWeek: firstDayOfWeek },
131
- React__default.createElement(DatePickerCalendarBody, { activeOverlay: activeOverlay, setActiveOverlay: setActiveOverlay })))),
132
- description && (React__default.createElement(Text, { elementType: "p", className: "tds-field-description", slot: "description" },
133
- React__default.createElement(Icon, { "aria-hidden": true, className: "tds-field-description-invalid-icon", symbol: "general#exclamation-triangle" }),
134
- description))));
135
- }
136
- DatePicker.displayName = "DatePicker";
137
-
138
- export { DatePicker };
8
+ const _today = $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2());
9
+ Array.from({ length: 12 }, (_, i) => i);
10
+ Array.from({ length: 131 }, (_, i) => _today.year - 100 + i);
139
11
  //# sourceMappingURL=DatePicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sources":["../../../src/components/date-picker/DatePicker.tsx"],"sourcesContent":["import \"../button/btn.css\"\nimport \"../input-text-base/index.css\"\nimport \"./index.css\"\n\nimport {\n CalendarDate,\n type DateValue,\n getLocalTimeZone,\n parseDate,\n today as todayCalendar,\n} from \"@internationalized/date\"\nimport Icon from \"@utilities/Icon\"\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport classNames from \"classnames\"\nimport React, { type ReactNode, useContext, useMemo, useState } from \"react\"\nimport {\n Button,\n Calendar,\n CalendarCell,\n CalendarGrid,\n CalendarGridBody,\n CalendarGridHeader,\n CalendarHeaderCell,\n CalendarStateContext,\n DateInput,\n DatePicker as AriaDatePicker,\n type DatePickerProps as AriaDatePickerProps,\n DateSegment,\n Dialog,\n Group,\n Label,\n ListBox,\n ListBoxItem,\n Popover,\n Text,\n} from \"react-aria-components\"\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 /** Helper text displayed below the component. Styled as error text when `invalid` is `true`. */\n description?: string\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 /** 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 /** The controlled value. Accepts a DateValue or ISO date string. */\n value?: DatePickerDateValue | null\n}\n\ntype AriaDatePickerPropsToOmit =\n | \"children\"\n | \"defaultOpen\"\n | \"defaultValue\"\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 MONTHS = Array.from({ length: 12 }, (_, i) => i)\n const YEARS = Array.from({ length: 131 }, (_, i) => today.year - 100 + i)\n const shortMonthFormatter = useMemo(\n () => new Intl.DateTimeFormat(undefined, { month: \"short\" }),\n []\n )\n const longMonthFormatter = useMemo(\n () => new Intl.DateTimeFormat(undefined, { month: \"long\" }),\n []\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\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`, `min`, and `max` also accept ISO date strings (`\"YYYY-MM-DD\"`) for\n * convenience. Restrict the selectable range with `min`/`max`, or mark\n * individual dates as unavailable via `isDateUnavailable`.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/components-datepicker--docs | Storybook Documentation}\n */\nexport function DatePicker({\n className,\n description,\n disabled,\n firstDayOfWeek,\n hideLabel,\n invalid,\n isDateUnavailable,\n label,\n max,\n min,\n onChange,\n readOnly,\n required,\n size = \"md\",\n value,\n ...restProps\n}: DatePickerElementProps) {\n const convertedValue = toCalendarDate(value)\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 return (\n <AriaDatePicker\n {...restProps}\n aria-label={hideLabel ? label : undefined}\n className={combinedClassName}\n isDateUnavailable={isDateUnavailable}\n isDisabled={disabled}\n isInvalid={invalid}\n isReadOnly={readOnly}\n isRequired={required}\n maxValue={convertedMax}\n minValue={convertedMin}\n onChange={onChange ?? undefined}\n onOpenChange={(isOpen) => {\n if (!isOpen) setActiveOverlay(null)\n }}\n value={convertedValue}\n >\n {!hideLabel && <Label className=\"tds-field-label\">{label}</Label>}\n <Group className=\"tds-field-control tds-date-picker-field\">\n <DateInput className=\"tds-date-picker-input\">\n {(segment) => (\n <DateSegment\n className={\n segment.type === \"literal\"\n ? \"tds-field-date-segment-separator\"\n : \"tds-field-date-segment\"\n }\n segment={segment}\n />\n )}\n </DateInput>\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 firstDayOfWeek={firstDayOfWeek}\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 </AriaDatePicker>\n )\n}\n\nDatePicker.displayName = \"DatePicker\"\n"],"names":["parseDate","React","todayCalendar","getLocalTimeZone","CalendarDate","AriaDatePicker"],"mappings":";;;;;;;;AAyCA,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,OAAOA,wCAAS,CAAC,KAAK,CAAC;AACzB;AAuDA,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,aAAa,EACb,gBAAgB,GAIjB,EAAA;;;;;AAKC,IAAA,MAAM,KAAK,GAAG,UAAU,CAAC,oBAAoB,CAAE;AAC/C,IAAA,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW;AACrC,IAAA,MAAM,KAAK,GAAGC,yCAAa,CAACC,yCAAgB,EAAE,CAAC;IAC/C,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAA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,OAAO,MACPA,cAAA,CAAA,aAAA,CAAC,WAAW,EAAA,EACV,SAAS,EACP,OAAO,CAAC,IAAI,KAAK;AACf,sBAAE;sBACA,wBAAwB,EAE9B,OAAO,EAAE,OAAO,EAAA,CAChB,CACH,CACS;AACZ,YAAAA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,SAAS,EAAC,iDAAiD,EAAA;AACjE,gBAAAA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAA,aAAA,EAAA,IAAA,EAAa,MAAM,EAAC,kBAAkB,EAAA,CAAG,CACvC,CACH;AACR,QAAAA,cAAA,CAAA,aAAA,CAAC,OAAO,EAAA,EACN,SAAS,EAAE,UAAU,CAAC,yBAAyB,EAAE;gBAC/C,6BAA6B,EAAE,IAAI,KAAK,IAAI;aAC7C,CAAC,EACF,MAAM,EAAE,CAAC,EAAA;AAET,YAAAA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,IAAA;gBACLA,cAAA,CAAA,aAAA,CAAC,QAAQ,IACP,SAAS,EAAC,0BAA0B,EACpC,cAAc,EAAE,cAAc,EAAA;AAE9B,oBAAAA,cAAA,CAAA,aAAA,CAAC,sBAAsB,EAAA,EACrB,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAAA,CAClC,CACO,CACJ,CACD;AACT,QAAA,WAAW,KACVA,cAAA,CAAA,aAAA,CAAC,IAAI,IACH,WAAW,EAAC,GAAG,EACf,SAAS,EAAC,uBAAuB,EACjC,IAAI,EAAC,aAAa,EAAA;YAElBA,cAAA,CAAA,aAAA,CAAC,IAAI,yBAEH,SAAS,EAAC,oCAAoC,EAC9C,MAAM,EAAC,8BAA8B,EAAA,CACrC;AACD,YAAA,WAAW,CACP,CACR,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 \"../input-text-base/index.css\"\nimport \"./index.css\"\n\nimport {\n CalendarDate,\n type DateValue,\n getLocalTimeZone,\n parseDate,\n today as todayCalendar,\n} from \"@internationalized/date\"\nimport Icon from \"@utilities/Icon\"\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport classNames from \"classnames\"\nimport React, { type ReactNode, useContext, useState } from \"react\"\nimport {\n Button,\n Calendar,\n CalendarCell,\n CalendarGrid,\n CalendarGridBody,\n CalendarGridHeader,\n CalendarHeaderCell,\n CalendarStateContext,\n DateInput,\n DatePicker as AriaDatePicker,\n type DatePickerProps as AriaDatePickerProps,\n DateSegment,\n Dialog,\n Group,\n Label,\n ListBox,\n ListBoxItem,\n Popover,\n Text,\n} from \"react-aria-components\"\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 /** Helper text displayed below the component. Styled as error text when `invalid` is `true`. */\n description?: string\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 /** 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 /** The controlled value. Accepts a DateValue or ISO date string. */\n value?: DatePickerDateValue | null\n}\n\ntype AriaDatePickerPropsToOmit =\n | \"children\"\n | \"defaultOpen\"\n | \"defaultValue\"\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\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`, `min`, and `max` also accept ISO date strings (`\"YYYY-MM-DD\"`) for\n * convenience. Restrict the selectable range with `min`/`max`, or mark\n * individual dates as unavailable via `isDateUnavailable`.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/components-datepicker--docs | Storybook Documentation}\n */\nexport function DatePicker({\n className,\n description,\n disabled,\n firstDayOfWeek,\n hideLabel,\n invalid,\n isDateUnavailable,\n label,\n max,\n min,\n onChange,\n readOnly,\n required,\n size = \"md\",\n value,\n ...restProps\n}: DatePickerElementProps) {\n const convertedValue = toCalendarDate(value)\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 return (\n <AriaDatePicker\n {...restProps}\n aria-label={hideLabel ? label : undefined}\n className={combinedClassName}\n isDateUnavailable={isDateUnavailable}\n isDisabled={disabled}\n isInvalid={invalid}\n isReadOnly={readOnly}\n isRequired={required}\n maxValue={convertedMax}\n minValue={convertedMin}\n onChange={onChange ?? undefined}\n onOpenChange={(isOpen) => {\n if (!isOpen) setActiveOverlay(null)\n }}\n value={convertedValue}\n >\n {!hideLabel && <Label className=\"tds-field-label\">{label}</Label>}\n <Group className=\"tds-field-control tds-date-picker-field\">\n <DateInput className=\"tds-date-picker-input\">\n {(segment) => (\n <DateSegment\n className={\n segment.type === \"literal\"\n ? \"tds-field-date-segment-separator\"\n : \"tds-field-date-segment\"\n }\n segment={segment}\n />\n )}\n </DateInput>\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 firstDayOfWeek={firstDayOfWeek}\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 </AriaDatePicker>\n )\n}\n\nDatePicker.displayName = \"DatePicker\"\n"],"names":["todayCalendar","getLocalTimeZone"],"mappings":";;;;;;;AAqCA,MAAM,MAAM,GAAGA,yCAAa,CAACC,yCAAgB,EAAE,CAAC;AACjC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;AACvC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,IAAI,GAAG,GAAG,GAAG,CAAC"}
@@ -0,0 +1,139 @@
1
+ import "./index.css";
2
+ import type { CombineAriaPropsWithCustomProps } from "../../utilities/reactAriaProps";
3
+ import React, { type ReactElement, type ReactNode } from "react";
4
+ import type { Key, MenuItemProps, MenuSectionProps, PopoverProps } from "react-aria-components";
5
+ export type DropdownPlacement = NonNullable<PopoverProps["placement"]>;
6
+ export interface DropdownProps {
7
+ /**
8
+ * A `<DropdownTrigger>` followed by `<DropdownAction>` / `<DropdownLink>` /
9
+ * `<DropdownSection>` / `<DropdownSeparator>` elements.
10
+ */
11
+ children: ReactNode;
12
+ /** Optional override for the menu element id. */
13
+ id?: string;
14
+ /** Fires when the menu closes. */
15
+ onClose?: () => void;
16
+ /** Fires when the menu opens. Useful for analytics or lazy data prep. */
17
+ onOpen?: () => void;
18
+ /**
19
+ * Popover position relative to the trigger. Uses React Aria's
20
+ * space-separated format (e.g., `"bottom start"`, `"top end"`,
21
+ * `"left top"`).
22
+ */
23
+ placement?: DropdownPlacement;
24
+ }
25
+ export type DropdownElementProps = DropdownProps;
26
+ /**
27
+ * An action menu — a button that, when activated, reveals a list of actions or
28
+ * navigation links. Composed of a `<DropdownTrigger>` wrapping a Tapestry
29
+ * dropdown-trigger button (`DropdownButton`, `DropdownIconButton`, or
30
+ * `PageHeaderActionsDropdownButton`), followed by `<DropdownAction>`,
31
+ * `<DropdownLink>`, `<DropdownSection>`, and `<DropdownSeparator>` items.
32
+ *
33
+ * **Dropdown vs Select.** Use `Dropdown` to trigger an action ("Edit",
34
+ * "Delete") or navigate ("Go to documentation"). Use `Select` to collect a
35
+ * value that is bound to form data or component state. They look visually
36
+ * similar but follow different ARIA patterns (Menu vs Combobox/Listbox) and
37
+ * are not interchangeable.
38
+ *
39
+ * Built on React Aria's `MenuTrigger` + `Menu` + `Popover` primitives.
40
+ *
41
+ * @component
42
+ * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/menu/ | W3C APG Menu Pattern}
43
+ */
44
+ export declare function Dropdown({ children, id, onClose, onOpen, placement, }: DropdownElementProps): React.JSX.Element;
45
+ export interface DropdownTriggerProps {
46
+ /**
47
+ * A single Tapestry dropdown-trigger button element (`DropdownButton`,
48
+ * `DropdownIconButton`, or `PageHeaderActionsDropdownButton`).
49
+ */
50
+ children: ReactElement;
51
+ }
52
+ export declare function DropdownTrigger({ children }: DropdownTriggerProps): React.JSX.Element;
53
+ export interface DropdownItemBaseProps {
54
+ /** Applies destructive styling. */
55
+ destructive?: boolean;
56
+ /** Applies staff-only visual treatment. */
57
+ staffOnly?: boolean;
58
+ }
59
+ export interface DropdownActionProps extends DropdownItemBaseProps {
60
+ /**
61
+ * Disables the item. Renamed to React Aria's `isDisabled` inside the
62
+ * wrapper. Disabled items are skipped by keyboard traversal and won't fire
63
+ * `onAction`.
64
+ */
65
+ disabled?: boolean;
66
+ /**
67
+ * Stable identifier — required by React Aria's collection model for keying
68
+ * and focus tracking.
69
+ */
70
+ id: Key;
71
+ /** Callback fired when the item is activated. */
72
+ onAction: () => void;
73
+ }
74
+ type AriaActionPropsToOmit = "href" | "isDisabled" | "rel" | "routerOptions" | "target" | "value";
75
+ type AriaActionPropsToInclude = "textValue";
76
+ export type DropdownActionElementProps<T extends object = object> = CombineAriaPropsWithCustomProps<MenuItemProps<T>, DropdownActionProps, AriaActionPropsToOmit, AriaActionPropsToInclude>;
77
+ /**
78
+ * A `<Dropdown>` item that fires a callback when activated. Renders an RA
79
+ * `<MenuItem>` (`role="menuitem"`). Children are passed through and can use
80
+ * the slot convention (`slot="label" | "prefix" | "suffix" | "description"`)
81
+ * for structured content.
82
+ *
83
+ * @component
84
+ */
85
+ export declare function DropdownAction<T extends object>({ className, destructive, disabled, staffOnly, ...restProps }: DropdownActionElementProps<T>): React.JSX.Element;
86
+ export interface DropdownLinkProps extends DropdownItemBaseProps {
87
+ /** If `true`, sets `target="_blank"` and `rel="noreferrer noopener"`. */
88
+ external?: boolean;
89
+ /** Destination URL. */
90
+ href: string;
91
+ /**
92
+ * Stable identifier — required by React Aria's collection model for keying
93
+ * and focus tracking.
94
+ */
95
+ id: Key;
96
+ }
97
+ type AriaLinkPropsToOmit = "isDisabled" | "onAction" | "rel" | "target" | "value";
98
+ type AriaLinkPropsToInclude = "href" | "routerOptions" | "textValue";
99
+ export type DropdownLinkElementProps<T extends object = object> = CombineAriaPropsWithCustomProps<MenuItemProps<T>, DropdownLinkProps, AriaLinkPropsToOmit, AriaLinkPropsToInclude>;
100
+ /**
101
+ * A `<Dropdown>` item that navigates to a URL. Renders an RA `<MenuItem>` as
102
+ * an anchor (`<a role="menuitem" href="…">`). Pass `external` to open in a
103
+ * new tab with `rel="noreferrer noopener"`.
104
+ *
105
+ * `disabled` is intentionally not accepted — HTML has no native disabled state
106
+ * for anchors, and a "disabled link" has no accessible analog. If a link
107
+ * shouldn't be activatable, omit it.
108
+ *
109
+ * @component
110
+ */
111
+ export declare function DropdownLink<T extends object>({ className, destructive, external, staffOnly, ...restProps }: DropdownLinkElementProps<T>): React.JSX.Element;
112
+ export interface DropdownSectionProps {
113
+ /** The items rendered within the section. */
114
+ children: ReactNode;
115
+ /**
116
+ * Heading rendered above the section's items. Required — RA renders the
117
+ * section as `role="group"` and the heading provides the group's
118
+ * accessible name via `aria-labelledby`.
119
+ */
120
+ title: string;
121
+ }
122
+ export type DropdownSectionElementProps<T extends object = object> = CombineAriaPropsWithCustomProps<MenuSectionProps<T>, DropdownSectionProps, "value", never>;
123
+ /**
124
+ * A grouped section within a `<Dropdown>`. Renders an RA `<MenuSection>`
125
+ * (`role="group"`) with an optional `<Header>` heading when `title` is set.
126
+ *
127
+ * @component
128
+ */
129
+ export declare function DropdownSection<T extends object>({ children, className, title, ...restProps }: DropdownSectionElementProps<T>): React.JSX.Element;
130
+ export type DropdownSeparatorElementProps = Record<string, never>;
131
+ /**
132
+ * A divider between items in a `<Dropdown>`. Renders an RA `<Separator>`
133
+ * (`role="separator"`).
134
+ *
135
+ * @component
136
+ */
137
+ export declare function DropdownSeparator(): React.JSX.Element;
138
+ export {};
139
+ //# sourceMappingURL=Dropdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,KAAK,EAAE,EAEZ,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EACV,GAAG,EACH,aAAa,EACb,gBAAgB,EAChB,YAAY,EACb,MAAM,uBAAuB,CAAA;AAY9B,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAA;AAEtE,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB,iDAAiD;IACjD,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAA;CAC9B;AAED,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAA;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,EA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GACZ,UAAU,GACV,KAAK,GACL,QAAQ,GACR,OAAO,CAAA;AACX,KAAK,sBAAsB,GAAG,MAAM,GAAG,eAAe,GAAG,WAAW,CAAA;AAEpE,MAAM,MAAM,wBAAwB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAC5D,+BAA+B,CAC7B,aAAa,CAAC,CAAC,CAAC,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,CACvB,CAAA;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,EAC7C,SAAS,EACT,WAAW,EACX,QAAQ,EACR,SAAS,EACT,GAAG,SAAS,EACb,EAAE,wBAAwB,CAAC,CAAC,CAAC,qBAkB7B;AAED,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,QAAQ,EAAE,SAAS,CAAA;IACnB;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,2BAA2B,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAC/D,+BAA+B,CAC7B,gBAAgB,CAAC,CAAC,CAAC,EACnB,oBAAoB,EACpB,OAAO,EACP,KAAK,CACN,CAAA;AAEH;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,EAChD,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,SAAS,EACb,EAAE,2BAA2B,CAAC,CAAC,CAAC,qBAUhC;AAED,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AAEjE;;;;;GAKG;AACH,wBAAgB,iBAAiB,sBAEhC"}
@@ -0,0 +1,97 @@
1
+ import classNames from 'classnames';
2
+ import React__default from 'react';
3
+ import { MenuTrigger, Popover, Menu, MenuItem, MenuSection, Header, Separator, Pressable } from 'react-aria-components';
4
+
5
+ /**
6
+ * An action menu — a button that, when activated, reveals a list of actions or
7
+ * navigation links. Composed of a `<DropdownTrigger>` wrapping a Tapestry
8
+ * dropdown-trigger button (`DropdownButton`, `DropdownIconButton`, or
9
+ * `PageHeaderActionsDropdownButton`), followed by `<DropdownAction>`,
10
+ * `<DropdownLink>`, `<DropdownSection>`, and `<DropdownSeparator>` items.
11
+ *
12
+ * **Dropdown vs Select.** Use `Dropdown` to trigger an action ("Edit",
13
+ * "Delete") or navigate ("Go to documentation"). Use `Select` to collect a
14
+ * value that is bound to form data or component state. They look visually
15
+ * similar but follow different ARIA patterns (Menu vs Combobox/Listbox) and
16
+ * are not interchangeable.
17
+ *
18
+ * Built on React Aria's `MenuTrigger` + `Menu` + `Popover` primitives.
19
+ *
20
+ * @component
21
+ * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/menu/ | W3C APG Menu Pattern}
22
+ */
23
+ function Dropdown({ children, id, onClose, onOpen, placement = "bottom start", }) {
24
+ const [trigger, ...items] = React__default.Children.toArray(children);
25
+ const handleOpenChange = (isOpen) => {
26
+ if (isOpen)
27
+ onOpen?.();
28
+ else
29
+ onClose?.();
30
+ };
31
+ return (React__default.createElement(MenuTrigger, { onOpenChange: handleOpenChange },
32
+ trigger,
33
+ React__default.createElement(Popover, { className: "tds-dropdown-popover", placement: placement },
34
+ React__default.createElement(Menu, { id: id }, items))));
35
+ }
36
+ function DropdownTrigger({ children }) {
37
+ const child = React__default.Children.only(children);
38
+ const { disabled, loading } = child.props;
39
+ return (React__default.createElement(Pressable, { isDisabled: disabled || loading }, children));
40
+ }
41
+ /**
42
+ * A `<Dropdown>` item that fires a callback when activated. Renders an RA
43
+ * `<MenuItem>` (`role="menuitem"`). Children are passed through and can use
44
+ * the slot convention (`slot="label" | "prefix" | "suffix" | "description"`)
45
+ * for structured content.
46
+ *
47
+ * @component
48
+ */
49
+ function DropdownAction({ className, destructive, disabled, staffOnly, ...restProps }) {
50
+ return (React__default.createElement(MenuItem, { ...restProps, className: classNames("tds-dropdown-item", {
51
+ "tds-dropdown-item--destructive": destructive,
52
+ "tds-dropdown-item--staff-only": staffOnly,
53
+ }, className), isDisabled: disabled }));
54
+ }
55
+ /**
56
+ * A `<Dropdown>` item that navigates to a URL. Renders an RA `<MenuItem>` as
57
+ * an anchor (`<a role="menuitem" href="…">`). Pass `external` to open in a
58
+ * new tab with `rel="noreferrer noopener"`.
59
+ *
60
+ * `disabled` is intentionally not accepted — HTML has no native disabled state
61
+ * for anchors, and a "disabled link" has no accessible analog. If a link
62
+ * shouldn't be activatable, omit it.
63
+ *
64
+ * @component
65
+ */
66
+ function DropdownLink({ className, destructive, external, staffOnly, ...restProps }) {
67
+ const externalProps = external
68
+ ? { rel: "noreferrer noopener", target: "_blank" }
69
+ : null;
70
+ return (React__default.createElement(MenuItem, { ...restProps, ...externalProps, className: classNames("tds-dropdown-item", {
71
+ "tds-dropdown-item--destructive": destructive,
72
+ "tds-dropdown-item--staff-only": staffOnly,
73
+ }, className) }));
74
+ }
75
+ /**
76
+ * A grouped section within a `<Dropdown>`. Renders an RA `<MenuSection>`
77
+ * (`role="group"`) with an optional `<Header>` heading when `title` is set.
78
+ *
79
+ * @component
80
+ */
81
+ function DropdownSection({ children, className, title, ...restProps }) {
82
+ return (React__default.createElement(MenuSection, { ...restProps, className: classNames("tds-dropdown-section", className) },
83
+ React__default.createElement(Header, { className: "tds-dropdown-section-label" }, title),
84
+ children));
85
+ }
86
+ /**
87
+ * A divider between items in a `<Dropdown>`. Renders an RA `<Separator>`
88
+ * (`role="separator"`).
89
+ *
90
+ * @component
91
+ */
92
+ function DropdownSeparator() {
93
+ return React__default.createElement(Separator, { className: "tds-dropdown-separator" });
94
+ }
95
+
96
+ export { Dropdown, DropdownAction, DropdownLink, DropdownSection, DropdownSeparator, DropdownTrigger };
97
+ //# sourceMappingURL=Dropdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropdown.js","sources":["../../../src/components/dropdown/Dropdown.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport classNames from \"classnames\"\nimport React, {\n type ComponentProps,\n type ReactElement,\n type ReactNode,\n} from \"react\"\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 Separator,\n} from \"react-aria-components\"\n\nexport type DropdownPlacement = NonNullable<PopoverProps[\"placement\"]>\n\nexport interface DropdownProps {\n /**\n * A `<DropdownTrigger>` followed by `<DropdownAction>` / `<DropdownLink>` /\n * `<DropdownSection>` / `<DropdownSeparator>` elements.\n */\n children: ReactNode\n /** Optional override for the menu element id. */\n id?: string\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 * Popover position relative to the trigger. Uses React Aria's\n * space-separated format (e.g., `\"bottom start\"`, `\"top end\"`,\n * `\"left top\"`).\n */\n placement?: DropdownPlacement\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`), followed by `<DropdownAction>`,\n * `<DropdownLink>`, `<DropdownSection>`, and `<DropdownSeparator>` items.\n *\n * **Dropdown vs Select.** Use `Dropdown` to trigger an action (\"Edit\",\n * \"Delete\") or navigate (\"Go to documentation\"). Use `Select` to collect a\n * value that is bound to form data or component state. They look visually\n * similar but follow different ARIA patterns (Menu vs Combobox/Listbox) and\n * are not interchangeable.\n *\n * Built on React Aria's `MenuTrigger` + `Menu` + `Popover` primitives.\n *\n * @component\n * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/menu/ | W3C APG Menu Pattern}\n */\nexport function Dropdown({\n children,\n id,\n onClose,\n onOpen,\n placement = \"bottom start\",\n}: DropdownElementProps) {\n const [trigger, ...items] = React.Children.toArray(children)\n\n const handleOpenChange = (isOpen: boolean) => {\n if (isOpen) onOpen?.()\n else onClose?.()\n }\n\n return (\n <MenuTrigger onOpenChange={handleOpenChange}>\n {trigger}\n <Popover className=\"tds-dropdown-popover\" placement={placement}>\n <Menu id={id}>{items}</Menu>\n </Popover>\n </MenuTrigger>\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\n/**\n * Wraps a single Tapestry dropdown-trigger button and bridges it to React\n * Aria's `MenuTrigger` via `<Pressable>`. Forwards the child's `disabled` /\n * `loading` state to Pressable so it suppresses press wiring on disabled\n * buttons.\n *\n * @component\n */\ntype PressableChild = ComponentProps<typeof Pressable>[\"children\"]\n\nexport function DropdownTrigger({ children }: DropdownTriggerProps) {\n const child = React.Children.only(children) as ReactElement<{\n disabled?: boolean\n loading?: boolean\n }>\n const { disabled, loading } = child.props\n return (\n <Pressable isDisabled={disabled || loading}>\n {children as PressableChild}\n </Pressable>\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 /** Callback fired when the item is activated. */\n onAction: () => void\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 DropdownLinkProps extends DropdownItemBaseProps {\n /** If `true`, sets `target=\"_blank\"` and `rel=\"noreferrer noopener\"`. */\n external?: boolean\n /** Destination URL. */\n href: string\n /**\n * Stable identifier — required by React Aria's collection model for keying\n * and focus tracking.\n */\n id: Key\n}\n\ntype AriaLinkPropsToOmit =\n | \"isDisabled\"\n | \"onAction\"\n | \"rel\"\n | \"target\"\n | \"value\"\ntype AriaLinkPropsToInclude = \"href\" | \"routerOptions\" | \"textValue\"\n\nexport type DropdownLinkElementProps<T extends object = object> =\n CombineAriaPropsWithCustomProps<\n MenuItemProps<T>,\n DropdownLinkProps,\n AriaLinkPropsToOmit,\n AriaLinkPropsToInclude\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 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 />\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":";;;;AAkDA;;;;;;;;;;;;;;;;;AAiBG;AACG,SAAU,QAAQ,CAAC,EACvB,QAAQ,EACR,EAAE,EACF,OAAO,EACP,MAAM,EACN,SAAS,GAAG,cAAc,GACL,EAAA;AACrB,IAAA,MAAM,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,GAAGA,cAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC;AAE5D,IAAA,MAAM,gBAAgB,GAAG,CAAC,MAAe,KAAI;AAC3C,QAAA,IAAI,MAAM;YAAE,MAAM,IAAI;;YACjB,OAAO,IAAI;AAClB,IAAA,CAAC;AAED,IAAA,QACEA,c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AA,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,EAAA,CACD;AAEN;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;;;;"}
@@ -0,0 +1,4 @@
1
+ import "./index.css";
2
+ export type { DropdownActionElementProps, DropdownActionProps, DropdownElementProps, DropdownLinkElementProps, DropdownLinkProps, DropdownPlacement, DropdownProps, DropdownSectionElementProps, DropdownSectionProps, DropdownSeparatorElementProps, DropdownTriggerProps, } from "./Dropdown";
3
+ export { Dropdown, DropdownAction, DropdownLink, DropdownSection, DropdownSeparator, DropdownTrigger, } from "./Dropdown";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,YAAY,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,2BAA2B,EAC3B,oBAAoB,EACpB,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAA"}
@@ -1,6 +1,6 @@
1
- import '../../tapestry-wc/dist/components/p-nyMzpSUR.js';
2
- import { defineCustomElement } from '../../tapestry-wc/dist/components/tds-page-header.js';
3
- import { defineCustomElement as defineCustomElement$1 } from '../../tapestry-wc/dist/components/tds-page-header-nav.js';
1
+ import '../../packages/tapestry-wc/dist/components/p-nyMzpSUR.js';
2
+ import { defineCustomElement } from '../../packages/tapestry-wc/dist/components/tds-page-header.js';
3
+ import { defineCustomElement as defineCustomElement$1 } from '../../packages/tapestry-wc/dist/components/tds-page-header-nav.js';
4
4
 
5
5
  defineCustomElement();
6
6
  defineCustomElement$1();