@pipe0/react 1.0.31 → 1.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/components/defaults/adapters/context-select-input.mjs +1 -0
  3. package/dist/components/defaults/adapters/context-select-input.mjs.map +1 -1
  4. package/dist/components/defaults/adapters/loose-object-input.mjs +2 -2
  5. package/dist/components/defaults/adapters/loose-object-input.mjs.map +1 -1
  6. package/dist/components/defaults/catalog/card-derived.d.mts +1 -1
  7. package/dist/components/defaults/catalog/card-derived.mjs +0 -1
  8. package/dist/components/defaults/catalog/card-derived.mjs.map +1 -1
  9. package/dist/components/defaults/catalog/card-primitives.d.mts +2 -2
  10. package/dist/components/defaults/catalog/card-primitives.mjs +2 -2
  11. package/dist/components/defaults/catalog/card-primitives.mjs.map +1 -1
  12. package/dist/components/internal/LiquidEditor/ChipEditPopover.mjs +60 -14
  13. package/dist/components/internal/LiquidEditor/ChipEditPopover.mjs.map +1 -1
  14. package/dist/context/catalog-card-context.mjs +3 -7
  15. package/dist/context/catalog-card-context.mjs.map +1 -1
  16. package/dist/context/catalog-config-context.d.mts +1 -1
  17. package/dist/context/catalog-config-context.mjs +1 -1
  18. package/dist/context/catalog-config-context.mjs.map +1 -1
  19. package/dist/hooks/catalog-table.d.mts.map +1 -1
  20. package/dist/hooks/catalog-table.mjs +13 -2
  21. package/dist/hooks/catalog-table.mjs.map +1 -1
  22. package/dist/hooks/use-pipe-catalog-table.d.mts +8 -8
  23. package/dist/index.d.mts +2 -17
  24. package/dist/index.mjs +1 -16
  25. package/dist/styles/pipe0-form.css +1 -1
  26. package/dist/types/catalog-adapters.d.mts +2 -19
  27. package/dist/types/catalog-adapters.d.mts.map +1 -1
  28. package/package.json +2 -2
  29. package/dist/components/compound/searches-catalog/active-filters.d.mts +0 -23
  30. package/dist/components/compound/searches-catalog/active-filters.d.mts.map +0 -1
  31. package/dist/components/compound/searches-catalog/active-filters.mjs +0 -50
  32. package/dist/components/compound/searches-catalog/active-filters.mjs.map +0 -1
  33. package/dist/components/compound/searches-catalog/card.d.mts +0 -22
  34. package/dist/components/compound/searches-catalog/card.d.mts.map +0 -1
  35. package/dist/components/compound/searches-catalog/card.mjs +0 -82
  36. package/dist/components/compound/searches-catalog/card.mjs.map +0 -1
  37. package/dist/components/compound/searches-catalog/category-filter.d.mts +0 -27
  38. package/dist/components/compound/searches-catalog/category-filter.d.mts.map +0 -1
  39. package/dist/components/compound/searches-catalog/category-filter.mjs +0 -61
  40. package/dist/components/compound/searches-catalog/category-filter.mjs.map +0 -1
  41. package/dist/components/compound/searches-catalog/column-filter.d.mts +0 -29
  42. package/dist/components/compound/searches-catalog/column-filter.d.mts.map +0 -1
  43. package/dist/components/compound/searches-catalog/column-filter.mjs +0 -64
  44. package/dist/components/compound/searches-catalog/column-filter.mjs.map +0 -1
  45. package/dist/components/compound/searches-catalog/column-filters.d.mts +0 -15
  46. package/dist/components/compound/searches-catalog/column-filters.d.mts.map +0 -1
  47. package/dist/components/compound/searches-catalog/column-filters.mjs +0 -16
  48. package/dist/components/compound/searches-catalog/column-filters.mjs.map +0 -1
  49. package/dist/components/compound/searches-catalog/empty.d.mts +0 -17
  50. package/dist/components/compound/searches-catalog/empty.d.mts.map +0 -1
  51. package/dist/components/compound/searches-catalog/empty.mjs +0 -29
  52. package/dist/components/compound/searches-catalog/empty.mjs.map +0 -1
  53. package/dist/components/compound/searches-catalog/index.d.mts +0 -12
  54. package/dist/components/compound/searches-catalog/list.d.mts +0 -19
  55. package/dist/components/compound/searches-catalog/list.d.mts.map +0 -1
  56. package/dist/components/compound/searches-catalog/list.mjs +0 -33
  57. package/dist/components/compound/searches-catalog/list.mjs.map +0 -1
  58. package/dist/components/compound/searches-catalog/output-field-filter.d.mts +0 -22
  59. package/dist/components/compound/searches-catalog/output-field-filter.d.mts.map +0 -1
  60. package/dist/components/compound/searches-catalog/output-field-filter.mjs +0 -22
  61. package/dist/components/compound/searches-catalog/output-field-filter.mjs.map +0 -1
  62. package/dist/components/compound/searches-catalog/provider-filter.d.mts +0 -22
  63. package/dist/components/compound/searches-catalog/provider-filter.d.mts.map +0 -1
  64. package/dist/components/compound/searches-catalog/provider-filter.mjs +0 -29
  65. package/dist/components/compound/searches-catalog/provider-filter.mjs.map +0 -1
  66. package/dist/components/compound/searches-catalog/root.d.mts +0 -33
  67. package/dist/components/compound/searches-catalog/root.d.mts.map +0 -1
  68. package/dist/components/compound/searches-catalog/root.mjs +0 -74
  69. package/dist/components/compound/searches-catalog/root.mjs.map +0 -1
  70. package/dist/components/compound/searches-catalog/search-filter.d.mts +0 -21
  71. package/dist/components/compound/searches-catalog/search-filter.d.mts.map +0 -1
  72. package/dist/components/compound/searches-catalog/search-filter.mjs +0 -47
  73. package/dist/components/compound/searches-catalog/search-filter.mjs.map +0 -1
  74. package/dist/components/compound/searches-catalog/tag-filter.d.mts +0 -22
  75. package/dist/components/compound/searches-catalog/tag-filter.d.mts.map +0 -1
  76. package/dist/components/compound/searches-catalog/tag-filter.mjs +0 -22
  77. package/dist/components/compound/searches-catalog/tag-filter.mjs.map +0 -1
  78. package/dist/context/searches-catalog-card-context.d.mts +0 -24
  79. package/dist/context/searches-catalog-card-context.d.mts.map +0 -1
  80. package/dist/context/searches-catalog-card-context.mjs +0 -13
  81. package/dist/context/searches-catalog-card-context.mjs.map +0 -1
  82. package/dist/context/searches-catalog-context.d.mts +0 -20
  83. package/dist/context/searches-catalog-context.d.mts.map +0 -1
  84. package/dist/context/searches-catalog-context.mjs +0 -13
  85. package/dist/context/searches-catalog-context.mjs.map +0 -1
  86. package/dist/hooks/use-searches-catalog-table.d.mts +0 -56
  87. package/dist/hooks/use-searches-catalog-table.d.mts.map +0 -1
  88. package/dist/hooks/use-searches-catalog-table.mjs +0 -159
  89. package/dist/hooks/use-searches-catalog-table.mjs.map +0 -1
