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

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 (115) hide show
  1. package/AGENTS.md +3 -0
  2. package/CHANGELOG.md +17 -0
  3. package/build/browser/action-form/FormFieldApi.js.map +1 -1
  4. package/build/browser/action-form/fields/{TextInputField.module.css → BaseInput.module.css} +2 -2
  5. package/build/browser/action-form/fields/BaseInput.module.css.js +6 -0
  6. package/build/browser/action-form/fields/FormFieldRenderer.js +26 -8
  7. package/build/browser/action-form/fields/FormFieldRenderer.js.map +1 -1
  8. package/build/browser/action-form/fields/RadioButtonsField.js +57 -0
  9. package/build/browser/action-form/fields/RadioButtonsField.js.map +1 -0
  10. package/build/browser/action-form/fields/RadioButtonsField.module.css +83 -0
  11. package/build/browser/action-form/fields/RadioButtonsField.module.css.js +10 -0
  12. package/build/browser/action-form/fields/TextAreaField.js +50 -0
  13. package/build/browser/action-form/fields/TextAreaField.js.map +1 -0
  14. package/build/browser/action-form/fields/TextInputField.js +3 -3
  15. package/build/browser/action-form/fields/TextInputField.js.map +1 -1
  16. package/build/browser/pdf-viewer/PdfViewer.js +40 -4
  17. package/build/browser/pdf-viewer/PdfViewer.js.map +1 -1
  18. package/build/browser/pdf-viewer/components/PdfViewerAnnotationLayer.js +85 -18
  19. package/build/browser/pdf-viewer/components/PdfViewerAnnotationLayer.js.map +1 -1
  20. package/build/browser/pdf-viewer/components/PdfViewerAnnotationLayer.module.css +18 -0
  21. package/build/browser/pdf-viewer/components/PdfViewerAnnotationLayer.module.css.js +1 -0
  22. package/build/browser/pdf-viewer/components/PdfViewerContent.js +15 -3
  23. package/build/browser/pdf-viewer/components/PdfViewerContent.js.map +1 -1
  24. package/build/browser/pdf-viewer/components/PdfViewerOutlineSidebar.module.css +1 -1
  25. package/build/browser/pdf-viewer/components/PdfViewerSidebar.module.css +1 -1
  26. package/build/browser/pdf-viewer/components/PdfViewerSidebarHeader.module.css +1 -1
  27. package/build/browser/pdf-viewer/components/PdfViewerToolbar.js +29 -2
  28. package/build/browser/pdf-viewer/components/PdfViewerToolbar.js.map +1 -1
  29. package/build/browser/pdf-viewer/components/PdfViewerToolbar.module.css +5 -0
  30. package/build/browser/pdf-viewer/components/PdfViewerToolbar.module.css.js +1 -0
  31. package/build/browser/pdf-viewer/constants.js +2 -1
  32. package/build/browser/pdf-viewer/constants.js.map +1 -1
  33. package/build/browser/pdf-viewer/hooks/usePdfAnnotationsByPage.js +30 -0
  34. package/build/browser/pdf-viewer/hooks/usePdfAnnotationsByPage.js.map +1 -0
  35. package/build/browser/pdf-viewer/hooks/usePdfFormFields.js +326 -0
  36. package/build/browser/pdf-viewer/hooks/usePdfFormFields.js.map +1 -0
  37. package/build/browser/pdf-viewer/hooks/usePdfHighlightMode.js +199 -0
  38. package/build/browser/pdf-viewer/hooks/usePdfHighlightMode.js.map +1 -0
  39. package/build/browser/pdf-viewer/hooks/usePdfViewer.js +16 -10
  40. package/build/browser/pdf-viewer/hooks/usePdfViewer.js.map +1 -1
  41. package/build/browser/pdf-viewer/types.js.map +1 -1
  42. package/build/browser/public/experimental.js +3 -0
  43. package/build/browser/public/experimental.js.map +1 -1
  44. package/build/browser/styles.css +144 -35
  45. package/build/cjs/public/experimental.cjs +1735 -1109
  46. package/build/cjs/public/experimental.cjs.map +1 -1
  47. package/build/cjs/public/experimental.css +82 -5
  48. package/build/cjs/public/experimental.css.map +1 -1
  49. package/build/cjs/public/experimental.d.cts +154 -20
  50. package/build/esm/action-form/FormFieldApi.js.map +1 -1
  51. package/build/esm/action-form/fields/{TextInputField.module.css → BaseInput.module.css} +2 -2
  52. package/build/esm/action-form/fields/FormFieldRenderer.js +26 -8
  53. package/build/esm/action-form/fields/FormFieldRenderer.js.map +1 -1
  54. package/build/esm/action-form/fields/RadioButtonsField.js +57 -0
  55. package/build/esm/action-form/fields/RadioButtonsField.js.map +1 -0
  56. package/build/esm/action-form/fields/RadioButtonsField.module.css +83 -0
  57. package/build/esm/action-form/fields/TextAreaField.js +50 -0
  58. package/build/esm/action-form/fields/TextAreaField.js.map +1 -0
  59. package/build/esm/action-form/fields/TextInputField.js +3 -3
  60. package/build/esm/action-form/fields/TextInputField.js.map +1 -1
  61. package/build/esm/pdf-viewer/PdfViewer.js +40 -4
  62. package/build/esm/pdf-viewer/PdfViewer.js.map +1 -1
  63. package/build/esm/pdf-viewer/components/PdfViewerAnnotationLayer.js +85 -18
  64. package/build/esm/pdf-viewer/components/PdfViewerAnnotationLayer.js.map +1 -1
  65. package/build/esm/pdf-viewer/components/PdfViewerAnnotationLayer.module.css +18 -0
  66. package/build/esm/pdf-viewer/components/PdfViewerContent.js +15 -3
  67. package/build/esm/pdf-viewer/components/PdfViewerContent.js.map +1 -1
  68. package/build/esm/pdf-viewer/components/PdfViewerOutlineSidebar.module.css +1 -1
  69. package/build/esm/pdf-viewer/components/PdfViewerSidebar.module.css +1 -1
  70. package/build/esm/pdf-viewer/components/PdfViewerSidebarHeader.module.css +1 -1
  71. package/build/esm/pdf-viewer/components/PdfViewerToolbar.js +29 -2
  72. package/build/esm/pdf-viewer/components/PdfViewerToolbar.js.map +1 -1
  73. package/build/esm/pdf-viewer/components/PdfViewerToolbar.module.css +5 -0
  74. package/build/esm/pdf-viewer/constants.js +2 -1
  75. package/build/esm/pdf-viewer/constants.js.map +1 -1
  76. package/build/esm/pdf-viewer/hooks/usePdfAnnotationsByPage.js +30 -0
  77. package/build/esm/pdf-viewer/hooks/usePdfAnnotationsByPage.js.map +1 -0
  78. package/build/esm/pdf-viewer/hooks/usePdfFormFields.js +326 -0
  79. package/build/esm/pdf-viewer/hooks/usePdfFormFields.js.map +1 -0
  80. package/build/esm/pdf-viewer/hooks/usePdfHighlightMode.js +199 -0
  81. package/build/esm/pdf-viewer/hooks/usePdfHighlightMode.js.map +1 -0
  82. package/build/esm/pdf-viewer/hooks/usePdfViewer.js +16 -10
  83. package/build/esm/pdf-viewer/hooks/usePdfViewer.js.map +1 -1
  84. package/build/esm/pdf-viewer/types.js.map +1 -1
  85. package/build/esm/public/experimental.js +3 -0
  86. package/build/esm/public/experimental.js.map +1 -1
  87. package/build/types/action-form/FormFieldApi.d.ts +8 -2
  88. package/build/types/action-form/FormFieldApi.d.ts.map +1 -1
  89. package/build/types/action-form/fields/FormFieldRenderer.d.ts.map +1 -1
  90. package/build/types/action-form/fields/RadioButtonsField.d.ts +3 -0
  91. package/build/types/action-form/fields/RadioButtonsField.d.ts.map +1 -0
  92. package/build/types/action-form/fields/TextAreaField.d.ts +3 -0
  93. package/build/types/action-form/fields/TextAreaField.d.ts.map +1 -0
  94. package/build/types/pdf-viewer/PdfViewer.d.ts +1 -1
  95. package/build/types/pdf-viewer/PdfViewer.d.ts.map +1 -1
  96. package/build/types/pdf-viewer/components/PdfViewerAnnotationLayer.d.ts.map +1 -1
  97. package/build/types/pdf-viewer/components/PdfViewerContent.d.ts +8 -4
  98. package/build/types/pdf-viewer/components/PdfViewerContent.d.ts.map +1 -1
  99. package/build/types/pdf-viewer/components/PdfViewerToolbar.d.ts +6 -1
  100. package/build/types/pdf-viewer/components/PdfViewerToolbar.d.ts.map +1 -1
  101. package/build/types/pdf-viewer/constants.d.ts +1 -1
  102. package/build/types/pdf-viewer/constants.d.ts.map +1 -1
  103. package/build/types/pdf-viewer/hooks/usePdfAnnotationsByPage.d.ts +5 -0
  104. package/build/types/pdf-viewer/hooks/usePdfAnnotationsByPage.d.ts.map +1 -0
  105. package/build/types/pdf-viewer/hooks/usePdfFormFields.d.ts +24 -0
  106. package/build/types/pdf-viewer/hooks/usePdfFormFields.d.ts.map +1 -0
  107. package/build/types/pdf-viewer/hooks/usePdfHighlightMode.d.ts +35 -0
  108. package/build/types/pdf-viewer/hooks/usePdfHighlightMode.d.ts.map +1 -0
  109. package/build/types/pdf-viewer/hooks/usePdfViewer.d.ts.map +1 -1
  110. package/build/types/pdf-viewer/types.d.ts +90 -13
  111. package/build/types/pdf-viewer/types.d.ts.map +1 -1
  112. package/build/types/public/experimental.d.ts +4 -1
  113. package/build/types/public/experimental.d.ts.map +1 -1
  114. package/package.json +5 -5
  115. package/build/browser/action-form/fields/TextInputField.module.css.js +0 -6
