@planningcenter/tapestry 3.2.3-rc.4 → 3.2.3-rc.5
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/combo-box/ComboBox.d.ts +4 -2
- package/dist/components/combo-box/ComboBox.d.ts.map +1 -1
- package/dist/components/combo-box/ComboBox.js +5 -3
- package/dist/components/combo-box/ComboBox.js.map +1 -1
- package/dist/reactRender.css +1347 -1340
- package/dist/reactRender.css.map +1 -1
- package/dist/reactRenderLegacy.css +1347 -1340
- package/dist/reactRenderLegacy.css.map +1 -1
- package/dist/unstable.css +7 -0
- package/dist/unstable.css.map +1 -1
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ import "../button/btn.css";
|
|
|
2
2
|
import "./index.css";
|
|
3
3
|
import type { CombineAriaPropsWithCustomProps } from "../../utilities/reactAriaProps";
|
|
4
4
|
import React, { type ReactNode } from "react";
|
|
5
|
-
import type { ComboBoxProps as AriaComboBoxProps, Key, ListBoxItemProps, ListBoxSectionProps } from "react-aria-components";
|
|
5
|
+
import type { ComboBoxProps as AriaComboBoxProps, Key, ListBoxItemProps, ListBoxRenderProps, ListBoxSectionProps } from "react-aria-components";
|
|
6
6
|
export type ComboBoxSize = "md" | "lg";
|
|
7
7
|
export interface ComboBoxProps<T extends object = object> {
|
|
8
8
|
/** The children of the combo box (ComboBoxItem elements or a render function). */
|
|
@@ -28,6 +28,8 @@ export interface ComboBoxProps<T extends object = object> {
|
|
|
28
28
|
placeholder?: string;
|
|
29
29
|
/** If `true`, allows the value to be read but not changed. */
|
|
30
30
|
readOnly?: boolean;
|
|
31
|
+
/** Provides content to display when there are no items in the list. */
|
|
32
|
+
renderEmptyState?: (props: ListBoxRenderProps) => ReactNode;
|
|
31
33
|
/** If `true`, appends an asterisk at the end of the label text. */
|
|
32
34
|
required?: boolean;
|
|
33
35
|
/** The size of the combo box. */
|
|
@@ -36,7 +38,7 @@ export interface ComboBoxProps<T extends object = object> {
|
|
|
36
38
|
type AriaComboBoxPropsToOmit = "slot";
|
|
37
39
|
type AriaComboBoxPropsToInclude = "allowsEmptyCollection" | "defaultInputValue" | "defaultItems" | "defaultValue" | "disabledKeys" | "inputValue" | "items" | "menuTrigger" | "name" | "onInputChange" | "selectionMode" | "value";
|
|
38
40
|
export type ComboBoxElementProps<T extends object = object> = CombineAriaPropsWithCustomProps<AriaComboBoxProps<T, "single" | "multiple">, ComboBoxProps<T>, AriaComboBoxPropsToOmit, AriaComboBoxPropsToInclude>;
|
|
39
|
-
export declare function ComboBox<T extends object>({ children, className, description, disabled, filter, hideLabel, invalid, label, menuTrigger, onChange, placeholder, readOnly, required, size, ...restProps }: ComboBoxElementProps<T>): React.JSX.Element;
|
|
41
|
+
export declare function ComboBox<T extends object>({ allowsEmptyCollection, children, className, description, disabled, filter, hideLabel, invalid, label, menuTrigger, onChange, placeholder, readOnly, renderEmptyState, required, size, ...restProps }: ComboBoxElementProps<T>): React.JSX.Element;
|
|
40
42
|
export interface ComboBoxItemProps {
|
|
41
43
|
/** Disables the item. */
|
|
42
44
|
disabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboBox.d.ts","sourceRoot":"","sources":["../../../src/components/combo-box/ComboBox.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAA;AAC1B,OAAO,aAAa,CAAA;AAGpB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,KAAK,EACV,aAAa,IAAI,iBAAiB,EAClC,GAAG,EACH,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,uBAAuB,CAAA;AAe9B,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAA;AAEtC,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACtD,kFAAkF;IAClF,QAAQ,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AE,OAAO,CAAA;CACnB;AAED,KAAK,0BAA0B,GAAG,YAAY,CAAA;AAE9C,KAAK,6BAA6B,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,CAAA;AAEvE,MAAM,MAAM,wBAAwB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAC5D,+BAA+B,CAC7B,gBAAgB,CAAC,CAAC,CAAC,EACnB,iBAAiB,EACjB,0BAA0B,EAC1B,6BAA6B,CAC9B,CAAA;AAEH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,EAC7C,SAAS,EACT,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,wBAAwB,CAAC,CAAC,CAAC,qBAQ7B;AAED,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,QAAQ,EAAE,SAAS,CAAA;IACnB,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,KAAK,gCAAgC,GAAG,cAAc,CAAA;AAEtD,MAAM,MAAM,2BAA2B,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAC/D,+BAA+B,CAC7B,mBAAmB,CAAC,CAAC,CAAC,EACtB,oBAAoB,EACpB,KAAK,EACL,gCAAgC,CACjC,CAAA;AAEH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,EAChD,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,SAAS,EACb,EAAE,2BAA2B,CAAC,CAAC,CAAC,qBAYhC"}
|
|
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import { ComboBox as ComboBox$1, Label, Group, Input, Button, Popover, ListBox, Text, ListBoxItem, ListBoxSection, Header } from 'react-aria-components';
|
|
5
5
|
|
|
6
|
-
function ComboBox({ children, className, description, disabled, filter, hideLabel, invalid, label, menuTrigger, onChange, placeholder, readOnly, required, size = "md", ...restProps }) {
|
|
6
|
+
function ComboBox({ allowsEmptyCollection = true, children, className, description, disabled, filter, hideLabel, invalid, label, menuTrigger, onChange, placeholder, readOnly, renderEmptyState = () => "No results", required, size = "md", ...restProps }) {
|
|
7
7
|
const combinedClassName = classNames("tds-combo-box", { "tds-combo-box--lg": size === "lg" }, className);
|
|
8
8
|
return (
|
|
9
9
|
// React Aria's ComboBox is generic over selection mode (M). We instantiate
|
|
@@ -12,14 +12,16 @@ function ComboBox({ children, className, description, disabled, filter, hideLabe
|
|
|
12
12
|
// of function types (to allow narrower handlers like
|
|
13
13
|
// `setValue: (Key|null) => void`), which isn't assignable to RAC's
|
|
14
14
|
// single-function signature.
|
|
15
|
-
React__default.createElement(ComboBox$1, { ...restProps, "aria-label": hideLabel ? label : undefined, className: combinedClassName, defaultFilter: filter, isDisabled: disabled, isInvalid: invalid, isReadOnly: readOnly, isRequired: required, menuTrigger: menuTrigger, onChange: onChange },
|
|
15
|
+
React__default.createElement(ComboBox$1, { ...restProps, allowsEmptyCollection: allowsEmptyCollection, "aria-label": hideLabel ? label : undefined, className: combinedClassName, defaultFilter: filter, isDisabled: disabled, isInvalid: invalid, isReadOnly: readOnly, isRequired: required, menuTrigger: menuTrigger, onChange: onChange },
|
|
16
16
|
!hideLabel && React__default.createElement(Label, { className: "tds-combo-box-label" }, label),
|
|
17
17
|
React__default.createElement(Group, { className: "tds-combo-box-field" },
|
|
18
18
|
React__default.createElement(Input, { className: "tds-combo-box-input", placeholder: placeholder }),
|
|
19
19
|
React__default.createElement(Button, { className: classNames("tds-combo-box-button", menuTrigger !== "focus" && "tds-btn tds-btn--infield") },
|
|
20
20
|
React__default.createElement(Icon, { "aria-hidden": true, symbol: "general#down-caret" }))),
|
|
21
21
|
React__default.createElement(Popover, { className: "tds-combo-box-popover" },
|
|
22
|
-
React__default.createElement(ListBox, { className: "tds-combo-box-list"
|
|
22
|
+
React__default.createElement(ListBox, { className: "tds-combo-box-list", renderEmptyState: allowsEmptyCollection
|
|
23
|
+
? (props) => (React__default.createElement("div", { className: "tds-combo-box-empty-state" }, renderEmptyState(props)))
|
|
24
|
+
: undefined }, children)),
|
|
23
25
|
description && (React__default.createElement(Text, { className: "tds-combo-box-description", slot: "description" },
|
|
24
26
|
React__default.createElement(Icon, { "aria-hidden": true, className: "tds-combo-box-description-invalid-icon", symbol: "general#exclamation-triangle" }),
|
|
25
27
|
description))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboBox.js","sources":["../../../src/components/combo-box/ComboBox.tsx"],"sourcesContent":["import \"../button/btn.css\"\nimport \"./index.css\"\n\nimport Icon from \"@utilities/Icon\"\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport classNames from \"classnames\"\nimport React, { type ReactNode } from \"react\"\nimport type {\n ComboBoxProps as AriaComboBoxProps,\n Key,\n ListBoxItemProps,\n ListBoxSectionProps,\n} from \"react-aria-components\"\nimport {\n Button,\n ComboBox as AriaComboBox,\n Group,\n Header,\n Input,\n Label,\n ListBox,\n ListBoxItem,\n ListBoxSection,\n Popover,\n Text,\n} from \"react-aria-components\"\n\nexport type ComboBoxSize = \"md\" | \"lg\"\n\nexport interface ComboBoxProps<T extends object = object> {\n /** The children of the combo box (ComboBoxItem elements or a render function). */\n children: ReactNode | ((item: T) => ReactNode)\n /** Helper text displayed below the component. Styled as error text when `invalid` is `true`. */\n description?: string\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 * 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 /** Placeholder text for the input. */\n placeholder?: string\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 combo box. */\n size?: ComboBoxSize\n}\n\ntype AriaComboBoxPropsToOmit = \"slot\"\n\ntype AriaComboBoxPropsToInclude =\n | \"allowsEmptyCollection\"\n | \"defaultInputValue\"\n | \"defaultItems\"\n | \"defaultValue\"\n | \"disabledKeys\"\n | \"inputValue\"\n | \"items\"\n | \"menuTrigger\"\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\nexport function ComboBox<T extends object>({\n children,\n className,\n description,\n disabled,\n filter,\n hideLabel,\n invalid,\n label,\n menuTrigger,\n onChange,\n placeholder,\n readOnly,\n required,\n size = \"md\",\n ...restProps\n}: ComboBoxElementProps<T>) {\n const combinedClassName = classNames(\n \"tds-combo-box\",\n { \"tds-combo-box--lg\": size === \"lg\" },\n className\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 aria-label={hideLabel ? label : undefined}\n className={combinedClassName}\n defaultFilter={filter}\n isDisabled={disabled}\n isInvalid={invalid}\n isReadOnly={readOnly}\n isRequired={required}\n menuTrigger={menuTrigger}\n onChange={onChange as (value: Key | Key[] | null) => void}\n >\n {!hideLabel && <Label className=\"tds-combo-box-label\">{label}</Label>}\n <Group className=\"tds-combo-box-field\">\n <Input className=\"tds-combo-box-input\" placeholder={placeholder} />\n <Button\n className={classNames(\n \"tds-combo-box-button\",\n menuTrigger !== \"focus\" && \"tds-btn tds-btn--infield\"\n )}\n >\n <Icon aria-hidden symbol=\"general#down-caret\" />\n </Button>\n </Group>\n <Popover className=\"tds-combo-box-popover\">\n <ListBox
|
|
1
|
+
{"version":3,"file":"ComboBox.js","sources":["../../../src/components/combo-box/ComboBox.tsx"],"sourcesContent":["import \"../button/btn.css\"\nimport \"./index.css\"\n\nimport Icon from \"@utilities/Icon\"\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport classNames from \"classnames\"\nimport React, { type ReactNode } from \"react\"\nimport type {\n ComboBoxProps as AriaComboBoxProps,\n Key,\n ListBoxItemProps,\n ListBoxRenderProps,\n ListBoxSectionProps,\n} from \"react-aria-components\"\nimport {\n Button,\n ComboBox as AriaComboBox,\n Group,\n Header,\n Input,\n Label,\n ListBox,\n ListBoxItem,\n ListBoxSection,\n Popover,\n Text,\n} from \"react-aria-components\"\n\nexport type ComboBoxSize = \"md\" | \"lg\"\n\nexport interface ComboBoxProps<T extends object = object> {\n /** The children of the combo box (ComboBoxItem elements or a render function). */\n children: ReactNode | ((item: T) => ReactNode)\n /** Helper text displayed below the component. Styled as error text when `invalid` is `true`. */\n description?: string\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 * 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 /** Placeholder text for the input. */\n placeholder?: string\n /** If `true`, allows the value to be read but not changed. */\n readOnly?: boolean\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: (props: ListBoxRenderProps) => ReactNode\n /** If `true`, appends an asterisk at the end of the label text. */\n required?: boolean\n /** The size of the combo box. */\n size?: ComboBoxSize\n}\n\ntype AriaComboBoxPropsToOmit = \"slot\"\n\ntype AriaComboBoxPropsToInclude =\n | \"allowsEmptyCollection\"\n | \"defaultInputValue\"\n | \"defaultItems\"\n | \"defaultValue\"\n | \"disabledKeys\"\n | \"inputValue\"\n | \"items\"\n | \"menuTrigger\"\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\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 menuTrigger,\n onChange,\n placeholder,\n readOnly,\n renderEmptyState = () => \"No results\",\n required,\n size = \"md\",\n ...restProps\n}: ComboBoxElementProps<T>) {\n const combinedClassName = classNames(\n \"tds-combo-box\",\n { \"tds-combo-box--lg\": size === \"lg\" },\n className\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 isInvalid={invalid}\n isReadOnly={readOnly}\n isRequired={required}\n menuTrigger={menuTrigger}\n onChange={onChange as (value: Key | Key[] | null) => void}\n >\n {!hideLabel && <Label className=\"tds-combo-box-label\">{label}</Label>}\n <Group className=\"tds-combo-box-field\">\n <Input className=\"tds-combo-box-input\" placeholder={placeholder} />\n <Button\n className={classNames(\n \"tds-combo-box-button\",\n menuTrigger !== \"focus\" && \"tds-btn tds-btn--infield\"\n )}\n >\n <Icon aria-hidden symbol=\"general#down-caret\" />\n </Button>\n </Group>\n <Popover className=\"tds-combo-box-popover\">\n <ListBox\n className=\"tds-combo-box-list\"\n renderEmptyState={\n allowsEmptyCollection\n ? (props) => (\n <div className=\"tds-combo-box-empty-state\">\n {renderEmptyState(props)}\n </div>\n )\n : undefined\n }\n >\n {children}\n </ListBox>\n </Popover>\n {description && (\n <Text className=\"tds-combo-box-description\" slot=\"description\">\n <Icon\n aria-hidden\n className=\"tds-combo-box-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\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\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}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