@@ -1,29 +0,0 @@
1
- import { useSearchesCatalogContext } from "../../../context/searches-catalog-context.mjs";
2
- import { SearchesCatalogColumnFilter } from "./column-filter.mjs";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- import { getProviderEntry } from "@pipe0/base";
5
- import { Building2 } from "lucide-react";
6
-
7
- //#region src/components/compound/searches-catalog/provider-filter.tsx
8
- const DEFAULT_PLACEHOLDER = /* @__PURE__ */ jsxs("span", {
9
- className: "pz:inline-flex pz:items-center pz:gap-1.5",
10
- children: [/* @__PURE__ */ jsx(Building2, { className: "pz:size-4" }), " Provider"]
11
- });
12
- function SearchesCatalogProviderFilter({ options, placeholder = DEFAULT_PLACEHOLDER, className, render }) {
13
- const ctx = useSearchesCatalogContext();
14
- return /* @__PURE__ */ jsx(SearchesCatalogColumnFilter, {
15
- id: "providers",
16
- placeholder,
17
- options: options ?? ctx.sortedProviderEntries.map(([name]) => ({
18
- label: name,
19
- value: name,
20
- imageSrc: getProviderEntry(name)?.logoUrl
21
- })),
22
- className,
23
- render
24
- });
25
- }
26
-
27
- //#endregion
28
- export { SearchesCatalogProviderFilter };
29
- //# sourceMappingURL=provider-filter.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"provider-filter.mjs","names":[],"sources":["../../../../src/components/compound/searches-catalog/provider-filter.tsx"],"sourcesContent":["import type { useRender } from \"@base-ui/react/use-render\";\nimport { getProviderEntry, type ProviderName } from \"@pipe0/base\";\nimport { Building2 } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport { useSearchesCatalogContext } from \"../../../context/searches-catalog-context.js\";\nimport type { FilterSelectOption } from \"../../defaults/catalog/filter-select.js\";\nimport { type ColumnFilterState, SearchesCatalogColumnFilter } from \"./column-filter.js\";\n\nexport interface SearchesCatalogProviderFilterProps {\n options?: ReadonlyArray<FilterSelectOption>;\n placeholder?: ReactNode;\n className?: string;\n render?: useRender.ComponentProps<\"div\", ColumnFilterState>[\"render\"];\n}\n\nconst DEFAULT_PLACEHOLDER = (\n <span className=\"pz:inline-flex pz:items-center pz:gap-1.5\">\n <Building2 className=\"pz:size-4\" /> Provider\n </span>\n);\n\nexport function SearchesCatalogProviderFilter({\n options,\n placeholder = DEFAULT_PLACEHOLDER,\n className,\n render,\n}: SearchesCatalogProviderFilterProps) {\n const ctx = useSearchesCatalogContext();\n const resolvedOptions =\n options ??\n ctx.sortedProviderEntries.map(([name]) => ({\n label: name,\n value: name,\n imageSrc: getProviderEntry(name as ProviderName)?.logoUrl,\n }));\n\n return (\n <SearchesCatalogColumnFilter\n id=\"providers\"\n placeholder={placeholder}\n options={resolvedOptions}\n className={className}\n render={render}\n />\n );\n}\n"],"mappings":";;;;;;;AAeA,MAAM,sBACJ,qBAAC,QAAD;CAAM,WAAU;WAAhB,CACE,oBAAC,WAAD,EAAW,WAAU,aAAc,eAC9B;;AAGT,SAAgB,8BAA8B,EAC5C,SACA,cAAc,qBACd,WACA,UACqC;CACrC,MAAM,MAAM,2BAA2B;AASvC,QACE,oBAAC,6BAAD;EACE,IAAG;EACU;EACb,SAXF,WACA,IAAI,sBAAsB,KAAK,CAAC,WAAW;GACzC,OAAO;GACP,OAAO;GACP,UAAU,iBAAiB,KAAqB,EAAE;GACnD,EAAE;EAOU;EACH;EACR"}
@@ -1,33 +0,0 @@
1
- import { CatalogClassNames, CatalogComponentOverrides, SearchesCardData } from "../../../types/catalog-adapters.mjs";
2
- import { UseSearchesCatalogTableReturn } from "../../../hooks/use-searches-catalog-table.mjs";
3
- import { useRender } from "@base-ui/react/use-render";
4
- import { ReactNode, SyntheticEvent } from "react";
5
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
6
- import { CatalogFilter } from "@pipe0/base";
7
- import { ColumnFilter } from "@tanstack/react-table";
8
-
9
- //#region src/components/compound/searches-catalog/root.d.ts
10
- interface CustomizationProps {
11
- classNames?: CatalogClassNames;
12
- components?: CatalogComponentOverrides;
13
- className?: string;
14
- render?: useRender.ComponentProps<"div">["render"];
15
- }
16
- interface SelectionProps {
17
- /** Fires on click / keyboard activation of any `<SearchesCatalogCard>`. */
18
- onSelectSearches?: (searches: SearchesCardData, e: SyntheticEvent) => void;
19
- }
20
- interface SearchesCatalogInstanceProps extends CustomizationProps, SelectionProps {
21
- context: UseSearchesCatalogTableReturn;
22
- children?: ReactNode;
23
- }
24
- interface SearchesCatalogZeroConfigProps extends CustomizationProps, SelectionProps {
25
- filter?: CatalogFilter;
26
- initialColumnFilters?: ColumnFilter[];
27
- children?: ReactNode;
28
- }
29
- type SearchesCatalogProps = SearchesCatalogInstanceProps | SearchesCatalogZeroConfigProps;
30
- declare function SearchesCatalog(props: SearchesCatalogProps): _$react_jsx_runtime0.JSX.Element;
31
- //#endregion
32
- export { SearchesCatalog, SearchesCatalogInstanceProps, SearchesCatalogProps, SearchesCatalogZeroConfigProps };
33
- //# sourceMappingURL=root.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"root.d.mts","names":[],"sources":["../../../../src/components/compound/searches-catalog/root.tsx"],"mappings":";;;;;;;;;UA+BU,kBAAA;EACR,UAAA,GAAa,iBAAA;EACb,UAAA,GAAa,yBAAA;EACb,SAAA;EACA,MAAA,GAAS,SAAA,CAAU,cAAA;AAAA;AAAA,UAGX,cAAA;EALK;EAOb,gBAAA,IAAoB,QAAA,EAAU,gBAAA,EAAkB,CAAA,EAAG,cAAA;AAAA;AAAA,UAGpC,4BAAA,SAAqC,kBAAA,EAAoB,cAAA;EACxE,OAAA,EAAS,6BAAA;EACT,QAAA,GAAW,SAAA;AAAA;AAAA,UAGI,8BAAA,SAAuC,kBAAA,EAAoB,cAAA;EAC1E,MAAA,GAAS,aAAA;EACT,oBAAA,GAAuB,YAAA;EACvB,QAAA,GAAW,SAAA;AAAA;AAAA,KAGD,oBAAA,GAAuB,4BAAA,GAA+B,8BAAA;AAAA,iBAElD,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAoB,oBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -1,74 +0,0 @@
1
- import { CatalogProvider, CatalogRoot, useCatalogConfig } from "../../../context/catalog-config-context.mjs";
2
- import { SearchesCatalogContext } from "../../../context/searches-catalog-context.mjs";
3
- import { DefaultCatalogRoot } from "../../defaults/catalog/layout.mjs";
4
- import { SearchesCatalogActiveFilters } from "./active-filters.mjs";
5
- import { SearchesCatalogCategoryFilter } from "./category-filter.mjs";
6
- import { SearchesCatalogColumnFilters } from "./column-filters.mjs";
7
- import { SearchesCatalogEmpty } from "./empty.mjs";
8
- import { SearchesCatalogList } from "./list.mjs";
9
- import { useSearchesCatalogTable } from "../../../hooks/use-searches-catalog-table.mjs";
10
- import { SearchesCatalogSearchFilter } from "./search-filter.mjs";
11
- import { useMemo, useState } from "react";
12
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
-
14
- //#region src/components/compound/searches-catalog/root.tsx
15
- function SearchesCatalog(props) {
16
- if ("context" in props) return /* @__PURE__ */ jsx(SearchesCatalogWithContext, { ...props });
17
- return /* @__PURE__ */ jsx(SearchesCatalogZeroConfig, { ...props });
18
- }
19
- function SearchesCatalogZeroConfig({ filter, initialColumnFilters, ...rest }) {
20
- return /* @__PURE__ */ jsx(SearchesCatalogWithContext, {
21
- context: useSearchesCatalogTable({
22
- filter,
23
- initialColumnFilters
24
- }),
25
- ...rest
26
- });
27
- }
28
- function SearchesCatalogWithContext({ context, children, className, classNames, components, onSelectSearches, render }) {
29
- const hasLocalOverrides = classNames || components;
30
- const [expandedCardId, setExpandedCardId] = useState(null);
31
- const value = useMemo(() => ({
32
- ...context,
33
- onSelectCard: onSelectSearches,
34
- expandedCardId,
35
- setExpandedCardId
36
- }), [
37
- context,
38
- onSelectSearches,
39
- expandedCardId
40
- ]);
41
- const inner = /* @__PURE__ */ jsx(SearchesCatalogContext.Provider, {
42
- value,
43
- children: /* @__PURE__ */ jsx(SearchesCatalogShell, {
44
- className,
45
- render,
46
- children
47
- })
48
- });
49
- if (hasLocalOverrides) return /* @__PURE__ */ jsx(CatalogRoot, { children: /* @__PURE__ */ jsx(CatalogProvider, {
50
- classNames,
51
- components,
52
- children: inner
53
- }) });
54
- return /* @__PURE__ */ jsx(CatalogRoot, { children: inner });
55
- }
56
- function SearchesCatalogShell({ children, className, render }) {
57
- useCatalogConfig();
58
- return /* @__PURE__ */ jsx(DefaultCatalogRoot, {
59
- className,
60
- render,
61
- children: children !== void 0 ? children : /* @__PURE__ */ jsxs(Fragment$1, { children: [
62
- /* @__PURE__ */ jsx(SearchesCatalogSearchFilter, {}),
63
- /* @__PURE__ */ jsx(SearchesCatalogCategoryFilter, {}),
64
- /* @__PURE__ */ jsx(SearchesCatalogColumnFilters, {}),
65
- /* @__PURE__ */ jsx(SearchesCatalogActiveFilters, {}),
66
- /* @__PURE__ */ jsx(SearchesCatalogList, {}),
67
- /* @__PURE__ */ jsx(SearchesCatalogEmpty, {})
68
- ] })
69
- });
70
- }
71
-
72
- //#endregion
73
- export { SearchesCatalog };
74
- //# sourceMappingURL=root.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"root.mjs","names":[],"sources":["../../../../src/components/compound/searches-catalog/root.tsx"],"sourcesContent":["import type { useRender } from \"@base-ui/react/use-render\";\nimport type { CatalogFilter } from \"@pipe0/base\";\nimport type { ColumnFilter } from \"@tanstack/react-table\";\nimport type { ReactNode, SyntheticEvent } from \"react\";\nimport { useMemo, useState } from \"react\";\nimport {\n CatalogProvider,\n CatalogRoot,\n useCatalogConfig,\n} from \"../../../context/catalog-config-context.js\";\nimport {\n SearchesCatalogContext,\n type SearchesCatalogContextValue,\n} from \"../../../context/searches-catalog-context.js\";\nimport {\n type UseSearchesCatalogTableReturn,\n useSearchesCatalogTable,\n} from \"../../../hooks/use-searches-catalog-table.js\";\nimport type {\n CatalogClassNames,\n CatalogComponentOverrides,\n SearchesCardData,\n} from \"../../../types/catalog-adapters.js\";\nimport { DefaultCatalogRoot } from \"../../defaults/catalog/layout.js\";\nimport { SearchesCatalogActiveFilters } from \"./active-filters.js\";\nimport { SearchesCatalogCategoryFilter } from \"./category-filter.js\";\nimport { SearchesCatalogColumnFilters } from \"./column-filters.js\";\nimport { SearchesCatalogEmpty } from \"./empty.js\";\nimport { SearchesCatalogList } from \"./list.js\";\nimport { SearchesCatalogSearchFilter } from \"./search-filter.js\";\n\ninterface CustomizationProps {\n classNames?: CatalogClassNames;\n components?: CatalogComponentOverrides;\n className?: string;\n render?: useRender.ComponentProps<\"div\">[\"render\"];\n}\n\ninterface SelectionProps {\n /** Fires on click / keyboard activation of any `<SearchesCatalogCard>`. */\n onSelectSearches?: (searches: SearchesCardData, e: SyntheticEvent) => void;\n}\n\nexport interface SearchesCatalogInstanceProps extends CustomizationProps, SelectionProps {\n context: UseSearchesCatalogTableReturn;\n children?: ReactNode;\n}\n\nexport interface SearchesCatalogZeroConfigProps extends CustomizationProps, SelectionProps {\n filter?: CatalogFilter;\n initialColumnFilters?: ColumnFilter[];\n children?: ReactNode;\n}\n\nexport type SearchesCatalogProps = SearchesCatalogInstanceProps | SearchesCatalogZeroConfigProps;\n\nexport function SearchesCatalog(props: SearchesCatalogProps) {\n if (\"context\" in props) {\n return <SearchesCatalogWithContext {...props} />;\n }\n return <SearchesCatalogZeroConfig {...props} />;\n}\n\nfunction SearchesCatalogZeroConfig({\n filter,\n initialColumnFilters,\n ...rest\n}: SearchesCatalogZeroConfigProps) {\n const context = useSearchesCatalogTable({ filter, initialColumnFilters });\n return <SearchesCatalogWithContext context={context} {...rest} />;\n}\n\nfunction SearchesCatalogWithContext({\n context,\n children,\n className,\n classNames,\n components,\n onSelectSearches,\n render,\n}: SearchesCatalogInstanceProps) {\n const hasLocalOverrides = classNames || components;\n const [expandedCardId, setExpandedCardId] = useState<string | null>(null);\n\n const value = useMemo<SearchesCatalogContextValue>(\n () => ({\n ...context,\n onSelectCard: onSelectSearches,\n expandedCardId,\n setExpandedCardId,\n }),\n [context, onSelectSearches, expandedCardId],\n );\n\n const inner = (\n <SearchesCatalogContext.Provider value={value}>\n <SearchesCatalogShell className={className} render={render}>\n {children}\n </SearchesCatalogShell>\n </SearchesCatalogContext.Provider>\n );\n if (hasLocalOverrides) {\n return (\n <CatalogRoot>\n <CatalogProvider classNames={classNames} components={components}>\n {inner}\n </CatalogProvider>\n </CatalogRoot>\n );\n }\n return <CatalogRoot>{inner}</CatalogRoot>;\n}\n\nfunction SearchesCatalogShell({\n children,\n className,\n render,\n}: {\n children?: ReactNode;\n className?: string;\n render?: useRender.ComponentProps<\"div\">[\"render\"];\n}) {\n useCatalogConfig();\n const body =\n children !== undefined ? (\n children\n ) : (\n <>\n <SearchesCatalogSearchFilter />\n <SearchesCatalogCategoryFilter />\n <SearchesCatalogColumnFilters />\n <SearchesCatalogActiveFilters />\n <SearchesCatalogList />\n <SearchesCatalogEmpty />\n </>\n );\n return (\n <DefaultCatalogRoot className={className} render={render}>\n {body}\n </DefaultCatalogRoot>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAwDA,SAAgB,gBAAgB,OAA6B;AAC3D,KAAI,aAAa,MACf,QAAO,oBAAC,4BAAD,EAA4B,GAAI,OAAS;AAElD,QAAO,oBAAC,2BAAD,EAA2B,GAAI,OAAS;;AAGjD,SAAS,0BAA0B,EACjC,QACA,sBACA,GAAG,QAC8B;AAEjC,QAAO,oBAAC,4BAAD;EAA4B,SADnB,wBAAwB;GAAE;GAAQ;GAAsB,CAAC;EACpB,GAAI;EAAQ;;AAGnE,SAAS,2BAA2B,EAClC,SACA,UACA,WACA,YACA,YACA,kBACA,UAC+B;CAC/B,MAAM,oBAAoB,cAAc;CACxC,MAAM,CAAC,gBAAgB,qBAAqB,SAAwB,KAAK;CAEzE,MAAM,QAAQ,eACL;EACL,GAAG;EACH,cAAc;EACd;EACA;EACD,GACD;EAAC;EAAS;EAAkB;EAAe,CAC5C;CAED,MAAM,QACJ,oBAAC,uBAAuB,UAAxB;EAAwC;YACtC,oBAAC,sBAAD;GAAiC;GAAmB;GACjD;GACoB;EACS;AAEpC,KAAI,kBACF,QACE,oBAAC,aAAD,YACE,oBAAC,iBAAD;EAA6B;EAAwB;YAClD;EACe,GACN;AAGlB,QAAO,oBAAC,aAAD,YAAc,OAAoB;;AAG3C,SAAS,qBAAqB,EAC5B,UACA,WACA,UAKC;AACD,mBAAkB;AAclB,QACE,oBAAC,oBAAD;EAA+B;EAAmB;YAblD,aAAa,SACX,WAEA;GACE,oBAAC,6BAAD,EAA+B;GAC/B,oBAAC,+BAAD,EAAiC;GACjC,oBAAC,8BAAD,EAAgC;GAChC,oBAAC,8BAAD,EAAgC;GAChC,oBAAC,qBAAD,EAAuB;GACvB,oBAAC,sBAAD,EAAwB;GACvB;EAKgB"}
@@ -1,21 +0,0 @@
1
- import { useRender } from "@base-ui/react/use-render";
2
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
-
4
- //#region src/components/compound/searches-catalog/search-filter.d.ts
5
- interface SearchesCatalogSearchFilterState {
6
- value: string;
7
- setValue: (value: string) => void;
8
- isActive: boolean;
9
- }
10
- interface SearchesCatalogSearchFilterProps extends useRender.ComponentProps<"input", SearchesCatalogSearchFilterState> {
11
- placeholder?: string;
12
- }
13
- declare function SearchesCatalogSearchFilter({
14
- placeholder,
15
- className,
16
- render,
17
- ...props
18
- }: SearchesCatalogSearchFilterProps): _$react_jsx_runtime0.JSX.Element;
19
- //#endregion
20
- export { SearchesCatalogSearchFilter, SearchesCatalogSearchFilterProps, SearchesCatalogSearchFilterState };
21
- //# sourceMappingURL=search-filter.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"search-filter.d.mts","names":[],"sources":["../../../../src/components/compound/searches-catalog/search-filter.tsx"],"mappings":";;;;UASiB,gCAAA;EACf,KAAA;EACA,QAAA,GAAW,KAAA;EACX,QAAA;AAAA;AAAA,UAGe,gCAAA,SACP,SAAA,CAAU,cAAA,UAAwB,gCAAA;EAC1C,WAAA;AAAA;AAAA,iBAGc,2BAAA,CAAA;EACd,WAAA;EACA,SAAA;EACA,MAAA;EAAA,GACG;AAAA,GACF,gCAAA,GAAgC,oBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -1,47 +0,0 @@
1
- import { cn } from "../../../lib/utils.mjs";
2
- import { useCatalogConfig } from "../../../context/catalog-config-context.mjs";
3
- import { useSearchesCatalogContext } from "../../../context/searches-catalog-context.mjs";
4
- import { Input } from "../../ui/input.mjs";
5
- import { mergeProps } from "@base-ui/react/merge-props";
6
- import { useRender } from "@base-ui/react/use-render";
7
- import { jsx, jsxs } from "react/jsx-runtime";
8
- import { Search } from "lucide-react";
9
-
10
- //#region src/components/compound/searches-catalog/search-filter.tsx
11
- function SearchesCatalogSearchFilter({ placeholder = "Search searches...", className, render, ...props }) {
12
- const { globalFilterInput, setGlobalFilterInput } = useSearchesCatalogContext();
13
- const { classNames } = useCatalogConfig();
14
- const inputElement = useRender({
15
- defaultTagName: "input",
16
- render,
17
- state: {
18
- value: globalFilterInput,
19
- setValue: setGlobalFilterInput,
20
- isActive: !!globalFilterInput
21
- },
22
- stateAttributesMapping: { setValue: () => null },
23
- props: mergeProps({
24
- type: "search",
25
- placeholder,
26
- value: globalFilterInput,
27
- onChange: (e) => setGlobalFilterInput(e.target.value),
28
- className: render ? cn(classNames?.searchInput, className) : void 0
29
- }, props)
30
- });
31
- if (render) return inputElement;
32
- return /* @__PURE__ */ jsxs("div", {
33
- "data-p0": "catalog-search",
34
- className: cn("pz:relative", classNames?.searchInputContainer),
35
- children: [/* @__PURE__ */ jsx(Search, { className: "pz:absolute pz:left-2.5 pz:top-1/2 pz:-translate-y-1/2 pz:size-4 pz:text-muted-foreground pz:pointer-events-none" }), /* @__PURE__ */ jsx(Input, {
36
- type: "search",
37
- placeholder,
38
- value: globalFilterInput,
39
- onChange: (e) => setGlobalFilterInput(e.target.value),
40
- className: cn("pz:pl-8", classNames?.searchInput, className)
41
- })]
42
- });
43
- }
44
-
45
- //#endregion
46
- export { SearchesCatalogSearchFilter };
47
- //# sourceMappingURL=search-filter.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"search-filter.mjs","names":["SearchIcon"],"sources":["../../../../src/components/compound/searches-catalog/search-filter.tsx"],"sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { Search as SearchIcon } from \"lucide-react\";\nimport type { ChangeEvent } from \"react\";\nimport { useCatalogConfig } from \"../../../context/catalog-config-context.js\";\nimport { useSearchesCatalogContext } from \"../../../context/searches-catalog-context.js\";\nimport { cn } from \"../../../lib/utils.js\";\nimport { Input } from \"../../ui/input.js\";\n\nexport interface SearchesCatalogSearchFilterState {\n value: string;\n setValue: (value: string) => void;\n isActive: boolean;\n}\n\nexport interface SearchesCatalogSearchFilterProps\n extends useRender.ComponentProps<\"input\", SearchesCatalogSearchFilterState> {\n placeholder?: string;\n}\n\nexport function SearchesCatalogSearchFilter({\n placeholder = \"Search searches...\",\n className,\n render,\n ...props\n}: SearchesCatalogSearchFilterProps) {\n const { globalFilterInput, setGlobalFilterInput } = useSearchesCatalogContext();\n const { classNames } = useCatalogConfig();\n const isActive = !!globalFilterInput;\n\n const inputElement = useRender({\n defaultTagName: \"input\",\n render,\n state: { value: globalFilterInput, setValue: setGlobalFilterInput, isActive },\n stateAttributesMapping: {\n setValue: () => null,\n },\n props: mergeProps<\"input\">(\n {\n type: \"search\",\n placeholder,\n value: globalFilterInput,\n onChange: (e: ChangeEvent<HTMLInputElement>) => setGlobalFilterInput(e.target.value),\n className: render ? cn(classNames?.searchInput, className) : undefined,\n },\n props,\n ),\n });\n\n if (render) return inputElement;\n\n return (\n <div data-p0=\"catalog-search\" className={cn(\"pz:relative\", classNames?.searchInputContainer)}>\n <SearchIcon className=\"pz:absolute pz:left-2.5 pz:top-1/2 pz:-translate-y-1/2 pz:size-4 pz:text-muted-foreground pz:pointer-events-none\" />\n <Input\n type=\"search\"\n placeholder={placeholder}\n value={globalFilterInput}\n onChange={(e) => setGlobalFilterInput(e.target.value)}\n className={cn(\"pz:pl-8\", classNames?.searchInput, className)}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAoBA,SAAgB,4BAA4B,EAC1C,cAAc,sBACd,WACA,QACA,GAAG,SACgC;CACnC,MAAM,EAAE,mBAAmB,yBAAyB,2BAA2B;CAC/E,MAAM,EAAE,eAAe,kBAAkB;CAGzC,MAAM,eAAe,UAAU;EAC7B,gBAAgB;EAChB;EACA,OAAO;GAAE,OAAO;GAAmB,UAAU;GAAsB,UALpD,CAAC,CAAC;GAK4D;EAC7E,wBAAwB,EACtB,gBAAgB,MACjB;EACD,OAAO,WACL;GACE,MAAM;GACN;GACA,OAAO;GACP,WAAW,MAAqC,qBAAqB,EAAE,OAAO,MAAM;GACpF,WAAW,SAAS,GAAG,YAAY,aAAa,UAAU,GAAG;GAC9D,EACD,MACD;EACF,CAAC;AAEF,KAAI,OAAQ,QAAO;AAEnB,QACE,qBAAC,OAAD;EAAK,WAAQ;EAAiB,WAAW,GAAG,eAAe,YAAY,qBAAqB;YAA5F,CACE,oBAACA,QAAD,EAAY,WAAU,oHAAqH,GAC3I,oBAAC,OAAD;GACE,MAAK;GACQ;GACb,OAAO;GACP,WAAW,MAAM,qBAAqB,EAAE,OAAO,MAAM;GACrD,WAAW,GAAG,WAAW,YAAY,aAAa,UAAU;GAC5D,EACE"}
@@ -1,22 +0,0 @@
1
- import { FilterSelectOption } from "../../defaults/catalog/filter-select.mjs";
2
- import { ColumnFilterState } from "./column-filter.mjs";
3
- import { useRender } from "@base-ui/react/use-render";
4
- import { ReactNode } from "react";
5
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
6
-
7
- //#region src/components/compound/searches-catalog/tag-filter.d.ts
8
- interface SearchesCatalogTagFilterProps {
9
- options?: ReadonlyArray<FilterSelectOption>;
10
- placeholder?: ReactNode;
11
- className?: string;
12
- render?: useRender.ComponentProps<"div", ColumnFilterState>["render"];
13
- }
14
- declare function SearchesCatalogTagFilter({
15
- options,
16
- placeholder,
17
- className,
18
- render
19
- }: SearchesCatalogTagFilterProps): _$react_jsx_runtime0.JSX.Element;
20
- //#endregion
21
- export { SearchesCatalogTagFilter, SearchesCatalogTagFilterProps };
22
- //# sourceMappingURL=tag-filter.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tag-filter.d.mts","names":[],"sources":["../../../../src/components/compound/searches-catalog/tag-filter.tsx"],"mappings":";;;;;;;UAMiB,6BAAA;EACf,OAAA,GAAU,aAAA,CAAc,kBAAA;EACxB,WAAA,GAAc,SAAA;EACd,SAAA;EACA,MAAA,GAAS,SAAA,CAAU,cAAA,QAAsB,iBAAA;AAAA;AAAA,iBAS3B,wBAAA,CAAA;EACd,OAAA;EACA,WAAA;EACA,SAAA;EACA;AAAA,GACC,6BAAA,GAA6B,oBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -1,22 +0,0 @@
1
- import { SearchesCatalogColumnFilter } from "./column-filter.mjs";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Tag } from "lucide-react";
4
-
5
- //#region src/components/compound/searches-catalog/tag-filter.tsx
6
- const DEFAULT_PLACEHOLDER = /* @__PURE__ */ jsxs("span", {
7
- className: "pz:inline-flex pz:items-center pz:gap-1.5",
8
- children: [/* @__PURE__ */ jsx(Tag, { className: "pz:size-4" }), " Tag"]
9
- });
10
- function SearchesCatalogTagFilter({ options, placeholder = DEFAULT_PLACEHOLDER, className, render }) {
11
- return /* @__PURE__ */ jsx(SearchesCatalogColumnFilter, {
12
- id: "tags",
13
- placeholder,
14
- options,
15
- className,
16
- render
17
- });
18
- }
19
-
20
- //#endregion
21
- export { SearchesCatalogTagFilter };
22
- //# sourceMappingURL=tag-filter.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tag-filter.mjs","names":[],"sources":["../../../../src/components/compound/searches-catalog/tag-filter.tsx"],"sourcesContent":["import type { useRender } from \"@base-ui/react/use-render\";\nimport { Tag } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport type { FilterSelectOption } from \"../../defaults/catalog/filter-select.js\";\nimport { type ColumnFilterState, SearchesCatalogColumnFilter } from \"./column-filter.js\";\n\nexport interface SearchesCatalogTagFilterProps {\n options?: ReadonlyArray<FilterSelectOption>;\n placeholder?: ReactNode;\n className?: string;\n render?: useRender.ComponentProps<\"div\", ColumnFilterState>[\"render\"];\n}\n\nconst DEFAULT_PLACEHOLDER = (\n <span className=\"pz:inline-flex pz:items-center pz:gap-1.5\">\n <Tag className=\"pz:size-4\" /> Tag\n </span>\n);\n\nexport function SearchesCatalogTagFilter({\n options,\n placeholder = DEFAULT_PLACEHOLDER,\n className,\n render,\n}: SearchesCatalogTagFilterProps) {\n return (\n <SearchesCatalogColumnFilter\n id=\"tags\"\n placeholder={placeholder}\n options={options}\n className={className}\n render={render}\n />\n );\n}\n"],"mappings":";;;;;AAaA,MAAM,sBACJ,qBAAC,QAAD;CAAM,WAAU;WAAhB,CACE,oBAAC,KAAD,EAAK,WAAU,aAAc,UACxB;;AAGT,SAAgB,yBAAyB,EACvC,SACA,cAAc,qBACd,WACA,UACgC;AAChC,QACE,oBAAC,6BAAD;EACE,IAAG;EACU;EACJ;EACE;EACH;EACR"}
@@ -1,24 +0,0 @@
1
- import { SearchesCardData } from "../types/catalog-adapters.mjs";
2
- import * as _$react from "react";
3
- import { SyntheticEvent } from "react";
4
-
5
- //#region src/context/searches-catalog-card-context.d.ts
6
- interface SearchesCatalogCardContextValue {
7
- card: SearchesCardData;
8
- index: number;
9
- selected: boolean;
10
- expanded: boolean;
11
- /** Selection handler — fires the catalog root's `onSelectCard`. */
12
- onSelect: (e: SyntheticEvent) => void;
13
- /**
14
- * Open or close this card's expansion drawer. Only a single card inside a
15
- * `<SearchesCatalog>` can be expanded at any time — opening one closes the
16
- * previously expanded card.
17
- */
18
- setExpanded: (open: boolean) => void;
19
- }
20
- declare const SearchesCatalogCardContext: _$react.Context<SearchesCatalogCardContextValue | null>;
21
- declare function useSearchesCatalogCard(): SearchesCatalogCardContextValue;
22
- //#endregion
23
- export { SearchesCatalogCardContext, SearchesCatalogCardContextValue, useSearchesCatalogCard };
24
- //# sourceMappingURL=searches-catalog-card-context.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"searches-catalog-card-context.d.mts","names":[],"sources":["../../src/context/searches-catalog-card-context.ts"],"mappings":";;;;;UAIiB,+BAAA;EACf,IAAA,EAAM,gBAAA;EACN,KAAA;EACA,QAAA;EACA,QAAA;;EAEA,QAAA,GAAW,CAAA,EAAG,cAAA;EALd;;;;;EAWA,WAAA,GAAc,IAAA;AAAA;AAAA,cAGH,0BAAA,EAA0B,OAAA,CAAA,OAAA,CAAA,+BAAA;AAAA,iBAIvB,sBAAA,CAAA,GAA0B,+BAAA"}
@@ -1,13 +0,0 @@
1
- import { createContext, useContext } from "react";
2
-
3
- //#region src/context/searches-catalog-card-context.ts
4
- const SearchesCatalogCardContext = createContext(null);
5
- function useSearchesCatalogCard() {
6
- const value = useContext(SearchesCatalogCardContext);
7
- if (value == null) throw new Error("useSearchesCatalogCard must be used inside <SearchesCatalogCard>.");
8
- return value;
9
- }
10
-
11
- //#endregion
12
- export { SearchesCatalogCardContext, useSearchesCatalogCard };
13
- //# sourceMappingURL=searches-catalog-card-context.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"searches-catalog-card-context.mjs","names":[],"sources":["../../src/context/searches-catalog-card-context.ts"],"sourcesContent":["import type { SyntheticEvent } from \"react\";\nimport { createContext, useContext } from \"react\";\nimport type { SearchesCardData } from \"../types/catalog-adapters.js\";\n\nexport interface SearchesCatalogCardContextValue {\n card: SearchesCardData;\n index: number;\n selected: boolean;\n expanded: boolean;\n /** Selection handler — fires the catalog root's `onSelectCard`. */\n onSelect: (e: SyntheticEvent) => void;\n /**\n * Open or close this card's expansion drawer. Only a single card inside a\n * `<SearchesCatalog>` can be expanded at any time — opening one closes the\n * previously expanded card.\n */\n setExpanded: (open: boolean) => void;\n}\n\nexport const SearchesCatalogCardContext = createContext<SearchesCatalogCardContextValue | null>(\n null,\n);\n\nexport function useSearchesCatalogCard(): SearchesCatalogCardContextValue {\n const value = useContext(SearchesCatalogCardContext);\n if (value == null) {\n throw new Error(\"useSearchesCatalogCard must be used inside <SearchesCatalogCard>.\");\n }\n return value;\n}\n"],"mappings":";;;AAmBA,MAAa,6BAA6B,cACxC,KACD;AAED,SAAgB,yBAA0D;CACxE,MAAM,QAAQ,WAAW,2BAA2B;AACpD,KAAI,SAAS,KACX,OAAM,IAAI,MAAM,oEAAoE;AAEtF,QAAO"}
@@ -1,20 +0,0 @@
1
- import { SearchesCardData } from "../types/catalog-adapters.mjs";
2
- import { UseSearchesCatalogTableReturn } from "../hooks/use-searches-catalog-table.mjs";
3
- import * as _$react from "react";
4
- import { SyntheticEvent } from "react";
5
-
6
- //#region src/context/searches-catalog-context.d.ts
7
- type SearchesCatalogContextValue = UseSearchesCatalogTableReturn & {
8
- onSelectCard?: (card: SearchesCardData, e: SyntheticEvent) => void;
9
- /**
10
- * Id of the currently expanded card row (drawer open), or `null`. Driven by
11
- * the default card layout's inline drawer.
12
- */
13
- expandedCardId: string | null;
14
- setExpandedCardId: (id: string | null) => void;
15
- };
16
- declare const SearchesCatalogContext: _$react.Context<SearchesCatalogContextValue | null>;
17
- declare function useSearchesCatalogContext(): SearchesCatalogContextValue;
18
- //#endregion
19
- export { SearchesCatalogContext, SearchesCatalogContextValue, useSearchesCatalogContext };
20
- //# sourceMappingURL=searches-catalog-context.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"searches-catalog-context.d.mts","names":[],"sources":["../../src/context/searches-catalog-context.ts"],"mappings":";;;;;;KAKY,2BAAA,GAA8B,6BAAA;EACxC,YAAA,IAAgB,IAAA,EAAM,gBAAA,EAAkB,CAAA,EAAG,cAAA;;AAD7C;;;EAME,cAAA;EACA,iBAAA,GAAoB,EAAA;AAAA;AAAA,cAGT,sBAAA,EAAsB,OAAA,CAAA,OAAA,CAAA,2BAAA;AAAA,iBAEnB,yBAAA,CAAA,GAA6B,2BAAA"}
@@ -1,13 +0,0 @@
1
- import { createContext, useContext } from "react";
2
-
3
- //#region src/context/searches-catalog-context.ts
4
- const SearchesCatalogContext = createContext(null);
5
- function useSearchesCatalogContext() {
6
- const value = useContext(SearchesCatalogContext);
7
- if (value == null) throw new Error("useSearchesCatalogContext must be used inside <SearchesCatalog>. Either render <SearchesCatalog>...</SearchesCatalog> or pass `context={useSearchesCatalogTable()}`.");
8
- return value;
9
- }
10
-
11
- //#endregion
12
- export { SearchesCatalogContext, useSearchesCatalogContext };
13
- //# sourceMappingURL=searches-catalog-context.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"searches-catalog-context.mjs","names":[],"sources":["../../src/context/searches-catalog-context.ts"],"sourcesContent":["import type { SyntheticEvent } from \"react\";\nimport { createContext, useContext } from \"react\";\nimport type { UseSearchesCatalogTableReturn } from \"../hooks/use-searches-catalog-table.js\";\nimport type { SearchesCardData } from \"../types/catalog-adapters.js\";\n\nexport type SearchesCatalogContextValue = UseSearchesCatalogTableReturn & {\n onSelectCard?: (card: SearchesCardData, e: SyntheticEvent) => void;\n /**\n * Id of the currently expanded card row (drawer open), or `null`. Driven by\n * the default card layout's inline drawer.\n */\n expandedCardId: string | null;\n setExpandedCardId: (id: string | null) => void;\n};\n\nexport const SearchesCatalogContext = createContext<SearchesCatalogContextValue | null>(null);\n\nexport function useSearchesCatalogContext(): SearchesCatalogContextValue {\n const value = useContext(SearchesCatalogContext);\n if (value == null) {\n throw new Error(\n \"useSearchesCatalogContext must be used inside <SearchesCatalog>. \" +\n \"Either render <SearchesCatalog>...</SearchesCatalog> or pass `context={useSearchesCatalogTable()}`.\",\n );\n }\n return value;\n}\n"],"mappings":";;;AAeA,MAAa,yBAAyB,cAAkD,KAAK;AAE7F,SAAgB,4BAAyD;CACvE,MAAM,QAAQ,WAAW,uBAAuB;AAChD,KAAI,SAAS,KACX,OAAM,IAAI,MACR,uKAED;AAEH,QAAO"}
@@ -1,56 +0,0 @@
1
- import { SearchesCardData } from "../types/catalog-adapters.mjs";
2
- import { CatalogFilterMeta, CatalogSearchFeatures } from "../utils/catalog-helpers.mjs";
3
- import * as _$react from "react";
4
- import { CatalogFilter, SearchCategory, SearchesCatalogTableData, SearchesId } from "@pipe0/base";
5
- import * as _$_tanstack_react_table0 from "@tanstack/react-table";
6
- import { ColumnFilter } from "@tanstack/react-table";
7
-
8
- //#region src/hooks/use-searches-catalog-table.d.ts
9
- type SearchesOutputFieldEntries = Record<string, SearchesId[]>;
10
- declare function useSearchesCatalogTable(config?: {
11
- initialColumnFilters?: ColumnFilter[];
12
- filter?: CatalogFilter;
13
- }): {
14
- table: _$_tanstack_react_table0.AppReactTable<{
15
- columnFilteringFeature: _$_tanstack_react_table0.TableFeature;
16
- globalFilteringFeature: _$_tanstack_react_table0.TableFeature;
17
- rowSortingFeature: _$_tanstack_react_table0.TableFeature;
18
- filteredRowModel: (table: _$_tanstack_react_table0.Table<any, any>) => () => _$_tanstack_react_table0.RowModel<any, any>;
19
- sortedRowModel: (table: _$_tanstack_react_table0.Table<any, any>) => () => _$_tanstack_react_table0.RowModel<any, any>;
20
- filterFns: {
21
- includesString: _$_tanstack_react_table0.CreatedFilterFn<any, any>;
22
- arrIncludes: _$_tanstack_react_table0.CreatedFilterFn<any, any>;
23
- catalogSearch: _$_tanstack_react_table0.FilterFn<CatalogSearchFeatures, _$_tanstack_react_table0.RowData>;
24
- };
25
- sortFns: {
26
- catalogSearch: _$_tanstack_react_table0.SortFn<CatalogSearchFeatures, _$_tanstack_react_table0.RowData>;
27
- };
28
- filterMeta: CatalogFilterMeta;
29
- }, SearchesCatalogTableData, _$_tanstack_react_table0.TableState_ColumnFiltering & _$_tanstack_react_table0.TableState_GlobalFiltering & _$_tanstack_react_table0.TableState_RowSorting, {}, {}, {}>;
30
- cards: SearchesCardData[];
31
- cardsByCategory: {
32
- category: SearchCategory;
33
- cards: SearchesCardData[];
34
- }[];
35
- categoryCounts: Partial<Record<SearchCategory, number>>;
36
- baselineCardCount: number;
37
- baselineCategoryCounts: Partial<Record<SearchCategory, number>>;
38
- category: SearchCategory | null;
39
- setCategory: (category: SearchCategory | null) => void;
40
- globalFilterInput: string;
41
- setGlobalFilterInput: _$react.Dispatch<_$react.SetStateAction<string>>;
42
- addColumnFilter: (id: "inputFields" | "outputFields" | "tags" | "providers", value: string) => void;
43
- removeColumnFilter: (id: "inputFields" | "outputFields" | "tags" | "providers") => void;
44
- resetFilters: () => void;
45
- getColumnFilterValue: (id: "inputFields" | "outputFields" | "tags" | "providers") => string;
46
- sortedOutputFieldEntries: [string, ("companies:profiles:crustdata@1" | "people:profiles:crustdata@1" | "people:profiles:icypeas@1" | "companies:profiles:icypeas@1" | "people:profiles:clado@1" | "people:profiles:clado@2" | "people:employees:leadmagic@1" | "companies:profiles:exa@1" | "people:profiles:exa@1")[]][];
47
- sortedTagEntries: [string, ("companies:profiles:crustdata@1" | "people:profiles:crustdata@1" | "people:profiles:icypeas@1" | "companies:profiles:icypeas@1" | "people:profiles:clado@1" | "people:profiles:clado@2" | "people:employees:leadmagic@1" | "companies:profiles:exa@1" | "people:profiles:exa@1")[]][];
48
- sortedProviderEntries: [string, ("companies:profiles:crustdata@1" | "people:profiles:crustdata@1" | "people:profiles:icypeas@1" | "companies:profiles:icypeas@1" | "people:profiles:clado@1" | "people:profiles:clado@2" | "people:employees:leadmagic@1" | "companies:profiles:exa@1" | "people:profiles:exa@1")[]][];
49
- searchIdsByOutputField: Record<string, ("companies:profiles:crustdata@1" | "people:profiles:crustdata@1" | "people:profiles:icypeas@1" | "companies:profiles:icypeas@1" | "people:profiles:clado@1" | "people:profiles:clado@2" | "people:employees:leadmagic@1" | "companies:profiles:exa@1" | "people:profiles:exa@1")[]>;
50
- searchIdsByProvider: Record<string, ("companies:profiles:crustdata@1" | "people:profiles:crustdata@1" | "people:profiles:icypeas@1" | "companies:profiles:icypeas@1" | "people:profiles:clado@1" | "people:profiles:clado@2" | "people:employees:leadmagic@1" | "companies:profiles:exa@1" | "people:profiles:exa@1")[]>;
51
- searchIdsByTag: Record<string, ("companies:profiles:crustdata@1" | "people:profiles:crustdata@1" | "people:profiles:icypeas@1" | "companies:profiles:icypeas@1" | "people:profiles:clado@1" | "people:profiles:clado@2" | "people:employees:leadmagic@1" | "companies:profiles:exa@1" | "people:profiles:exa@1")[]>;
52
- };
53
- type UseSearchesCatalogTableReturn = ReturnType<typeof useSearchesCatalogTable>;
54
- //#endregion
55
- export { SearchesOutputFieldEntries, UseSearchesCatalogTableReturn, useSearchesCatalogTable };
56
- //# sourceMappingURL=use-searches-catalog-table.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-searches-catalog-table.d.mts","names":[],"sources":["../../src/hooks/use-searches-catalog-table.ts"],"mappings":";;;;;;;;KAoBY,0BAAA,GAA6B,MAAA,SAAe,UAAA;AAAA,iBAyCxC,uBAAA,CACd,MAAA;EAAU,oBAAA,GAAuB,YAAA;EAAgB,MAAA,GAAS,aAAA;AAAA;;4BAAa,wBAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;cAgG3B,cAAA;WAAuB,gBAAA;EAAA;;;;;0BArC3B,cAAA;;yCAAc,OAAA,CAAA,cAAA;+EAhBK,KAAA;;;;;;;;;;;KA0HjD,6BAAA,GAAgC,UAAA,QAAkB,uBAAA"}
@@ -1,159 +0,0 @@
1
- import { createCatalogColumnHelper, useCatalogTable } from "./catalog-table.mjs";
2
- import { useDebounce } from "./use-debounce.mjs";
3
- import { useMemo, useState } from "react";
4
- import { filterSearchesEntries, getDefaultSearchesOutputFields, getInitialSearchesTableData, getLoweestSearchesCreditAmount, getSearchesSearchTarget, getSearchesTableDataAggregates, getStartingCostPerSearchesProvider } from "@pipe0/base";
5
-
6
- //#region src/hooks/use-searches-catalog-table.ts
7
- const columnHelper = createCatalogColumnHelper();
8
- const columns = columnHelper.columns([
9
- columnHelper.accessor("searchId", {
10
- filterFn: "includesString",
11
- enableGlobalFilter: false
12
- }),
13
- columnHelper.accessor("description", { enableGlobalFilter: false }),
14
- columnHelper.accessor("label", {
15
- filterFn: "includesString",
16
- enableGlobalFilter: false
17
- }),
18
- columnHelper.accessor((row) => getDefaultSearchesOutputFields(row.searchId) || [], {
19
- id: "outputFields",
20
- filterFn: "arrIncludes",
21
- enableGlobalFilter: false
22
- }),
23
- columnHelper.accessor((row) => row.tags || [], {
24
- id: "tags",
25
- filterFn: "arrIncludes",
26
- enableGlobalFilter: false
27
- }),
28
- columnHelper.accessor((row) => row.provider, {
29
- id: "providers",
30
- enableGlobalFilter: false
31
- }),
32
- columnHelper.accessor((row) => getSearchesSearchTarget(row), {
33
- id: "search",
34
- enableGlobalFilter: true,
35
- enableSorting: true,
36
- sortFn: "catalogSearch"
37
- })
38
- ]);
39
- function useSearchesCatalogTable(config = {}) {
40
- const [category, setCategory] = useState(null);
41
- const { initialColumnFilters = [], filter } = config;
42
- const initialSearchTableData = useMemo(() => filterSearchesEntries(getInitialSearchesTableData(category), filter), [category, filter]);
43
- const baselineTableData = useMemo(() => filterSearchesEntries(getInitialSearchesTableData(null), filter), [filter]);
44
- const table = useCatalogTable({
45
- columns,
46
- data: initialSearchTableData,
47
- initialState: { columnFilters: initialColumnFilters }
48
- });
49
- const columnFilters = table.state.columnFilters;
50
- const aggregates = useMemo(() => getSearchesTableDataAggregates(initialSearchTableData, category), [category, initialSearchTableData]);
51
- const [globalFilterInput, setGlobalFilterInput, setGlobalFilterImmediately] = useDebounce((v) => {
52
- if (v === table.atoms.globalFilter.get()) return;
53
- table.setGlobalFilter(v);
54
- table.setSorting(v ? [{
55
- id: "search",
56
- desc: true
57
- }] : []);
58
- if (v) {
59
- setCategory(null);
60
- table.setColumnFilters([]);
61
- }
62
- });
63
- const addColumnFilter = (id, value) => {
64
- setGlobalFilterImmediately("");
65
- table.setColumnFilters([{
66
- id,
67
- value
68
- }]);
69
- };
70
- const resetFilters = () => {
71
- setGlobalFilterImmediately("");
72
- setCategory(null);
73
- };
74
- const removeColumnFilter = (id) => {
75
- table.getColumn(id)?.setFilterValue(null);
76
- };
77
- const handleCategoryChange = (category) => {
78
- setCategory(category);
79
- table.setColumnFilters([]);
80
- setGlobalFilterImmediately("");
81
- };
82
- const getColumnFilterValue = (id) => {
83
- return columnFilters.find((f) => f.id === id)?.value;
84
- };
85
- const rows = table.getRowModel().rows;
86
- const cards = useMemo(() => rows.map((row) => {
87
- const entry = row.original;
88
- const latestEntry = aggregates.searchEntriesByBaseSearch[entry.baseSearch]?.[0] ?? entry;
89
- return {
90
- searchesId: latestEntry.searchesId,
91
- baseSearches: entry.baseSearch,
92
- label: entry.label,
93
- description: entry.description,
94
- provider: entry.provider,
95
- providers: [entry.provider],
96
- startingCostPerProvider: getStartingCostPerSearchesProvider(latestEntry.searchesId),
97
- startingCreditAmount: getLoweestSearchesCreditAmount(latestEntry),
98
- costMode: latestEntry.cost.mode,
99
- defaultOutputFields: getDefaultSearchesOutputFields(latestEntry.searchesId),
100
- docPath: latestEntry.docPath,
101
- entry,
102
- latestEntry
103
- };
104
- }), [rows, aggregates.searchEntriesByBaseSearch]);
105
- return {
106
- table,
107
- cards,
108
- cardsByCategory: useMemo(() => {
109
- const groups = /* @__PURE__ */ new Map();
110
- for (const card of cards) {
111
- const cats = card.entry.categories ?? [];
112
- for (const cat of cats) {
113
- const arr = groups.get(cat);
114
- if (arr) arr.push(card);
115
- else groups.set(cat, [card]);
116
- }
117
- }
118
- return Array.from(groups, ([category, group]) => ({
119
- category,
120
- cards: group
121
- }));
122
- }, [cards]),
123
- categoryCounts: useMemo(() => {
124
- const counts = {};
125
- for (const card of cards) {
126
- const cats = card.entry.categories ?? [];
127
- for (const cat of cats) counts[cat] = (counts[cat] ?? 0) + 1;
128
- }
129
- return counts;
130
- }, [cards]),
131
- baselineCardCount: baselineTableData.length,
132
- baselineCategoryCounts: useMemo(() => {
133
- const counts = {};
134
- for (const entry of baselineTableData) {
135
- const cats = entry.categories ?? [];
136
- for (const cat of cats) counts[cat] = (counts[cat] ?? 0) + 1;
137
- }
138
- return counts;
139
- }, [baselineTableData]),
140
- category,
141
- setCategory: handleCategoryChange,
142
- globalFilterInput,
143
- setGlobalFilterInput,
144
- addColumnFilter,
145
- removeColumnFilter,
146
- resetFilters,
147
- getColumnFilterValue,
148
- sortedOutputFieldEntries: aggregates.sortedOutputFieldEntries,
149
- sortedTagEntries: aggregates.sortedTagEntries,
150
- sortedProviderEntries: aggregates.sortedProviderEntries,
151
- searchIdsByOutputField: aggregates.searchIdsByOutputField,
152
- searchIdsByProvider: aggregates.searchIdsByProvider,
153
- searchIdsByTag: aggregates.searchIdsByTag
154
- };
155
- }
156
-
157
- //#endregion
158
- export { useSearchesCatalogTable };
159
- //# sourceMappingURL=use-searches-catalog-table.mjs.map