@planningcenter/tapestry 4.5.0 → 4.5.1-qa-1263.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DataTable/ActiveFilters.d.ts +10 -0
- package/dist/components/DataTable/ActiveFilters.d.ts.map +1 -0
- package/dist/components/DataTable/ActiveFilters.js +32 -0
- package/dist/components/DataTable/ActiveFilters.js.map +1 -0
- package/dist/components/DataTable/DataTable.d.ts +12 -1
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.js +55 -48
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/DataTable/FilterContext.d.ts +16 -0
- package/dist/components/DataTable/FilterContext.d.ts.map +1 -0
- package/dist/components/DataTable/FilterContext.js +32 -0
- package/dist/components/DataTable/FilterContext.js.map +1 -0
- package/dist/components/DataTable/FilterControls.d.ts +11 -0
- package/dist/components/DataTable/FilterControls.d.ts.map +1 -0
- package/dist/components/DataTable/FilterControls.js +57 -0
- package/dist/components/DataTable/FilterControls.js.map +1 -0
- package/dist/components/DataTable/FilterTypes.d.ts +49 -0
- package/dist/components/DataTable/FilterTypes.d.ts.map +1 -0
- package/dist/components/DataTable/ViewSettingsToggle.d.ts.map +1 -1
- package/dist/components/DataTable/ViewSettingsToggle.js +5 -6
- package/dist/components/DataTable/ViewSettingsToggle.js.map +1 -1
- package/dist/components/combo-box/ComboBox.d.ts +1 -1
- package/dist/components/combo-box/ComboBox.d.ts.map +1 -1
- package/dist/components/combo-box/ComboBox.js.map +1 -1
- package/dist/index.css +4 -3
- package/dist/index.css.map +1 -1
- package/dist/packages/tapestry-render/dist/{buildComponent-Dr2UOgFa.js → buildComponent-DDhu-82j.js} +44 -25
- package/dist/packages/tapestry-render/dist/buildComponent-DDhu-82j.js.map +1 -0
- package/dist/packages/tapestry-render/dist/index.js +2 -2
- package/dist/packages/tapestry-render/dist/index.js.map +1 -1
- package/dist/packages/tapestry-render/dist/legacy.js +2 -2
- package/dist/packages/tapestry-render/dist/legacy.js.map +1 -1
- package/dist/reactRender.css +1217 -1160
- package/dist/reactRender.css.map +1 -1
- package/dist/reactRenderLegacy.css +1217 -1160
- package/dist/reactRenderLegacy.css.map +1 -1
- package/dist/unstable.css +107 -50
- package/dist/unstable.css.map +1 -1
- package/package.json +5 -5
- package/dist/packages/tapestry-render/dist/buildComponent-Dr2UOgFa.js.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import '../button/ActionsDropdownIconButton.js';
|
|
2
|
+
import { Button } from '../button/Button.js';
|
|
3
|
+
import '../button/DropdownButton.js';
|
|
4
|
+
import '../button/DropdownIconButton.js';
|
|
5
|
+
import '../button/IconButton.js';
|
|
6
|
+
import '../button/LoadingButton.js';
|
|
7
|
+
import '../button/PageHeaderActionsDropdownButton.js';
|
|
8
|
+
import { ButtonGroup } from '../button-group/ButtonGroup.js';
|
|
9
|
+
import { DropdownSection, DropdownAction } from '../dropdown/Dropdown.js';
|
|
10
|
+
import { Popover, PopoverTrigger, PopoverContent } from '../popover/Popover.js';
|
|
11
|
+
import Icon from '../../utilities/Icon.js';
|
|
12
|
+
import { useId } from '../../utilities/useId.js';
|
|
13
|
+
import React__default from 'react';
|
|
14
|
+
import { Input } from 'react-aria-components/Input';
|
|
15
|
+
import { Label } from 'react-aria-components/Label';
|
|
16
|
+
import { Menu, SubmenuTrigger, Popover as Popover$1 } from 'react-aria-components/Menu';
|
|
17
|
+
|
|
18
|
+
const NOOP_ACTION = () => { };
|
|
19
|
+
// Must be a dedicated component, not returned inline from `renderFilterItem`.
|
|
20
|
+
// RAC clones an `id` onto whatever that function returns, and an inline
|
|
21
|
+
// `SubmenuTrigger` has none of its own — the clone falls back to `item.id`,
|
|
22
|
+
// colliding with the trigger child's own `id` and silently breaking it.
|
|
23
|
+
function FilterSubmenu({ group }) {
|
|
24
|
+
return (React__default.createElement(SubmenuTrigger, null,
|
|
25
|
+
React__default.createElement(DropdownAction, { className: "tds-data-table-filter-controls-submenu-trigger", id: group.label, onAction: NOOP_ACTION, textValue: group.label },
|
|
26
|
+
React__default.createElement("span", { slot: "label" }, group.label),
|
|
27
|
+
React__default.createElement(Icon, { "aria-hidden": true, className: "tds-data-table-filter-controls-submenu-chevron", slot: "suffix", symbol: "general#right-chevron" })),
|
|
28
|
+
React__default.createElement(Popover$1, { className: "tds-dropdown-popover tds-data-table-filter-controls-submenu-popover", placement: "right top" },
|
|
29
|
+
React__default.createElement(Menu, { "aria-label": group.label, className: "tds-data-table-filter-controls-submenu-list", items: group.children }, renderFilterItem))));
|
|
30
|
+
}
|
|
31
|
+
function renderFilterItem(node) {
|
|
32
|
+
if (node.children) {
|
|
33
|
+
if (node.renderChildrenInSubmenu) {
|
|
34
|
+
return React__default.createElement(FilterSubmenu, { key: node.label, group: node });
|
|
35
|
+
}
|
|
36
|
+
return (React__default.createElement(DropdownSection, { key: node.label, id: node.label, title: node.label }, node.children.map(renderFilterItem)));
|
|
37
|
+
}
|
|
38
|
+
return (React__default.createElement(DropdownAction, { key: node.name, id: node.name, onAction: NOOP_ACTION, textValue: node.label },
|
|
39
|
+
React__default.createElement("span", { slot: "label" }, node.label)));
|
|
40
|
+
}
|
|
41
|
+
/** Skeleton for the DataTable filters cluster — grows incrementally. */
|
|
42
|
+
function FilterControls({ filters }) {
|
|
43
|
+
const temporarySearchInputId = `tds-data-table-filter-controls-search-${useId()}`;
|
|
44
|
+
return (React__default.createElement(ButtonGroup, { "aria-label": "Filters", className: "tds-data-table-filter-controls" },
|
|
45
|
+
React__default.createElement(Popover, null,
|
|
46
|
+
React__default.createElement(PopoverTrigger, null,
|
|
47
|
+
React__default.createElement(Button, { label: "Add filter", prefix: React__default.createElement(Icon, { "aria-hidden": true, symbol: "general#three-reducing-horizontal-bars" }) })),
|
|
48
|
+
React__default.createElement(PopoverContent, { className: "tds-data-table-popover", placement: "bottom" },
|
|
49
|
+
React__default.createElement(Label, { className: "tds-data-table-filter-controls-label--hidden", htmlFor: temporarySearchInputId }, "Search filters"),
|
|
50
|
+
React__default.createElement(Input, { className: "tds-data-table-filter-controls-search-input", id: temporarySearchInputId, placeholder: "Search isn't implemented yet" }),
|
|
51
|
+
React__default.createElement(Menu, { "aria-label": "Filters", className: "tds-data-table-filter-controls-list", items: filters, renderEmptyState: () => "No filters match" }, renderFilterItem))),
|
|
52
|
+
React__default.createElement(Button, { label: "0" })));
|
|
53
|
+
}
|
|
54
|
+
FilterControls.displayName = "FilterControls";
|
|
55
|
+
|
|
56
|
+
export { FilterControls };
|
|
57
|
+
//# sourceMappingURL=FilterControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterControls.js","sources":["../../../src/components/DataTable/FilterControls.tsx"],"sourcesContent":["import { Button } from \"@components/button\"\nimport { ButtonGroup } from \"@components/button-group\"\nimport { DropdownAction, DropdownSection } from \"@components/dropdown\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"@components/popover\"\nimport Icon from \"@utilities/Icon\"\nimport { useId } from \"@utilities/useId\"\nimport React, { type ReactElement } from \"react\"\nimport { Input } from \"react-aria-components/Input\"\nimport { Label } from \"react-aria-components/Label\"\nimport {\n Menu,\n Popover as AriaPopover,\n SubmenuTrigger,\n} from \"react-aria-components/Menu\"\n\nimport type { FilterNode, FilterNodeGroup } from \"./FilterTypes\"\n\nconst NOOP_ACTION = () => {}\n\n// Must be a dedicated component, not returned inline from `renderFilterItem`.\n// RAC clones an `id` onto whatever that function returns, and an inline\n// `SubmenuTrigger` has none of its own — the clone falls back to `item.id`,\n// colliding with the trigger child's own `id` and silently breaking it.\nfunction FilterSubmenu({ group }: { group: FilterNodeGroup }) {\n return (\n <SubmenuTrigger>\n <DropdownAction\n className=\"tds-data-table-filter-controls-submenu-trigger\"\n id={group.label}\n onAction={NOOP_ACTION}\n textValue={group.label}\n >\n <span slot=\"label\">{group.label}</span>\n <Icon\n aria-hidden\n className=\"tds-data-table-filter-controls-submenu-chevron\"\n slot=\"suffix\"\n symbol=\"general#right-chevron\"\n />\n </DropdownAction>\n <AriaPopover\n className=\"tds-dropdown-popover tds-data-table-filter-controls-submenu-popover\"\n placement=\"right top\"\n >\n <Menu\n aria-label={group.label}\n className=\"tds-data-table-filter-controls-submenu-list\"\n items={group.children}\n >\n {renderFilterItem}\n </Menu>\n </AriaPopover>\n </SubmenuTrigger>\n )\n}\n\nfunction renderFilterItem(node: FilterNode): ReactElement {\n if (node.children) {\n if (node.renderChildrenInSubmenu) {\n return <FilterSubmenu key={node.label} group={node} />\n }\n\n return (\n <DropdownSection key={node.label} id={node.label} title={node.label}>\n {node.children.map(renderFilterItem)}\n </DropdownSection>\n )\n }\n\n return (\n <DropdownAction\n key={node.name}\n id={node.name}\n onAction={NOOP_ACTION}\n textValue={node.label}\n >\n <span slot=\"label\">{node.label}</span>\n </DropdownAction>\n )\n}\n\nexport interface FilterControlsProps {\n filters: FilterNode[]\n}\n\n/** Skeleton for the DataTable filters cluster — grows incrementally. */\nexport function FilterControls({ filters }: FilterControlsProps) {\n const temporarySearchInputId = `tds-data-table-filter-controls-search-${useId()}`\n\n return (\n <ButtonGroup\n aria-label=\"Filters\"\n className=\"tds-data-table-filter-controls\"\n >\n <Popover>\n <PopoverTrigger>\n <Button\n label=\"Add filter\"\n prefix={\n <Icon\n aria-hidden\n symbol=\"general#three-reducing-horizontal-bars\"\n />\n }\n />\n </PopoverTrigger>\n <PopoverContent className=\"tds-data-table-popover\" placement=\"bottom\">\n {/* Search will go here. */}\n <Label\n className=\"tds-data-table-filter-controls-label--hidden\"\n htmlFor={temporarySearchInputId}\n >\n Search filters\n </Label>\n <Input\n className=\"tds-data-table-filter-controls-search-input\"\n id={temporarySearchInputId}\n placeholder=\"Search isn't implemented yet\"\n />\n <Menu\n aria-label=\"Filters\"\n className=\"tds-data-table-filter-controls-list\"\n items={filters}\n renderEmptyState={() => \"No filters match\"}\n >\n {renderFilterItem}\n </Menu>\n </PopoverContent>\n </Popover>\n {/* Active filter count will go here. */}\n <Button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R,gBAAAA,cAAA,CAAA,aAAA,CAAC,KAAK,EAAA,EACJ,SAAS,EAAC,6CAA6C,EACvD,EAAE,EAAE,sBAAsB,EAC1B,WAAW,EAAC,8BAA8B,EAAA,CAC1C;gBACFA,cAAA,CAAA,aAAA,CAAC,IAAI,kBACQ,SAAS,EACpB,SAAS,EAAC,qCAAqC,EAC/C,KAAK,EAAE,OAAO,EACd,gBAAgB,EAAE,MAAM,kBAAkB,EAAA,EAEzC,gBAAgB,CACZ,CACQ,CACT;QAEVA,cAAA,CAAA,aAAA,CAAC,MAAM,IAAC,KAAK,EAAC,GAAG,EAAA,CAAG,CACR;AAElB;AAEA,cAAc,CAAC,WAAW,GAAG,gBAAgB;;;;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface FilterNodeBase {
|
|
2
|
+
/** Extra search terms beyond the label. Not yet matched by search. */
|
|
3
|
+
keywords?: string[];
|
|
4
|
+
}
|
|
5
|
+
export interface InputType {
|
|
6
|
+
type: string;
|
|
7
|
+
}
|
|
8
|
+
export interface Operator {
|
|
9
|
+
inputType: InputType;
|
|
10
|
+
label: string;
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
13
|
+
export interface FilterNodeItem extends FilterNodeBase {
|
|
14
|
+
children?: never;
|
|
15
|
+
/** Not rendered in the menu. Carried through as data for the change handler. */
|
|
16
|
+
description?: string;
|
|
17
|
+
/** Display name in the filter menu. */
|
|
18
|
+
label: string;
|
|
19
|
+
/**
|
|
20
|
+
* Stable id. Keys the active filter this config produces. Must be unique
|
|
21
|
+
* across the whole filter tree — it's applied as the item's `id`, and
|
|
22
|
+
* duplicates break the menu.
|
|
23
|
+
*/
|
|
24
|
+
name: string;
|
|
25
|
+
operators: Operator[];
|
|
26
|
+
}
|
|
27
|
+
export interface FilterNodeGroup extends FilterNodeBase {
|
|
28
|
+
/** Filters and nested groups, in display order. */
|
|
29
|
+
children: FilterNode[];
|
|
30
|
+
description?: never;
|
|
31
|
+
keywords?: string[];
|
|
32
|
+
/** Section header, or submenu trigger label. */
|
|
33
|
+
label: string;
|
|
34
|
+
/** Opens children in a submenu instead of an inline section. */
|
|
35
|
+
renderChildrenInSubmenu?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export type FilterNode = FilterNodeItem | FilterNodeGroup;
|
|
38
|
+
export interface ActiveFilter {
|
|
39
|
+
/** The HTML name of the applied filter. Connects to the name of the filter. */
|
|
40
|
+
name: string;
|
|
41
|
+
/** The operator used by the applied filter. Corresponds to the name of the operator in the filter configuration. */
|
|
42
|
+
operator: string;
|
|
43
|
+
/**
|
|
44
|
+
* The value of the applied filter. Can be of any type depending on the filter configuration.
|
|
45
|
+
* TODO: Add more specific typing based on the operator and input type.
|
|
46
|
+
*/
|
|
47
|
+
value: unknown;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=FilterTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterTypes.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/FilterTypes.tsx"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,SAAS,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,QAAQ,EAAE,CAAA;CACtB;AAED,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,mDAAmD;IACnD,QAAQ,EAAE,UAAU,EAAE,CAAA;IACtB,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAA;IACb,gEAAgE;IAChE,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC;AAED,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,eAAe,CAAA;AAEzD,MAAM,WAAW,YAAY;IAC3B,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAA;IACZ,qHAAqH;IACrH,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAA;CACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewSettingsToggle.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/ViewSettingsToggle.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,MAAM,WAAW,uBAAuB;IACtC,iEAAiE;IACjE,OAAO,EAAE,eAAe,EAAE,CAAA;IAC1B,wBAAwB,EAAE,CAAC,kBAAkB,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IAChE,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAUD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,wBAAwB,EACxB,kBAAkB,GACnB,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"ViewSettingsToggle.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/ViewSettingsToggle.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,MAAM,WAAW,uBAAuB;IACtC,iEAAiE;IACjE,OAAO,EAAE,eAAe,EAAE,CAAA;IAC1B,wBAAwB,EAAE,CAAC,kBAAkB,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IAChE,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAUD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,wBAAwB,EACxB,kBAAkB,GACnB,EAAE,uBAAuB,qBAoCzB;yBAxCe,kBAAkB"}
|
|
@@ -21,12 +21,11 @@ function renderColumnItem(column) {
|
|
|
21
21
|
* Compact View switch) as siblings inside the same dialog.
|
|
22
22
|
*/
|
|
23
23
|
function ViewSettingsToggle({ columns, onColumnVisibilityChange, visibleColumnNames, }) {
|
|
24
|
-
return (React__default.createElement(
|
|
25
|
-
React__default.createElement(
|
|
26
|
-
React__default.createElement(
|
|
27
|
-
React__default.createElement(
|
|
28
|
-
|
|
29
|
-
React__default.createElement(PopoverContent, { className: "tds-data-table-popover", modal: false, placement: "bottom end" }, columns.length > 0 && (React__default.createElement(FilterableListBox, { hideLabel: true, items: columns, label: "Column visibility", onSelectionChange: (keys) => onColumnVisibilityChange(keys), placeholder: "Search columns", selectedKeys: visibleColumnNames, selectionMode: "multiple", showBulkActions: true }, renderColumnItem))))));
|
|
24
|
+
return (React__default.createElement(Popover, null,
|
|
25
|
+
React__default.createElement(Tooltip, { content: "View settings", placement: "bottom end" },
|
|
26
|
+
React__default.createElement(PopoverTrigger, null,
|
|
27
|
+
React__default.createElement(IconButton, { "aria-label": "View settings", className: "tds-data-table-popover-trigger", icon: React__default.createElement(Icon, { "aria-hidden": true, symbol: "general#faders" }) }))),
|
|
28
|
+
React__default.createElement(PopoverContent, { className: "tds-data-table-popover", modal: false, placement: "bottom end" }, columns.length > 0 && (React__default.createElement(FilterableListBox, { hideLabel: true, items: columns, label: "Column visibility", onSelectionChange: (keys) => onColumnVisibilityChange(keys), placeholder: "Search columns", selectedKeys: visibleColumnNames, selectionMode: "multiple", showBulkActions: true }, renderColumnItem)))));
|
|
30
29
|
}
|
|
31
30
|
ViewSettingsToggle.displayName = "ViewSettingsToggle";
|
|
32
31
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewSettingsToggle.js","sources":["../../../src/components/DataTable/ViewSettingsToggle.tsx"],"sourcesContent":["import { IconButton } from \"@components/button\"\nimport {\n FilterableListBox,\n FilterableListBoxItem,\n} from \"@components/internal/filterable-list-box\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"@components/popover\"\nimport Icon from \"@utilities/Icon\"\nimport React from \"react\"\n\nimport { Tooltip } from \"../internal/tooltip/Tooltip\"\nimport type { DataTableColumn } from \"./DataTableColumn\"\n\nexport interface ViewSettingsToggleProps {\n /** The columns opted into visibility toggling via `hideable`. */\n columns: DataTableColumn[]\n onColumnVisibilityChange: (visibleColumnNames: string[]) => void\n visibleColumnNames: string[]\n}\n\nfunction renderColumnItem(column: DataTableColumn) {\n return (\n <FilterableListBoxItem id={column.name}>\n {column.headerLabel}\n </FilterableListBoxItem>\n )\n}\n\n/**\n * A trigger + popover for table view settings. Today it only holds column\n * visibility (via `FilterableListBox`), but the panel is meant to grow to\n * include other view-related settings (e.g. a Table/Card display toggle, a\n * Compact View switch) as siblings inside the same dialog.\n */\nexport function ViewSettingsToggle({\n columns,\n onColumnVisibilityChange,\n visibleColumnNames,\n}: ViewSettingsToggleProps) {\n return (\n <
|
|
1
|
+
{"version":3,"file":"ViewSettingsToggle.js","sources":["../../../src/components/DataTable/ViewSettingsToggle.tsx"],"sourcesContent":["import { IconButton } from \"@components/button\"\nimport {\n FilterableListBox,\n FilterableListBoxItem,\n} from \"@components/internal/filterable-list-box\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"@components/popover\"\nimport Icon from \"@utilities/Icon\"\nimport React from \"react\"\n\nimport { Tooltip } from \"../internal/tooltip/Tooltip\"\nimport type { DataTableColumn } from \"./DataTableColumn\"\n\nexport interface ViewSettingsToggleProps {\n /** The columns opted into visibility toggling via `hideable`. */\n columns: DataTableColumn[]\n onColumnVisibilityChange: (visibleColumnNames: string[]) => void\n visibleColumnNames: string[]\n}\n\nfunction renderColumnItem(column: DataTableColumn) {\n return (\n <FilterableListBoxItem id={column.name}>\n {column.headerLabel}\n </FilterableListBoxItem>\n )\n}\n\n/**\n * A trigger + popover for table view settings. Today it only holds column\n * visibility (via `FilterableListBox`), but the panel is meant to grow to\n * include other view-related settings (e.g. a Table/Card display toggle, a\n * Compact View switch) as siblings inside the same dialog.\n */\nexport function ViewSettingsToggle({\n columns,\n onColumnVisibilityChange,\n visibleColumnNames,\n}: ViewSettingsToggleProps) {\n return (\n <Popover>\n <Tooltip content=\"View settings\" placement=\"bottom end\">\n <PopoverTrigger>\n <IconButton\n aria-label=\"View settings\"\n className=\"tds-data-table-popover-trigger\"\n icon={<Icon aria-hidden symbol=\"general#faders\" />}\n />\n </PopoverTrigger>\n </Tooltip>\n <PopoverContent\n className=\"tds-data-table-popover\"\n modal={false}\n placement=\"bottom end\"\n >\n {columns.length > 0 && (\n <FilterableListBox\n hideLabel\n items={columns}\n label=\"Column visibility\"\n onSelectionChange={(keys) =>\n onColumnVisibilityChange(keys as string[])\n }\n placeholder=\"Search columns\"\n selectedKeys={visibleColumnNames}\n selectionMode=\"multiple\"\n showBulkActions\n >\n {renderColumnItem}\n </FilterableListBox>\n )}\n </PopoverContent>\n </Popover>\n )\n}\n\nViewSettingsToggle.displayName = \"ViewSettingsToggle\"\n"],"names":["React"],"mappings":";;;;;;;;;;;;;AAmBA,SAAS,gBAAgB,CAAC,MAAuB,EAAA;AAC/C,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,qBAAqB,EAAA,EAAC,EAAE,EAAE,MAAM,CAAC,IAAI,IACnC,MAAM,CAAC,WAAW,CACG;AAE5B;AAEA;;;;;AAKG;AACG,SAAU,kBAAkB,CAAC,EACjC,OAAO,EACP,wBAAwB,EACxB,kBAAkB,GACM,EAAA;IACxB,QACEA,6BAAC,OAAO,EAAA,IAAA;QACNA,cAAA,CAAA,aAAA,CAAC,OAAO,IAAC,OAAO,EAAC,eAAe,EAAC,SAAS,EAAC,YAAY,EAAA;AACrD,YAAAA,cAAA,CAAA,aAAA,CAAC,cAAc,EAAA,IAAA;AACb,gBAAAA,cAAA,CAAA,aAAA,CAAC,UAAU,EAAA,EAAA,YAAA,EACE,eAAe,EAC1B,SAAS,EAAC,gCAAgC,EAC1C,IAAI,EAAEA,cAAA,CAAA,aAAA,CAAC,IAAI,yBAAa,MAAM,EAAC,gBAAgB,EAAA,CAAG,EAAA,CAClD,CACa,CACT;AACV,QAAAA,cAAA,CAAA,aAAA,CAAC,cAAc,EAAA,EACb,SAAS,EAAC,wBAAwB,EAClC,KAAK,EAAE,KAAK,EACZ,SAAS,EAAC,YAAY,EAAA,EAErB,OAAO,CAAC,MAAM,GAAG,CAAC,KACjBA,6BAAC,iBAAiB,EAAA,EAChB,SAAS,EAAA,IAAA,EACT,KAAK,EAAE,OAAO,EACd,KAAK,EAAC,mBAAmB,EACzB,iBAAiB,EAAE,CAAC,IAAI,KACtB,wBAAwB,CAAC,IAAgB,CAAC,EAE5C,WAAW,EAAC,gBAAgB,EAC5B,YAAY,EAAE,kBAAkB,EAChC,aAAa,EAAC,UAAU,EACxB,eAAe,EAAA,IAAA,EAAA,EAEd,gBAAgB,CACC,CACrB,CACc,CACT;AAEd;AAEA,kBAAkB,CAAC,WAAW,GAAG,oBAAoB;;;;"}
|
|
@@ -63,7 +63,7 @@ export interface ComboBoxProps<T extends object = object> {
|
|
|
63
63
|
size?: ComboBoxSize;
|
|
64
64
|
}
|
|
65
65
|
type AriaComboBoxPropsToOmit = "slot";
|
|
66
|
-
type AriaComboBoxPropsToInclude = "allowsEmptyCollection" | "
|
|
66
|
+
type AriaComboBoxPropsToInclude = "allowsEmptyCollection" | "defaultItems" | "defaultValue" | "disabledKeys" | "inputValue" | "items" | "name" | "onInputChange" | "selectionMode" | "value";
|
|
67
67
|
export type ComboBoxElementProps<T extends object = object> = CombineAriaPropsWithCustomProps<AriaComboBoxProps<T, "single" | "multiple">, ComboBoxProps<T>, AriaComboBoxPropsToOmit, AriaComboBoxPropsToInclude>;
|
|
68
68
|
/**
|
|
69
69
|
* A combo box combines a text input with a filterable popover
|
|
@@ -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,oBAAoB,CAAA;AAC3B,OAAO,aAAa,CAAA;AAKpB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AACzD,OAAO,EAIL,KAAK,aAAa,IAAI,iBAAiB,EAGvC,KAAK,GAAG,EAIR,KAAK,gBAAgB,EAErB,KAAK,YAAY,IAAI,gBAAgB,EAErC,KAAK,mBAAmB,EAGzB,MAAM,gCAAgC,CAAA;AAIvC,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAA;AAEtC,MAAM,MAAM,oBAAoB,GAC5B,OAAO,GACP,WAAW,GACX,MAAM,GACN,SAAS,GACT,aAAa,GACb,SAAS,CAAA;AAEb,KAAK,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI,WAAW,CACnD,gBAAgB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAChC,CAAA;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACtD,mCAAmC;IACnC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAA;IAC7B,gGAAgG;IAChG,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mFAAmF;IACnF,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAA;IAC3D,qGAAqG;IACrG,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MAAM,WAAW,iBAAiB;IAChC,yBAAyB;IACzB,QAAQ,CAAC,EAAE,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;;;;;;;;;GASG;AACH,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;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,EAChD,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,SAAS,EACb,EAAE,2BAA2B,CAAC,CAAC,CAAC,qBAYhC"}
|
|
@@ -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 LoadingSpinner from \"@components/internal/LoadingSpinner\"\nimport Icon from \"@utilities/Icon\"\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport classNames from \"classnames\"\nimport React, { type ReactNode, useContext } 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 /** 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 * - 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 | \"defaultInputValue\"\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 * 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/components-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 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 <div aria-label=\"Loading more\" role=\"status\">\n <LoadingSpinner />\n </div>\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 <Input\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\n aria-label={\n loadingState === \"loading\" ? \"Loading\" : undefined\n }\n className=\"tds-combo-box-empty-state\"\n role={loadingState === \"loading\" ? \"status\" : undefined}\n >\n {loadingState === \"loading\" ? (\n <LoadingSpinner />\n ) : (\n resolveEmptyState(renderEmptyState)\n )}\n </div>\n )\n : undefined\n }\n >\n {renderChildren()}\n {loadMoreItem}\n </ListBox>\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/components-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/components-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":";;;;;;;;;;;;;;;AA6HA,SAAS,iBAAiB,CAAC,KAAoC,EAAA;AAC7D,IAAA,OAAO,OAAO,KAAK,KAAK,UAAU,GAAG,KAAK,EAAE,GAAG,KAAK;AACtD;AAEA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AAU,YAAY,CAAmB,EAC7C,SAAS,EACT,QAAQ,EACR,GAAG,SAAS,EACgB,EAAA;IAC5B,QACE,oBAAC,WAAW,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,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 LoadingSpinner from \"@components/internal/LoadingSpinner\"\nimport Icon from \"@utilities/Icon\"\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport classNames from \"classnames\"\nimport React, { type ReactNode, useContext } 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 /** 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 * - 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 * 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/components-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 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 <div aria-label=\"Loading more\" role=\"status\">\n <LoadingSpinner />\n </div>\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 <Input\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\n aria-label={\n loadingState === \"loading\" ? \"Loading\" : undefined\n }\n className=\"tds-combo-box-empty-state\"\n role={loadingState === \"loading\" ? \"status\" : undefined}\n >\n {loadingState === \"loading\" ? (\n <LoadingSpinner />\n ) : (\n resolveEmptyState(renderEmptyState)\n )}\n </div>\n )\n : undefined\n }\n >\n {renderChildren()}\n {loadMoreItem}\n </ListBox>\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/components-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/components-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":";;;;;;;;;;;;;;;AA4HA,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,CAA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AAS,CAAC,EAAA;QAE7D,KAAK,KACJ,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,SAAS,EAAC,8BAA8B,EAAA,EAAE,KAAK,CAAU,CAClE;QACA,QAAQ,CACM;AAErB;;;;"}
|
package/dist/index.css
CHANGED
|
@@ -5802,11 +5802,12 @@ a.tds-dropdown-item:is(:hover, :active){
|
|
|
5802
5802
|
}
|
|
5803
5803
|
|
|
5804
5804
|
@supports ((-webkit-appearance: base-select) or (-moz-appearance: base-select) or (appearance: base-select)){
|
|
5805
|
+
@media (hover) and (pointer: fine){
|
|
5805
5806
|
.tds-select select:has(> button){
|
|
5806
|
-
|
|
5807
|
-
|
|
5807
|
+
padding-inline-end:0;
|
|
5808
|
+
background-image:none;
|
|
5808
5809
|
}
|
|
5809
|
-
|
|
5810
|
+
|
|
5810
5811
|
:is(.tds-select select:has( > button)),:is(.tds-select select:has( > button))::picker(select){
|
|
5811
5812
|
padding-block:0;
|
|
5812
5813
|
-webkit-appearance:base-select;
|