package/AGENTS.md CHANGED
@@ -13,6 +13,8 @@ All components import from `@osdk/react-components/experimental`.
13
13
  | **FilterList** | Aggregation-based filter UI for object sets with draggable reordering. |
14
14
  | **BaseFilterList** | OSDK-agnostic base filter list — use for custom filter implementations. |
15
15
  | **ColumnConfigDialog** | Dialog for managing column visibility and drag-and-drop reordering. |
16
+ | **PdfViewer** | PDF viewer for OSDK Media objects with toolbar, search, annotations, sidebar (thumbnails/outline), highlight mode, and form fields. |
17
+ | **BasePdfViewer** | OSDK-agnostic base PDF viewer — accepts a URL or ArrayBuffer directly. Use when building custom data fetching on top of the viewer UI. |
16
18
 
17
19
  ## Documentation
18
20
 
@@ -20,3 +22,4 @@ Before using any component, read the relevant doc:
20
22
 
21
23
  - **Setup & installation**: Read [README.md](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/README.md) for provider, CSS layers, and peer dependencies
22
24
  - **ObjectTable**: Read [docs/ObjectTable.md](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/ObjectTable.md) for props, column definitions, examples, theming, and troubleshooting
25
+ - **PdfViewer**: Read [docs/PdfViewer.md](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/PdfViewer.md) for props, annotations, building blocks, hooks, examples, and theming
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @osdk/react-components
2
2
 
3
+ ## 0.2.0-beta.25
4
+
5
+ ### Minor Changes
6
+
7
+ - d4ac875: Add text highlight annotation mode to PdfViewer with toolbar toggle button, `onTextHighlight` callback, and multi-rect annotation support via `rects` field on `PdfAnnotation`
8
+ - e19ff03: Add TextAreaField component using @base-ui Input with render prop for native textarea rendering
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [f294f5a]
13
+ - Updated dependencies [2855223]
14
+ - Updated dependencies [d284bf2]
15
+ - Updated dependencies [b68cebd]
16
+ - @osdk/client@2.8.0-beta.28
17
+ - @osdk/react@0.10.0-beta.13
18
+ - @osdk/api@2.8.0-beta.28
19
+
3
20
  ## 0.2.0-beta.24
4
21
 
