@osdk/react-components 0.2.0-beta.25 → 0.2.0-beta.27

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 (107) hide show
  1. package/AGENTS.md +1 -0
  2. package/CHANGELOG.md +28 -0
  3. package/build/browser/action-form/ActionForm.js +15 -11
  4. package/build/browser/action-form/ActionForm.js.map +1 -1
  5. package/build/browser/action-form/FormFieldApi.js.map +1 -1
  6. package/build/browser/action-form/fields/CustomField.js +30 -0
  7. package/build/browser/action-form/fields/CustomField.js.map +1 -0
  8. package/build/browser/action-form/fields/FormFieldRenderer.js +13 -21
  9. package/build/browser/action-form/fields/FormFieldRenderer.js.map +1 -1
  10. package/build/browser/action-form/fields/RadioButtonsField.js +1 -1
  11. package/build/browser/action-form/fields/RadioButtonsField.js.map +1 -1
  12. package/build/browser/action-form/utils/getDefaultFieldDefinitions.js +97 -10
  13. package/build/browser/action-form/utils/getDefaultFieldDefinitions.js.map +1 -1
  14. package/build/browser/base-components/dialog/Dialog.js +4 -2
  15. package/build/browser/base-components/dialog/Dialog.js.map +1 -1
  16. package/build/browser/object-table/ObjectTableApi.js.map +1 -1
  17. package/build/browser/object-table/hooks/useFunctionColumnsData.js +57 -192
  18. package/build/browser/object-table/hooks/useFunctionColumnsData.js.map +1 -1
  19. package/build/browser/pdf-viewer/PdfViewer.js +10 -5
  20. package/build/browser/pdf-viewer/PdfViewer.js.map +1 -1
  21. package/build/browser/pdf-viewer/PdfViewerContext.js +108 -0
  22. package/build/browser/pdf-viewer/PdfViewerContext.js.map +1 -0
  23. package/build/browser/pdf-viewer/hooks/usePdfFormFields.js +26 -11
  24. package/build/browser/pdf-viewer/hooks/usePdfFormFields.js.map +1 -1
  25. package/build/browser/pdf-viewer/hooks/usePdfHighlightMode.js +29 -1
  26. package/build/browser/pdf-viewer/hooks/usePdfHighlightMode.js.map +1 -1
  27. package/build/browser/pdf-viewer/hooks/usePdfViewerCore.js +3 -3
  28. package/build/browser/pdf-viewer/hooks/usePdfViewerCore.js.map +1 -1
  29. package/build/browser/pdf-viewer/hooks/usePdfViewerSearch.js +3 -3
  30. package/build/browser/pdf-viewer/hooks/usePdfViewerSearch.js.map +1 -1
  31. package/build/browser/pdf-viewer/hooks/usePdfViewerState.js +3 -3
  32. package/build/browser/pdf-viewer/hooks/usePdfViewerState.js.map +1 -1
  33. package/build/browser/pdf-viewer/types.js.map +1 -1
  34. package/build/browser/public/experimental.js +2 -0
  35. package/build/browser/public/experimental.js.map +1 -1
  36. package/build/cjs/{chunk-GT6IV6LV.cjs → chunk-MRRRZN44.cjs} +6 -4
  37. package/build/cjs/chunk-MRRRZN44.cjs.map +1 -0
  38. package/build/cjs/public/experimental.cjs +1384 -1343
  39. package/build/cjs/public/experimental.cjs.map +1 -1
  40. package/build/cjs/public/experimental.d.cts +115 -8
  41. package/build/cjs/public/primitives.cjs +5 -5
  42. package/build/cjs/public/primitives.d.cts +3 -2
  43. package/build/esm/action-form/ActionForm.js +15 -11
  44. package/build/esm/action-form/ActionForm.js.map +1 -1
  45. package/build/esm/action-form/FormFieldApi.js.map +1 -1
  46. package/build/esm/action-form/fields/CustomField.js +30 -0
  47. package/build/esm/action-form/fields/CustomField.js.map +1 -0
  48. package/build/esm/action-form/fields/FormFieldRenderer.js +13 -21
  49. package/build/esm/action-form/fields/FormFieldRenderer.js.map +1 -1
  50. package/build/esm/action-form/fields/RadioButtonsField.js +1 -1
  51. package/build/esm/action-form/fields/RadioButtonsField.js.map +1 -1
  52. package/build/esm/action-form/utils/getDefaultFieldDefinitions.js +97 -10
  53. package/build/esm/action-form/utils/getDefaultFieldDefinitions.js.map +1 -1
  54. package/build/esm/base-components/dialog/Dialog.js +4 -2
  55. package/build/esm/base-components/dialog/Dialog.js.map +1 -1
  56. package/build/esm/object-table/ObjectTableApi.js.map +1 -1
  57. package/build/esm/object-table/hooks/useFunctionColumnsData.js +57 -192
  58. package/build/esm/object-table/hooks/useFunctionColumnsData.js.map +1 -1
  59. package/build/esm/pdf-viewer/PdfViewer.js +10 -5
  60. package/build/esm/pdf-viewer/PdfViewer.js.map +1 -1
  61. package/build/esm/pdf-viewer/PdfViewerContext.js +108 -0
  62. package/build/esm/pdf-viewer/PdfViewerContext.js.map +1 -0
  63. package/build/esm/pdf-viewer/hooks/usePdfFormFields.js +26 -11
  64. package/build/esm/pdf-viewer/hooks/usePdfFormFields.js.map +1 -1
  65. package/build/esm/pdf-viewer/hooks/usePdfHighlightMode.js +29 -1
  66. package/build/esm/pdf-viewer/hooks/usePdfHighlightMode.js.map +1 -1
  67. package/build/esm/pdf-viewer/hooks/usePdfViewerCore.js +3 -3
  68. package/build/esm/pdf-viewer/hooks/usePdfViewerCore.js.map +1 -1
  69. package/build/esm/pdf-viewer/hooks/usePdfViewerSearch.js +3 -3
  70. package/build/esm/pdf-viewer/hooks/usePdfViewerSearch.js.map +1 -1
  71. package/build/esm/pdf-viewer/hooks/usePdfViewerState.js +3 -3
  72. package/build/esm/pdf-viewer/hooks/usePdfViewerState.js.map +1 -1
  73. package/build/esm/pdf-viewer/types.js.map +1 -1
  74. package/build/esm/public/experimental.js +2 -0
  75. package/build/esm/public/experimental.js.map +1 -1
  76. package/build/types/action-form/FormFieldApi.d.ts +3 -3
  77. package/build/types/action-form/FormFieldApi.d.ts.map +1 -1
  78. package/build/types/action-form/fields/CustomField.d.ts +9 -0
  79. package/build/types/action-form/fields/CustomField.d.ts.map +1 -0
  80. package/build/types/action-form/fields/FormFieldRenderer.d.ts.map +1 -1
  81. package/build/types/action-form/fields/RadioButtonsField.d.ts +2 -2
  82. package/build/types/action-form/fields/RadioButtonsField.d.ts.map +1 -1
  83. package/build/types/action-form/utils/getDefaultFieldDefinitions.d.ts +7 -4
  84. package/build/types/action-form/utils/getDefaultFieldDefinitions.d.ts.map +1 -1
  85. package/build/types/base-components/dialog/Dialog.d.ts +3 -2
  86. package/build/types/base-components/dialog/Dialog.d.ts.map +1 -1
  87. package/build/types/object-table/ObjectTableApi.d.ts +4 -3
  88. package/build/types/object-table/ObjectTableApi.d.ts.map +1 -1
  89. package/build/types/object-table/hooks/useFunctionColumnsData.d.ts.map +1 -1
  90. package/build/types/pdf-viewer/PdfViewer.d.ts +2 -2
  91. package/build/types/pdf-viewer/PdfViewer.d.ts.map +1 -1
  92. package/build/types/pdf-viewer/PdfViewerContext.d.ts +64 -0
  93. package/build/types/pdf-viewer/PdfViewerContext.d.ts.map +1 -0
  94. package/build/types/pdf-viewer/hooks/usePdfHighlightMode.d.ts +1 -0
  95. package/build/types/pdf-viewer/hooks/usePdfHighlightMode.d.ts.map +1 -1
  96. package/build/types/pdf-viewer/types.d.ts +47 -0
  97. package/build/types/pdf-viewer/types.d.ts.map +1 -1
  98. package/build/types/public/experimental.d.ts +2 -0
  99. package/build/types/public/experimental.d.ts.map +1 -1
  100. package/package.json +9 -9
  101. package/build/browser/action-form/utils/getDefaultFieldComponent.js +0 -56
  102. package/build/browser/action-form/utils/getDefaultFieldComponent.js.map +0 -1
  103. package/build/cjs/chunk-GT6IV6LV.cjs.map +0 -1
  104. package/build/esm/action-form/utils/getDefaultFieldComponent.js +0 -56
  105. package/build/esm/action-form/utils/getDefaultFieldComponent.js.map +0 -1
  106. package/build/types/action-form/utils/getDefaultFieldComponent.d.ts +0 -6
  107. package/build/types/action-form/utils/getDefaultFieldComponent.d.ts.map +0 -1
package/AGENTS.md CHANGED
@@ -23,3 +23,4 @@ Before using any component, read the relevant doc:
23
23
  - **Setup & installation**: Read [README.md](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/README.md) for provider, CSS layers, and peer dependencies
24
24
  - **ObjectTable**: Read [docs/ObjectTable.md](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/ObjectTable.md) for props, column definitions, examples, theming, and troubleshooting
25
25
  - **PdfViewer**: Read [docs/PdfViewer.md](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/PdfViewer.md) for props, annotations, building blocks, hooks, examples, and theming
26
+ - **FilterList**: Read [docs/FilterList.md](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/FilterList.md) for props, examples, and usage
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @osdk/react-components
2
2
 
3
+ ## 0.2.0-beta.27
4
+
5
+ ### Minor Changes
6
+
7
+ - 32c27d7: Added useOsdkFunctions to @osdk/react to execute multiple functions in parallel. This is used by ObjectTable to fetch function-backed columns
8
+ - 6019278: auto-compute peer dependency ranges from changelog history for react and react-components
9
+
10
+ ## 0.2.0-beta.26
11
+
12
+ ### Minor Changes
13
+
14
+ - 8eea31b: feat(pdf): pdf viewer recipes + fixed for form fields
15
+ - c3da451: add marking button, category group, and validation components for CBAC picker
16
+ - 073a5b1: Add ESLint rules for code quality, React best practices, and JSX accessibility
17
+ - 82573b8: Pin react-day-picker to 9.1.0
18
+ - 66b7125: Add RadioButtonsField component for action form radio button inputs
19
+ - 6ec2110: Add CustomField component for user-defined field renderers in ActionForm
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [520398c]
24
+ - Updated dependencies [ffc6efe]
25
+ - Updated dependencies [4a856cb]
26
+ - Updated dependencies [b0930e4]
27
+ - @osdk/client@2.8.0-beta.29
28
+ - @osdk/api@2.8.0-beta.29
29
+ - @osdk/react@0.10.0-beta.14
30
+
3
31
  ## 0.2.0-beta.25
4
32
 
5
33
  ### Minor Changes
@@ -53,17 +53,21 @@ export const ActionForm = typedReactMemo(function ({
53
53
  }
54
54
  }, [metadataError, onError]);
55
55
  const parameters = metadata?.parameters;
