@planningcenter/tapestry 4.15.0-rc.0 → 4.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DataTable/ActiveFilterInstance.d.ts +6 -0
- package/dist/components/DataTable/ActiveFilterInstance.d.ts.map +1 -1
- package/dist/components/DataTable/ActiveFilterInstance.js +13 -0
- package/dist/components/DataTable/ActiveFilterInstance.js.map +1 -1
- package/dist/components/DataTable/CollectionEditorsLazy.d.ts +1 -1
- package/dist/components/DataTable/CollectionEditorsLazy.d.ts.map +1 -1
- package/dist/components/DataTable/CollectionEditorsLazy.js +2 -2
- package/dist/components/DataTable/CollectionEditorsLazy.js.map +1 -1
- package/dist/components/DataTable/CollectionEditorsShared.d.ts +4 -8
- package/dist/components/DataTable/CollectionEditorsShared.d.ts.map +1 -1
- package/dist/components/DataTable/CollectionEditorsShared.js +2 -2
- package/dist/components/DataTable/CollectionEditorsShared.js.map +1 -1
- package/dist/components/DataTable/CollectionEditorsStatic.d.ts +4 -5
- package/dist/components/DataTable/CollectionEditorsStatic.d.ts.map +1 -1
- package/dist/components/DataTable/CollectionEditorsStatic.js +9 -9
- package/dist/components/DataTable/CollectionEditorsStatic.js.map +1 -1
- package/dist/components/DataTable/DataTable.d.ts +27 -5
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.js +13 -2
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/DataTable/DataTableRow.d.ts +2 -0
- package/dist/components/DataTable/DataTableRow.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableRow.js.map +1 -1
- package/dist/components/DataTable/RowActions.d.ts +7 -3
- package/dist/components/DataTable/RowActions.d.ts.map +1 -1
- package/dist/components/DataTable/RowActions.js +7 -2
- package/dist/components/DataTable/RowActions.js.map +1 -1
- package/dist/components/DataTable/collectionFilter.js +1 -1
- package/dist/components/DataTable/collectionFilter.js.map +1 -1
- package/dist/components/DataTable/dateFilter.js +5 -5
- 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/index.d.ts +1 -1
- package/dist/components/DataTable/index.d.ts.map +1 -1
- package/dist/components/DataTable/numberFilter.js +3 -2
- package/dist/components/DataTable/numberFilter.js.map +1 -1
- package/dist/components/DataTable/scopedFilter.js +5 -1
- package/dist/components/DataTable/scopedFilter.js.map +1 -1
- package/dist/components/DataTable/textFilter.js +1 -1
- package/dist/components/DataTable/textFilter.js.map +1 -1
- package/dist/components/button/ActionsDropdownIconButton.js +2 -2
- 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 +4 -4
- 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.js +31 -31
- package/dist/components/combo-box/ComboBox.js.map +1 -1
- package/dist/components/date-picker/DatePicker.js +42 -42
- 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 +4 -4
- 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/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.js +8 -8
- 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 +696 -657
- package/dist/reactRender.css.map +1 -1
- package/dist/reactRenderLegacy.css +696 -657
- package/dist/reactRenderLegacy.css.map +1 -1
- package/dist/tapestryMount.css +696 -657
- package/dist/tapestryMount.css.map +1 -1
- package/dist/tapestryMountLegacy.css +696 -657
- package/dist/tapestryMountLegacy.css.map +1 -1
- package/dist/unstable.css +45 -6
- 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.js +34 -5
- package/dist/utilities/locale.js.map +1 -1
- package/docs/components/DataTable.md +23 -5
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DropdownTriggerContext } from '../dropdown/DropdownTriggerContext.js';
|
|
2
|
-
import
|
|
2
|
+
import React__default, { forwardRef, useContext } from 'react';
|
|
3
3
|
import { dropdownProps } from './DropdownButton.js';
|
|
4
4
|
import { IconButton } from './IconButton.js';
|
|
5
5
|
|
|
@@ -15,7 +15,7 @@ import { IconButton } from './IconButton.js';
|
|
|
15
15
|
*/
|
|
16
16
|
const DropdownIconButton = forwardRef((props, ref) => {
|
|
17
17
|
const contextProps = useContext(DropdownTriggerContext);
|
|
18
|
-
return (
|
|
18
|
+
return (React__default.createElement(IconButton, { ref: ref, ...props, ...contextProps, ...dropdownProps(props) }));
|
|
19
19
|
});
|
|
20
20
|
DropdownIconButton.displayName = "DropdownIconButton";
|
|
21
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownIconButton.js","sources":["../../../src/components/button/DropdownIconButton.tsx"],"sourcesContent":["import { DropdownTriggerContext } from \"@components/dropdown/DropdownTriggerContext\"\nimport React, { forwardRef, useContext } from \"react\"\n\nimport { DropdownButtonProps, dropdownProps } from \"./DropdownButton\"\nimport { IconButton, IconButtonProps } from \"./IconButton\"\n\n/**\n * An icon-only button that toggles a dropdown menu or popover. Appends a\n * caret suffix to the icon and wires up `aria-controls` and `aria-expanded`\n * to the controlled element. Requires an `aria-label` or `tooltip` for\n * accessibility.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/buttons-dropdown-icon-button--docs | Storybook Documentation}\n * @see {@link https://github.com/planningcenter/tapestry/tree/main/packages/tapestry-migration-cli | Migration CLI: Available}\n */\nexport const DropdownIconButton = forwardRef<\n HTMLButtonElement,\n IconButtonProps & DropdownButtonProps\n>((props, ref) => {\n const contextProps = useContext(DropdownTriggerContext)\n return (\n <IconButton\n ref={ref}\n {...props}\n {...contextProps}\n {...dropdownProps(props)}\n />\n )\n})\n\nDropdownIconButton.displayName = \"DropdownIconButton\"\n"],"names":[],"mappings":";;;;;AAMA;;;;;;;;;AASG;AACI,MAAM,kBAAkB,GAAG,UAAU,CAG1C,CAAC,KAAK,EAAE,GAAG,KAAI;AACf,IAAA,MAAM,YAAY,GAAG,UAAU,CAAC,sBAAsB,CAAC;AACvD,IAAA,
|
|
1
|
+
{"version":3,"file":"DropdownIconButton.js","sources":["../../../src/components/button/DropdownIconButton.tsx"],"sourcesContent":["import { DropdownTriggerContext } from \"@components/dropdown/DropdownTriggerContext\"\nimport React, { forwardRef, useContext } from \"react\"\n\nimport { DropdownButtonProps, dropdownProps } from \"./DropdownButton\"\nimport { IconButton, IconButtonProps } from \"./IconButton\"\n\n/**\n * An icon-only button that toggles a dropdown menu or popover. Appends a\n * caret suffix to the icon and wires up `aria-controls` and `aria-expanded`\n * to the controlled element. Requires an `aria-label` or `tooltip` for\n * accessibility.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/buttons-dropdown-icon-button--docs | Storybook Documentation}\n * @see {@link https://github.com/planningcenter/tapestry/tree/main/packages/tapestry-migration-cli | Migration CLI: Available}\n */\nexport const DropdownIconButton = forwardRef<\n HTMLButtonElement,\n IconButtonProps & DropdownButtonProps\n>((props, ref) => {\n const contextProps = useContext(DropdownTriggerContext)\n return (\n <IconButton\n ref={ref}\n {...props}\n {...contextProps}\n {...dropdownProps(props)}\n />\n )\n})\n\nDropdownIconButton.displayName = \"DropdownIconButton\"\n"],"names":["React"],"mappings":";;;;;AAMA;;;;;;;;;AASG;AACI,MAAM,kBAAkB,GAAG,UAAU,CAG1C,CAAC,KAAK,EAAE,GAAG,KAAI;AACf,IAAA,MAAM,YAAY,GAAG,UAAU,CAAC,sBAAsB,CAAC;AACvD,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,UAAU,IACT,GAAG,EAAE,GAAG,EAAA,GACJ,KAAK,EAAA,GACL,YAAY,KACZ,aAAa,CAAC,KAAK,CAAC,EAAA,CACxB;AAEN,CAAC;AAED,kBAAkB,CAAC,WAAW,GAAG,oBAAoB;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Tooltip } from '../internal/tooltip/Tooltip.js';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import
|
|
3
|
+
import React__default, { forwardRef } from 'react';
|
|
4
4
|
import { BaseButton } from './BaseButton.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -15,10 +15,10 @@ const IconButton = forwardRef(({ className, icon, tooltip, tooltipPlacement = "b
|
|
|
15
15
|
const iconOnlyClassName = classNames("tds-btn--icononly", className);
|
|
16
16
|
if (tooltip?.trim()) {
|
|
17
17
|
const { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...buttonProps } = restProps;
|
|
18
|
-
return (
|
|
19
|
-
|
|
18
|
+
return (React__default.createElement(Tooltip, { content: tooltip, placement: tooltipPlacement, visualOnly: true },
|
|
19
|
+
React__default.createElement(BaseButton, { ...buttonProps, "aria-label": ariaLabel || tooltip, label: icon, className: iconOnlyClassName, ref: ref })));
|
|
20
20
|
}
|
|
21
|
-
return (
|
|
21
|
+
return (React__default.createElement(BaseButton, { ...restProps, label: icon, className: iconOnlyClassName, ref: ref }));
|
|
22
22
|
});
|
|
23
23
|
IconButton.displayName = "IconButton";
|
|
24
24
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sources":["../../../src/components/button/IconButton.tsx"],"sourcesContent":["import \"./btn.css\"\n\nimport { Tooltip, type TooltipPlacement } from \"@components/internal/tooltip\"\nimport classNames from \"classnames\"\nimport React, { forwardRef } from \"react\"\n\nimport { BaseButton, BaseButtonElementProps } from \"./BaseButton\"\n\ntype IconButtonSharedProps = Omit<BaseButtonElementProps, \"label\"> & {\n /** The icon to display in the button. Set via story args for non-primitive values. */\n icon: React.ReactNode\n}\n\nexport type IconButtonBaseProps = IconButtonSharedProps & {\n /** Accessible label. Required for icon-only buttons to provide context about the button's purpose. */\n \"aria-label\": string\n}\n\ntype IconButtonTooltipProps = {\n /** Accessible label. Required for icon-only buttons to provide context about the button's purpose. Not required when `tooltip` is set. When both are set, this is the name and the tooltip is visual only. */\n \"aria-label\"?: string\n /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `\"Delete\"`, aria-label `\"Delete, 3 selected\"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. Never opens on hover while `disabled` or `loading`, and opens on keyboard focus only with `focusableWhenDisabled`, so don't rely on it to explain why the button is disabled. */\n tooltip: string\n}\n\ntype IconButtonAriaLabelProps = {\n /** Accessible label. Required for icon-only buttons to provide context about the button's purpose. Not required when `tooltip` is set. When both are set, this is the name and the tooltip is visual only. */\n \"aria-label\": string\n /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `\"Delete\"`, aria-label `\"Delete, 3 selected\"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. Never opens on hover while `disabled` or `loading`, and opens on keyboard focus only with `focusableWhenDisabled`, so don't rely on it to explain why the button is disabled. */\n tooltip?: string\n}\n\n/**\n * An icon-only button needs a name: `aria-label`, `tooltip`, or both.\n * `IconButtonAriaLabelProps` is declared last so that a missing name\n * reports \"aria-label is missing\", not \"tooltip is missing\".\n */\ntype IconButtonNameProps = IconButtonAriaLabelProps | IconButtonTooltipProps\n\nexport type IconButtonProps = IconButtonSharedProps &\n IconButtonNameProps & {\n /** Where the tooltip renders relative to the button. Default `\"bottom\"`. Has no effect without `tooltip`. */\n tooltipPlacement?: TooltipPlacement\n }\n\n/**\n * An icon-only button component that renders as a button element.\n * Requires an icon, and an aria-label or tooltip for accessibility.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/buttons-icon-button--docs | Storybook Documentation}\n * @see {@link https://github.com/planningcenter/tapestry/tree/main/packages/tapestry-migration-cli | Migration CLI: Available}\n */\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n className,\n icon,\n tooltip,\n tooltipPlacement = \"bottom\",\n ...restProps\n }: IconButtonProps,\n ref\n ) => {\n const iconOnlyClassName = classNames(\"tds-btn--icononly\", className)\n\n if (tooltip?.trim()) {\n const {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...buttonProps\n } = restProps\n\n return (\n <Tooltip content={tooltip} placement={tooltipPlacement} visualOnly>\n <BaseButton\n {...buttonProps}\n aria-label={ariaLabel || tooltip}\n label={icon}\n className={iconOnlyClassName}\n ref={ref}\n />\n </Tooltip>\n )\n }\n\n return (\n <BaseButton\n {...restProps}\n label={icon}\n className={iconOnlyClassName}\n ref={ref}\n />\n )\n }\n)\n\nIconButton.displayName = \"IconButton\"\n"],"names":[],"mappings":";;;;;AA6CA;;;;;;;AAOG;AACI,MAAM,UAAU,GAAG,UAAU,CAClC,CACE,EACE,SAAS,EACT,IAAI,EACJ,OAAO,EACP,gBAAgB,GAAG,QAAQ,EAC3B,GAAG,SAAS,EACI,EAClB,GAAG,KACD;IACF,MAAM,iBAAiB,GAAG,UAAU,CAAC,mBAAmB,EAAE,SAAS,CAAC;AAEpE,IAAA,IAAI,OAAO,EAAE,IAAI,EAAE,EAAE;AACnB,QAAA,MAAM,EACJ,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,GAAG,WAAW,EACf,GAAG,SAAS;AAEb,QAAA,
|
|
1
|
+
{"version":3,"file":"IconButton.js","sources":["../../../src/components/button/IconButton.tsx"],"sourcesContent":["import \"./btn.css\"\n\nimport { Tooltip, type TooltipPlacement } from \"@components/internal/tooltip\"\nimport classNames from \"classnames\"\nimport React, { forwardRef } from \"react\"\n\nimport { BaseButton, BaseButtonElementProps } from \"./BaseButton\"\n\ntype IconButtonSharedProps = Omit<BaseButtonElementProps, \"label\"> & {\n /** The icon to display in the button. Set via story args for non-primitive values. */\n icon: React.ReactNode\n}\n\nexport type IconButtonBaseProps = IconButtonSharedProps & {\n /** Accessible label. Required for icon-only buttons to provide context about the button's purpose. */\n \"aria-label\": string\n}\n\ntype IconButtonTooltipProps = {\n /** Accessible label. Required for icon-only buttons to provide context about the button's purpose. Not required when `tooltip` is set. When both are set, this is the name and the tooltip is visual only. */\n \"aria-label\"?: string\n /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `\"Delete\"`, aria-label `\"Delete, 3 selected\"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. Never opens on hover while `disabled` or `loading`, and opens on keyboard focus only with `focusableWhenDisabled`, so don't rely on it to explain why the button is disabled. */\n tooltip: string\n}\n\ntype IconButtonAriaLabelProps = {\n /** Accessible label. Required for icon-only buttons to provide context about the button's purpose. Not required when `tooltip` is set. When both are set, this is the name and the tooltip is visual only. */\n \"aria-label\": string\n /** Text shown on hover and focus. Without `aria-label`, it is also used as the `aria-label`. With `aria-label`, start the `aria-label` with the same text (e.g. tooltip `\"Delete\"`, aria-label `\"Delete, 3 selected\"`). The tooltip itself is hidden from screen readers. Ignores `aria-labelledby`. Never opens on hover while `disabled` or `loading`, and opens on keyboard focus only with `focusableWhenDisabled`, so don't rely on it to explain why the button is disabled. */\n tooltip?: string\n}\n\n/**\n * An icon-only button needs a name: `aria-label`, `tooltip`, or both.\n * `IconButtonAriaLabelProps` is declared last so that a missing name\n * reports \"aria-label is missing\", not \"tooltip is missing\".\n */\ntype IconButtonNameProps = IconButtonAriaLabelProps | IconButtonTooltipProps\n\nexport type IconButtonProps = IconButtonSharedProps &\n IconButtonNameProps & {\n /** Where the tooltip renders relative to the button. Default `\"bottom\"`. Has no effect without `tooltip`. */\n tooltipPlacement?: TooltipPlacement\n }\n\n/**\n * An icon-only button component that renders as a button element.\n * Requires an icon, and an aria-label or tooltip for accessibility.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/buttons-icon-button--docs | Storybook Documentation}\n * @see {@link https://github.com/planningcenter/tapestry/tree/main/packages/tapestry-migration-cli | Migration CLI: Available}\n */\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n className,\n icon,\n tooltip,\n tooltipPlacement = \"bottom\",\n ...restProps\n }: IconButtonProps,\n ref\n ) => {\n const iconOnlyClassName = classNames(\"tds-btn--icononly\", className)\n\n if (tooltip?.trim()) {\n const {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...buttonProps\n } = restProps\n\n return (\n <Tooltip content={tooltip} placement={tooltipPlacement} visualOnly>\n <BaseButton\n {...buttonProps}\n aria-label={ariaLabel || tooltip}\n label={icon}\n className={iconOnlyClassName}\n ref={ref}\n />\n </Tooltip>\n )\n }\n\n return (\n <BaseButton\n {...restProps}\n label={icon}\n className={iconOnlyClassName}\n ref={ref}\n />\n )\n }\n)\n\nIconButton.displayName = \"IconButton\"\n"],"names":["React"],"mappings":";;;;;AA6CA;;;;;;;AAOG;AACI,MAAM,UAAU,GAAG,UAAU,CAClC,CACE,EACE,SAAS,EACT,IAAI,EACJ,OAAO,EACP,gBAAgB,GAAG,QAAQ,EAC3B,GAAG,SAAS,EACI,EAClB,GAAG,KACD;IACF,MAAM,iBAAiB,GAAG,UAAU,CAAC,mBAAmB,EAAE,SAAS,CAAC;AAEpE,IAAA,IAAI,OAAO,EAAE,IAAI,EAAE,EAAE;AACnB,QAAA,MAAM,EACJ,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,GAAG,WAAW,EACf,GAAG,SAAS;AAEb,QAAA,QACEA,cAAA,CAAA,aAAA,CAAC,OAAO,EAAA,EAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAA,IAAA,EAAA;YAChEA,cAAA,CAAA,aAAA,CAAC,UAAU,OACL,WAAW,EAAA,YAAA,EACH,SAAS,IAAI,OAAO,EAChC,KAAK,EAAE,IAAI,EACX,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,GAAG,EAAA,CACR,CACM;IAEd;AAEA,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,UAAU,OACL,SAAS,EACb,KAAK,EAAE,IAAI,EACX,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,GAAG,EAAA,CACR;AAEN,CAAC;AAGH,UAAU,CAAC,WAAW,GAAG,YAAY;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { forwardRef } from 'react';
|
|
2
2
|
import { BaseButton } from './BaseButton.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -19,7 +19,7 @@ import { BaseButton } from './BaseButton.js';
|
|
|
19
19
|
* @see {@link https://planningcenter.github.io/tapestry/?path=/docs/deprecated-loadingbutton--docs | Storybook Documentation}
|
|
20
20
|
*/
|
|
21
21
|
const LoadingButton = forwardRef((props, ref) => {
|
|
22
|
-
return
|
|
22
|
+
return React__default.createElement(BaseButton, { ...props, ref: ref });
|
|
23
23
|
});
|
|
24
24
|
LoadingButton.displayName = "LoadingButton";
|
|
25
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingButton.js","sources":["../../../src/components/button/LoadingButton.tsx"],"sourcesContent":["import \"./btn.css\"\n\nimport React, { forwardRef } from \"react\"\n\nimport { BaseButton, BaseButtonElementProps } from \"./BaseButton\"\n\n/**\n * @deprecated Use ButtonElementProps with loading prop instead. LoadingButton will be removed in a future version.\n */\nexport interface LoadingButtonProps extends BaseButtonElementProps {\n /** Whether the button is in a loading state. When true, the button is disabled and shows a loading spinner. */\n loading?: boolean\n /** Accessible label to use when the button is in loading state. */\n loadingAriaLabel?: string\n}\n\n/**\n * @deprecated Use Button with loading prop instead. LoadingButton will be removed in a future version.\n *\n * A loading button component that shows a loading indicator when the loading prop is true.\n * When loading, the button is automatically disabled and shows a spinner.\n * Supports all BaseButton props including prefix and suffix.\n *\n * @example\n * // Deprecated\n * <LoadingButton loading={true} label=\"Submit\" />\n *\n * // Use this instead:\n * <Button loading={true} label=\"Submit\" />\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/deprecated-loadingbutton--docs | Storybook Documentation}\n */\nexport const LoadingButton = forwardRef<HTMLButtonElement, LoadingButtonProps>(\n (props, ref) => {\n return <BaseButton {...props} ref={ref} />\n }\n)\n\nLoadingButton.displayName = \"LoadingButton\"\n"],"names":[],"mappings":";;;AAgBA;;;;;;;;;;;;;;;;AAgBG;AACI,MAAM,aAAa,GAAG,UAAU,CACrC,CAAC,KAAK,EAAE,GAAG,KAAI;IACb,
|
|
1
|
+
{"version":3,"file":"LoadingButton.js","sources":["../../../src/components/button/LoadingButton.tsx"],"sourcesContent":["import \"./btn.css\"\n\nimport React, { forwardRef } from \"react\"\n\nimport { BaseButton, BaseButtonElementProps } from \"./BaseButton\"\n\n/**\n * @deprecated Use ButtonElementProps with loading prop instead. LoadingButton will be removed in a future version.\n */\nexport interface LoadingButtonProps extends BaseButtonElementProps {\n /** Whether the button is in a loading state. When true, the button is disabled and shows a loading spinner. */\n loading?: boolean\n /** Accessible label to use when the button is in loading state. */\n loadingAriaLabel?: string\n}\n\n/**\n * @deprecated Use Button with loading prop instead. LoadingButton will be removed in a future version.\n *\n * A loading button component that shows a loading indicator when the loading prop is true.\n * When loading, the button is automatically disabled and shows a spinner.\n * Supports all BaseButton props including prefix and suffix.\n *\n * @example\n * // Deprecated\n * <LoadingButton loading={true} label=\"Submit\" />\n *\n * // Use this instead:\n * <Button loading={true} label=\"Submit\" />\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/deprecated-loadingbutton--docs | Storybook Documentation}\n */\nexport const LoadingButton = forwardRef<HTMLButtonElement, LoadingButtonProps>(\n (props, ref) => {\n return <BaseButton {...props} ref={ref} />\n }\n)\n\nLoadingButton.displayName = \"LoadingButton\"\n"],"names":["React"],"mappings":";;;AAgBA;;;;;;;;;;;;;;;;AAgBG;AACI,MAAM,aAAa,GAAG,UAAU,CACrC,CAAC,KAAK,EAAE,GAAG,KAAI;IACb,OAAOA,cAAA,CAAA,aAAA,CAAC,UAAU,EAAA,EAAA,GAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAA,CAAI;AAC5C,CAAC;AAGH,aAAa,CAAC,WAAW,GAAG,eAAe;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import
|
|
2
|
+
import React__default, { forwardRef } from 'react';
|
|
3
3
|
import { DropdownButton } from './DropdownButton.js';
|
|
4
4
|
|
|
5
5
|
function needsAttentionProps({ className, needsAttention, }) {
|
|
6
6
|
return needsAttention
|
|
7
7
|
? {
|
|
8
8
|
className: classNames(className, "tds-btn--attention"),
|
|
9
|
-
prefix: (
|
|
9
|
+
prefix: (React__default.createElement("span", { className: "attention-icon", "aria-label": "Needs attention!" })),
|
|
10
10
|
}
|
|
11
11
|
: {
|
|
12
12
|
className,
|
|
@@ -21,7 +21,7 @@ function needsAttentionProps({ className, needsAttention, }) {
|
|
|
21
21
|
* @see {@link https://planningcenter.github.io/tapestry/?path=/docs/application-admin-page-header-actions-dropdown-button--docs | Storybook Documentation}
|
|
22
22
|
*/
|
|
23
23
|
const PageHeaderActionsDropdownButton = forwardRef(({ className, needsAttention, ...props }, ref) => {
|
|
24
|
-
return (
|
|
24
|
+
return (React__default.createElement(DropdownButton, { ref: ref, ...props, kind: "secondary-page-header", ...needsAttentionProps({ className, needsAttention }) }));
|
|
25
25
|
});
|
|
26
26
|
PageHeaderActionsDropdownButton.displayName = "PageHeaderActionsDropdownButton";
|
|
27
27
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeaderActionsDropdownButton.js","sources":["../../../src/components/button/PageHeaderActionsDropdownButton.tsx"],"sourcesContent":["import \"./btn.css\"\n\nimport classNames from \"classnames\"\nimport React, { forwardRef } from \"react\"\n\nimport { BaseButtonElementProps } from \"./BaseButton\"\nimport { DropdownButton, DropdownButtonProps } from \"./DropdownButton\"\n\nexport type PageHeaderActionsDropdownButtonProps = Omit<\n BaseButtonElementProps,\n \"kind\"\n> &\n DropdownButtonProps & {\n /** Whether the button needs attention. Adds warning styling and attention icon when true. */\n needsAttention?: boolean\n }\n\nexport function needsAttentionProps({\n className,\n needsAttention,\n}: {\n className?: string\n needsAttention?: boolean\n}) {\n return needsAttention\n ? {\n className: classNames(className, \"tds-btn--attention\"),\n prefix: (\n <span className=\"attention-icon\" aria-label=\"Needs attention!\" />\n ),\n }\n : {\n className,\n }\n}\n\n/**\n * A dropdown button styled for the page header actions area. Renders with\n * the `secondary-page-header` kind and supports an optional `needsAttention`\n * state that adds warning styling and an attention icon.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/application-admin-page-header-actions-dropdown-button--docs | Storybook Documentation}\n */\nexport const PageHeaderActionsDropdownButton = forwardRef<\n HTMLButtonElement,\n PageHeaderActionsDropdownButtonProps\n>(\n (\n {\n className,\n needsAttention,\n ...props\n }: PageHeaderActionsDropdownButtonProps,\n ref\n ) => {\n return (\n <DropdownButton\n ref={ref}\n {...props}\n kind=\"secondary-page-header\"\n {...needsAttentionProps({ className, needsAttention })}\n />\n )\n }\n)\n\nPageHeaderActionsDropdownButton.displayName = \"PageHeaderActionsDropdownButton\"\n"],"names":[],"mappings":";;;;SAiBgB,mBAAmB,CAAC,EAClC,SAAS,EACT,cAAc,GAIf,EAAA;AACC,IAAA,OAAO;AACL,UAAE;AACE,YAAA,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,oBAAoB,CAAC;YACtD,MAAM,
|
|
1
|
+
{"version":3,"file":"PageHeaderActionsDropdownButton.js","sources":["../../../src/components/button/PageHeaderActionsDropdownButton.tsx"],"sourcesContent":["import \"./btn.css\"\n\nimport classNames from \"classnames\"\nimport React, { forwardRef } from \"react\"\n\nimport { BaseButtonElementProps } from \"./BaseButton\"\nimport { DropdownButton, DropdownButtonProps } from \"./DropdownButton\"\n\nexport type PageHeaderActionsDropdownButtonProps = Omit<\n BaseButtonElementProps,\n \"kind\"\n> &\n DropdownButtonProps & {\n /** Whether the button needs attention. Adds warning styling and attention icon when true. */\n needsAttention?: boolean\n }\n\nexport function needsAttentionProps({\n className,\n needsAttention,\n}: {\n className?: string\n needsAttention?: boolean\n}) {\n return needsAttention\n ? {\n className: classNames(className, \"tds-btn--attention\"),\n prefix: (\n <span className=\"attention-icon\" aria-label=\"Needs attention!\" />\n ),\n }\n : {\n className,\n }\n}\n\n/**\n * A dropdown button styled for the page header actions area. Renders with\n * the `secondary-page-header` kind and supports an optional `needsAttention`\n * state that adds warning styling and an attention icon.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/application-admin-page-header-actions-dropdown-button--docs | Storybook Documentation}\n */\nexport const PageHeaderActionsDropdownButton = forwardRef<\n HTMLButtonElement,\n PageHeaderActionsDropdownButtonProps\n>(\n (\n {\n className,\n needsAttention,\n ...props\n }: PageHeaderActionsDropdownButtonProps,\n ref\n ) => {\n return (\n <DropdownButton\n ref={ref}\n {...props}\n kind=\"secondary-page-header\"\n {...needsAttentionProps({ className, needsAttention })}\n />\n )\n }\n)\n\nPageHeaderActionsDropdownButton.displayName = \"PageHeaderActionsDropdownButton\"\n"],"names":["React"],"mappings":";;;;SAiBgB,mBAAmB,CAAC,EAClC,SAAS,EACT,cAAc,GAIf,EAAA;AACC,IAAA,OAAO;AACL,UAAE;AACE,YAAA,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,oBAAoB,CAAC;YACtD,MAAM,GACJA,cAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,gBAAgB,EAAA,YAAA,EAAY,kBAAkB,EAAA,CAAG,CAClE;AACF;AACH,UAAE;YACE,SAAS;SACV;AACP;AAEA;;;;;;;AAOG;AACI,MAAM,+BAA+B,GAAG,UAAU,CAIvD,CACE,EACE,SAAS,EACT,cAAc,EACd,GAAG,KAAK,EAC6B,EACvC,GAAG,KACD;IACF,QACEA,cAAA,CAAA,aAAA,CAAC,cAAc,EAAA,EACb,GAAG,EAAE,GAAG,EAAA,GACJ,KAAK,EACT,IAAI,EAAC,uBAAuB,EAAA,GACxB,mBAAmB,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,EAAA,CACtD;AAEN,CAAC;AAGH,+BAA+B,CAAC,WAAW,GAAG,iCAAiC;;;;"}
|
|
@@ -11,7 +11,7 @@ import Icon from '../../utilities/Icon.js';
|
|
|
11
11
|
import { useAnnounce } from '../../utilities/useAnnounce.js';
|
|
12
12
|
import { useId } from '../../utilities/useId.js';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
-
import
|
|
14
|
+
import React__default, { useContext, useEffect } from 'react';
|
|
15
15
|
import { ListBoxLoadMoreItem, ComboBox as ComboBox$1, Label, Button, Popover, ListBox, Text, ListBoxItem, ListBoxSection, ComboBoxStateContext, Input, Collection } from 'react-aria-components/ComboBox';
|
|
16
16
|
import { Group } from 'react-aria-components/Group';
|
|
17
17
|
import { Header } from 'react-aria-components/Header';
|
|
@@ -21,7 +21,7 @@ function resolveEmptyState(value) {
|
|
|
21
21
|
}
|
|
22
22
|
function ClearButton() {
|
|
23
23
|
const state = useContext(ComboBoxStateContext);
|
|
24
|
-
return (
|
|
24
|
+
return (React__default.createElement(IconButton, { "aria-label": "Clear", className: "tds-combo-box-clear-button", "data-input-empty": !state?.inputValue ? true : undefined, icon: React__default.createElement(Icon, { "aria-hidden": true, className: "tds-combo-box-clear-icon", symbol: "general#x" }), kind: "neutral-inline", onClick: () => state?.setInputValue(""), onMouseDown: (event) => event.preventDefault(), tabIndex: -1 }));
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* In multiple selection mode, Tab closes the list without changing the
|
|
@@ -30,7 +30,7 @@ function ClearButton() {
|
|
|
30
30
|
*/
|
|
31
31
|
function ComboBoxInput(props) {
|
|
32
32
|
const state = useContext(ComboBoxStateContext);
|
|
33
|
-
return (
|
|
33
|
+
return (React__default.createElement(Input, { ...props, onKeyDownCapture: (event) => {
|
|
34
34
|
if (event.key === "Tab" &&
|
|
35
35
|
state?.isOpen &&
|
|
36
36
|
state.selectionManager.selectionMode === "multiple") {
|
|
@@ -51,7 +51,7 @@ function FilteringAnnouncement() {
|
|
|
51
51
|
const state = useContext(ComboBoxStateContext);
|
|
52
52
|
if (!state?.isOpen)
|
|
53
53
|
return null;
|
|
54
|
-
return
|
|
54
|
+
return React__default.createElement(LoadingAnnouncement, { key: state.inputValue, message: "Loading" });
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* A combo box combines a text input with a filterable popover
|
|
@@ -72,13 +72,13 @@ function ComboBox({ allowsEmptyCollection = true, children, className, descripti
|
|
|
72
72
|
"tds-combo-box--lg": size === "lg",
|
|
73
73
|
"tds-field--lg": size === "lg",
|
|
74
74
|
}, className);
|
|
75
|
-
const loadMoreItem = onLoadMore && (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
const loadMoreItem = onLoadMore && (React__default.createElement(ListBoxLoadMoreItem, { className: "tds-combo-box-load-more", isLoading: loadingState === "loadingMore", onLoadMore: onLoadMore },
|
|
76
|
+
React__default.createElement("span", { className: "tds-combo-box-loading-label--hidden" }, "Loading more"),
|
|
77
|
+
React__default.createElement(LoadingSpinner, null),
|
|
78
|
+
React__default.createElement(LoadingAnnouncement, { message: "Loading more" })));
|
|
79
79
|
const renderChildren = () => {
|
|
80
80
|
if (typeof children === "function") {
|
|
81
|
-
return (
|
|
81
|
+
return (React__default.createElement(Collection, { items: restProps.items ?? restProps.defaultItems }, children));
|
|
82
82
|
}
|
|
83
83
|
return children;
|
|
84
84
|
};
|
|
@@ -89,31 +89,31 @@ function ComboBox({ allowsEmptyCollection = true, children, className, descripti
|
|
|
89
89
|
// of function types (to allow narrower handlers like
|
|
90
90
|
// `setValue: (Key|null) => void`), which isn't assignable to RAC's
|
|
91
91
|
// single-function signature.
|
|
92
|
-
|
|
93
|
-
!hideLabel &&
|
|
94
|
-
|
|
95
|
-
showSearchIcon && (
|
|
96
|
-
|
|
97
|
-
menuTrigger !== "focus" && !readOnly && (
|
|
98
|
-
|
|
92
|
+
React__default.createElement(ComboBox$1, { ...restProps, allowsEmptyCollection: allowsEmptyCollection, "aria-label": hideLabel ? label : undefined, className: combinedClassName, defaultFilter: filter, isDisabled: disabled, isReadOnly: readOnly, isRequired: required, menuTrigger: menuTrigger, onChange: onChange },
|
|
93
|
+
!hideLabel && React__default.createElement(Label, { className: "tds-field-label" }, label),
|
|
94
|
+
React__default.createElement(Group, { className: "tds-field-control tds-combo-box-field" },
|
|
95
|
+
showSearchIcon && (React__default.createElement(Icon, { "aria-hidden": true, className: "tds-combo-box-search-icon", symbol: "general#search" })),
|
|
96
|
+
React__default.createElement(ComboBoxInput, { "aria-invalid": invalid || undefined, className: "tds-combo-box-input", placeholder: placeholder }),
|
|
97
|
+
menuTrigger !== "focus" && !readOnly && (React__default.createElement(Button, { className: "tds-combo-box-button tds-btn tds-btn--infield" },
|
|
98
|
+
React__default.createElement(Icon, { "aria-hidden": true, symbol: "general#down-caret" }))),
|
|
99
99
|
showClearButton &&
|
|
100
100
|
menuTrigger === "focus" &&
|
|
101
101
|
!readOnly &&
|
|
102
|
-
!disabled &&
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
? () => (
|
|
106
|
-
loadingState === "error" && (
|
|
107
|
-
loadingState === "loading" ? (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
!disabled && React__default.createElement(ClearButton, null)),
|
|
103
|
+
React__default.createElement(Popover, { className: "tds-combo-box-popover" },
|
|
104
|
+
React__default.createElement(ListBox, { className: "tds-combo-box-list", renderEmptyState: allowsEmptyCollection
|
|
105
|
+
? () => (React__default.createElement("div", { className: "tds-combo-box-empty-state", id: emptyStateId },
|
|
106
|
+
loadingState === "error" && (React__default.createElement(ErrorAnnouncement, { labelledBy: emptyStateId })),
|
|
107
|
+
loadingState === "loading" ? (React__default.createElement(React__default.Fragment, null,
|
|
108
|
+
React__default.createElement("span", { className: "tds-combo-box-loading-label--hidden" }, "Loading"),
|
|
109
|
+
React__default.createElement(LoadingSpinner, null),
|
|
110
|
+
React__default.createElement(LoadingAnnouncement, { message: "Loading" }))) : (resolveEmptyState(renderEmptyState))))
|
|
111
111
|
: undefined },
|
|
112
112
|
renderChildren(),
|
|
113
113
|
loadMoreItem),
|
|
114
|
-
loadingState === "filtering" &&
|
|
115
|
-
description && (
|
|
116
|
-
|
|
114
|
+
loadingState === "filtering" && React__default.createElement(FilteringAnnouncement, null)),
|
|
115
|
+
description && (React__default.createElement(Text, { className: "tds-field-description", slot: "description" },
|
|
116
|
+
React__default.createElement(Icon, { "aria-hidden": true, className: "tds-field-description-invalid-icon", symbol: "general#exclamation-triangle" }),
|
|
117
117
|
description))));
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
@@ -127,7 +127,7 @@ function ComboBox({ allowsEmptyCollection = true, children, className, descripti
|
|
|
127
127
|
* @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-combobox--docs | Storybook Documentation}
|
|
128
128
|
*/
|
|
129
129
|
function ComboBoxItem({ className, disabled, ...restProps }) {
|
|
130
|
-
return (
|
|
130
|
+
return (React__default.createElement(ListBoxItem, { ...restProps, className: classNames("tds-combo-box-list-item", className), isDisabled: disabled }));
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
133
|
* A group of related {@link ComboBoxItem}s within a {@link ComboBox}. Renders
|
|
@@ -137,8 +137,8 @@ function ComboBoxItem({ className, disabled, ...restProps }) {
|
|
|
137
137
|
* @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-combobox--docs | Storybook Documentation}
|
|
138
138
|
*/
|
|
139
139
|
function ComboBoxSection({ children, className, title, ...restProps }) {
|
|
140
|
-
return (
|
|
141
|
-
title && (
|
|
140
|
+
return (React__default.createElement(ListBoxSection, { ...restProps, className: classNames("tds-combo-box-list-section", className) },
|
|
141
|
+
title && (React__default.createElement(Header, { className: "tds-combo-box-section-header" }, title)),
|
|
142
142
|
children));
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboBox.js","sources":["../../../src/components/combo-box/ComboBox.tsx"],"sourcesContent":["import \"../button/btn.css\"\nimport \"../field/index.css\"\nimport \"./index.css\"\n\nimport { IconButton } from \"@components/button\"\nimport {\n LOADING_ANNOUNCEMENT_DELAY_MS,\n LoadingAnnouncement,\n} from \"@components/internal/LoadingAnnouncement\"\nimport LoadingSpinner from \"@components/internal/LoadingSpinner\"\nimport Icon from \"@utilities/Icon\"\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport { useAnnounce } from \"@utilities/useAnnounce\"\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, { type ReactNode, useContext, useEffect } from \"react\"\nimport {\n Button,\n Collection,\n ComboBox as AriaComboBox,\n type ComboBoxProps as AriaComboBoxProps,\n ComboBoxStateContext,\n Input,\n type Key,\n Label,\n ListBox,\n ListBoxItem,\n type ListBoxItemProps,\n ListBoxLoadMoreItem,\n type ListBoxProps as AriaListBoxProps,\n ListBoxSection,\n type ListBoxSectionProps,\n Popover,\n Text,\n} from \"react-aria-components/ComboBox\"\nimport { Group } from \"react-aria-components/Group\"\nimport { Header } from \"react-aria-components/Header\"\n\nexport type ComboBoxSize = \"md\" | \"lg\"\n\nexport type ComboBoxLoadingState =\n | \"error\"\n | \"filtering\"\n | \"idle\"\n | \"loading\"\n | \"loadingMore\"\n | \"sorting\"\n\ntype ComboBoxChildren<T extends object> = NonNullable<\n AriaListBoxProps<T>[\"children\"]\n>\n\nexport interface ComboBoxProps<T extends object = object> {\n /**\n * If `true`, keeps typed text that does not match an option. Turn it on when\n * ComboBox is a standalone search and the suggestions are shortcuts. Leave it\n * off in forms, where the value needs to match one of the options.\n */\n allowsCustomValue?: boolean\n /** The contents of the listbox. */\n children: ComboBoxChildren<T>\n /** Helper text displayed below the component. Styled as error text when `invalid` is `true`. */\n description?: ReactNode\n /** Disables the field and trigger button. */\n disabled?: boolean\n /** Custom filter function for determining if an item should appear in the list. */\n filter?: (textValue: string, inputValue: string) => boolean\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 /** Accessible label for the field. */\n label: string\n /**\n * Async loading state for the listbox.\n * - `\"loading\"`: while the collection is empty, replaces the empty state with a spinner.\n * - `\"loadingMore\"`: shows an inline spinner at the bottom of the listbox (use with `onLoadMore`).\n * - `\"filtering\"`: renders as `\"idle\"`, but tells screen reader users \"Loading\" when results are slow to arrive after typing stops.\n * - `\"error\"`: renders as `\"idle\"`, but reads the empty state (`renderEmptyState`) to screen reader users while the collection is empty.\n * - Other values render as `\"idle\"`.\n */\n loadingState?: ComboBoxLoadingState\n /**\n * The interaction that opens the popover.\n * - `\"input\"`: opens when the user enters text in the input.\n * - `\"focus\"`: opens when the user focuses (via click or keyboard) into the input.\n * - `\"manual\"`: opens only via the trigger button or arrow keys.\n * @default \"focus\"\n */\n menuTrigger?: \"focus\" | \"input\" | \"manual\"\n /**\n * Called when the selected value(s) change.\n * Receives `Key[]` when `selectionMode` is `\"multiple\"`, otherwise `Key | null`.\n */\n onChange?: ((value: Key | null) => void) | ((value: Key[]) => void)\n /** Called when the user scrolls near the bottom of the listbox. Pair with `loadingState` for infinite scroll. */\n onLoadMore?: () => void\n /** Placeholder text for the input. */\n placeholder?: string\n /** If `true`, allows the value to be read but not changed. */\n readOnly?: boolean\n /** Content to display when there are no items in the list. Defaults to \"No results\". */\n renderEmptyState?: ReactNode | (() => ReactNode)\n /** If `true`, appends an asterisk at the end of the label text. */\n required?: boolean\n /**\n * If `true`, renders a button after the input that clears its text. Only\n * applies when `menuTrigger` is `\"focus\"`, where no trigger button is rendered.\n */\n showClearButton?: boolean\n /** If `true`, renders a search icon before the input. */\n showSearchIcon?: boolean\n /** The size of the combo box. */\n size?: ComboBoxSize\n}\n\ntype AriaComboBoxPropsToOmit = \"slot\"\n\ntype AriaComboBoxPropsToInclude =\n | \"allowsEmptyCollection\"\n | \"defaultItems\"\n | \"defaultValue\"\n | \"disabledKeys\"\n | \"inputValue\"\n | \"items\"\n | \"name\"\n | \"onInputChange\"\n | \"selectionMode\"\n | \"value\"\n\nexport type ComboBoxElementProps<T extends object = object> =\n CombineAriaPropsWithCustomProps<\n AriaComboBoxProps<T, \"single\" | \"multiple\">,\n ComboBoxProps<T>,\n AriaComboBoxPropsToOmit,\n AriaComboBoxPropsToInclude\n >\n\nfunction resolveEmptyState(value: ReactNode | (() => ReactNode)): ReactNode {\n return typeof value === \"function\" ? value() : value\n}\n\nfunction ClearButton() {\n const state = useContext(ComboBoxStateContext)\n\n return (\n <IconButton\n aria-label=\"Clear\"\n className=\"tds-combo-box-clear-button\"\n data-input-empty={!state?.inputValue ? true : undefined}\n icon={\n <Icon\n aria-hidden\n className=\"tds-combo-box-clear-icon\"\n symbol=\"general#x\"\n />\n }\n kind=\"neutral-inline\"\n onClick={() => state?.setInputValue(\"\")}\n onMouseDown={(event) => event.preventDefault()}\n tabIndex={-1}\n />\n )\n}\n\n/**\n * In multiple selection mode, Tab closes the list without changing the\n * selection. React Aria would otherwise toggle the focused option, which\n * removes a value when the list opened with a selected option focused.\n */\nfunction ComboBoxInput(props: React.ComponentProps<typeof Input>) {\n const state = useContext(ComboBoxStateContext)\n\n return (\n <Input\n {...props}\n onKeyDownCapture={(event) => {\n if (\n event.key === \"Tab\" &&\n state?.isOpen &&\n state.selectionManager.selectionMode === \"multiple\"\n ) {\n state.selectionManager.setFocusedKey(null)\n }\n }}\n />\n )\n}\n\nfunction ErrorAnnouncement({ labelledBy }: { labelledBy: string }) {\n const announce = useAnnounce()\n const inputValue = useContext(ComboBoxStateContext)?.inputValue\n\n useEffect(() => {\n const timeout = setTimeout(\n () => announce({ \"aria-labelledby\": labelledBy }),\n LOADING_ANNOUNCEMENT_DELAY_MS\n )\n return () => clearTimeout(timeout)\n }, [announce, inputValue, labelledBy])\n\n return null\n}\n\nfunction FilteringAnnouncement() {\n const state = useContext(ComboBoxStateContext)\n if (!state?.isOpen) return null\n\n return <LoadingAnnouncement key={state.inputValue} message=\"Loading\" />\n}\n\n/**\n * A combo box combines a text input with a filterable popover\n * listbox, allowing users to type to search and select from a list of options.\n *\n * It supports both single and multiple selection (`selectionMode`), custom filtering,\n * and asynchronous data loading with infinite scroll capabilities (`loadingState` and `onLoadMore`).\n * Collections can be either static or dynamic, managed via the `children`, `items`,\n * or `defaultItems` props. To construct the dropdown list, compose this component\n * with `ComboBoxItem` for individual options and `ComboBoxSection` for grouping.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-combobox--docs | Storybook Documentation}\n */\nexport function ComboBox<T extends object>({\n allowsEmptyCollection = true,\n children,\n className,\n description,\n disabled,\n filter,\n hideLabel,\n invalid,\n label,\n loadingState,\n menuTrigger = \"focus\",\n onChange,\n onLoadMore,\n placeholder,\n readOnly,\n renderEmptyState = \"No results\",\n required,\n showClearButton,\n showSearchIcon,\n size = \"md\",\n ...restProps\n}: ComboBoxElementProps<T>) {\n const emptyStateId = `tds-combo-box-empty-state-${useId()}`\n const combinedClassName = classNames(\n \"tds-field tds-combo-box\",\n {\n \"tds-combo-box--lg\": size === \"lg\",\n \"tds-field--lg\": size === \"lg\",\n },\n className\n )\n\n const loadMoreItem = onLoadMore && (\n <ListBoxLoadMoreItem\n className=\"tds-combo-box-load-more\"\n isLoading={loadingState === \"loadingMore\"}\n onLoadMore={onLoadMore}\n >\n <span className=\"tds-combo-box-loading-label--hidden\">Loading more</span>\n <LoadingSpinner />\n <LoadingAnnouncement message=\"Loading more\" />\n </ListBoxLoadMoreItem>\n )\n\n const renderChildren = () => {\n if (typeof children === \"function\") {\n return (\n <Collection items={restProps.items ?? restProps.defaultItems}>\n {children}\n </Collection>\n )\n }\n return children\n }\n\n return (\n // React Aria's ComboBox is generic over selection mode (M). We instantiate\n // it with the union \"single\" | \"multiple\" so value/defaultValue/selectionMode\n // accept both shapes. onChange still needs a cast because our type is a union\n // of function types (to allow narrower handlers like\n // `setValue: (Key|null) => void`), which isn't assignable to RAC's\n // single-function signature.\n <AriaComboBox<T, \"single\" | \"multiple\">\n {...restProps}\n allowsEmptyCollection={allowsEmptyCollection}\n aria-label={hideLabel ? label : undefined}\n className={combinedClassName}\n defaultFilter={filter}\n isDisabled={disabled}\n isReadOnly={readOnly}\n isRequired={required}\n menuTrigger={menuTrigger}\n onChange={onChange as (value: Key | Key[] | null) => void}\n >\n {!hideLabel && <Label className=\"tds-field-label\">{label}</Label>}\n <Group className=\"tds-field-control tds-combo-box-field\">\n {showSearchIcon && (\n <Icon\n aria-hidden\n className=\"tds-combo-box-search-icon\"\n symbol=\"general#search\"\n />\n )}\n <ComboBoxInput\n aria-invalid={invalid || undefined}\n className=\"tds-combo-box-input\"\n placeholder={placeholder}\n />\n {menuTrigger !== \"focus\" && !readOnly && (\n <Button className=\"tds-combo-box-button tds-btn tds-btn--infield\">\n <Icon aria-hidden symbol=\"general#down-caret\" />\n </Button>\n )}\n {showClearButton &&\n menuTrigger === \"focus\" &&\n !readOnly &&\n !disabled && <ClearButton />}\n </Group>\n <Popover className=\"tds-combo-box-popover\">\n <ListBox\n className=\"tds-combo-box-list\"\n renderEmptyState={\n allowsEmptyCollection\n ? () => (\n <div className=\"tds-combo-box-empty-state\" id={emptyStateId}>\n {loadingState === \"error\" && (\n <ErrorAnnouncement labelledBy={emptyStateId} />\n )}\n {loadingState === \"loading\" ? (\n <>\n <span className=\"tds-combo-box-loading-label--hidden\">\n Loading\n </span>\n <LoadingSpinner />\n <LoadingAnnouncement message=\"Loading\" />\n </>\n ) : (\n resolveEmptyState(renderEmptyState)\n )}\n </div>\n )\n : undefined\n }\n >\n {renderChildren()}\n {loadMoreItem}\n </ListBox>\n {loadingState === \"filtering\" && <FilteringAnnouncement />}\n </Popover>\n {description && (\n <Text className=\"tds-field-description\" slot=\"description\">\n <Icon\n aria-hidden\n className=\"tds-field-description-invalid-icon\"\n symbol=\"general#exclamation-triangle\"\n />\n {description}\n </Text>\n )}\n </AriaComboBox>\n )\n}\n\nexport interface ComboBoxItemProps {\n /** Disables the item. */\n disabled?: boolean\n}\n\ntype AriaListBoxItemPropsToOmit = \"isDisabled\"\n\ntype AriaListBoxItemPropsToInclude = \"onAction\" | \"textValue\" | \"value\"\n\nexport type ComboBoxItemElementProps<T extends object = object> =\n CombineAriaPropsWithCustomProps<\n ListBoxItemProps<T>,\n ComboBoxItemProps,\n AriaListBoxItemPropsToOmit,\n AriaListBoxItemPropsToInclude\n >\n\n/**\n * A selectable option within a {@link ComboBox}. Renders as a listbox item.\n *\n * Provide an `id` (or `key` when rendering from a collection) to identify the\n * option, and `textValue` when the visible children are not plain text so\n * type-ahead and screen readers have a stable label to use.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-combobox--docs | Storybook Documentation}\n */\nexport function ComboBoxItem<T extends object>({\n className,\n disabled,\n ...restProps\n}: ComboBoxItemElementProps<T>) {\n return (\n <ListBoxItem\n {...restProps}\n className={classNames(\"tds-combo-box-list-item\", className)}\n isDisabled={disabled}\n />\n )\n}\n\nexport interface ComboBoxSectionProps {\n /** The items rendered within the section. */\n children: ReactNode\n /** Optional heading text rendered above the section's items. */\n title?: string\n}\n\ntype AriaListBoxSectionPropsToInclude = \"dependencies\"\n\nexport type ComboBoxSectionElementProps<T extends object = object> =\n CombineAriaPropsWithCustomProps<\n ListBoxSectionProps<T>,\n ComboBoxSectionProps,\n never,\n AriaListBoxSectionPropsToInclude\n >\n\n/**\n * A group of related {@link ComboBoxItem}s within a {@link ComboBox}. Renders\n * an optional `title` heading above its items.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-combobox--docs | Storybook Documentation}\n */\nexport function ComboBoxSection<T extends object>({\n children,\n className,\n title,\n ...restProps\n}: ComboBoxSectionElementProps<T>) {\n return (\n <ListBoxSection\n {...restProps}\n className={classNames(\"tds-combo-box-list-section\", className)}\n >\n {title && (\n <Header className=\"tds-combo-box-section-header\">{title}</Header>\n )}\n {children}\n </ListBoxSection>\n )\n}\n"],"names":["AriaComboBox"],"mappings":";;;;;;;;;;;;;;;;;;AA0IA,SAAS,iBAAiB,CAAC,KAAoC,EAAA;AAC7D,IAAA,OAAO,OAAO,KAAK,KAAK,UAAU,GAAG,KAAK,EAAE,GAAG,KAAK;AACtD;AAEA,SAAS,WAAW,GAAA;AAClB,IAAA,MAAM,KAAK,GAAG,UAAU,CAAC,oBAAoB,CAAC;AAE9C,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,UAAU,EAAA,EAAA,YAAA,EACE,OAAO,EAClB,SAAS,EAAC,4BAA4B,EAAA,kBAAA,EACpB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EACvD,IAAI,EACF,KAAA,CAAA,aAAA,CAAC,IAAI,yBAEH,SAAS,EAAC,0BAA0B,EACpC,MAAM,EAAC,WAAW,EAAA,CAClB,EAEJ,IAAI,EAAC,gBAAgB,EACrB,OAAO,EAAE,MAAM,KAAK,EAAE,aAAa,CAAC,EAAE,CAAC,EACvC,WAAW,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,cAAc,EAAE,EAC9C,QAAQ,EAAE,EAAE,EAAA,CACZ;AAEN;AAEA;;;;AAI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,UAAU,CAAC,yBAAyB,EAAE,SAAS,CAAC,EAC3D,UAAU,EAAE,QAAQ,EAAA,CACpB;AAEN;AAmBA;;;;;;AAMG;AACG,SAAU,eAAe,CAAmB,EAChD,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,SAAS,EACmB,EAAA;AAC/B,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,cAAc,EAAA,EAAA,GACT,SAAS,EACb,SAAS,EAAE,UAAU,CAAC,4BAA4B,EAAE,SAAS,CAAC,EAAA;QAE7D,KAAK,KACJ,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,SAAS,EAAC,8BAA8B,EAAA,EAAE,KAAK,CAAU,CAClE;QACA,QAAQ,CACM;AAErB;;;;"}
|
|
1
|
+
{"version":3,"file":"ComboBox.js","sources":["../../../src/components/combo-box/ComboBox.tsx"],"sourcesContent":["import \"../button/btn.css\"\nimport \"../field/index.css\"\nimport \"./index.css\"\n\nimport { IconButton } from \"@components/button\"\nimport {\n LOADING_ANNOUNCEMENT_DELAY_MS,\n LoadingAnnouncement,\n} from \"@components/internal/LoadingAnnouncement\"\nimport LoadingSpinner from \"@components/internal/LoadingSpinner\"\nimport Icon from \"@utilities/Icon\"\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport { useAnnounce } from \"@utilities/useAnnounce\"\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, { type ReactNode, useContext, useEffect } from \"react\"\nimport {\n Button,\n Collection,\n ComboBox as AriaComboBox,\n type ComboBoxProps as AriaComboBoxProps,\n ComboBoxStateContext,\n Input,\n type Key,\n Label,\n ListBox,\n ListBoxItem,\n type ListBoxItemProps,\n ListBoxLoadMoreItem,\n type ListBoxProps as AriaListBoxProps,\n ListBoxSection,\n type ListBoxSectionProps,\n Popover,\n Text,\n} from \"react-aria-components/ComboBox\"\nimport { Group } from \"react-aria-components/Group\"\nimport { Header } from \"react-aria-components/Header\"\n\nexport type ComboBoxSize = \"md\" | \"lg\"\n\nexport type ComboBoxLoadingState =\n | \"error\"\n | \"filtering\"\n | \"idle\"\n | \"loading\"\n | \"loadingMore\"\n | \"sorting\"\n\ntype ComboBoxChildren<T extends object> = NonNullable<\n AriaListBoxProps<T>[\"children\"]\n>\n\nexport interface ComboBoxProps<T extends object = object> {\n /**\n * If `true`, keeps typed text that does not match an option. Turn it on when\n * ComboBox is a standalone search and the suggestions are shortcuts. Leave it\n * off in forms, where the value needs to match one of the options.\n */\n allowsCustomValue?: boolean\n /** The contents of the listbox. */\n children: ComboBoxChildren<T>\n /** Helper text displayed below the component. Styled as error text when `invalid` is `true`. */\n description?: ReactNode\n /** Disables the field and trigger button. */\n disabled?: boolean\n /** Custom filter function for determining if an item should appear in the list. */\n filter?: (textValue: string, inputValue: string) => boolean\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 /** Accessible label for the field. */\n label: string\n /**\n * Async loading state for the listbox.\n * - `\"loading\"`: while the collection is empty, replaces the empty state with a spinner.\n * - `\"loadingMore\"`: shows an inline spinner at the bottom of the listbox (use with `onLoadMore`).\n * - `\"filtering\"`: renders as `\"idle\"`, but tells screen reader users \"Loading\" when results are slow to arrive after typing stops.\n * - `\"error\"`: renders as `\"idle\"`, but reads the empty state (`renderEmptyState`) to screen reader users while the collection is empty.\n * - Other values render as `\"idle\"`.\n */\n loadingState?: ComboBoxLoadingState\n /**\n * The interaction that opens the popover.\n * - `\"input\"`: opens when the user enters text in the input.\n * - `\"focus\"`: opens when the user focuses (via click or keyboard) into the input.\n * - `\"manual\"`: opens only via the trigger button or arrow keys.\n * @default \"focus\"\n */\n menuTrigger?: \"focus\" | \"input\" | \"manual\"\n /**\n * Called when the selected value(s) change.\n * Receives `Key[]` when `selectionMode` is `\"multiple\"`, otherwise `Key | null`.\n */\n onChange?: ((value: Key | null) => void) | ((value: Key[]) => void)\n /** Called when the user scrolls near the bottom of the listbox. Pair with `loadingState` for infinite scroll. */\n onLoadMore?: () => void\n /** Placeholder text for the input. */\n placeholder?: string\n /** If `true`, allows the value to be read but not changed. */\n readOnly?: boolean\n /** Content to display when there are no items in the list. Defaults to \"No results\". */\n renderEmptyState?: ReactNode | (() => ReactNode)\n /** If `true`, appends an asterisk at the end of the label text. */\n required?: boolean\n /**\n * If `true`, renders a button after the input that clears its text. Only\n * applies when `menuTrigger` is `\"focus\"`, where no trigger button is rendered.\n */\n showClearButton?: boolean\n /** If `true`, renders a search icon before the input. */\n showSearchIcon?: boolean\n /** The size of the combo box. */\n size?: ComboBoxSize\n}\n\ntype AriaComboBoxPropsToOmit = \"slot\"\n\ntype AriaComboBoxPropsToInclude =\n | \"allowsEmptyCollection\"\n | \"defaultItems\"\n | \"defaultValue\"\n | \"disabledKeys\"\n | \"inputValue\"\n | \"items\"\n | \"name\"\n | \"onInputChange\"\n | \"selectionMode\"\n | \"value\"\n\nexport type ComboBoxElementProps<T extends object = object> =\n CombineAriaPropsWithCustomProps<\n AriaComboBoxProps<T, \"single\" | \"multiple\">,\n ComboBoxProps<T>,\n AriaComboBoxPropsToOmit,\n AriaComboBoxPropsToInclude\n >\n\nfunction resolveEmptyState(value: ReactNode | (() => ReactNode)): ReactNode {\n return typeof value === \"function\" ? value() : value\n}\n\nfunction ClearButton() {\n const state = useContext(ComboBoxStateContext)\n\n return (\n <IconButton\n aria-label=\"Clear\"\n className=\"tds-combo-box-clear-button\"\n data-input-empty={!state?.inputValue ? true : undefined}\n icon={\n <Icon\n aria-hidden\n className=\"tds-combo-box-clear-icon\"\n symbol=\"general#x\"\n />\n }\n kind=\"neutral-inline\"\n onClick={() => state?.setInputValue(\"\")}\n onMouseDown={(event) => event.preventDefault()}\n tabIndex={-1}\n />\n )\n}\n\n/**\n * In multiple selection mode, Tab closes the list without changing the\n * selection. React Aria would otherwise toggle the focused option, which\n * removes a value when the list opened with a selected option focused.\n */\nfunction ComboBoxInput(props: React.ComponentProps<typeof Input>) {\n const state = useContext(ComboBoxStateContext)\n\n return (\n <Input\n {...props}\n onKeyDownCapture={(event) => {\n if (\n event.key === \"Tab\" &&\n state?.isOpen &&\n state.selectionManager.selectionMode === \"multiple\"\n ) {\n state.selectionManager.setFocusedKey(null)\n }\n }}\n />\n )\n}\n\nfunction ErrorAnnouncement({ labelledBy }: { labelledBy: string }) {\n const announce = useAnnounce()\n const inputValue = useContext(ComboBoxStateContext)?.inputValue\n\n useEffect(() => {\n const timeout = setTimeout(\n () => announce({ \"aria-labelledby\": labelledBy }),\n LOADING_ANNOUNCEMENT_DELAY_MS\n )\n return () => clearTimeout(timeout)\n }, [announce, inputValue, labelledBy])\n\n return null\n}\n\nfunction FilteringAnnouncement() {\n const state = useContext(ComboBoxStateContext)\n if (!state?.isOpen) return null\n\n return <LoadingAnnouncement key={state.inputValue} message=\"Loading\" />\n}\n\n/**\n * A combo box combines a text input with a filterable popover\n * listbox, allowing users to type to search and select from a list of options.\n *\n * It supports both single and multiple selection (`selectionMode`), custom filtering,\n * and asynchronous data loading with infinite scroll capabilities (`loadingState` and `onLoadMore`).\n * Collections can be either static or dynamic, managed via the `children`, `items`,\n * or `defaultItems` props. To construct the dropdown list, compose this component\n * with `ComboBoxItem` for individual options and `ComboBoxSection` for grouping.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-combobox--docs | Storybook Documentation}\n */\nexport function ComboBox<T extends object>({\n allowsEmptyCollection = true,\n children,\n className,\n description,\n disabled,\n filter,\n hideLabel,\n invalid,\n label,\n loadingState,\n menuTrigger = \"focus\",\n onChange,\n onLoadMore,\n placeholder,\n readOnly,\n renderEmptyState = \"No results\",\n required,\n showClearButton,\n showSearchIcon,\n size = \"md\",\n ...restProps\n}: ComboBoxElementProps<T>) {\n const emptyStateId = `tds-combo-box-empty-state-${useId()}`\n const combinedClassName = classNames(\n \"tds-field tds-combo-box\",\n {\n \"tds-combo-box--lg\": size === \"lg\",\n \"tds-field--lg\": size === \"lg\",\n },\n className\n )\n\n const loadMoreItem = onLoadMore && (\n <ListBoxLoadMoreItem\n className=\"tds-combo-box-load-more\"\n isLoading={loadingState === \"loadingMore\"}\n onLoadMore={onLoadMore}\n >\n <span className=\"tds-combo-box-loading-label--hidden\">Loading more</span>\n <LoadingSpinner />\n <LoadingAnnouncement message=\"Loading more\" />\n </ListBoxLoadMoreItem>\n )\n\n const renderChildren = () => {\n if (typeof children === \"function\") {\n return (\n <Collection items={restProps.items ?? restProps.defaultItems}>\n {children}\n </Collection>\n )\n }\n return children\n }\n\n return (\n // React Aria's ComboBox is generic over selection mode (M). We instantiate\n // it with the union \"single\" | \"multiple\" so value/defaultValue/selectionMode\n // accept both shapes. onChange still needs a cast because our type is a union\n // of function types (to allow narrower handlers like\n // `setValue: (Key|null) => void`), which isn't assignable to RAC's\n // single-function signature.\n <AriaComboBox<T, \"single\" | \"multiple\">\n {...restProps}\n allowsEmptyCollection={allowsEmptyCollection}\n aria-label={hideLabel ? label : undefined}\n className={combinedClassName}\n defaultFilter={filter}\n isDisabled={disabled}\n isReadOnly={readOnly}\n isRequired={required}\n menuTrigger={menuTrigger}\n onChange={onChange as (value: Key | Key[] | null) => void}\n >\n {!hideLabel && <Label className=\"tds-field-label\">{label}</Label>}\n <Group className=\"tds-field-control tds-combo-box-field\">\n {showSearchIcon && (\n <Icon\n aria-hidden\n className=\"tds-combo-box-search-icon\"\n symbol=\"general#search\"\n />\n )}\n <ComboBoxInput\n aria-invalid={invalid || undefined}\n className=\"tds-combo-box-input\"\n placeholder={placeholder}\n />\n {menuTrigger !== \"focus\" && !readOnly && (\n <Button className=\"tds-combo-box-button tds-btn tds-btn--infield\">\n <Icon aria-hidden symbol=\"general#down-caret\" />\n </Button>\n )}\n {showClearButton &&\n menuTrigger === \"focus\" &&\n !readOnly &&\n !disabled && <ClearButton />}\n </Group>\n <Popover className=\"tds-combo-box-popover\">\n <ListBox\n className=\"tds-combo-box-list\"\n renderEmptyState={\n allowsEmptyCollection\n ? () => (\n <div className=\"tds-combo-box-empty-state\" id={emptyStateId}>\n {loadingState === \"error\" && (\n <ErrorAnnouncement labelledBy={emptyStateId} />\n )}\n {loadingState === \"loading\" ? (\n <>\n <span className=\"tds-combo-box-loading-label--hidden\">\n Loading\n </span>\n <LoadingSpinner />\n <LoadingAnnouncement message=\"Loading\" />\n </>\n ) : (\n resolveEmptyState(renderEmptyState)\n )}\n </div>\n )\n : undefined\n }\n >\n {renderChildren()}\n {loadMoreItem}\n </ListBox>\n {loadingState === \"filtering\" && <FilteringAnnouncement />}\n </Popover>\n {description && (\n <Text className=\"tds-field-description\" slot=\"description\">\n <Icon\n aria-hidden\n className=\"tds-field-description-invalid-icon\"\n symbol=\"general#exclamation-triangle\"\n />\n {description}\n </Text>\n )}\n </AriaComboBox>\n )\n}\n\nexport interface ComboBoxItemProps {\n /** Disables the item. */\n disabled?: boolean\n}\n\ntype AriaListBoxItemPropsToOmit = \"isDisabled\"\n\ntype AriaListBoxItemPropsToInclude = \"onAction\" | \"textValue\" | \"value\"\n\nexport type ComboBoxItemElementProps<T extends object = object> =\n CombineAriaPropsWithCustomProps<\n ListBoxItemProps<T>,\n ComboBoxItemProps,\n AriaListBoxItemPropsToOmit,\n AriaListBoxItemPropsToInclude\n >\n\n/**\n * A selectable option within a {@link ComboBox}. Renders as a listbox item.\n *\n * Provide an `id` (or `key` when rendering from a collection) to identify the\n * option, and `textValue` when the visible children are not plain text so\n * type-ahead and screen readers have a stable label to use.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-combobox--docs | Storybook Documentation}\n */\nexport function ComboBoxItem<T extends object>({\n className,\n disabled,\n ...restProps\n}: ComboBoxItemElementProps<T>) {\n return (\n <ListBoxItem\n {...restProps}\n className={classNames(\"tds-combo-box-list-item\", className)}\n isDisabled={disabled}\n />\n )\n}\n\nexport interface ComboBoxSectionProps {\n /** The items rendered within the section. */\n children: ReactNode\n /** Optional heading text rendered above the section's items. */\n title?: string\n}\n\ntype AriaListBoxSectionPropsToInclude = \"dependencies\"\n\nexport type ComboBoxSectionElementProps<T extends object = object> =\n CombineAriaPropsWithCustomProps<\n ListBoxSectionProps<T>,\n ComboBoxSectionProps,\n never,\n AriaListBoxSectionPropsToInclude\n >\n\n/**\n * A group of related {@link ComboBoxItem}s within a {@link ComboBox}. Renders\n * an optional `title` heading above its items.\n *\n * @component\n * @see {@link https://planningcenter.github.io/tapestry/?path=/docs/forms-combobox--docs | Storybook Documentation}\n */\nexport function ComboBoxSection<T extends object>({\n children,\n className,\n title,\n ...restProps\n}: ComboBoxSectionElementProps<T>) {\n return (\n <ListBoxSection\n {...restProps}\n className={classNames(\"tds-combo-box-list-section\", className)}\n >\n {title && (\n <Header className=\"tds-combo-box-section-header\">{title}</Header>\n )}\n {children}\n </ListBoxSection>\n )\n}\n"],"names":["React","AriaComboBox"],"mappings":";;;;;;;;;;;;;;;;;;AA0IA,SAAS,iBAAiB,CAAC,KAAoC,EAAA;AAC7D,IAAA,OAAO,OAAO,KAAK,KAAK,UAAU,GAAG,KAAK,EAAE,GAAG,KAAK;AACtD;AAEA,SAAS,WAAW,GAAA;AAClB,IAAA,MAAM,KAAK,GAAG,UAAU,CAAC,oBAAoB,CAAC;AAE9C,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,UAAU,EAAA,EAAA,YAAA,EACE,OAAO,EAClB,SAAS,EAAC,4BAA4B,EAAA,kBAAA,EACpB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EACvD,IAAI,EACFA,cAAA,CAAA,aAAA,CAAC,IAAI,yBAEH,SAAS,EAAC,0BAA0B,EACpC,MAAM,EAAC,WAAW,EAAA,CAClB,EAEJ,IAAI,EAAC,gBAAgB,EACrB,OAAO,EAAE,MAAM,KAAK,EAAE,aAAa,CAAC,EAAE,CAAC,EACvC,WAAW,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,cAAc,EAAE,EAC9C,QAAQ,EAAE,EAAE,EAAA,CACZ;AAEN;AAEA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W,EAAA,EAAA,GACN,SAAS,EACb,SAAS,EAAE,UAAU,CAAC,yBAAyB,EAAE,SAAS,CAAC,EAC3D,UAAU,EAAE,QAAQ,EAAA,CACpB;AAEN;AAmBA;;;;;;AAMG;AACG,SAAU,eAAe,CAAmB,EAChD,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,SAAS,EACmB,EAAA;AAC/B,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,cAAc,EAAA,EAAA,GACT,SAAS,EACb,SAAS,EAAE,UAAU,CAAC,4BAA4B,EAAE,SAAS,CAAC,EAAA;QAE7D,KAAK,KACJA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,SAAS,EAAC,8BAA8B,EAAA,EAAE,KAAK,CAAU,CAClE;QACA,QAAQ,CACM;AAErB;;;;"}
|
|
@@ -5,7 +5,7 @@ import Icon from '../../utilities/Icon.js';
|
|
|
5
5
|
import { useTapestryLocale } from '../../utilities/locale.js';
|
|
6
6
|
import { useDateFieldLocale } from '../../utilities/useDateFieldLocale.js';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import
|
|
8
|
+
import React__default, { useState, useRef, useEffect, useMemo, useContext } from 'react';
|
|
9
9
|
import { I18nProvider } from 'react-aria/I18nProvider';
|
|
10
10
|
import { CalendarStateContext } from 'react-aria-components/Calendar';
|
|
11
11
|
import { DatePicker as DatePicker$1, Label, Group, DateInput, DateSegment, Button, Popover, Calendar, Text, CalendarGrid, CalendarGridHeader, CalendarHeaderCell, CalendarGridBody, CalendarCell } from 'react-aria-components/DatePicker';
|
|
@@ -26,7 +26,7 @@ function toCalendarDate(input) {
|
|
|
26
26
|
return $58246871e4652552$export$6b862160d295c8e(input);
|
|
27
27
|
}
|
|
28
28
|
function DatePickerOverlay({ children, variant, }) {
|
|
29
|
-
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));
|
|
30
30
|
}
|
|
31
31
|
function DatePickerCalendarBody({ activeOverlay, setActiveOverlay, }) {
|
|
32
32
|
// Read and drive Calendar's focused date through its state context. This
|
|
@@ -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);
|
|
@@ -188,8 +188,8 @@ function DatePicker({ className, defaultValue, description, disabled, firstDayOf
|
|
|
188
188
|
const fieldRef = useRef(null);
|
|
189
189
|
const locale = useTapestryLocale();
|
|
190
190
|
const dateFieldLocale = useDateFieldLocale();
|
|
191
|
-
return (
|
|
192
|
-
|
|
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
193
|
if (isPartlyFilled(fieldRef.current)) {
|
|
194
194
|
if (computedValue) {
|
|
195
195
|
setHeldValue(computedValue);
|
|
@@ -225,10 +225,10 @@ function DatePicker({ className, defaultValue, description, disabled, firstDayOf
|
|
|
225
225
|
setActiveOverlay(null);
|
|
226
226
|
onOpenChange?.(isOpen);
|
|
227
227
|
}, validate: () => (heldValue && required ? "Enter a full date" : null), value: heldValue ?? computedValue },
|
|
228
|
-
!hideLabel &&
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
232
|
? "tds-field-date-segment-separator"
|
|
233
233
|
: "tds-field-date-segment", segment: segment.type === "year" &&
|
|
234
234
|
!segment.isPlaceholder &&
|
|
@@ -242,20 +242,20 @@ function DatePicker({ className, defaultValue, description, disabled, firstDayOf
|
|
|
242
242
|
}).format(segment.value),
|
|
243
243
|
}
|
|
244
244
|
: segment })))),
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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
248
|
"tds-date-picker-popover--lg": size === "lg",
|
|
249
249
|
}), offset: 2 },
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
description && (
|
|
254
|
-
|
|
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
255
|
description)),
|
|
256
256
|
name && (
|
|
257
257
|
// Submits the reported value, which react-aria's own input can't while it holds a partly filled date
|
|
258
|
-
|
|
258
|
+
React__default.createElement("input", { disabled: disabled, hidden: true, name: name, onChange: () => { }, type: "text", value: computedValue?.toString() ?? "" })))));
|
|
259
259
|
}
|
|
260
260
|
DatePicker.displayName = "DatePicker";
|
|
261
261
|
|