@pipe0/react 0.1.7 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/components/compound/effect-catalog/card.d.mts +22 -0
  3. package/dist/components/compound/effect-catalog/card.d.mts.map +1 -0
  4. package/dist/components/compound/effect-catalog/card.mjs +82 -0
  5. package/dist/components/compound/effect-catalog/card.mjs.map +1 -0
  6. package/dist/components/compound/effect-catalog/category-filter.d.mts +27 -0
  7. package/dist/components/compound/effect-catalog/category-filter.d.mts.map +1 -0
  8. package/dist/components/compound/effect-catalog/category-filter.mjs +61 -0
  9. package/dist/components/compound/effect-catalog/category-filter.mjs.map +1 -0
  10. package/dist/components/compound/effect-catalog/empty.d.mts +17 -0
  11. package/dist/components/compound/effect-catalog/empty.d.mts.map +1 -0
  12. package/dist/components/compound/effect-catalog/empty.mjs +29 -0
  13. package/dist/components/compound/effect-catalog/empty.mjs.map +1 -0
  14. package/dist/components/compound/effect-catalog/index.d.mts +6 -0
  15. package/dist/components/compound/effect-catalog/list.d.mts +19 -0
  16. package/dist/components/compound/effect-catalog/list.d.mts.map +1 -0
  17. package/dist/components/compound/effect-catalog/list.mjs +33 -0
  18. package/dist/components/compound/effect-catalog/list.mjs.map +1 -0
  19. package/dist/components/compound/effect-catalog/root.d.mts +31 -0
  20. package/dist/components/compound/effect-catalog/root.d.mts.map +1 -0
  21. package/dist/components/compound/effect-catalog/root.mjs +67 -0
  22. package/dist/components/compound/effect-catalog/root.mjs.map +1 -0
  23. package/dist/components/compound/effect-catalog/search-filter.d.mts +21 -0
  24. package/dist/components/compound/effect-catalog/search-filter.d.mts.map +1 -0
  25. package/dist/components/compound/effect-catalog/search-filter.mjs +47 -0
  26. package/dist/components/compound/effect-catalog/search-filter.mjs.map +1 -0
  27. package/dist/components/compound/pipe-catalog/card.mjs +1 -1
  28. package/dist/components/compound/pipe-catalog/category-filter.mjs +1 -1
  29. package/dist/components/compound/pipe-catalog/provider-filter.mjs +1 -1
  30. package/dist/components/compound/pipe-catalog/root.mjs +1 -1
  31. package/dist/components/compound/pipe-form/content.d.mts +6 -1
  32. package/dist/components/compound/pipe-form/content.d.mts.map +1 -1
  33. package/dist/components/compound/pipe-form/content.mjs +3 -2
  34. package/dist/components/compound/pipe-form/content.mjs.map +1 -1
  35. package/dist/components/compound/search-catalog/active-filters.mjs +1 -1
  36. package/dist/components/compound/search-catalog/category-filter.mjs +1 -1
  37. package/dist/components/compound/search-catalog/provider-filter.mjs +1 -1
  38. package/dist/components/compound/search-form/content.d.mts +6 -1
  39. package/dist/components/compound/search-form/content.d.mts.map +1 -1
  40. package/dist/components/compound/search-form/content.mjs +3 -2
  41. package/dist/components/compound/search-form/content.mjs.map +1 -1
  42. package/dist/components/compound/searches-catalog/active-filters.mjs +1 -1
  43. package/dist/components/compound/searches-catalog/category-filter.mjs +1 -1
  44. package/dist/components/compound/searches-catalog/provider-filter.mjs +1 -1
  45. package/dist/components/defaults/adapters/exact-range-input.mjs +1 -1
  46. package/dist/components/defaults/adapters/json-extraction-input.mjs +1 -1
  47. package/dist/components/defaults/adapters/pipes-run-if-input.mjs +1 -1
  48. package/dist/components/defaults/catalog/card-derived.d.mts.map +1 -1
  49. package/dist/components/defaults/catalog/card-derived.mjs +6 -4
  50. package/dist/components/defaults/catalog/card-derived.mjs.map +1 -1
  51. package/dist/components/defaults/catalog/provider-avatars.mjs +3 -3
  52. package/dist/components/defaults/catalog/provider-avatars.mjs.map +1 -1
  53. package/dist/components/defaults/form/form-empty-state.mjs +23 -0
  54. package/dist/components/defaults/form/form-empty-state.mjs.map +1 -0
  55. package/dist/components/internal/LiquidEditor/LiquidEditor.mjs +2 -2
  56. package/dist/components/internal/LiquidEditor/LiquidEditor.mjs.map +1 -1
  57. package/dist/context/catalog-card-context.mjs +4 -2
  58. package/dist/context/catalog-card-context.mjs.map +1 -1
  59. package/dist/context/effect-catalog-card-context.d.mts +20 -0
  60. package/dist/context/effect-catalog-card-context.d.mts.map +1 -0
  61. package/dist/context/effect-catalog-card-context.mjs +13 -0
  62. package/dist/context/effect-catalog-card-context.mjs.map +1 -0
  63. package/dist/context/effect-catalog-context.d.mts +20 -0
  64. package/dist/context/effect-catalog-context.d.mts.map +1 -0
  65. package/dist/context/effect-catalog-context.mjs +13 -0
  66. package/dist/context/effect-catalog-context.mjs.map +1 -0
  67. package/dist/hooks/use-effect-catalog-table.d.mts +33 -0
  68. package/dist/hooks/use-effect-catalog-table.d.mts.map +1 -0
  69. package/dist/hooks/use-effect-catalog-table.mjs +104 -0
  70. package/dist/hooks/use-effect-catalog-table.mjs.map +1 -0
  71. package/dist/hooks/use-form-core.mjs +1 -1
  72. package/dist/hooks/use-form-core.mjs.map +1 -1
  73. package/dist/hooks/use-sheet-effect-form.d.mts +35 -0
  74. package/dist/hooks/use-sheet-effect-form.d.mts.map +1 -0
  75. package/dist/hooks/use-sheet-effect-form.mjs +104 -0
  76. package/dist/hooks/use-sheet-effect-form.mjs.map +1 -0
  77. package/dist/index.d.mts +12 -2
  78. package/dist/index.mjs +14 -4
  79. package/dist/styles/pipe0-form.css +1 -1
  80. package/dist/types/catalog-adapters.d.mts +22 -2
  81. package/dist/types/catalog-adapters.d.mts.map +1 -1
  82. package/dist/utils/build-section-handlers.mjs +3 -3
  83. package/dist/utils/build-section-handlers.mjs.map +1 -1
  84. package/dist/utils/catalog-helpers.d.mts +1 -1
  85. package/package.json +15 -25
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @pipe0/elements-react
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 70036b5: Fix dependency declarations so consumers no longer have to hand-install internal libraries.
8
+
9
+ `@pipe0/react`: the libraries it only uses internally — `@dnd-kit/*`, `@floating-ui/react`,
10
+ `@hookform/resolvers`, `@tanstack/react-table`, `@tiptap/*`, and `react-hook-form` — moved from
11
+ `peerDependencies` to regular `dependencies`; they're never exposed on the public API, so the
12
+ library now controls their versions and installs them automatically. `@base-ui/react` was
13
+ promoted from a `dependency` to a `peerDependency` because its types are part of the public API
14
+ (`useRender.ComponentProps`) and consumers are expected to import it directly. `react`,
15
+ `react-dom`, and `zod` remain peers.
16
+
17
+ `@pipe0/base`: `zod` moved from `dependencies` to `peerDependencies` so the consumer's app,
18
+ `@pipe0/base`, and `@pipe0/react` all resolve to a single zod instance (avoiding duplicate-instance
19
+ type errors).
20
+
21
+ Consumers must now have `@base-ui/react`, `react`, `react-dom`, and `zod` installed as peers.
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [70036b5]
26
+ - @pipe0/base@0.5.0
27
+
3
28
  ## 0.1.7
