@osdk/react-components 0.3.0-main-20260408142652 → 0.3.0-main-20260408215622

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 (61) hide show
  1. package/CHANGELOG.md +5 -4
  2. package/build/browser/action-form/BaseForm.js +4 -1
  3. package/build/browser/action-form/BaseForm.js.map +1 -1
  4. package/build/browser/action-form/FormFieldApi.js.map +1 -1
  5. package/build/browser/action-form/fields/FieldBridge.js +1 -2
  6. package/build/browser/action-form/fields/FieldBridge.js.map +1 -1
  7. package/build/browser/action-form/fields/FormFieldRenderer.js +4 -1
  8. package/build/browser/action-form/fields/FormFieldRenderer.js.map +1 -1
  9. package/build/browser/action-form/fields/ObjectSetField.js +115 -0
  10. package/build/browser/action-form/fields/ObjectSetField.js.map +1 -0
  11. package/build/browser/action-form/fields/ObjectSetField.module.css +45 -0
  12. package/build/browser/action-form/fields/ObjectSetField.module.css.js +10 -0
  13. package/build/browser/action-form/utils/getDefaultFieldDefinitions.js +3 -1
  14. package/build/browser/action-form/utils/getDefaultFieldDefinitions.js.map +1 -1
  15. package/build/browser/base-components/icon/BlueprintIcon.js +58 -0
  16. package/build/browser/base-components/icon/BlueprintIcon.js.map +1 -0
  17. package/build/browser/base-components/skeleton/SkeletonBar.js.map +1 -1
  18. package/build/browser/public/primitives.js +1 -0
  19. package/build/browser/public/primitives.js.map +1 -1
  20. package/build/browser/styles.css +48 -0
  21. package/build/cjs/{chunk-MRRRZN44.cjs → chunk-5RXC6RGN.cjs} +54 -32
  22. package/build/cjs/chunk-5RXC6RGN.cjs.map +1 -0
  23. package/build/cjs/public/experimental.cjs +1348 -1238
  24. package/build/cjs/public/experimental.cjs.map +1 -1
  25. package/build/cjs/public/experimental.css +27 -0
  26. package/build/cjs/public/experimental.css.map +1 -1
  27. package/build/cjs/public/experimental.d.cts +22 -6
  28. package/build/cjs/public/primitives.cjs +9 -5
  29. package/build/cjs/public/primitives.css +22 -0
  30. package/build/cjs/public/primitives.css.map +1 -1
  31. package/build/cjs/public/primitives.d.cts +9 -1
  32. package/build/esm/action-form/BaseForm.js +4 -1
  33. package/build/esm/action-form/BaseForm.js.map +1 -1
  34. package/build/esm/action-form/FormFieldApi.js.map +1 -1
  35. package/build/esm/action-form/fields/FieldBridge.js +1 -2
  36. package/build/esm/action-form/fields/FieldBridge.js.map +1 -1
  37. package/build/esm/action-form/fields/FormFieldRenderer.js +4 -1
  38. package/build/esm/action-form/fields/FormFieldRenderer.js.map +1 -1
  39. package/build/esm/action-form/fields/ObjectSetField.js +115 -0
  40. package/build/esm/action-form/fields/ObjectSetField.js.map +1 -0
  41. package/build/esm/action-form/fields/ObjectSetField.module.css +45 -0
  42. package/build/esm/action-form/utils/getDefaultFieldDefinitions.js +3 -1
  43. package/build/esm/action-form/utils/getDefaultFieldDefinitions.js.map +1 -1
  44. package/build/esm/base-components/icon/BlueprintIcon.js +58 -0
  45. package/build/esm/base-components/icon/BlueprintIcon.js.map +1 -0
  46. package/build/esm/base-components/skeleton/SkeletonBar.js.map +1 -1
  47. package/build/esm/public/primitives.js +1 -0
  48. package/build/esm/public/primitives.js.map +1 -1
  49. package/build/types/action-form/FormFieldApi.d.ts +23 -6
  50. package/build/types/action-form/FormFieldApi.d.ts.map +1 -1
  51. package/build/types/action-form/fields/FormFieldRenderer.d.ts.map +1 -1
  52. package/build/types/action-form/fields/ObjectSetField.d.ts +4 -0
  53. package/build/types/action-form/fields/ObjectSetField.d.ts.map +1 -0
  54. package/build/types/base-components/icon/BlueprintIcon.d.ts +12 -0
  55. package/build/types/base-components/icon/BlueprintIcon.d.ts.map +1 -0
  56. package/build/types/base-components/skeleton/SkeletonBar.d.ts +1 -2
  57. package/build/types/base-components/skeleton/SkeletonBar.d.ts.map +1 -1
  58. package/build/types/public/primitives.d.ts +1 -0
  59. package/build/types/public/primitives.d.ts.map +1 -1
  60. package/package.json +4 -4
  61. package/build/cjs/chunk-MRRRZN44.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @osdk/react-components
2
2
 
3
- ## 0.3.0-main-20260408142652
3
+ ## 0.3.0-main-20260408215622
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -12,6 +12,7 @@
12
12
  ### Patch Changes
13
13
 
14
14
  - 236a88b: Downgrade react-day-picker from v9 to ^8.10.0
15
+ - 86d0bce: Add ObjectSetField component for action forms
15
16
  - 79b001e: Add FilePickerField component for attachment and media reference form fields
16
17
  - b2b512e: Address FilePickerField PR review comments: memoize computed values, add aria-label, rename CSS token, add keyboard interaction tests
17
18
  - Updated dependencies [f8b9f12]
@@ -19,9 +20,9 @@
19
20
  - Updated dependencies [0b349bd]
20
21
  - Updated dependencies [51ccca8]
21
22
  - Updated dependencies [fb85818]
22
- - @osdk/client@2.9.0-main-20260408142652
23
- - @osdk/react@0.11.0-main-20260408142652
24
- - @osdk/api@2.9.0-main-20260408142652
23
+ - @osdk/client@2.9.0-main-20260408215622
24
+ - @osdk/react@0.11.0-main-20260408215622
25
+ - @osdk/api@2.9.0-main-20260408215622
25
26
 
26
27
  ## 0.2.0
27
28
 