5
22
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldApi.js","names":[],"sources":["FormFieldApi.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n ActionParam,\n CompileTimeMetadata,\n DataValueClientToWire,\n ObjectSet,\n ObjectTypeDefinition,\n} from \"@osdk/api\";\nimport type React from \"react\";\n\n/**\n * A form field definition specifies configuration for a single field\n */\nexport interface FormFieldDefinition<\n Q extends ActionDefinition<unknown>,\n K extends FieldKey<Q> = FieldKey<Q>,\n> {\n /**\n * The field's unique key\n */\n fieldKey: K;\n\n /**\n * Display label for the field\n * If not provided, the form field will not show any label.\n */\n label?: string;\n\n /**\n * Default value of the field\n */\n defaultValue?: FieldValueType<Q, K>;\n\n /**\n * The form field component type to render\n */\n fieldComponent: ValidFormFieldForPropertyType<FieldDescriptorType<Q, K>>;\n\n /**\n * Whether the field is required\n */\n isRequired?: boolean;\n\n /**\n * Placeholder text\n */\n placeholder?: string;\n\n /**\n * Additional information to display on this field\n * The placement of helper text depends on the value of helperTextPlacement prop\n */\n helperText?: string;\n\n /**\n * The placement of the helper text either below the field or in a tooltip\n *\n * @default \"tooltip\"\n */\n helperTextPlacement?: \"bottom\" | \"tooltip\";\n\n /**\n * Whether the field is disabled\n */\n isDisabled?: boolean;\n\n /**\n * A callback to return a custom error message if validation failed\n *\n * @param validationRule the validation rule that failed with the error message\n * @returns the error message to display\n */\n onValidationError?: (error: ValidationError) => string;\n\n /**\n * Additional function to validate the field\n *\n * @param value the current field value\n * @returns a boolean promise indicating whether the value is valid\n */\n validate?: (value: FieldValueType<Q, K>) => Promise<boolean>;\n\n /**\n * The component props for the form field\n * Excludes runtime props (key, onChange) which are managed by ActionForm\n */\n fieldComponentProps?: Omit<\n FormFieldPropsByType[\n ValidFormFieldForPropertyType<\n FieldDescriptorType<Q, K>\n >\n ],\n \"key\" | \"onChange\"\n >;\n}\n\ntype ValidationError = { type: ValidationRule; error: string };\n\ntype ValidationRule =\n | \"required\"\n | \"min\"\n | \"max\"\n | \"minLength\"\n | \"maxLength\"\n | \"pattern\"\n | \"validate\";\n\n/**\n * Maps field types to their corresponding props\n */\nexport interface FormFieldPropsByType {\n DATETIME_PICKER: DatetimePickerFieldProps;\n DROPDOWN: DropdownFieldProps<unknown, boolean>;\n FILE_PICKER: FilePickerProps;\n NUMBER_INPUT: NumberInputFieldProps;\n OBJECT_SET: ObjectSetFieldProps<ObjectTypeDefinition>;\n RADIO_BUTTONS: RadioButtonsFieldProps<unknown>;\n TEXT_AREA: TextAreaFieldProps;\n TEXT_INPUT: TextInputFieldProps;\n CUSTOM: CustomFieldProps<unknown>;\n}\n\n/**\n * Datetime picker field props.\n *\n * When `formatDate` is omitted, ISO-like format is used (YYYY-MM-DD / YYYY-MM-DD HH:mm).\n */\nexport interface DatetimePickerFieldProps extends BaseFormFieldProps<Date> {\n /**\n * The earliest date the user can select.\n * If provided, this will be added to the field validation.\n */\n min?: Date;\n\n /**\n * The latest date the user can select.\n * If provided, this will be added to the field validation.\n */\n max?: Date;\n\n /**\n * Whether to show time picker.\n */\n showTime?: boolean;\n\n /**\n * Whether to close the popover after selecting a date.\n * @default true when `showTime` is false, false when `showTime` is true\n */\n closeOnSelection?: boolean;\n\n /**\n * Placeholder text shown when no value is selected.\n */\n placeholder?: string;\n\n /** Formats a Date for display in the trigger button. */\n formatDate?: (date: Date) => string;\n}\n\n/**\n * Dropdown field props with selectable items\n */\nexport interface DropdownFieldProps<V, Multiple extends boolean = false>\n extends BaseFormFieldProps<Multiple extends true ? V[] : V>\n{\n /**\n * Available items for the dropdown\n */\n items: V[];\n\n /**\n * Converts an item to a display string. Defaults to `String()`.\n */\n itemToStringLabel?: (item: V) => string;\n\n /**\n * Returns a unique string key for a list item. Used as the React `key`.\n * Falls back to the item's index when not provided.\n */\n itemToKey?: (item: V) => string;\n\n /**\n * Custom equality check for item values. Defaults to `Object.is`.\n * Required when items are objects to ensure correct selection matching.\n */\n isItemEqual?: (a: V, b: V) => boolean;\n\n /**\n * Whether the dropdown allows searching/filtering.\n * When true, renders a Combobox with a search input.\n * When false (default), renders a Select dropdown.\n */\n isSearchable?: boolean;\n\n /**\n * Placeholder text shown when no value is selected.\n */\n placeholder?: string;\n\n /**\n * Whether multiple values can be selected\n */\n isMultiple?: Multiple;\n}\n\nexport interface FilePickerProps extends BaseFormFieldProps<File | File[]> {\n /**\n * Whether multiple files can be selected\n */\n isMulti?: boolean;\n\n /**\n * Accepted file types (e.g., \"image/*\", \".pdf\")\n */\n accept?: string | string[];\n\n /**\n * Maximum file size in bytes\n */\n maxSize?: number;\n}\n\n/**\n * Text area field props\n */\nexport interface TextAreaFieldProps extends\n BaseFormFieldProps<string>,\n Pick<\n React.TextareaHTMLAttributes<HTMLTextAreaElement>,\n | \"rows\"\n | \"wrap\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"minLength\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"maxLength\"\n >\n{}\n\nexport interface TextInputFieldProps extends\n BaseFormFieldProps<string>,\n Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n /**\n * If provided, this will be added to the field validation\n */\n | \"minLength\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"maxLength\"\n >\n{\n placeholder?: string;\n}\n\n/**\n * Number input field props\n */\nexport interface NumberInputFieldProps extends\n BaseFormFieldProps<number>,\n Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n /**\n * If provided, this will be added to the field validation\n */\n | \"min\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"max\"\n | \"step\"\n >\n{}\n\n/**\n * Radio buttons field props\n */\nexport interface RadioButtonsFieldProps<V> extends BaseFormFieldProps<V> {\n /**\n * Available options for radio buttons\n */\n options: Option<V>[];\n}\n\n/**\n * Option interface for radio button options\n */\nexport interface Option<V> {\n label: string;\n value: V;\n}\n\n/**\n * Object set field displays the summary of the count of the given object set\n */\nexport interface ObjectSetFieldProps<T extends ObjectTypeDefinition>\n extends BaseFormFieldProps<ObjectSet<T>>\n{}\n\n/**\n * Custom field props for user-defined renderers\n */\nexport interface CustomFieldProps<V> extends BaseFormFieldProps<V> {\n /**\n * Custom renderer function\n */\n customRenderer: (props: BaseFormFieldProps<V>) => React.ReactNode;\n}\n\nexport interface BaseFormFieldProps<V> {\n /**\n * The HTML `id` attribute for the field input element.\n * Used for `<label htmlFor>` association.\n */\n id?: string;\n\n /**\n * The value of the form field\n */\n value: V | null;\n /**\n * Called when the field value changes.\n *\n * ActionForm internally wraps this to pass the key to `onFieldValueChange`:\n * ```\n * <DropdownField\n * {...fieldDef}\n * onChange={(value) => onFieldValueChange(fieldDef.key, value)}\n * />\n * ```\n *\n * @param value The new value of the form field\n */\n onChange?: (value: V | null) => void;\n}\n\nexport type FieldKey<Q extends ActionDefinition<unknown>> =\n keyof ActionParameters<Q>;\n\n/**\n * Extracts parameters from an ActionDefinition\n */\nexport type ActionParameters<Q extends ActionDefinition<unknown>> =\n CompileTimeMetadata<Q>[\"parameters\"];\n\n/**\n * Extracts the value type for a specific parameter\n *\n * TODO: Re-use `BaseType`\n */\nexport type FieldValueType<\n Q extends ActionDefinition<unknown>,\n K extends keyof ActionParameters<Q> = keyof ActionParameters<Q>,\n> = ActionParameters<Q>[K][\"type\"] extends\n ActionMetadata.DataType.Object<infer T> ? ActionParam.ObjectType<T>\n : ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.ObjectSet<\n infer T\n > ? ActionParam.ObjectSetType<T>\n : ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.Struct<\n infer T\n > ? ActionParam.StructType<T>\n : ActionParameters<Q>[K][\"type\"] extends keyof DataValueClientToWire\n ? DataValueClientToWire[ActionParameters<Q>[K][\"type\"]]\n : never;\n\n/**\n * Extracts the parameter type descriptor for a specific action parameter.\n */\nexport type FieldDescriptorType<\n Q extends ActionDefinition<unknown> = ActionDefinition<unknown>,\n K extends keyof ActionParameters<Q> = keyof ActionParameters<Q>,\n> = ActionParameters<Q>[K][\"type\"];\n\n/**\n * Available form field component types\n */\nexport type FieldComponent =\n | \"DATETIME_PICKER\"\n | \"DROPDOWN\"\n | \"FILE_PICKER\"\n | \"NUMBER_INPUT\"\n | \"RADIO_BUTTONS\"\n | \"OBJECT_SET\"\n | \"TEXT_AREA\"\n | \"TEXT_INPUT\"\n | \"CUSTOM\";\n\n/**\n * Describes the data type of a form field, independent of OSDK.\n * Mirrors ActionMetadata.DataType to keep the rendering layer OSDK-agnostic.\n */\nexport type FieldType =\n | \"boolean\"\n | \"string\"\n | \"integer\"\n | \"long\"\n | \"double\"\n | \"datetime\"\n | \"timestamp\"\n | \"attachment\"\n | \"marking\"\n | \"mediaReference\"\n | \"objectType\"\n | \"geoshape\"\n | \"geohash\"\n | { type: \"object\"; object: string }\n | { type: \"objectSet\"; objectSet: string }\n | { type: \"interface\"; interface: string }\n | { type: \"struct\"; struct: Record<string, string> };\n\n/**\n * An OSDK-agnostic field definition used by BaseForm and FormFieldRenderer.\n * Contains only the information needed to render a single field — no generics,\n * no compile-time parameter constraints.\n *\n * Implemented as a distributed mapped type: switching on `fieldComponent`\n * narrows `fieldComponentProps` to the correct props type automatically.\n */\nexport type RendererFieldDefinition = {\n [K in FieldComponent]: {\n fieldKey: string;\n fieldComponent: K;\n fieldType?: FieldType;\n label?: string;\n defaultValue?: unknown;\n isRequired?: boolean;\n placeholder?: string;\n helperText?: string;\n helperTextPlacement?: \"bottom\" | \"tooltip\";\n fieldComponentProps?: Omit<FormFieldPropsByType[K], \"value\" | \"onChange\">;\n };\n}[FieldComponent];\n\n/**\n * Gets valid form field types for a given property type\n */\nexport type ValidFormFieldForPropertyType<P extends FieldDescriptorType> =\n P extends \"objectSet\" ? \"OBJECT_SET\"\n : P extends \"object\" ? \"DROPDOWN\"\n : P extends \"mediaReference\" | \"attachment\" ? \"FILE_PICKER\"\n : P extends \"boolean\" ? \"RADIO_BUTTONS\" | \"DROPDOWN\"\n : P extends \"string\" ? \"TEXT_INPUT\" | \"TEXT_AREA\"\n : P extends \"datetime\" | \"timestamp\" ? \"DATETIME_PICKER\"\n : P extends\n | \"double\"\n | \"integer\"\n | \"long\"\n | \"float\"\n | \"short\"\n | \"byte\"\n | \"decimal\" ? \"NUMBER_INPUT\"\n : never;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"FormFieldApi.js","names":[],"sources":["FormFieldApi.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n ActionParam,\n CompileTimeMetadata,\n DataValueClientToWire,\n ObjectSet,\n ObjectTypeDefinition,\n} from \"@osdk/api\";\nimport type React from \"react\";\n\n/**\n * A form field definition specifies configuration for a single field\n */\nexport interface FormFieldDefinition<\n Q extends ActionDefinition<unknown>,\n K extends FieldKey<Q> = FieldKey<Q>,\n> {\n /**\n * The field's unique key\n */\n fieldKey: K;\n\n /**\n * Display label for the field\n * If not provided, the form field will not show any label.\n */\n label?: string;\n\n /**\n * Default value of the field\n */\n defaultValue?: FieldValueType<Q, K>;\n\n /**\n * The form field component type to render\n */\n fieldComponent: ValidFormFieldForPropertyType<FieldDescriptorType<Q, K>>;\n\n /**\n * Whether the field is required\n */\n isRequired?: boolean;\n\n /**\n * Placeholder text\n */\n placeholder?: string;\n\n /**\n * Additional information to display on this field\n * The placement of helper text depends on the value of helperTextPlacement prop\n */\n helperText?: string;\n\n /**\n * The placement of the helper text either below the field or in a tooltip\n *\n * @default \"tooltip\"\n */\n helperTextPlacement?: \"bottom\" | \"tooltip\";\n\n /**\n * Whether the field is disabled\n */\n isDisabled?: boolean;\n\n /**\n * A callback to return a custom error message if validation failed\n *\n * @param validationRule the validation rule that failed with the error message\n * @returns the error message to display\n */\n onValidationError?: (error: ValidationError) => string;\n\n /**\n * Additional function to validate the field\n *\n * @param value the current field value\n * @returns a boolean promise indicating whether the value is valid\n */\n validate?: (value: FieldValueType<Q, K>) => Promise<boolean>;\n\n /**\n * The component props for the form field\n * Excludes runtime props (key, onChange) which are managed by ActionForm\n */\n fieldComponentProps?: Omit<\n FormFieldPropsByType[\n ValidFormFieldForPropertyType<\n FieldDescriptorType<Q, K>\n >\n ],\n \"key\" | \"onChange\"\n >;\n}\n\ntype ValidationError = { type: ValidationRule; error: string };\n\ntype ValidationRule =\n | \"required\"\n | \"min\"\n | \"max\"\n | \"minLength\"\n | \"maxLength\"\n | \"pattern\"\n | \"validate\";\n\n/**\n * Maps field types to their corresponding props\n */\nexport interface FormFieldPropsByType {\n DATETIME_PICKER: DatetimePickerFieldProps;\n DROPDOWN: DropdownFieldProps<unknown, boolean>;\n FILE_PICKER: FilePickerProps;\n NUMBER_INPUT: NumberInputFieldProps;\n OBJECT_SET: ObjectSetFieldProps<ObjectTypeDefinition>;\n RADIO_BUTTONS: RadioButtonsFieldProps<unknown>;\n TEXT_AREA: TextAreaFieldProps;\n TEXT_INPUT: TextInputFieldProps;\n CUSTOM: CustomFieldProps<unknown>;\n}\n\n/**\n * Datetime picker field props.\n *\n * When `formatDate` is omitted, ISO-like format is used (YYYY-MM-DD / YYYY-MM-DD HH:mm).\n */\nexport interface DatetimePickerFieldProps extends BaseFormFieldProps<Date> {\n /**\n * The earliest date the user can select.\n * If provided, this will be added to the field validation.\n */\n min?: Date;\n\n /**\n * The latest date the user can select.\n * If provided, this will be added to the field validation.\n */\n max?: Date;\n\n /**\n * Whether to show time picker.\n */\n showTime?: boolean;\n\n /**\n * Whether to close the popover after selecting a date.\n * @default true when `showTime` is false, false when `showTime` is true\n */\n closeOnSelection?: boolean;\n\n /**\n * Placeholder text shown when no value is selected.\n */\n placeholder?: string;\n\n /** Formats a Date for display in the trigger button. */\n formatDate?: (date: Date) => string;\n}\n\n/**\n * Dropdown field props with selectable items\n */\nexport interface DropdownFieldProps<V, Multiple extends boolean = false>\n extends BaseFormFieldProps<Multiple extends true ? V[] : V>\n{\n /**\n * Available items for the dropdown\n */\n items: V[];\n\n /**\n * Converts an item to a display string. Defaults to `String()`.\n */\n itemToStringLabel?: (item: V) => string;\n\n /**\n * Returns a unique string key for a list item. Used as the React `key`.\n * Falls back to the item's index when not provided.\n */\n itemToKey?: (item: V) => string;\n\n /**\n * Custom equality check for item values. Defaults to `Object.is`.\n * Required when items are objects to ensure correct selection matching.\n */\n isItemEqual?: (a: V, b: V) => boolean;\n\n /**\n * Whether the dropdown allows searching/filtering.\n * When true, renders a Combobox with a search input.\n * When false (default), renders a Select dropdown.\n */\n isSearchable?: boolean;\n\n /**\n * Placeholder text shown when no value is selected.\n */\n placeholder?: string;\n\n /**\n * Whether multiple values can be selected\n */\n isMultiple?: Multiple;\n}\n\nexport interface FilePickerProps extends BaseFormFieldProps<File | File[]> {\n /**\n * Whether multiple files can be selected\n */\n isMulti?: boolean;\n\n /**\n * Accepted file types (e.g., \"image/*\", \".pdf\")\n */\n accept?: string | string[];\n\n /**\n * Maximum file size in bytes\n */\n maxSize?: number;\n}\n\n/**\n * Text area field props\n */\nexport interface TextAreaFieldProps extends\n BaseFormFieldProps<string>,\n Pick<\n React.TextareaHTMLAttributes<HTMLTextAreaElement>,\n | \"rows\"\n | \"wrap\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"minLength\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"maxLength\"\n >\n{\n placeholder?: string;\n}\n\nexport interface TextInputFieldProps extends\n BaseFormFieldProps<string>,\n Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n /**\n * If provided, this will be added to the field validation\n */\n | \"minLength\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"maxLength\"\n >\n{\n placeholder?: string;\n}\n\n/**\n * Number input field props\n */\nexport interface NumberInputFieldProps extends\n BaseFormFieldProps<number>,\n Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n /**\n * If provided, this will be added to the field validation\n */\n | \"min\"\n /**\n * If provided, this will be added to the field validation\n */\n | \"max\"\n | \"step\"\n >\n{}\n\n/**\n * Radio buttons field props\n */\nexport interface RadioButtonsFieldProps<V> extends BaseFormFieldProps<V> {\n /**\n * Available options for radio buttons.\n *\n * Values are compared by reference equality (`===`). When options contain\n * non-primitive values, pass the same object references for `value` and\n * the corresponding option entry.\n */\n options: Option<V>[];\n}\n\n/**\n * Option interface for radio button options\n */\nexport interface Option<V> {\n label: string;\n value: V;\n}\n\n/**\n * Object set field displays the summary of the count of the given object set\n */\nexport interface ObjectSetFieldProps<T extends ObjectTypeDefinition>\n extends BaseFormFieldProps<ObjectSet<T>>\n{}\n\n/**\n * Custom field props for user-defined renderers\n */\nexport interface CustomFieldProps<V> extends BaseFormFieldProps<V> {\n /**\n * Custom renderer function\n */\n customRenderer: (props: BaseFormFieldProps<V>) => React.ReactNode;\n}\n\nexport interface BaseFormFieldProps<V> {\n /**\n * The HTML `id` attribute for the field input element.\n * Used for `<label htmlFor>` association.\n */\n id?: string;\n\n /**\n * The value of the form field\n */\n value: V | null;\n /**\n * Called when the field value changes.\n *\n * ActionForm internally wraps this to pass the key to `onFieldValueChange`:\n * ```\n * <DropdownField\n * {...fieldDef}\n * onChange={(value) => onFieldValueChange(fieldDef.key, value)}\n * />\n * ```\n *\n * @param value The new value of the form field\n */\n onChange?: (value: V | null) => void;\n}\n\nexport type FieldKey<Q extends ActionDefinition<unknown>> =\n keyof ActionParameters<Q>;\n\n/**\n * Extracts parameters from an ActionDefinition\n */\nexport type ActionParameters<Q extends ActionDefinition<unknown>> =\n CompileTimeMetadata<Q>[\"parameters\"];\n\n/**\n * Extracts the value type for a specific parameter\n *\n * TODO: Re-use `BaseType`\n */\nexport type FieldValueType<\n Q extends ActionDefinition<unknown>,\n K extends keyof ActionParameters<Q> = keyof ActionParameters<Q>,\n> = ActionParameters<Q>[K][\"type\"] extends\n ActionMetadata.DataType.Object<infer T> ? ActionParam.ObjectType<T>\n : ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.ObjectSet<\n infer T\n > ? ActionParam.ObjectSetType<T>\n : ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.Struct<\n infer T\n > ? ActionParam.StructType<T>\n : ActionParameters<Q>[K][\"type\"] extends keyof DataValueClientToWire\n ? DataValueClientToWire[ActionParameters<Q>[K][\"type\"]]\n : never;\n\n/**\n * Extracts the parameter type descriptor for a specific action parameter.\n */\nexport type FieldDescriptorType<\n Q extends ActionDefinition<unknown> = ActionDefinition<unknown>,\n K extends keyof ActionParameters<Q> = keyof ActionParameters<Q>,\n> = ActionParameters<Q>[K][\"type\"];\n\n/**\n * Available form field component types\n */\nexport type FieldComponent =\n | \"DATETIME_PICKER\"\n | \"DROPDOWN\"\n | \"FILE_PICKER\"\n | \"NUMBER_INPUT\"\n | \"RADIO_BUTTONS\"\n | \"OBJECT_SET\"\n | \"TEXT_AREA\"\n | \"TEXT_INPUT\"\n | \"CUSTOM\";\n\n/**\n * Describes the data type of a form field, independent of OSDK.\n * Mirrors ActionMetadata.DataType to keep the rendering layer OSDK-agnostic.\n */\nexport type FieldType =\n | \"boolean\"\n | \"string\"\n | \"integer\"\n | \"long\"\n | \"double\"\n | \"datetime\"\n | \"timestamp\"\n | \"attachment\"\n | \"marking\"\n | \"mediaReference\"\n | \"objectType\"\n | \"geoshape\"\n | \"geohash\"\n | { type: \"object\"; object: string }\n | { type: \"objectSet\"; objectSet: string }\n | { type: \"interface\"; interface: string }\n | { type: \"struct\"; struct: Record<string, string> };\n\n/**\n * An OSDK-agnostic field definition used by BaseForm and FormFieldRenderer.\n * Contains only the information needed to render a single field — no generics,\n * no compile-time parameter constraints.\n *\n * Implemented as a distributed mapped type: switching on `fieldComponent`\n * narrows `fieldComponentProps` to the correct props type automatically.\n */\nexport type RendererFieldDefinition = {\n [K in FieldComponent]: {\n fieldKey: string;\n fieldComponent: K;\n fieldType?: FieldType;\n label?: string;\n defaultValue?: unknown;\n isRequired?: boolean;\n placeholder?: string;\n helperText?: string;\n helperTextPlacement?: \"bottom\" | \"tooltip\";\n fieldComponentProps?: Omit<FormFieldPropsByType[K], \"value\" | \"onChange\">;\n };\n}[FieldComponent];\n\n/**\n * Gets valid form field types for a given property type\n */\nexport type ValidFormFieldForPropertyType<P extends FieldDescriptorType> =\n P extends \"objectSet\" ? \"OBJECT_SET\"\n : P extends \"object\" ? \"DROPDOWN\"\n : P extends \"mediaReference\" | \"attachment\" ? \"FILE_PICKER\"\n : P extends \"boolean\" ? \"RADIO_BUTTONS\" | \"DROPDOWN\"\n : P extends \"string\" ? \"TEXT_INPUT\" | \"TEXT_AREA\"\n : P extends \"datetime\" | \"timestamp\" ? \"DATETIME_PICKER\"\n : P extends\n | \"double\"\n | \"integer\"\n | \"long\"\n | \"float\"\n | \"short\"\n | \"byte\"\n | \"decimal\" ? \"NUMBER_INPUT\"\n : never;\n"],"mappings":"","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
2
+ * Copyright 2026 Palantir Technologies, Inc. All rights reserved.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- .osdkTextInput {
17
+ .osdkBaseInput {
18
18
  display: block;
19
19
  width: 100%;
20
20
  min-height: var(--osdk-input-min-height);
@@ -0,0 +1,6 @@
1
+ // CSS Module proxy for BaseInput.module.css
2
+ const styles = {
3
+ "osdkBaseInput": "BaseInput-module__osdkBaseInput___4IpLsapU"
4
+ };
5
+
6
+ export default styles;
@@ -1,6 +1,6 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
2
  /*
3
- * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ * Copyright 2026 Palantir Technologies, Inc. All rights reserved.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -19,8 +19,11 @@ import React, { memo } from "react";
19
19
  import { FormField } from "../FormField.js";
20
20
  import { DatetimePickerField } from "./DatetimePickerField.js";
21
21
  import { DropdownField } from "./DropdownField.js";
22
+ import { RadioButtonsField } from "./RadioButtonsField.js";
23
+ import { TextAreaField } from "./TextAreaField.js";
22
24
  import { TextInputField } from "./TextInputField.js";
23
25
  const EMPTY_ITEMS = [];
26
+ const EMPTY_OPTIONS = [];
24
27
  export const FormFieldRenderer = /*#__PURE__*/memo(function ({
25
28
  fieldDefinition,
26
29
  value,
@@ -42,16 +45,19 @@ export const FormFieldRenderer = /*#__PURE__*/memo(function ({
42
45
  function renderFieldComponent(fieldDefinition, value, onChange) {
43
46
  switch (fieldDefinition.fieldComponent) {
44
47
  case "TEXT_INPUT":
45
- // TODO: Render a <textarea> for TEXT_AREA instead of falling through
48
+ return /*#__PURE__*/React.createElement(TextInputField, _extends({
49
+ id: fieldDefinition.fieldKey,
50
+ value: value != null ? String(value) : "",
51
+ onChange: onChange,
52
+ placeholder: fieldDefinition.placeholder
53
+ }, fieldDefinition.fieldComponentProps));
46
54
  case "TEXT_AREA":
47
- return /*#__PURE__*/React.createElement(TextInputField, {
48
- id: fieldDefinition.fieldKey
49
- // TODO: Use coerceFieldValue
50
- ,
55
+ return /*#__PURE__*/React.createElement(TextAreaField, _extends({
56
+ id: fieldDefinition.fieldKey,
51
57
  value: value != null ? String(value) : "",
52
58
  onChange: onChange,
53
59
  placeholder: fieldDefinition.placeholder
54
- });
60
+ }, fieldDefinition.fieldComponentProps));
55
61
  case "DROPDOWN":
56
62
  {
57
63
  const {
@@ -74,8 +80,20 @@ function renderFieldComponent(fieldDefinition, value, onChange) {
74
80
  value: value instanceof Date ? value : null,
75
81
  onChange: onChange
76
82
  }, fieldDefinition.fieldComponentProps));
77
- case "NUMBER_INPUT":
78
83
  case "RADIO_BUTTONS":
84
+ {
85
+ const {
86
+ options = EMPTY_OPTIONS,
87
+ ...radioProps
88
+ } = fieldDefinition.fieldComponentProps ?? {};
89
+ return /*#__PURE__*/React.createElement(RadioButtonsField, _extends({
90
+ id: fieldDefinition.fieldKey,
91
+ value: value,
92
+ onChange: onChange,
93
+ options: options
94
+ }, radioProps));
95
+ }
96
+ case "NUMBER_INPUT":
79
97
  case "FILE_PICKER":
80
98
  case "OBJECT_SET":
81
99
  case "CUSTOM":
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldRenderer.js","names":["React","memo","FormField","DatetimePickerField","DropdownField","TextInputField","EMPTY_ITEMS","FormFieldRenderer","fieldDefinition","value","onFieldValueChange","label","isRequired","helperText","helperTextPlacement","createElement","fieldKey","undefined","renderFieldComponent","onChange","fieldComponent","id","String","placeholder","items","dropdownProps","fieldComponentProps","_extends","Date","assertUnreachableFieldComponent","Error"],"sources":["FormFieldRenderer.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 } from \"react\";\nimport { FormField } from \"../FormField.js\";\nimport type { RendererFieldDefinition } from \"../FormFieldApi.js\";\nimport { DatetimePickerField } from \"./DatetimePickerField.js\";\nimport { DropdownField } from \"./DropdownField.js\";\nimport { TextInputField } from \"./TextInputField.js\";\n\nconst EMPTY_ITEMS: unknown[] = [];\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 // TODO: Render a <textarea> for TEXT_AREA instead of falling through\n case \"TEXT_AREA\":\n return (\n <TextInputField\n id={fieldDefinition.fieldKey}\n // TODO: Use coerceFieldValue\n value={value != null ? String(value) : \"\"}\n onChange={onChange}\n placeholder={fieldDefinition.placeholder}\n />\n );\n case \"DROPDOWN\": {\n const { items = EMPTY_ITEMS, ...dropdownProps } =\n fieldDefinition.fieldComponentProps ?? {};\n return (\n <DropdownField\n value={value}\n onChange={onChange}\n items={items}\n placeholder={fieldDefinition.placeholder}\n {...dropdownProps}\n />\n );\n }\n case \"DATETIME_PICKER\":\n return (\n <DatetimePickerField\n id={fieldDefinition.fieldKey}\n placeholder={fieldDefinition.placeholder}\n // TODO: Use coerceFieldValue\n value={value instanceof Date ? value : null}\n onChange={onChange}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"NUMBER_INPUT\":\n case \"RADIO_BUTTONS\":\n case \"FILE_PICKER\":\n case \"OBJECT_SET\":\n case \"CUSTOM\":\n return <div>Unsupported field type: {fieldDefinition.fieldComponent}\n </div>;\n default:\n return assertUnreachableFieldComponent(fieldDefinition);\n }\n}\n\nfunction assertUnreachableFieldComponent(value: never): never {\n throw new Error(`Unhandled field component: ${String(value)}`);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,SAAS,QAAQ,iBAAiB;AAE3C,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,qBAAqB;AAEpD,MAAMC,WAAsB,GAAG,EAAE;AAQjC,OAAO,MAAMC,iBAAmD,gBAAGN,IAAI,CACrE,UAA6B;EAC3BO,eAAe;EACfC,KAAK;EACLC;AACsB,CAAC,EAAsB;EAC7C,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAoB,CAAC,GAC1DN,eAAe;EAEjB,oBACER,KAAA,CAAAe,aAAA,CAACb,SAAS;IACRS,KAAK,EAAEA,KAAM;IACbC,UAAU,EAAEA,UAAW;IACvBI,QAAQ,EAAER,eAAe,CAACQ,QAAS;IACnCH,UAAU,EAAEC,mBAAmB,KAAK,SAAS,GAAGD,UAAU,GAAGI;EAAU,GAEtEC,oBAAoB,CAACV,eAAe,EAAEC,KAAK,EAAEC,kBAAkB,CACvD,CAAC;AAEhB,CACF,CAAC;AAED,SAASQ,oBAAoBA,CAC3BV,eAAwC,EACxCC,KAAc,EACdU,QAAkC,EACd;EACpB,QAAQX,eAAe,CAACY,cAAc;IACpC,KAAK,YAAY;IACjB;IACA,KAAK,WAAW;MACd,oBACEpB,KAAA,CAAAe,aAAA,CAACV,cAAc;QACbgB,EAAE,EAAEb,eAAe,CAACQ;QACpB;QAAA;QACAP,KAAK,EAAEA,KAAK,IAAI,IAAI,GAAGa,MAAM,CAACb,KAAK,CAAC,GAAG,EAAG;QAC1CU,QAAQ,EAAEA,QAAS;QACnBI,WAAW,EAAEf,eAAe,CAACe;MAAY,CAC1C,CAAC;IAEN,KAAK,UAAU;MAAE;QACf,MAAM;UAAEC,KAAK,GAAGlB,WAAW;UAAE,GAAGmB;QAAc,CAAC,GAC7CjB,eAAe,CAACkB,mBAAmB,IAAI,CAAC,CAAC;QAC3C,oBACE1B,KAAA,CAAAe,aAAA,CAACX,aAAa,EAAAuB,QAAA;UACZlB,KAAK,EAAEA,KAAM;UACbU,QAAQ,EAAEA,QAAS;UACnBK,KAAK,EAAEA,KAAM;UACbD,WAAW,EAAEf,eAAe,CAACe;QAAY,GACrCE,aAAa,CAClB,CAAC;MAEN;IACA,KAAK,iBAAiB;MACpB,oBACEzB,KAAA,CAAAe,aAAA,CAACZ,mBAAmB,EAAAwB,QAAA;QAClBN,EAAE,EAAEb,eAAe,CAACQ,QAAS;QAC7BO,WAAW,EAAEf,eAAe,CAACe;QAC7B;QAAA;QACAd,KAAK,EAAEA,KAAK,YAAYmB,IAAI,GAAGnB,KAAK,GAAG,IAAK;QAC5CU,QAAQ,EAAEA;MAAS,GACfX,eAAe,CAACkB,mBAAmB,CACxC,CAAC;IAEN,KAAK,cAAc;IACnB,KAAK,eAAe;IACpB,KAAK,aAAa;IAClB,KAAK,YAAY;IACjB,KAAK,QAAQ;MACX,oBAAO1B,KAAA,CAAAe,aAAA,cAAK,0BAAwB,EAACP,eAAe,CAACY,cAChD,CAAC;IACR;MACE,OAAOS,+BAA+B,CAACrB,eAAe,CAAC;EAC3D;AACF;AAEA,SAASqB,+BAA+BA,CAACpB,KAAY,EAAS;EAC5D,MAAM,IAAIqB,KAAK,CAAC,8BAA8BR,MAAM,CAACb,KAAK,CAAC,EAAE,CAAC;AAChE","ignoreList":[]}
1
+ {"version":3,"file":"FormFieldRenderer.js","names":["React","memo","FormField","DatetimePickerField","DropdownField","RadioButtonsField","TextAreaField","TextInputField","EMPTY_ITEMS","EMPTY_OPTIONS","FormFieldRenderer","fieldDefinition","value","onFieldValueChange","label","isRequired","helperText","helperTextPlacement","createElement","fieldKey","undefined","renderFieldComponent","onChange","fieldComponent","_extends","id","String","placeholder","fieldComponentProps","items","dropdownProps","Date","options","radioProps","assertUnreachableFieldComponent","Error"],"sources":["FormFieldRenderer.tsx"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { memo } from \"react\";\nimport { FormField } from \"../FormField.js\";\nimport type { Option, RendererFieldDefinition } from \"../FormFieldApi.js\";\nimport { DatetimePickerField } from \"./DatetimePickerField.js\";\nimport { DropdownField } from \"./DropdownField.js\";\nimport { RadioButtonsField } from \"./RadioButtonsField.js\";\nimport { TextAreaField } from \"./TextAreaField.js\";\nimport { TextInputField } from \"./TextInputField.js\";\n\nconst EMPTY_ITEMS: unknown[] = [];\nconst EMPTY_OPTIONS: Option<never>[] = [];\n\nexport interface FormFieldRendererProps {\n fieldDefinition: RendererFieldDefinition;\n value: unknown;\n onFieldValueChange: (value: unknown) => void;\n}\n\nexport const FormFieldRenderer: React.FC<FormFieldRendererProps> = memo(\n function FormFieldRendererFn({\n fieldDefinition,\n value,\n onFieldValueChange,\n }: FormFieldRendererProps): React.ReactElement {\n const { label, isRequired, helperText, helperTextPlacement } =\n fieldDefinition;\n\n return (\n <FormField\n label={label}\n isRequired={isRequired}\n fieldKey={fieldDefinition.fieldKey}\n helperText={helperTextPlacement !== \"tooltip\" ? helperText : undefined}\n >\n {renderFieldComponent(fieldDefinition, value, onFieldValueChange)}\n </FormField>\n );\n },\n);\n\nfunction renderFieldComponent(\n fieldDefinition: RendererFieldDefinition,\n value: unknown,\n onChange: (value: unknown) => void,\n): React.ReactElement {\n switch (fieldDefinition.fieldComponent) {\n case \"TEXT_INPUT\":\n return (\n <TextInputField\n id={fieldDefinition.fieldKey}\n value={value != null ? String(value) : \"\"}\n onChange={onChange}\n placeholder={fieldDefinition.placeholder}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"TEXT_AREA\":\n return (\n <TextAreaField\n id={fieldDefinition.fieldKey}\n value={value != null ? String(value) : \"\"}\n onChange={onChange}\n placeholder={fieldDefinition.placeholder}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"DROPDOWN\": {\n const { items = EMPTY_ITEMS, ...dropdownProps } =\n fieldDefinition.fieldComponentProps ?? {};\n return (\n <DropdownField\n value={value}\n onChange={onChange}\n items={items}\n placeholder={fieldDefinition.placeholder}\n {...dropdownProps}\n />\n );\n }\n case \"DATETIME_PICKER\":\n return (\n <DatetimePickerField\n id={fieldDefinition.fieldKey}\n placeholder={fieldDefinition.placeholder}\n // TODO: Use coerceFieldValue\n value={value instanceof Date ? value : null}\n onChange={onChange}\n {...fieldDefinition.fieldComponentProps}\n />\n );\n case \"RADIO_BUTTONS\": {\n const { options = EMPTY_OPTIONS, ...radioProps } =\n fieldDefinition.fieldComponentProps ?? {};\n return (\n <RadioButtonsField\n id={fieldDefinition.fieldKey}\n value={value}\n onChange={onChange}\n options={options}\n {...radioProps}\n />\n );\n }\n case \"NUMBER_INPUT\":\n case \"FILE_PICKER\":\n case \"OBJECT_SET\":\n case \"CUSTOM\":\n return <div>Unsupported field type: {fieldDefinition.fieldComponent}\n </div>;\n default:\n return assertUnreachableFieldComponent(fieldDefinition);\n }\n}\n\nfunction assertUnreachableFieldComponent(value: never): never {\n throw new Error(`Unhandled field component: ${String(value)}`);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,SAAS,QAAQ,iBAAiB;AAE3C,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,cAAc,QAAQ,qBAAqB;AAEpD,MAAMC,WAAsB,GAAG,EAAE;AACjC,MAAMC,aAA8B,GAAG,EAAE;AAQzC,OAAO,MAAMC,iBAAmD,gBAAGT,IAAI,CACrE,UAA6B;EAC3BU,eAAe;EACfC,KAAK;EACLC;AACsB,CAAC,EAAsB;EAC7C,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAoB,CAAC,GAC1DN,eAAe;EAEjB,oBACEX,KAAA,CAAAkB,aAAA,CAAChB,SAAS;IACRY,KAAK,EAAEA,KAAM;IACbC,UAAU,EAAEA,UAAW;IACvBI,QAAQ,EAAER,eAAe,CAACQ,QAAS;IACnCH,UAAU,EAAEC,mBAAmB,KAAK,SAAS,GAAGD,UAAU,GAAGI;EAAU,GAEtEC,oBAAoB,CAACV,eAAe,EAAEC,KAAK,EAAEC,kBAAkB,CACvD,CAAC;AAEhB,CACF,CAAC;AAED,SAASQ,oBAAoBA,CAC3BV,eAAwC,EACxCC,KAAc,EACdU,QAAkC,EACd;EACpB,QAAQX,eAAe,CAACY,cAAc;IACpC,KAAK,YAAY;MACf,oBACEvB,KAAA,CAAAkB,aAAA,CAACX,cAAc,EAAAiB,QAAA;QACbC,EAAE,EAAEd,eAAe,CAACQ,QAAS;QAC7BP,KAAK,EAAEA,KAAK,IAAI,IAAI,GAAGc,MAAM,CAACd,KAAK,CAAC,GAAG,EAAG;QAC1CU,QAAQ,EAAEA,QAAS;QACnBK,WAAW,EAAEhB,eAAe,CAACgB;MAAY,GACrChB,eAAe,CAACiB,mBAAmB,CACxC,CAAC;IAEN,KAAK,WAAW;MACd,oBACE5B,KAAA,CAAAkB,aAAA,CAACZ,aAAa,EAAAkB,QAAA;QACZC,EAAE,EAAEd,eAAe,CAACQ,QAAS;QAC7BP,KAAK,EAAEA,KAAK,IAAI,IAAI,GAAGc,MAAM,CAACd,KAAK,CAAC,GAAG,EAAG;QAC1CU,QAAQ,EAAEA,QAAS;QACnBK,WAAW,EAAEhB,eAAe,CAACgB;MAAY,GACrChB,eAAe,CAACiB,mBAAmB,CACxC,CAAC;IAEN,KAAK,UAAU;MAAE;QACf,MAAM;UAAEC,KAAK,GAAGrB,WAAW;UAAE,GAAGsB;QAAc,CAAC,GAC7CnB,eAAe,CAACiB,mBAAmB,IAAI,CAAC,CAAC;QAC3C,oBACE5B,KAAA,CAAAkB,aAAA,CAACd,aAAa,EAAAoB,QAAA;UACZZ,KAAK,EAAEA,KAAM;UACbU,QAAQ,EAAEA,QAAS;UACnBO,KAAK,EAAEA,KAAM;UACbF,WAAW,EAAEhB,eAAe,CAACgB;QAAY,GACrCG,aAAa,CAClB,CAAC;MAEN;IACA,KAAK,iBAAiB;MACpB,oBACE9B,KAAA,CAAAkB,aAAA,CAACf,mBAAmB,EAAAqB,QAAA;QAClBC,EAAE,EAAEd,eAAe,CAACQ,QAAS;QAC7BQ,WAAW,EAAEhB,eAAe,CAACgB;QAC7B;QAAA;QACAf,KAAK,EAAEA,KAAK,YAAYmB,IAAI,GAAGnB,KAAK,GAAG,IAAK;QAC5CU,QAAQ,EAAEA;MAAS,GACfX,eAAe,CAACiB,mBAAmB,CACxC,CAAC;IAEN,KAAK,eAAe;MAAE;QACpB,MAAM;UAAEI,OAAO,GAAGvB,aAAa;UAAE,GAAGwB;QAAW,CAAC,GAC9CtB,eAAe,CAACiB,mBAAmB,IAAI,CAAC,CAAC;QAC3C,oBACE5B,KAAA,CAAAkB,aAAA,CAACb,iBAAiB,EAAAmB,QAAA;UAChBC,EAAE,EAAEd,eAAe,CAACQ,QAAS;UAC7BP,KAAK,EAAEA,KAAM;UACbU,QAAQ,EAAEA,QAAS;UACnBU,OAAO,EAAEA;QAAQ,GACbC,UAAU,CACf,CAAC;MAEN;IACA,KAAK,cAAc;IACnB,KAAK,aAAa;IAClB,KAAK,YAAY;IACjB,KAAK,QAAQ;MACX,oBAAOjC,KAAA,CAAAkB,aAAA,cAAK,0BAAwB,EAACP,eAAe,CAACY,cAChD,CAAC;IACR;MACE,OAAOW,+BAA+B,CAACvB,eAAe,CAAC;EAC3D;AACF;AAEA,SAASuB,+BAA+BA,CAACtB,KAAY,EAAS;EAC5D,MAAM,IAAIuB,KAAK,CAAC,8BAA8BT,MAAM,CAACd,KAAK,CAAC,EAAE,CAAC;AAChE","ignoreList":[]}
@@ -0,0 +1,57 @@
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 { Radio } from "@base-ui/react/radio";
18
+ import { RadioGroup } from "@base-ui/react/radio-group";
19
+ import { memo, useCallback, useMemo } from "react";
20
+ import { typedReactMemo } from "../../shared/typedMemo.js";
21
+ import styles from "./RadioButtonsField.module.css.js";
22
+ export const RadioButtonsField = typedReactMemo(function ({
23
+ id,
24
+ value,
25
+ onChange,
26
+ options
27
+ }) {
28
+ const selectedLabel = useMemo(() => value != null ? options.find(opt => opt.value === value)?.label : undefined, [options, value]);
29
+ const handleValueChange = useCallback(nextLabel => {
30
+ const match = options.find(opt => opt.label === nextLabel);
31
+ onChange?.(match?.value ?? null);
32
+ }, [options, onChange]);
33
+ return /*#__PURE__*/React.createElement(RadioGroup, {
34
+ id: id,
35
+ className: styles.osdkRadioGroup,
36
+ value: selectedLabel,
37
+ onValueChange: handleValueChange
38
+ }, options.map(option => /*#__PURE__*/React.createElement(RadioItem, {
39
+ key: option.label,
40
+ option: option
41
+ })));
42
+ });
43
+ const RadioItem = /*#__PURE__*/memo(function ({
44
+ option
45
+ }) {
46
+ return /*#__PURE__*/React.createElement("label", {
47
+ className: styles.osdkRadioItem
48
+ }, /*#__PURE__*/React.createElement(Radio.Root, {
49
+ value: option.label,
50
+ className: styles.osdkRadioRoot
51
+ }, /*#__PURE__*/React.createElement(Radio.Indicator, {
52
+ className: styles.osdkRadioIndicator
53
+ })), /*#__PURE__*/React.createElement("span", {
54
+ className: styles.osdkRadioLabel
55
+ }, option.label));
56
+ });
57
+ //# sourceMappingURL=RadioButtonsField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RadioButtonsField.js","names":["Radio","RadioGroup","memo","useCallback","useMemo","typedReactMemo","styles","RadioButtonsField","id","value","onChange","options","selectedLabel","find","opt","label","undefined","handleValueChange","nextLabel","match","React","createElement","className","osdkRadioGroup","onValueChange","map","option","RadioItem","key","osdkRadioItem","Root","osdkRadioRoot","Indicator","osdkRadioIndicator","osdkRadioLabel"],"sources":["RadioButtonsField.tsx"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Radio } from \"@base-ui/react/radio\";\nimport { RadioGroup } from \"@base-ui/react/radio-group\";\nimport { memo, type ReactElement, useCallback, useMemo } from \"react\";\nimport { typedReactMemo } from \"../../shared/typedMemo.js\";\nimport type { Option, RadioButtonsFieldProps } from \"../FormFieldApi.js\";\nimport styles from \"./RadioButtonsField.module.css\";\n\nexport const RadioButtonsField: <V>(\n props: RadioButtonsFieldProps<V>,\n) => ReactElement = typedReactMemo(function RadioButtonsFieldFn<V,>({\n id,\n value,\n onChange,\n options,\n}: RadioButtonsFieldProps<V>): ReactElement {\n const selectedLabel = useMemo(\n () =>\n value != null\n ? options.find((opt) => opt.value === value)?.label\n : undefined,\n [options, value],\n );\n\n const handleValueChange = useCallback(\n (nextLabel: unknown) => {\n const match = options.find((opt) => opt.label === nextLabel);\n onChange?.(match?.value ?? null);\n },\n [options, onChange],\n );\n\n return (\n <RadioGroup\n id={id}\n className={styles.osdkRadioGroup}\n value={selectedLabel}\n onValueChange={handleValueChange}\n >\n {options.map((option) => (\n <RadioItem key={option.label} option={option} />\n ))}\n </RadioGroup>\n );\n});\n\nconst RadioItem = memo(function RadioItemFn({\n option,\n}: {\n option: Option<unknown>;\n}): ReactElement {\n return (\n <label className={styles.osdkRadioItem}>\n <Radio.Root value={option.label} className={styles.osdkRadioRoot}>\n <Radio.Indicator className={styles.osdkRadioIndicator} />\n </Radio.Root>\n <span className={styles.osdkRadioLabel}>{option.label}</span>\n </label>\n );\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,QAAQ,sBAAsB;AAC5C,SAASC,UAAU,QAAQ,4BAA4B;AACvD,SAASC,IAAI,EAAqBC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACrE,SAASC,cAAc,QAAQ,2BAA2B;AAE1D,OAAOC,MAAM,MAAM,gCAAgC;AAEnD,OAAO,MAAMC,iBAEI,GAAGF,cAAc,CAAC,UAAiC;EAClEG,EAAE;EACFC,KAAK;EACLC,QAAQ;EACRC;AACyB,CAAC,EAAgB;EAC1C,MAAMC,aAAa,GAAGR,OAAO,CAC3B,MACEK,KAAK,IAAI,IAAI,GACTE,OAAO,CAACE,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACL,KAAK,KAAKA,KAAK,CAAC,EAAEM,KAAK,GACjDC,SAAS,EACf,CAACL,OAAO,EAAEF,KAAK,CACjB,CAAC;EAED,MAAMQ,iBAAiB,GAAGd,WAAW,CAClCe,SAAkB,IAAK;IACtB,MAAMC,KAAK,GAAGR,OAAO,CAACE,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,KAAK,KAAKG,SAAS,CAAC;IAC5DR,QAAQ,GAAGS,KAAK,EAAEV,KAAK,IAAI,IAAI,CAAC;EAClC,CAAC,EACD,CAACE,OAAO,EAAED,QAAQ,CACpB,CAAC;EAED,oBACEU,KAAA,CAAAC,aAAA,CAACpB,UAAU;IACTO,EAAE,EAAEA,EAAG;IACPc,SAAS,EAAEhB,MAAM,CAACiB,cAAe;IACjCd,KAAK,EAAEG,aAAc;IACrBY,aAAa,EAAEP;EAAkB,GAEhCN,OAAO,CAACc,GAAG,CAAEC,MAAM,iBAClBN,KAAA,CAAAC,aAAA,CAACM,SAAS;IAACC,GAAG,EAAEF,MAAM,CAACX,KAAM;IAACW,MAAM,EAAEA;EAAO,CAAE,CAChD,CACS,CAAC;AAEjB,CAAC,CAAC;AAEF,MAAMC,SAAS,gBAAGzB,IAAI,CAAC,UAAqB;EAC1CwB;AAGF,CAAC,EAAgB;EACf,oBACEN,KAAA,CAAAC,aAAA;IAAOC,SAAS,EAAEhB,MAAM,CAACuB;EAAc,gBACrCT,KAAA,CAAAC,aAAA,CAACrB,KAAK,CAAC8B,IAAI;IAACrB,KAAK,EAAEiB,MAAM,CAACX,KAAM;IAACO,SAAS,EAAEhB,MAAM,CAACyB;EAAc,gBAC/DX,KAAA,CAAAC,aAAA,CAACrB,KAAK,CAACgC,SAAS;IAACV,SAAS,EAAEhB,MAAM,CAAC2B;EAAmB,CAAE,CAC9C,CAAC,eACbb,KAAA,CAAAC,aAAA;IAAMC,SAAS,EAAEhB,MAAM,CAAC4B;EAAe,GAAER,MAAM,CAACX,KAAY,CACvD,CAAC;AAEZ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,83 @@
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
+ .osdkRadioGroup {
18
+ display: flex;
19
+ flex-direction: column;
20
+ gap: var(--osdk-radio-gap);
21
+ }
22
+
23
+ .osdkRadioItem {
24
+ display: flex;
25
+ align-items: center;
26
+ gap: var(--osdk-radio-item-gap);
27
+ }
28
+
29
+ .osdkRadioRoot {
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ width: var(--osdk-radio-size);
34
+ height: var(--osdk-radio-size);
35
+ border-radius: 50%;
36
+ border: var(--osdk-radio-border);
37
+ cursor: pointer;
38
+ flex-shrink: 0;
39
+
40
+ &[data-unchecked] {
41
+ background-color: var(--osdk-radio-bg);
42
+
43
+ &:hover {
44
+ background-color: var(--osdk-radio-bg-hover);
45
+ }
46
+ }
47
+
48
+ &[data-checked] {
49
+ background-color: var(--osdk-radio-bg-checked);
50
+
51
+ &:hover {
52
+ background-color: var(--osdk-radio-bg-checked-hover);
53
+ }
54
+
55
+ &:active {
56
+ background-color: var(--osdk-radio-bg-checked-active);
57
+ }
58
+ }
59
+
60
+ &:focus-visible {
61
+ outline: var(--osdk-focus-outline);
62
+ outline-offset: calc(-1 * var(--osdk-focus-visible-outline-offset));
63
+ }
64
+ }
65
+
66
+ .osdkRadioIndicator {
67
+ width: var(--osdk-radio-indicator-size);
68
+ height: var(--osdk-radio-indicator-size);
69
+ border-radius: 50%;
70
+ background-color: var(--osdk-radio-indicator-color);
71
+
72
+ &[data-unchecked] {
73
+ display: none;
74
+ }
75
+ }
76
+
77
+ .osdkRadioLabel {
78
+ font-family: var(--osdk-typography-font-family);
79
+ font-size: var(--osdk-typography-font-size-default);
80
+ line-height: var(--osdk-typography-line-height-default);
81
+ color: var(--osdk-typography-color-default);
82
+ cursor: pointer;
83
+ }
@@ -0,0 +1,10 @@
1
+ // CSS Module proxy for RadioButtonsField.module.css
2
+ const styles = {
3
+ "osdkRadioGroup": "RadioButtonsField-module__osdkRadioGroup___t5qC9340",
4
+ "osdkRadioItem": "RadioButtonsField-module__osdkRadioItem___1OaMMDkR",
5
+ "osdkRadioRoot": "RadioButtonsField-module__osdkRadioRoot___vhiNVEfp",
6
+ "osdkRadioIndicator": "RadioButtonsField-module__osdkRadioIndicator___qbvVgGBN",
7
+ "osdkRadioLabel": "RadioButtonsField-module__osdkRadioLabel___UUPF7AlO"
8
+ };
9
+
10
+ export default styles;
@@ -0,0 +1,50 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ /*
3
+ * Copyright 2026 Palantir Technologies, Inc. All rights reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ import { Input } from "@base-ui/react/input";
19
+ import React, { useCallback } from "react";
20
+ import styles from "./BaseInput.module.css.js";
21
+ const TEXTAREA_STYLE = {
22
+ resize: "vertical"
23
+ };
24
+ export function TextAreaField({
25
+ id,
26
+ value,
27
+ onChange,
28
+ placeholder,
29
+ rows,
30
+ wrap,
31
+ minLength,
32
+ maxLength
33
+ }) {
34
+ const renderTextarea = useCallback(props => /*#__PURE__*/React.createElement("textarea", _extends({}, props, {
35
+ rows: rows,
36
+ wrap: wrap,
37
+ style: TEXTAREA_STYLE
38
+ })), [rows, wrap]);
39
+ return /*#__PURE__*/React.createElement(Input, {
40
+ id: id,
41
+ className: styles.osdkBaseInput,
42
+ value: value ?? "",
43
+ onValueChange: onChange,
44
+ placeholder: placeholder,
45
+ minLength: minLength,
46
+ maxLength: maxLength,
47
+ render: renderTextarea
48
+ });
49
+ }
50
+ //# sourceMappingURL=TextAreaField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextAreaField.js","names":["Input","React","useCallback","styles","TEXTAREA_STYLE","resize","TextAreaField","id","value","onChange","placeholder","rows","wrap","minLength","maxLength","renderTextarea","props","createElement","_extends","style","className","osdkBaseInput","onValueChange","render"],"sources":["TextAreaField.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 { Input } from \"@base-ui/react/input\";\nimport React, { useCallback } from \"react\";\nimport type { TextAreaFieldProps } from \"../FormFieldApi.js\";\nimport styles from \"./BaseInput.module.css\";\n\nconst TEXTAREA_STYLE: React.CSSProperties = { resize: \"vertical\" };\n\nexport function TextAreaField({\n id,\n value,\n onChange,\n placeholder,\n rows,\n wrap,\n minLength,\n maxLength,\n}: TextAreaFieldProps): React.ReactElement {\n const renderTextarea = useCallback(\n (props: React.ComponentPropsWithRef<\"textarea\">) => (\n <textarea {...props} rows={rows} wrap={wrap} style={TEXTAREA_STYLE} />\n ),\n [rows, wrap],\n );\n\n return (\n <Input\n id={id}\n className={styles.osdkBaseInput}\n value={value ?? \"\"}\n onValueChange={onChange}\n placeholder={placeholder}\n minLength={minLength}\n maxLength={maxLength}\n render={renderTextarea}\n />\n );\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,QAAQ,sBAAsB;AAC5C,OAAOC,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAE1C,OAAOC,MAAM,MAAM,wBAAwB;AAE3C,MAAMC,cAAmC,GAAG;EAAEC,MAAM,EAAE;AAAW,CAAC;AAElE,OAAO,SAASC,aAAaA,CAAC;EAC5BC,EAAE;EACFC,KAAK;EACLC,QAAQ;EACRC,WAAW;EACXC,IAAI;EACJC,IAAI;EACJC,SAAS;EACTC;AACkB,CAAC,EAAsB;EACzC,MAAMC,cAAc,GAAGb,WAAW,CAC/Bc,KAA8C,iBAC7Cf,KAAA,CAAAgB,aAAA,aAAAC,QAAA,KAAcF,KAAK;IAAEL,IAAI,EAAEA,IAAK;IAACC,IAAI,EAAEA,IAAK;IAACO,KAAK,EAAEf;EAAe,EAAE,CACtE,EACD,CAACO,IAAI,EAAEC,IAAI,CACb,CAAC;EAED,oBACEX,KAAA,CAAAgB,aAAA,CAACjB,KAAK;IACJO,EAAE,EAAEA,EAAG;IACPa,SAAS,EAAEjB,MAAM,CAACkB,aAAc;IAChCb,KAAK,EAAEA,KAAK,IAAI,EAAG;IACnBc,aAAa,EAAEb,QAAS;IACxBC,WAAW,EAAEA,WAAY;IACzBG,SAAS,EAAEA,SAAU;IACrBC,SAAS,EAAEA,SAAU;IACrBS,MAAM,EAAER;EAAe,CACxB,CAAC;AAEN","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
2
+ * Copyright 2026 Palantir Technologies, Inc. All rights reserved.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { Input } from "@base-ui/react/input";
18
18
  import React from "react";
19
- import styles from "./TextInputField.module.css.js";
19
+ import styles from "./BaseInput.module.css.js";
20
20
  export function TextInputField({
21
21
  id,
22
22
  value,
@@ -27,7 +27,7 @@ export function TextInputField({
27
27
  }) {
28
28
  return /*#__PURE__*/React.createElement(Input, {
29
29
  id: id,
30
- className: styles.osdkTextInput,
30
+ className: styles.osdkBaseInput,
31
31
  type: "text",
32
32
  value: value ?? "",
33
33
  onValueChange: onChange,
@@ -1 +1 @@
1
- {"version":3,"file":"TextInputField.js","names":["Input","React","styles","TextInputField","id","value","onChange","placeholder","minLength","maxLength","createElement","className","osdkTextInput","type","onValueChange"],"sources":["TextInputField.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 { Input } from \"@base-ui/react/input\";\nimport React from \"react\";\nimport type { TextInputFieldProps } from \"../FormFieldApi.js\";\nimport styles from \"./TextInputField.module.css\";\n\nexport function TextInputField({\n id,\n value,\n onChange,\n placeholder,\n minLength,\n maxLength,\n}: TextInputFieldProps & { id?: string }): React.ReactElement {\n return (\n <Input\n id={id}\n className={styles.osdkTextInput}\n type=\"text\"\n value={value ?? \"\"}\n onValueChange={onChange}\n placeholder={placeholder}\n minLength={minLength}\n maxLength={maxLength}\n />\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,QAAQ,sBAAsB;AAC5C,OAAOC,KAAK,MAAM,OAAO;AAEzB,OAAOC,MAAM,MAAM,6BAA6B;AAEhD,OAAO,SAASC,cAAcA,CAAC;EAC7BC,EAAE;EACFC,KAAK;EACLC,QAAQ;EACRC,WAAW;EACXC,SAAS;EACTC;AACqC,CAAC,EAAsB;EAC5D,oBACER,KAAA,CAAAS,aAAA,CAACV,KAAK;IACJI,EAAE,EAAEA,EAAG;IACPO,SAAS,EAAET,MAAM,CAACU,aAAc;IAChCC,IAAI,EAAC,MAAM;IACXR,KAAK,EAAEA,KAAK,IAAI,EAAG;IACnBS,aAAa,EAAER,QAAS;IACxBC,WAAW,EAAEA,WAAY;IACzBC,SAAS,EAAEA,SAAU;IACrBC,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN","ignoreList":[]}
1
+ {"version":3,"file":"TextInputField.js","names":["Input","React","styles","TextInputField","id","value","onChange","placeholder","minLength","maxLength","createElement","className","osdkBaseInput","type","onValueChange"],"sources":["TextInputField.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 { Input } from \"@base-ui/react/input\";\nimport React from \"react\";\nimport type { TextInputFieldProps } from \"../FormFieldApi.js\";\nimport styles from \"./BaseInput.module.css\";\n\nexport function TextInputField({\n id,\n value,\n onChange,\n placeholder,\n minLength,\n maxLength,\n}: TextInputFieldProps & { id?: string }): React.ReactElement {\n return (\n <Input\n id={id}\n className={styles.osdkBaseInput}\n type=\"text\"\n value={value ?? \"\"}\n onValueChange={onChange}\n placeholder={placeholder}\n minLength={minLength}\n maxLength={maxLength}\n />\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,QAAQ,sBAAsB;AAC5C,OAAOC,KAAK,MAAM,OAAO;AAEzB,OAAOC,MAAM,MAAM,wBAAwB;AAE3C,OAAO,SAASC,cAAcA,CAAC;EAC7BC,EAAE;EACFC,KAAK;EACLC,QAAQ;EACRC,WAAW;EACXC,SAAS;EACTC;AACqC,CAAC,EAAsB;EAC5D,oBACER,KAAA,CAAAS,aAAA,CAACV,KAAK;IACJI,EAAE,EAAEA,EAAG;IACPO,SAAS,EAAET,MAAM,CAACU,aAAc;IAChCC,IAAI,EAAC,MAAM;IACXR,KAAK,EAAEA,KAAK,IAAI,EAAG;IACnBS,aAAa,EAAER,QAAS;IACxBC,WAAW,EAAEA,WAAY;IACzBC,SAAS,EAAEA,SAAU;IACrBC,SAAS,EAAEA;EAAU,CACtB,CAAC;AAEN","ignoreList":[]}
@@ -24,14 +24,23 @@ import { PdfViewerOutlineSidebar } from "./components/PdfViewerOutlineSidebar.js
24
24
  import { PdfViewerSearchBar } from "./components/PdfViewerSearchBar.js";
25
25
  import { PdfViewerSidebar } from "./components/PdfViewerSidebar.js";
26
26
  import { PdfViewerToolbar } from "./components/PdfViewerToolbar.js";
27
- import { EMPTY_ANNOTATION_ARRAY, EMPTY_ANNOTATIONS } from "./constants.js";
27
+ import { EMPTY_ANNOTATION_ARRAY } from "./constants.js";
28
+ import { usePdfAnnotationsByPage } from "./hooks/usePdfAnnotationsByPage.js";
29
+ import { usePdfFormFields } from "./hooks/usePdfFormFields.js";
30
+ import { usePdfHighlightMode } from "./hooks/usePdfHighlightMode.js";
28
31
  import { usePdfViewerState } from "./hooks/usePdfViewerState.js";
29
32
  import styles from "./PdfViewer.module.css.js";
30
33
  export function BasePdfViewer({
31
34
  src,
32
- annotations = EMPTY_ANNOTATIONS,
35
+ annotations = EMPTY_ANNOTATION_ARRAY,
33
36
  onAnnotationClick,
34
37
  onDownload,
38
+ enableHighlight = false,
39
+ onTextHighlight,
40
+ onHighlightDelete,
41
+ formData,
42
+ onFormSubmit,
43
+ onFormChange,
35
44
  initialPage = 1,
36
45
  initialScale = 1.0,
37
46
  initialSidebarOpen = false,
@@ -48,6 +57,28 @@ export function BasePdfViewer({
48
57
  sidebarMode: sidebarModeProp,
49
58
  onDownload
50
59
  });
60
+ const {
61
+ highlightModeActive,
62
+ toggleHighlightMode
63
+ } = usePdfHighlightMode({
64
+ pdfViewerRef: viewer.pdfViewerRef,
65
+ document: viewer.document,
66
+ enabled: enableHighlight,
67
+ onTextHighlight,
68
+ onHighlightDelete
69
+ });
70
+ const {
71
+ hasFormFields,
72
+ submitFormData
73
+ } = usePdfFormFields({
74
+ pdfViewerRef: viewer.pdfViewerRef,
75
+ eventBusRef: viewer.eventBusRef,
76
+ document: viewer.document,
77
+ formData,
78
+ onFormSubmit,
79
+ onFormChange
80
+ });
81
+ const annotationsByPage = usePdfAnnotationsByPage(annotations);
51
82
  const rootClassName = classnames(styles.pdfViewer, className);
52
83
  if (viewer.loading) {
53
84
  return /*#__PURE__*/React.createElement("div", {
@@ -88,7 +119,12 @@ export function BasePdfViewer({
88
119
  onDownload: viewer.download,
89
120
  enableDownload: enableDownload,
90
121
  onRotateLeft: viewer.rotateLeft,
91
- onRotateRight: viewer.rotateRight
122
+ onRotateRight: viewer.rotateRight,
123
+ enableHighlight: enableHighlight,
124
+ highlightModeActive: highlightModeActive,
125
+ onHighlightToggle: toggleHighlightMode,
126
+ enableFormSave: onFormSubmit != null && hasFormFields,
127
+ onFormSave: submitFormData
92
128
  }), viewer.search.isSearchOpen && /*#__PURE__*/React.createElement(PdfViewerSearchBar, {
93
129
  query: viewer.search.query,
94
130
  totalMatches: viewer.search.totalMatches,
@@ -122,7 +158,7 @@ export function BasePdfViewer({
122
158
  ref: viewer.viewerRef,
123
159
  className: "pdfViewer"
124
160
  }), viewer.portalTargets.map(target => {
125
- const pageAnnotations = annotations[target.pageNumber] ?? EMPTY_ANNOTATION_ARRAY;
161
+ const pageAnnotations = annotationsByPage[target.pageNumber] ?? EMPTY_ANNOTATION_ARRAY;
126
162
  if (pageAnnotations.length === 0) {
127
163
  return null;
128
164
  }