56
- const resolvedFieldDefinitions = useMemo(() => formFieldDefinitions ?? (metadata != null ? getDefaultFieldDefinitions(metadata) : EMPTY_FIELD_DEFINITIONS), [formFieldDefinitions, metadata]);
57
- const rendererFieldDefinitions = useMemo(() =>
58
- // RendererFieldDefinition is a discriminated union keyed by fieldComponent.
59
- // TypeScript can't verify that the spread preserves the fieldComponent ↔
60
- // fieldComponentProps pairing, but FormFieldDefinition guarantees it.
61
- resolvedFieldDefinitions.map(def => ({
62
- ...def,
63
- fieldKey: String(def.fieldKey),
64
- fieldType: parameters?.[String(def.fieldKey)]?.type,
65
- defaultValue: def.defaultValue
66
- })), [resolvedFieldDefinitions, parameters]);
56
+ const customFieldDefinitions = useMemo(() => {
57
+ if (formFieldDefinitions == null) {
58
+ return null;
59
+ }
60
+ // RendererFieldDefinition is a discriminated union keyed by fieldComponent.
61
+ // TypeScript can't verify that the spread preserves the fieldComponent ↔
62
+ // fieldComponentProps pairing, but FormFieldDefinition guarantees it.
63
+ return formFieldDefinitions.map(def => ({
64
+ ...def,
65
+ fieldKey: String(def.fieldKey),
66
+ fieldType: parameters?.[String(def.fieldKey)]?.type,
67
+ defaultValue: def.defaultValue
68
+ }));
69
+ }, [formFieldDefinitions, parameters]);
70
+ const rendererFieldDefinitions = useMemo(() => customFieldDefinitions ?? (metadata != null ? getDefaultFieldDefinitions(metadata) : EMPTY_FIELD_DEFINITIONS), [customFieldDefinitions, metadata]);
67
71
  const coerceFormState = useCallback(rawState => {
68
72
  const coerced = {};
69
73
  for (const [key, value] of Object.entries(rawState)) {
@@ -1 +1 @@
1
- {"version":3,"file":"ActionForm.js","names":["useOsdkMetadata","useOsdkAction","React","useCallback","useEffect","useMemo","typedReactMemo","BaseForm","coerceFieldValue","getDefaultFieldDefinitions","EMPTY_FIELD_DEFINITIONS","ActionForm","actionDefinition","formTitle","formFieldDefinitions","formState","controlledFormState","onFormStateChange","isSubmitDisabled","onSubmit","onValidationResponse","_onValidationResponse","onSuccess","onError","applyAction","osdkApplyAction","isPending","metadata","loading","metadataLoading","error","metadataError","type","parameters","resolvedFieldDefinitions","rendererFieldDefinitions","map","def","fieldKey","String","fieldType","defaultValue","coerceFormState","rawState","coerced","key","value","Object","entries","handleSubmit","rawFormState","result","e","handleFieldValueChange","prev","resolvedTitle","displayName","apiName","commonProps","fieldDefinitions","isLoading","onFieldValueChange","createElement","_extends"],"sources":["ActionForm.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 { ActionDefinition } from \"@osdk/api\";\nimport { useOsdkMetadata } from \"@osdk/react\";\nimport { useOsdkAction } from \"@osdk/react/experimental\";\nimport React, { useCallback, useEffect, useMemo } from \"react\";\nimport { typedReactMemo } from \"../shared/typedMemo.js\";\nimport type { ActionFormProps, FormState } from \"./ActionFormApi.js\";\nimport { BaseForm } from \"./BaseForm.js\";\nimport type { RendererFieldDefinition } from \"./FormFieldApi.js\";\nimport { coerceFieldValue } from \"./utils/coerceFieldValue.js\";\nimport { getDefaultFieldDefinitions } from \"./utils/getDefaultFieldDefinitions.js\";\n\nconst EMPTY_FIELD_DEFINITIONS: readonly [] = [];\n\nexport const ActionForm: <Q extends ActionDefinition<unknown>>(\n props: ActionFormProps<Q>,\n) => React.ReactElement = typedReactMemo(function ActionFormFn<\n Q extends ActionDefinition<unknown>,\n>({\n actionDefinition,\n formTitle,\n formFieldDefinitions,\n formState: controlledFormState,\n onFormStateChange,\n isSubmitDisabled,\n onSubmit,\n onValidationResponse: _onValidationResponse,\n onSuccess,\n onError,\n}: ActionFormProps<Q>): React.ReactElement {\n const { applyAction: osdkApplyAction, isPending } = useOsdkAction(\n actionDefinition,\n );\n const {\n metadata,\n loading: metadataLoading,\n error: metadataError,\n } = useOsdkMetadata(actionDefinition);\n\n useEffect(\n function saveMetadataError() {\n if (metadataError != null) {\n onError?.({ type: \"unknown\", error: metadataError });\n }\n },\n [metadataError, onError],\n );\n\n const parameters = metadata?.parameters;\n\n const resolvedFieldDefinitions = useMemo(\n () =>\n formFieldDefinitions\n ?? (metadata != null\n ? getDefaultFieldDefinitions<Q>(metadata)\n : EMPTY_FIELD_DEFINITIONS),\n [formFieldDefinitions, metadata],\n );\n\n const rendererFieldDefinitions: ReadonlyArray<RendererFieldDefinition> =\n useMemo(\n () =>\n // RendererFieldDefinition is a discriminated union keyed by fieldComponent.\n // TypeScript can't verify that the spread preserves the fieldComponent ↔\n // fieldComponentProps pairing, but FormFieldDefinition guarantees it.\n resolvedFieldDefinitions.map((def) =>\n ({\n ...def,\n fieldKey: String(def.fieldKey),\n fieldType: parameters?.[String(def.fieldKey)]?.type,\n defaultValue: def.defaultValue,\n }) as RendererFieldDefinition\n ),\n [resolvedFieldDefinitions, parameters],\n );\n\n const coerceFormState = useCallback(\n (rawState: Record<string, unknown>): Record<string, unknown> => {\n const coerced: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(rawState)) {\n coerced[key] = coerceFieldValue(parameters?.[key]?.type, value);\n }\n return coerced;\n },\n [parameters],\n );\n\n const handleSubmit = useCallback(\n async (rawFormState: Record<string, unknown>) => {\n const formState = coerceFormState(rawFormState) as FormState<Q>;\n try {\n if (onSubmit != null) {\n await onSubmit(formState, osdkApplyAction);\n } else {\n const result = await osdkApplyAction(formState);\n onSuccess?.(result);\n }\n } catch (e) {\n onError?.({ type: \"submission\", error: e });\n }\n },\n [coerceFormState, onSubmit, osdkApplyAction, onSuccess, onError],\n );\n\n const handleFieldValueChange = useCallback(\n (fieldKey: string, value: unknown) => {\n onFormStateChange?.(\n (prev) =>\n ({\n ...prev,\n [fieldKey]: value,\n }) as FormState<Q>,\n );\n },\n [onFormStateChange],\n );\n\n const resolvedTitle = formTitle ?? metadata?.displayName\n ?? actionDefinition.apiName;\n\n const isControlled = controlledFormState != null;\n\n const commonProps = {\n formTitle: resolvedTitle,\n fieldDefinitions: rendererFieldDefinitions,\n onSubmit: handleSubmit,\n isSubmitDisabled,\n isPending,\n isLoading: metadataLoading,\n onFieldValueChange: handleFieldValueChange,\n };\n\n if (!isControlled) {\n return <BaseForm {...commonProps} />;\n }\n\n return <BaseForm {...commonProps} formState={controlledFormState} />;\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,aAAa,QAAQ,0BAA0B;AACxD,OAAOC,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAC9D,SAASC,cAAc,QAAQ,wBAAwB;AAEvD,SAASC,QAAQ,QAAQ,eAAe;AAExC,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,0BAA0B,QAAQ,uCAAuC;AAElF,MAAMC,uBAAoC,GAAG,EAAE;AAE/C,OAAO,MAAMC,UAEU,GAAGL,cAAc,CAAC,UAEvC;EACAM,gBAAgB;EAChBC,SAAS;EACTC,oBAAoB;EACpBC,SAAS,EAAEC,mBAAmB;EAC9BC,iBAAiB;EACjBC,gBAAgB;EAChBC,QAAQ;EACRC,oBAAoB,EAAEC,qBAAqB;EAC3CC,SAAS;EACTC;AACkB,CAAC,EAAsB;EACzC,MAAM;IAAEC,WAAW,EAAEC,eAAe;IAAEC;EAAU,CAAC,GAAGzB,aAAa,CAC/DW,gBACF,CAAC;EACD,MAAM;IACJe,QAAQ;IACRC,OAAO,EAAEC,eAAe;IACxBC,KAAK,EAAEC;EACT,CAAC,GAAG/B,eAAe,CAACY,gBAAgB,CAAC;EAErCR,SAAS,CACP,YAA6B;IAC3B,IAAI2B,aAAa,IAAI,IAAI,EAAE;MACzBR,OAAO,GAAG;QAAES,IAAI,EAAE,SAAS;QAAEF,KAAK,EAAEC;MAAc,CAAC,CAAC;IACtD;EACF,CAAC,EACD,CAACA,aAAa,EAAER,OAAO,CACzB,CAAC;EAED,MAAMU,UAAU,GAAGN,QAAQ,EAAEM,UAAU;EAEvC,MAAMC,wBAAwB,GAAG7B,OAAO,CACtC,MACES,oBAAoB,KACda,QAAQ,IAAI,IAAI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MACV7B,OAAO,GAAG;QAAES,IAAI,EAAE,YAAY;QAAEF,KAAK,EAAEsB;MAAE,CAAC,CAAC;IAC7C;EACF,CAAC,EACD,CAACV,eAAe,EAAEvB,QAAQ,EAAEM,eAAe,EAAEH,SAAS,EAAEC,OAAO,CACjE,CAAC;EAED,MAAM8B,sBAAsB,GAAGlD,WAAW,CACxC,CAACmC,QAAgB,EAAEQ,KAAc,KAAK;IACpC7B,iBAAiB,GACdqC,IAAI,KACF;MACC,GAAGA,IAAI;MACP,CAAChB,QAAQ,GAAGQ;IACd,CAAC,CACL,CAAC;EACH,CAAC,EACD,CAAC7B,iBAAiB,CACpB,CAAC;EAED,MAAMsC,aAAa,GAAG1C,SAAS,IAAIc,QAAQ,EAAE6B,WAAW,IACnD5C,gBAAgB,CAAC6C,OAAO;EAI7B,MAAMC,WAAW,GAAG;IAClB7C,SAAS,EAAE0C,aAAa;IACxBI,gBAAgB,EAAExB,wBAAwB;IAC1ChB,QAAQ,EAAE8B,YAAY;IACtB/B,gBAAgB;IAChBQ,SAAS;IACTkC,SAAS,EAAE/B,eAAe;IAC1BgC,kBAAkB,EAAER;EACtB,CAAC;EAED,IAAI,EAZiBrC,mBAAmB,IAAI,IAAI,CAY/B,EAAE;IACjB,oBAAOd,KAAA,CAAA4D,aAAA,CAACvD,QAAQ,EAAKmD,WAAc,CAAC;EACtC;EAEA,oBAAOxD,KAAA,CAAA4D,aAAA,CAACvD,QAAQ,EAAAwD,QAAA,KAAKL,WAAW;IAAE3C,SAAS,EAAEC;EAAoB,EAAE,CAAC;AACtE,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ActionForm.js","names":["useOsdkMetadata","useOsdkAction","React","useCallback","useEffect","useMemo","typedReactMemo","BaseForm","coerceFieldValue","getDefaultFieldDefinitions","EMPTY_FIELD_DEFINITIONS","ActionForm","actionDefinition","formTitle","formFieldDefinitions","formState","controlledFormState","onFormStateChange","isSubmitDisabled","onSubmit","onValidationResponse","_onValidationResponse","onSuccess","onError","applyAction","osdkApplyAction","isPending","metadata","loading","metadataLoading","error","metadataError","type","parameters","customFieldDefinitions","map","def","fieldKey","String","fieldType","defaultValue","rendererFieldDefinitions","coerceFormState","rawState","coerced","key","value","Object","entries","handleSubmit","rawFormState","result","e","handleFieldValueChange","prev","resolvedTitle","displayName","apiName","commonProps","fieldDefinitions","isLoading","onFieldValueChange","createElement","_extends"],"sources":["ActionForm.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 { ActionDefinition } from \"@osdk/api\";\nimport { useOsdkMetadata } from \"@osdk/react\";\nimport { useOsdkAction } from \"@osdk/react/experimental\";\nimport React, { useCallback, useEffect, useMemo } from \"react\";\nimport { typedReactMemo } from \"../shared/typedMemo.js\";\nimport type { ActionFormProps, FormState } from \"./ActionFormApi.js\";\nimport { BaseForm } from \"./BaseForm.js\";\nimport type { RendererFieldDefinition } from \"./FormFieldApi.js\";\nimport { coerceFieldValue } from \"./utils/coerceFieldValue.js\";\nimport { getDefaultFieldDefinitions } from \"./utils/getDefaultFieldDefinitions.js\";\n\nconst EMPTY_FIELD_DEFINITIONS: readonly [] = [];\n\nexport const ActionForm: <Q extends ActionDefinition<unknown>>(\n props: ActionFormProps<Q>,\n) => React.ReactElement = typedReactMemo(function ActionFormFn<\n Q extends ActionDefinition<unknown>,\n>({\n actionDefinition,\n formTitle,\n formFieldDefinitions,\n formState: controlledFormState,\n onFormStateChange,\n isSubmitDisabled,\n onSubmit,\n onValidationResponse: _onValidationResponse,\n onSuccess,\n onError,\n}: ActionFormProps<Q>): React.ReactElement {\n const { applyAction: osdkApplyAction, isPending } = useOsdkAction(\n actionDefinition,\n );\n const {\n metadata,\n loading: metadataLoading,\n error: metadataError,\n } = useOsdkMetadata(actionDefinition);\n\n useEffect(\n function saveMetadataError() {\n if (metadataError != null) {\n onError?.({ type: \"unknown\", error: metadataError });\n }\n },\n [metadataError, onError],\n );\n\n const parameters = metadata?.parameters;\n\n const customFieldDefinitions: ReadonlyArray<RendererFieldDefinition> | null =\n useMemo(() => {\n if (formFieldDefinitions == null) {\n return null;\n }\n // RendererFieldDefinition is a discriminated union keyed by fieldComponent.\n // TypeScript can't verify that the spread preserves the fieldComponent ↔\n // fieldComponentProps pairing, but FormFieldDefinition guarantees it.\n return formFieldDefinitions.map(\n (def) =>\n ({\n ...def,\n fieldKey: String(def.fieldKey),\n fieldType: parameters?.[String(def.fieldKey)]?.type,\n defaultValue: def.defaultValue,\n }) as RendererFieldDefinition,\n );\n }, [formFieldDefinitions, parameters]);\n\n const rendererFieldDefinitions = useMemo(\n () =>\n customFieldDefinitions\n ?? (metadata != null\n ? getDefaultFieldDefinitions(metadata)\n : EMPTY_FIELD_DEFINITIONS),\n [customFieldDefinitions, metadata],\n );\n\n const coerceFormState = useCallback(\n (rawState: Record<string, unknown>): Record<string, unknown> => {\n const coerced: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(rawState)) {\n coerced[key] = coerceFieldValue(parameters?.[key]?.type, value);\n }\n return coerced;\n },\n [parameters],\n );\n\n const handleSubmit = useCallback(\n async (rawFormState: Record<string, unknown>) => {\n const formState = coerceFormState(rawFormState) as FormState<Q>;\n try {\n if (onSubmit != null) {\n await onSubmit(formState, osdkApplyAction);\n } else {\n const result = await osdkApplyAction(formState);\n onSuccess?.(result);\n }\n } catch (e) {\n onError?.({ type: \"submission\", error: e });\n }\n },\n [coerceFormState, onSubmit, osdkApplyAction, onSuccess, onError],\n );\n\n const handleFieldValueChange = useCallback(\n (fieldKey: string, value: unknown) => {\n onFormStateChange?.(\n (prev) =>\n ({\n ...prev,\n [fieldKey]: value,\n }) as FormState<Q>,\n );\n },\n [onFormStateChange],\n );\n\n const resolvedTitle = formTitle ?? metadata?.displayName\n ?? actionDefinition.apiName;\n\n const isControlled = controlledFormState != null;\n\n const commonProps = {\n formTitle: resolvedTitle,\n fieldDefinitions: rendererFieldDefinitions,\n onSubmit: handleSubmit,\n isSubmitDisabled,\n isPending,\n isLoading: metadataLoading,\n onFieldValueChange: handleFieldValueChange,\n };\n\n if (!isControlled) {\n return <BaseForm {...commonProps} />;\n }\n\n return <BaseForm {...commonProps} formState={controlledFormState} />;\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,aAAa,QAAQ,0BAA0B;AACxD,OAAOC,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAC9D,SAASC,cAAc,QAAQ,wBAAwB;AAEvD,SAASC,QAAQ,QAAQ,eAAe;AAExC,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,0BAA0B,QAAQ,uCAAuC;AAElF,MAAMC,uBAAoC,GAAG,EAAE;AAE/C,OAAO,MAAMC,UAEU,GAAGL,cAAc,CAAC,UAEvC;EACAM,gBAAgB;EAChBC,SAAS;EACTC,oBAAoB;EACpBC,SAAS,EAAEC,mBAAmB;EAC9BC,iBAAiB;EACjBC,gBAAgB;EAChBC,QAAQ;EACRC,oBAAoB,EAAEC,qBAAqB;EAC3CC,SAAS;EACTC;AACkB,CAAC,EAAsB;EACzC,MAAM;IAAEC,WAAW,EAAEC,eAAe;IAAEC;EAAU,CAAC,GAAGzB,aAAa,CAC/DW,gBACF,CAAC;EACD,MAAM;IACJe,QAAQ;IACRC,OAAO,EAAEC,eAAe;IACxBC,KAAK,EAAEC;EACT,CAAC,GAAG/B,eAAe,CAACY,gBAAgB,CAAC;E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D,QAAQ,EAAKmD,WAAc,CAAC;EACtC;EAEA,oBAAOxD,KAAA,CAAA4D,aAAA,CAACvD,QAAQ,EAAAwD,QAAA,KAAKL,WAAW;IAAE3C,SAAS,EAAEC;EAAoB,EAAE,CAAC;AACtE,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldApi.js","names":[],"sources":["FormFieldApi.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 ActionDefinition,\n ActionMetadata,\n ActionParam,\n CompileTimeMetadata,\n DataValueClientToWire,\n ObjectSet,\n ObjectTypeDefinition,\n} from \"@osdk/api\";\nimport type React from \"react\";\n\n/**\n * A form field definition specifies configuration for a single field\n */\nexport interface FormFieldDefinition<\n Q extends ActionDefinition<unknown>,\n K extends FieldKey<Q> = FieldKey<Q>,\n> {\n /**\n * The field's unique key\n */\n fieldKey: K;\n\n /**\n * Display label for the field\n * If not provided, the form field will not show any label.\n */\n label?: string;\n\n /**\n * Default value of the field\n */\n defaultValue?: FieldValueType<Q, K>;\n\n /**\n * The form field component type to render\n */\n fieldComponent: ValidFormFieldForPropertyType<FieldDescriptorType<Q, K>>;\n\n /**\n * Whether the field is required\n */\n isRequired?: boolean;\n\n /**\n * Placeholder text\n */\n placeholder?: string;\n\n /**\n * Additional information to display on this field\n * The placement of helper text depends on the value of helperTextPlacement prop\n */\n helperText?: string;\n\n /**\n * The placement of the helper text either below the field or in a tooltip\n *\n * @default \"tooltip\"\n */\n helperTextPlacement?: \"bottom\" | \"tooltip\";\n\n /**\n * Whether the field is disabled\n */\n isDisabled?: boolean;\n\n /**\n * A callback to return a custom error message if validation failed\n *\n * @param validationRule the validation rule that failed with the error message\n * @returns the error message to display\n */\n onValidationError?: (error: ValidationError) => string;\n\n /**\n * Additional function to validate the field\n *\n * @param value the current field value\n * @returns a boolean promise indicating whether the value is valid\n */\n validate?: (value: FieldValueType<Q, K>) => Promise<boolean>;\n\n /**\n * The component props for the form field\n * Excludes runtime props (key, onChange) which are managed by ActionForm\n */\n fieldComponentProps?: Omit<\n FormFieldPropsByType[\n ValidFormFieldForPropertyType<\n FieldDescriptorType<Q, K>\n >\n ],\n \"key\" | \"onChange\"\n >;\n}\n\ntype ValidationError = { type: ValidationRule; error: string };\n\ntype ValidationRule =\n | \"required\"\n | \"min\"\n | \"max\"\n | \"minLength\"\n | \"maxLength\"\n | \"pattern\"\n | \"validate\";\n\n/**\n * Maps field types to their corresponding props\n */\nexport interface FormFieldPropsByType {\n DATETIME_PICKER: DatetimePickerFieldProps;\n DROPDOWN: DropdownFieldProps<unknown, boolean>;\n FILE_PICKER: FilePickerProps;\n NUMBER_INPUT: NumberInputFieldProps;\n OBJECT_SET: ObjectSetFieldProps<ObjectTypeDefinition>;\n RADIO_BUTTONS: RadioButtonsFieldProps<unknown>;\n TEXT_AREA: TextAreaFieldProps;\n TEXT_INPUT: TextInputFieldProps;\n CUSTOM: CustomFieldProps<unknown>;\n}\n\n/**\n * Datetime picker field props.\n *\n * When `formatDate` is omitted, ISO-like format is used (YYYY-MM-DD / YYYY-MM-DD HH:mm).\n */\nexport interface DatetimePickerFieldProps extends BaseFormFieldProps<Date> {\n /**\n * The earliest date the user can select.\n * If provided, this will be added to the field validation.\n */\n min?: Date;\n\n /**\n * The latest date the user can select.\n * If provided, this will be added to the field validation.\n */\n max?: Date;\n\n /**\n * Whether to show time picker.\n */\n showTime?: boolean;\n\n /**\n * Whether to close the popover after selecting a date.\n * @default true when `showTime` is false, false when `showTime` is true\n */\n closeOnSelection?: boolean;\n\n /**\n * Placeholder text shown when no value is selected.\n */\n placeholder?: string;\n\n /** Formats a Date for display in the trigger button. */\n formatDate?: (date: Date) => string;\n}\n\n/**\n * Dropdown field props with selectable items\n */\nexport interface DropdownFieldProps<V, Multiple extends boolean = false>\n extends BaseFormFieldProps<Multiple extends true ? V[] : V>\n{\n /**\n * Available items for the dropdown\n */\n items: V[];\n\n /**\n * Converts an item to a display string. Defaults to `String()`.\n */\n itemToStringLabel?: (item: V) => string;\n\n /**\n * Returns a unique string key for a list item. Used as the React `key`.\n * Falls back to the item's index when not provided.\n */\n itemToKey?: (item: V) => string;\n\n /**\n * Custom equality check for item values. Defaults to `Object.is`.\n * Required when items are objects to ensure correct selection matching.\n */\n isItemEqual?: (a: V, b: V) => boolean;\n\n /**\n * Whether the dropdown allows searching/filtering.\n * When true, renders a Combobox with a search input.\n * When false (default), renders a Select dropdown.\n */\n isSearchable?: boolean;\n\n /**\n * Placeholder text shown when no value is selected.\n */\n placeholder?: string;\n\n /**\n * Whether multiple values can be selected\n */\n isMultiple?: Multiple;\n}\n\nexport interface FilePickerProps extends BaseFormFieldProps<File | File[]> {\n /**\n * Whether multiple files can be selected\n */\n isMulti?: boolean;\n\n /**\n * Accepted file types (e.g., \"image/*\", \".pdf\")\n */\n accept?: string | string[];\n\n /**\n * Maximum file size in bytes\n */\n maxSize?: number;\n}\n\n/**\n * Text area field props\n */\nexport interface TextAreaFieldProps extends\n BaseFormFieldProps<string>,\n Pick<\n React.TextareaHTMLAttributes<HTMLTextAreaElement>,\n | \"rows\"\n | \"wrap\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"minLength\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"maxLength\"\n >\n{\n placeholder?: string;\n}\n\nexport interface TextInputFieldProps extends\n BaseFormFieldProps<string>,\n Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n /**\n * If provided, this will be added to the field validation\n */\n | \"minLength\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"maxLength\"\n >\n{\n placeholder?: string;\n}\n\n/**\n * Number input field props\n */\nexport interface NumberInputFieldProps extends\n BaseFormFieldProps<number>,\n Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n /**\n * If provided, this will be added to the field validation\n */\n | \"min\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"max\"\n | \"step\"\n >\n{}\n\n/**\n * Radio buttons field props\n */\nexport interface RadioButtonsFieldProps<V> extends BaseFormFieldProps<V> {\n /**\n * Available options for radio buttons.\n *\n * Values are compared by reference equality (`===`). When options contain\n * non-primitive values, pass the same object references for `value` and\n * the corresponding option entry.\n */\n options: Option<V>[];\n}\n\n/**\n * Option interface for radio button options\n */\nexport interface Option<V> {\n label: string;\n value: V;\n}\n\n/**\n * Object set field displays the summary of the count of the given object set\n */\nexport interface ObjectSetFieldProps<T extends ObjectTypeDefinition>\n extends BaseFormFieldProps<ObjectSet<T>>\n{}\n\n/**\n * Custom field props for user-defined renderers\n */\nexport interface CustomFieldProps<V> extends BaseFormFieldProps<V> {\n /**\n * Custom renderer function\n */\n customRenderer: (props: BaseFormFieldProps<V>) => React.ReactNode;\n}\n\nexport interface BaseFormFieldProps<V> {\n /**\n * The HTML `id` attribute for the field input element.\n * Used for `<label htmlFor>` association.\n */\n id?: string;\n\n /**\n * The value of the form field\n */\n value: V | null;\n /**\n * Called when the field value changes.\n *\n * ActionForm internally wraps this to pass the key to `onFieldValueChange`:\n * ```\n * <DropdownField\n * {...fieldDef}\n * onChange={(value) => onFieldValueChange(fieldDef.key, value)}\n * />\n * ```\n *\n * @param value The new value of the form field\n */\n onChange?: (value: V | null) => void;\n}\n\nexport type FieldKey<Q extends ActionDefinition<unknown>> =\n keyof ActionParameters<Q>;\n\n/**\n * Extracts parameters from an ActionDefinition\n */\nexport type ActionParameters<Q extends ActionDefinition<unknown>> =\n CompileTimeMetadata<Q>[\"parameters\"];\n\n/**\n * Extracts the value type for a specific parameter\n *\n * TODO: Re-use `BaseType`\n */\nexport type FieldValueType<\n Q extends ActionDefinition<unknown>,\n K extends keyof ActionParameters<Q> = keyof ActionParameters<Q>,\n> = ActionParameters<Q>[K][\"type\"] extends\n ActionMetadata.DataType.Object<infer T> ? ActionParam.ObjectType<T>\n : ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.ObjectSet<\n infer T\n > ? ActionParam.ObjectSetType<T>\n : ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.Struct<\n infer T\n > ? ActionParam.StructType<T>\n : ActionParameters<Q>[K][\"type\"] extends keyof DataValueClientToWire\n ? DataValueClientToWire[ActionParameters<Q>[K][\"type\"]]\n : never;\n\n/**\n * Extracts the parameter type descriptor for a specific action parameter.\n */\nexport type FieldDescriptorType<\n Q extends ActionDefinition<unknown> = ActionDefinition<unknown>,\n K extends keyof ActionParameters<Q> = keyof ActionParameters<Q>,\n> = ActionParameters<Q>[K][\"type\"];\n\n/**\n * Available form field component types\n */\nexport type FieldComponent =\n | \"DATETIME_PICKER\"\n | \"DROPDOWN\"\n | \"FILE_PICKER\"\n | \"NUMBER_INPUT\"\n | \"RADIO_BUTTONS\"\n | \"OBJECT_SET\"\n | \"TEXT_AREA\"\n | \"TEXT_INPUT\"\n | \"CUSTOM\";\n\n/**\n * Describes the data type of a form field, independent of OSDK.\n * Mirrors ActionMetadata.DataType to keep the rendering layer OSDK-agnostic.\n */\nexport type FieldType =\n | \"boolean\"\n | \"string\"\n | \"integer\"\n | \"long\"\n | \"double\"\n | \"datetime\"\n | \"timestamp\"\n | \"attachment\"\n | \"marking\"\n | \"mediaReference\"\n | \"objectType\"\n | \"geoshape\"\n | \"geohash\"\n | { type: \"object\"; object: string }\n | { type: \"objectSet\"; objectSet: string }\n | { type: \"interface\"; interface: string }\n | { type: \"struct\"; struct: Record<string, string> };\n\n/**\n * An OSDK-agnostic field definition used by BaseForm and FormFieldRenderer.\n * Contains only the information needed to render a single field — no generics,\n * no compile-time parameter constraints.\n *\n * Implemented as a distributed mapped type: switching on `fieldComponent`\n * narrows `fieldComponentProps` to the correct props type automatically.\n */\nexport type RendererFieldDefinition = {\n [K in FieldComponent]: {\n fieldKey: string;\n fieldComponent: K;\n fieldType?: FieldType;\n label?: string;\n defaultValue?: unknown;\n isRequired?: boolean;\n placeholder?: string;\n helperText?: string;\n helperTextPlacement?: \"bottom\" | \"tooltip\";\n fieldComponentProps?: Omit<FormFieldPropsByType[K], \"value\" | \"onChange\">;\n };\n}[FieldComponent];\n\n/**\n * Gets valid form field types for a given property type\n */\nexport type ValidFormFieldForPropertyType<P extends FieldDescriptorType> =\n P extends \"objectSet\" ? \"OBJECT_SET\"\n : P extends \"object\" ? \"DROPDOWN\"\n : P extends \"mediaReference\" | \"attachment\" ? \"FILE_PICKER\"\n : P extends \"boolean\" ? \"RADIO_BUTTONS\" | \"DROPDOWN\"\n : P extends \"string\" ? \"TEXT_INPUT\" | \"TEXT_AREA\"\n : P extends \"datetime\" | \"timestamp\" ? \"DATETIME_PICKER\"\n : P extends\n | \"double\"\n | \"integer\"\n | \"long\"\n | \"float\"\n | \"short\"\n | \"byte\"\n | \"decimal\" ? \"NUMBER_INPUT\"\n : never;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"FormFieldApi.js","names":[],"sources":["FormFieldApi.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 ActionDefinition,\n ActionMetadata,\n ActionParam,\n CompileTimeMetadata,\n DataValueClientToWire,\n ObjectSet,\n ObjectTypeDefinition,\n} from \"@osdk/api\";\nimport type React from \"react\";\n\n/**\n * A form field definition specifies configuration for a single field\n */\nexport interface FormFieldDefinition<\n Q extends ActionDefinition<unknown>,\n K extends FieldKey<Q> = FieldKey<Q>,\n> {\n /**\n * The field's unique key\n */\n fieldKey: K;\n\n /**\n * Display label for the field\n * If not provided, the form field will not show any label.\n */\n label?: string;\n\n /**\n * Default value of the field\n */\n defaultValue?: FieldValueType<Q, K>;\n\n /**\n * The form field component type to render\n */\n fieldComponent: ValidFormFieldForPropertyType<FieldDescriptorType<Q, K>>;\n\n /**\n * Whether the field is required\n */\n isRequired?: boolean;\n\n /**\n * Placeholder text\n */\n placeholder?: string;\n\n /**\n * Additional information to display on this field\n * The placement of helper text depends on the value of helperTextPlacement prop\n */\n helperText?: string;\n\n /**\n * The placement of the helper text either below the field or in a tooltip\n *\n * @default \"tooltip\"\n */\n helperTextPlacement?: \"bottom\" | \"tooltip\";\n\n /**\n * Whether the field is disabled\n */\n isDisabled?: boolean;\n\n /**\n * A callback to return a custom error message if validation failed\n *\n * @param validationRule the validation rule that failed with the error message\n * @returns the error message to display\n */\n onValidationError?: (error: ValidationError) => string;\n\n /**\n * Additional function to validate the field\n *\n * @param value the current field value\n * @returns a boolean promise indicating whether the value is valid\n */\n validate?: (value: FieldValueType<Q, K>) => Promise<boolean>;\n\n /**\n * The component props for the form field\n * Excludes runtime props (value, onChange) which are managed by ActionForm\n */\n fieldComponentProps: Omit<\n FormFieldPropsByType[\n ValidFormFieldForPropertyType<\n FieldDescriptorType<Q, K>\n >\n ],\n \"value\" | \"onChange\"\n >;\n}\n\ntype ValidationError = { type: ValidationRule; error: string };\n\ntype ValidationRule =\n | \"required\"\n | \"min\"\n | \"max\"\n | \"minLength\"\n | \"maxLength\"\n | \"pattern\"\n | \"validate\";\n\n/**\n * Maps field types to their corresponding props\n */\nexport interface FormFieldPropsByType {\n DATETIME_PICKER: DatetimePickerFieldProps;\n DROPDOWN: DropdownFieldProps<unknown, boolean>;\n FILE_PICKER: FilePickerProps;\n NUMBER_INPUT: NumberInputFieldProps;\n OBJECT_SET: ObjectSetFieldProps<ObjectTypeDefinition>;\n RADIO_BUTTONS: RadioButtonsFieldProps<unknown>;\n TEXT_AREA: TextAreaFieldProps;\n TEXT_INPUT: TextInputFieldProps;\n CUSTOM: CustomFieldProps<unknown>;\n}\n\n/**\n * Datetime picker field props.\n *\n * When `formatDate` is omitted, ISO-like format is used (YYYY-MM-DD / YYYY-MM-DD HH:mm).\n */\nexport interface DatetimePickerFieldProps extends BaseFormFieldProps<Date> {\n /**\n * The earliest date the user can select.\n * If provided, this will be added to the field validation.\n */\n min?: Date;\n\n /**\n * The latest date the user can select.\n * If provided, this will be added to the field validation.\n */\n max?: Date;\n\n /**\n * Whether to show time picker.\n */\n showTime?: boolean;\n\n /**\n * Whether to close the popover after selecting a date.\n * @default true when `showTime` is false, false when `showTime` is true\n */\n closeOnSelection?: boolean;\n\n /**\n * Placeholder text shown when no value is selected.\n */\n placeholder?: string;\n\n /** Formats a Date for display in the trigger button. */\n formatDate?: (date: Date) => string;\n}\n\n/**\n * Dropdown field props with selectable items\n */\nexport interface DropdownFieldProps<V, Multiple extends boolean = false>\n extends BaseFormFieldProps<Multiple extends true ? V[] : V>\n{\n /**\n * Available items for the dropdown\n */\n items: V[];\n\n /**\n * Converts an item to a display string. Defaults to `String()`.\n */\n itemToStringLabel?: (item: V) => string;\n\n /**\n * Returns a unique string key for a list item. Used as the React `key`.\n * Falls back to the item's index when not provided.\n */\n itemToKey?: (item: V) => string;\n\n /**\n * Custom equality check for item values. Defaults to `Object.is`.\n * Required when items are objects to ensure correct selection matching.\n */\n isItemEqual?: (a: V, b: V) => boolean;\n\n /**\n * Whether the dropdown allows searching/filtering.\n * When true, renders a Combobox with a search input.\n * When false (default), renders a Select dropdown.\n */\n isSearchable?: boolean;\n\n /**\n * Placeholder text shown when no value is selected.\n */\n placeholder?: string;\n\n /**\n * Whether multiple values can be selected\n */\n isMultiple?: Multiple;\n}\n\nexport interface FilePickerProps extends BaseFormFieldProps<File | File[]> {\n /**\n * Whether multiple files can be selected\n */\n isMulti?: boolean;\n\n /**\n * Accepted file types (e.g., \"image/*\", \".pdf\")\n */\n accept?: string | string[];\n\n /**\n * Maximum file size in bytes\n */\n maxSize?: number;\n}\n\n/**\n * Text area field props\n */\nexport interface TextAreaFieldProps extends\n BaseFormFieldProps<string>,\n Pick<\n React.TextareaHTMLAttributes<HTMLTextAreaElement>,\n | \"rows\"\n | \"wrap\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"minLength\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"maxLength\"\n >\n{\n placeholder?: string;\n}\n\nexport interface TextInputFieldProps extends\n BaseFormFieldProps<string>,\n Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n /**\n * If provided, this will be added to the field validation\n */\n | \"minLength\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"maxLength\"\n >\n{\n placeholder?: string;\n}\n\n/**\n * Number input field props\n */\nexport interface NumberInputFieldProps extends\n BaseFormFieldProps<number>,\n Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n /**\n * If provided, this will be added to the field validation\n */\n | \"min\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"max\"\n | \"step\"\n >\n{}\n\n/**\n * Radio buttons field props\n */\nexport interface RadioButtonsFieldProps<V> extends BaseFormFieldProps<V> {\n /**\n * Available options for radio buttons.\n *\n * Values are compared by reference equality (`===`). When options contain\n * non-primitive values, pass the same object references for `value` and\n * the corresponding option entry.\n */\n options: Option<V>[];\n}\n\n/**\n * Option interface for radio button options\n */\nexport interface Option<V> {\n label: string;\n value: V;\n}\n\n/**\n * Object set field displays the summary of the count of the given object set\n */\nexport interface ObjectSetFieldProps<T extends ObjectTypeDefinition>\n extends BaseFormFieldProps<ObjectSet<T>>\n{}\n\n/**\n * Custom field props for user-defined renderers\n */\nexport interface CustomFieldProps<V> extends BaseFormFieldProps<V> {\n /**\n * Custom renderer function\n */\n customRenderer: (props: BaseFormFieldProps<V>) => React.ReactNode;\n}\n\nexport interface BaseFormFieldProps<V> {\n /**\n * The HTML `id` attribute for the field input element.\n * Used for `<label htmlFor>` association.\n */\n id?: string;\n\n /**\n * The value of the form field\n */\n value: V | null;\n /**\n * Called when the field value changes.\n *\n * ActionForm internally wraps this to pass the key to `onFieldValueChange`:\n * ```\n * <DropdownField\n * {...fieldDef}\n * onChange={(value) => onFieldValueChange(fieldDef.key, value)}\n * />\n * ```\n *\n * @param value The new value of the form field\n */\n onChange?: (value: V | null) => void;\n}\n\nexport type FieldKey<Q extends ActionDefinition<unknown>> =\n keyof ActionParameters<Q>;\n\n/**\n * Extracts parameters from an ActionDefinition\n */\nexport type ActionParameters<Q extends ActionDefinition<unknown>> =\n CompileTimeMetadata<Q>[\"parameters\"];\n\n/**\n * Extracts the value type for a specific parameter\n *\n * TODO: Re-use `BaseType`\n */\nexport type FieldValueType<\n Q extends ActionDefinition<unknown>,\n K extends keyof ActionParameters<Q> = keyof ActionParameters<Q>,\n> = ActionParameters<Q>[K][\"type\"] extends\n ActionMetadata.DataType.Object<infer T> ? ActionParam.ObjectType<T>\n : ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.ObjectSet<\n infer T\n > ? ActionParam.ObjectSetType<T>\n : ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.Struct<\n infer T\n > ? ActionParam.StructType<T>\n : ActionParameters<Q>[K][\"type\"] extends keyof DataValueClientToWire\n ? DataValueClientToWire[ActionParameters<Q>[K][\"type\"]]\n : never;\n\n/**\n * Extracts the parameter type descriptor for a specific action parameter.\n */\nexport type FieldDescriptorType<\n Q extends ActionDefinition<unknown> = ActionDefinition<unknown>,\n K extends keyof ActionParameters<Q> = keyof ActionParameters<Q>,\n> = ActionParameters<Q>[K][\"type\"];\n\n/**\n * Available form field component types\n */\nexport type FieldComponent =\n | \"DATETIME_PICKER\"\n | \"DROPDOWN\"\n | \"FILE_PICKER\"\n | \"NUMBER_INPUT\"\n | \"RADIO_BUTTONS\"\n | \"OBJECT_SET\"\n | \"TEXT_AREA\"\n | \"TEXT_INPUT\"\n | \"CUSTOM\";\n\n/**\n * Describes the data type of a form field, independent of OSDK.\n * Mirrors ActionMetadata.DataType to keep the rendering layer OSDK-agnostic.\n */\nexport type FieldType =\n | \"boolean\"\n | \"string\"\n | \"integer\"\n | \"long\"\n | \"double\"\n | \"datetime\"\n | \"timestamp\"\n | \"attachment\"\n | \"marking\"\n | \"mediaReference\"\n | \"objectType\"\n | \"geoshape\"\n | \"geohash\"\n | { type: \"object\"; object: string }\n | { type: \"objectSet\"; objectSet: string }\n | { type: \"interface\"; interface: string }\n | { type: \"struct\"; struct: Record<string, string> };\n\n/**\n * An OSDK-agnostic field definition used by BaseForm and FormFieldRenderer.\n * Contains only the information needed to render a single field — no generics,\n * no compile-time parameter constraints.\n *\n * Implemented as a distributed mapped type: switching on `fieldComponent`\n * narrows `fieldComponentProps` to the correct props type automatically.\n */\nexport type RendererFieldDefinition = {\n [K in FieldComponent]: {\n fieldKey: string;\n fieldComponent: K;\n fieldType?: FieldType;\n label?: string;\n defaultValue?: unknown;\n isRequired?: boolean;\n placeholder?: string;\n helperText?: string;\n helperTextPlacement?: \"bottom\" | \"tooltip\";\n fieldComponentProps: Omit<FormFieldPropsByType[K], \"value\" | \"onChange\">;\n };\n}[FieldComponent];\n\n/**\n * Gets valid form field types for a given property type\n */\nexport type ValidFormFieldForPropertyType<P extends FieldDescriptorType> =\n P extends \"objectSet\" ? \"OBJECT_SET\"\n : P extends \"object\" ? \"DROPDOWN\"\n : P extends \"mediaReference\" | \"attachment\" ? \"FILE_PICKER\"\n : P extends \"boolean\" ? \"RADIO_BUTTONS\" | \"DROPDOWN\"\n : P extends \"string\" ? \"TEXT_INPUT\" | \"TEXT_AREA\"\n : P extends \"datetime\" | \"timestamp\" ? \"DATETIME_PICKER\"\n : P extends\n | \"double\"\n | \"integer\"\n | \"long\"\n | \"float\"\n | \"short\"\n | \"byte\"\n | \"decimal\" ? \"NUMBER_INPUT\"\n : never;\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ /*
2
+ * Copyright 2026 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import React, { memo } from "react";
18
+ /**
19
+ * Renders a user-provided custom field. Delegates all rendering to the
20
+ * `customRenderer` callback, passing through the standard form field props
21
+ * (value, onChange, id) so the custom implementation can participate in
22
+ * form state management.
23
+ */
24
+ export const CustomField = /*#__PURE__*/memo(function ({
25
+ customRenderer: CustomRenderer,
26
+ ...baseProps
27
+ }) {
28
+ return /*#__PURE__*/React.createElement(CustomRenderer, baseProps);
29
+ });
30
+ //# sourceMappingURL=CustomField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomField.js","names":["React","memo","CustomField","customRenderer","CustomRenderer","baseProps","createElement"],"sources":["CustomField.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 React, { memo } from \"react\";\nimport type { CustomFieldProps } from \"../FormFieldApi.js\";\n\n/**\n * Renders a user-provided custom field. Delegates all rendering to the\n * `customRenderer` callback, passing through the standard form field props\n * (value, onChange, id) so the custom implementation can participate in\n * form state management.\n */\nexport const CustomField: React.FC<CustomFieldProps<unknown>> = memo(\n function CustomFieldFn({ customRenderer: CustomRenderer, ...baseProps }) {\n return <CustomRenderer {...baseProps} />;\n },\n);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AAGnC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAgD,gBAAGD,IAAI,CAClE,UAAuB;EAAEE,cAAc,EAAEC,cAAc;EAAE,GAAGC;AAAU,CAAC,EAAE;EACvE,oBAAOL,KAAA,CAAAM,aAAA,CAACF,cAAc,EAAKC,SAAY,CAAC;AAC1C,CACF,CAAC","ignoreList":[]}
@@ -17,13 +17,12 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
17
17
 
18
18
  import React, { memo } from "react";
19
19
  import { FormField } from "../FormField.js";
20
+ import { CustomField } from "./CustomField.js";
20
21
  import { DatetimePickerField } from "./DatetimePickerField.js";
21
22
  import { DropdownField } from "./DropdownField.js";
22
23
  import { RadioButtonsField } from "./RadioButtonsField.js";
23
24
  import { TextAreaField } from "./TextAreaField.js";
24
25
  import { TextInputField } from "./TextInputField.js";
25
- const EMPTY_ITEMS = [];
26
- const EMPTY_OPTIONS = [];
27
26
  export const FormFieldRenderer = /*#__PURE__*/memo(function ({
28
27
  fieldDefinition,
29
28
  value,
@@ -60,16 +59,11 @@ function renderFieldComponent(fieldDefinition, value, onChange) {
60
59
  }, fieldDefinition.fieldComponentProps));
61
60
  case "DROPDOWN":
62
61
  {
63
- const {
64
- items = EMPTY_ITEMS,
65
- ...dropdownProps
66
- } = fieldDefinition.fieldComponentProps ?? {};
67
62
  return /*#__PURE__*/React.createElement(DropdownField, _extends({
68
63
  value: value,
69
64
  onChange: onChange,
70
- items: items,
71
65
  placeholder: fieldDefinition.placeholder
72
- }, dropdownProps));
66
+ }, fieldDefinition.fieldComponentProps));
73
67
  }
74
68
  case "DATETIME_PICKER":
75
69
  return /*#__PURE__*/React.createElement(DatetimePickerField, _extends({
@@ -81,22 +75,20 @@ function renderFieldComponent(fieldDefinition, value, onChange) {
81
75
  onChange: onChange
82
76
  }, fieldDefinition.fieldComponentProps));
83
77
  case "RADIO_BUTTONS":
84
- {
85
- const {
86
- options = EMPTY_OPTIONS,
87
- ...radioProps
88
- } = fieldDefinition.fieldComponentProps ?? {};
89
- return /*#__PURE__*/React.createElement(RadioButtonsField, _extends({
90
- id: fieldDefinition.fieldKey,
91
- value: value,
92
- onChange: onChange,
93
- options: options
94
- }, radioProps));
95
- }
78
+ return /*#__PURE__*/React.createElement(RadioButtonsField, _extends({
79
+ id: fieldDefinition.fieldKey,
80
+ value: value,
81
+ onChange: onChange
82
+ }, fieldDefinition.fieldComponentProps));
83
+ case "CUSTOM":
84
+ return /*#__PURE__*/React.createElement(CustomField, _extends({
85
+ id: fieldDefinition.fieldKey,
86
+ value: value,
87
+ onChange: onChange
88
+ }, fieldDefinition.fieldComponentProps));
96
89
  case "NUMBER_INPUT":
97
90
  case "FILE_PICKER":
98
91
  case "OBJECT_SET":
99
- case "CUSTOM":
100
92
  return /*#__PURE__*/React.createElement("div", null, "Unsupported field type: ", fieldDefinition.fieldComponent);
101
93
  default:
102
94
  return assertUnreachableFieldComponent(fieldDefinition);
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldRenderer.js","names":["React","memo","FormField","DatetimePickerField","DropdownField","RadioButtonsField","TextAreaField","TextInputField","EMPTY_ITEMS","EMPTY_OPTIONS","FormFieldRenderer","fieldDefinition","value","onFieldValueChange","label","isRequired","helperText","helperTextPlacement","createElement","fieldKey","undefined","renderFieldComponent","onChange","fieldComponent","_extends","id","String","placeholder","fieldComponentProps","items","dropdownProps","Date","options","radioProps","assertUnreachableFieldComponent","Error"],"sources":["FormFieldRenderer.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 React, { memo } from \"react\";\nimport { FormField } from \"../FormField.js\";\nimport type { Option, RendererFieldDefinition } from \"../FormFieldApi.js\";\nimport { DatetimePickerField } from \"./DatetimePickerField.js\";\nimport { DropdownField } from \"./DropdownField.js\";\nimport { RadioButtonsField } from \"./RadioButtonsField.js\";\nimport { TextAreaField } from \"./TextAreaField.js\";\nimport { TextInputField } from \"./TextInputField.js\";\n\nconst EMPTY_ITEMS: unknown[] = [];\nconst EMPTY_OPTIONS: Option<never>[] = [];\n\nexport interface FormFieldRendererProps {\n fieldDefinition: RendererFieldDefinition;\n value: unknown;\n onFieldValueChange: (value: unknown) => void;\n}\n\nexport const FormFieldRenderer: React.FC<FormFieldRendererProps> = memo(\n function FormFieldRendererFn({\n fieldDefinition,\n value,\n onFieldValueChange,\n }: FormFieldRendererProps): React.ReactElement {\n const { label, isRequired, helperText, helperTextPlacement } =\n fieldDefinition;\n\n return (\n <FormField\n label={label}\n isRequired={isRequired}\n fieldKey={fieldDefinition.fieldKey}\n helperText={helperTextPlacement !== \"tooltip\" ? helperText : undefined}\n >\n {renderFieldComponent(fieldDefinition, value, onFieldValueChange)}\n </FormField>\n );\n },\n);\n\nfunction renderFieldComponent(\n fieldDefinition: RendererFieldDefinition,\n value: unknown,\n onChange: (value: unknown) => void,\n): React.ReactElement {\n switch (fieldDefinition.fieldComponent) {\n case \"TEXT_INPUT\":\n return (\n <TextInputField\n id={fieldDefinition.fieldKey}\n value={value != null ? String(value) : \"\"}\n onChange={onChange}\n placeholder={fieldDefinition.placeholder}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"TEXT_AREA\":\n return (\n <TextAreaField\n id={fieldDefinition.fieldKey}\n value={value != null ? String(value) : \"\"}\n onChange={onChange}\n placeholder={fieldDefinition.placeholder}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"DROPDOWN\": {\n const { items = EMPTY_ITEMS, ...dropdownProps } =\n fieldDefinition.fieldComponentProps ?? {};\n return (\n <DropdownField\n value={value}\n onChange={onChange}\n items={items}\n placeholder={fieldDefinition.placeholder}\n {...dropdownProps}\n />\n );\n }\n case \"DATETIME_PICKER\":\n return (\n <DatetimePickerField\n id={fieldDefinition.fieldKey}\n placeholder={fieldDefinition.placeholder}\n // TODO: Use coerceFieldValue\n value={value instanceof Date ? value : null}\n onChange={onChange}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"RADIO_BUTTONS\": {\n const { options = EMPTY_OPTIONS, ...radioProps } =\n fieldDefinition.fieldComponentProps ?? {};\n return (\n <RadioButtonsField\n id={fieldDefinition.fieldKey}\n value={value}\n onChange={onChange}\n options={options}\n {...radioProps}\n />\n );\n }\n case \"NUMBER_INPUT\":\n case \"FILE_PICKER\":\n case \"OBJECT_SET\":\n case \"CUSTOM\":\n return <div>Unsupported field type: {fieldDefinition.fieldComponent}\n </div>;\n default:\n return assertUnreachableFieldComponent(fieldDefinition);\n }\n}\n\nfunction assertUnreachableFieldComponent(value: never): never {\n throw new Error(`Unhandled field component: ${String(value)}`);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,SAAS,QAAQ,iBAAiB;AAE3C,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,qBAAqB;AA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B,CAACvB,eAAe,CAAC;EAC3D;AACF;AAEA,SAASuB,+BAA+BA,CAACtB,KAAY,EAAS;EAC5D,MAAM,IAAIuB,KAAK,CAAC,8BAA8BT,MAAM,CAACd,KAAK,CAAC,EAAE,CAAC;AAChE","ignoreList":[]}
1
+ {"version":3,"file":"FormFieldRenderer.js","names":["React","memo","FormField","CustomField","DatetimePickerField","DropdownField","RadioButtonsField","TextAreaField","TextInputField","FormFieldRenderer","fieldDefinition","value","onFieldValueChange","label","isRequired","helperText","helperTextPlacement","createElement","fieldKey","undefined","renderFieldComponent","onChange","fieldComponent","_extends","id","String","placeholder","fieldComponentProps","Date","assertUnreachableFieldComponent","Error"],"sources":["FormFieldRenderer.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 React, { memo } from \"react\";\nimport { FormField } from \"../FormField.js\";\nimport type { RendererFieldDefinition } from \"../FormFieldApi.js\";\nimport { CustomField } from \"./CustomField.js\";\nimport { DatetimePickerField } from \"./DatetimePickerField.js\";\nimport { DropdownField } from \"./DropdownField.js\";\nimport { RadioButtonsField } from \"./RadioButtonsField.js\";\nimport { TextAreaField } from \"./TextAreaField.js\";\nimport { TextInputField } from \"./TextInputField.js\";\n\nexport interface FormFieldRendererProps {\n fieldDefinition: RendererFieldDefinition;\n value: unknown;\n onFieldValueChange: (value: unknown) => void;\n}\n\nexport const FormFieldRenderer: React.FC<FormFieldRendererProps> = memo(\n function FormFieldRendererFn({\n fieldDefinition,\n value,\n onFieldValueChange,\n }: FormFieldRendererProps): React.ReactElement {\n const { label, isRequired, helperText, helperTextPlacement } =\n fieldDefinition;\n\n return (\n <FormField\n label={label}\n isRequired={isRequired}\n fieldKey={fieldDefinition.fieldKey}\n helperText={helperTextPlacement !== \"tooltip\" ? helperText : undefined}\n >\n {renderFieldComponent(fieldDefinition, value, onFieldValueChange)}\n </FormField>\n );\n },\n);\n\nfunction renderFieldComponent(\n fieldDefinition: RendererFieldDefinition,\n value: unknown,\n onChange: (value: unknown) => void,\n): React.ReactElement {\n switch (fieldDefinition.fieldComponent) {\n case \"TEXT_INPUT\":\n return (\n <TextInputField\n id={fieldDefinition.fieldKey}\n value={value != null ? String(value) : \"\"}\n onChange={onChange}\n placeholder={fieldDefinition.placeholder}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"TEXT_AREA\":\n return (\n <TextAreaField\n id={fieldDefinition.fieldKey}\n value={value != null ? String(value) : \"\"}\n onChange={onChange}\n placeholder={fieldDefinition.placeholder}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"DROPDOWN\": {\n return (\n <DropdownField\n value={value}\n onChange={onChange}\n placeholder={fieldDefinition.placeholder}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n }\n case \"DATETIME_PICKER\":\n return (\n <DatetimePickerField\n id={fieldDefinition.fieldKey}\n placeholder={fieldDefinition.placeholder}\n // TODO: Use coerceFieldValue\n value={value instanceof Date ? value : null}\n onChange={onChange}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"RADIO_BUTTONS\":\n return (\n <RadioButtonsField\n id={fieldDefinition.fieldKey}\n value={value}\n onChange={onChange}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"CUSTOM\":\n return (\n <CustomField\n id={fieldDefinition.fieldKey}\n value={value}\n onChange={onChange}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"NUMBER_INPUT\":\n case \"FILE_PICKER\":\n case \"OBJECT_SET\":\n return <div>Unsupported field type: {fieldDefinition.fieldComponent}\n </div>;\n default:\n return assertUnreachableFieldComponent(fieldDefinition);\n }\n}\n\nfunction assertUnreachableFieldComponent(value: never): never {\n throw new Error(`Unhandled field component: ${String(value)}`);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,SAAS,QAAQ,iBAAiB;AAE3C,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,qBAAqB;AAQpD,OAAO,MAAMC,iBAAmD,gBAAGR,IAAI,CACrE,UAA6B;EAC3BS,eAAe;EACfC,KAAK;EACLC;AACsB,CAAC,EAAsB;EAC7C,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAoB,CAAC,GAC1DN,eAAe;EAEjB,oBACEV,KAAA,CAAAiB,aAAA,CAACf,SAAS;IACRW,KAAK,EAAEA,KAAM;IACbC,UAAU,EAAEA,UAAW;IACvBI,QAAQ,EAAER,eAAe,CAACQ,QAAS;IACnCH,UAAU,EAAEC,mBAAmB,KAAK,SAAS,GAAGD,UAAU,GAAGI;EAAU,GAEtEC,oBAAoB,CAACV,eAAe,EAAEC,KAAK,EAAEC,kBAAkB,CACvD,CAAC;AAEhB,CACF,CAAC;AAED,SAASQ,oBAAoBA,CAC3BV,eAAwC,EACxCC,KAAc,EACdU,QAAkC,EACd;EACpB,QAAQX,eAAe,CAACY,cAAc;IACpC,KAAK,YAAY;MACf,oBACEtB,KAAA,CAAAiB,aAAA,CAACT,cAAc,EAAAe,QAAA;QACbC,EAAE,EAAEd,eAAe,CAACQ,QAAS;QAC7BP,KAAK,EAAEA,KAAK,IAAI,IAAI,GAAGc,MAAM,CAACd,KAAK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AiB,aAAA,CAACd,WAAW,EAAAoB,QAAA;QACVC,EAAE,EAAEd,eAAe,CAACQ,QAAS;QAC7BP,KAAK,EAAEA,KAAM;QACbU,QAAQ,EAAEA;MAAS,GACfX,eAAe,CAACiB,mBAAmB,CACxC,CAAC;IAEN,KAAK,cAAc;IACnB,KAAK,aAAa;IAClB,KAAK,YAAY;MACf,oBAAO3B,KAAA,CAAAiB,aAAA,cAAK,0BAAwB,EAACP,eAAe,CAACY,cAChD,CAAC;IACR;MACE,OAAOO,+BAA+B,CAACnB,eAAe,CAAC;EAC3D;AACF;AAEA,SAASmB,+BAA+BA,CAAClB,KAAY,EAAS;EAC5D,MAAM,IAAImB,KAAK,CAAC,8BAA8BL,MAAM,CAACd,KAAK,CAAC,EAAE,CAAC;AAChE","ignoreList":[]}
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { Radio } from "@base-ui/react/radio";
18
18
  import { RadioGroup } from "@base-ui/react/radio-group";
19
- import { memo, useCallback, useMemo } from "react";
19
+ import React, { memo, useCallback, useMemo } from "react";
20
20
  import { typedReactMemo } from "../../shared/typedMemo.js";
21
21
  import styles from "./RadioButtonsField.module.css.js";
22
22
  export const RadioButtonsField = typedReactMemo(function ({
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButtonsField.js","names":["Radio","RadioGroup","memo","useCallback","useMemo","typedReactMemo","styles","RadioButtonsField","id","value","onChange","options","selectedLabel","find","opt","label","undefined","handleValueChange","nextLabel","match","React","createElement","className","osdkRadioGroup","onValueChange","map","option","RadioItem","key","osdkRadioItem","Root","osdkRadioRoot","Indicator","osdkRadioIndicator","osdkRadioLabel"],"sources":["RadioButtonsField.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { Radio } from \"@base-ui/react/radio\";\nimport { RadioGroup } from \"@base-ui/react/radio-group\";\nimport { memo, type ReactElement, useCallback, useMemo } from \"react\";\nimport { typedReactMemo } from \"../../shared/typedMemo.js\";\nimport type { Option, RadioButtonsFieldProps } from \"../FormFieldApi.js\";\nimport styles from \"./RadioButtonsField.module.css\";\n\nexport const RadioButtonsField: <V>(\n props: RadioButtonsFieldProps<V>,\n) => ReactElement = typedReactMemo(function RadioButtonsFieldFn<V,>({\n id,\n value,\n onChange,\n options,\n}: RadioButtonsFieldProps<V>): ReactElement {\n const selectedLabel = useMemo(\n () =>\n value != null\n ? options.find((opt) => opt.value === value)?.label\n : undefined,\n [options, value],\n );\n\n const handleValueChange = useCallback(\n (nextLabel: unknown) => {\n const match = options.find((opt) => opt.label === nextLabel);\n onChange?.(match?.value ?? null);\n },\n [options, onChange],\n );\n\n return (\n <RadioGroup\n id={id}\n className={styles.osdkRadioGroup}\n value={selectedLabel}\n onValueChange={handleValueChange}\n >\n {options.map((option) => (\n <RadioItem key={option.label} option={option} />\n ))}\n </RadioGroup>\n );\n});\n\nconst RadioItem = memo(function RadioItemFn({\n option,\n}: {\n option: Option<unknown>;\n}): ReactElement {\n return (\n <label className={styles.osdkRadioItem}>\n <Radio.Root value={option.label} className={styles.osdkRadioRoot}>\n <Radio.Indicator className={styles.osdkRadioIndicator} />\n </Radio.Root>\n <span className={styles.osdkRadioLabel}>{option.label}</span>\n </label>\n );\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,QAAQ,sBAAsB;AAC5C,SAASC,UAAU,QAAQ,4BAA4B;AACvD,SAASC,IAAI,EAAqBC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACrE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K,EAAEiB,MAAM,CAACX,KAAM;IAACO,SAAS,EAAEhB,MAAM,CAACyB;EAAc,gBAC/DX,KAAA,CAAAC,aAAA,CAACrB,KAAK,CAACgC,SAAS;IAACV,SAAS,EAAEhB,MAAM,CAAC2B;EAAmB,CAAE,CAC9C,CAAC,eACbb,KAAA,CAAAC,aAAA;IAAMC,SAAS,EAAEhB,MAAM,CAAC4B;EAAe,GAAER,MAAM,CAACX,KAAY,CACvD,CAAC;AAEZ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"RadioButtonsField.js","names":["Radio","RadioGroup","React","memo","useCallback","useMemo","typedReactMemo","styles","RadioButtonsField","id","value","onChange","options","selectedLabel","find","opt","label","undefined","handleValueChange","nextLabel","match","createElement","className","osdkRadioGroup","onValueChange","map","option","RadioItem","key","osdkRadioItem","Root","osdkRadioRoot","Indicator","osdkRadioIndicator","osdkRadioLabel"],"sources":["RadioButtonsField.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { Radio } from \"@base-ui/react/radio\";\nimport { RadioGroup } from \"@base-ui/react/radio-group\";\nimport React, { memo, useCallback, useMemo } from \"react\";\nimport { typedReactMemo } from \"../../shared/typedMemo.js\";\nimport type { Option, RadioButtonsFieldProps } from \"../FormFieldApi.js\";\nimport styles from \"./RadioButtonsField.module.css\";\n\nexport const RadioButtonsField: <V>(\n props: RadioButtonsFieldProps<V>,\n) => React.ReactElement = typedReactMemo(function RadioButtonsFieldFn<V,>({\n id,\n value,\n onChange,\n options,\n}: RadioButtonsFieldProps<V>): React.ReactElement {\n const selectedLabel = useMemo(\n () =>\n value != null\n ? options.find((opt) => opt.value === value)?.label\n : undefined,\n [options, value],\n );\n\n const handleValueChange = useCallback(\n (nextLabel: unknown) => {\n const match = options.find((opt) => opt.label === nextLabel);\n onChange?.(match?.value ?? null);\n },\n [options, onChange],\n );\n\n return (\n <RadioGroup\n id={id}\n className={styles.osdkRadioGroup}\n value={selectedLabel}\n onValueChange={handleValueChange}\n >\n {options.map((option) => (\n <RadioItem key={option.label} option={option} />\n ))}\n </RadioGroup>\n );\n});\n\nconst RadioItem = memo(function RadioItemFn({\n option,\n}: {\n option: Option<unknown>;\n}): React.ReactElement {\n return (\n <label className={styles.osdkRadioItem}>\n <Radio.Root value={option.label} className={styles.osdkRadioRoot}>\n <Radio.Indicator className={styles.osdkRadioIndicator} />\n </Radio.Root>\n <span className={styles.osdkRadioLabel}>{option.label}</span>\n </label>\n );\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,QAAQ,sBAAsB;AAC5C,SAASC,UAAU,QAAQ,4BAA4B;AACvD,OAAOC,KAAK,IAAIC,IAAI,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACzD,SAASC,cAAc,QAAQ,2BAA2B;AAE1D,OAAOC,MAAM,MAAM,gCAAgC;AAEnD,OAAO,MAAMC,iBAEU,GAAGF,cAAc,CAAC,UAAiC;EACxEG,EAAE;EACFC,KAAK;EACLC,QAAQ;EACRC;AACyB,CAAC,EAAsB;EAChD,MAAMC,aAAa,GAAGR,OAAO,CAC3B,MACEK,KAAK,IAAI,IAAI,GACTE,OAAO,CAACE,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACL,KAAK,KAAKA,KAAK,CAAC,EAAEM,KAAK,GACjDC,SAAS,EACf,CAACL,OAAO,EAAEF,KAAK,CACjB,CAAC;EAED,MAAMQ,iBAAiB,GAAGd,WAAW,CAClCe,SAAkB,IAAK;IACtB,MAAMC,KAAK,GAAGR,OAAO,CAACE,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,KAAK,KAAKG,SAAS,CAAC;IAC5DR,QAAQ,GAAGS,KAAK,EAAEV,KAAK,IAAI,IAAI,CAAC;EAClC,CAAC,EACD,CAACE,OAAO,EAAED,QAAQ,CACpB,CAAC;EAED,oBACET,KAAA,CAAAmB,aAAA,CAACpB,UAAU;IACTQ,EAAE,EAAEA,EAAG;IACPa,SAAS,EAAEf,MAAM,CAACgB,cAAe;IACjCb,KAAK,EAAEG,aAAc;IACrBW,aAAa,EAAEN;EAAkB,GAEhCN,OAAO,CAACa,GAAG,CAAEC,MAAM,iBAClBxB,KAAA,CAAAmB,aAAA,CAACM,SAAS;IAACC,GAAG,EAAEF,MAAM,CAACV,KAAM;IAACU,MAAM,EAAEA;EAAO,CAAE,CAChD,CACS,CAAC;AAEjB,CAAC,CAAC;AAEF,MAAMC,SAAS,gBAAGxB,IAAI,CAAC,UAAqB;EAC1CuB;AAGF,CAAC,EAAsB;EACrB,oBACExB,KAAA,CAAAmB,aAAA;IAAOC,SAAS,EAAEf,MAAM,CAACsB;EAAc,gBACrC3B,KAAA,CAAAmB,aAAA,CAACrB,KAAK,CAAC8B,IAAI;IAACpB,KAAK,EAAEgB,MAAM,CAACV,KAAM;IAACM,SAAS,EAAEf,MAAM,CAACwB;EAAc,gBAC/D7B,KAAA,CAAAmB,aAAA,CAACrB,KAAK,CAACgC,SAAS;IAACV,SAAS,EAAEf,MAAM,CAAC0B;EAAmB,CAAE,CAC9C,CAAC,eACb/B,KAAA,CAAAmB,aAAA;IAAMC,SAAS,EAAEf,MAAM,CAAC2B;EAAe,GAAER,MAAM,CAACV,KAAY,CACvD,CAAC;AAEZ,CAAC,CAAC","ignoreList":[]}
@@ -14,20 +14,107 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { getDefaultFieldComponent } from "./getDefaultFieldComponent.js";
18
-
17
+ import { assertUnreachable } from "../../shared/assertUnreachable.js";
19
18
  /**
20
- * Derives default field definitions from fetched ActionMetadata.
19
+ * Derives default field definitions from ActionMetadata.
20
+ *
21
+ * Each parameter type maps to a concrete RendererFieldDefinition with the
22
+ * correct fieldComponent and default fieldComponentProps.
21
23
  */
22
24
  export function getDefaultFieldDefinitions(metadata) {
23
- return Object.entries(metadata.parameters).map(([key, param]) => ({
24
- // Object.entries erases key types; assertion bridges runtime string to FieldKey<Q>
25
+ return Object.entries(metadata.parameters).map(([key, param]) => buildFieldDefinition(key, param));
26
+ }
27
+ const EMPTY_ITEMS = [];
28
+
29
+ /**
30
+ * Maps a single action parameter to its default RendererFieldDefinition.
31
+ *
32
+ * Switches on the parameter's data type to select both the field component
33
+ * and its required default props.
34
+ */
35
+ function buildFieldDefinition(key, param) {
36
+ const base = {
25
37
  fieldKey: key,
26
38
  label: key,
27
- // getDefaultFieldComponent returns FieldComponent (full union); TS can't verify
28
- // it matches ValidFormFieldForPropertyType for a deferred generic Q
29
- fieldComponent: getDefaultFieldComponent(param.type),
30
- isRequired: !param.nullable
31
- }));
39
+ isRequired: !param.nullable,
40
+ fieldType: param.type
41
+ };
42
+ const paramType = param.type;
43
+ if (typeof paramType === "object") {
44
+ switch (paramType.type) {
45
+ case "objectSet":
46
+ return {
47
+ ...base,
48
+ fieldComponent: "OBJECT_SET",
49
+ fieldComponentProps: {}
50
+ };
51
+ case "object":
52
+ case "interface":
53
+ // TODO: provide correct items
54
+ return {
55
+ ...base,
56
+ fieldComponent: "DROPDOWN",
57
+ fieldComponentProps: {
58
+ items: EMPTY_ITEMS
59
+ }
60
+ };
61
+ case "struct":
62
+ return {
63
+ ...base,
64
+ fieldComponent: "TEXT_INPUT",
65
+ fieldComponentProps: {}
66
+ };
67
+ }
68
+ }
69
+ switch (paramType) {
70
+ case "string":
71
+ case "marking":
72
+ case "geohash":
73
+ case "geoshape":
74
+ case "objectType":
75
+ return {
76
+ ...base,
77
+ fieldComponent: "TEXT_INPUT",
78
+ fieldComponentProps: {}
79
+ };
80
+ case "boolean":
81
+ return {
82
+ ...base,
83
+ fieldComponent: "RADIO_BUTTONS",
84
+ fieldComponentProps: {
85
+ options: [{
86
+ label: "True",
87
+ value: true
88
+ }, {
89
+ label: "False",
90
+ value: false
91
+ }]
92
+ }
93
+ };
94
+ case "integer":
95
+ case "double":
96
+ case "long":
97
+ return {
98
+ ...base,
99
+ fieldComponent: "NUMBER_INPUT",
100
+ fieldComponentProps: {}
101
+ };
102
+ case "datetime":
103
+ case "timestamp":
104
+ return {
105
+ ...base,
106
+ fieldComponent: "DATETIME_PICKER",
107
+ fieldComponentProps: {}
108
+ };
109
+ case "attachment":
110
+ case "mediaReference":
111
+ return {
112
+ ...base,
113
+ fieldComponent: "FILE_PICKER",
114
+ fieldComponentProps: {}
115
+ };
116
+ default:
117
+ return assertUnreachable(paramType);
118
+ }
32
119
  }
33
120
  //# sourceMappingURL=getDefaultFieldDefinitions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDefaultFieldDefinitions.js","names":["getDefaultFieldComponent","getDefaultFieldDefinitions","metadata","Object","entries","parameters","map","key","param","fieldKey","label","fieldComponent","type","isRequired","nullable"],"sources":["getDefaultFieldDefinitions.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 { ActionDefinition, ActionMetadata } from \"@osdk/api\";\nimport type {\n ActionParameters,\n FieldDescriptorType,\n FieldKey,\n FormFieldDefinition,\n ValidFormFieldForPropertyType,\n} from \"../FormFieldApi.js\";\nimport { getDefaultFieldComponent } from \"./getDefaultFieldComponent.js\";\n\n/**\n * Derives default field definitions from fetched ActionMetadata.\n */\nexport function getDefaultFieldDefinitions<\n Q extends ActionDefinition<unknown>,\n>(metadata: ActionMetadata): ReadonlyArray<FormFieldDefinition<Q>> {\n return Object.entries(metadata.parameters).map(([key, param]) => ({\n // Object.entries erases key types; assertion bridges runtime string to FieldKey<Q>\n fieldKey: key as FieldKey<Q>,\n label: key,\n // getDefaultFieldComponent returns FieldComponent (full union); TS can't verify\n // it matches ValidFormFieldForPropertyType for a deferred generic Q\n fieldComponent: getDefaultFieldComponent(\n param.type,\n ) as ValidFormFieldForPropertyType<\n FieldDescriptorType<Q, keyof ActionParameters<Q>>\n >,\n isRequired: !param.nullable,\n }));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SAASA,wBAAwB,QAAQ,+BAA+B;;AAExE;AACA;AACA;AACA,OAAO,SAASC,0BAA0BA,CAExCC,QAAwB,EAAyC;EACjE,OAAOC,MAAM,CAACC,OAAO,CAACF,QAAQ,CAACG,UAAU,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,MAAM;IAChE;IACAC,QAAQ,EAAEF,GAAkB;IAC5BG,KAAK,EAAEH,GAAG;IACV;IACA;IACAI,cAAc,EAAEX,wBAAwB,CACtCQ,KAAK,CAACI,IACR,CAEC;IACDC,UAAU,EAAE,CAACL,KAAK,CAACM;EACrB,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"file":"getDefaultFieldDefinitions.js","names":["assertUnreachable","getDefaultFieldDefinitions","metadata","Object","entries","parameters","map","key","param","buildFieldDefinition","EMPTY_ITEMS","base","fieldKey","label","isRequired","nullable","fieldType","type","paramType","fieldComponent","fieldComponentProps","items","options","value"],"sources":["getDefaultFieldDefinitions.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 { ActionMetadata } from \"@osdk/api\";\nimport { assertUnreachable } from \"../../shared/assertUnreachable.js\";\nimport type { RendererFieldDefinition } from \"../FormFieldApi.js\";\n\n/**\n * Derives default field definitions from ActionMetadata.\n *\n * Each parameter type maps to a concrete RendererFieldDefinition with the\n * correct fieldComponent and default fieldComponentProps.\n */\nexport function getDefaultFieldDefinitions(\n metadata: ActionMetadata,\n): ReadonlyArray<RendererFieldDefinition> {\n return Object.entries(metadata.parameters).map(\n ([key, param]) => buildFieldDefinition(key, param),\n );\n}\n\nconst EMPTY_ITEMS: unknown[] = [];\n\n/**\n * Maps a single action parameter to its default RendererFieldDefinition.\n *\n * Switches on the parameter's data type to select both the field component\n * and its required default props.\n */\nfunction buildFieldDefinition(\n key: string,\n param: ActionMetadata.Parameter,\n): RendererFieldDefinition {\n const base = {\n fieldKey: key,\n label: key,\n isRequired: !param.nullable,\n fieldType: param.type,\n };\n\n const paramType = param.type;\n\n if (typeof paramType === \"object\") {\n switch (paramType.type) {\n case \"objectSet\":\n return {\n ...base,\n fieldComponent: \"OBJECT_SET\",\n fieldComponentProps: {},\n };\n case \"object\":\n case \"interface\":\n // TODO: provide correct items\n return {\n ...base,\n fieldComponent: \"DROPDOWN\",\n fieldComponentProps: { items: EMPTY_ITEMS },\n };\n case \"struct\":\n return {\n ...base,\n fieldComponent: \"TEXT_INPUT\",\n fieldComponentProps: {},\n };\n }\n }\n\n switch (paramType) {\n case \"string\":\n case \"marking\":\n case \"geohash\":\n case \"geoshape\":\n case \"objectType\":\n return {\n ...base,\n fieldComponent: \"TEXT_INPUT\",\n fieldComponentProps: {},\n };\n case \"boolean\":\n return {\n ...base,\n fieldComponent: \"RADIO_BUTTONS\",\n fieldComponentProps: {\n options: [{ label: \"True\", value: true }, {\n label: \"False\",\n value: false,\n }],\n },\n };\n case \"integer\":\n case \"double\":\n case \"long\":\n return {\n ...base,\n fieldComponent: \"NUMBER_INPUT\",\n fieldComponentProps: {},\n };\n case \"datetime\":\n case \"timestamp\":\n return {\n ...base,\n fieldComponent: \"DATETIME_PICKER\",\n fieldComponentProps: {},\n };\n case \"attachment\":\n case \"mediaReference\":\n return {\n ...base,\n fieldComponent: \"FILE_PICKER\",\n fieldComponentProps: {},\n };\n default:\n return assertUnreachable(paramType);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,iBAAiB,QAAQ,mCAAmC;AAGrE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,0BAA0BA,CACxCC,QAAwB,EACgB;EACxC,OAAOC,MAAM,CAACC,OAAO,CAACF,QAAQ,CAACG,UAAU,CAAC,CAACC,GAAG,CAC5C,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAKC,oBAAoB,CAACF,GAAG,EAAEC,KAAK,CACnD,CAAC;AACH;AAEA,MAAME,WAAsB,GAAG,EAAE;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA,SAASD,oBAAoBA,CAC3BF,GAAW,EACXC,KAA+B,EACN;EACzB,MAAMG,IAAI,GAAG;IACXC,QAAQ,EAAEL,GAAG;IACbM,KAAK,EAAEN,GAAG;IACVO,UAAU,EAAE,CAACN,KAAK,CAACO,QAAQ;IAC3BC,SAAS,EAAER,KAAK,CAACS;EACnB,CAAC;EAED,MAAMC,SAAS,GAAGV,KAAK,CAACS,IAAI;EAE5B,IAAI,OAAOC,SAAS,KAAK,QAAQ,EAAE;IACjC,QAAQA,SAAS,CAACD,IAAI;MACpB,KAAK,W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xB,CAAC;IACH;MACE,OAAOpB,iBAAiB,CAACkB,SAAS,CAAC;EACvC;AACF","ignoreList":[]}
@@ -25,11 +25,13 @@ export function Dialog({
25
25
  title,
26
26
  children,
27
27
  footer,
28
- className
28
+ className,
29
+ disablePointerDismissal
29
30
  }) {
30
31
  return /*#__PURE__*/React.createElement(BaseUIDialog.Root, {
31
32
  open: isOpen,
32
- onOpenChange: onOpenChange
33
+ onOpenChange: onOpenChange,
34
+ disablePointerDismissal: disablePointerDismissal
33
35
  }, /*#__PURE__*/React.createElement(BaseUIDialog.Portal, null, /*#__PURE__*/React.createElement(BaseUIDialog.Backdrop, {
34
36
  className: styles.backdrop
35
37
  }), /*#__PURE__*/React.createElement(BaseUIDialog.Popup, {
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","names":["Dialog","BaseUIDialog","Cross","classnames","React","styles","isOpen","onOpenChange","title","children","footer","className","createElement","Root","open","Portal","Backdrop","backdrop","Popup","popup","header","Title","Close","closeButton","closeIcon","body"],"sources":["Dialog.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 { Dialog as BaseUIDialog } from \"@base-ui/react/dialog\";\nimport { Cross } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport React from \"react\";\nimport styles from \"./Dialog.module.css\";\n\nexport interface DialogProps {\n isOpen: boolean;\n onOpenChange: () => void;\n title: React.ReactNode;\n children: React.ReactNode;\n footer?: React.ReactNode;\n className?: string;\n}\n\nexport function Dialog({\n isOpen,\n onOpenChange,\n title,\n children,\n footer,\n className,\n}: DialogProps): React.ReactElement {\n return (\n <BaseUIDialog.Root open={isOpen} onOpenChange={onOpenChange}>\n <BaseUIDialog.Portal>\n <BaseUIDialog.Backdrop className={styles.backdrop} />\n <BaseUIDialog.Popup\n className={classnames(\n styles.popup,\n className,\n )}\n >\n <div className={styles.header}>\n <BaseUIDialog.Title className={styles.title}>\n {title}\n </BaseUIDialog.Title>\n <BaseUIDialog.Close\n className={styles.closeButton}\n aria-label=\"Close dialog\"\n >\n <Cross className={styles.closeIcon} />\n </BaseUIDialog.Close>\n </div>\n <div className={styles.body}>{children}</div>\n {footer != null && <div className={styles.footer}>{footer}</div>}\n </BaseUIDialog.Popup>\n </BaseUIDialog.Portal>\n </BaseUIDialog.Root>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,MAAM,IAAIC,YAAY,QAAQ,uBAAuB;AAC9D,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,MAAM,MAAM,qBAAqB;AAWxC,OAAO,SAASL,MAAMA,CAAC;EACrBM,MAAM;EACNC,YAAY;EACZC,KAAK;EACLC,QAAQ;EACRC,MAAM;EACNC;AACW,CAAC,EAAsB;EAClC,oBACEP,KAAA,CAAAQ,aAAA,CAACX,YAAY,CAACY,IAAI;IAACC,IAAI,EAAER,MAAO;IAACC,YAAY,EAAEA;EAAa,gBAC1DH,KAAA,CAAAQ,aAAA,CAACX,YAAY,CAACc,MAAM,qBAClBX,KAAA,CAAAQ,aAAA,CAACX,YAAY,CAACe,QAAQ;IAACL,SAAS,EAAEN,MAAM,CAACY;EAAS,CAAE,CAAC,eACrDb,KAAA,CAAAQ,aAAA,CAACX,YAAY,CAACiB,KAAK;IACjBP,SAAS,EAAER,UAAU,CACnBE,MAAM,CAACc,KAAK,EACZR,SACF;EAAE,gBAEFP,KAAA,CAAAQ,aAAA;IAAKD,SAAS,EAAEN,MAAM,CAACe;EAAO,gBAC5BhB,KAAA,CAAAQ,aAAA,CAACX,YAAY,CAACoB,KAAK;IAACV,SAAS,EAAEN,MAAM,CAACG;EAAM,GACzCA,KACiB,CAAC,eACrBJ,KAAA,CAAAQ,aAAA,CAACX,YAAY,CAACqB,KAAK;IACjBX,SAAS,EAAEN,MAAM,CAACkB,WAAY;IAC9B,cAAW;EAAc,gBAEzBnB,KAAA,CAAAQ,aAAA,CAACV,KAAK;IAACS,SAAS,EAAEN,MAAM,CAACmB;EAAU,CAAE,CACnB,CACjB,CAAC,eACNpB,KAAA,CAAAQ,aAAA;IAAKD,SAAS,EAAEN,MAAM,CAACoB;EAAK,GAAEhB,QAAc,CAAC,EAC5CC,MAAM,IAAI,IAAI,iBAAIN,KAAA,CAAAQ,aAAA;IAAKD,SAAS,EAAEN,MAAM,CAACK;EAAO,GAAEA,MAAY,CAC7C,CACD,CACJ,CAAC;AAExB","ignoreList":[]}
1
+ {"version":3,"file":"Dialog.js","names":["Dialog","BaseUIDialog","Cross","classnames","React","styles","isOpen","onOpenChange","title","children","footer","className","disablePointerDismissal","createElement","Root","open","Portal","Backdrop","backdrop","Popup","popup","header","Title","Close","closeButton","closeIcon","body"],"sources":["Dialog.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 { Dialog as BaseUIDialog } from \"@base-ui/react/dialog\";\nimport { Cross } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport React from \"react\";\nimport styles from \"./Dialog.module.css\";\n\nexport interface DialogProps {\n isOpen: boolean;\n onOpenChange: (open: boolean) => void;\n title: React.ReactNode;\n children: React.ReactNode;\n footer?: React.ReactNode;\n className?: string;\n disablePointerDismissal?: boolean;\n}\n\nexport function Dialog({\n isOpen,\n onOpenChange,\n title,\n children,\n footer,\n className,\n disablePointerDismissal,\n}: DialogProps): React.ReactElement {\n return (\n <BaseUIDialog.Root\n open={isOpen}\n onOpenChange={onOpenChange}\n disablePointerDismissal={disablePointerDismissal}\n >\n <BaseUIDialog.Portal>\n <BaseUIDialog.Backdrop className={styles.backdrop} />\n <BaseUIDialog.Popup\n className={classnames(\n styles.popup,\n className,\n )}\n >\n <div className={styles.header}>\n <BaseUIDialog.Title className={styles.title}>\n {title}\n </BaseUIDialog.Title>\n <BaseUIDialog.Close\n className={styles.closeButton}\n aria-label=\"Close dialog\"\n >\n <Cross className={styles.closeIcon} />\n </BaseUIDialog.Close>\n </div>\n <div className={styles.body}>{children}</div>\n {footer != null && <div className={styles.footer}>{footer}</div>}\n </BaseUIDialog.Popup>\n </BaseUIDialog.Portal>\n </BaseUIDialog.Root>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,MAAM,IAAIC,YAAY,QAAQ,uBAAuB;AAC9D,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,MAAM,MAAM,qBAAqB;AAYxC,OAAO,SAASL,MAAMA,CAAC;EACrBM,MAAM;EACNC,YAAY;EACZC,KAAK;EACLC,QAAQ;EACRC,MAAM;EACNC,SAAS;EACTC;AACW,CAAC,EAAsB;EAClC,oBACER,KAAA,CAAAS,aAAA,CAACZ,YAAY,CAACa,IAAI;IAChBC,IAAI,EAAET,MAAO;IACbC,YAAY,EAAEA,YAAa;IAC3BK,uBAAuB,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