@@ -76,7 +76,10 @@ export const BaseForm = /*#__PURE__*/memo(function ({
76
76
  function buildDefaultValues(fieldDefinitions) {
77
77
  const values = {};
78
78
  for (const def of fieldDefinitions) {
79
- values[def.fieldKey] = def.defaultValue;
79
+ const props = def.fieldComponentProps;
80
+ if ("defaultValue" in props) {
81
+ values[def.fieldKey] = props.defaultValue;
82
+ }
80
83
  }
81
84
  return values;
82
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BaseForm.js","names":["classNames","React","memo","useCallback","useMemo","useForm","ActionButton","styles","FieldBridge","FormHeader","BaseForm","formTitle","fieldDefinitions","formState","controlledFormState","onFieldValueChange","onSubmit","isSubmitDisabled","isPending","isLoading","className","defaultValues","buildDefaultValues","control","handleSubmit","rhfHandleSubmit","values","onFormSubmit","rhfValues","createElement","osdkForm","title","length","role","osdkFormFields","map","fieldDef","key","fieldKey","onExternalChange","osdkFormFooter","type","variant","disabled","def","defaultValue"],"sources":["BaseForm.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 classNames from \"classnames\";\nimport React, { memo, useCallback, useMemo } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport { ActionButton } from \"../base-components/action-button/ActionButton.js\";\nimport type { BaseFormProps } from \"./ActionFormApi.js\";\nimport styles from \"./BaseForm.module.css\";\nimport { FieldBridge } from \"./fields/FieldBridge.js\";\nimport type { RendererFieldDefinition } from \"./FormFieldApi.js\";\nimport { FormHeader } from \"./FormHeader.js\";\n\nexport const BaseForm: React.FC<BaseFormProps> = memo(function BaseFormFn({\n formTitle,\n fieldDefinitions,\n formState: controlledFormState,\n onFieldValueChange,\n onSubmit,\n isSubmitDisabled = false,\n isPending = false,\n isLoading = false,\n className,\n}: BaseFormProps): React.ReactElement {\n const isControlled = controlledFormState != null;\n\n const defaultValues = useMemo(\n () => buildDefaultValues(fieldDefinitions),\n [fieldDefinitions],\n );\n\n const { control, handleSubmit: rhfHandleSubmit } = useForm<\n Record<string, unknown>\n >({\n ...(isControlled ? { values: controlledFormState } : { defaultValues }),\n });\n\n const onFormSubmit = useCallback(\n (rhfValues: Record<string, unknown>) => {\n // In controlled mode, always submit the controlled state, not RHF's\n // internal state. Between a user keystroke and the parent re-rendering,\n // RHF's store may hold the user-typed value rather than the parent's\n // value. Using controlledFormState directly preserves the existing\n // guarantee that controlled mode submits the parent's state.\n onSubmit(controlledFormState ?? rhfValues);\n },\n [onSubmit, controlledFormState],\n );\n\n return (\n <form\n className={classNames(styles.osdkForm, className)}\n onSubmit={rhfHandleSubmit(onFormSubmit)}\n >\n {formTitle != null && <FormHeader title={formTitle} />}\n {isLoading && fieldDefinitions.length === 0 && (\n <div role=\"status\">Loading form fields...</div>\n )}\n <div className={styles.osdkFormFields}>\n {fieldDefinitions.map((fieldDef) => (\n <FieldBridge\n key={fieldDef.fieldKey}\n fieldDef={fieldDef}\n control={control}\n onExternalChange={onFieldValueChange}\n />\n ))}\n </div>\n <div className={styles.osdkFormFooter}>\n <ActionButton\n type=\"submit\"\n variant=\"primary\"\n disabled={isSubmitDisabled || isPending}\n >\n {isPending ? \"Submitting…\" : \"Submit\"}\n </ActionButton>\n </div>\n </form>\n );\n});\n\nfunction buildDefaultValues(\n fieldDefinitions: ReadonlyArray<RendererFieldDefinition>,\n): Record<string, unknown> {\n const values: Record<string, unknown> = {};\n for (const def of fieldDefinitions) {\n values[def.fieldKey] = def.defaultValue;\n }\n return values;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,IAAIC,IAAI,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACzD,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,YAAY,QAAQ,kDAAkD;AAE/E,OAAOC,MAAM,MAAM,uBAAuB;AAC1C,SAASC,WAAW,QAAQ,yBAAyB;AAErD,SAASC,UAAU,QAAQ,iBAAiB;AAE5C,OAAO,MAAMC,QAAiC,gBAAGR,IAAI,CAAC,UAAoB;EACxES,SAAS;EACTC,gBAAgB;EAChBC,SAAS,EAAEC,mBAAmB;EAC9BC,kBAAkB;EAClBC,QAAQ;EACRC,gBAAgB,GAAG,KAAK;EACxBC,SAAS,GAAG,KAAK;EACjBC,SAAS,GAAG,KAAK;EACjBC;AACa,CAAC,EAAsB;EAGpC,MAAMC,a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,CAACiC;EAAe,gBACpCvC,KAAA,CAAA4B,aAAA,CAACvB,YAAY;IACXmC,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAC,SAAS;IACjBC,QAAQ,EAAE1B,gBAAgB,IAAIC;EAAU,GAEvCA,SAAS,GAAG,aAAa,GAAG,QACjB,CACX,CACD,CAAC;AAEX,CAAC,CAAC;AAEF,SAASI,kBAAkBA,CACzBV,gBAAwD,EAC/B;EACzB,MAAMc,MAA+B,GAAG,CAAC,CAAC;EAC1C,KAAK,MAAMkB,GAAG,IAAIhC,gBAAgB,EAAE;IAClCc,MAAM,CAACkB,GAAG,CAACN,QAAQ,CAAC,GAAGM,GAAG,CAACC,YAAY;EACzC;EACA,OAAOnB,MAAM;AACf","ignoreList":[]}
1
+ {"version":3,"file":"BaseForm.js","names":["classNames","React","memo","useCallback","useMemo","useForm","ActionButton","styles","FieldBridge","FormHeader","BaseForm","formTitle","fieldDefinitions","formState","controlledFormState","onFieldValueChange","onSubmit","isSubmitDisabled","isPending","isLoading","className","defaultValues","buildDefaultValues","control","handleSubmit","rhfHandleSubmit","values","onFormSubmit","rhfValues","createElement","osdkForm","title","length","role","osdkFormFields","map","fieldDef","key","fieldKey","onExternalChange","osdkFormFooter","type","variant","disabled","def","props","fieldComponentProps","defaultValue"],"sources":["BaseForm.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 classNames from \"classnames\";\nimport React, { memo, useCallback, useMemo } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport { ActionButton } from \"../base-components/action-button/ActionButton.js\";\nimport type { BaseFormProps } from \"./ActionFormApi.js\";\nimport styles from \"./BaseForm.module.css\";\nimport { FieldBridge } from \"./fields/FieldBridge.js\";\nimport type { RendererFieldDefinition } from \"./FormFieldApi.js\";\nimport { FormHeader } from \"./FormHeader.js\";\n\nexport const BaseForm: React.FC<BaseFormProps> = memo(function BaseFormFn({\n formTitle,\n fieldDefinitions,\n formState: controlledFormState,\n onFieldValueChange,\n onSubmit,\n isSubmitDisabled = false,\n isPending = false,\n isLoading = false,\n className,\n}: BaseFormProps): React.ReactElement {\n const isControlled = controlledFormState != null;\n\n const defaultValues = useMemo(\n () => buildDefaultValues(fieldDefinitions),\n [fieldDefinitions],\n );\n\n const { control, handleSubmit: rhfHandleSubmit } = useForm<\n Record<string, unknown>\n >({\n ...(isControlled ? { values: controlledFormState } : { defaultValues }),\n });\n\n const onFormSubmit = useCallback(\n (rhfValues: Record<string, unknown>) => {\n // In controlled mode, always submit the controlled state, not RHF's\n // internal state. Between a user keystroke and the parent re-rendering,\n // RHF's store may hold the user-typed value rather than the parent's\n // value. Using controlledFormState directly preserves the existing\n // guarantee that controlled mode submits the parent's state.\n onSubmit(controlledFormState ?? rhfValues);\n },\n [onSubmit, controlledFormState],\n );\n\n return (\n <form\n className={classNames(styles.osdkForm, className)}\n onSubmit={rhfHandleSubmit(onFormSubmit)}\n >\n {formTitle != null && <FormHeader title={formTitle} />}\n {isLoading && fieldDefinitions.length === 0 && (\n <div role=\"status\">Loading form fields...</div>\n )}\n <div className={styles.osdkFormFields}>\n {fieldDefinitions.map((fieldDef) => (\n <FieldBridge\n key={fieldDef.fieldKey}\n fieldDef={fieldDef}\n control={control}\n onExternalChange={onFieldValueChange}\n />\n ))}\n </div>\n <div className={styles.osdkFormFooter}>\n <ActionButton\n type=\"submit\"\n variant=\"primary\"\n disabled={isSubmitDisabled || isPending}\n >\n {isPending ? \"Submitting…\" : \"Submit\"}\n </ActionButton>\n </div>\n </form>\n );\n});\n\nfunction buildDefaultValues(\n fieldDefinitions: ReadonlyArray<RendererFieldDefinition>,\n): Record<string, unknown> {\n const values: Record<string, unknown> = {};\n for (const def of fieldDefinitions) {\n const props: Record<string, unknown> = def.fieldComponentProps;\n if (\"defaultValue\" in props) {\n values[def.fieldKey] = props.defaultValue;\n }\n }\n return values;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,IAAIC,IAAI,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACzD,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,YAAY,QAAQ,kDAAkD;AAE/E,OAAOC,MAAM,MAAM,uBAAuB;AAC1C,SAASC,WAAW,QAAQ,yBAAyB;AAErD,SAASC,UAAU,QAAQ,iBAAiB;AAE5C,OAAO,MAAMC,QAAiC,gBAAGR,IAAI,CAAC,UAAoB;EACxES,SAAS;EACTC,gBAAgB;EAChBC,SAAS,EAAEC,mBAAmB;EAC9BC,kBAAkB;EAClBC,QAAQ;EACRC,gBAAgB,GAAG,KAAK;EACxBC,SAAS,GAAG,KAAK;EACjBC,SAAS,GAAG,KAAK;EACjBC;AACa,CAAC,EAAsB;EAGpC,MAAMC,aAAa,GAAGjB,OAAO,CAC3B,MAAMkB,kBAAkB,CAACV,gBAAgB,CAAC,EAC1C,CAACA,gBAAgB,CACnB,CAAC;EAED,MAAM;IAAEW,OAAO;IAAEC,YAAY,EAAEC;EAAgB,CAAC,GAAGpB,OAAO,CAExD;IACA,IAVmBS,mBAAmB,IAAI,IAAI,GAU3B;MAAEY,MAAM,EAAEZ;IAAoB,CAAC,GAAG;MAAEO;IAAc,CAAC;EACxE,CAAC,CAAC;EAEF,MAAMM,YAAY,GAAGxB,WAAW,CAC7ByB,SAAkC,IAAK;IACtC;IACA;IACA;IACA;IACA;IACAZ,QAAQ,CAACF,mBAAmB,IAAIc,SAAS,CAAC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Ac,IAAID,KAAK,EAAE;MAC3BnB,MAAM,CAACkB,GAAG,CAACN,QAAQ,CAAC,GAAGO,KAAK,CAACE,YAAY;IAC3C;EACF;EACA,OAAOrB,MAAM;AACf","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldApi.js","names":[],"sources":["FormFieldApi.ts"],"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 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 */\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 * The text displayed when no file is selected.\n *\n * @default \"No file chosen\"\n */\n text?: string;\n\n /**\n * The text displayed on the browse button.\n *\n * @default \"Browse\"\n */\n buttonText?: string;\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 BaseFormFieldProps<number> {\n /**\n * Minimum allowed value.\n */\n min?: number;\n\n /**\n * Maximum allowed value.\n */\n max?: number;\n\n /**\n * Step increment for the input. Used by the stepper buttons and ArrowUp/ArrowDown keyboard stepping.\n *\n * @default 1\n */\n step?: number;\n\n /**\n * Placeholder text shown when the input is empty.\n */\n placeholder?: string;\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 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 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 */\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 FormManagedProps<\n ValidFormFieldForPropertyType<FieldDescriptorType<Q, K>>\n >\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 * The text displayed when no file is selected.\n *\n * @default \"No file chosen\"\n */\n text?: string;\n\n /**\n * The text displayed on the browse button.\n *\n * @default \"Browse\"\n */\n buttonText?: string;\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 BaseFormFieldProps<number> {\n /**\n * Minimum allowed value.\n */\n min?: number;\n\n /**\n * Maximum allowed value.\n */\n max?: number;\n\n /**\n * Step increment for the input. Used by the stepper buttons and ArrowUp/ArrowDown keyboard stepping.\n *\n * @default 1\n */\n step?: number;\n\n /**\n * Placeholder text shown when the input is empty.\n */\n placeholder?: string;\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 Pick<BaseFormFieldProps<ObjectSet<T>>, \"id\" | \"value\">\n{\n /**\n * Message displayed when no object set is provided.\n *\n * @default \"Object set is not defined\"\n */\n emptyMessage?: string;\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 /**\n * The default value of the form field.\n */\n defaultValue?: V;\n\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 * Props managed by form state infrastructure (FieldBridge / RHF).\n * Fields with onChange participate in form state → value and onChange are managed\n * externally. Read-only fields (no onChange, e.g. ObjectSetField) keep value in\n * fieldComponentProps so it bypasses form state cloning.\n */\ntype FormManagedProps<K extends FieldComponent> = \"onChange\" extends\n keyof FormFieldPropsByType[K] ? \"value\" | \"onChange\"\n : \"onChange\";\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 isRequired?: boolean;\n placeholder?: string;\n helperText?: string;\n helperTextPlacement?: \"bottom\" | \"tooltip\";\n fieldComponentProps: Omit<FormFieldPropsByType[K], FormManagedProps<K>>;\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":[]}
@@ -29,8 +29,7 @@ export const FieldBridge = /*#__PURE__*/memo(function ({
29
29
  }
30
30
  } = useController({
31
31
  name: fieldDef.fieldKey,
32
- control,
33
- defaultValue: fieldDef.defaultValue
32
+ control
34
33
  });
35
34
  const handleChange = useCallback(newValue => {
36
35
  onChange(newValue);
@@ -1 +1 @@
1
- {"version":3,"file":"FieldBridge.js","names":["React","memo","useCallback","useController","FormFieldRenderer","FieldBridge","fieldDef","control","onExternalChange","field","onChange","value","name","fieldKey","defaultValue","handleChange","newValue","createElement","fieldDefinition","onFieldValueChange"],"sources":["FieldBridge.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 React, { memo, useCallback } from \"react\";\nimport type { Control } from \"react-hook-form\";\nimport { useController } from \"react-hook-form\";\nimport type { RendererFieldDefinition } from \"../FormFieldApi.js\";\nimport { FormFieldRenderer } from \"./FormFieldRenderer.js\";\n\nexport interface FieldBridgeProps {\n fieldDef: RendererFieldDefinition;\n control: Control<Record<string, unknown>>;\n onExternalChange?: (fieldKey: string, value: unknown) => void;\n}\nexport const FieldBridge: React.FC<FieldBridgeProps> = memo(\n function FieldBridgeFn({\n fieldDef,\n control,\n onExternalChange,\n }: FieldBridgeProps): React.ReactElement {\n const {\n field: { onChange, value },\n } = useController({\n name: fieldDef.fieldKey,\n control,\n defaultValue: fieldDef.defaultValue,\n });\n\n const handleChange = useCallback(\n (newValue: unknown) => {\n onChange(newValue);\n onExternalChange?.(fieldDef.fieldKey, newValue);\n },\n [onChange, onExternalChange, fieldDef.fieldKey],\n );\n\n return (\n <FormFieldRenderer\n value={value}\n fieldDefinition={fieldDef}\n onFieldValueChange={handleChange}\n />\n );\n },\n);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,IAAI,EAAEC,WAAW,QAAQ,OAAO;AAEhD,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,SAASC,iBAAiB,QAAQ,wBAAwB;AAO1D,OAAO,MAAMC,WAAuC,gBAAGJ,IAAI,CACzD,UAAuB;EACrBK,QAAQ;EACRC,OAAO;EACPC;AACgB,CAAC,EAAsB;EACvC,MAAM;IACJC,KAAK,EAAE;MAAEC,QAAQ;MAAEC;IAAM;EAC3B,CAAC,GAAGR,aAAa,CAAC;IAChBS,IAAI,EAAEN,QAAQ,CAACO,QAAQ;IACvBN,OAAO;IACPO,YAAY,EAAER,QAAQ,CAACQ;EACzB,CAAC,CAAC;EAEF,MAAMC,YAAY,GAAGb,WAAW,CAC7Bc,QAAiB,IAAK;IACrBN,QAAQ,CAACM,QAAQ,CAAC;IAClBR,gBAAgB,GAAGF,QAAQ,CAACO,QAAQ,EAAEG,QAAQ,CAAC;EACjD,CAAC,EACD,CAACN,QAAQ,EAAEF,gBAAgB,EAAEF,QAAQ,CAACO,QAAQ,CAChD,CAAC;EAED,oBACEb,KAAA,CAAAiB,aAAA,CAACb,iBAAiB;IAChBO,KAAK,EAAEA,KAAM;IACbO,eAAe,EAAEZ,QAAS;IAC1Ba,kBAAkB,EAAEJ;EAAa,CAClC,CAAC;AAEN,CACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"FieldBridge.js","names":["React","memo","useCallback","useController","FormFieldRenderer","FieldBridge","fieldDef","control","onExternalChange","field","onChange","value","name","fieldKey","handleChange","newValue","createElement","fieldDefinition","onFieldValueChange"],"sources":["FieldBridge.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 React, { memo, useCallback } from \"react\";\nimport type { Control } from \"react-hook-form\";\nimport { useController } from \"react-hook-form\";\nimport type { RendererFieldDefinition } from \"../FormFieldApi.js\";\nimport { FormFieldRenderer } from \"./FormFieldRenderer.js\";\n\nexport interface FieldBridgeProps {\n fieldDef: RendererFieldDefinition;\n control: Control<Record<string, unknown>>;\n onExternalChange?: (fieldKey: string, value: unknown) => void;\n}\nexport const FieldBridge: React.FC<FieldBridgeProps> = memo(\n function FieldBridgeFn({\n fieldDef,\n control,\n onExternalChange,\n }: FieldBridgeProps): React.ReactElement {\n const {\n field: { onChange, value },\n } = useController({\n name: fieldDef.fieldKey,\n control,\n });\n\n const handleChange = useCallback(\n (newValue: unknown) => {\n onChange(newValue);\n onExternalChange?.(fieldDef.fieldKey, newValue);\n },\n [onChange, onExternalChange, fieldDef.fieldKey],\n );\n\n return (\n <FormFieldRenderer\n value={value}\n fieldDefinition={fieldDef}\n onFieldValueChange={handleChange}\n />\n );\n },\n);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,IAAI,EAAEC,WAAW,QAAQ,OAAO;AAEhD,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,SAASC,iBAAiB,QAAQ,wBAAwB;AAO1D,OAAO,MAAMC,WAAuC,gBAAGJ,IAAI,CACzD,UAAuB;EACrBK,QAAQ;EACRC,OAAO;EACPC;AACgB,CAAC,EAAsB;EACvC,MAAM;IACJC,KAAK,EAAE;MAAEC,QAAQ;MAAEC;IAAM;EAC3B,CAAC,GAAGR,aAAa,CAAC;IAChBS,IAAI,EAAEN,QAAQ,CAACO,QAAQ;IACvBN;EACF,CAAC,CAAC;EAEF,MAAMO,YAAY,GAAGZ,WAAW,CAC7Ba,QAAiB,IAAK;IACrBL,QAAQ,CAACK,QAAQ,CAAC;IAClBP,gBAAgB,GAAGF,QAAQ,CAACO,QAAQ,EAAEE,QAAQ,CAAC;EACjD,CAAC,EACD,CAACL,QAAQ,EAAEF,gBAAgB,EAAEF,QAAQ,CAACO,QAAQ,CAChD,CAAC;EAED,oBACEb,KAAA,CAAAgB,aAAA,CAACZ,iBAAiB;IAChBO,KAAK,EAAEA,KAAM;IACbM,eAAe,EAAEX,QAAS;IAC1BY,kBAAkB,EAAEJ;EAAa,CAClC,CAAC;AAEN,CACF,CAAC","ignoreList":[]}
@@ -22,6 +22,7 @@ import { DatetimePickerField } from "./DatetimePickerField.js";
22
22
  import { DropdownField } from "./DropdownField.js";
23
23
  import { FilePickerField } from "./FilePickerField.js";
24
24
  import { NumberInputField } from "./NumberInputField.js";
25
+ import { ObjectSetField } from "./ObjectSetField.js";
25
26
  import { RadioButtonsField } from "./RadioButtonsField.js";
26
27
  import { TextAreaField } from "./TextAreaField.js";
27
28
  import { TextInputField } from "./TextInputField.js";
@@ -103,7 +104,9 @@ function renderFieldComponent(fieldDefinition, value, onChange) {
103
104
  onChange: onChange
104
105
  }, fieldDefinition.fieldComponentProps));
105
106
  case "OBJECT_SET":
106
- return /*#__PURE__*/React.createElement("div", null, "Unsupported field type: ", fieldDefinition.fieldComponent);
107
+ return /*#__PURE__*/React.createElement(ObjectSetField, _extends({
108
+ id: fieldDefinition.fieldKey
109
+ }, fieldDefinition.fieldComponentProps));
107
110
  default:
108
111
  return assertUnreachableFieldComponent(fieldDefinition);
109
112
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldRenderer.js","names":["React","memo","FormField","CustomField","DatetimePickerField","DropdownField","FilePickerField","NumberInputField","RadioButtonsField","TextAreaField","TextInputField","FormFieldRenderer","fieldDefinition","value","onFieldValueChange","label","isRequired","helperText","helperTextPlacement","createElement","fieldKey","undefined","renderFieldComponent","onChange","fieldComponent","_extends","id","String","placeholder","fieldComponentProps","Date","coerceToFileValue","assertUnreachableFieldComponent","isFileArray","every","v","File","Array","isArray","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 { FilePickerField } from \"./FilePickerField.js\";\nimport { NumberInputField } from \"./NumberInputField.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 // TODO: Use coerceFieldValue\n return (\n <NumberInputField\n id={fieldDefinition.fieldKey}\n value={typeof value === \"number\" ? value : null}\n onChange={onChange}\n placeholder={fieldDefinition.placeholder}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"FILE_PICKER\":\n return (\n <FilePickerField\n id={fieldDefinition.fieldKey}\n value={coerceToFileValue(value)}\n onChange={onChange}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"OBJECT_SET\":\n return <div>Unsupported field type: {fieldDefinition.fieldComponent}\n </div>;\n default:\n return assertUnreachableFieldComponent(fieldDefinition);\n }\n}\n\n// TODO: Move and share with `coerceFieldValue`\nfunction isFileArray(value: unknown[]): value is File[] {\n return value.every((v) => v instanceof File);\n}\n\nfunction coerceToFileValue(value: unknown): File | File[] | null {\n if (value instanceof File) {\n return value;\n }\n if (Array.isArray(value) && isFileArray(value)) {\n return value;\n }\n return null;\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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AAA,CAACZ,gBAAgB,EAAAkB,QAAA;QACfC,EAAE,EAAEd,eAAe,CAACQ,QAAS;QAC7BP,KAAK,EAAE,OAAOA,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG,IAAK;QAChDU,QAAQ,EAAEA,QAAS;QACnBK,WAAW,EAAEhB,eAAe,CAACgB;MAAY,GACrChB,eAAe,CAACiB,mBAAmB,CACxC,CAAC;IAEN,KAAK,aAAa;MAChB,oBACE7B,KAAA,CAAAmB,aAAA,CAACb,eAAe,EAAAmB,QAAA;QACdC,EAAE,EAAEd,eAAe,CAACQ,QAAS;QAC7BP,KAAK,EAAEkB,iBAAiB,CAAClB,KAAK,CAAE;QAChCU,QAAQ,EAAEA;MAAS,GACfX,eAAe,CAACiB,mBAAmB,CACxC,CAAC;IAEN,KAAK,YAAY;MACf,oBAAO7B,KAAA,CAAAmB,aAAA,cAAK,0BAAwB,EAACP,eAAe,CAACY,cAChD,CAAC;IACR;MACE,OAAOQ,+BAA+B,CAACpB,eAAe,CAAC;EAC3D;AACF;;AAEA;AACA,SAASqB,WAAWA,CAACpB,KAAgB,EAAmB;EACtD,OAAOA,KAAK,CAACqB,KAAK,CAAEC,CAAC,IAAKA,CAAC,YAAYC,IAAI,CAAC;AAC9C;AAEA,SAASL,iBAAiBA,CAAClB,KAAc,EAAwB;EAC/D,IAAIA,KAAK,YAAYuB,IAAI,EAAE;IACzB,OAAOvB,KAAK;EACd;EACA,IAAIwB,KAAK,CAACC,OAAO,CAACzB,KAAK,CAAC,IAAIoB,WAAW,CAACpB,KAAK,CAAC,EAAE;IAC9C,OAAOA,KAAK;EACd;EACA,OAAO,IAAI;AACb;AAEA,SAASmB,+BAA+BA,CAACnB,KAAY,EAAS;EAC5D,MAAM,IAAI0B,KAAK,CAAC,8BAA8BZ,MAAM,CAACd,KAAK,CAAC,EAAE,CAAC;AAChE","ignoreList":[]}
1
+ {"version":3,"file":"FormFieldRenderer.js","names":["React","memo","FormField","CustomField","DatetimePickerField","DropdownField","FilePickerField","NumberInputField","ObjectSetField","RadioButtonsField","TextAreaField","TextInputField","FormFieldRenderer","fieldDefinition","value","onFieldValueChange","label","isRequired","helperText","helperTextPlacement","createElement","fieldKey","undefined","renderFieldComponent","onChange","fieldComponent","_extends","id","String","placeholder","fieldComponentProps","Date","coerceToFileValue","assertUnreachableFieldComponent","isFileArray","every","v","File","Array","isArray","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 { FilePickerField } from \"./FilePickerField.js\";\nimport { NumberInputField } from \"./NumberInputField.js\";\nimport { ObjectSetField } from \"./ObjectSetField.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 // TODO: Use coerceFieldValue\n return (\n <NumberInputField\n id={fieldDefinition.fieldKey}\n value={typeof value === \"number\" ? value : null}\n onChange={onChange}\n placeholder={fieldDefinition.placeholder}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"FILE_PICKER\":\n return (\n <FilePickerField\n id={fieldDefinition.fieldKey}\n value={coerceToFileValue(value)}\n onChange={onChange}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"OBJECT_SET\":\n return (\n <ObjectSetField\n id={fieldDefinition.fieldKey}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n default:\n return assertUnreachableFieldComponent(fieldDefinition);\n }\n}\n\n// TODO: Move and share with `coerceFieldValue`\nfunction isFileArray(value: unknown[]): value is File[] {\n return value.every((v) => v instanceof File);\n}\n\nfunction coerceToFileValue(value: unknown): File | File[] | null {\n if (value instanceof File) {\n return value;\n }\n if (Array.isArray(value) && isFileArray(value)) {\n return value;\n }\n return null;\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,eAAe,QAAQ,sBAAsB;AACtD,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,qBAAqB;AAQpD,OAAO,MAAMC,iBAAmD,gBAAGX,IAAI,CACrE,UAA6B;EAC3BY,eAAe;EACfC,KAAK;EACLC;AACsB,CAAC,EAAsB;EAC7C,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAoB,CAAC,GAC1DN,eAAe;EAEjB,oBACEb,KAAA,CAAAoB,aAAA,CAAClB,SAAS;IACRc,KAAK,EAAEA,KAAM;IACbC,U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E9B,KAAA,CAAAoB,aAAA,CAACZ,cAAc,EAAAkB,QAAA;QACbC,EAAE,EAAEd,eAAe,CAACQ;MAAS,GACzBR,eAAe,CAACiB,mBAAmB,CACxC,CAAC;IAEN;MACE,OAAOG,+BAA+B,CAACpB,eAAe,CAAC;EAC3D;AACF;;AAEA;AACA,SAASqB,WAAWA,CAACpB,KAAgB,EAAmB;EACtD,OAAOA,KAAK,CAACqB,KAAK,CAAEC,CAAC,IAAKA,CAAC,YAAYC,IAAI,CAAC;AAC9C;AAEA,SAASL,iBAAiBA,CAAClB,KAAc,EAAwB;EAC/D,IAAIA,KAAK,YAAYuB,IAAI,EAAE;IACzB,OAAOvB,KAAK;EACd;EACA,IAAIwB,KAAK,CAACC,OAAO,CAACzB,KAAK,CAAC,IAAIoB,WAAW,CAACpB,KAAK,CAAC,EAAE;IAC9C,OAAOA,KAAK;EACd;EACA,OAAO,IAAI;AACb;AAEA,SAASmB,+BAA+BA,CAACnB,KAAY,EAAS;EAC5D,MAAM,IAAI0B,KAAK,CAAC,8BAA8BZ,MAAM,CAACd,KAAK,CAAC,EAAE,CAAC;AAChE","ignoreList":[]}
@@ -0,0 +1,115 @@
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 { IconSize } from "@blueprintjs/icons";
18
+ import { useOsdkMetadata } from "@osdk/react";
19
+ import { useObjectSet } from "@osdk/react/experimental";
20
+ import classnames from "classnames";
21
+ import React from "react";
22
+ import { BlueprintIcon } from "../../base-components/icon/BlueprintIcon.js";
23
+ import { SkeletonBar } from "../../base-components/skeleton/SkeletonBar.js";
24
+ import { typedReactMemo } from "../../shared/typedMemo.js";
25
+ import styles from "./ObjectSetField.module.css.js";
26
+ const DEFAULT_OBJECT_ICON = {
27
+ name: "cube",
28
+ color: "#4C90F0"
29
+ };
30
+ const ICON_SIZE = IconSize.STANDARD;
31
+ const DEFAULT_EMPTY_MESSAGE = "Object set is not defined";
32
+ export const ObjectSetField = typedReactMemo(function ({
33
+ value,
34
+ emptyMessage = DEFAULT_EMPTY_MESSAGE
35
+ }) {
36
+ if (value == null) {
37
+ return /*#__PURE__*/React.createElement("div", {
38
+ className: classnames(styles.osdkObjectSetField, styles.osdkObjectSetFieldEmpty)
39
+ }, emptyMessage);
40
+ }
41
+ return /*#__PURE__*/React.createElement(ObjectSetFieldContent, {
42
+ objectSet: value
43
+ });
44
+ });
45
+ const ObjectSetFieldContent = /*#__PURE__*/React.memo(function ({
46
+ objectSet
47
+ }) {
48
+ const objectTypeDef = objectSet.$objectSetInternals.def;
49
+ const {
50
+ metadata,
51
+ loading: metadataLoading
52
+ } = useOsdkMetadata(objectTypeDef);
53
+ const {
54
+ totalCount,
55
+ data,
56
+ isLoading: objectSetLoading,
57
+ error: objectSetError
58
+ } = useObjectSet(objectSet, {
59
+ // Fetching a page size of one is enough to get the totalCount
60
+ pageSize: 1
61
+ });
62
+ const hasMetadata = metadata != null;
63
+ const icon = React.useMemo(() => metadata != null && "icon" in metadata && metadata.icon != null ? toComponentIcon(metadata.icon) : DEFAULT_OBJECT_ICON, [metadata]);
64
+ const displayName = totalCount === "1" || !hasMetadata || !("pluralDisplayName" in metadata) ? metadata?.displayName : metadata.pluralDisplayName;
65
+
66
+ // Wait for metadata even if the count is already available, so we can
67
+ // show the correct display name and avoid a flash of "objects" → "Employees".
68
+
69
+ return /*#__PURE__*/React.createElement("div", {
70
+ className: styles.osdkObjectSetField
71
+ }, metadataLoading && !hasMetadata ? /*#__PURE__*/React.createElement(React.Fragment, null, OBJECT_SET_ICON_SKELETON, OBJECT_SET_LABEL_SKELETON) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BlueprintIcon, {
72
+ icon: icon,
73
+ size: ICON_SIZE
74
+ }), /*#__PURE__*/React.createElement(ObjectSetLabel, {
75
+ displayName: displayName,
76
+ totalCount: totalCount,
77
+ error: objectSetError,
78
+ isLoading: objectSetLoading
79
+ })));
80
+ });
81
+ const ObjectSetLabel = /*#__PURE__*/React.memo(function ({
82
+ displayName,
83
+ totalCount,
84
+ isLoading,
85
+ error
86
+ }) {
87
+ const hasData = totalCount != null;
88
+ const label = displayName ?? (totalCount === "1" ? "object" : "objects");
89
+ const showSkeleton = isLoading && !hasData;
90
+ const showError = error != null && !hasData && !isLoading;
91
+ return /*#__PURE__*/React.createElement(React.Fragment, null, showSkeleton && OBJECT_SET_LABEL_SKELETON, showError && /*#__PURE__*/React.createElement("span", {
92
+ className: styles.osdkObjectSetFieldError,
93
+ role: "alert"
94
+ }, `Failed to load: ${error.message}`), !showSkeleton && !showError && /*#__PURE__*/React.createElement("span", null, `${formatCount(totalCount)} ${label}`));
95
+ });
96
+ const OBJECT_SET_ICON_SKELETON = /*#__PURE__*/React.createElement(SkeletonBar, {
97
+ className: styles.osdkObjectSetIconSkeleton
98
+ });
99
+ const OBJECT_SET_LABEL_SKELETON = /*#__PURE__*/React.createElement(SkeletonBar, {
100
+ className: styles.osdkObjectSetLabelSkeleton
101
+ });
102
+ function formatCount(count) {
103
+ if (count == null) {
104
+ return "\u2013"; // '–' symbol
105
+ }
106
+ const num = Number(count);
107
+ return Number.isNaN(num) ? count : num.toLocaleString();
108
+ }
109
+ function toComponentIcon(apiIcon) {
110
+ return {
111
+ name: apiIcon.name,
112
+ color: apiIcon.color
113
+ };
114
+ }
115
+ //# sourceMappingURL=ObjectSetField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectSetField.js","names":["IconSize","useOsdkMetadata","useObjectSet","classnames","React","BlueprintIcon","SkeletonBar","typedReactMemo","styles","DEFAULT_OBJECT_ICON","name","color","ICON_SIZE","STANDARD","DEFAULT_EMPTY_MESSAGE","ObjectSetField","value","emptyMessage","createElement","className","osdkObjectSetField","osdkObjectSetFieldEmpty","ObjectSetFieldContent","objectSet","memo","objectTypeDef","$objectSetInternals","def","metadata","loading","metadataLoading","totalCount","data","isLoading","objectSetLoading","error","objectSetError","pageSize","hasMetadata","icon","useMemo","toComponentIcon","displayName","pluralDisplayName","Fragment","OBJECT_SET_ICON_SKELETON","OBJECT_SET_LABEL_SKELETON","size","ObjectSetLabel","hasData","label","showSkeleton","showError","osdkObjectSetFieldError","role","message","formatCount","osdkObjectSetIconSkeleton","osdkObjectSetLabelSkeleton","count","num","Number","isNaN","toLocaleString","apiIcon"],"sources":["ObjectSetField.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 { type IconName, IconSize } from \"@blueprintjs/icons\";\nimport type { ObjectSet, ObjectTypeDefinition } from \"@osdk/api\";\nimport { useOsdkMetadata } from \"@osdk/react\";\nimport { useObjectSet } from \"@osdk/react/experimental\";\nimport classnames from \"classnames\";\nimport React from \"react\";\nimport {\n BlueprintIcon,\n type Icon,\n} from \"../../base-components/icon/BlueprintIcon.js\";\nimport { SkeletonBar } from \"../../base-components/skeleton/SkeletonBar.js\";\nimport { typedReactMemo } from \"../../shared/typedMemo.js\";\nimport type { ObjectSetFieldProps } from \"../FormFieldApi.js\";\nimport styles from \"./ObjectSetField.module.css\";\n\nconst DEFAULT_OBJECT_ICON: Icon = { name: \"cube\", color: \"#4C90F0\" };\nconst ICON_SIZE = IconSize.STANDARD;\nconst DEFAULT_EMPTY_MESSAGE = \"Object set is not defined\";\n\nexport const ObjectSetField: <T extends ObjectTypeDefinition>(\n props: ObjectSetFieldProps<T>,\n) => React.ReactElement = typedReactMemo(function ObjectSetFieldFn<\n T extends ObjectTypeDefinition,\n>({\n value,\n emptyMessage = DEFAULT_EMPTY_MESSAGE,\n}: ObjectSetFieldProps<T>): React.ReactElement {\n if (value == null) {\n return (\n <div\n className={classnames(\n styles.osdkObjectSetField,\n styles.osdkObjectSetFieldEmpty,\n )}\n >\n {emptyMessage}\n </div>\n );\n }\n\n return <ObjectSetFieldContent objectSet={value} />;\n});\n\nconst ObjectSetFieldContent = React.memo(function ObjectSetFieldContentFn({\n objectSet,\n}: {\n objectSet: ObjectSet;\n}): React.ReactElement {\n const objectTypeDef = objectSet.$objectSetInternals.def;\n const { metadata, loading: metadataLoading } = useOsdkMetadata(objectTypeDef);\n const {\n totalCount,\n data,\n isLoading: objectSetLoading,\n error: objectSetError,\n } = useObjectSet(objectSet, {\n // Fetching a page size of one is enough to get the totalCount\n pageSize: 1,\n });\n\n const hasMetadata = metadata != null;\n\n const icon = React.useMemo(\n () =>\n metadata != null && \"icon\" in metadata && metadata.icon != null\n ? toComponentIcon(metadata.icon)\n : DEFAULT_OBJECT_ICON,\n [metadata],\n );\n\n const displayName =\n totalCount === \"1\" || !hasMetadata || !(\"pluralDisplayName\" in metadata)\n ? metadata?.displayName\n : metadata.pluralDisplayName;\n\n // Wait for metadata even if the count is already available, so we can\n // show the correct display name and avoid a flash of \"objects\" → \"Employees\".\n const showLoadingState = metadataLoading && !hasMetadata;\n\n return (\n <div className={styles.osdkObjectSetField}>\n {showLoadingState\n ? (\n <>\n {OBJECT_SET_ICON_SKELETON}\n {OBJECT_SET_LABEL_SKELETON}\n </>\n )\n : (\n <>\n <BlueprintIcon icon={icon} size={ICON_SIZE} />\n <ObjectSetLabel\n displayName={displayName}\n totalCount={totalCount}\n error={objectSetError}\n isLoading={objectSetLoading}\n />\n </>\n )}\n </div>\n );\n});\n\nconst ObjectSetLabel = React.memo(function ObjectSetLabelFn({\n displayName,\n totalCount,\n isLoading,\n error,\n}: {\n displayName: string | undefined;\n totalCount: string | undefined;\n isLoading: boolean;\n error: Error | undefined;\n}): React.ReactElement {\n const hasData = totalCount != null;\n const label = displayName ?? (totalCount === \"1\" ? \"object\" : \"objects\");\n const showSkeleton = isLoading && !hasData;\n const showError = error != null && !hasData && !isLoading;\n\n return (\n <>\n {showSkeleton && OBJECT_SET_LABEL_SKELETON}\n {showError && (\n <span className={styles.osdkObjectSetFieldError} role=\"alert\">\n {`Failed to load: ${error.message}`}\n </span>\n )}\n {!showSkeleton && !showError && (\n <span>{`${formatCount(totalCount)} ${label}`}</span>\n )}\n </>\n );\n});\n\nconst OBJECT_SET_ICON_SKELETON = (\n <SkeletonBar className={styles.osdkObjectSetIconSkeleton} />\n);\n\nconst OBJECT_SET_LABEL_SKELETON = (\n <SkeletonBar className={styles.osdkObjectSetLabelSkeleton} />\n);\n\nfunction formatCount(count: string | undefined): string {\n if (count == null) {\n return \"\\u2013\"; // '–' symbol\n }\n const num = Number(count);\n return Number.isNaN(num) ? count : num.toLocaleString();\n}\n\nfunction toComponentIcon(apiIcon: { name: string; color: string }): Icon {\n return { name: apiIcon.name as IconName, color: apiIcon.color };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAwBA,QAAQ,QAAQ,oBAAoB;AAE5D,SAASC,eAAe,QAAQ,aAAa;AAC7C,SAASC,YAAY,QAAQ,0BAA0B;AACvD,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AACzB,SACEC,aAAa,QAER,6CAA6C;AACpD,SAASC,WAAW,QAAQ,+CAA+C;AAC3E,SAASC,cAAc,QAAQ,2BAA2B;AAE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CAAAwC,QAAA,QACGO,YAAY,IAAIL,yBAAyB,EACzCM,SAAS,iBACRhD,KAAA,CAAAc,aAAA;IAAMC,SAAS,EAAEX,MAAM,CAAC6C,uBAAwB;IAACC,IAAI,EAAC;EAAO,GAC1D,mBAAmBnB,KAAK,CAACoB,OAAO,EAC7B,CACP,EACA,CAACJ,YAAY,IAAI,CAACC,SAAS,iBAC1BhD,KAAA,CAAAc,aAAA,eAAO,GAAGsC,WAAW,CAACzB,UAAU,CAAC,IAAImB,KAAK,EAAS,CAErD,CAAC;AAEP,CAAC,CAAC;AAEF,MAAML,wBAAwB,gBAC5BzC,KAAA,CAAAc,aAAA,CAACZ,WAAW;EAACa,SAAS,EAAEX,MAAM,CAACiD;AAA0B,CAAE,CAC5D;AAED,MAAMX,yBAAyB,gBAC7B1C,KAAA,CAAAc,aAAA,CAACZ,WAAW;EAACa,SAAS,EAAEX,MAAM,CAACkD;AAA2B,CAAE,CAC7D;AAED,SAASF,WAAWA,CAACG,KAAyB,EAAU;EACtD,IAAIA,KAAK,IAAI,IAAI,EAAE;IACjB,OAAO,QAAQ,CAAC,CAAC;EACnB;EACA,MAAMC,GAAG,GAAGC,MAAM,CAACF,KAAK,CAAC;EACzB,OAAOE,MAAM,CAACC,KAAK,CAACF,GAAG,CAAC,GAAGD,KAAK,GAAGC,GAAG,CAACG,cAAc,CAAC,CAAC;AACzD;AAEA,SAAStB,eAAeA,CAACuB,OAAwC,EAAQ;EACvE,OAAO;IAAEtD,IAAI,EAAEsD,OAAO,CAACtD,IAAgB;IAAEC,KAAK,EAAEqD,OAAO,CAACrD;EAAM,CAAC;AACjE","ignoreList":[]}
@@ -0,0 +1,45 @@
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
+ .osdkObjectSetField {
18
+ display: flex;
19
+ align-items: center;
20
+ gap: var(--osdk-object-set-gap);
21
+ min-height: var(--osdk-object-set-min-height);
22
+ padding: var(--osdk-object-set-padding);
23
+ color: var(--osdk-object-set-color);
24
+ font-family: var(--osdk-object-set-font-family);
25
+ font-size: var(--osdk-object-set-font-size);
26
+ line-height: var(--osdk-object-set-line-height);
27
+ }
28
+
29
+ .osdkObjectSetFieldEmpty {
30
+ color: var(--osdk-object-set-placeholder-color);
31
+ }
32
+
33
+ .osdkObjectSetFieldError {
34
+ color: var(--osdk-object-set-error-color);
35
+ }
36
+
37
+ .osdkObjectSetIconSkeleton {
38
+ width: var(--osdk-object-set-icon-skeleton-width);
39
+ align-self: stretch;
40
+ }
41
+
42
+ .osdkObjectSetLabelSkeleton {
43
+ width: var(--osdk-object-set-label-skeleton-width);
44
+ align-self: stretch;
45
+ }
@@ -0,0 +1,10 @@
1
+ // CSS Module proxy for ObjectSetField.module.css
2
+ const styles = {
3
+ "osdkObjectSetField": "ObjectSetField-module__osdkObjectSetField___3nQswWr3",
4
+ "osdkObjectSetFieldEmpty": "ObjectSetField-module__osdkObjectSetFieldEmpty___DaUkwr5W",
5
+ "osdkObjectSetFieldError": "ObjectSetField-module__osdkObjectSetFieldError___RRtly-rv",
6
+ "osdkObjectSetIconSkeleton": "ObjectSetField-module__osdkObjectSetIconSkeleton___gwPxH9b-",
7
+ "osdkObjectSetLabelSkeleton": "ObjectSetField-module__osdkObjectSetLabelSkeleton___39bANfY3"
8
+ };
9
+
10
+ export default styles;
@@ -46,7 +46,9 @@ function buildFieldDefinition(key, param) {
46
46
  return {
47
47
  ...base,
48
48
  fieldComponent: "OBJECT_SET",
49
- fieldComponentProps: {}
49
+ fieldComponentProps: {
50
+ value: null
51
+ }
50
52
  };
51
53
  case "object":
52
54
  case "interface":
@@ -1 +1 @@
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,oBA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L,GAAGZ,IAAI;QACPQ,cAAc,EAAE,cAAc;QAC9BC,mBAAmB,EAAE,CAAC;MACxB,CAAC;IACH,KAAK,UAAU;IACf,KAAK,WAAW;MACd,OAAO;QACL,GAAGT,IAAI;QACPQ,cAAc,EAAE,iBAAiB;QACjCC,mBAAmB,EAAE,CAAC;MACxB,CAAC;IACH,KAAK,YAAY;IACjB,KAAK,gBAAgB;MACnB,OAAO;QACL,GAAGT,IAAI;QACPQ,cAAc,EAAE,aAAa;QAC7BC,mBAAmB,EAAE,CAAC;MACxB,CAAC;IACH;MACE,OAAOpB,iBAAiB,CAACkB,SAAS,CAAC;EACvC;AACF","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","value","items","options"],"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: { value: null },\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,m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AY;QAC5BC,mBAAmB,EAAE,CAAC;MACxB,CAAC;IACH,KAAK,SAAS;MACZ,OAAO;QACL,GAAGT,IAAI;QACPQ,cAAc,EAAE,eAAe;QAC/BC,mBAAmB,EAAE;UACnBG,OAAO,EAAE,CAAC;YAAEV,KAAK,EAAE,MAAM;YAAEQ,KAAK,EAAE;UAAK,CAAC,EAAE;YACxCR,KAAK,EAAE,OAAO;YACdQ,KAAK,EAAE;UACT,CAAC;QACH;MACF,CAAC;IACH,KAAK,SAAS;IACd,KAAK,QAAQ;IACb,KAAK,MAAM;MACT,OAAO;QACL,GAAGV,IAAI;QACPQ,cAAc,EAAE,cAAc;QAC9BC,mBAAmB,EAAE,CAAC;MACxB,CAAC;IACH,KAAK,UAAU;IACf,KAAK,WAAW;MACd,OAAO;QACL,GAAGT,IAAI;QACPQ,cAAc,EAAE,iBAAiB;QACjCC,mBAAmB,EAAE,CAAC;MACxB,CAAC;IACH,KAAK,YAAY;IACjB,KAAK,gBAAgB;MACnB,OAAO;QACL,GAAGT,IAAI;QACPQ,cAAc,EAAE,aAAa;QAC7BC,mBAAmB,EAAE,CAAC;MACxB,CAAC;IACH;MACE,OAAOpB,iBAAiB,CAACkB,SAAS,CAAC;EACvC;AACF","ignoreList":[]}
@@ -0,0 +1,58 @@
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 { Icons, SVGIconContainer } from "@blueprintjs/icons";
18
+ import React from "react";
19
+ export const BlueprintIcon = /*#__PURE__*/React.memo(function ({
20
+ icon,
21
+ size
22
+ }) {
23
+ const paths = useIcon(icon.name, size);
24
+ return /*#__PURE__*/React.createElement(SVGIconContainer, {
25
+ iconName: icon.name,
26
+ color: icon.color
27
+ }, paths != null ? paths.map((d, i) => /*#__PURE__*/React.createElement("path", {
28
+ key: i,
29
+ d: d,
30
+ fillRule: "evenodd"
31
+ })) : []);
32
+ });
33
+
34
+ /**
35
+ * Loads icon paths on demand via the public `Icons.load()` API
36
+ * instead of the static `getIconPaths()` which bundles every icon definition.
37
+ */
38
+ function useIcon(icon, size) {
39
+ const [iconPaths, setIconPaths] = React.useState(() => Icons.getPaths(icon, size));
40
+ React.useEffect(function () {
41
+ let isMounted = true;
42
+ const loadedIconPaths = Icons.getPaths(icon, size);
43
+ if (loadedIconPaths != null) {
44
+ setIconPaths(loadedIconPaths);
45
+ } else {
46
+ void Icons.load(icon, size).then(() => {
47
+ if (isMounted) {
48
+ setIconPaths(Icons.getPaths(icon, size));
49
+ }
50
+ });
51
+ }
52
+ return () => {
53
+ isMounted = false;
54
+ };
55
+ }, [icon, size]);
56
+ return iconPaths;
57
+ }
58
+ //# sourceMappingURL=BlueprintIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlueprintIcon.js","names":["Icons","SVGIconContainer","React","BlueprintIcon","memo","icon","size","paths","useIcon","name","createElement","iconName","color","map","d","i","key","fillRule","iconPaths","setIconPaths","useState","getPaths","useEffect","isMounted","loadedIconPaths","load","then"],"sources":["BlueprintIcon.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 {\n type IconName,\n type IconPaths,\n Icons,\n type IconSize,\n SVGIconContainer,\n} from \"@blueprintjs/icons\";\nimport React from \"react\";\n\nexport interface Icon {\n name: IconName;\n color?: string;\n}\n\ninterface BlueprintIconProps {\n icon: Icon;\n size: IconSize;\n}\n\nexport const BlueprintIcon: React.NamedExoticComponent<BlueprintIconProps> =\n React.memo(function BlueprintIconFn({\n icon,\n size,\n }: BlueprintIconProps): React.ReactElement {\n const paths = useIcon(icon.name, size);\n\n return (\n <SVGIconContainer iconName={icon.name} color={icon.color}>\n {paths != null\n ? paths.map((d, i) => <path key={i} d={d} fillRule=\"evenodd\" />)\n : []}\n </SVGIconContainer>\n );\n });\n\n/**\n * Loads icon paths on demand via the public `Icons.load()` API\n * instead of the static `getIconPaths()` which bundles every icon definition.\n */\nfunction useIcon(icon: IconName, size: IconSize): IconPaths | undefined {\n const [iconPaths, setIconPaths] = React.useState<IconPaths | undefined>(() =>\n Icons.getPaths(icon, size)\n );\n\n React.useEffect(\n function loadIconPaths() {\n let isMounted = true;\n const loadedIconPaths = Icons.getPaths(icon, size);\n if (loadedIconPaths != null) {\n setIconPaths(loadedIconPaths);\n } else {\n void Icons.load(icon, size).then(() => {\n if (isMounted) {\n setIconPaths(Icons.getPaths(icon, size));\n }\n });\n }\n return () => {\n isMounted = false;\n };\n },\n [icon, size],\n );\n\n return iconPaths;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAGEA,KAAK,EAELC,gBAAgB,QACX,oBAAoB;AAC3B,OAAOC,KAAK,MAAM,OAAO;AAYzB,OAAO,MAAMC,aAA6D,gBACxED,KAAK,CAACE,IAAI,CAAC,UAAyB;EAClCC,IAAI;EACJC;AACkB,CAAC,EAAsB;EACzC,MAAMC,KAAK,GAAGC,OAAO,CAACH,IAAI,CAACI,IAAI,EAAEH,IAAI,CAAC;EAEtC,oBACEJ,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","React","styles","SkeletonBar","width","height","maxWidth","className","createElement","skeletonBar","style"],"sources":["SkeletonBar.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 classnames from \"classnames\";\nimport React from \"react\";\nimport styles from \"./SkeletonBar.module.css\";\n\ninterface SkeletonBarProps {\n width?: string | number;\n height?: string | number;\n maxWidth?: string | number;\n className?: string;\n}\n\nexport function SkeletonBar({\n width,\n height,\n maxWidth,\n className,\n}: SkeletonBarProps): React.ReactElement {\n return (\n <div\n aria-hidden=\"true\"\n className={classnames(styles.skeletonBar, className)}\n style={{ width, height, maxWidth }}\n />\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,MAAM,MAAM,0BAA0B;AAS7C,OAAO,SAASC,WAAWA,CAAC;EAC1BC,KAAK;EACLC,MAAM;EACNC,QAAQ;EACRC;AACgB,CAAC,EAAsB;EACvC,oBACEN,KAAA,CAAAO,aAAA;IACE,eAAY,MAAM;IAClBD,SAAS,EAAEP,UAAU,CAACE,MAAM,CAACO,WAAW,EAAEF,SAAS,CAAE;IACrDG,KAAK,EAAE;MAAEN,KAAK;MAAEC,MAAM;MAAEC;IAAS;EAAE,CACpC,CAAC;AAEN","ignoreList":[]}
1
+ {"version":3,"file":"SkeletonBar.js","names":["classnames","React","styles","SkeletonBar","width","height","maxWidth","className","createElement","skeletonBar","style"],"sources":["SkeletonBar.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 classnames from \"classnames\";\nimport React from \"react\";\nimport styles from \"./SkeletonBar.module.css\";\n\nexport interface SkeletonBarProps {\n width?: string | number;\n height?: string | number;\n maxWidth?: string | number;\n className?: string;\n}\n\nexport function SkeletonBar({\n width,\n height,\n maxWidth,\n className,\n}: SkeletonBarProps): React.ReactElement {\n return (\n <div\n aria-hidden=\"true\"\n className={classnames(styles.skeletonBar, className)}\n style={{ width, height, maxWidth }}\n />\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,MAAM,MAAM,0BAA0B;AAS7C,OAAO,SAASC,WAAWA,CAAC;EAC1BC,KAAK;EACLC,MAAM;EACNC,QAAQ;EACRC;AACgB,CAAC,EAAsB;EACvC,oBACEN,KAAA,CAAAO,aAAA;IACE,eAAY,MAAM;IAClBD,SAAS,EAAEP,UAAU,CAACE,MAAM,CAACO,WAAW,EAAEF,SAAS,CAAE;IACrDG,KAAK,EAAE;MAAEN,KAAK;MAAEC,MAAM;MAAEC;IAAS;EAAE,CACpC,CAAC;AAEN","ignoreList":[]}
@@ -16,5 +16,6 @@
16
16
 
17
17
  export { ActionButton } from "../base-components/action-button/ActionButton.js";
18
18
  export { Dialog } from "../base-components/dialog/Dialog.js";
19
+ export { SkeletonBar } from "../base-components/skeleton/SkeletonBar.js";
19
20
  export { Tooltip, TooltipArrow } from "../base-components/tooltip/index.js";
20
21
  //# sourceMappingURL=primitives.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"primitives.js","names":["ActionButton","Dialog","Tooltip","TooltipArrow"],"sources":["primitives.ts"],"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\nexport {\n ActionButton,\n type ButtonProps,\n} from \"../base-components/action-button/ActionButton.js\";\nexport { Dialog, type DialogProps } from \"../base-components/dialog/Dialog.js\";\nexport {\n Tooltip,\n TooltipArrow,\n type TooltipProps,\n} from \"../base-components/tooltip/index.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,YAAY,QAEP,kDAAkD;AACzD,SAASC,MAAM,QAA0B,qCAAqC;AAC9E,SACEC,OAAO,EACPC,YAAY,QAEP,qCAAqC","ignoreList":[]}
1
+ {"version":3,"file":"primitives.js","names":["ActionButton","Dialog","SkeletonBar","Tooltip","TooltipArrow"],"sources":["primitives.ts"],"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\nexport {\n ActionButton,\n type ButtonProps,\n} from \"../base-components/action-button/ActionButton.js\";\nexport { Dialog, type DialogProps } from \"../base-components/dialog/Dialog.js\";\nexport {\n SkeletonBar,\n type SkeletonBarProps,\n} from \"../base-components/skeleton/SkeletonBar.js\";\nexport {\n Tooltip,\n TooltipArrow,\n type TooltipProps,\n} from \"../base-components/tooltip/index.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,YAAY,QAEP,kDAAkD;AACzD,SAASC,MAAM,QAA0B,qCAAqC;AAC9E,SACEC,WAAW,QAEN,4CAA4C;AACnD,SACEC,OAAO,EACPC,YAAY,QAEP,qCAAqC","ignoreList":[]}