4
29
 
5
30
  ### Patch Changes
@@ -0,0 +1,22 @@
1
+ import { EffectCardData } from "../../../types/catalog-adapters.mjs";
2
+ import { useRender } from "@base-ui/react/use-render";
3
+ import * as _$react from "react";
4
+ import { MouseEvent } from "react";
5
+
6
+ //#region src/components/compound/effect-catalog/card.d.ts
7
+ interface EffectCatalogCardState {
8
+ selected: boolean;
9
+ expanded: boolean;
10
+ setExpanded: (open: boolean) => void;
11
+ }
12
+ interface EffectCatalogCardProps extends useRender.ComponentProps<"div", EffectCatalogCardState> {
13
+ card: EffectCardData;
14
+ index?: number;
15
+ selected?: boolean;
16
+ /** Overrides the default click handler that fires `onSelectCard`. */
17
+ onClick?: (e: MouseEvent<HTMLDivElement>) => void;
18
+ }
19
+ declare const EffectCatalogCard: _$react.ForwardRefExoticComponent<Omit<EffectCatalogCardProps, "ref"> & _$react.RefAttributes<HTMLDivElement>>;
20
+ //#endregion
21
+ export { EffectCatalogCard, EffectCatalogCardProps, EffectCatalogCardState };
22
+ //# sourceMappingURL=card.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.d.mts","names":[],"sources":["../../../../src/components/compound/effect-catalog/card.tsx"],"mappings":";;;;;;UAyBiB,sBAAA;EACf,QAAA;EACA,QAAA;EACA,WAAA,GAAc,IAAA;AAAA;AAAA,UAGC,sBAAA,SACP,SAAA,CAAU,cAAA,QAAsB,sBAAA;EACxC,IAAA,EAAM,cAAA;EACN,KAAA;EACA,QAAA;EAPA;EASA,OAAA,IAAW,CAAA,EAAG,UAAA,CAAW,cAAA;AAAA;AAAA,cAUd,iBAAA,EAAiB,OAAA,CAAA,yBAAA,CAAA,IAAA,CAAA,sBAAA,WAAA,OAAA,CAAA,aAAA,CAAA,cAAA"}
@@ -0,0 +1,82 @@
1
+ import { cn } from "../../../lib/utils.mjs";
2
+ import { useCatalogConfig } from "../../../context/catalog-config-context.mjs";
3
+ import { EffectCatalogCardContext } from "../../../context/effect-catalog-card-context.mjs";
4
+ import { useEffectCatalogContext } from "../../../context/effect-catalog-context.mjs";
5
+ import { CatalogCardDescription, CatalogCardHeader, CatalogCardTitle } from "../../defaults/catalog/card-primitives.mjs";
6
+ import { mergeProps } from "@base-ui/react/merge-props";
7
+ import { useRender } from "@base-ui/react/use-render";
8
+ import { forwardRef, useCallback, useId, useMemo } from "react";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+
11
+ //#region src/components/compound/effect-catalog/card.tsx
12
+ const DEFAULT_BODY = /* @__PURE__ */ jsxs(CatalogCardHeader, { children: [/* @__PURE__ */ jsx(CatalogCardTitle, {}), /* @__PURE__ */ jsx(CatalogCardDescription, {})] });
13
+ const EffectCatalogCard = forwardRef(function EffectCatalogCard({ card, index = 0, selected = false, render, onClick, className, ...rest }, ref) {
14
+ const { onSelectCard, expandedCardId, setExpandedCardId } = useEffectCatalogContext();
15
+ const { classNames, components } = useCatalogConfig();
16
+ const instanceId = useId();
17
+ const expanded = expandedCardId === instanceId;
18
+ const setExpanded = useCallback((open) => {
19
+ setExpandedCardId(open ? instanceId : null);
20
+ }, [instanceId, setExpandedCardId]);
21
+ const onSelect = useCallback((e) => {
22
+ onSelectCard?.(card, e);
23
+ }, [onSelectCard, card]);
24
+ const contextValue = useMemo(() => ({
25
+ card,
26
+ index,
27
+ selected,
28
+ expanded,
29
+ onSelect,
30
+ setExpanded
31
+ }), [
32
+ card,
33
+ index,
34
+ selected,
35
+ expanded,
36
+ onSelect,
37
+ setExpanded
38
+ ]);
39
+ const interactive = !!(onClick || onSelectCard);
40
+ const handleClick = onClick ? onClick : onSelectCard ? (e) => onSelect(e) : void 0;
41
+ const handleKeyDown = interactive ? (e) => {
42
+ if (e.key === "Enter" || e.key === " ") {
43
+ e.preventDefault();
44
+ if (onClick) onClick(e);
45
+ else onSelect(e);
46
+ }
47
+ } : void 0;
48
+ const isUsingDefaultBody = !render;
49
+ const Card = components?.Card;
50
+ const element = useRender({
51
+ ref,
52
+ defaultTagName: "div",
53
+ render,
54
+ state: {
55
+ selected,
56
+ expanded,
57
+ setExpanded
58
+ },
59
+ stateAttributesMapping: { setExpanded: () => null },
60
+ props: mergeProps({
61
+ role: interactive ? "button" : void 0,
62
+ tabIndex: interactive ? 0 : void 0,
63
+ onClick: handleClick,
64
+ onKeyDown: handleKeyDown,
65
+ className: cn("pz:flex pz:flex-col", isUsingDefaultBody && "pz:rounded-md pz:border pz:border-input pz:bg-card pz:px-3 pz:py-2.5 pz:transition-colors", isUsingDefaultBody && interactive && "pz:hover:bg-muted/40", interactive && "pz:cursor-pointer", classNames?.card, className),
66
+ ...isUsingDefaultBody ? { children: DEFAULT_BODY } : {},
67
+ "data-p0": "catalog-card"
68
+ }, rest)
69
+ });
70
+ if (Card) return /* @__PURE__ */ jsx(EffectCatalogCardContext.Provider, {
71
+ value: contextValue,
72
+ children: /* @__PURE__ */ jsx(Card, { children: DEFAULT_BODY })
73
+ });
74
+ return /* @__PURE__ */ jsx(EffectCatalogCardContext.Provider, {
75
+ value: contextValue,
76
+ children: element
77
+ });
78
+ });
79
+
80
+ //#endregion
81
+ export { EffectCatalogCard };
82
+ //# sourceMappingURL=card.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.mjs","names":[],"sources":["../../../../src/components/compound/effect-catalog/card.tsx"],"sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport {\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n type SyntheticEvent,\n useCallback,\n useId,\n useMemo,\n} from \"react\";\nimport { useCatalogConfig } from \"../../../context/catalog-config-context.js\";\nimport {\n EffectCatalogCardContext,\n type EffectCatalogCardContextValue,\n} from \"../../../context/effect-catalog-card-context.js\";\nimport { useEffectCatalogContext } from \"../../../context/effect-catalog-context.js\";\nimport { cn } from \"../../../lib/utils.js\";\nimport type { EffectCardData } from \"../../../types/catalog-adapters.js\";\nimport {\n CatalogCardDescription,\n CatalogCardHeader,\n CatalogCardTitle,\n} from \"../../defaults/catalog/card-primitives.js\";\n\nexport interface EffectCatalogCardState {\n selected: boolean;\n expanded: boolean;\n setExpanded: (open: boolean) => void;\n}\n\nexport interface EffectCatalogCardProps\n extends useRender.ComponentProps<\"div\", EffectCatalogCardState> {\n card: EffectCardData;\n index?: number;\n selected?: boolean;\n /** Overrides the default click handler that fires `onSelectCard`. */\n onClick?: (e: MouseEvent<HTMLDivElement>) => void;\n}\n\nconst DEFAULT_BODY = (\n <CatalogCardHeader>\n <CatalogCardTitle />\n <CatalogCardDescription />\n </CatalogCardHeader>\n);\n\nexport const EffectCatalogCard = forwardRef<HTMLDivElement, EffectCatalogCardProps>(\n function EffectCatalogCard(\n { card, index = 0, selected = false, render, onClick, className, ...rest },\n ref,\n ) {\n const { onSelectCard, expandedCardId, setExpandedCardId } = useEffectCatalogContext();\n const { classNames, components } = useCatalogConfig();\n const instanceId = useId();\n const expanded = expandedCardId === instanceId;\n\n const setExpanded = useCallback(\n (open: boolean) => {\n setExpandedCardId(open ? instanceId : null);\n },\n [instanceId, setExpandedCardId],\n );\n\n const onSelect = useCallback(\n (e: SyntheticEvent) => {\n onSelectCard?.(card, e);\n },\n [onSelectCard, card],\n );\n\n const contextValue = useMemo<EffectCatalogCardContextValue>(\n () => ({ card, index, selected, expanded, onSelect, setExpanded }),\n [card, index, selected, expanded, onSelect, setExpanded],\n );\n\n const interactive = !!(onClick || onSelectCard);\n const handleClick = onClick\n ? onClick\n : onSelectCard\n ? (e: MouseEvent<HTMLDivElement>) => onSelect(e)\n : undefined;\n const handleKeyDown = interactive\n ? (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (onClick) onClick(e as unknown as MouseEvent<HTMLDivElement>);\n else onSelect(e);\n }\n }\n : undefined;\n\n const isUsingDefaultBody = !render;\n\n const Card = components?.Card;\n\n const element = useRender({\n ref,\n defaultTagName: \"div\",\n render,\n state: { selected, expanded, setExpanded },\n stateAttributesMapping: {\n setExpanded: () => null,\n },\n props: mergeProps<\"div\">(\n {\n role: interactive ? \"button\" : undefined,\n tabIndex: interactive ? 0 : undefined,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n className: cn(\n \"pz:flex pz:flex-col\",\n isUsingDefaultBody &&\n \"pz:rounded-md pz:border pz:border-input pz:bg-card pz:px-3 pz:py-2.5 pz:transition-colors\",\n isUsingDefaultBody && interactive && \"pz:hover:bg-muted/40\",\n interactive && \"pz:cursor-pointer\",\n classNames?.card,\n className,\n ),\n ...(isUsingDefaultBody ? { children: DEFAULT_BODY } : {}),\n ...({ \"data-p0\": \"catalog-card\" } as Record<string, string>),\n },\n rest as Record<string, unknown>,\n ),\n });\n\n if (Card) {\n return (\n <EffectCatalogCardContext.Provider value={contextValue}>\n <Card>{DEFAULT_BODY}</Card>\n </EffectCatalogCardContext.Provider>\n );\n }\n\n return (\n <EffectCatalogCardContext.Provider value={contextValue}>\n {element}\n </EffectCatalogCardContext.Provider>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;AAwCA,MAAM,eACJ,qBAAC,mBAAD,aACE,oBAAC,kBAAD,EAAoB,GACpB,oBAAC,wBAAD,EAA0B,EACR;AAGtB,MAAa,oBAAoB,WAC/B,SAAS,kBACP,EAAE,MAAM,QAAQ,GAAG,WAAW,OAAO,QAAQ,SAAS,WAAW,GAAG,QACpE,KACA;CACA,MAAM,EAAE,cAAc,gBAAgB,sBAAsB,yBAAyB;CACrF,MAAM,EAAE,YAAY,eAAe,kBAAkB;CACrD,MAAM,aAAa,OAAO;CAC1B,MAAM,WAAW,mBAAmB;CAEpC,MAAM,cAAc,aACjB,SAAkB;AACjB,oBAAkB,OAAO,aAAa,KAAK;IAE7C,CAAC,YAAY,kBAAkB,CAChC;CAED,MAAM,WAAW,aACd,MAAsB;AACrB,iBAAe,MAAM,EAAE;IAEzB,CAAC,cAAc,KAAK,CACrB;CAED,MAAM,eAAe,eACZ;EAAE;EAAM;EAAO;EAAU;EAAU;EAAU;EAAa,GACjE;EAAC;EAAM;EAAO;EAAU;EAAU;EAAU;EAAY,CACzD;CAED,MAAM,cAAc,CAAC,EAAE,WAAW;CAClC,MAAM,cAAc,UAChB,UACA,gBACG,MAAkC,SAAS,EAAE,GAC9C;CACN,MAAM,gBAAgB,eACjB,MAAqC;AACpC,MAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;AACtC,KAAE,gBAAgB;AAClB,OAAI,QAAS,SAAQ,EAA2C;OAC3D,UAAS,EAAE;;KAGpB;CAEJ,MAAM,qBAAqB,CAAC;CAE5B,MAAM,OAAO,YAAY;CAEzB,MAAM,UAAU,UAAU;EACxB;EACA,gBAAgB;EAChB;EACA,OAAO;GAAE;GAAU;GAAU;GAAa;EAC1C,wBAAwB,EACtB,mBAAmB,MACpB;EACD,OAAO,WACL;GACE,MAAM,cAAc,WAAW;GAC/B,UAAU,cAAc,IAAI;GAC5B,SAAS;GACT,WAAW;GACX,WAAW,GACT,uBACA,sBACE,6FACF,sBAAsB,eAAe,wBACrC,eAAe,qBACf,YAAY,MACZ,UACD;GACD,GAAI,qBAAqB,EAAE,UAAU,cAAc,GAAG,EAAE;GAClD,WAAW;GAClB,EACD,KACD;EACF,CAAC;AAEF,KAAI,KACF,QACE,oBAAC,yBAAyB,UAA1B;EAAmC,OAAO;YACxC,oBAAC,MAAD,YAAO,cAAoB;EACO;AAIxC,QACE,oBAAC,yBAAyB,UAA1B;EAAmC,OAAO;YACvC;EACiC;EAGzC"}
@@ -0,0 +1,27 @@
1
+ import { CategoryOption } from "../../defaults/catalog/category-filter.mjs";
2
+ import { useRender } from "@base-ui/react/use-render";
3
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
4
+ import { SheetEffectCategory } from "@pipe0/base";
5
+
6
+ //#region src/components/compound/effect-catalog/category-filter.d.ts
7
+ interface EffectCatalogCategoryFilterState {
8
+ value: SheetEffectCategory | null;
9
+ setValue: (value: SheetEffectCategory | null) => void;
10
+ options: ReadonlyArray<CategoryOption<SheetEffectCategory>>;
11
+ counts: Partial<Record<SheetEffectCategory, number>>;
12
+ totalCount: number;
13
+ isActive: boolean;
14
+ }
15
+ interface EffectCatalogCategoryFilterProps extends useRender.ComponentProps<"div", EffectCatalogCategoryFilterState> {
16
+ /** Override the default category options. */
17
+ options?: ReadonlyArray<CategoryOption<SheetEffectCategory>>;
18
+ }
19
+ declare function EffectCatalogCategoryFilter({
20
+ options,
21
+ className,
22
+ render,
23
+ ...props
24
+ }: EffectCatalogCategoryFilterProps): _$react_jsx_runtime0.JSX.Element;
25
+ //#endregion
26
+ export { EffectCatalogCategoryFilter, EffectCatalogCategoryFilterProps, EffectCatalogCategoryFilterState };
27
+ //# sourceMappingURL=category-filter.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"category-filter.d.mts","names":[],"sources":["../../../../src/components/compound/effect-catalog/category-filter.tsx"],"mappings":";;;;;;UAiCiB,gCAAA;EACf,KAAA,EAAO,mBAAA;EACP,QAAA,GAAW,KAAA,EAAO,mBAAA;EAClB,OAAA,EAAS,aAAA,CAAc,cAAA,CAAe,mBAAA;EACtC,MAAA,EAAQ,OAAA,CAAQ,MAAA,CAAO,mBAAA;EACvB,UAAA;EACA,QAAA;AAAA;AAAA,UAGe,gCAAA,SACP,SAAA,CAAU,cAAA,QAAsB,gCAAA;EAPjB;EASvB,OAAA,GAAU,aAAA,CAAc,cAAA,CAAe,mBAAA;AAAA;AAAA,iBAGzB,2BAAA,CAAA;EACd,OAAA;EACA,SAAA;EACA,MAAA;EAAA,GACG;AAAA,GACF,gCAAA,GAAgC,oBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -0,0 +1,61 @@
1
+ import { useEffectCatalogContext } from "../../../context/effect-catalog-context.mjs";
2
+ import { DefaultCategoryFilter } from "../../defaults/catalog/category-filter.mjs";
3
+ import { mergeProps } from "@base-ui/react/merge-props";
4
+ import { useRender } from "@base-ui/react/use-render";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { getSheetEffectCategoryEntries } from "@pipe0/base";
7
+ import { Cog, Eraser, Sparkles, X, Zap } from "lucide-react";
8
+
9
+ //#region src/components/compound/effect-catalog/category-filter.tsx
10
+ const EFFECT_CATEGORY_ICONS = {
11
+ data_hygiene: Eraser,
12
+ enrichment: Zap,
13
+ internal: Cog,
14
+ deprecated: X
15
+ };
16
+ const DEFAULT_OPTIONS = [{
17
+ id: null,
18
+ label: "All",
19
+ icon: Sparkles
20
+ }, ...[...getSheetEffectCategoryEntries()].sort((a, b) => a.order - b.order).map((entry) => ({
21
+ id: entry.id,
22
+ label: entry.label,
23
+ icon: EFFECT_CATEGORY_ICONS[entry.id]
24
+ }))];
25
+ function EffectCatalogCategoryFilter({ options = DEFAULT_OPTIONS, className, render, ...props }) {
26
+ const ctx = useEffectCatalogContext();
27
+ const value = ctx.category;
28
+ const isActive = value !== null;
29
+ const element = useRender({
30
+ defaultTagName: "div",
31
+ render,
32
+ state: {
33
+ value,
34
+ setValue: ctx.setCategory,
35
+ options,
36
+ counts: ctx.baselineCategoryCounts,
37
+ totalCount: ctx.baselineCardCount,
38
+ isActive
39
+ },
40
+ stateAttributesMapping: {
41
+ setValue: () => null,
42
+ options: () => null,
43
+ counts: () => null
44
+ },
45
+ props: mergeProps({
46
+ className,
47
+ "data-p0": "catalog-category-filter"
48
+ }, props)
49
+ });
50
+ if (render) return element;
51
+ return /* @__PURE__ */ jsx(DefaultCategoryFilter, {
52
+ options,
53
+ value: ctx.category,
54
+ onChange: ctx.setCategory,
55
+ className
56
+ });
57
+ }
58
+
59
+ //#endregion
60
+ export { EffectCatalogCategoryFilter };
61
+ //# sourceMappingURL=category-filter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"category-filter.mjs","names":[],"sources":["../../../../src/components/compound/effect-catalog/category-filter.tsx"],"sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { getSheetEffectCategoryEntries, type SheetEffectCategory } from \"@pipe0/base\";\nimport { Cog, Eraser, Sparkles, X, Zap } from \"lucide-react\";\nimport { useEffectCatalogContext } from \"../../../context/effect-catalog-context.js\";\nimport {\n type CategoryOption,\n DefaultCategoryFilter,\n} from \"../../defaults/catalog/category-filter.js\";\n\nconst EFFECT_CATEGORY_ICONS: Record<\n SheetEffectCategory,\n CategoryOption<SheetEffectCategory>[\"icon\"]\n> = {\n data_hygiene: Eraser,\n enrichment: Zap,\n internal: Cog,\n deprecated: X,\n};\n\nconst DEFAULT_OPTIONS: ReadonlyArray<CategoryOption<SheetEffectCategory>> = [\n { id: null, label: \"All\", icon: Sparkles },\n ...[...getSheetEffectCategoryEntries()]\n .sort((a, b) => a.order - b.order)\n .map(\n (entry): CategoryOption<SheetEffectCategory> => ({\n id: entry.id,\n label: entry.label,\n icon: EFFECT_CATEGORY_ICONS[entry.id],\n }),\n ),\n];\n\nexport interface EffectCatalogCategoryFilterState {\n value: SheetEffectCategory | null;\n setValue: (value: SheetEffectCategory | null) => void;\n options: ReadonlyArray<CategoryOption<SheetEffectCategory>>;\n counts: Partial<Record<SheetEffectCategory, number>>;\n totalCount: number;\n isActive: boolean;\n}\n\nexport interface EffectCatalogCategoryFilterProps\n extends useRender.ComponentProps<\"div\", EffectCatalogCategoryFilterState> {\n /** Override the default category options. */\n options?: ReadonlyArray<CategoryOption<SheetEffectCategory>>;\n}\n\nexport function EffectCatalogCategoryFilter({\n options = DEFAULT_OPTIONS,\n className,\n render,\n ...props\n}: EffectCatalogCategoryFilterProps) {\n const ctx = useEffectCatalogContext();\n const value = ctx.category;\n const isActive = value !== null;\n\n const element = useRender({\n defaultTagName: \"div\",\n render,\n state: {\n value,\n setValue: ctx.setCategory,\n options,\n counts: ctx.baselineCategoryCounts,\n totalCount: ctx.baselineCardCount,\n isActive,\n },\n stateAttributesMapping: {\n setValue: () => null,\n options: () => null,\n counts: () => null,\n },\n props: mergeProps<\"div\">(\n {\n className,\n ...({ \"data-p0\": \"catalog-category-filter\" } as Record<string, string>),\n },\n props,\n ),\n });\n\n if (render) return element;\n\n return (\n <DefaultCategoryFilter\n options={options}\n value={ctx.category}\n onChange={ctx.setCategory}\n className={className}\n />\n );\n}\n"],"mappings":";;;;;;;;;AAUA,MAAM,wBAGF;CACF,cAAc;CACd,YAAY;CACZ,UAAU;CACV,YAAY;CACb;AAED,MAAM,kBAAsE,CAC1E;CAAE,IAAI;CAAM,OAAO;CAAO,MAAM;CAAU,EAC1C,GAAG,CAAC,GAAG,+BAA+B,CAAC,CACpC,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,CACjC,KACE,WAAgD;CAC/C,IAAI,MAAM;CACV,OAAO,MAAM;CACb,MAAM,sBAAsB,MAAM;CACnC,EACF,CACJ;AAiBD,SAAgB,4BAA4B,EAC1C,UAAU,iBACV,WACA,QACA,GAAG,SACgC;CACnC,MAAM,MAAM,yBAAyB;CACrC,MAAM,QAAQ,IAAI;CAClB,MAAM,WAAW,UAAU;CAE3B,MAAM,UAAU,UAAU;EACxB,gBAAgB;EAChB;EACA,OAAO;GACL;GACA,UAAU,IAAI;GACd;GACA,QAAQ,IAAI;GACZ,YAAY,IAAI;GAChB;GACD;EACD,wBAAwB;GACtB,gBAAgB;GAChB,eAAe;GACf,cAAc;GACf;EACD,OAAO,WACL;GACE;GACM,WAAW;GAClB,EACD,MACD;EACF,CAAC;AAEF,KAAI,OAAQ,QAAO;AAEnB,QACE,oBAAC,uBAAD;EACW;EACT,OAAO,IAAI;EACX,UAAU,IAAI;EACH;EACX"}
@@ -0,0 +1,17 @@
1
+ import { useRender } from "@base-ui/react/use-render";
2
+ import * as _$react from "react";
3
+
4
+ //#region src/components/compound/effect-catalog/empty.d.ts
5
+ interface EffectCatalogEmptyState {
6
+ visible: boolean;
7
+ }
8
+ interface EffectCatalogEmptyProps extends useRender.ComponentProps<"div", EffectCatalogEmptyState> {}
9
+ declare function EffectCatalogEmpty({
10
+ children,
11
+ className,
12
+ render,
13
+ ...props
14
+ }: EffectCatalogEmptyProps): _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | null;
15
+ //#endregion
16
+ export { EffectCatalogEmpty, EffectCatalogEmptyProps, EffectCatalogEmptyState };
17
+ //# sourceMappingURL=empty.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty.d.mts","names":[],"sources":["../../../../src/components/compound/effect-catalog/empty.tsx"],"mappings":";;;;UAMiB,uBAAA;EACf,OAAA;AAAA;AAAA,UAGe,uBAAA,SACP,SAAA,CAAU,cAAA,QAAsB,uBAAA;AAAA,iBAE1B,kBAAA,CAAA;EACd,QAAA;EACA,SAAA;EACA,MAAA;EAAA,GACG;AAAA,GACF,uBAAA,GAAuB,OAAA,CAAA,YAAA,mBAAA,OAAA,CAAA,qBAAA"}
@@ -0,0 +1,29 @@
1
+ import { useCatalogConfig } from "../../../context/catalog-config-context.mjs";
2
+ import { useEffectCatalogContext } from "../../../context/effect-catalog-context.mjs";
3
+ import { DefaultEmptyState } from "../../defaults/catalog/empty-state.mjs";
4
+ import { mergeProps } from "@base-ui/react/merge-props";
5
+ import { useRender } from "@base-ui/react/use-render";
6
+ import { jsx } from "react/jsx-runtime";
7
+
8
+ //#region src/components/compound/effect-catalog/empty.tsx
9
+ function EffectCatalogEmpty({ children, className, render, ...props }) {
10
+ const { components } = useCatalogConfig();
11
+ const visible = useEffectCatalogContext().table.getRowModel().rows.length === 0;
12
+ const EmptyState = components?.EmptyState;
13
+ const element = useRender({
14
+ defaultTagName: "div",
15
+ render,
16
+ state: { visible },
17
+ props: mergeProps({
18
+ className,
19
+ children: EmptyState ? /* @__PURE__ */ jsx(EmptyState, { children }) : /* @__PURE__ */ jsx(DefaultEmptyState, { children: children ?? "No effects found. Try adjusting your filters." }),
20
+ "data-p0": "catalog-empty"
21
+ }, props)
22
+ });
23
+ if (!visible) return null;
24
+ return element;
25
+ }
26
+
27
+ //#endregion
28
+ export { EffectCatalogEmpty };
29
+ //# sourceMappingURL=empty.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty.mjs","names":[],"sources":["../../../../src/components/compound/effect-catalog/empty.tsx"],"sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { useCatalogConfig } from \"../../../context/catalog-config-context.js\";\nimport { useEffectCatalogContext } from \"../../../context/effect-catalog-context.js\";\nimport { DefaultEmptyState } from \"../../defaults/catalog/empty-state.js\";\n\nexport interface EffectCatalogEmptyState {\n visible: boolean;\n}\n\nexport interface EffectCatalogEmptyProps\n extends useRender.ComponentProps<\"div\", EffectCatalogEmptyState> {}\n\nexport function EffectCatalogEmpty({\n children,\n className,\n render,\n ...props\n}: EffectCatalogEmptyProps) {\n const { components } = useCatalogConfig();\n const ctx = useEffectCatalogContext();\n const visible = ctx.table.getRowModel().rows.length === 0;\n\n const EmptyState = components?.EmptyState;\n const defaultBody = EmptyState ? (\n <EmptyState>{children}</EmptyState>\n ) : (\n <DefaultEmptyState>\n {children ?? \"No effects found. Try adjusting your filters.\"}\n </DefaultEmptyState>\n );\n\n const element = useRender({\n defaultTagName: \"div\",\n render,\n state: { visible },\n props: mergeProps<\"div\">(\n {\n className,\n children: defaultBody,\n ...({ \"data-p0\": \"catalog-empty\" } as Record<string, string>),\n },\n props,\n ),\n });\n\n if (!visible) return null;\n return element;\n}\n"],"mappings":";;;;;;;;AAaA,SAAgB,mBAAmB,EACjC,UACA,WACA,QACA,GAAG,SACuB;CAC1B,MAAM,EAAE,eAAe,kBAAkB;CAEzC,MAAM,UADM,yBAAyB,CACjB,MAAM,aAAa,CAAC,KAAK,WAAW;CAExD,MAAM,aAAa,YAAY;CAS/B,MAAM,UAAU,UAAU;EACxB,gBAAgB;EAChB;EACA,OAAO,EAAE,SAAS;EAClB,OAAO,WACL;GACE;GACA,UAfc,aAClB,oBAAC,YAAD,EAAa,UAAsB,IAEnC,oBAAC,mBAAD,YACG,YAAY,iDACK;GAWV,WAAW;GAClB,EACD,MACD;EACF,CAAC;AAEF,KAAI,CAAC,QAAS,QAAO;AACrB,QAAO"}
@@ -0,0 +1,6 @@
1
+ import { EffectCatalogCard, EffectCatalogCardProps, EffectCatalogCardState } from "./card.mjs";
2
+ import { EffectCatalogCategoryFilter, EffectCatalogCategoryFilterProps, EffectCatalogCategoryFilterState } from "./category-filter.mjs";
3
+ import { EffectCatalogEmpty, EffectCatalogEmptyProps, EffectCatalogEmptyState } from "./empty.mjs";
4
+ import { EffectCatalogList, EffectCatalogListProps, EffectCatalogListState } from "./list.mjs";
5
+ import { EffectCatalog, EffectCatalogInstanceProps, EffectCatalogProps, EffectCatalogZeroConfigProps } from "./root.mjs";
6
+ import { EffectCatalogSearchFilter, EffectCatalogSearchFilterProps, EffectCatalogSearchFilterState } from "./search-filter.mjs";
@@ -0,0 +1,19 @@
1
+ import { EffectCardData } from "../../../types/catalog-adapters.mjs";
2
+ import { useRender } from "@base-ui/react/use-render";
3
+ import * as _$react from "react";
4
+
5
+ //#region src/components/compound/effect-catalog/list.d.ts
6
+ interface EffectCatalogListState {
7
+ cards: ReadonlyArray<EffectCardData>;
8
+ isEmpty: boolean;
9
+ }
10
+ interface EffectCatalogListProps extends useRender.ComponentProps<"div", EffectCatalogListState> {}
11
+ declare function EffectCatalogList({
12
+ render,
13
+ className,
14
+ children,
15
+ ...props
16
+ }: EffectCatalogListProps): _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | null;
17
+ //#endregion
18
+ export { EffectCatalogList, EffectCatalogListProps, EffectCatalogListState };
19
+ //# sourceMappingURL=list.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.mts","names":[],"sources":["../../../../src/components/compound/effect-catalog/list.tsx"],"mappings":";;;;;UAOiB,sBAAA;EACf,KAAA,EAAO,aAAA,CAAc,cAAA;EACrB,OAAA;AAAA;AAAA,UAGe,sBAAA,SACP,SAAA,CAAU,cAAA,QAAsB,sBAAA;AAAA,iBAE1B,iBAAA,CAAA;EACd,MAAA;EACA,SAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,sBAAA,GAAsB,OAAA,CAAA,YAAA,mBAAA,OAAA,CAAA,qBAAA"}
@@ -0,0 +1,33 @@
1
+ import { cn } from "../../../lib/utils.mjs";
2
+ import { useEffectCatalogContext } from "../../../context/effect-catalog-context.mjs";
3
+ import { EffectCatalogCard } from "./card.mjs";
4
+ import { mergeProps } from "@base-ui/react/merge-props";
5
+ import { useRender } from "@base-ui/react/use-render";
6
+ import { jsx } from "react/jsx-runtime";
7
+
8
+ //#region src/components/compound/effect-catalog/list.tsx
9
+ function EffectCatalogList({ render, className, children, ...props }) {
10
+ const { cards } = useEffectCatalogContext();
11
+ const isEmpty = cards.length === 0;
12
+ const defaultBody = cards.map((card) => /* @__PURE__ */ jsx(EffectCatalogCard, { card }, card.effectId));
13
+ const element = useRender({
14
+ defaultTagName: "div",
15
+ render,
16
+ state: {
17
+ cards,
18
+ isEmpty
19
+ },
20
+ stateAttributesMapping: { cards: () => null },
21
+ props: mergeProps({
22
+ className: cn("pz:flex pz:flex-col pz:gap-2", className),
23
+ children: children ?? defaultBody,
24
+ "data-p0": "catalog-list"
25
+ }, props)
26
+ });
27
+ if (isEmpty) return null;
28
+ return element;
29
+ }
30
+
31
+ //#endregion
32
+ export { EffectCatalogList };
33
+ //# sourceMappingURL=list.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.mjs","names":[],"sources":["../../../../src/components/compound/effect-catalog/list.tsx"],"sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { useEffectCatalogContext } from \"../../../context/effect-catalog-context.js\";\nimport { cn } from \"../../../lib/utils.js\";\nimport type { EffectCardData } from \"../../../types/catalog-adapters.js\";\nimport { EffectCatalogCard } from \"./card.js\";\n\nexport interface EffectCatalogListState {\n cards: ReadonlyArray<EffectCardData>;\n isEmpty: boolean;\n}\n\nexport interface EffectCatalogListProps\n extends useRender.ComponentProps<\"div\", EffectCatalogListState> {}\n\nexport function EffectCatalogList({\n render,\n className,\n children,\n ...props\n}: EffectCatalogListProps) {\n const { cards } = useEffectCatalogContext();\n const isEmpty = cards.length === 0;\n\n const defaultBody = cards.map((card) => <EffectCatalogCard key={card.effectId} card={card} />);\n\n const element = useRender({\n defaultTagName: \"div\",\n render,\n state: { cards, isEmpty },\n stateAttributesMapping: {\n cards: () => null,\n },\n props: mergeProps<\"div\">(\n {\n className: cn(\"pz:flex pz:flex-col pz:gap-2\", className),\n children: children ?? defaultBody,\n ...({ \"data-p0\": \"catalog-list\" } as Record<string, string>),\n },\n props,\n ),\n });\n\n if (isEmpty) return null;\n return element;\n}\n"],"mappings":";;;;;;;;AAeA,SAAgB,kBAAkB,EAChC,QACA,WACA,UACA,GAAG,SACsB;CACzB,MAAM,EAAE,UAAU,yBAAyB;CAC3C,MAAM,UAAU,MAAM,WAAW;CAEjC,MAAM,cAAc,MAAM,KAAK,SAAS,oBAAC,mBAAD,EAA6C,MAAQ,EAA7B,KAAK,SAAwB,CAAC;CAE9F,MAAM,UAAU,UAAU;EACxB,gBAAgB;EAChB;EACA,OAAO;GAAE;GAAO;GAAS;EACzB,wBAAwB,EACtB,aAAa,MACd;EACD,OAAO,WACL;GACE,WAAW,GAAG,gCAAgC,UAAU;GACxD,UAAU,YAAY;GAChB,WAAW;GAClB,EACD,MACD;EACF,CAAC;AAEF,KAAI,QAAS,QAAO;AACpB,QAAO"}
@@ -0,0 +1,31 @@
1
+ import { CatalogClassNames, CatalogComponentOverrides, EffectCardData } from "../../../types/catalog-adapters.mjs";
2
+ import { UseEffectCatalogTableReturn } from "../../../hooks/use-effect-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 { SheetEffectCatalogTableData } from "@pipe0/base";
7
+
8
+ //#region src/components/compound/effect-catalog/root.d.ts
9
+ interface CustomizationProps {
10
+ classNames?: CatalogClassNames;
11
+ components?: CatalogComponentOverrides;
12
+ className?: string;
13
+ render?: useRender.ComponentProps<"div">["render"];
14
+ }
15
+ interface SelectionProps {
16
+ /** Fires on click / keyboard activation of any `<EffectCatalogCard>`. */
17
+ onSelectEffect?: (effect: EffectCardData, e: SyntheticEvent) => void;
18
+ }
19
+ interface EffectCatalogInstanceProps extends CustomizationProps, SelectionProps {
20
+ context: UseEffectCatalogTableReturn;
21
+ children?: ReactNode;
22
+ }
23
+ interface EffectCatalogZeroConfigProps extends CustomizationProps, SelectionProps {
24
+ filter?: (entry: SheetEffectCatalogTableData) => boolean;
25
+ children?: ReactNode;
26
+ }
27
+ type EffectCatalogProps = EffectCatalogInstanceProps | EffectCatalogZeroConfigProps;
28
+ declare function EffectCatalog(props: EffectCatalogProps): _$react_jsx_runtime0.JSX.Element;
29
+ //#endregion
30
+ export { EffectCatalog, EffectCatalogInstanceProps, EffectCatalogProps, EffectCatalogZeroConfigProps };
31
+ //# sourceMappingURL=root.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root.d.mts","names":[],"sources":["../../../../src/components/compound/effect-catalog/root.tsx"],"mappings":";;;;;;;;UA4BU,kBAAA;EACR,UAAA,GAAa,iBAAA;EACb,UAAA,GAAa,yBAAA;EACb,SAAA;EACA,MAAA,GAAS,SAAA,CAAU,cAAA;AAAA;AAAA,UAGX,cAAA;EALK;EAOb,cAAA,IAAkB,MAAA,EAAQ,cAAA,EAAgB,CAAA,EAAG,cAAA;AAAA;AAAA,UAG9B,0BAAA,SAAmC,kBAAA,EAAoB,cAAA;EACtE,OAAA,EAAS,2BAAA;EACT,QAAA,GAAW,SAAA;AAAA;AAAA,UAGI,4BAAA,SAAqC,kBAAA,EAAoB,cAAA;EACxE,MAAA,IAAU,KAAA,EAAO,2BAAA;EACjB,QAAA,GAAW,SAAA;AAAA;AAAA,KAGD,kBAAA,GAAqB,0BAAA,GAA6B,4BAAA;AAAA,iBAE9C,aAAA,CAAc,KAAA,EAAO,kBAAA,GAAkB,oBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -0,0 +1,67 @@
1
+ import { CatalogProvider, CatalogRoot, useCatalogConfig } from "../../../context/catalog-config-context.mjs";
2
+ import { EffectCatalogContext } from "../../../context/effect-catalog-context.mjs";
3
+ import { EffectCatalogCategoryFilter } from "./category-filter.mjs";
4
+ import { EffectCatalogEmpty } from "./empty.mjs";
5
+ import { EffectCatalogList } from "./list.mjs";
6
+ import { useEffectCatalogTable } from "../../../hooks/use-effect-catalog-table.mjs";
7
+ import { DefaultCatalogRoot } from "../../defaults/catalog/layout.mjs";
8
+ import { EffectCatalogSearchFilter } from "./search-filter.mjs";
9
+ import { useMemo, useState } from "react";
10
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
+
12
+ //#region src/components/compound/effect-catalog/root.tsx
13
+ function EffectCatalog(props) {
14
+ if ("context" in props) return /* @__PURE__ */ jsx(EffectCatalogWithContext, { ...props });
15
+ return /* @__PURE__ */ jsx(EffectCatalogZeroConfig, { ...props });
16
+ }
17
+ function EffectCatalogZeroConfig({ filter, ...rest }) {
18
+ return /* @__PURE__ */ jsx(EffectCatalogWithContext, {
19
+ context: useEffectCatalogTable({ filter }),
20
+ ...rest
21
+ });
22
+ }
23
+ function EffectCatalogWithContext({ context, children, className, classNames, components, onSelectEffect, render }) {
24
+ const hasLocalOverrides = classNames || components;
25
+ const [expandedCardId, setExpandedCardId] = useState(null);
26
+ const value = useMemo(() => ({
27
+ ...context,
28
+ onSelectCard: onSelectEffect,
29
+ expandedCardId,
30
+ setExpandedCardId
31
+ }), [
32
+ context,
33
+ onSelectEffect,
34
+ expandedCardId
35
+ ]);
36
+ const inner = /* @__PURE__ */ jsx(EffectCatalogContext.Provider, {
37
+ value,
38
+ children: /* @__PURE__ */ jsx(EffectCatalogShell, {
39
+ className,
40
+ render,
41
+ children
42
+ })
43
+ });
44
+ if (hasLocalOverrides) return /* @__PURE__ */ jsx(CatalogRoot, { children: /* @__PURE__ */ jsx(CatalogProvider, {
45
+ classNames,
46
+ components,
47
+ children: inner
48
+ }) });
49
+ return /* @__PURE__ */ jsx(CatalogRoot, { children: inner });
50
+ }
51
+ function EffectCatalogShell({ children, className, render }) {
52
+ useCatalogConfig();
53
+ return /* @__PURE__ */ jsx(DefaultCatalogRoot, {
54
+ className,
55
+ render,
56
+ children: children !== void 0 ? children : /* @__PURE__ */ jsxs(Fragment$1, { children: [
57
+ /* @__PURE__ */ jsx(EffectCatalogSearchFilter, {}),
58
+ /* @__PURE__ */ jsx(EffectCatalogCategoryFilter, {}),
59
+ /* @__PURE__ */ jsx(EffectCatalogList, {}),
60
+ /* @__PURE__ */ jsx(EffectCatalogEmpty, {})
61
+ ] })
62
+ });
63
+ }
64
+
65
+ //#endregion
66
+ export { EffectCatalog };
67
+ //# sourceMappingURL=root.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root.mjs","names":[],"sources":["../../../../src/components/compound/effect-catalog/root.tsx"],"sourcesContent":["import type { useRender } from \"@base-ui/react/use-render\";\nimport type { SheetEffectCatalogTableData } from \"@pipe0/base\";\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 EffectCatalogContext,\n type EffectCatalogContextValue,\n} from \"../../../context/effect-catalog-context.js\";\nimport {\n type UseEffectCatalogTableReturn,\n useEffectCatalogTable,\n} from \"../../../hooks/use-effect-catalog-table.js\";\nimport type {\n CatalogClassNames,\n CatalogComponentOverrides,\n EffectCardData,\n} from \"../../../types/catalog-adapters.js\";\nimport { DefaultCatalogRoot } from \"../../defaults/catalog/layout.js\";\nimport { EffectCatalogCategoryFilter } from \"./category-filter.js\";\nimport { EffectCatalogEmpty } from \"./empty.js\";\nimport { EffectCatalogList } from \"./list.js\";\nimport { EffectCatalogSearchFilter } 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 `<EffectCatalogCard>`. */\n onSelectEffect?: (effect: EffectCardData, e: SyntheticEvent) => void;\n}\n\nexport interface EffectCatalogInstanceProps extends CustomizationProps, SelectionProps {\n context: UseEffectCatalogTableReturn;\n children?: ReactNode;\n}\n\nexport interface EffectCatalogZeroConfigProps extends CustomizationProps, SelectionProps {\n filter?: (entry: SheetEffectCatalogTableData) => boolean;\n children?: ReactNode;\n}\n\nexport type EffectCatalogProps = EffectCatalogInstanceProps | EffectCatalogZeroConfigProps;\n\nexport function EffectCatalog(props: EffectCatalogProps) {\n if (\"context\" in props) {\n return <EffectCatalogWithContext {...props} />;\n }\n return <EffectCatalogZeroConfig {...props} />;\n}\n\nfunction EffectCatalogZeroConfig({ filter, ...rest }: EffectCatalogZeroConfigProps) {\n const context = useEffectCatalogTable({ filter });\n return <EffectCatalogWithContext context={context} {...rest} />;\n}\n\nfunction EffectCatalogWithContext({\n context,\n children,\n className,\n classNames,\n components,\n onSelectEffect,\n render,\n}: EffectCatalogInstanceProps) {\n const hasLocalOverrides = classNames || components;\n const [expandedCardId, setExpandedCardId] = useState<string | null>(null);\n\n const value = useMemo<EffectCatalogContextValue>(\n () => ({\n ...context,\n onSelectCard: onSelectEffect,\n expandedCardId,\n setExpandedCardId,\n }),\n [context, onSelectEffect, expandedCardId],\n );\n\n const inner = (\n <EffectCatalogContext.Provider value={value}>\n <EffectCatalogShell className={className} render={render}>\n {children}\n </EffectCatalogShell>\n </EffectCatalogContext.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 EffectCatalogShell({\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 <EffectCatalogSearchFilter />\n <EffectCatalogCategoryFilter />\n <EffectCatalogList />\n <EffectCatalogEmpty />\n </>\n );\n return (\n <DefaultCatalogRoot className={className} render={render}>\n {body}\n </DefaultCatalogRoot>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAoDA,SAAgB,cAAc,OAA2B;AACvD,KAAI,aAAa,MACf,QAAO,oBAAC,0BAAD,EAA0B,GAAI,OAAS;AAEhD,QAAO,oBAAC,yBAAD,EAAyB,GAAI,OAAS;;AAG/C,SAAS,wBAAwB,EAAE,QAAQ,GAAG,QAAsC;AAElF,QAAO,oBAAC,0BAAD;EAA0B,SADjB,sBAAsB,EAAE,QAAQ,CAAC;EACE,GAAI;EAAQ;;AAGjE,SAAS,yBAAyB,EAChC,SACA,UACA,WACA,YACA,YACA,gBACA,UAC6B;CAC7B,MAAM,oBAAoB,cAAc;CACxC,MAAM,CAAC,gBAAgB,qBAAqB,SAAwB,KAAK;CAEzE,MAAM,QAAQ,eACL;EACL,GAAG;EACH,cAAc;EACd;EACA;EACD,GACD;EAAC;EAAS;EAAgB;EAAe,CAC1C;CAED,MAAM,QACJ,oBAAC,qBAAqB,UAAtB;EAAsC;YACpC,oBAAC,oBAAD;GAA+B;GAAmB;GAC/C;GACkB;EACS;AAElC,KAAI,kBACF,QACE,oBAAC,aAAD,YACE,oBAAC,iBAAD;EAA6B;EAAwB;YAClD;EACe,GACN;AAGlB,QAAO,oBAAC,aAAD,YAAc,OAAoB;;AAG3C,SAAS,mBAAmB,EAC1B,UACA,WACA,UAKC;AACD,mBAAkB;AAYlB,QACE,oBAAC,oBAAD;EAA+B;EAAmB;YAXlD,aAAa,SACX,WAEA;GACE,oBAAC,2BAAD,EAA6B;GAC7B,oBAAC,6BAAD,EAA+B;GAC/B,oBAAC,mBAAD,EAAqB;GACrB,oBAAC,oBAAD,EAAsB;GACrB;EAKgB"}
@@ -0,0 +1,21 @@
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/effect-catalog/search-filter.d.ts
5
+ interface EffectCatalogSearchFilterState {
6
+ value: string;
7
+ setValue: (value: string) => void;
8
+ isActive: boolean;
9
+ }
10
+ interface EffectCatalogSearchFilterProps extends useRender.ComponentProps<"input", EffectCatalogSearchFilterState> {
11
+ placeholder?: string;
12
+ }
13
+ declare function EffectCatalogSearchFilter({
14
+ placeholder,
15
+ className,
16
+ render,
17
+ ...props
18
+ }: EffectCatalogSearchFilterProps): _$react_jsx_runtime0.JSX.Element;
19
+ //#endregion
20
+ export { EffectCatalogSearchFilter, EffectCatalogSearchFilterProps, EffectCatalogSearchFilterState };
21
+ //# sourceMappingURL=search-filter.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-filter.d.mts","names":[],"sources":["../../../../src/components/compound/effect-catalog/search-filter.tsx"],"mappings":";;;;UASiB,8BAAA;EACf,KAAA;EACA,QAAA,GAAW,KAAA;EACX,QAAA;AAAA;AAAA,UAGe,8BAAA,SACP,SAAA,CAAU,cAAA,UAAwB,8BAAA;EAC1C,WAAA;AAAA;AAAA,iBAGc,yBAAA,CAAA;EACd,WAAA;EACA,SAAA;EACA,MAAA;EAAA,GACG;AAAA,GACF,8BAAA,GAA8B,oBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -0,0 +1,47 @@
1
+ import { cn } from "../../../lib/utils.mjs";
2
+ import { useCatalogConfig } from "../../../context/catalog-config-context.mjs";
3
+ import { useEffectCatalogContext } from "../../../context/effect-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/effect-catalog/search-filter.tsx
11
+ function EffectCatalogSearchFilter({ placeholder = "Search effects...", className, render, ...props }) {
12
+ const { globalFilterInput, setGlobalFilterInput } = useEffectCatalogContext();
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 { EffectCatalogSearchFilter };
47
+ //# sourceMappingURL=search-filter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-filter.mjs","names":["SearchIcon"],"sources":["../../../../src/components/compound/effect-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 { useEffectCatalogContext } from \"../../../context/effect-catalog-context.js\";\nimport { cn } from \"../../../lib/utils.js\";\nimport { Input } from \"../../ui/input.js\";\n\nexport interface EffectCatalogSearchFilterState {\n value: string;\n setValue: (value: string) => void;\n isActive: boolean;\n}\n\nexport interface EffectCatalogSearchFilterProps\n extends useRender.ComponentProps<\"input\", EffectCatalogSearchFilterState> {\n placeholder?: string;\n}\n\nexport function EffectCatalogSearchFilter({\n placeholder = \"Search effects...\",\n className,\n render,\n ...props\n}: EffectCatalogSearchFilterProps) {\n const { globalFilterInput, setGlobalFilterInput } = useEffectCatalogContext();\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,0BAA0B,EACxC,cAAc,qBACd,WACA,QACA,GAAG,SAC8B;CACjC,MAAM,EAAE,mBAAmB,yBAAyB,yBAAyB;CAC7E,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,7 +1,7 @@
1
1
  import { cn } from "../../../lib/utils.mjs";
2
2
  import { useCatalogConfig } from "../../../context/catalog-config-context.mjs";
3
- import { usePipeCatalogContext } from "../../../context/pipe-catalog-context.mjs";
4
3
  import { PipeCatalogCardContext } from "../../../context/pipe-catalog-card-context.mjs";
4
+ import { usePipeCatalogContext } from "../../../context/pipe-catalog-context.mjs";
5
5
  import { CatalogCardDescription, CatalogCardHeader, CatalogCardTitle } from "../../defaults/catalog/card-primitives.mjs";
6
6
  import { mergeProps } from "@base-ui/react/merge-props";
7
7
  import { useRender } from "@base-ui/react/use-render";
@@ -3,8 +3,8 @@ import { DefaultCategoryFilter } from "../../defaults/catalog/category-filter.mj
3
3
  import { mergeProps } from "@base-ui/react/merge-props";
4
4
  import { useRender } from "@base-ui/react/use-render";
5
5
  import { jsx } from "react/jsx-runtime";
6
- import { Building2, Database, Hammer, Plug, ScanFace, Search, Users, X, Zap } from "lucide-react";
7
6
  import { getPipeCategoryEntries } from "@pipe0/base";
7
+ import { Building2, Database, Hammer, Plug, ScanFace, Search, Users, X, Zap } from "lucide-react";
8
8
 
9
9
  //#region src/components/compound/pipe-catalog/category-filter.tsx
10
10
  const PIPE_CATEGORY_ICONS = {
@@ -1,8 +1,8 @@
1
1
  import { usePipeCatalogContext } from "../../../context/pipe-catalog-context.mjs";
2
2
  import { PipeCatalogColumnFilter } from "./column-filter.mjs";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
- import { Building2 } from "lucide-react";
5
4
  import { getProviderEntry } from "@pipe0/base";
5
+ import { Building2 } from "lucide-react";
6
6
 
7
7
  //#region src/components/compound/pipe-catalog/provider-filter.tsx
8
8
  const DEFAULT_PLACEHOLDER = /* @__PURE__ */ jsxs("span", {