@osdk/react-components 0.50.0 → 0.51.0-main-76b378d8caf6626dfae5d847306590fd5efa5358

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 (99) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/build/browser/filter-list/FilterInput.js +11 -1
  3. package/build/browser/filter-list/FilterInput.js.map +1 -1
  4. package/build/browser/filter-list/FilterListApi.js.map +1 -1
  5. package/build/browser/filter-list/FilterListItemApi.js.map +1 -1
  6. package/build/browser/filter-list/hooks/useFilterListState.js +9 -52
  7. package/build/browser/filter-list/hooks/useFilterListState.js.map +1 -1
  8. package/build/browser/filter-list/hooks/usePropertyAggregation.js.map +1 -1
  9. package/build/browser/filter-list/types/CustomRendererTypes.js.map +1 -1
  10. package/build/browser/filter-list/types/KeywordSearchTypes.js.map +1 -1
  11. package/build/browser/filter-list/types/LinkedFilterTypes.js.map +1 -1
  12. package/build/browser/filter-list/types/StaticValuesTypes.js.map +1 -1
  13. package/build/browser/filter-list/utils/getSeedFilterState.js +68 -0
  14. package/build/browser/filter-list/utils/getSeedFilterState.js.map +1 -0
  15. package/build/browser/util/UserAgent.js +1 -1
  16. package/build/browser/util/UserAgent.js.map +1 -1
  17. package/build/cjs/chunk-4NJ2BPYR.cjs +11 -0
  18. package/build/cjs/{chunk-QYPTAETF.cjs.map → chunk-4NJ2BPYR.cjs.map} +1 -1
  19. package/build/cjs/{chunk-IP66AR3O.cjs → chunk-72RYP4YA.cjs} +4 -4
  20. package/build/cjs/{chunk-IP66AR3O.cjs.map → chunk-72RYP4YA.cjs.map} +1 -1
  21. package/build/cjs/chunk-AD7H4JHN.cjs +11 -0
  22. package/build/cjs/{chunk-I3VH56N7.cjs.map → chunk-AD7H4JHN.cjs.map} +1 -1
  23. package/build/cjs/{chunk-HCQFQKBI.cjs → chunk-ADGHRICE.cjs} +4 -4
  24. package/build/cjs/{chunk-HCQFQKBI.cjs.map → chunk-ADGHRICE.cjs.map} +1 -1
  25. package/build/cjs/{chunk-3KYJ76C2.cjs → chunk-BYIYP3UA.cjs} +4 -4
  26. package/build/cjs/{chunk-3KYJ76C2.cjs.map → chunk-BYIYP3UA.cjs.map} +1 -1
  27. package/build/cjs/{chunk-CGTQTLNP.cjs → chunk-CSW4GZCI.cjs} +4 -4
  28. package/build/cjs/{chunk-CGTQTLNP.cjs.map → chunk-CSW4GZCI.cjs.map} +1 -1
  29. package/build/cjs/{chunk-Q25HTQ6S.cjs → chunk-CTMTJTVP.cjs} +4 -4
  30. package/build/cjs/{chunk-Q25HTQ6S.cjs.map → chunk-CTMTJTVP.cjs.map} +1 -1
  31. package/build/cjs/{chunk-WT74OJ7T.cjs → chunk-EHB7DAJQ.cjs} +4 -4
  32. package/build/cjs/{chunk-WT74OJ7T.cjs.map → chunk-EHB7DAJQ.cjs.map} +1 -1
  33. package/build/cjs/{chunk-2GOF2S3Y.cjs → chunk-EOJF232G.cjs} +4 -4
  34. package/build/cjs/{chunk-2GOF2S3Y.cjs.map → chunk-EOJF232G.cjs.map} +1 -1
  35. package/build/cjs/{chunk-QCYEJARX.cjs → chunk-HWYBTMP5.cjs} +4 -4
  36. package/build/cjs/{chunk-QCYEJARX.cjs.map → chunk-HWYBTMP5.cjs.map} +1 -1
  37. package/build/cjs/chunk-IDZNCY56.cjs +11 -0
  38. package/build/cjs/{chunk-4FQZPGVB.cjs.map → chunk-IDZNCY56.cjs.map} +1 -1
  39. package/build/cjs/{chunk-ZX5S74BN.cjs → chunk-NJLF3EI2.cjs} +3 -3
  40. package/build/cjs/chunk-NJLF3EI2.cjs.map +1 -0
  41. package/build/cjs/chunk-PYNUF34U.cjs +11 -0
  42. package/build/cjs/{chunk-TBLSN4KJ.cjs.map → chunk-PYNUF34U.cjs.map} +1 -1
  43. package/build/cjs/{chunk-6CAHX3VA.cjs → chunk-XVSVS27S.cjs} +52 -49
  44. package/build/cjs/chunk-XVSVS27S.cjs.map +1 -0
  45. package/build/cjs/public/experimental/action-form.cjs +4 -4
  46. package/build/cjs/public/experimental/cbac-picker.cjs +11 -11
  47. package/build/cjs/public/experimental/document-viewer.cjs +4 -4
  48. package/build/cjs/public/experimental/email-viewer.cjs +3 -3
  49. package/build/cjs/public/experimental/filter-list.cjs +15 -15
  50. package/build/cjs/public/experimental/filter-list.d.cts +66 -78
  51. package/build/cjs/public/experimental/image-viewer.cjs +3 -3
  52. package/build/cjs/public/experimental/markdown-renderer.cjs +5 -5
  53. package/build/cjs/public/experimental/object-table.cjs +22 -22
  54. package/build/cjs/public/experimental/pdf-viewer.cjs +7 -7
  55. package/build/cjs/public/experimental/spreadsheet-viewer.cjs +3 -3
  56. package/build/cjs/public/experimental/tiff-renderer.cjs +5 -5
  57. package/build/cjs/public/experimental/video-viewer.cjs +3 -3
  58. package/build/cjs/public/experimental/xml-viewer.cjs +3 -3
  59. package/build/cjs/public/experimental.cjs +76 -76
  60. package/build/esm/filter-list/FilterInput.js +11 -1
  61. package/build/esm/filter-list/FilterInput.js.map +1 -1
  62. package/build/esm/filter-list/FilterListApi.js.map +1 -1
  63. package/build/esm/filter-list/FilterListItemApi.js.map +1 -1
  64. package/build/esm/filter-list/hooks/useFilterListState.js +9 -52
  65. package/build/esm/filter-list/hooks/useFilterListState.js.map +1 -1
  66. package/build/esm/filter-list/hooks/usePropertyAggregation.js.map +1 -1
  67. package/build/esm/filter-list/types/CustomRendererTypes.js.map +1 -1
  68. package/build/esm/filter-list/types/KeywordSearchTypes.js.map +1 -1
  69. package/build/esm/filter-list/types/LinkedFilterTypes.js.map +1 -1
  70. package/build/esm/filter-list/types/StaticValuesTypes.js.map +1 -1
  71. package/build/esm/filter-list/utils/getSeedFilterState.js +68 -0
  72. package/build/esm/filter-list/utils/getSeedFilterState.js.map +1 -0
  73. package/build/esm/util/UserAgent.js +1 -1
  74. package/build/esm/util/UserAgent.js.map +1 -1
  75. package/build/types/filter-list/FilterInput.d.ts.map +1 -1
  76. package/build/types/filter-list/FilterListApi.d.ts +11 -3
  77. package/build/types/filter-list/FilterListApi.d.ts.map +1 -1
  78. package/build/types/filter-list/FilterListItemApi.d.ts +26 -15
  79. package/build/types/filter-list/FilterListItemApi.d.ts.map +1 -1
  80. package/build/types/filter-list/hooks/useFilterListState.d.ts.map +1 -1
  81. package/build/types/filter-list/hooks/usePropertyAggregation.d.ts +1 -1
  82. package/build/types/filter-list/types/CustomRendererTypes.d.ts +9 -12
  83. package/build/types/filter-list/types/CustomRendererTypes.d.ts.map +1 -1
  84. package/build/types/filter-list/types/KeywordSearchTypes.d.ts +5 -16
  85. package/build/types/filter-list/types/KeywordSearchTypes.d.ts.map +1 -1
  86. package/build/types/filter-list/types/LinkedFilterTypes.d.ts +7 -19
  87. package/build/types/filter-list/types/LinkedFilterTypes.d.ts.map +1 -1
  88. package/build/types/filter-list/types/StaticValuesTypes.d.ts +8 -13
  89. package/build/types/filter-list/types/StaticValuesTypes.d.ts.map +1 -1
  90. package/build/types/filter-list/utils/getSeedFilterState.d.ts +15 -0
  91. package/build/types/filter-list/utils/getSeedFilterState.d.ts.map +1 -0
  92. package/docs/FilterList.md +88 -92
  93. package/package.json +4 -4
  94. package/build/cjs/chunk-4FQZPGVB.cjs +0 -11
  95. package/build/cjs/chunk-6CAHX3VA.cjs.map +0 -1
  96. package/build/cjs/chunk-I3VH56N7.cjs +0 -11
  97. package/build/cjs/chunk-QYPTAETF.cjs +0 -11
  98. package/build/cjs/chunk-TBLSN4KJ.cjs +0 -11
  99. package/build/cjs/chunk-ZX5S74BN.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @osdk/react-components
2
2
 
3
+ ## 0.51.0-main-76b378d8caf6626dfae5d847306590fd5efa5358
4
+
5
+ ### Minor Changes
6
+
7
+ - 76b378d: FilterList: filter definitions now seed from one optional `defaultFilterState`, matching the `default<Feature>` convention the rest of the library uses for an uncontrolled seed, and the `initialFilterStates` prop is now `defaultFilterStates`.
8
+
9
+ `id` and `isVisible` moved onto the shared `FilterDefinitionControls` mix-in. They were already declared on most kinds individually; every kind now accepts both.
10
+
11
+ Nothing is removed. Every old field is optional and `@deprecated`, and still honoured as a fallback.
12
+
13
+ To migrate:
14
+ - `PROPERTY`, `STATIC_VALUES`: rename `filterState` to `defaultFilterState`. The seed is now optional, so a `filterState` that only held an empty state (`{ type: "EXACT_MATCH", values: [] }` and friends) can be deleted instead — the filter starts empty either way.
15
+ - Top level: rename `initialFilterStates` to `defaultFilterStates`.
16
+ - Delete rather than rename `filterState` on `HAS_LINK` and `KEYWORD_SEARCH`. It has no effect, so renaming it would silently activate filters that were never active.
17
+ - `CUSTOM`: rename `filterState` to `defaultFilterState` to start filtering the object set.
18
+
3
19
  ## 0.50.0
4
20
 
5
21
  ### Minor Changes
@@ -21,6 +21,14 @@ import { ToggleInput } from "./base/inputs/ToggleInput.js";
21
21
  import { LinkedPropertyInput } from "./inputs/LinkedPropertyInput.js";
22
22
  import { PropertyFilterInput } from "./inputs/PropertyFilterInput.js";
23
23
  import { StaticValuesFilterInput } from "./inputs/StaticValuesFilterInput.js";
