@pipe0/react 1.0.39 → 1.0.41

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.
@@ -1 +1 @@
1
- {"version":3,"file":"catalog-helpers.mjs","names":[],"sources":["../../src/utils/catalog-helpers.tsx"],"sourcesContent":["import {\n type CatalogSearchTarget,\n type RecordFieldFormat,\n type RecordFieldStatus,\n type RecordFieldType,\n scoreCatalogSearch,\n} from \"@pipe0/base\";\nimport { type RankingInfo, rankItem } from \"@tanstack/match-sorter-utils\";\nimport type { FilterFn, RowData, SortFn, TableFeatures } from \"@tanstack/react-table\";\nimport type { ComponentType } from \"react\";\nimport {\n AtSign,\n BookDashed,\n Bookmark,\n Braces,\n Calendar,\n CalendarClock,\n CheckCheck,\n Coins,\n Contact,\n Hash,\n HelpCircle,\n Internet,\n Loader,\n MapPin,\n Pause,\n Percent,\n Phone,\n TextAlignStart,\n ToggleRight,\n TriangleDashed,\n Type,\n X,\n} from \"../components/internal/icons.js\";\n\nconst fieldStatusIconMap = {\n completed: CheckCheck,\n failed: X,\n no_result: BookDashed,\n pending: Bookmark,\n processing: Loader,\n queued: Pause,\n skipped: TriangleDashed,\n} satisfies Record<RecordFieldStatus, ComponentType>;\n\nconst FieldTypeIconMap = {\n boolean: ToggleRight,\n json: Braces,\n number: Hash,\n string: Type,\n unknown: HelpCircle,\n} satisfies Record<RecordFieldType, ComponentType>;\n\nexport function getFieldTypeIcon(fieldType: RecordFieldType) {\n return FieldTypeIconMap[fieldType];\n}\n\nconst FieldFormatIconMap: Partial<Record<NonNullable<RecordFieldFormat>, ComponentType>> = {\n email: AtSign,\n url: Internet,\n website_url: Internet,\n domain: Internet,\n profile_url: Contact,\n phone: Phone,\n date: Calendar,\n datetime: CalendarClock,\n address_line_1: MapPin,\n zip_code: Hash,\n currency: Coins,\n percent: Percent,\n markdown: TextAlignStart,\n long_text: TextAlignStart,\n text: Type,\n int: Hash,\n decimal: Hash,\n json_object: Braces,\n json_list: Braces,\n json_list_string: Braces,\n};\n\n/**\n * Column icon: the format is the expressive signal (an email column looks\n * different from a date column), the type is the fallback for untyped fields.\n */\nexport function getFieldFormatIcon(format: RecordFieldFormat, fieldType: RecordFieldType) {\n return (format ? FieldFormatIconMap[format] : undefined) ?? getFieldTypeIcon(fieldType);\n}\n\nexport function getFieldStatusIcon(fieldStatus: RecordFieldStatus) {\n return fieldStatusIconMap[fieldStatus];\n}\n\n/** Filter meta the catalog filter fns attach to rows, read back by the sort fns. */\nexport interface CatalogFilterMeta {\n itemRank?: RankingInfo;\n searchScore?: number;\n}\n\n// Docs idiom (fuzzy-filtering guide): a features type that only carries the\n// meta shape, so these fns are not coupled to one exact features object.\nexport type CatalogSearchFeatures = TableFeatures & { filterMeta: CatalogFilterMeta };\n\nexport const fuzzyFilter: FilterFn<CatalogSearchFeatures, RowData> = (\n row,\n columnId,\n value,\n addMeta,\n) => {\n const itemRank = rankItem(row.getValue(columnId), value);\n addMeta?.({ itemRank });\n return itemRank.passed;\n};\n\n// Global-filter fn for the catalog tables' hidden \"search\" column (its value\n// is a precomputed CatalogSearchTarget). Stashes the score so\n// catalogSearchSort can order rows by relevance while a query is active.\nexport const catalogSearchFilter: FilterFn<CatalogSearchFeatures, RowData> = (\n row,\n columnId,\n value,\n addMeta,\n) => {\n const score = scoreCatalogSearch(\n row.getValue<CatalogSearchTarget>(columnId),\n String(value ?? \"\"),\n );\n addMeta?.({ searchScore: score });\n return score > 0;\n};\n\nexport const catalogSearchSort: SortFn<CatalogSearchFeatures, RowData> = (rowA, rowB, columnId) => {\n const a = rowA.columnFiltersMeta[columnId]?.searchScore ?? 0;\n const b = rowB.columnFiltersMeta[columnId]?.searchScore ?? 0;\n return a - b; // paired with `desc: true` → highest score first\n};\n"],"mappings":";;;;;AAmCA,MAAM,qBAAqB;CACzB,WAAW;CACX,QAAQ;CACR,WAAW;CACX,SAAS;CACT,YAAY;CACZ,QAAQ;CACR,SAAS;CACV;AAED,MAAM,mBAAmB;CACvB,SAAS;CACT,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,SAAS;CACV;AAED,SAAgB,iBAAiB,WAA4B;AAC3D,QAAO,iBAAiB;;AAG1B,MAAM,qBAAqF;CACzF,OAAO;CACP,KAAK;CACL,aAAa;CACb,QAAQ;CACR,aAAa;CACb,OAAO;CACP,MAAM;CACN,UAAU;CACV,gBAAgB;CAChB,UAAU;CACV,UAAU;CACV,SAAS;CACT,UAAU;CACV,WAAW;CACX,MAAM;CACN,KAAK;CACL,SAAS;CACT,aAAa;CACb,WAAW;CACX,kBAAkB;CACnB;;;;;AAMD,SAAgB,mBAAmB,QAA2B,WAA4B;AACxF,SAAQ,SAAS,mBAAmB,UAAU,WAAc,iBAAiB,UAAU;;AAGzF,SAAgB,mBAAmB,aAAgC;AACjE,QAAO,mBAAmB;;AAa5B,MAAa,eACX,KACA,UACA,OACA,YACG;CACH,MAAM,WAAW,SAAS,IAAI,SAAS,SAAS,EAAE,MAAM;AACxD,WAAU,EAAE,UAAU,CAAC;AACvB,QAAO,SAAS;;AAMlB,MAAa,uBACX,KACA,UACA,OACA,YACG;CACH,MAAM,QAAQ,mBACZ,IAAI,SAA8B,SAAS,EAC3C,OAAO,SAAS,GAAG,CACpB;AACD,WAAU,EAAE,aAAa,OAAO,CAAC;AACjC,QAAO,QAAQ;;AAGjB,MAAa,qBAA6D,MAAM,MAAM,aAAa;AAGjG,SAFU,KAAK,kBAAkB,WAAW,eAAe,MACjD,KAAK,kBAAkB,WAAW,eAAe"}
1
+ {"version":3,"file":"catalog-helpers.mjs","names":[],"sources":["../../src/utils/catalog-helpers.tsx"],"sourcesContent":["import { type CatalogSearchTarget, scoreCatalogSearch } from \"@pipe0/base\";\nimport { type RankingInfo, rankItem } from \"@tanstack/match-sorter-utils\";\nimport type { FilterFn, RowData, SortFn, TableFeatures } from \"@tanstack/react-table\";\n\nexport { getFieldFormatIcon, getFieldStatusIcon, getFieldTypeIcon } from \"./field-icons.js\";\n\n/** Filter meta the catalog filter fns attach to rows, read back by the sort fns. */\nexport interface CatalogFilterMeta {\n itemRank?: RankingInfo;\n searchScore?: number;\n}\n\n// Docs idiom (fuzzy-filtering guide): a features type that only carries the\n// meta shape, so these fns are not coupled to one exact features object.\nexport type CatalogSearchFeatures = TableFeatures & { filterMeta: CatalogFilterMeta };\n\nexport const fuzzyFilter: FilterFn<CatalogSearchFeatures, RowData> = (\n row,\n columnId,\n value,\n addMeta,\n) => {\n const itemRank = rankItem(row.getValue(columnId), value);\n addMeta?.({ itemRank });\n return itemRank.passed;\n};\n\n// Global-filter fn for the catalog tables' hidden \"search\" column (its value\n// is a precomputed CatalogSearchTarget). Stashes the score so\n// catalogSearchSort can order rows by relevance while a query is active.\nexport const catalogSearchFilter: FilterFn<CatalogSearchFeatures, RowData> = (\n row,\n columnId,\n value,\n addMeta,\n) => {\n const score = scoreCatalogSearch(\n row.getValue<CatalogSearchTarget>(columnId),\n String(value ?? \"\"),\n );\n addMeta?.({ searchScore: score });\n return score > 0;\n};\n\nexport const catalogSearchSort: SortFn<CatalogSearchFeatures, RowData> = (rowA, rowB, columnId) => {\n const a = rowA.columnFiltersMeta[columnId]?.searchScore ?? 0;\n const b = rowB.columnFiltersMeta[columnId]?.searchScore ?? 0;\n return a - b; // paired with `desc: true` → highest score first\n};\n"],"mappings":";;;;;AAgBA,MAAa,eACX,KACA,UACA,OACA,YACG;CACH,MAAM,WAAW,SAAS,IAAI,SAAS,SAAS,EAAE,MAAM;AACxD,WAAU,EAAE,UAAU,CAAC;AACvB,QAAO,SAAS;;AAMlB,MAAa,uBACX,KACA,UACA,OACA,YACG;CACH,MAAM,QAAQ,mBACZ,IAAI,SAA8B,SAAS,EAC3C,OAAO,SAAS,GAAG,CACpB;AACD,WAAU,EAAE,aAAa,OAAO,CAAC;AACjC,QAAO,QAAQ;;AAGjB,MAAa,qBAA6D,MAAM,MAAM,aAAa;AAGjG,SAFU,KAAK,kBAAkB,WAAW,eAAe,MACjD,KAAK,kBAAkB,WAAW,eAAe"}
@@ -0,0 +1,15 @@
1
+ import { Icon } from "../components/internal/icons.mjs";
2
+ import { ComponentType } from "react";
3
+ import { RecordFieldFormat, RecordFieldStatus, RecordFieldType } from "@pipe0/base";
4
+
5
+ //#region src/utils/field-icons.d.ts
6
+ declare function getFieldTypeIcon(fieldType: RecordFieldType): Icon;
7
+ /**
8
+ * Column icon: the format is the expressive signal (an email column looks
9
+ * different from a date column), the type is the fallback for untyped fields.
10
+ */
11
+ declare function getFieldFormatIcon(format: RecordFieldFormat, fieldType: RecordFieldType): ComponentType | Icon;
12
+ declare function getFieldStatusIcon(fieldStatus: RecordFieldStatus): Icon;
13
+ //#endregion
14
+ export { getFieldFormatIcon, getFieldStatusIcon, getFieldTypeIcon };
15
+ //# sourceMappingURL=field-icons.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-icons.d.mts","names":[],"sources":["../../src/utils/field-icons.tsx"],"mappings":";;;;;iBAiDgB,gBAAA,CAAiB,SAAA,EAAW,eAAA,GAAe,IAAA;;;AAA3D;;iBA+BgB,kBAAA,CAAmB,MAAA,EAAQ,iBAAA,EAAmB,SAAA,EAAW,eAAA,GAAe,aAAA,GAAA,IAAA;AAAA,iBAIxE,kBAAA,CAAmB,WAAA,EAAa,iBAAA,GAAiB,IAAA"}
@@ -0,0 +1,58 @@
1
+ import { AtSign, BookDashed, Bookmark, Braces, Calendar, CalendarClock, CheckCheck, Coins, Contact, Hash, HelpCircle, Internet, Loader, MapPin, Pause, Percent, Phone, TextAlignStart, ToggleRight, TriangleDashed, Type, X } from "../components/internal/icons.mjs";
2
+
3
+ //#region src/utils/field-icons.tsx
4
+ const fieldStatusIconMap = {
5
+ completed: CheckCheck,
6
+ failed: X,
7
+ no_result: BookDashed,
8
+ pending: Bookmark,
9
+ processing: Loader,
10
+ queued: Pause,
11
+ skipped: TriangleDashed
12
+ };
13
+ const FieldTypeIconMap = {
14
+ boolean: ToggleRight,
15
+ json: Braces,
16
+ number: Hash,
17
+ string: Type,
18
+ unknown: HelpCircle
19
+ };
20
+ function getFieldTypeIcon(fieldType) {
21
+ return FieldTypeIconMap[fieldType];
22
+ }
23
+ const FieldFormatIconMap = {
24
+ email: AtSign,
25
+ url: Internet,
26
+ website_url: Internet,
27
+ domain: Internet,
28
+ profile_url: Contact,
29
+ phone: Phone,
30
+ date: Calendar,
31
+ datetime: CalendarClock,
32
+ address_line_1: MapPin,
33
+ zip_code: Hash,
34
+ currency: Coins,
35
+ percent: Percent,
36
+ markdown: TextAlignStart,
37
+ long_text: TextAlignStart,
38
+ text: Type,
39
+ int: Hash,
40
+ decimal: Hash,
41
+ json_object: Braces,
42
+ json_list: Braces,
43
+ json_list_string: Braces
44
+ };
45
+ /**
46
+ * Column icon: the format is the expressive signal (an email column looks
47
+ * different from a date column), the type is the fallback for untyped fields.
48
+ */
49
+ function getFieldFormatIcon(format, fieldType) {
50
+ return (format ? FieldFormatIconMap[format] : void 0) ?? getFieldTypeIcon(fieldType);
51
+ }
52
+ function getFieldStatusIcon(fieldStatus) {
53
+ return fieldStatusIconMap[fieldStatus];
54
+ }
55
+
56
+ //#endregion
57
+ export { getFieldFormatIcon, getFieldStatusIcon, getFieldTypeIcon };
58
+ //# sourceMappingURL=field-icons.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-icons.mjs","names":[],"sources":["../../src/utils/field-icons.tsx"],"sourcesContent":["import type { RecordFieldFormat, RecordFieldStatus, RecordFieldType } from \"@pipe0/base\";\nimport type { ComponentType } from \"react\";\nimport {\n AtSign,\n BookDashed,\n Bookmark,\n Braces,\n Calendar,\n CalendarClock,\n CheckCheck,\n Coins,\n Contact,\n Hash,\n HelpCircle,\n Internet,\n Loader,\n MapPin,\n Pause,\n Percent,\n Phone,\n TextAlignStart,\n ToggleRight,\n TriangleDashed,\n Type,\n X,\n} from \"../components/internal/icons.js\";\n\n// Type-only imports from @pipe0/base on purpose: the read-only record views\n// (RecordsTable) use these icons, and a value import would pull the whole\n// catalog into bundles that tree-shake @pipe0/react (the MCP Apps view).\n\nconst fieldStatusIconMap = {\n completed: CheckCheck,\n failed: X,\n no_result: BookDashed,\n pending: Bookmark,\n processing: Loader,\n queued: Pause,\n skipped: TriangleDashed,\n} satisfies Record<RecordFieldStatus, ComponentType>;\n\nconst FieldTypeIconMap = {\n boolean: ToggleRight,\n json: Braces,\n number: Hash,\n string: Type,\n unknown: HelpCircle,\n} satisfies Record<RecordFieldType, ComponentType>;\n\nexport function getFieldTypeIcon(fieldType: RecordFieldType) {\n return FieldTypeIconMap[fieldType];\n}\n\nconst FieldFormatIconMap: Partial<Record<NonNullable<RecordFieldFormat>, ComponentType>> = {\n email: AtSign,\n url: Internet,\n website_url: Internet,\n domain: Internet,\n profile_url: Contact,\n phone: Phone,\n date: Calendar,\n datetime: CalendarClock,\n address_line_1: MapPin,\n zip_code: Hash,\n currency: Coins,\n percent: Percent,\n markdown: TextAlignStart,\n long_text: TextAlignStart,\n text: Type,\n int: Hash,\n decimal: Hash,\n json_object: Braces,\n json_list: Braces,\n json_list_string: Braces,\n};\n\n/**\n * Column icon: the format is the expressive signal (an email column looks\n * different from a date column), the type is the fallback for untyped fields.\n */\nexport function getFieldFormatIcon(format: RecordFieldFormat, fieldType: RecordFieldType) {\n return (format ? FieldFormatIconMap[format] : undefined) ?? getFieldTypeIcon(fieldType);\n}\n\nexport function getFieldStatusIcon(fieldStatus: RecordFieldStatus) {\n return fieldStatusIconMap[fieldStatus];\n}\n"],"mappings":";;;AA+BA,MAAM,qBAAqB;CACzB,WAAW;CACX,QAAQ;CACR,WAAW;CACX,SAAS;CACT,YAAY;CACZ,QAAQ;CACR,SAAS;CACV;AAED,MAAM,mBAAmB;CACvB,SAAS;CACT,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,SAAS;CACV;AAED,SAAgB,iBAAiB,WAA4B;AAC3D,QAAO,iBAAiB;;AAG1B,MAAM,qBAAqF;CACzF,OAAO;CACP,KAAK;CACL,aAAa;CACb,QAAQ;CACR,aAAa;CACb,OAAO;CACP,MAAM;CACN,UAAU;CACV,gBAAgB;CAChB,UAAU;CACV,UAAU;CACV,SAAS;CACT,UAAU;CACV,WAAW;CACX,MAAM;CACN,KAAK;CACL,SAAS;CACT,aAAa;CACb,WAAW;CACX,kBAAkB;CACnB;;;;;AAMD,SAAgB,mBAAmB,QAA2B,WAA4B;AACxF,SAAQ,SAAS,mBAAmB,UAAU,WAAc,iBAAiB,UAAU;;AAGzF,SAAgB,mBAAmB,aAAgC;AACjE,QAAO,mBAAmB"}
@@ -6,7 +6,7 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
6
6
 
7
7
  //#region src/widgets/avatar-group.d.ts
8
8
  declare const avatarGroupVariants: (props?: ({
9
- size?: "base" | "sm" | "lg" | "md" | null | undefined;
9
+ size?: "base" | "sm" | "md" | "lg" | null | undefined;
10
10
  } & _$class_variance_authority_types0.ClassProp) | undefined) => string;
11
11
  interface AvatarGroupState {
12
12
  overflows: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipe0/react",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
4
4
  "description": "React component library for building forms and catalogs powered by pipe0 pipes and searches.",
5
5
  "license": "MIT",
6
6
  "author": "pipe0",
@@ -86,7 +86,7 @@
86
86
  "react-hook-form": "^7.62.0",
87
87
  "swr": "^2.4.1",
88
88
  "tailwind-merge": "^3.3.1",
89
- "@pipe0/base": "1.0.39"
89
+ "@pipe0/base": "1.0.41"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@base-ui/react": "^1.6.0",