24
+ /**
25
+ * Handed to a custom filter's `renderInput` when the definition seeds no state
26
+ * at all, so renderers can rely on always receiving a state object.
27
+ */
28
+ const EMPTY_CUSTOM_STATE = {
29
+ type: "custom",
30
+ customState: {}
31
+ };
24
32
  function FilterInputInner({
25
33
  objectType,
26
34
  objectSet,
@@ -72,7 +80,9 @@ function FilterInputInner({
72
80
  "data-unsupported": "true"
73
81
  }, "Custom filter missing renderInput");
74
82
  }
75
- const customFilterState = filterState?.type === "custom" ? filterState : definition.filterState;
83
+ const customFilterState = filterState?.type === "custom" ? filterState :
84
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- pre-rename fallback
85
+ definition.filterState ?? EMPTY_CUSTOM_STATE;
76
86
  return /*#__PURE__*/React.createElement(React.Fragment, null, definition.renderInput({
77
87
  objectType,
78
88
  objectSet,
@@ -1 +1 @@
1
- {"version":3,"file":"FilterInput.js","names":["React","memo","useCallback","FilterInputExcludeRow","ContainsTextInput","ToggleInput","LinkedPropertyInput","PropertyFilterInput","StaticValuesFilterInput","FilterInputInner","objectType","objectSet","definition","filterState","onFilterStateChanged","whereClause","linkedFilters","showFilteredOutValues","searchQuery","excludeRowOpen","layout","type","createElement","HasLinkInput","Fragment","KeywordSearchInput","placeholder","label","renderInput","customFilterState","state","FilterInput","hasLink","isExcluding","handleChange","handleClearAll","onClearAll","enabled","onChange","searchTerm","undefined","operator","newSearchTerm","value"],"sources":["FilterInput.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectSet, ObjectTypeDefinition, WhereClause } from \"@osdk/api\";\nimport React, { memo, useCallback } from \"react\";\n\nimport { FilterInputExcludeRow } from \"./base/FilterInputExcludeRow.js\";\nimport { ContainsTextInput } from \"./base/inputs/ContainsTextInput.js\";\nimport type { MultiSelectInputLayout } from \"./base/inputs/MultiSelectInput.js\";\nimport { ToggleInput } from \"./base/inputs/ToggleInput.js\";\nimport type { FilterDefinitionUnion } from \"./FilterListApi.js\";\nimport type { FilterState } from \"./FilterListItemApi.js\";\nimport { LinkedPropertyInput } from \"./inputs/LinkedPropertyInput.js\";\nimport { PropertyFilterInput } from \"./inputs/PropertyFilterInput.js\";\nimport { StaticValuesFilterInput } from \"./inputs/StaticValuesFilterInput.js\";\nimport type { LinkedFilter } from \"./types/LinkedFilterTypes.js\";\n\nexport interface FilterInputProps<Q extends ObjectTypeDefinition> {\n objectType: Q;\n objectSet?: ObjectSet<Q>;\n definition: FilterDefinitionUnion<Q>;\n filterState: FilterState | undefined;\n onFilterStateChanged: (state: FilterState) => void;\n /** Per-filter excluding-self where clause (direct filters only). */\n whereClause: WhereClause<Q>;\n /** Per-filter excluding-self linked-filter records. */\n linkedFilters?: ReadonlyArray<LinkedFilter<Q>>;\n showFilteredOutValues?: boolean;\n searchQuery?: string;\n excludeRowOpen?: boolean;\n /**\n * Layout for `MULTI_SELECT` filter components. Pass `\"inline\"` when this\n * input renders inside a popover (or any container where chips would feel\n * redundant) so the value list is always visible. Defaults to `\"dropdown\"`,\n * which renders chips + a portaled Combobox popup. Ignored by other\n * filter components.\n */\n layout?: MultiSelectInputLayout;\n}\n\nfunction FilterInputInner<Q extends ObjectTypeDefinition>({\n objectType,\n objectSet,\n definition,\n filterState,\n onFilterStateChanged,\n whereClause,\n linkedFilters,\n showFilteredOutValues,\n searchQuery,\n excludeRowOpen,\n layout,\n}: FilterInputProps<Q>): React.ReactElement {\n switch (definition.type) {\n case \"HAS_LINK\":\n return (\n <HasLinkInput\n filterState={filterState}\n onFilterStateChanged={onFilterStateChanged}\n excludeRowOpen={excludeRowOpen}\n />\n );\n\n case \"LINKED_PROPERTY\": {\n if (objectSet == null) {\n return <></>;\n }\n return (\n <LinkedPropertyInput\n objectSet={objectSet}\n definition={definition}\n filterState={filterState}\n onFilterStateChanged={onFilterStateChanged}\n whereClause={whereClause}\n linkedFilters={linkedFilters}\n showFilteredOutValues={showFilteredOutValues}\n searchQuery={searchQuery}\n excludeRowOpen={excludeRowOpen}\n layout={layout}\n />\n );\n }\n\n case \"KEYWORD_SEARCH\":\n return (\n <KeywordSearchInput\n filterState={filterState}\n onFilterStateChanged={onFilterStateChanged}\n placeholder={definition.label ?? \"Search...\"}\n />\n );\n\n case \"CUSTOM\": {\n if (!definition.renderInput) {\n return (\n <div data-unsupported=\"true\">Custom filter missing renderInput</div>\n );\n }\n const customFilterState =\n filterState?.type === \"custom\" ? filterState : definition.filterState;\n return (\n <>\n {definition.renderInput({\n objectType,\n objectSet,\n filterState: customFilterState,\n onFilterStateChanged: (state) => onFilterStateChanged(state),\n })}\n </>\n );\n }\n\n case \"PROPERTY\":\n return (\n <PropertyFilterInput\n objectType={objectType}\n objectSet={objectSet}\n definition={definition}\n filterState={filterState}\n onFilterStateChanged={onFilterStateChanged}\n whereClause={whereClause}\n linkedFilters={linkedFilters}\n showFilteredOutValues={showFilteredOutValues}\n searchQuery={searchQuery}\n excludeRowOpen={excludeRowOpen}\n layout={layout}\n />\n );\n\n case \"STATIC_VALUES\":\n return (\n <StaticValuesFilterInput\n definition={definition}\n filterState={filterState}\n onFilterStateChanged={onFilterStateChanged}\n searchQuery={searchQuery}\n excludeRowOpen={excludeRowOpen}\n layout={layout}\n />\n );\n\n default:\n return <div data-unsupported=\"true\">Unsupported filter type</div>;\n }\n}\n\nexport const FilterInput = memo(FilterInputInner) as typeof FilterInputInner;\n\ninterface HasLinkInputProps {\n filterState: FilterState | undefined;\n onFilterStateChanged: (state: FilterState) => void;\n excludeRowOpen?: boolean;\n}\n\nconst HasLinkInput = memo(function HasLinkInput({\n filterState,\n onFilterStateChanged,\n excludeRowOpen,\n}: HasLinkInputProps): React.ReactElement {\n const hasLink = filterState?.type === \"hasLink\" ? filterState.hasLink : false;\n const isExcluding =\n filterState?.type === \"hasLink\"\n ? (filterState.isExcluding ?? false)\n : false;\n\n const handleChange = useCallback(\n (hasLink: boolean) => {\n onFilterStateChanged({ type: \"hasLink\", hasLink, isExcluding });\n },\n [onFilterStateChanged, isExcluding],\n );\n\n const handleClearAll = useCallback(() => {\n onFilterStateChanged({ type: \"hasLink\", hasLink: false, isExcluding });\n }, [onFilterStateChanged, isExcluding]);\n\n return (\n <FilterInputExcludeRow\n excludeRowOpen={excludeRowOpen}\n filterState={filterState}\n onFilterStateChanged={onFilterStateChanged}\n onClearAll={handleClearAll}\n >\n <ToggleInput enabled={hasLink} onChange={handleChange} />\n </FilterInputExcludeRow>\n );\n});\n\ninterface KeywordSearchInputProps {\n filterState: FilterState | undefined;\n onFilterStateChanged: (state: FilterState) => void;\n placeholder: string;\n}\n\nconst KeywordSearchInput = memo(function KeywordSearchInput({\n filterState,\n onFilterStateChanged,\n placeholder,\n}: KeywordSearchInputProps): React.ReactElement {\n const searchTerm =\n filterState?.type === \"keywordSearch\" ? filterState.searchTerm : undefined;\n const operator =\n filterState?.type === \"keywordSearch\" ? filterState.operator : \"AND\";\n\n const handleChange = useCallback(\n (newSearchTerm: string | undefined) => {\n onFilterStateChanged({\n type: \"keywordSearch\",\n searchTerm: newSearchTerm ?? \"\",\n operator,\n });\n },\n [onFilterStateChanged, operator],\n );\n\n return (\n <ContainsTextInput\n value={searchTerm}\n onChange={handleChange}\n placeholder={placeholder}\n />\n );\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,KAAK,IAAIC,IAAI,EAAEC,WAAW,QAAQ,OAAO;AAEhD,SAASC,qBAAqB,QAAQ,iCAAiC;AACvE,SAASC,iBAAiB,QAAQ,oCAAoC;AAEtE,SAASC,WAAW,QAAQ,8BAA8B;AAG1D,SAASC,mBAAmB,QAAQ,iCAAiC;AACrE,SAASC,mBAAmB,QAAQ,iCAAiC;AACrE,SAASC,uBAAuB,QAAQ,qCAAqC;AA0B7E,SAASC,gBAAgBA,CAAiC;EACxDC,UAAU;EACVC,SAAS;EACTC,UAAU;EACVC,WAAW;EACXC,oBAAoB;EACpBC,WAAW;EACXC,aAAa;EACbC,qBAAqB;EACrBC,WAAW;EACXC,cAAc;EACdC;AACmB,CAAC,EAAsB;EAC1C,QAAQR,UAAU,CAACS,IAAI;IACrB,KAAK,UAAU;MACb,oBACErB,KAAA,CAAAsB,aAAA,CAACC,YAAY;QACXV,WAAW,EAAEA,WAAY;QACzBC,oBAAoB,EAAEA,oBAAqB;QAC3CK,cAAc,EAAEA;MAAe,CAChC,CAAC;IAGN,KAAK,iBAAiB;MAAE;QACtB,IAAIR,SAAS,IAAI,IAAI,EAAE;U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","ContainsTextInput","ToggleInput","LinkedPropertyInput","PropertyFilterInput","StaticValuesFilterInput","EMPTY_CUSTOM_STATE","type","customState","FilterInputInner","objectType","objectSet","definition","filterState","onFilterStateChanged","whereClause","linkedFilters","showFilteredOutValues","searchQuery","excludeRowOpen","layout","createElement","HasLinkInput","Fragment","KeywordSearchInput","placeholder","label","renderInput","customFilterState","state","FilterInput","hasLink","isExcluding","handleChange","handleClearAll","onClearAll","enabled","onChange","searchTerm","undefined","operator","newSearchTerm","value"],"sources":["FilterInput.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectSet, ObjectTypeDefinition, WhereClause } from \"@osdk/api\";\nimport React, { memo, useCallback } from \"react\";\n\nimport { FilterInputExcludeRow } from \"./base/FilterInputExcludeRow.js\";\nimport { ContainsTextInput } from \"./base/inputs/ContainsTextInput.js\";\nimport type { MultiSelectInputLayout } from \"./base/inputs/MultiSelectInput.js\";\nimport { ToggleInput } from \"./base/inputs/ToggleInput.js\";\nimport type { FilterDefinitionUnion } from \"./FilterListApi.js\";\nimport type { FilterState } from \"./FilterListItemApi.js\";\nimport { LinkedPropertyInput } from \"./inputs/LinkedPropertyInput.js\";\nimport { PropertyFilterInput } from \"./inputs/PropertyFilterInput.js\";\nimport { StaticValuesFilterInput } from \"./inputs/StaticValuesFilterInput.js\";\nimport type { CustomFilterState } from \"./types/CustomRendererTypes.js\";\nimport type { LinkedFilter } from \"./types/LinkedFilterTypes.js\";\n\n/**\n * Handed to a custom filter's `renderInput` when the definition seeds no state\n * at all, so renderers can rely on always receiving a state object.\n */\nconst EMPTY_CUSTOM_STATE: CustomFilterState = {\n type: \"custom\",\n customState: {},\n};\n\nexport interface FilterInputProps<Q extends ObjectTypeDefinition> {\n objectType: Q;\n objectSet?: ObjectSet<Q>;\n definition: FilterDefinitionUnion<Q>;\n filterState: FilterState | undefined;\n onFilterStateChanged: (state: FilterState) => void;\n /** Per-filter excluding-self where clause (direct filters only). */\n whereClause: WhereClause<Q>;\n /** Per-filter excluding-self linked-filter records. */\n linkedFilters?: ReadonlyArray<LinkedFilter<Q>>;\n showFilteredOutValues?: boolean;\n searchQuery?: string;\n excludeRowOpen?: boolean;\n /**\n * Layout for `MULTI_SELECT` filter components. Pass `\"inline\"` when this\n * input renders inside a popover (or any container where chips would feel\n * redundant) so the value list is always visible. Defaults to `\"dropdown\"`,\n * which renders chips + a portaled Combobox popup. Ignored by other\n * filter components.\n */\n layout?: MultiSelectInputLayout;\n}\n\nfunction FilterInputInner<Q extends ObjectTypeDefinition>({\n objectType,\n objectSet,\n definition,\n filterState,\n onFilterStateChanged,\n whereClause,\n linkedFilters,\n showFilteredOutValues,\n searchQuery,\n excludeRowOpen,\n layout,\n}: FilterInputProps<Q>): React.ReactElement {\n switch (definition.type) {\n case \"HAS_LINK\":\n return (\n <HasLinkInput\n filterState={filterState}\n onFilterStateChanged={onFilterStateChanged}\n excludeRowOpen={excludeRowOpen}\n />\n );\n\n case \"LINKED_PROPERTY\": {\n if (objectSet == null) {\n return <></>;\n }\n return (\n <LinkedPropertyInput\n objectSet={objectSet}\n definition={definition}\n filterState={filterState}\n onFilterStateChanged={onFilterStateChanged}\n whereClause={whereClause}\n linkedFilters={linkedFilters}\n showFilteredOutValues={showFilteredOutValues}\n searchQuery={searchQuery}\n excludeRowOpen={excludeRowOpen}\n layout={layout}\n />\n );\n }\n\n case \"KEYWORD_SEARCH\":\n return (\n <KeywordSearchInput\n filterState={filterState}\n onFilterStateChanged={onFilterStateChanged}\n placeholder={definition.label ?? \"Search...\"}\n />\n );\n\n case \"CUSTOM\": {\n if (!definition.renderInput) {\n return (\n <div data-unsupported=\"true\">Custom filter missing renderInput</div>\n );\n }\n const customFilterState =\n filterState?.type === \"custom\"\n ? filterState\n : // eslint-disable-next-line @typescript-eslint/no-deprecated -- pre-rename fallback\n (definition.filterState ?? EMPTY_CUSTOM_STATE);\n return (\n <>\n {definition.renderInput({\n objectType,\n objectSet,\n filterState: customFilterState,\n onFilterStateChanged: (state) => onFilterStateChanged(state),\n })}\n </>\n );\n }\n\n case \"PROPERTY\":\n return (\n <PropertyFilterInput\n objectType={objectType}\n objectSet={objectSet}\n definition={definition}\n filterState={filterState}\n onFilterStateChanged={onFilterStateChanged}\n whereClause={whereClause}\n linkedFilters={linkedFilters}\n showFilteredOutValues={showFilteredOutValues}\n searchQuery={searchQuery}\n excludeRowOpen={excludeRowOpen}\n layout={layout}\n />\n );\n\n case \"STATIC_VALUES\":\n return (\n <StaticValuesFilterInput\n definition={definition}\n filterState={filterState}\n onFilterStateChanged={onFilterStateChanged}\n searchQuery={searchQuery}\n excludeRowOpen={excludeRowOpen}\n layout={layout}\n />\n );\n\n default:\n return <div data-unsupported=\"true\">Unsupported filter type</div>;\n }\n}\n\nexport const FilterInput = memo(FilterInputInner) as typeof FilterInputInner;\n\ninterface HasLinkInputProps {\n filterState: FilterState | undefined;\n onFilterStateChanged: (state: FilterState) => void;\n excludeRowOpen?: boolean;\n}\n\nconst HasLinkInput = memo(function HasLinkInput({\n filterState,\n onFilterStateChanged,\n excludeRowOpen,\n}: HasLinkInputProps): React.ReactElement {\n const hasLink = filterState?.type === \"hasLink\" ? filterState.hasLink : false;\n const isExcluding =\n filterState?.type === \"hasLink\"\n ? (filterState.isExcluding ?? false)\n : false;\n\n const handleChange = useCallback(\n (hasLink: boolean) => {\n onFilterStateChanged({ type: \"hasLink\", hasLink, isExcluding });\n },\n [onFilterStateChanged, isExcluding],\n );\n\n const handleClearAll = useCallback(() => {\n onFilterStateChanged({ type: \"hasLink\", hasLink: false, isExcluding });\n }, [onFilterStateChanged, isExcluding]);\n\n return (\n <FilterInputExcludeRow\n excludeRowOpen={excludeRowOpen}\n filterState={filterState}\n onFilterStateChanged={onFilterStateChanged}\n onClearAll={handleClearAll}\n >\n <ToggleInput enabled={hasLink} onChange={handleChange} />\n </FilterInputExcludeRow>\n );\n});\n\ninterface KeywordSearchInputProps {\n filterState: FilterState | undefined;\n onFilterStateChanged: (state: FilterState) => void;\n placeholder: string;\n}\n\nconst KeywordSearchInput = memo(function KeywordSearchInput({\n filterState,\n onFilterStateChanged,\n placeholder,\n}: KeywordSearchInputProps): React.ReactElement {\n const searchTerm =\n filterState?.type === \"keywordSearch\" ? filterState.searchTerm : undefined;\n const operator =\n filterState?.type === \"keywordSearch\" ? filterState.operator : \"AND\";\n\n const handleChange = useCallback(\n (newSearchTerm: string | undefined) => {\n onFilterStateChanged({\n type: \"keywordSearch\",\n searchTerm: newSearchTerm ?? \"\",\n operator,\n });\n },\n [onFilterStateChanged, operator],\n );\n\n return (\n <ContainsTextInput\n value={searchTerm}\n onChange={handleChange}\n placeholder={placeholder}\n />\n );\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,KAAK,IAAIC,IAAI,EAAEC,WAAW,QAAQ,OAAO;AAEhD,SAASC,qBAAqB,QAAQ,iCAAiC;AACvE,SAASC,iBAAiB,QAAQ,oCAAoC;AAEtE,SAASC,WAAW,QAAQ,8BAA8B;AAG1D,SAASC,mBAAmB,QAAQ,iCAAiC;AACrE,SAASC,mBAAmB,QAAQ,iCAAiC;AACrE,SAASC,uBAAuB,QAAQ,qCAAqC;AAI7E;AACA;AACA;AACA;AACA,MAAMC,kBAAqC,GAAG;EAC5CC,IAAI,EAAE,QAAQ;EACdC,WAAW,EAAE,CAAC;AAChB,CAAC;AAyBD,SAASC,gBAAgBA,CAAiC;EACxDC,UAAU;EACVC,SAAS;EACTC,UAA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ACnBP,IAAI,EAAE,eAAe;MACrB+B,UAAU,EAAEG,aAAa,IAAI,EAAE;MAC/BD;IACF,CAAC,CAAC;EACJ,CAAC,EACD,CAAC1B,oBAAoB,EAAE0B,QAAQ,CACjC,CAAC;EAED,oBACE3C,KAAA,CAAAwB,aAAA,CAACpB,iBAAiB;IAChByC,KAAK,EAAEJ,UAAW;IAClBD,QAAQ,EAAEJ,YAAa;IACvBR,WAAW,EAAEA;EAAY,CAC1B,CAAC;AAEN,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"FilterListApi.js","names":[],"sources":["FilterListApi.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n LinkNames,\n ObjectSet,\n ObjectTypeDefinition,\n WhereClause,\n} from \"@osdk/api\";\nimport type React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport type {\n FilterState,\n PropertyFilterDefinition,\n} from \"./FilterListItemApi.js\";\nimport type { CustomFilterDefinition } from \"./types/CustomRendererTypes.js\";\nimport type { KeywordSearchFilterDefinition } from \"./types/KeywordSearchTypes.js\";\nimport type {\n HasLinkFilterDefinition,\n LinkedPropertyFilterDefinition,\n} from \"./types/LinkedFilterTypes.js\";\nimport type { StaticValuesFilterDefinition } from \"./types/StaticValuesTypes.js\";\n\n/**\n * Distributes LinkedPropertyFilterDefinition over each link name individually,\n * so that LinkedQ/LinkedK/LinkedC defaults resolve correctly per link.\n */\ntype DistributeLinkedProperty<\n Q extends ObjectTypeDefinition,\n L extends LinkNames<Q>,\n> = L extends LinkNames<Q> ? LinkedPropertyFilterDefinition<Q, L> : never;\n\n/**\n * Union type of all filter definition types\n */\nexport type FilterDefinitionUnion<Q extends ObjectTypeDefinition> =\n | PropertyFilterDefinition<Q>\n | HasLinkFilterDefinition<Q>\n | DistributeLinkedProperty<Q, LinkNames<Q>>\n | KeywordSearchFilterDefinition<Q>\n | CustomFilterDefinition<Q>\n | StaticValuesFilterDefinition<Q>;\n\n/**\n * Extract the key from a filter definition union\n */\ntype ExtractFilterKey<D> = D extends { key: infer K }\n ? K\n : D extends { linkName: infer L }\n ? L\n : never;\n\nexport type FilterKey<Q extends ObjectTypeDefinition> = ExtractFilterKey<\n FilterDefinitionUnion<Q>\n>;\n\nexport interface FilterListProps<Q extends ObjectTypeDefinition> {\n /**\n * The object type definition for the objects being filtered.\n * Used for metadata resolution (property types, display names).\n */\n objectType: Q;\n\n /**\n * Optional object set to scope aggregation queries. When omitted,\n * aggregations run against the full object type.\n */\n objectSet?: ObjectSet<Q>;\n\n /**\n * Called whenever the filter clause changes. FilterList owns filter state;\n * this is how you read it out, e.g. to feed an `ObjectTable`'s `filter`.\n *\n * `LINKED_PROPERTY` filters are not represented in the clause — use\n * `onEffectiveObjectSet` for those.\n *\n * @param newClause The updated filter clause\n */\n onFilterClauseChanged?: (newClause: WhereClause<Q>) => void;\n\n /**\n * Optional title to display in the filter list header\n */\n title?: ReactNode;\n\n /**\n * Optional icon to display next to the title\n */\n titleIcon?: React.ReactNode;\n\n /**\n * The definition for all supported filter items in the list\n * If not supplied, all filterable properties will be available\n */\n filterDefinitions?: Array<FilterDefinitionUnion<Q>>;\n\n /**\n * Called when filter state changes\n *\n * @param definition The filter definition whose state changed\n * @param newState The updated filter state\n */\n onFilterStateChanged?: (\n definition: FilterDefinitionUnion<Q>,\n newState: FilterState,\n ) => void;\n\n /**\n * Called with the narrowed `ObjectSet` whenever filters change. Requires\n * `objectSet` to be set.\n *\n * A linked filter only narrows the set when its definition has\n * `reverseLinkName`. Linked filters without it are skipped here; read their\n * state from `onFilterStateChanged` instead.\n */\n onEffectiveObjectSet?: (objectSet: ObjectSet<Q>) => void;\n\n /**\n * When `true`, facets render greyed-out count=0 rows for values present in\n * the unfiltered data but excluded by other active filters.\n * @default false\n */\n showFilteredOutValues?: boolean;\n\n /**\n * Controls how filter visibility (add/remove) is managed.\n *\n * - `\"uncontrolled\"` (default): FilterList manages visibility internally.\n * An \"Add filter\" popover is rendered for filters with `isVisible: false`,\n * and each visible filter shows a remove button.\n * - `\"controlled\"`: The consumer manages which filters are visible via\n * `filterDefinitions`. Filters with `isVisible: false` are excluded from\n * the rendered list.\n *\n * @default \"uncontrolled\"\n * @deprecated Going away; visibility will always be managed internally.\n * Seed it with `isVisible` on each `filterDefinitions` entry and observe\n * changes with `onFilterVisibilityChange`.\n */\n addFilterMode?: \"controlled\" | \"uncontrolled\";\n\n /**\n * Called after a filter is shown from the built-in \"Add filter\" popover.\n *\n * @param filterKey The key of the added filter\n * @param newDefinitions Deprecated. The `filterDefinitions` you passed in,\n * unchanged — not the post-add state. Use `onFilterVisibilityChange`.\n */\n onFilterAdded?: (\n filterKey: FilterKey<Q>,\n /** @deprecated Use `onFilterVisibilityChange`. */\n newDefinitions: Array<FilterDefinitionUnion<Q>>,\n ) => void;\n\n /**\n * Called after a filter's remove button is clicked, once the filter is\n * hidden and its state cleared.\n *\n * @param filterKey The key of the removed filter\n */\n onFilterRemoved?: (filterKey: FilterKey<Q>) => void;\n\n /**\n * Called when filter visibility or ordering changes, i.e. when filters are\n * reordered, added or removed via the built-in show/remove controls, or\n * reset.\n *\n * Visible filters come first, in display order, followed by the hidden ones.\n * Persist this array and feed it back as the order and `isVisible` of\n * `filterDefinitions` to make reordering survive a remount.\n *\n * @param newStates The filters in current display order with their visibility state\n */\n onFilterVisibilityChange?: (\n newStates: Array<{\n filterKey: FilterKey<Q>;\n isVisible: boolean;\n }>,\n ) => void;\n\n /**\n * Enable drag-and-drop reordering of filters. When `true`, drag handles are\n * rendered and filters can be reordered.\n *\n * Reorder state is managed internally; persist `onFilterVisibilityChange` to\n * track order across remounts.\n *\n * @default false\n */\n enableSorting?: boolean;\n\n /**\n * Whether the collapse/expand control is available. When `false` the panel is\n * always expanded, no collapse control is rendered, and `collapsed` /\n * `defaultCollapsed` are ignored.\n * @default true\n */\n enableCollapse?: boolean;\n\n /**\n * Controlled mode. When supplied, this prop is the source of truth for\n * whether the panel is collapsed and the component keeps no internal state;\n * re-render with a new value in response to `onCollapsedChange`.\n *\n * If both `collapsed` and `defaultCollapsed` are provided, `collapsed` takes\n * precedence. Ignored when `enableCollapse` is `false`.\n */\n collapsed?: boolean;\n\n /**\n * Uncontrolled mode. Seeds the panel's internal collapsed state; the\n * component continues to own the state after mount, so later changes to this\n * prop are ignored.\n *\n * If both `collapsed` and `defaultCollapsed` are provided, `collapsed` takes\n * precedence. Ignored when `enableCollapse` is `false`.\n * @default false\n */\n defaultCollapsed?: boolean;\n\n /**\n * Called whenever the collapsed state changes.\n *\n * @param collapsed The new collapsed state\n */\n onCollapsedChange?: (collapsed: boolean) => void;\n\n /**\n * Initial filter states for hydrating from external storage.\n * These states are merged over definition defaults on mount.\n * Use onFilterStateChanged to persist state changes externally.\n */\n initialFilterStates?: Map<string, FilterState>;\n\n /**\n * Show reset filters button in header\n */\n showResetButton?: boolean;\n\n /**\n * Called when reset button is clicked\n */\n onReset?: () => void;\n\n /**\n * Show count of active filters in header\n */\n showActiveFilterCount?: boolean;\n\n /**\n * Additional CSS class name\n */\n className?: string;\n\n /**\n * Custom render function for the \"Add filter\" button. Customizes the trigger\n * element for the built-in add-filter popover; the popover behavior is\n * handled automatically.\n */\n renderAddFilterButton?: () => React.ReactNode;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"FilterListApi.js","names":[],"sources":["FilterListApi.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n LinkNames,\n ObjectSet,\n ObjectTypeDefinition,\n WhereClause,\n} from \"@osdk/api\";\nimport type React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport type {\n FilterState,\n PropertyFilterDefinition,\n} from \"./FilterListItemApi.js\";\nimport type { CustomFilterDefinition } from \"./types/CustomRendererTypes.js\";\nimport type { KeywordSearchFilterDefinition } from \"./types/KeywordSearchTypes.js\";\nimport type {\n HasLinkFilterDefinition,\n LinkedPropertyFilterDefinition,\n} from \"./types/LinkedFilterTypes.js\";\nimport type { StaticValuesFilterDefinition } from \"./types/StaticValuesTypes.js\";\n\n/**\n * Distributes LinkedPropertyFilterDefinition over each link name individually,\n * so that LinkedQ/LinkedK/LinkedC defaults resolve correctly per link.\n */\ntype DistributeLinkedProperty<\n Q extends ObjectTypeDefinition,\n L extends LinkNames<Q>,\n> = L extends LinkNames<Q> ? LinkedPropertyFilterDefinition<Q, L> : never;\n\n/**\n * Union type of all filter definition types\n */\nexport type FilterDefinitionUnion<Q extends ObjectTypeDefinition> =\n | PropertyFilterDefinition<Q>\n | HasLinkFilterDefinition<Q>\n | DistributeLinkedProperty<Q, LinkNames<Q>>\n | KeywordSearchFilterDefinition<Q>\n | CustomFilterDefinition<Q>\n | StaticValuesFilterDefinition<Q>;\n\n/**\n * Extract the key from a filter definition union\n */\ntype ExtractFilterKey<D> = D extends { key: infer K }\n ? K\n : D extends { linkName: infer L }\n ? L\n : never;\n\nexport type FilterKey<Q extends ObjectTypeDefinition> = ExtractFilterKey<\n FilterDefinitionUnion<Q>\n>;\n\nexport interface FilterListProps<Q extends ObjectTypeDefinition> {\n /**\n * The object type definition for the objects being filtered.\n * Used for metadata resolution (property types, display names).\n */\n objectType: Q;\n\n /**\n * Optional object set to scope aggregation queries. When omitted,\n * aggregations run against the full object type.\n */\n objectSet?: ObjectSet<Q>;\n\n /**\n * Called whenever the filter clause changes. FilterList owns filter state;\n * this is how you read it out, e.g. to feed an `ObjectTable`'s `filter`.\n *\n * `LINKED_PROPERTY` filters are not represented in the clause — use\n * `onEffectiveObjectSet` for those.\n *\n * @param newClause The updated filter clause\n */\n onFilterClauseChanged?: (newClause: WhereClause<Q>) => void;\n\n /**\n * Optional title to display in the filter list header\n */\n title?: ReactNode;\n\n /**\n * Optional icon to display next to the title\n */\n titleIcon?: React.ReactNode;\n\n /**\n * The definition for all supported filter items in the list\n * If not supplied, all filterable properties will be available\n */\n filterDefinitions?: Array<FilterDefinitionUnion<Q>>;\n\n /**\n * Called when filter state changes\n *\n * @param definition The filter definition whose state changed\n * @param newState The updated filter state\n */\n onFilterStateChanged?: (\n definition: FilterDefinitionUnion<Q>,\n newState: FilterState,\n ) => void;\n\n /**\n * Called with the narrowed `ObjectSet` whenever filters change. Requires\n * `objectSet` to be set.\n *\n * A linked filter only narrows the set when its definition has\n * `reverseLinkName`. Linked filters without it are skipped here; read their\n * state from `onFilterStateChanged` instead.\n */\n onEffectiveObjectSet?: (objectSet: ObjectSet<Q>) => void;\n\n /**\n * When `true`, facets render greyed-out count=0 rows for values present in\n * the unfiltered data but excluded by other active filters.\n * @default false\n */\n showFilteredOutValues?: boolean;\n\n /**\n * Controls how filter visibility (add/remove) is managed.\n *\n * - `\"uncontrolled\"` (default): FilterList manages visibility internally.\n * An \"Add filter\" popover is rendered for filters with `isVisible: false`,\n * and each visible filter shows a remove button.\n * - `\"controlled\"`: The consumer manages which filters are visible via\n * `filterDefinitions`. Filters with `isVisible: false` are excluded from\n * the rendered list.\n *\n * @default \"uncontrolled\"\n * @deprecated Going away; visibility will always be managed internally.\n * Seed it with `isVisible` on each `filterDefinitions` entry and observe\n * changes with `onFilterVisibilityChange`.\n */\n addFilterMode?: \"controlled\" | \"uncontrolled\";\n\n /**\n * Called after a filter is shown from the built-in \"Add filter\" popover.\n *\n * @param filterKey The key of the added filter\n * @param newDefinitions Deprecated. The `filterDefinitions` you passed in,\n * unchanged — not the post-add state. Use `onFilterVisibilityChange`.\n */\n onFilterAdded?: (\n filterKey: FilterKey<Q>,\n /** @deprecated Use `onFilterVisibilityChange`. */\n /* eslint-disable-next-line @typescript-eslint/no-deprecated */\n newDefinitions: Array<FilterDefinitionUnion<Q>>,\n ) => void;\n\n /**\n * Called after a filter's remove button is clicked, once the filter is\n * hidden and its state cleared.\n *\n * @param filterKey The key of the removed filter\n */\n onFilterRemoved?: (filterKey: FilterKey<Q>) => void;\n\n /**\n * Called when filter visibility or ordering changes, i.e. when filters are\n * reordered, added or removed via the built-in show/remove controls, or\n * reset.\n *\n * Visible filters come first, in display order, followed by the hidden ones.\n * Persist this array and feed it back as the order and `isVisible` of\n * `filterDefinitions` to make reordering survive a remount.\n *\n * @param newStates The filters in current display order with their visibility state\n */\n onFilterVisibilityChange?: (\n newStates: Array<{\n filterKey: FilterKey<Q>;\n isVisible: boolean;\n }>,\n ) => void;\n\n /**\n * Enable drag-and-drop reordering of filters. When `true`, drag handles are\n * rendered and filters can be reordered.\n *\n * Reorder state is managed internally; persist `onFilterVisibilityChange` to\n * track order across remounts.\n *\n * @default false\n */\n enableSorting?: boolean;\n\n /**\n * Whether the collapse/expand control is available. When `false` the panel is\n * always expanded, no collapse control is rendered, and `collapsed` /\n * `defaultCollapsed` are ignored.\n * @default true\n */\n enableCollapse?: boolean;\n\n /**\n * Controlled mode. When supplied, this prop is the source of truth for\n * whether the panel is collapsed and the component keeps no internal state;\n * re-render with a new value in response to `onCollapsedChange`.\n *\n * If both `collapsed` and `defaultCollapsed` are provided, `collapsed` takes\n * precedence. Ignored when `enableCollapse` is `false`.\n */\n collapsed?: boolean;\n\n /**\n * Uncontrolled mode. Seeds the panel's internal collapsed state; the\n * component continues to own the state after mount, so later changes to this\n * prop are ignored.\n *\n * If both `collapsed` and `defaultCollapsed` are provided, `collapsed` takes\n * precedence. Ignored when `enableCollapse` is `false`.\n * @default false\n */\n defaultCollapsed?: boolean;\n\n /**\n * Called whenever the collapsed state changes.\n *\n * @param collapsed The new collapsed state\n */\n onCollapsedChange?: (collapsed: boolean) => void;\n\n /**\n * Seeds filter states from external storage, keyed by `getFilterKey`.\n * Applied over the per-definition `defaultFilterState` seeds on mount, and\n * FilterList owns the states from then on. Also the state the reset button\n * restores to.\n * Use `onFilterStateChanged` to persist changes back out.\n *\n * @default undefined (filters seed from their definitions alone)\n */\n defaultFilterStates?: Map<string, FilterState>;\n\n /**\n * @deprecated Rename to `defaultFilterStates`.\n */\n initialFilterStates?: Map<string, FilterState>;\n\n /**\n * Show reset filters button in header\n */\n showResetButton?: boolean;\n\n /**\n * Called when reset button is clicked\n */\n onReset?: () => void;\n\n /**\n * Show count of active filters in header\n */\n showActiveFilterCount?: boolean;\n\n /**\n * Additional CSS class name\n */\n className?: string;\n\n /**\n * Custom render function for the \"Add filter\" button. Customizes the trigger\n * element for the built-in add-filter popover; the popover behavior is\n * handled automatically.\n */\n renderAddFilterButton?: () => React.ReactNode;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"FilterListItemApi.js","names":[],"sources":["FilterListItemApi.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n CompileTimeMetadata,\n ObjectTypeDefinition,\n PropertyKeys,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport type { ReactNode } from \"react\";\n\nimport type { CustomFilterState } from \"./types/CustomRendererTypes.js\";\nimport type { KeywordSearchFilterState } from \"./types/KeywordSearchTypes.js\";\nimport type {\n HasLinkFilterState,\n LinkedPropertyFilterState,\n} from \"./types/LinkedFilterTypes.js\";\n\n/**\n * Helper type to extract the property type from an ObjectTypeDefinition given a property key\n */\nexport type PropertyTypeFromKey<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q>,\n> = CompileTimeMetadata<Q>[\"properties\"][K][\"type\"];\n\n/**\n * Common mix-in for filter definitions: opt-out flag for the header search\n * monocle.\n */\nexport interface FilterDefinitionControls {\n /**\n * When `false`, the header monocle (search-values icon) is hidden even for\n * filter components that ordinarily support in-filter search. Useful for\n * `MULTI_SELECT`, which already has its own inline search field.\n *\n * @default true\n */\n searchField?: boolean;\n}\n\n/**\n * All available filter component types\n */\nexport type FilterComponentType =\n | \"LISTOGRAM\"\n | \"DATE_RANGE\"\n | \"NUMBER_RANGE\"\n | \"TEXT_TAGS\"\n | \"CONTAINS_TEXT\"\n | \"SINGLE_SELECT\"\n | \"MULTI_SELECT\"\n | \"SINGLE_DATE\"\n | \"MULTI_DATE\"\n | \"TIMELINE\"\n | \"TOGGLE\";\n\n/**\n * Gets valid component types for a given property type\n */\nexport type ValidComponentsForPropertyType<P extends WirePropertyTypes> =\n P extends \"boolean\"\n ? \"LISTOGRAM\" | \"SINGLE_SELECT\" | \"TOGGLE\"\n : P extends \"string\"\n ?\n | \"LISTOGRAM\"\n | \"TEXT_TAGS\"\n | \"CONTAINS_TEXT\"\n | \"SINGLE_SELECT\"\n | \"MULTI_SELECT\"\n : P extends \"datetime\" | \"timestamp\"\n ? \"DATE_RANGE\" | \"SINGLE_DATE\" | \"MULTI_DATE\" | \"TIMELINE\"\n : P extends\n | \"double\"\n | \"integer\"\n | \"long\"\n | \"float\"\n | \"short\"\n | \"byte\"\n | \"decimal\"\n ? \"NUMBER_RANGE\" | \"SINGLE_SELECT\" | \"MULTI_SELECT\"\n : never;\n\n/**\n * Union of all possible filter states\n */\nexport type FilterState =\n | ExactMatchFilterState<string | boolean>\n | DateRangeFilterState\n | ContainsTextFilterState\n | NumberRangeFilterState\n | SelectFilterState<string | boolean | number>\n | SelectFilterState<Date>\n | TimelineFilterState\n | ToggleFilterState\n | HasLinkFilterState\n | LinkedPropertyFilterState\n | KeywordSearchFilterState\n | CustomFilterState;\n\n/**\n * Maps component types to their corresponding state types\n */\nexport interface FilterStateByComponentType {\n LISTOGRAM: ExactMatchFilterState<string | boolean>;\n DATE_RANGE: DateRangeFilterState;\n TEXT_TAGS: ExactMatchFilterState<string>;\n CONTAINS_TEXT: ContainsTextFilterState;\n NUMBER_RANGE: NumberRangeFilterState;\n SINGLE_SELECT: SelectFilterState<string | boolean | number>;\n MULTI_SELECT: SelectFilterState<string | boolean | number>;\n SINGLE_DATE: SelectFilterState<Date>;\n MULTI_DATE: SelectFilterState<Date>;\n TIMELINE: TimelineFilterState;\n TOGGLE: ToggleFilterState;\n}\n\n/**\n * All filter state discriminator types\n */\nexport type FilterStateType =\n | \"EXACT_MATCH\"\n | \"DATE_RANGE\"\n | \"NUMBER_RANGE\"\n | \"CONTAINS_TEXT\"\n | \"SELECT\"\n | \"TIMELINE\"\n | \"TOGGLE\"\n | \"hasLink\"\n | \"linkedProperty\"\n | \"keywordSearch\"\n | \"custom\";\n\n/**\n * Base interface for all filter states\n * Contains common properties shared across all filter types\n */\nexport interface BaseFilterState {\n /**\n * The type of filter component\n */\n type: FilterStateType;\n\n /**\n * If true, the objects satisfying the filter are excluded\n * @default false\n */\n isExcluding?: boolean;\n\n /**\n * If true, include objects that have no value\n * @default false\n */\n includeNull?: boolean;\n}\n\nexport interface ExactMatchFilterState<\n T = string | boolean,\n> extends BaseFilterState {\n type: \"EXACT_MATCH\";\n values: T[];\n}\n\nexport interface DateRangeFilterState extends BaseFilterState {\n type: \"DATE_RANGE\";\n /**\n * The earliest date the user can select\n */\n minValue?: Date;\n /**\n * The latest date the user can select\n */\n maxValue?: Date;\n}\n\nexport interface ContainsTextFilterState extends BaseFilterState {\n type: \"CONTAINS_TEXT\";\n value?: string;\n}\n\nexport interface NumberRangeFilterState extends BaseFilterState {\n type: \"NUMBER_RANGE\";\n /**\n * Minimum numeric value (inclusive)\n */\n minValue?: number;\n /**\n * Maximum numeric value (inclusive)\n */\n maxValue?: number;\n}\n\n/**\n * Consolidated state type for select-based filters.\n * Used by SINGLE_SELECT, MULTI_SELECT, SINGLE_DATE, and MULTI_DATE.\n */\nexport interface SelectFilterState<\n T = string | boolean | number | Date,\n> extends BaseFilterState {\n type: \"SELECT\";\n selectedValues: T[];\n}\n\nexport interface TimelineFilterState extends BaseFilterState {\n type: \"TIMELINE\";\n startDate?: Date;\n endDate?: Date;\n granularity?: \"day\" | \"week\" | \"month\" | \"quarter\" | \"year\";\n}\n\nexport interface ToggleFilterState extends BaseFilterState {\n type: \"TOGGLE\";\n enabled: boolean;\n}\n\n/**\n * Optional date display formatter. Mixed into `PropertyFilterDefinition`\n * only when the property is `datetime` or `timestamp` — see\n * {@link PropertyFilterDateExtras}.\n *\n * `formatDate` overrides the displayed string everywhere the filter\n * surfaces a date: the shared `DateRangePicker` / `DatePicker` idle text,\n * the date-range histogram tooltip and period subtitle, the multi-date\n * chip text, and timeline labels. The picker's internal value remains\n * ISO `YYYY-MM-DD` so cross-locale viewers see a consistent input format\n * regardless of `formatDate`.\n *\n * Receives a `Date` in local time. If the property is a UTC ISO string and\n * you want a different timezone, do that conversion inside your callback.\n */\nexport interface DateFormattingProps {\n formatDate?: (date: Date) => string;\n}\n\n/**\n * Conditionally adds `formatDate` to a property filter definition only for\n * `datetime` / `timestamp` properties. For other property types this field\n * is typed as `never` so attempting to set it is a TypeScript error.\n */\nexport type PropertyFilterDateExtras<P extends WirePropertyTypes> = P extends\n | \"datetime\"\n | \"timestamp\"\n ? DateFormattingProps\n : { formatDate?: never };\n\ninterface PropertyFilterDefinitionBase<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q> = PropertyKeys<Q>,\n C extends ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>> =\n ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>>,\n> extends FilterDefinitionControls {\n /**\n * Discriminator for filter definition type\n */\n type: \"PROPERTY\";\n\n /**\n * Optional unique identifier for stable keying across filter reorders.\n */\n id?: string;\n\n /**\n * The property key to filter on\n */\n key: K;\n\n /**\n * Display label for the filter\n */\n label?: string;\n\n /**\n * The filter component type to render\n * Must be compatible with the property type derived from the key, see ValidComponentsForPropertyType\n */\n filterComponent: C;\n\n /**\n * The current state of the filter.\n * If provided, the filter is controlled.\n */\n filterState: FilterStateByComponentType[C];\n\n /**\n * Maps filter values to colors for visual differentiation.\n * Used by LISTOGRAM (per-row bar colors).\n */\n colorMap?: Record<string, string>;\n\n /**\n * Configuration for LISTOGRAM display mode.\n * Only applies when filterComponent is \"LISTOGRAM\".\n */\n listogramConfig?: {\n displayMode?: \"full\" | \"count\" | \"minimal\";\n /**\n * Number of items shown before \"View all\" link appears\n * @default 5\n */\n maxVisibleItems?: number;\n };\n\n /**\n * Custom display function for filter values.\n * Replaces the default string display in dropdown items, chips, and listogram rows.\n * When the function returns a string, that string is also used for search matching\n * within filter dropdowns. When it returns a non-string `ReactNode`, search falls\n * back to the raw value.\n */\n renderValue?: (value: string) => ReactNode;\n\n /**\n * Show aggregation counts next to filter option values.\n * Applies to LISTOGRAM, SINGLE_SELECT, and MULTI_SELECT components.\n * @default true for LISTOGRAM and MULTI_SELECT, false for SINGLE_SELECT\n */\n showCount?: boolean;\n\n /**\n * When true, clicking a bar in the histogram replaces the filter range\n * with that bucket's `[min, max]`. Only applies to histogram-rendering\n * filter components (`NUMBER_RANGE` and `DATE_RANGE`); ignored on other\n * component types.\n *\n * Click replaces the current range — clicking a second bar discards the\n * previous selection. Multi-bucket selection / shift+click union is NOT\n * supported in v1.\n *\n * @default false\n */\n clickToFilter?: boolean;\n\n /**\n * Controls whether this filter is rendered.\n * When false, the filter is hidden but its state is preserved.\n * @default true\n */\n isVisible?: boolean;\n}\n\n/**\n * A property filter definition specifies configuration for filtering on a single property\n *\n * The component type C must be compatible with the property type derived from the key.\n * For example, boolean properties can only use LISTOGRAM or SINGLE_SELECT,\n * while string properties can use LISTOGRAM, TEXT_TAGS, CONTAINS_TEXT, SINGLE_SELECT, or MULTI_SELECT.\n *\n * Date and datetime properties may additionally specify `formatDate` — see\n * {@link PropertyFilterDateExtras}.\n */\nexport type PropertyFilterDefinition<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q> = PropertyKeys<Q>,\n C extends ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>> =\n ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>>,\n> = PropertyFilterDefinitionBase<Q, K, C> &\n PropertyFilterDateExtras<PropertyTypeFromKey<Q, K>>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"FilterListItemApi.js","names":[],"sources":["FilterListItemApi.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n CompileTimeMetadata,\n ObjectTypeDefinition,\n PropertyKeys,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport type { ReactNode } from \"react\";\n\nimport type { CustomFilterState } from \"./types/CustomRendererTypes.js\";\nimport type { KeywordSearchFilterState } from \"./types/KeywordSearchTypes.js\";\nimport type {\n HasLinkFilterState,\n LinkedPropertyFilterState,\n} from \"./types/LinkedFilterTypes.js\";\n\n/**\n * Helper type to extract the property type from an ObjectTypeDefinition given a property key\n */\nexport type PropertyTypeFromKey<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q>,\n> = CompileTimeMetadata<Q>[\"properties\"][K][\"type\"];\n\n/**\n * Fields shared by every filter definition, regardless of kind.\n */\nexport interface FilterDefinitionControls {\n /**\n * When `false`, the header monocle (search-values icon) is hidden even for\n * filter components that ordinarily support in-filter search. Useful for\n * `MULTI_SELECT`, which already has its own inline search field.\n *\n * @default true\n */\n searchField?: boolean;\n\n /**\n * Optional unique identifier for stable keying across filter reorders.\n * Set it explicitly when that derived value would collide, e.g. two filters on the\n * same property.\n *\n * This is the key used in `defaultFilterStates`; `getFilterKey(definition)`\n * returns it.\n *\n * @default a value derived from the definition (its `key`, or its link and property names)\n */\n id?: string;\n\n /**\n * Controls whether this filter is rendered.\n * When false, the filter is hidden but its state is preserved.\n * @default true\n */\n isVisible?: boolean;\n}\n\n/**\n * All available filter component types\n */\nexport type FilterComponentType =\n | \"LISTOGRAM\"\n | \"DATE_RANGE\"\n | \"NUMBER_RANGE\"\n | \"TEXT_TAGS\"\n | \"CONTAINS_TEXT\"\n | \"SINGLE_SELECT\"\n | \"MULTI_SELECT\"\n | \"SINGLE_DATE\"\n | \"MULTI_DATE\"\n | \"TIMELINE\"\n | \"TOGGLE\";\n\n/**\n * Gets valid component types for a given property type\n */\nexport type ValidComponentsForPropertyType<P extends WirePropertyTypes> =\n P extends \"boolean\"\n ? \"LISTOGRAM\" | \"SINGLE_SELECT\" | \"TOGGLE\"\n : P extends \"string\"\n ?\n | \"LISTOGRAM\"\n | \"TEXT_TAGS\"\n | \"CONTAINS_TEXT\"\n | \"SINGLE_SELECT\"\n | \"MULTI_SELECT\"\n : P extends \"datetime\" | \"timestamp\"\n ? \"DATE_RANGE\" | \"SINGLE_DATE\" | \"MULTI_DATE\" | \"TIMELINE\"\n : P extends\n | \"double\"\n | \"integer\"\n | \"long\"\n | \"float\"\n | \"short\"\n | \"byte\"\n | \"decimal\"\n ? \"NUMBER_RANGE\" | \"SINGLE_SELECT\" | \"MULTI_SELECT\"\n : never;\n\n/**\n * Union of all possible filter states\n */\nexport type FilterState =\n | ExactMatchFilterState<string | boolean>\n | DateRangeFilterState\n | ContainsTextFilterState\n | NumberRangeFilterState\n | SelectFilterState<string | boolean | number>\n | SelectFilterState<Date>\n | TimelineFilterState\n | ToggleFilterState\n | HasLinkFilterState\n | LinkedPropertyFilterState\n | KeywordSearchFilterState\n | CustomFilterState;\n\n/**\n * Maps component types to their corresponding state types\n */\nexport interface FilterStateByComponentType {\n LISTOGRAM: ExactMatchFilterState<string | boolean>;\n DATE_RANGE: DateRangeFilterState;\n TEXT_TAGS: ExactMatchFilterState<string>;\n CONTAINS_TEXT: ContainsTextFilterState;\n NUMBER_RANGE: NumberRangeFilterState;\n SINGLE_SELECT: SelectFilterState<string | boolean | number>;\n MULTI_SELECT: SelectFilterState<string | boolean | number>;\n SINGLE_DATE: SelectFilterState<Date>;\n MULTI_DATE: SelectFilterState<Date>;\n TIMELINE: TimelineFilterState;\n TOGGLE: ToggleFilterState;\n}\n\n/**\n * All filter state discriminator types\n */\nexport type FilterStateType =\n | \"EXACT_MATCH\"\n | \"DATE_RANGE\"\n | \"NUMBER_RANGE\"\n | \"CONTAINS_TEXT\"\n | \"SELECT\"\n | \"TIMELINE\"\n | \"TOGGLE\"\n | \"hasLink\"\n | \"linkedProperty\"\n | \"keywordSearch\"\n | \"custom\";\n\n/**\n * Base interface for all filter states\n * Contains common properties shared across all filter types\n */\nexport interface BaseFilterState {\n /**\n * The type of filter component\n */\n type: FilterStateType;\n\n /**\n * If true, the objects satisfying the filter are excluded\n * @default false\n */\n isExcluding?: boolean;\n\n /**\n * If true, include objects that have no value\n * @default false\n */\n includeNull?: boolean;\n}\n\nexport interface ExactMatchFilterState<\n T = string | boolean,\n> extends BaseFilterState {\n type: \"EXACT_MATCH\";\n values: T[];\n}\n\nexport interface DateRangeFilterState extends BaseFilterState {\n type: \"DATE_RANGE\";\n /**\n * The earliest date the user can select\n */\n minValue?: Date;\n /**\n * The latest date the user can select\n */\n maxValue?: Date;\n}\n\nexport interface ContainsTextFilterState extends BaseFilterState {\n type: \"CONTAINS_TEXT\";\n value?: string;\n}\n\nexport interface NumberRangeFilterState extends BaseFilterState {\n type: \"NUMBER_RANGE\";\n /**\n * Minimum numeric value (inclusive)\n */\n minValue?: number;\n /**\n * Maximum numeric value (inclusive)\n */\n maxValue?: number;\n}\n\n/**\n * Consolidated state type for select-based filters.\n * Used by SINGLE_SELECT, MULTI_SELECT, SINGLE_DATE, and MULTI_DATE.\n */\nexport interface SelectFilterState<\n T = string | boolean | number | Date,\n> extends BaseFilterState {\n type: \"SELECT\";\n selectedValues: T[];\n}\n\nexport interface TimelineFilterState extends BaseFilterState {\n type: \"TIMELINE\";\n startDate?: Date;\n endDate?: Date;\n granularity?: \"day\" | \"week\" | \"month\" | \"quarter\" | \"year\";\n}\n\nexport interface ToggleFilterState extends BaseFilterState {\n type: \"TOGGLE\";\n enabled: boolean;\n}\n\n/**\n * Optional date display formatter. Mixed into `PropertyFilterDefinition`\n * only when the property is `datetime` or `timestamp` — see\n * {@link PropertyFilterDateExtras}.\n *\n * `formatDate` overrides the displayed string everywhere the filter\n * surfaces a date: the shared `DateRangePicker` / `DatePicker` idle text,\n * the date-range histogram tooltip and period subtitle, the multi-date\n * chip text, and timeline labels. The picker's internal value remains\n * ISO `YYYY-MM-DD` so cross-locale viewers see a consistent input format\n * regardless of `formatDate`.\n *\n * Receives a `Date` in local time. If the property is a UTC ISO string and\n * you want a different timezone, do that conversion inside your callback.\n */\nexport interface DateFormattingProps {\n formatDate?: (date: Date) => string;\n}\n\n/**\n * Conditionally adds `formatDate` to a property filter definition only for\n * `datetime` / `timestamp` properties. For other property types this field\n * is typed as `never` so attempting to set it is a TypeScript error.\n */\nexport type PropertyFilterDateExtras<P extends WirePropertyTypes> = P extends\n | \"datetime\"\n | \"timestamp\"\n ? DateFormattingProps\n : { formatDate?: never };\n\ninterface PropertyFilterDefinitionBase<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q> = PropertyKeys<Q>,\n C extends ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>> =\n ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>>,\n> extends FilterDefinitionControls {\n /**\n * Discriminator for filter definition type\n */\n type: \"PROPERTY\";\n\n /**\n * The property key to filter on\n */\n key: K;\n\n /**\n * Display label for the filter\n */\n label?: string;\n\n /**\n * The filter component type to render\n * Must be compatible with the property type derived from the key, see ValidComponentsForPropertyType\n */\n filterComponent: C;\n\n /**\n * Seeds the filter's state on mount, FilterList owns the state from then on\n *\n * @default undefined (filter starts empty)\n */\n defaultFilterState?: FilterStateByComponentType[C];\n\n /**\n * @deprecated Rename to `defaultFilterState`.\n */\n filterState?: FilterStateByComponentType[C];\n\n /**\n * Maps filter values to colors for visual differentiation.\n * Used by LISTOGRAM (per-row bar colors).\n */\n colorMap?: Record<string, string>;\n\n /**\n * Configuration for LISTOGRAM display mode.\n * Only applies when filterComponent is \"LISTOGRAM\".\n */\n listogramConfig?: {\n displayMode?: \"full\" | \"count\" | \"minimal\";\n /**\n * Number of items shown before \"View all\" link appears\n * @default 5\n */\n maxVisibleItems?: number;\n };\n\n /**\n * Custom display function for filter values.\n * Replaces the default string display in dropdown items, chips, and listogram rows.\n * When the function returns a string, that string is also used for search matching\n * within filter dropdowns. When it returns a non-string `ReactNode`, search falls\n * back to the raw value.\n */\n renderValue?: (value: string) => ReactNode;\n\n /**\n * Show aggregation counts next to filter option values.\n * Applies to LISTOGRAM, SINGLE_SELECT, and MULTI_SELECT components.\n * @default true for LISTOGRAM and MULTI_SELECT, false for SINGLE_SELECT\n */\n showCount?: boolean;\n\n /**\n * When true, clicking a bar in the histogram replaces the filter range\n * with that bucket's `[min, max]`. Only applies to histogram-rendering\n * filter components (`NUMBER_RANGE` and `DATE_RANGE`); ignored on other\n * component types.\n *\n * Click replaces the current range — clicking a second bar discards the\n * previous selection. Multi-bucket selection / shift+click union is NOT\n * supported in v1.\n *\n * @default false\n */\n clickToFilter?: boolean;\n}\n\n/**\n * A property filter definition specifies configuration for filtering on a single property\n *\n * The component type C must be compatible with the property type derived from the key.\n * For example, boolean properties can only use LISTOGRAM or SINGLE_SELECT,\n * while string properties can use LISTOGRAM, TEXT_TAGS, CONTAINS_TEXT, SINGLE_SELECT, or MULTI_SELECT.\n *\n * Date and datetime properties may additionally specify `formatDate` — see\n * {@link PropertyFilterDateExtras}.\n */\nexport type PropertyFilterDefinition<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q> = PropertyKeys<Q>,\n C extends ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>> =\n ValidComponentsForPropertyType<PropertyTypeFromKey<Q, K>>,\n> = PropertyFilterDefinitionBase<Q, K, C> &\n PropertyFilterDateExtras<PropertyTypeFromKey<Q, K>>;\n"],"mappings":"","ignoreList":[]}
@@ -17,11 +17,10 @@
17
17
  import { useOsdkMetadata } from "@osdk/react";
18
18
  import { isEqual } from "lodash-es";
19
19
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
20
- import { assertUnreachable } from "../../shared/assertUnreachable.js";
21
20
  import { buildWhereClause, getActiveLinkedFilters } from "../utils/filterStateToWhereClause.js";
22
21
  import { filterHasActiveState } from "../utils/filterValues.js";
23
22
  import { getFilterKey } from "../utils/getFilterKey.js";
24
- import { getLinkedFilterComponent } from "../utils/getLinkedFilterComponent.js";
23
+ import { getSeedFilterState } from "../utils/getSeedFilterState.js";
25
24
  import { narrowObjectSet } from "../utils/narrowObjectSet.js";
26
25
  import { useStableMapEntries } from "./useStableMapEntries.js";
27
26
  function buildInitialStates(definitions) {
@@ -30,54 +29,9 @@ function buildInitialStates(definitions) {
30
29
  return states;
31
30
  }
32
31
  for (const definition of definitions) {
33
- const key = getFilterKey(definition);
34
- switch (definition.type) {
35
- case "PROPERTY":
36
- {
37
- const state = definition.filterState;
38
- if (state) {
39
- states.set(key, state);
40
- }
41
- break;
42
- }
43
- case "HAS_LINK":
44
- case "KEYWORD_SEARCH":
45
- case "CUSTOM":
46
- {
47
- const state = definition.defaultFilterState;
48
- if (state) {
49
- states.set(key, state);
50
- }
51
- break;
52
- }
53
- case "STATIC_VALUES":
54
- {
55
- const state = definition.filterState;
56
- if (state) {
57
- states.set(key, state);
58
- }
59
- break;
60
- }
61
- case "LINKED_PROPERTY":
62
- {
63
- // No component renders as unsupported, so seeding would narrow
64
- // `objectSet` off a filter the user can neither see nor clear.
65
- if (getLinkedFilterComponent(definition) == null) {
66
- break;
67
- }
68
- const innerState = definition.defaultFilterState ??
69
- // eslint-disable-next-line @typescript-eslint/no-deprecated -- pre-rename fallback
70
- definition.defaultLinkedFilterState;
71
- if (innerState) {
72
- states.set(key, {
73
- type: "linkedProperty",
74
- linkedFilterState: innerState
75
- });
76
- }
77
- break;
78
- }
79
- default:
80
- assertUnreachable(definition);
32
+ const state = getSeedFilterState(definition);
33
+ if (state) {
34
+ states.set(getFilterKey(definition), state);
81
35
  }
82
36
  }
83
37
  return states;
@@ -90,8 +44,11 @@ export function useFilterListState(props) {
90
44
  onFilterStateChanged,
91
45
  onFilterClauseChanged,
92
46
  onEffectiveObjectSet,
47
+ defaultFilterStates,
48
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- back-compat fallback for the pre-rename prop
93
49
  initialFilterStates
94
50
  } = props;
51
+ const seededFilterStates = defaultFilterStates ?? initialFilterStates;
95
52
  const {
96
53
  metadata
97
54
  } = useOsdkMetadata(objectType);
@@ -121,8 +78,8 @@ export function useFilterListState(props) {
121
78
  // the lifetime of the component (unlike `useMemo`, which React may discard).
122
79
  const [initialFilterStatesSnapshot] = useState(() => {
123
80
  const snapshot = buildInitialStates(filterDefinitions);
124
- if (initialFilterStates) {
125
- for (const [key, state] of initialFilterStates) {
81
+ if (seededFilterStates) {
82
+ for (const [key, state] of seededFilterStates) {
126
83
  snapshot.set(key, state);
127
84
  }
128
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useFilterListState.js","names":["useOsdkMetadata","isEqual","useCallback","useEffect","useMemo","useRef","useState","assertUnreachable","buildWhereClause","getActiveLinkedFilters","filterHasActiveState","getFilterKey","getLinkedFilterComponent","narrowObjectSet","useStableMapEntries","buildInitialStates","definitions","states","Map","definition","key","type","state","filterState","set","defaultFilterState","innerState","defaultLinkedFilterState","linkedFilterState","useFilterListState","props","objectType","objectSet","filterDefinitions","onFilterStateChanged","onFilterClauseChanged","onEffectiveObjectSet","initialFilterStates","metadata","onFilterClauseChangedRef","current","onEffectiveObjectSetRef","filterDefinitionsRef","propertyTypes","map","properties","prop","Object","entries","multiplicity","initialFilterStatesSnapshot","snapshot","filterStates","setFilterStates","setFilterState","filterKey","prev","next","find","d","clearFilterState","delete","reset","whereClause","linkedFilters","effectiveObjectSet","undefined","perFilterWhereClauses","perFilterLinkedFilters","activeFilterCount","count","values","hasChangesFromInitial"],"sources":["useFilterListState.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectSet, ObjectTypeDefinition, WhereClause } from \"@osdk/api\";\nimport { useOsdkMetadata } from \"@osdk/react\";\nimport { isEqual } from \"lodash-es\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport { assertUnreachable } from \"../../shared/assertUnreachable.js\";\nimport type { FilterListProps } from \"../FilterListApi.js\";\nimport type { FilterState } from \"../FilterListItemApi.js\";\nimport type {\n LinkedFilter,\n LinkedPropertyFilterState,\n} from \"../types/LinkedFilterTypes.js\";\nimport {\n buildWhereClause,\n getActiveLinkedFilters,\n type PropertyTypeInfo,\n} from \"../utils/filterStateToWhereClause.js\";\nimport { filterHasActiveState } from \"../utils/filterValues.js\";\nimport { getFilterKey } from \"../utils/getFilterKey.js\";\nimport { getLinkedFilterComponent } from \"../utils/getLinkedFilterComponent.js\";\nimport { narrowObjectSet } from \"../utils/narrowObjectSet.js\";\nimport { useStableMapEntries } from \"./useStableMapEntries.js\";\n\nexport interface UseFilterListStateResult<Q extends ObjectTypeDefinition> {\n filterStates: Map<string, FilterState>;\n setFilterState: (filterKey: string, state: FilterState) => void;\n clearFilterState: (filterKey: string) => void;\n /** Direct (non-link-traversing) filters combined into a `WhereClause<Q>`. */\n whereClause: WhereClause<Q>;\n /** Active linked-property records; apply via `narrowObjectSet`. */\n linkedFilters: ReadonlyArray<LinkedFilter<Q>>;\n /** Per-filter excluding-self where clauses keyed by `getFilterKey`. */\n perFilterWhereClauses: Map<string, WhereClause<Q>>;\n /** Per-filter excluding-self linked filters keyed by `getFilterKey`. */\n perFilterLinkedFilters: Map<string, ReadonlyArray<LinkedFilter<Q>>>;\n activeFilterCount: number;\n hasChangesFromInitial: boolean;\n reset: () => void;\n}\n\nfunction buildInitialStates<Q extends ObjectTypeDefinition>(\n definitions: FilterListProps<Q>[\"filterDefinitions\"],\n): Map<string, FilterState> {\n const states = new Map<string, FilterState>();\n\n if (!definitions) {\n return states;\n }\n\n for (const definition of definitions) {\n const key = getFilterKey(definition);\n switch (definition.type) {\n case \"PROPERTY\": {\n const state = definition.filterState;\n if (state) {\n states.set(key, state);\n }\n break;\n }\n case \"HAS_LINK\":\n case \"KEYWORD_SEARCH\":\n case \"CUSTOM\": {\n const state = definition.defaultFilterState;\n if (state) {\n states.set(key, state);\n }\n break;\n }\n case \"STATIC_VALUES\": {\n const state = definition.filterState;\n if (state) {\n states.set(key, state);\n }\n break;\n }\n case \"LINKED_PROPERTY\": {\n // No component renders as unsupported, so seeding would narrow\n // `objectSet` off a filter the user can neither see nor clear.\n if (getLinkedFilterComponent(definition) == null) {\n break;\n }\n const innerState =\n definition.defaultFilterState ??\n // eslint-disable-next-line @typescript-eslint/no-deprecated -- pre-rename fallback\n definition.defaultLinkedFilterState;\n if (innerState) {\n const state: LinkedPropertyFilterState = {\n type: \"linkedProperty\",\n linkedFilterState: innerState,\n };\n states.set(key, state);\n }\n break;\n }\n default:\n assertUnreachable(definition);\n }\n }\n\n return states;\n}\n\nexport function useFilterListState<Q extends ObjectTypeDefinition>(\n props: FilterListProps<Q>,\n): UseFilterListStateResult<Q> {\n const {\n objectType,\n objectSet,\n filterDefinitions,\n onFilterStateChanged,\n onFilterClauseChanged,\n onEffectiveObjectSet,\n initialFilterStates,\n } = props;\n const { metadata } = useOsdkMetadata(objectType);\n const onFilterClauseChangedRef = useRef(onFilterClauseChanged);\n onFilterClauseChangedRef.current = onFilterClauseChanged;\n const onEffectiveObjectSetRef = useRef(onEffectiveObjectSet);\n onEffectiveObjectSetRef.current = onEffectiveObjectSet;\n const filterDefinitionsRef = useRef(filterDefinitions);\n filterDefinitionsRef.current = filterDefinitions;\n\n const propertyTypes = useMemo(() => {\n const map = new Map<string, PropertyTypeInfo>();\n if (metadata?.properties) {\n for (const [key, prop] of Object.entries(metadata.properties)) {\n if (typeof prop.type === \"string\") {\n map.set(key, {\n type: prop.type,\n multiplicity: prop.multiplicity === true,\n });\n }\n }\n }\n return map;\n }, [metadata?.properties]);\n\n // Captured once on first render to provide a stable baseline for the reset\n // button's enabled state. `useState`'s lazy initializer pins the value for\n // the lifetime of the component (unlike `useMemo`, which React may discard).\n const [initialFilterStatesSnapshot] = useState<Map<string, FilterState>>(\n () => {\n const snapshot = buildInitialStates(filterDefinitions);\n if (initialFilterStates) {\n for (const [key, state] of initialFilterStates) {\n snapshot.set(key, state);\n }\n }\n return snapshot;\n },\n );\n\n const [filterStates, setFilterStates] = useState<Map<string, FilterState>>(\n () => new Map(initialFilterStatesSnapshot),\n );\n\n const setFilterState = useCallback(\n (filterKey: string, state: FilterState) => {\n setFilterStates((prev) => {\n const next = new Map(prev);\n next.set(filterKey, state);\n return next;\n });\n\n const definition = filterDefinitionsRef.current?.find(\n (d) => getFilterKey(d) === filterKey,\n );\n if (definition) {\n onFilterStateChanged?.(definition, state);\n }\n },\n [onFilterStateChanged],\n );\n\n const clearFilterState = useCallback((filterKey: string) => {\n setFilterStates((prev) => {\n const next = new Map(prev);\n next.delete(filterKey);\n return next;\n });\n }, []);\n\n const reset = useCallback(() => {\n setFilterStates(new Map(initialFilterStatesSnapshot));\n }, [initialFilterStatesSnapshot]);\n\n const whereClause = useMemo(\n () => buildWhereClause(filterDefinitions, filterStates, propertyTypes),\n [filterDefinitions, filterStates, propertyTypes],\n );\n\n const linkedFilters = useMemo(\n () => getActiveLinkedFilters(filterDefinitions, filterStates),\n [filterDefinitions, filterStates],\n );\n\n const effectiveObjectSet = useMemo<ObjectSet<Q> | undefined>(\n () =>\n objectSet == null\n ? undefined\n : narrowObjectSet(objectSet, whereClause, linkedFilters),\n [objectSet, whereClause, linkedFilters],\n );\n\n useEffect(() => {\n onFilterClauseChangedRef.current?.(whereClause);\n }, [whereClause]);\n\n useEffect(() => {\n if (effectiveObjectSet == null) {\n return;\n }\n onEffectiveObjectSetRef.current?.(effectiveObjectSet);\n }, [effectiveObjectSet]);\n\n const perFilterWhereClauses = useStableMapEntries(\n useMemo(() => {\n const map = new Map<string, WhereClause<Q>>();\n for (const definition of filterDefinitions ?? []) {\n const key = getFilterKey(definition);\n map.set(\n key,\n buildWhereClause(filterDefinitions, filterStates, propertyTypes, key),\n );\n }\n return map;\n }, [filterDefinitions, filterStates, propertyTypes]),\n );\n\n const perFilterLinkedFilters = useStableMapEntries(\n useMemo(() => {\n const map = new Map<string, ReadonlyArray<LinkedFilter<Q>>>();\n for (const definition of filterDefinitions ?? []) {\n const key = getFilterKey(definition);\n map.set(\n key,\n getActiveLinkedFilters(filterDefinitions, filterStates, key),\n );\n }\n return map;\n }, [filterDefinitions, filterStates]),\n );\n\n const activeFilterCount = useMemo(() => {\n let count = 0;\n for (const state of filterStates.values()) {\n if (filterHasActiveState(state)) {\n count++;\n }\n }\n return count;\n }, [filterStates]);\n\n const hasChangesFromInitial = useMemo(\n () => !isEqual(filterStates, initialFilterStatesSnapshot),\n [filterStates, initialFilterStatesSnapshot],\n );\n\n return useMemo(\n () => ({\n filterStates,\n setFilterState,\n clearFilterState,\n whereClause,\n linkedFilters,\n perFilterWhereClauses,\n perFilterLinkedFilters,\n activeFilterCount,\n hasChangesFromInitial,\n reset,\n }),\n [\n filterStates,\n setFilterState,\n clearFilterState,\n whereClause,\n linkedFilters,\n perFilterWhereClauses,\n perFilterLinkedFilters,\n activeFilterCount,\n hasChangesFromInitial,\n reset,\n ],\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAAQ,aAAa;AAC7C,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEzE,SAASC,iBAAiB,QAAQ,mCAAmC;AAOrE,SACEC,gBAAgB,EAChBC,sBAAsB,QAEjB,sCAAsC;AAC7C,SAASC,oBAAoB,QAAQ,0BAA0B;AAC/D,SAASC,YAAY,QAAQ,0BAA0B;AACvD,SAASC,wBAAwB,QAAQ,sCAAsC;AAC/E,SAASC,eAAe,QAAQ,6BAA6B;AAC7D,SAASC,mBAAmB,QAAQ,0BAA0B;AAmB9D,SAASC,kBAAkBA,CACzBC,WAAoD,EAC1B;EAC1B,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAAsB,CAAC;EAE7C,IAAI,CAACF,WAAW,EAAE;IAChB,OAAOC,MAAM;EACf;EAEA,KAAK,MAAME,UAAU,IAAIH,WAAW,EAAE;IACpC,MAAMI,GAAG,GAAGT,YAAY,CAACQ,UAAU,CAAC;IACpC,QAAQA,UAAU,CAACE,IAAI;MACrB,KAAK,UAAU;QAAE;UACf,MAAMC,KAAK,GAAGH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ACHX,sBAAsB,CAACwB,iBAAiB,EAAEmB,YAAY,EAAEhC,GAAG,CAC7D,CAAC;IACH;IACA,OAAOwB,GAAG;EACZ,CAAC,EAAE,CAACX,iBAAiB,EAAEmB,YAAY,CAAC,CACtC,CAAC;EAED,MAAMiB,iBAAiB,GAAGjE,OAAO,CAAC,MAAM;IACtC,IAAIkE,KAAK,GAAG,CAAC;IACb,KAAK,MAAMhD,KAAK,IAAI8B,YAAY,CAACmB,MAAM,CAAC,CAAC,EAAE;MACzC,IAAI7D,oBAAoB,CAACY,KAAK,CAAC,EAAE;QAC/BgD,KAAK,EAAE;MACT;IACF;IACA,OAAOA,KAAK;EACd,CAAC,EAAE,CAAClB,YAAY,CAAC,CAAC;EAElB,MAAMoB,qBAAqB,GAAGpE,OAAO,CACnC,MAAM,CAACH,OAAO,CAACmD,YAAY,EAAEF,2BAA2B,CAAC,EACzD,CAACE,YAAY,EAAEF,2BAA2B,CAC5C,CAAC;EAED,OAAO9C,OAAO,CACZ,OAAO;IACLgD,YAAY;IACZE,cAAc;IACdM,gBAAgB;IAChBG,WAAW;IACXC,aAAa;IACbG,qBAAqB;IACrBC,sBAAsB;IACtBC,iBAAiB;IACjBG,qBAAqB;IACrBV;EACF,CAAC,CAAC,EACF,CACEV,YAAY,EACZE,cAAc,EACdM,gBAAgB,EAChBG,WAAW,EACXC,aAAa,EACbG,qBAAqB,EACrBC,sBAAsB,EACtBC,iBAAiB,EACjBG,qBAAqB,EACrBV,KAAK,CAET,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"useFilterListState.js","names":["useOsdkMetadata","isEqual","useCallback","useEffect","useMemo","useRef","useState","buildWhereClause","getActiveLinkedFilters","filterHasActiveState","getFilterKey","getSeedFilterState","narrowObjectSet","useStableMapEntries","buildInitialStates","definitions","states","Map","definition","state","set","useFilterListState","props","objectType","objectSet","filterDefinitions","onFilterStateChanged","onFilterClauseChanged","onEffectiveObjectSet","defaultFilterStates","initialFilterStates","seededFilterStates","metadata","onFilterClauseChangedRef","current","onEffectiveObjectSetRef","filterDefinitionsRef","propertyTypes","map","properties","key","prop","Object","entries","type","multiplicity","initialFilterStatesSnapshot","snapshot","filterStates","setFilterStates","setFilterState","filterKey","prev","next","find","d","clearFilterState","delete","reset","whereClause","linkedFilters","effectiveObjectSet","undefined","perFilterWhereClauses","perFilterLinkedFilters","activeFilterCount","count","values","hasChangesFromInitial"],"sources":["useFilterListState.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectSet, ObjectTypeDefinition, WhereClause } from \"@osdk/api\";\nimport { useOsdkMetadata } from \"@osdk/react\";\nimport { isEqual } from \"lodash-es\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nimport type { FilterListProps } from \"../FilterListApi.js\";\nimport type { FilterState } from \"../FilterListItemApi.js\";\nimport type { LinkedFilter } from \"../types/LinkedFilterTypes.js\";\nimport {\n buildWhereClause,\n getActiveLinkedFilters,\n type PropertyTypeInfo,\n} from \"../utils/filterStateToWhereClause.js\";\nimport { filterHasActiveState } from \"../utils/filterValues.js\";\nimport { getFilterKey } from \"../utils/getFilterKey.js\";\nimport { getSeedFilterState } from \"../utils/getSeedFilterState.js\";\nimport { narrowObjectSet } from \"../utils/narrowObjectSet.js\";\nimport { useStableMapEntries } from \"./useStableMapEntries.js\";\n\nexport interface UseFilterListStateResult<Q extends ObjectTypeDefinition> {\n filterStates: Map<string, FilterState>;\n setFilterState: (filterKey: string, state: FilterState) => void;\n clearFilterState: (filterKey: string) => void;\n /** Direct (non-link-traversing) filters combined into a `WhereClause<Q>`. */\n whereClause: WhereClause<Q>;\n /** Active linked-property records; apply via `narrowObjectSet`. */\n linkedFilters: ReadonlyArray<LinkedFilter<Q>>;\n /** Per-filter excluding-self where clauses keyed by `getFilterKey`. */\n perFilterWhereClauses: Map<string, WhereClause<Q>>;\n /** Per-filter excluding-self linked filters keyed by `getFilterKey`. */\n perFilterLinkedFilters: Map<string, ReadonlyArray<LinkedFilter<Q>>>;\n activeFilterCount: number;\n hasChangesFromInitial: boolean;\n reset: () => void;\n}\n\nfunction buildInitialStates<Q extends ObjectTypeDefinition>(\n definitions: FilterListProps<Q>[\"filterDefinitions\"],\n): Map<string, FilterState> {\n const states = new Map<string, FilterState>();\n\n if (!definitions) {\n return states;\n }\n\n for (const definition of definitions) {\n const state = getSeedFilterState(definition);\n if (state) {\n states.set(getFilterKey(definition), state);\n }\n }\n\n return states;\n}\n\nexport function useFilterListState<Q extends ObjectTypeDefinition>(\n props: FilterListProps<Q>,\n): UseFilterListStateResult<Q> {\n const {\n objectType,\n objectSet,\n filterDefinitions,\n onFilterStateChanged,\n onFilterClauseChanged,\n onEffectiveObjectSet,\n defaultFilterStates,\n // eslint-disable-next-line @typescript-eslint/no-deprecated -- back-compat fallback for the pre-rename prop\n initialFilterStates,\n } = props;\n const seededFilterStates = defaultFilterStates ?? initialFilterStates;\n const { metadata } = useOsdkMetadata(objectType);\n const onFilterClauseChangedRef = useRef(onFilterClauseChanged);\n onFilterClauseChangedRef.current = onFilterClauseChanged;\n const onEffectiveObjectSetRef = useRef(onEffectiveObjectSet);\n onEffectiveObjectSetRef.current = onEffectiveObjectSet;\n const filterDefinitionsRef = useRef(filterDefinitions);\n filterDefinitionsRef.current = filterDefinitions;\n\n const propertyTypes = useMemo(() => {\n const map = new Map<string, PropertyTypeInfo>();\n if (metadata?.properties) {\n for (const [key, prop] of Object.entries(metadata.properties)) {\n if (typeof prop.type === \"string\") {\n map.set(key, {\n type: prop.type,\n multiplicity: prop.multiplicity === true,\n });\n }\n }\n }\n return map;\n }, [metadata?.properties]);\n\n // Captured once on first render to provide a stable baseline for the reset\n // button's enabled state. `useState`'s lazy initializer pins the value for\n // the lifetime of the component (unlike `useMemo`, which React may discard).\n const [initialFilterStatesSnapshot] = useState<Map<string, FilterState>>(\n () => {\n const snapshot = buildInitialStates(filterDefinitions);\n if (seededFilterStates) {\n for (const [key, state] of seededFilterStates) {\n snapshot.set(key, state);\n }\n }\n return snapshot;\n },\n );\n\n const [filterStates, setFilterStates] = useState<Map<string, FilterState>>(\n () => new Map(initialFilterStatesSnapshot),\n );\n\n const setFilterState = useCallback(\n (filterKey: string, state: FilterState) => {\n setFilterStates((prev) => {\n const next = new Map(prev);\n next.set(filterKey, state);\n return next;\n });\n\n const definition = filterDefinitionsRef.current?.find(\n (d) => getFilterKey(d) === filterKey,\n );\n if (definition) {\n onFilterStateChanged?.(definition, state);\n }\n },\n [onFilterStateChanged],\n );\n\n const clearFilterState = useCallback((filterKey: string) => {\n setFilterStates((prev) => {\n const next = new Map(prev);\n next.delete(filterKey);\n return next;\n });\n }, []);\n\n const reset = useCallback(() => {\n setFilterStates(new Map(initialFilterStatesSnapshot));\n }, [initialFilterStatesSnapshot]);\n\n const whereClause = useMemo(\n () => buildWhereClause(filterDefinitions, filterStates, propertyTypes),\n [filterDefinitions, filterStates, propertyTypes],\n );\n\n const linkedFilters = useMemo(\n () => getActiveLinkedFilters(filterDefinitions, filterStates),\n [filterDefinitions, filterStates],\n );\n\n const effectiveObjectSet = useMemo<ObjectSet<Q> | undefined>(\n () =>\n objectSet == null\n ? undefined\n : narrowObjectSet(objectSet, whereClause, linkedFilters),\n [objectSet, whereClause, linkedFilters],\n );\n\n useEffect(() => {\n onFilterClauseChangedRef.current?.(whereClause);\n }, [whereClause]);\n\n useEffect(() => {\n if (effectiveObjectSet == null) {\n return;\n }\n onEffectiveObjectSetRef.current?.(effectiveObjectSet);\n }, [effectiveObjectSet]);\n\n const perFilterWhereClauses = useStableMapEntries(\n useMemo(() => {\n const map = new Map<string, WhereClause<Q>>();\n for (const definition of filterDefinitions ?? []) {\n const key = getFilterKey(definition);\n map.set(\n key,\n buildWhereClause(filterDefinitions, filterStates, propertyTypes, key),\n );\n }\n return map;\n }, [filterDefinitions, filterStates, propertyTypes]),\n );\n\n const perFilterLinkedFilters = useStableMapEntries(\n useMemo(() => {\n const map = new Map<string, ReadonlyArray<LinkedFilter<Q>>>();\n for (const definition of filterDefinitions ?? []) {\n const key = getFilterKey(definition);\n map.set(\n key,\n getActiveLinkedFilters(filterDefinitions, filterStates, key),\n );\n }\n return map;\n }, [filterDefinitions, filterStates]),\n );\n\n const activeFilterCount = useMemo(() => {\n let count = 0;\n for (const state of filterStates.values()) {\n if (filterHasActiveState(state)) {\n count++;\n }\n }\n return count;\n }, [filterStates]);\n\n const hasChangesFromInitial = useMemo(\n () => !isEqual(filterStates, initialFilterStatesSnapshot),\n [filterStates, initialFilterStatesSnapshot],\n );\n\n return useMemo(\n () => ({\n filterStates,\n setFilterState,\n clearFilterState,\n whereClause,\n linkedFilters,\n perFilterWhereClauses,\n perFilterLinkedFilters,\n activeFilterCount,\n hasChangesFromInitial,\n reset,\n }),\n [\n filterStates,\n setFilterState,\n clearFilterState,\n whereClause,\n linkedFilters,\n perFilterWhereClauses,\n perFilterLinkedFilters,\n activeFilterCount,\n hasChangesFromInitial,\n reset,\n ],\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAAQ,aAAa;AAC7C,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAKzE,SACEC,gBAAgB,EAChBC,sBAAsB,QAEjB,sCAAsC;AAC7C,SAASC,oBAAoB,QAAQ,0BAA0B;AAC/D,SAASC,YAAY,QAAQ,0BAA0B;AACvD,SAASC,k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CAAC,EAAE;QAC/B+C,KAAK,EAAE;MACT;IACF;IACA,OAAOA,KAAK;EACd,CAAC,EAAE,CAAClB,YAAY,CAAC,CAAC;EAElB,MAAMoB,qBAAqB,GAAGhE,OAAO,CACnC,MAAM,CAACH,OAAO,CAAC+C,YAAY,EAAEF,2BAA2B,CAAC,EACzD,CAACE,YAAY,EAAEF,2BAA2B,CAC5C,CAAC;EAED,OAAO1C,OAAO,CACZ,OAAO;IACL4C,YAAY;IACZE,cAAc;IACdM,gBAAgB;IAChBG,WAAW;IACXC,aAAa;IACbG,qBAAqB;IACrBC,sBAAsB;IACtBC,iBAAiB;IACjBG,qBAAqB;IACrBV;EACF,CAAC,CAAC,EACF,CACEV,YAAY,EACZE,cAAc,EACdM,gBAAgB,EAChBG,WAAW,EACXC,aAAa,EACbG,qBAAqB,EACrBC,sBAAsB,EACtBC,iBAAiB,EACjBG,qBAAqB,EACrBV,KAAK,CAET,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"usePropertyAggregation.js","names":["useOsdkAggregation","useMemo","dedupeEmptyAggregationRows","NO_VALUE","EMPTY_ACTIVE_VALUES","usePropertyAggregation","objectType","propertyKey","objectSet","options","aggregateOptions","$select","$count","$groupBy","$exact","$includeNullValue","aggregationArgs","aggregate","where","data","countData","isLoading","error","activeValues","result","maxCount","values","dataArray","existingValues","Set","item","raw","$group","add","String","filteredOutEntries","flatMap","v","has","rawValue","count","push","value","isNull","Math","max","deduped","sortBy","sort","a","b","localeCompare","limit","length","slice"],"sources":["usePropertyAggregation.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n AggregateOpts,\n ObjectSet,\n ObjectTypeDefinition,\n PropertyKeys,\n WhereClause,\n} from \"@osdk/api\";\nimport { useOsdkAggregation } from \"@osdk/react\";\nimport { useMemo } from \"react\";\n\nimport type { AggregationGroupResult } from \"../utils/aggregationHelpers.js\";\nimport { dedupeEmptyAggregationRows, NO_VALUE } from \"../utils/filterValues.js\";\n\nexport type { PropertyAggregationValue } from \"../types/AggregationTypes.js\";\n\nimport type { PropertyAggregationValue } from \"../types/AggregationTypes.js\";\n\nexport interface UsePropertyAggregationResult {\n data: PropertyAggregationValue[];\n maxCount: number;\n isLoading: boolean;\n error: Error | null;\n}\n\nconst EMPTY_ACTIVE_VALUES: string[] = [];\n\nexport interface UsePropertyAggregationOptions<\n Q extends ObjectTypeDefinition = ObjectTypeDefinition,\n> {\n limit?: number;\n where?: WhereClause<Q>;\n sortBy?: \"count\" | \"value\";\n /** Selected values to include in results even when they have zero matching\n * rows (e.g. saved filter selections from initialFilterStates). */\n activeValues?: string[];\n}\n\nexport function usePropertyAggregation<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q>,\n>(\n objectType: Q,\n propertyKey: K,\n objectSet: ObjectSet<Q> | undefined,\n options?: UsePropertyAggregationOptions<Q>,\n): UsePropertyAggregationResult {\n // AggregateOpts requires specific property keys from Q, but we're dynamically\n // using propertyKey. The cast is unavoidable for this dynamic filter pattern.\n const aggregateOptions = useMemo(\n () =>\n ({\n $select: { $count: \"unordered\" as const },\n $groupBy: {\n [propertyKey as string]: {\n $exact: { $includeNullValue: true },\n },\n },\n }) as AggregateOpts<Q>,\n [propertyKey],\n );\n\n const aggregationArgs = useMemo(\n () => ({ aggregate: aggregateOptions, where: options?.where, objectSet }),\n [aggregateOptions, options?.where, objectSet],\n );\n\n const {\n data: countData,\n isLoading,\n error,\n } = useOsdkAggregation(objectType, aggregationArgs);\n\n const activeValues = options?.activeValues ?? EMPTY_ACTIVE_VALUES;\n\n const result = useMemo((): {\n data: PropertyAggregationValue[];\n maxCount: number;\n } => {\n if (!countData) {\n return { data: [], maxCount: 0 };\n }\n\n const values: PropertyAggregationValue[] = [];\n let maxCount = 0;\n\n // The aggregation result type varies by query structure. Since we're building\n // the query dynamically based on propertyKey, we cast to a known shape that\n // matches the $groupBy + $count aggregation pattern.\n const dataArray = countData as AggregationGroupResult;\n\n // Build a set of values present in the aggregation so we can identify\n // which active selections need to be synthesized as filtered-out entries.\n const existingValues = new Set<string>();\n for (const item of dataArray) {\n const raw = item.$group[propertyKey as string];\n existingValues.add(raw == null ? NO_VALUE : String(raw));\n }\n\n // Synthesize filtered-out entries for active selections absent from\n // aggregation results (e.g. saved filters with zero matching rows). They\n // use the same shape as real entries so the loop below handles isNull\n // uniformly.\n const filteredOutEntries = activeValues.flatMap((v) =>\n existingValues.has(v)\n ? []\n : [{ $group: { [propertyKey as string]: v }, $count: 0 }],\n );\n\n for (const item of [...dataArray, ...filteredOutEntries]) {\n const rawValue = item.$group[propertyKey as string];\n const count = item.$count ?? 0;\n\n if (rawValue == null) {\n values.push({ value: NO_VALUE, count, isNull: true });\n } else {\n values.push({ value: String(rawValue), count });\n }\n maxCount = Math.max(maxCount, count);\n }\n\n const deduped = dedupeEmptyAggregationRows(values);\n\n const sortBy = options?.sortBy ?? \"count\";\n if (sortBy === \"count\") {\n deduped.sort(\n (a, b) => b.count - a.count || a.value.localeCompare(b.value),\n );\n } else {\n deduped.sort((a, b) => a.value.localeCompare(b.value));\n }\n\n if (options?.limit && deduped.length > options.limit) {\n return { data: deduped.slice(0, options.limit), maxCount };\n }\n\n return { data: deduped, maxCount };\n }, [countData, propertyKey, options?.limit, options?.sortBy, activeValues]);\n\n return {\n data: result.data,\n maxCount: result.maxCount,\n isLoading,\n error: error ?? null,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SA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AC,CAACV,KAAK,GAAGS,CAAC,CAACT,KAAK,IAAIS,CAAC,CAACP,KAAK,CAACS,aAAa,CAACD,CAAC,CAACR,KAAK,CAC9D,CAAC;IACH,CAAC,MAAM;MACLI,OAAO,CAACE,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACP,KAAK,CAACS,aAAa,CAACD,CAAC,CAACR,KAAK,CAAC,CAAC;IACxD;IAEA,IAAIjC,OAAO,EAAE2C,KAAK,IAAIN,OAAO,CAACO,MAAM,GAAG5C,OAAO,CAAC2C,KAAK,EAAE;MACpD,OAAO;QAAEjC,IAAI,EAAE2B,OAAO,CAACQ,KAAK,CAAC,CAAC,EAAE7C,OAAO,CAAC2C,KAAK,CAAC;QAAE3B;MAAS,CAAC;IAC5D;IAEA,OAAO;MAAEN,IAAI,EAAE2B,OAAO;MAAErB;IAAS,CAAC;EACpC,CAAC,EAAE,CAACL,SAAS,EAAEb,WAAW,EAAEE,OAAO,EAAE2C,KAAK,EAAE3C,OAAO,EAAEsC,MAAM,EAAExB,YAAY,CAAC,CAAC;EAE3E,OAAO;IACLJ,IAAI,EAAEK,MAAM,CAACL,IAAI;IACjBM,QAAQ,EAAED,MAAM,CAACC,QAAQ;IACzBJ,SAAS;IACTC,KAAK,EAAEA,KAAK,IAAI;EAClB,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"usePropertyAggregation.js","names":["useOsdkAggregation","useMemo","dedupeEmptyAggregationRows","NO_VALUE","EMPTY_ACTIVE_VALUES","usePropertyAggregation","objectType","propertyKey","objectSet","options","aggregateOptions","$select","$count","$groupBy","$exact","$includeNullValue","aggregationArgs","aggregate","where","data","countData","isLoading","error","activeValues","result","maxCount","values","dataArray","existingValues","Set","item","raw","$group","add","String","filteredOutEntries","flatMap","v","has","rawValue","count","push","value","isNull","Math","max","deduped","sortBy","sort","a","b","localeCompare","limit","length","slice"],"sources":["usePropertyAggregation.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n AggregateOpts,\n ObjectSet,\n ObjectTypeDefinition,\n PropertyKeys,\n WhereClause,\n} from \"@osdk/api\";\nimport { useOsdkAggregation } from \"@osdk/react\";\nimport { useMemo } from \"react\";\n\nimport type { AggregationGroupResult } from \"../utils/aggregationHelpers.js\";\nimport { dedupeEmptyAggregationRows, NO_VALUE } from \"../utils/filterValues.js\";\n\nexport type { PropertyAggregationValue } from \"../types/AggregationTypes.js\";\n\nimport type { PropertyAggregationValue } from \"../types/AggregationTypes.js\";\n\nexport interface UsePropertyAggregationResult {\n data: PropertyAggregationValue[];\n maxCount: number;\n isLoading: boolean;\n error: Error | null;\n}\n\nconst EMPTY_ACTIVE_VALUES: string[] = [];\n\nexport interface UsePropertyAggregationOptions<\n Q extends ObjectTypeDefinition = ObjectTypeDefinition,\n> {\n limit?: number;\n where?: WhereClause<Q>;\n sortBy?: \"count\" | \"value\";\n /** Selected values to include in results even when they have zero matching\n * rows (e.g. saved filter selections from defaultFilterStates). */\n activeValues?: string[];\n}\n\nexport function usePropertyAggregation<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q>,\n>(\n objectType: Q,\n propertyKey: K,\n objectSet: ObjectSet<Q> | undefined,\n options?: UsePropertyAggregationOptions<Q>,\n): UsePropertyAggregationResult {\n // AggregateOpts requires specific property keys from Q, but we're dynamically\n // using propertyKey. The cast is unavoidable for this dynamic filter pattern.\n const aggregateOptions = useMemo(\n () =>\n ({\n $select: { $count: \"unordered\" as const },\n $groupBy: {\n [propertyKey as string]: {\n $exact: { $includeNullValue: true },\n },\n },\n }) as AggregateOpts<Q>,\n [propertyKey],\n );\n\n const aggregationArgs = useMemo(\n () => ({ aggregate: aggregateOptions, where: options?.where, objectSet }),\n [aggregateOptions, options?.where, objectSet],\n );\n\n const {\n data: countData,\n isLoading,\n error,\n } = useOsdkAggregation(objectType, aggregationArgs);\n\n const activeValues = options?.activeValues ?? EMPTY_ACTIVE_VALUES;\n\n const result = useMemo((): {\n data: PropertyAggregationValue[];\n maxCount: number;\n } => {\n if (!countData) {\n return { data: [], maxCount: 0 };\n }\n\n const values: PropertyAggregationValue[] = [];\n let maxCount = 0;\n\n // The aggregation result type varies by query structure. Since we're building\n // the query dynamically based on propertyKey, we cast to a known shape that\n // matches the $groupBy + $count aggregation pattern.\n const dataArray = countData as AggregationGroupResult;\n\n // Build a set of values present in the aggregation so we can identify\n // which active selections need to be synthesized as filtered-out entries.\n const existingValues = new Set<string>();\n for (const item of dataArray) {\n const raw = item.$group[propertyKey as string];\n existingValues.add(raw == null ? NO_VALUE : String(raw));\n }\n\n // Synthesize filtered-out entries for active selections absent from\n // aggregation results (e.g. saved filters with zero matching rows). They\n // use the same shape as real entries so the loop below handles isNull\n // uniformly.\n const filteredOutEntries = activeValues.flatMap((v) =>\n existingValues.has(v)\n ? []\n : [{ $group: { [propertyKey as string]: v }, $count: 0 }],\n );\n\n for (const item of [...dataArray, ...filteredOutEntries]) {\n const rawValue = item.$group[propertyKey as string];\n const count = item.$count ?? 0;\n\n if (rawValue == null) {\n values.push({ value: NO_VALUE, count, isNull: true });\n } else {\n values.push({ value: String(rawValue), count });\n }\n maxCount = Math.max(maxCount, count);\n }\n\n const deduped = dedupeEmptyAggregationRows(values);\n\n const sortBy = options?.sortBy ?? \"count\";\n if (sortBy === \"count\") {\n deduped.sort(\n (a, b) => b.count - a.count || a.value.localeCompare(b.value),\n );\n } else {\n deduped.sort((a, b) => a.value.localeCompare(b.value));\n }\n\n if (options?.limit && deduped.length > options.limit) {\n return { data: deduped.slice(0, options.limit), maxCount };\n }\n\n return { data: deduped, maxCount };\n }, [countData, propertyKey, options?.limit, options?.sortBy, activeValues]);\n\n return {\n data: result.data,\n maxCount: result.maxCount,\n isLoading,\n error: error ?? null,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,kBAAkB,QAAQ,aAAa;AAChD,SAASC,OAAO,QAAQ,OAAO;AAG/B,SAASC,0BAA0B,EAAEC,QAAQ,QAAQ,0BAA0B;AAa/E,MAAMC,mBAA6B,GAAG,EAAE;AAaxC,OAAO,SAASC,sBAAsBA,CAIpCC,UAAa,EACbC,WAAc,EACdC,SAAmC,EACnCC,OAA0C,EACZ;EAC9B;EACA;EACA,MAAMC,gBAAgB,GAAGT,OAAO,CAC9B,OACG;IACCU,OAAO,EAAE;MAAEC,MAAM,EAAE;IAAqB,CAAC;IACzCC,QAAQ,EAAE;MACR,CAACN,WAAW,GAAa;QACvBO,MAAM,EAAE;UAAEC,iBAAiB,EAAE;QAAK;MACpC;IACF;EACF,CAAC,CAAqB,EACxB,CAACR,WAAW,CACd,CAAC;EAED,MAAMS,eAAe,GAAGf,OAAO,CAC7B,OAAO;IAAEgB,SAAS,EAAEP,gBAAgB;IAAEQ,KAAK,EAAET,OAAO,EAAES,KAAK;IAAEV;EAAU,CAAC,CAAC,EACzE,CAACE,gBAAgB,EAAED,OAAO,EAAES,KAAK,EAAEV,SAAS,CAC9C,CAAC;EAED,MAAM;IACJW,IAAI,EAAEC,SAAS;IACfC,SAAS;IACTC;EACF,CAAC,GAAGtB,kBAAkB,CAACM,UAAU,EAAEU,eAAe,CAAC;EAEnD,MAAMO,YAAY,GAAGd,OAAO,EAAEc,YAAY,IAAInB,mBAAmB;EAEjE,MAAMoB,MAAM,GAAGvB,OAAO,CAAC,MAGlB;IACH,IAAI,CAACmB,SAAS,EAAE;MACd,OAAO;QAAED,IAAI,EAAE,EAAE;QAAEM,QAAQ,E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AC;IACtC;IAEA,MAAMM,OAAO,GAAG5C,0BAA0B,CAACwB,MAAM,CAAC;IAElD,MAAMqB,MAAM,GAAGtC,OAAO,EAAEsC,MAAM,IAAI,OAAO;IACzC,IAAIA,MAAM,KAAK,OAAO,EAAE;MACtBD,OAAO,CAACE,IAAI,CACV,CAACC,CAAC,EAAEC,CAAC,KAAKA,CAAC,CAACV,KAAK,GAAGS,CAAC,CAACT,KAAK,IAAIS,CAAC,CAACP,KAAK,CAACS,aAAa,CAACD,CAAC,CAACR,KAAK,CAC9D,CAAC;IACH,CAAC,MAAM;MACLI,OAAO,CAACE,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACP,KAAK,CAACS,aAAa,CAACD,CAAC,CAACR,KAAK,CAAC,CAAC;IACxD;IAEA,IAAIjC,OAAO,EAAE2C,KAAK,IAAIN,OAAO,CAACO,MAAM,GAAG5C,OAAO,CAAC2C,KAAK,EAAE;MACpD,OAAO;QAAEjC,IAAI,EAAE2B,OAAO,CAACQ,KAAK,CAAC,CAAC,EAAE7C,OAAO,CAAC2C,KAAK,CAAC;QAAE3B;MAAS,CAAC;IAC5D;IAEA,OAAO;MAAEN,IAAI,EAAE2B,OAAO;MAAErB;IAAS,CAAC;EACpC,CAAC,EAAE,CAACL,SAAS,EAAEb,WAAW,EAAEE,OAAO,EAAE2C,KAAK,EAAE3C,OAAO,EAAEsC,MAAM,EAAExB,YAAY,CAAC,CAAC;EAE3E,OAAO;IACLJ,IAAI,EAAEK,MAAM,CAACL,IAAI;IACjBM,QAAQ,EAAED,MAAM,CAACC,QAAQ;IACzBJ,SAAS;IACTC,KAAK,EAAEA,KAAK,IAAI;EAClB,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"CustomRendererTypes.js","names":[],"sources":["CustomRendererTypes.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectSet, ObjectTypeDefinition, WhereClause } from \"@osdk/api\";\nimport type { ReactNode } from \"react\";\n\nimport type {\n BaseFilterState,\n FilterDefinitionControls,\n} from \"../FilterListItemApi.js\";\n\n/**\n * State for custom filter\n */\nexport interface CustomFilterState<\n T = Record<string, unknown>,\n> extends BaseFilterState {\n type: \"custom\";\n customState: T;\n}\n\n/**\n * Props passed to custom filter input renderer\n */\nexport interface CustomFilterInputRendererProps<\n Q extends ObjectTypeDefinition,\n State extends BaseFilterState,\n> {\n objectType: Q;\n objectSet?: ObjectSet<Q>;\n filterState: State;\n onFilterStateChanged: (newState: State) => void;\n}\n\n/**\n * Props passed to custom filter item renderer\n * Includes full item context in addition to input renderer props\n */\nexport interface CustomFilterItemRendererProps<\n Q extends ObjectTypeDefinition,\n State extends BaseFilterState,\n> extends CustomFilterInputRendererProps<Q, State> {\n label: string;\n onRemove?: () => void;\n}\n\n/**\n * Filter definition for custom filters\n * Provides full control over rendering and filter logic\n */\nexport interface CustomFilterDefinition<\n Q extends ObjectTypeDefinition,\n State extends BaseFilterState = CustomFilterState,\n> extends FilterDefinitionControls {\n type: \"CUSTOM\";\n /**\n * Optional unique identifier for stable keying across filter reorders.\n * If provided, takes precedence over `key` for state keying.\n */\n id?: string;\n /**\n * Unique key for this custom filter\n */\n key: string;\n label?: string;\n filterComponent: \"CUSTOM\";\n filterState: State;\n defaultFilterState?: State;\n /**\n * Render the input portion of the filter\n * Used when rendering within a filter item wrapper\n */\n renderInput?: (props: CustomFilterInputRendererProps<Q, State>) => ReactNode;\n /**\n * Render the complete filter item\n * Used when you need full control over the item appearance\n */\n renderItem?: (props: CustomFilterItemRendererProps<Q, State>) => ReactNode;\n /**\n * Convert filter state to a WhereClause for filtering\n * Required for the filter to affect the object set\n */\n toWhereClause: (state: State) => WhereClause<Q> | undefined;\n /**\n * Controls whether this filter is rendered.\n * When false, the filter is hidden but its state is preserved.\n * @default true\n */\n isVisible?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"CustomRendererTypes.js","names":[],"sources":["CustomRendererTypes.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectSet, ObjectTypeDefinition, WhereClause } from \"@osdk/api\";\nimport type { ReactNode } from \"react\";\n\nimport type {\n BaseFilterState,\n FilterDefinitionControls,\n} from \"../FilterListItemApi.js\";\n\n/**\n * State for custom filter\n */\nexport interface CustomFilterState<\n T = Record<string, unknown>,\n> extends BaseFilterState {\n type: \"custom\";\n customState: T;\n}\n\n/**\n * Props passed to custom filter input renderer\n */\nexport interface CustomFilterInputRendererProps<\n Q extends ObjectTypeDefinition,\n State extends BaseFilterState,\n> {\n objectType: Q;\n objectSet?: ObjectSet<Q>;\n filterState: State;\n onFilterStateChanged: (newState: State) => void;\n}\n\n/**\n * Props passed to custom filter item renderer\n * Includes full item context in addition to input renderer props\n */\nexport interface CustomFilterItemRendererProps<\n Q extends ObjectTypeDefinition,\n State extends BaseFilterState,\n> extends CustomFilterInputRendererProps<Q, State> {\n label: string;\n onRemove?: () => void;\n}\n\n/**\n * Filter definition for custom filters\n * Provides full control over rendering and filter logic\n */\nexport interface CustomFilterDefinition<\n Q extends ObjectTypeDefinition,\n State extends BaseFilterState = CustomFilterState,\n> extends FilterDefinitionControls {\n type: \"CUSTOM\";\n /**\n * Unique key for this custom filter\n */\n key: string;\n label?: string;\n filterComponent: \"CUSTOM\";\n\n /**\n * Seeds the filter's state on mount, FilterList owns the state from then on\n *\n * @default undefined (filter starts empty)\n */\n defaultFilterState?: State;\n\n /**\n * @deprecated Use `defaultFilterState`.\n */\n filterState?: State;\n /**\n * Render the input portion of the filter\n * Used when rendering within a filter item wrapper\n */\n renderInput?: (props: CustomFilterInputRendererProps<Q, State>) => ReactNode;\n /**\n * Render the complete filter item\n * Used when you need full control over the item appearance\n */\n renderItem?: (props: CustomFilterItemRendererProps<Q, State>) => ReactNode;\n /**\n * Convert filter state to a WhereClause for filtering\n * Required for the filter to affect the object set\n */\n toWhereClause: (state: State) => WhereClause<Q> | undefined;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"KeywordSearchTypes.js","names":[],"sources":["KeywordSearchTypes.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectTypeDefinition, PropertyKeys } from \"@osdk/api\";\n\nimport type {\n BaseFilterState,\n FilterDefinitionControls,\n} from \"../FilterListItemApi.js\";\n\n/**\n * Keys of string properties on an object type\n */\nexport type StringPropertyKeys<Q extends ObjectTypeDefinition> =\n PropertyKeys.Filtered<Q, \"string\">;\n\n/**\n * State for keyword search filter\n */\nexport interface KeywordSearchFilterState extends BaseFilterState {\n type: \"keywordSearch\";\n searchTerm: string;\n /**\n * How multiple terms are combined\n * - \"AND\": All terms must match\n * - \"OR\": Any term must match\n */\n operator: \"AND\" | \"OR\";\n}\n\n/**\n * Filter definition for keyword search across string properties\n */\nexport interface KeywordSearchFilterDefinition<\n Q extends ObjectTypeDefinition,\n K extends StringPropertyKeys<Q> = StringPropertyKeys<Q>,\n> extends FilterDefinitionControls {\n type: \"KEYWORD_SEARCH\";\n /**\n * Optional unique identifier for stable keying across filter reorders.\n */\n id?: string;\n /**\n * Properties to search within\n * - \"all\": Search all string properties\n * - K[]: Search specific string properties\n */\n properties: \"all\" | K[];\n label?: string;\n /**\n * Controlled state for the filter.\n * When provided, the filter becomes controlled and changes should be\n * handled via onFilterStateChanged callback.\n */\n filterState?: KeywordSearchFilterState;\n /**\n * Default state for uncontrolled mode.\n * Used when filterState is not provided.\n */\n defaultFilterState?: KeywordSearchFilterState;\n /**\n * Controls whether this filter is rendered.\n * When false, the filter is hidden but its state is preserved.\n * @default true\n */\n isVisible?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"KeywordSearchTypes.js","names":[],"sources":["KeywordSearchTypes.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectTypeDefinition, PropertyKeys } from \"@osdk/api\";\n\nimport type {\n BaseFilterState,\n FilterDefinitionControls,\n} from \"../FilterListItemApi.js\";\n\n/**\n * Keys of string properties on an object type\n */\nexport type StringPropertyKeys<Q extends ObjectTypeDefinition> =\n PropertyKeys.Filtered<Q, \"string\">;\n\n/**\n * State for keyword search filter\n */\nexport interface KeywordSearchFilterState extends BaseFilterState {\n type: \"keywordSearch\";\n searchTerm: string;\n /**\n * How multiple terms are combined\n * - \"AND\": All terms must match\n * - \"OR\": Any term must match\n */\n operator: \"AND\" | \"OR\";\n}\n\n/**\n * Filter definition for keyword search across string properties\n */\nexport interface KeywordSearchFilterDefinition<\n Q extends ObjectTypeDefinition,\n K extends StringPropertyKeys<Q> = StringPropertyKeys<Q>,\n> extends FilterDefinitionControls {\n type: \"KEYWORD_SEARCH\";\n /**\n * Properties to search within\n * - \"all\": Search all string properties\n * - K[]: Search specific string properties\n */\n properties: \"all\" | K[];\n label?: string;\n /**\n * Seeds the filter's state on mount, FilterList owns the state from then on\n *\n * @default undefined (filter starts empty)\n */\n defaultFilterState?: KeywordSearchFilterState;\n\n /**\n * @deprecated Has no effect, remove it.\n */\n filterState?: KeywordSearchFilterState;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"LinkedFilterTypes.js","names":["EMPTY_LINKED_FILTERS"],"sources":["LinkedFilterTypes.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n LinkedType,\n LinkNames,\n ObjectTypeDefinition,\n PropertyKeys,\n WhereClause,\n} from \"@osdk/api\";\nimport type { ReactNode } from \"react\";\n\nimport type {\n BaseFilterState,\n FilterDefinitionControls,\n FilterState,\n FilterStateByComponentType,\n PropertyTypeFromKey,\n ValidComponentsForPropertyType,\n} from \"../FilterListItemApi.js\";\n\n/**\n * Runtime representation of an active linked-property filter. Each entry\n * binds a `linkName` to its `reverseLinkName` and an `innerWhere` typed\n * against the linked object type, so `narrowObjectSet` can pivot type-safely.\n */\nexport type LinkedFilter<Q extends ObjectTypeDefinition> = {\n [L in LinkNames<Q>]: {\n linkName: L;\n reverseLinkName: LinkNames<LinkedType<Q, L>>;\n innerWhere: WhereClause<LinkedType<Q, L>>;\n };\n}[LinkNames<Q>];\n\n/** Shared empty default for `LinkedFilter` arrays — avoids new-array-per-render. */\nexport const EMPTY_LINKED_FILTERS: readonly never[] = [];\n\n/**\n * State for \"has link\" filter\n */\nexport interface HasLinkFilterState extends BaseFilterState {\n type: \"hasLink\";\n hasLink: boolean;\n}\n\n/**\n * State for linked property filter\n * Wraps the filter state of the linked property\n */\nexport interface LinkedPropertyFilterState<\n S extends FilterState = FilterState,\n> extends BaseFilterState {\n type: \"linkedProperty\";\n linkedFilterState: S;\n}\n\n/**\n * Filter definition for \"Has Link\" filter\n * Filters objects based on whether they have any linked objects of the specified type\n */\nexport interface HasLinkFilterDefinition<\n Q extends ObjectTypeDefinition,\n L extends LinkNames<Q> = LinkNames<Q>,\n> extends FilterDefinitionControls {\n type: \"HAS_LINK\";\n /**\n * Optional unique identifier for stable keying across filter reorders.\n */\n id?: string;\n linkName: L;\n label?: string;\n filterState: HasLinkFilterState;\n defaultFilterState?: HasLinkFilterState;\n /**\n * Controls whether this filter is rendered.\n * When false, the filter is hidden but its state is preserved.\n * @default true\n */\n isVisible?: boolean;\n}\n\n/**\n * Filter definition for filtering on a property of linked objects\n */\nexport interface LinkedPropertyFilterDefinition<\n Q extends ObjectTypeDefinition,\n L extends LinkNames<Q>,\n LinkedQ extends ObjectTypeDefinition = LinkedType<Q, L>,\n LinkedK extends PropertyKeys<LinkedQ> = PropertyKeys<LinkedQ>,\n LinkedC extends ValidComponentsForPropertyType<\n PropertyTypeFromKey<LinkedQ, LinkedK>\n > = ValidComponentsForPropertyType<PropertyTypeFromKey<LinkedQ, LinkedK>>,\n> extends FilterDefinitionControls {\n type: \"LINKED_PROPERTY\";\n /**\n * Optional unique identifier for stable keying across filter reorders.\n */\n id?: string;\n linkName: L;\n /**\n * Set this to make the filter narrow `objectSet`; the result is emitted\n * via `onEffectiveObjectSet`. The value names the link on the linked\n * object type that points back to `Q` (the inverse of `linkName`).\n *\n * Leave unset to keep the filter UI-only. It still renders and fires\n * `onFilterStateChanged`, but FilterList won't narrow on it.\n */\n reverseLinkName?: LinkNames<LinkedQ>;\n linkedPropertyKey: LinkedK;\n\n /**\n * The filter component to render for the linked property. Must be\n * compatible with the linked property's type, see\n * ValidComponentsForPropertyType.\n *\n * Required in practice — a definition that sets neither this nor\n * `linkedFilterComponent` renders as unsupported.\n */\n // TODO: make this required, and drop the note above, when\n // `linkedFilterComponent` is removed.\n filterComponent?: LinkedC;\n\n /**\n * @deprecated Rename to `filterComponent`.\n */\n linkedFilterComponent?: LinkedC;\n\n /**\n * Seeds the state of the filter on the *linked* property. FilterList owns the\n * state from then on. `onFilterStateChanged` fires with the wrapper.\n *\n * @default undefined (filter starts empty)\n */\n defaultFilterState?: FilterStateByComponentType[LinkedC];\n\n /**\n * @deprecated Rename to `defaultFilterState`.\n */\n defaultLinkedFilterState?: FilterStateByComponentType[LinkedC];\n\n /**\n * @deprecated Has no effect, remove it.\n */\n linkedFilterState?: FilterStateByComponentType[LinkedC];\n\n /**\n * @deprecated Has no effect, remove it.\n */\n filterState?: LinkedPropertyFilterState<FilterStateByComponentType[LinkedC]>;\n\n label?: string;\n\n /**\n * Show aggregation counts next to filter option values.\n * Applies to LISTOGRAM, SINGLE_SELECT, and MULTI_SELECT linked components.\n * @default true for LISTOGRAM and MULTI_SELECT, false for SINGLE_SELECT\n */\n showCount?: boolean;\n\n /**\n * Custom display function for filter values.\n * Replaces the default string display in dropdown items, chips, and listogram rows.\n * When the function returns a string, that string is also used for search matching\n * within filter dropdowns. When it returns a non-string `ReactNode`, search falls\n * back to the raw value.\n */\n renderValue?: (value: string) => ReactNode;\n\n /**\n * Controls whether this filter is rendered.\n * When false, the filter is hidden but its state is preserved.\n * @default true\n */\n isVisible?: boolean;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;;AASA;AACA,OAAO,MAAMA,oBAAsC,GAAG,EAAE;;AAExD;AACA;AACA;;AAMA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;;AAsBA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"LinkedFilterTypes.js","names":["EMPTY_LINKED_FILTERS"],"sources":["LinkedFilterTypes.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n LinkedType,\n LinkNames,\n ObjectTypeDefinition,\n PropertyKeys,\n WhereClause,\n} from \"@osdk/api\";\nimport type { ReactNode } from \"react\";\n\nimport type {\n BaseFilterState,\n FilterDefinitionControls,\n FilterState,\n FilterStateByComponentType,\n PropertyTypeFromKey,\n ValidComponentsForPropertyType,\n} from \"../FilterListItemApi.js\";\n\n/**\n * Runtime representation of an active linked-property filter. Each entry\n * binds a `linkName` to its `reverseLinkName` and an `innerWhere` typed\n * against the linked object type, so `narrowObjectSet` can pivot type-safely.\n */\nexport type LinkedFilter<Q extends ObjectTypeDefinition> = {\n [L in LinkNames<Q>]: {\n linkName: L;\n reverseLinkName: LinkNames<LinkedType<Q, L>>;\n innerWhere: WhereClause<LinkedType<Q, L>>;\n };\n}[LinkNames<Q>];\n\n/** Shared empty default for `LinkedFilter` arrays — avoids new-array-per-render. */\nexport const EMPTY_LINKED_FILTERS: readonly never[] = [];\n\n/**\n * State for \"has link\" filter\n */\nexport interface HasLinkFilterState extends BaseFilterState {\n type: \"hasLink\";\n hasLink: boolean;\n}\n\n/**\n * State for linked property filter\n * Wraps the filter state of the linked property\n */\nexport interface LinkedPropertyFilterState<\n S extends FilterState = FilterState,\n> extends BaseFilterState {\n type: \"linkedProperty\";\n linkedFilterState: S;\n}\n\n/**\n * Filter definition for \"Has Link\" filter\n * Filters objects based on whether they have any linked objects of the specified type\n */\nexport interface HasLinkFilterDefinition<\n Q extends ObjectTypeDefinition,\n L extends LinkNames<Q> = LinkNames<Q>,\n> extends FilterDefinitionControls {\n type: \"HAS_LINK\";\n linkName: L;\n label?: string;\n\n /**\n * Seeds the filter's state on mount, FilterList owns the state from then on\n *\n * @default undefined (filter starts empty)\n */\n defaultFilterState?: HasLinkFilterState;\n\n /**\n * @deprecated Has no effect, remove it.\n */\n filterState?: HasLinkFilterState;\n}\n\n/**\n * Filter definition for filtering on a property of linked objects\n */\nexport interface LinkedPropertyFilterDefinition<\n Q extends ObjectTypeDefinition,\n L extends LinkNames<Q>,\n LinkedQ extends ObjectTypeDefinition = LinkedType<Q, L>,\n LinkedK extends PropertyKeys<LinkedQ> = PropertyKeys<LinkedQ>,\n LinkedC extends ValidComponentsForPropertyType<\n PropertyTypeFromKey<LinkedQ, LinkedK>\n > = ValidComponentsForPropertyType<PropertyTypeFromKey<LinkedQ, LinkedK>>,\n> extends FilterDefinitionControls {\n type: \"LINKED_PROPERTY\";\n linkName: L;\n /**\n * Set this to make the filter narrow `objectSet`; the result is emitted\n * via `onEffectiveObjectSet`. The value names the link on the linked\n * object type that points back to `Q` (the inverse of `linkName`).\n *\n * Leave unset to keep the filter UI-only. It still renders and fires\n * `onFilterStateChanged`, but FilterList won't narrow on it.\n */\n reverseLinkName?: LinkNames<LinkedQ>;\n linkedPropertyKey: LinkedK;\n\n /**\n * The filter component to render for the linked property. Must be\n * compatible with the linked property's type, see\n * ValidComponentsForPropertyType.\n *\n * Required in practice — a definition that sets neither this nor\n * `linkedFilterComponent` renders as unsupported.\n */\n // TODO: make this required, and drop the note above, when\n // `linkedFilterComponent` is removed.\n filterComponent?: LinkedC;\n\n /**\n * @deprecated Rename to `filterComponent`.\n */\n linkedFilterComponent?: LinkedC;\n\n /**\n * Seeds the state of the filter on the *linked* property. FilterList owns the\n * state from then on. `onFilterStateChanged` fires with the wrapper.\n *\n * @default undefined (filter starts empty)\n */\n defaultFilterState?: FilterStateByComponentType[LinkedC];\n\n /**\n * @deprecated Rename to `defaultFilterState`.\n */\n defaultLinkedFilterState?: FilterStateByComponentType[LinkedC];\n\n /**\n * @deprecated Has no effect, remove it.\n */\n linkedFilterState?: FilterStateByComponentType[LinkedC];\n\n /**\n * @deprecated Has no effect, remove it.\n */\n filterState?: LinkedPropertyFilterState<FilterStateByComponentType[LinkedC]>;\n\n label?: string;\n\n /**\n * Show aggregation counts next to filter option values.\n * Applies to LISTOGRAM, SINGLE_SELECT, and MULTI_SELECT linked components.\n * @default true for LISTOGRAM and MULTI_SELECT, false for SINGLE_SELECT\n */\n showCount?: boolean;\n\n /**\n * Custom display function for filter values.\n * Replaces the default string display in dropdown items, chips, and listogram rows.\n * When the function returns a string, that string is also used for search matching\n * within filter dropdowns. When it returns a non-string `ReactNode`, search falls\n * back to the raw value.\n */\n renderValue?: (value: string) => ReactNode;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;;AASA;AACA,OAAO,MAAMA,oBAAsC,GAAG,EAAE;;AAExD;AACA;AACA;;AAMA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;;AAsBA;AACA;AACA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"StaticValuesTypes.js","names":[],"sources":["StaticValuesTypes.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectTypeDefinition, WhereClause } from \"@osdk/api\";\nimport type { ReactNode } from \"react\";\n\nimport type {\n FilterDefinitionControls,\n FilterState,\n FilterStateByComponentType,\n} from \"../FilterListItemApi.js\";\n\n/**\n * Component types that support static values.\n * These components can display a fixed list of string values without OSDK aggregation.\n */\nexport type StaticValuesComponentType =\n | \"LISTOGRAM\"\n | \"SINGLE_SELECT\"\n | \"MULTI_SELECT\"\n | \"TEXT_TAGS\";\n\n/**\n * Filter definition for static (non-OSDK) value lists.\n * Renders built-in filter components with user-provided values instead of\n * fetching values via OSDK aggregation queries.\n */\nexport interface StaticValuesFilterDefinition<\n Q extends ObjectTypeDefinition,\n C extends StaticValuesComponentType = StaticValuesComponentType,\n> extends FilterDefinitionControls {\n type: \"STATIC_VALUES\";\n\n /**\n * Optional unique identifier for stable keying across filter reorders.\n * If provided, takes precedence over `key` for state keying.\n */\n id?: string;\n\n /**\n * Key used for state management and auto WHERE clause generation.\n * When `toWhereClause` is not provided, this is used as the property key\n * in the generated WHERE clause.\n */\n key: string;\n\n /**\n * Display label for the filter\n */\n label?: string;\n\n /**\n * The filter component type to render\n */\n filterComponent: C;\n\n /**\n * The current state of the filter\n */\n filterState: FilterStateByComponentType[C];\n\n /**\n * The static list of values to display in the filter component.\n * These are rendered directly without OSDK aggregation.\n */\n values: string[];\n\n /**\n * Custom display function for filter values.\n * Replaces the default string display in dropdown items, chips, and listogram rows.\n * When the function returns a string, that string is also used for search matching\n * within filter dropdowns. When it returns a non-string `ReactNode`, search falls\n * back to the raw value.\n */\n renderValue?: (value: string) => ReactNode;\n\n /**\n * Show aggregation counts next to filter option values.\n * Applies to LISTOGRAM, SINGLE_SELECT, and MULTI_SELECT components.\n * @default true for LISTOGRAM and MULTI_SELECT, false for SINGLE_SELECT\n */\n showCount?: boolean;\n\n /**\n * Maps filter values to colors for visual differentiation.\n * Used by LISTOGRAM (per-row bar colors).\n */\n colorMap?: Record<string, string>;\n\n /**\n * Configuration for LISTOGRAM display mode.\n * Only applies when filterComponent is \"LISTOGRAM\".\n */\n listogramConfig?: {\n displayMode?: \"full\" | \"count\" | \"minimal\";\n /**\n * Number of items shown before \"View all\" link appears\n * @default 5\n */\n maxVisibleItems?: number;\n };\n\n /**\n * Optional custom WHERE clause generator.\n * When provided, this is used instead of auto-generating a WHERE clause\n * from the `key` and filter state.\n */\n toWhereClause?: (state: FilterState) => WhereClause<Q> | undefined;\n\n /**\n * Controls whether this filter is rendered.\n * When false, the filter is hidden but its state is preserved.\n * @default true\n */\n isVisible?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"StaticValuesTypes.js","names":[],"sources":["StaticValuesTypes.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectTypeDefinition, WhereClause } from \"@osdk/api\";\nimport type { ReactNode } from \"react\";\n\nimport type {\n FilterDefinitionControls,\n FilterState,\n FilterStateByComponentType,\n} from \"../FilterListItemApi.js\";\n\n/**\n * Component types that support static values.\n * These components can display a fixed list of string values without OSDK aggregation.\n */\nexport type StaticValuesComponentType =\n | \"LISTOGRAM\"\n | \"SINGLE_SELECT\"\n | \"MULTI_SELECT\"\n | \"TEXT_TAGS\";\n\n/**\n * Filter definition for static (non-OSDK) value lists.\n * Renders built-in filter components with user-provided values instead of\n * fetching values via OSDK aggregation queries.\n */\nexport interface StaticValuesFilterDefinition<\n Q extends ObjectTypeDefinition,\n C extends StaticValuesComponentType = StaticValuesComponentType,\n> extends FilterDefinitionControls {\n type: \"STATIC_VALUES\";\n\n /**\n * Key used for state management and auto WHERE clause generation.\n * When `toWhereClause` is not provided, this is used as the property key\n * in the generated WHERE clause.\n */\n key: string;\n\n /**\n * Display label for the filter\n */\n label?: string;\n\n /**\n * The filter component type to render\n */\n filterComponent: C;\n\n /**\n * Seeds the filter's state on mount, FilterList owns the state from then on\n *\n * @default undefined (filter starts empty)\n */\n defaultFilterState?: FilterStateByComponentType[C];\n\n /**\n * @deprecated Rename to `defaultFilterState`.\n */\n filterState?: FilterStateByComponentType[C];\n\n /**\n * The static list of values to display in the filter component.\n * These are rendered directly without OSDK aggregation.\n */\n values: string[];\n\n /**\n * Custom display function for filter values.\n * Replaces the default string display in dropdown items, chips, and listogram rows.\n * When the function returns a string, that string is also used for search matching\n * within filter dropdowns. When it returns a non-string `ReactNode`, search falls\n * back to the raw value.\n */\n renderValue?: (value: string) => ReactNode;\n\n /**\n * Show aggregation counts next to filter option values.\n * Applies to LISTOGRAM, SINGLE_SELECT, and MULTI_SELECT components.\n * @default true for LISTOGRAM and MULTI_SELECT, false for SINGLE_SELECT\n */\n showCount?: boolean;\n\n /**\n * Maps filter values to colors for visual differentiation.\n * Used by LISTOGRAM (per-row bar colors).\n */\n colorMap?: Record<string, string>;\n\n /**\n * Configuration for LISTOGRAM display mode.\n * Only applies when filterComponent is \"LISTOGRAM\".\n */\n listogramConfig?: {\n displayMode?: \"full\" | \"count\" | \"minimal\";\n /**\n * Number of items shown before \"View all\" link appears\n * @default 5\n */\n maxVisibleItems?: number;\n };\n\n /**\n * Optional custom WHERE clause generator.\n * When provided, this is used instead of auto-generating a WHERE clause\n * from the `key` and filter state.\n */\n toWhereClause?: (state: FilterState) => WhereClause<Q> | undefined;\n}\n"],"mappings":"","ignoreList":[]}