@osdk/react-components 0.2.0-beta.21 → 0.2.0-beta.22

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 (257) hide show
  1. package/AGENTS.md +14 -97
  2. package/CHANGELOG.md +19 -0
  3. package/README.md +1 -1
  4. package/build/browser/action-form/ActionFormApi.js.map +1 -1
  5. package/build/browser/action-form/BaseForm.js +18 -5
  6. package/build/browser/action-form/BaseForm.js.map +1 -1
  7. package/build/browser/action-form/BaseForm.module.css +38 -0
  8. package/build/browser/action-form/BaseForm.module.css.js +8 -0
  9. package/build/browser/action-form/FormField.js +42 -0
  10. package/build/browser/action-form/FormField.js.map +1 -0
  11. package/build/browser/action-form/FormField.module.css +41 -0
  12. package/build/browser/action-form/FormField.module.css.js +10 -0
  13. package/build/browser/action-form/FormFieldApi.js.map +1 -1
  14. package/build/browser/action-form/FormHeader.js +26 -0
  15. package/build/browser/action-form/FormHeader.js.map +1 -0
  16. package/build/browser/action-form/FormHeader.module.css +26 -0
  17. package/build/browser/action-form/FormHeader.module.css.js +6 -0
  18. package/build/browser/action-form/fields/FormFieldRenderer.js +7 -5
  19. package/build/browser/action-form/fields/FormFieldRenderer.js.map +1 -1
  20. package/build/browser/action-form/fields/TextInputField.js +2 -0
  21. package/build/browser/action-form/fields/TextInputField.js.map +1 -1
  22. package/build/browser/action-form/fields/TextInputField.module.css +56 -0
  23. package/build/browser/action-form/fields/TextInputField.module.css.js +6 -0
  24. package/build/browser/base-components/checkbox/Checkbox.js +2 -2
  25. package/build/browser/base-components/checkbox/Checkbox.js.map +1 -1
  26. package/build/browser/base-components/checkbox/Checkbox.module.css +0 -4
  27. package/build/browser/base-components/combobox/Combobox.js +3 -8
  28. package/build/browser/base-components/combobox/Combobox.js.map +1 -1
  29. package/build/browser/base-components/combobox/Combobox.module.css +0 -3
  30. package/build/browser/base-components/draggable-list/DraggableList.js +2 -4
  31. package/build/browser/base-components/draggable-list/DraggableList.js.map +1 -1
  32. package/build/browser/base-components/search-bar/SearchBar.module.css +2 -2
  33. package/build/browser/base-components/select/Select.js +1 -3
  34. package/build/browser/base-components/select/Select.js.map +1 -1
  35. package/build/browser/base-components/select/Select.module.css +0 -2
  36. package/build/browser/base-components/switch/Switch.module.css +0 -1
  37. package/build/browser/filter-list/FilterInput.js +14 -5
  38. package/build/browser/filter-list/FilterInput.js.map +1 -1
  39. package/build/browser/filter-list/FilterList.js +13 -5
  40. package/build/browser/filter-list/FilterList.js.map +1 -1
  41. package/build/browser/filter-list/FilterListApi.js.map +1 -1
  42. package/build/browser/filter-list/base/AddFilterPopover.js +4 -3
  43. package/build/browser/filter-list/base/AddFilterPopover.js.map +1 -1
  44. package/build/browser/filter-list/base/BaseFilterListApi.js.map +1 -1
  45. package/build/browser/filter-list/base/ExcludeDropdown.js +61 -0
  46. package/build/browser/filter-list/base/ExcludeDropdown.js.map +1 -0
  47. package/build/browser/filter-list/base/ExcludeDropdown.module.css +94 -0
  48. package/build/browser/filter-list/base/ExcludeDropdown.module.css.js +12 -0
  49. package/build/browser/filter-list/base/FilterIcons.js +0 -39
  50. package/build/browser/filter-list/base/FilterIcons.js.map +1 -1
  51. package/build/browser/filter-list/base/FilterInputExcludeRow.js +55 -0
  52. package/build/browser/filter-list/base/FilterInputExcludeRow.js.map +1 -0
  53. package/build/browser/filter-list/base/FilterListItem.js +72 -23
  54. package/build/browser/filter-list/base/FilterListItem.js.map +1 -1
  55. package/build/browser/filter-list/base/FilterListItem.module.css +96 -20
  56. package/build/browser/filter-list/base/FilterListItem.module.css.js +7 -2
  57. package/build/browser/filter-list/base/inputs/CheckboxListInput.js +2 -2
  58. package/build/browser/filter-list/base/inputs/CheckboxListInput.js.map +1 -1
  59. package/build/browser/filter-list/base/inputs/ContainsTextInput.js +2 -6
  60. package/build/browser/filter-list/base/inputs/ContainsTextInput.js.map +1 -1
  61. package/build/browser/filter-list/base/inputs/ListogramInput.js +2 -2
  62. package/build/browser/filter-list/base/inputs/ListogramInput.js.map +1 -1
  63. package/build/browser/filter-list/base/inputs/RangeInput.js +2 -2
  64. package/build/browser/filter-list/base/inputs/RangeInput.js.map +1 -1
  65. package/build/browser/filter-list/base/inputs/SingleSelectInput.js +1 -3
  66. package/build/browser/filter-list/base/inputs/SingleSelectInput.js.map +1 -1
  67. package/build/browser/filter-list/base/inputs/{useStaleData.js → useStableData.js} +5 -5
  68. package/build/browser/filter-list/base/inputs/useStableData.js.map +1 -0
  69. package/build/browser/filter-list/hooks/usePropertyAggregation.js +3 -2
  70. package/build/browser/filter-list/hooks/usePropertyAggregation.js.map +1 -1
  71. package/build/browser/filter-list/inputs/CheckboxListFilterInput.js +15 -5
  72. package/build/browser/filter-list/inputs/CheckboxListFilterInput.js.map +1 -1
  73. package/build/browser/filter-list/inputs/DateRangeFilterInput.js +10 -6
  74. package/build/browser/filter-list/inputs/DateRangeFilterInput.js.map +1 -1
  75. package/build/browser/filter-list/inputs/LinkedPropertyInput.js +41 -18
  76. package/build/browser/filter-list/inputs/LinkedPropertyInput.js.map +1 -1
  77. package/build/browser/filter-list/inputs/ListogramFilterInput.js +15 -5
  78. package/build/browser/filter-list/inputs/ListogramFilterInput.js.map +1 -1
  79. package/build/browser/filter-list/inputs/MultiSelectFilterInput.js +12 -4
  80. package/build/browser/filter-list/inputs/MultiSelectFilterInput.js.map +1 -1
  81. package/build/browser/filter-list/inputs/NumberRangeFilterInput.js +10 -6
  82. package/build/browser/filter-list/inputs/NumberRangeFilterInput.js.map +1 -1
  83. package/build/browser/filter-list/inputs/PropertyFilterInput.js +36 -10
  84. package/build/browser/filter-list/inputs/PropertyFilterInput.js.map +1 -1
  85. package/build/browser/filter-list/inputs/SingleSelectFilterInput.js +12 -4
  86. package/build/browser/filter-list/inputs/SingleSelectFilterInput.js.map +1 -1
  87. package/build/browser/filter-list/inputs/TextTagsFilterInput.js +12 -4
  88. package/build/browser/filter-list/inputs/TextTagsFilterInput.js.map +1 -1
  89. package/build/browser/filter-list/utils/filterValues.js +29 -1
  90. package/build/browser/filter-list/utils/filterValues.js.map +1 -1
  91. package/build/browser/object-table/LoadingCell.module.css +0 -1
  92. package/build/browser/object-table/MultiColumnSortDialog.js +1 -3
  93. package/build/browser/object-table/MultiColumnSortDialog.js.map +1 -1
  94. package/build/browser/object-table/MultiColumnSortDialog.module.css +0 -1
  95. package/build/browser/object-table/TableCell.module.css +1 -1
  96. package/build/browser/object-table/TableHeader.module.css +2 -2
  97. package/build/browser/object-table/TableHeaderWithPopover.js +2 -4
  98. package/build/browser/object-table/TableHeaderWithPopover.js.map +1 -1
  99. package/build/browser/object-table/TableHeaderWithPopover.module.css +1 -0
  100. package/build/browser/pdf-viewer/PdfViewerAnnotationLayer.module.css +0 -1
  101. package/build/browser/public/experimental.js +2 -0
  102. package/build/browser/public/experimental.js.map +1 -1
  103. package/build/browser/styles.css +372 -38
  104. package/build/cjs/public/experimental.cjs +1882 -1068
  105. package/build/cjs/public/experimental.cjs.map +1 -1
  106. package/build/cjs/public/experimental.css +244 -38
  107. package/build/cjs/public/experimental.css.map +1 -1
  108. package/build/cjs/public/experimental.d.cts +420 -11
  109. package/build/esm/action-form/ActionFormApi.js.map +1 -1
  110. package/build/esm/action-form/BaseForm.js +18 -5
  111. package/build/esm/action-form/BaseForm.js.map +1 -1
  112. package/build/esm/action-form/BaseForm.module.css +38 -0
  113. package/build/esm/action-form/FormField.js +42 -0
  114. package/build/esm/action-form/FormField.js.map +1 -0
  115. package/build/esm/action-form/FormField.module.css +41 -0
  116. package/build/esm/action-form/FormFieldApi.js.map +1 -1
  117. package/build/esm/action-form/FormHeader.js +26 -0
  118. package/build/esm/action-form/FormHeader.js.map +1 -0
  119. package/build/esm/action-form/FormHeader.module.css +26 -0
  120. package/build/esm/action-form/fields/FormFieldRenderer.js +7 -5
  121. package/build/esm/action-form/fields/FormFieldRenderer.js.map +1 -1
  122. package/build/esm/action-form/fields/TextInputField.js +2 -0
  123. package/build/esm/action-form/fields/TextInputField.js.map +1 -1
  124. package/build/esm/action-form/fields/TextInputField.module.css +56 -0
  125. package/build/esm/base-components/checkbox/Checkbox.js +2 -2
  126. package/build/esm/base-components/checkbox/Checkbox.js.map +1 -1
  127. package/build/esm/base-components/checkbox/Checkbox.module.css +0 -4
  128. package/build/esm/base-components/combobox/Combobox.js +3 -8
  129. package/build/esm/base-components/combobox/Combobox.js.map +1 -1
  130. package/build/esm/base-components/combobox/Combobox.module.css +0 -3
  131. package/build/esm/base-components/draggable-list/DraggableList.js +2 -4
  132. package/build/esm/base-components/draggable-list/DraggableList.js.map +1 -1
  133. package/build/esm/base-components/search-bar/SearchBar.module.css +2 -2
  134. package/build/esm/base-components/select/Select.js +1 -3
  135. package/build/esm/base-components/select/Select.js.map +1 -1
  136. package/build/esm/base-components/select/Select.module.css +0 -2
  137. package/build/esm/base-components/switch/Switch.module.css +0 -1
  138. package/build/esm/filter-list/FilterInput.js +14 -5
  139. package/build/esm/filter-list/FilterInput.js.map +1 -1
  140. package/build/esm/filter-list/FilterList.js +13 -5
  141. package/build/esm/filter-list/FilterList.js.map +1 -1
  142. package/build/esm/filter-list/FilterListApi.js.map +1 -1
  143. package/build/esm/filter-list/base/AddFilterPopover.js +4 -3
  144. package/build/esm/filter-list/base/AddFilterPopover.js.map +1 -1
  145. package/build/esm/filter-list/base/BaseFilterListApi.js.map +1 -1
  146. package/build/esm/filter-list/base/ExcludeDropdown.js +61 -0
  147. package/build/esm/filter-list/base/ExcludeDropdown.js.map +1 -0
  148. package/build/esm/filter-list/base/ExcludeDropdown.module.css +94 -0
  149. package/build/esm/filter-list/base/FilterIcons.js +0 -39
  150. package/build/esm/filter-list/base/FilterIcons.js.map +1 -1
  151. package/build/esm/filter-list/base/FilterInputExcludeRow.js +55 -0
  152. package/build/esm/filter-list/base/FilterInputExcludeRow.js.map +1 -0
  153. package/build/esm/filter-list/base/FilterListItem.js +72 -23
  154. package/build/esm/filter-list/base/FilterListItem.js.map +1 -1
  155. package/build/esm/filter-list/base/FilterListItem.module.css +96 -20
  156. package/build/esm/filter-list/base/inputs/CheckboxListInput.js +2 -2
  157. package/build/esm/filter-list/base/inputs/CheckboxListInput.js.map +1 -1
  158. package/build/esm/filter-list/base/inputs/ContainsTextInput.js +2 -6
  159. package/build/esm/filter-list/base/inputs/ContainsTextInput.js.map +1 -1
  160. package/build/esm/filter-list/base/inputs/ListogramInput.js +2 -2
  161. package/build/esm/filter-list/base/inputs/ListogramInput.js.map +1 -1
  162. package/build/esm/filter-list/base/inputs/RangeInput.js +2 -2
  163. package/build/esm/filter-list/base/inputs/RangeInput.js.map +1 -1
  164. package/build/esm/filter-list/base/inputs/SingleSelectInput.js +1 -3
  165. package/build/esm/filter-list/base/inputs/SingleSelectInput.js.map +1 -1
  166. package/build/esm/filter-list/base/inputs/{useStaleData.js → useStableData.js} +5 -5
  167. package/build/esm/filter-list/base/inputs/useStableData.js.map +1 -0
  168. package/build/esm/filter-list/hooks/usePropertyAggregation.js +3 -2
  169. package/build/esm/filter-list/hooks/usePropertyAggregation.js.map +1 -1
  170. package/build/esm/filter-list/inputs/CheckboxListFilterInput.js +15 -5
  171. package/build/esm/filter-list/inputs/CheckboxListFilterInput.js.map +1 -1
  172. package/build/esm/filter-list/inputs/DateRangeFilterInput.js +10 -6
  173. package/build/esm/filter-list/inputs/DateRangeFilterInput.js.map +1 -1
  174. package/build/esm/filter-list/inputs/LinkedPropertyInput.js +41 -18
  175. package/build/esm/filter-list/inputs/LinkedPropertyInput.js.map +1 -1
  176. package/build/esm/filter-list/inputs/ListogramFilterInput.js +15 -5
  177. package/build/esm/filter-list/inputs/ListogramFilterInput.js.map +1 -1
  178. package/build/esm/filter-list/inputs/MultiSelectFilterInput.js +12 -4
  179. package/build/esm/filter-list/inputs/MultiSelectFilterInput.js.map +1 -1
  180. package/build/esm/filter-list/inputs/NumberRangeFilterInput.js +10 -6
  181. package/build/esm/filter-list/inputs/NumberRangeFilterInput.js.map +1 -1
  182. package/build/esm/filter-list/inputs/PropertyFilterInput.js +36 -10
  183. package/build/esm/filter-list/inputs/PropertyFilterInput.js.map +1 -1
  184. package/build/esm/filter-list/inputs/SingleSelectFilterInput.js +12 -4
  185. package/build/esm/filter-list/inputs/SingleSelectFilterInput.js.map +1 -1
  186. package/build/esm/filter-list/inputs/TextTagsFilterInput.js +12 -4
  187. package/build/esm/filter-list/inputs/TextTagsFilterInput.js.map +1 -1
  188. package/build/esm/filter-list/utils/filterValues.js +29 -1
  189. package/build/esm/filter-list/utils/filterValues.js.map +1 -1
  190. package/build/esm/object-table/LoadingCell.module.css +0 -1
  191. package/build/esm/object-table/MultiColumnSortDialog.js +1 -3
  192. package/build/esm/object-table/MultiColumnSortDialog.js.map +1 -1
  193. package/build/esm/object-table/MultiColumnSortDialog.module.css +0 -1
  194. package/build/esm/object-table/TableCell.module.css +1 -1
  195. package/build/esm/object-table/TableHeader.module.css +2 -2
  196. package/build/esm/object-table/TableHeaderWithPopover.js +2 -4
  197. package/build/esm/object-table/TableHeaderWithPopover.js.map +1 -1
  198. package/build/esm/object-table/TableHeaderWithPopover.module.css +1 -0
  199. package/build/esm/pdf-viewer/PdfViewerAnnotationLayer.module.css +0 -1
  200. package/build/esm/public/experimental.js +2 -0
  201. package/build/esm/public/experimental.js.map +1 -1
  202. package/build/types/action-form/ActionFormApi.d.ts +1 -0
  203. package/build/types/action-form/ActionFormApi.d.ts.map +1 -1
  204. package/build/types/action-form/BaseForm.d.ts.map +1 -1
  205. package/build/types/action-form/FormField.d.ts +11 -0
  206. package/build/types/action-form/FormField.d.ts.map +1 -0
  207. package/build/types/action-form/FormFieldApi.d.ts +1 -1
  208. package/build/types/action-form/FormHeader.d.ts +6 -0
  209. package/build/types/action-form/FormHeader.d.ts.map +1 -0
  210. package/build/types/action-form/fields/FormFieldRenderer.d.ts.map +1 -1
  211. package/build/types/action-form/fields/TextInputField.d.ts.map +1 -1
  212. package/build/types/filter-list/FilterInput.d.ts +3 -1
  213. package/build/types/filter-list/FilterInput.d.ts.map +1 -1
  214. package/build/types/filter-list/FilterListApi.d.ts +12 -9
  215. package/build/types/filter-list/FilterListApi.d.ts.map +1 -1
  216. package/build/types/filter-list/base/AddFilterPopover.d.ts +2 -1
  217. package/build/types/filter-list/base/AddFilterPopover.d.ts.map +1 -1
  218. package/build/types/filter-list/base/BaseFilterListApi.d.ts +2 -0
  219. package/build/types/filter-list/base/BaseFilterListApi.d.ts.map +1 -1
  220. package/build/types/filter-list/base/ExcludeDropdown.d.ts +8 -0
  221. package/build/types/filter-list/base/ExcludeDropdown.d.ts.map +1 -0
  222. package/build/types/filter-list/base/FilterIcons.d.ts +0 -2
  223. package/build/types/filter-list/base/FilterIcons.d.ts.map +1 -1
  224. package/build/types/filter-list/base/FilterInputExcludeRow.d.ts +12 -0
  225. package/build/types/filter-list/base/FilterInputExcludeRow.d.ts.map +1 -0
  226. package/build/types/filter-list/base/FilterListItem.d.ts.map +1 -1
  227. package/build/types/filter-list/base/inputs/useStableData.d.ts +1 -0
  228. package/build/types/filter-list/base/inputs/useStableData.d.ts.map +1 -0
  229. package/build/types/filter-list/hooks/usePropertyAggregation.d.ts +2 -2
  230. package/build/types/filter-list/hooks/usePropertyAggregation.d.ts.map +1 -1
  231. package/build/types/filter-list/inputs/CheckboxListFilterInput.d.ts +5 -2
  232. package/build/types/filter-list/inputs/CheckboxListFilterInput.d.ts.map +1 -1
  233. package/build/types/filter-list/inputs/DateRangeFilterInput.d.ts +3 -2
  234. package/build/types/filter-list/inputs/DateRangeFilterInput.d.ts.map +1 -1
  235. package/build/types/filter-list/inputs/LinkedPropertyInput.d.ts +2 -1
  236. package/build/types/filter-list/inputs/LinkedPropertyInput.d.ts.map +1 -1
  237. package/build/types/filter-list/inputs/ListogramFilterInput.d.ts +5 -2
  238. package/build/types/filter-list/inputs/ListogramFilterInput.d.ts.map +1 -1
  239. package/build/types/filter-list/inputs/MultiSelectFilterInput.d.ts +4 -2
  240. package/build/types/filter-list/inputs/MultiSelectFilterInput.d.ts.map +1 -1
  241. package/build/types/filter-list/inputs/NumberRangeFilterInput.d.ts +3 -2
  242. package/build/types/filter-list/inputs/NumberRangeFilterInput.d.ts.map +1 -1
  243. package/build/types/filter-list/inputs/PropertyFilterInput.d.ts +3 -1
  244. package/build/types/filter-list/inputs/PropertyFilterInput.d.ts.map +1 -1
  245. package/build/types/filter-list/inputs/SingleSelectFilterInput.d.ts +4 -2
  246. package/build/types/filter-list/inputs/SingleSelectFilterInput.d.ts.map +1 -1
  247. package/build/types/filter-list/inputs/TextTagsFilterInput.d.ts +4 -2
  248. package/build/types/filter-list/inputs/TextTagsFilterInput.d.ts.map +1 -1
  249. package/build/types/filter-list/utils/filterValues.d.ts +2 -0
  250. package/build/types/filter-list/utils/filterValues.d.ts.map +1 -1
  251. package/build/types/public/experimental.d.ts +4 -0
  252. package/build/types/public/experimental.d.ts.map +1 -1
  253. package/package.json +4 -4
  254. package/build/browser/filter-list/base/inputs/useStaleData.js.map +0 -1
  255. package/build/esm/filter-list/base/inputs/useStaleData.js.map +0 -1
  256. package/build/types/filter-list/base/inputs/useStaleData.d.ts +0 -1
  257. package/build/types/filter-list/base/inputs/useStaleData.d.ts.map +0 -1
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { ReactNode, ReactElement } from 'react';
3
- import { ObjectTypeDefinition, ObjectSet, WhereClause, PropertyKeys, LinkNames, LinkedType, WirePropertyTypes, CompileTimeMetadata, ObjectOrInterfaceDefinition, SimplePropertyDef, QueryDefinition, QueryMetadata, Osdk, DerivedProperty, PrimaryKeyType, Media } from '@osdk/api';
3
+ import { ObjectTypeDefinition, ObjectSet, WhereClause, PropertyKeys, LinkNames, LinkedType, WirePropertyTypes, CompileTimeMetadata, ObjectOrInterfaceDefinition, SimplePropertyDef, QueryDefinition, QueryMetadata, Osdk, DerivedProperty, PrimaryKeyType, Media, ActionDefinition, ActionMetadata, ActionParam, DataValueClientToWire, ActionEditResponse, ActionValidationResponse } from '@osdk/api';
4
4
  import { RowData, Table, Cell, VisibilityState, ColumnOrderState } from '@tanstack/react-table';
5
+ import { ActionValidationError } from '@osdk/client';
5
6
 
6
7
  /**
7
8
  * State for custom filter
@@ -358,6 +359,8 @@ type RenderFilterInput<D> = (props: {
358
359
  filterKey: string;
359
360
  filterState: FilterState | undefined;
360
361
  onFilterStateChanged: (state: FilterState) => void;
362
+ searchQuery?: string;
363
+ excludeRowOpen?: boolean;
361
364
  }) => React__default.ReactNode;
362
365
  interface BaseFilterListProps<D> {
363
366
  filterDefinitions?: Array<D>;
@@ -442,14 +445,14 @@ interface FilterListProps<Q extends ObjectTypeDefinition> {
442
445
  /**
443
446
  * Controls how filter visibility (add/remove) is managed.
444
447
  *
445
- * - `"controlled"` (default): The consumer manages which filters are
446
- * visible via `filterDefinitions`. Filters with `isVisible: false` are
447
- * excluded from the rendered list.
448
- * - `"uncontrolled"`: FilterList manages visibility internally. An "Add
449
- * filter" popover is rendered for filters with `isVisible: false`, and
450
- * each visible filter shows a remove button.
448
+ * - `"uncontrolled"` (default): FilterList manages visibility internally.
449
+ * An "Add filter" popover is rendered for filters with `isVisible: false`,
450
+ * and each visible filter shows a remove button.
451
+ * - `"controlled"`: The consumer manages which filters are visible via
452
+ * `filterDefinitions`. Filters with `isVisible: false` are excluded from
453
+ * the rendered list.
451
454
  *
452
- * @default "controlled"
455
+ * @default "uncontrolled"
453
456
  */
454
457
  addFilterMode?: "controlled" | "uncontrolled";
455
458
  /**
@@ -510,8 +513,11 @@ interface FilterListProps<Q extends ObjectTypeDefinition> {
510
513
  className?: string;
511
514
  /**
512
515
  * Custom render function for the "Add filter" button.
513
- * Only used in controlled mode. In uncontrolled mode, the built-in
514
- * AddFilterPopover is rendered automatically.
516
+ *
517
+ * - In uncontrolled mode: customizes the trigger element for the built-in
518
+ * add-filter popover. The popover behavior is handled automatically.
519
+ * - In controlled mode: replaces the entire add-filter button area.
520
+ * The consumer is responsible for all add-filter behavior.
515
521
  */
516
522
  renderAddFilterButton?: () => React__default.ReactNode;
517
523
  }
@@ -964,4 +970,407 @@ interface PdfRendererProps extends Omit<PdfViewerProps, "src"> {
964
970
  }
965
971
  declare function PdfRenderer({ media, className, ...pdfViewerProps }: PdfRendererProps): React__default.ReactElement;
966
972
 
967
- export { type AnnotationType, BaseFilterList, type BaseFilterListProps, BasePdfViewer, BaseTable, type BaseTableProps, type CellEditInfo, ColumnConfigDialog, type ColumnConfigDialogProps, type ColumnConfigOptions, type ColumnDefinition, type ColumnDefinitionLocator, type CustomColumnLocator, type FilterComponentType, type FilterDefinitionUnion, FilterList, type FilterListItemProps, type FilterListProps, type FilterState, type FunctionColumnLocator, ObjectTable, type ObjectTableProps, type PdfAnnotation, PdfRenderer, type PdfRendererProps, type PdfViewerProps, type PropertyColumnLocator, type PropertyFilterDefinition, type RdpColumnLocator, type RenderFilterInput, deserializeFilterStates, serializeFilterStates };
973
+ /**
974
+ * A form field definition specifies configuration for a single field
975
+ */
976
+ interface FormFieldDefinition<Q extends ActionDefinition<unknown>, K extends FieldKey<Q> = FieldKey<Q>> {
977
+ /**
978
+ * The field's unique key
979
+ */
980
+ fieldKey: K;
981
+ /**
982
+ * Display label for the field
983
+ * If not provided, the form field will not show any label.
984
+ */
985
+ label?: string;
986
+ /**
987
+ * Default value of the field
988
+ */
989
+ defaultValue?: FieldValueType<Q, K>;
990
+ /**
991
+ * The form field component type to render
992
+ */
993
+ fieldComponent: ValidFormFieldForPropertyType<FieldDescriptorType<Q, K>>;
994
+ /**
995
+ * Whether the field is required
996
+ */
997
+ isRequired?: boolean;
998
+ /**
999
+ * Placeholder text
1000
+ */
1001
+ placeholder?: string;
1002
+ /**
1003
+ * Additional information to display on this field
1004
+ * The placement of helper text depends on the value of helperTextPlacement prop
1005
+ */
1006
+ helperText?: string;
1007
+ /**
1008
+ * The placement of the helper text either below the field or in a tooltip
1009
+ *
1010
+ * @default "tooltip"
1011
+ */
1012
+ helperTextPlacement?: "bottom" | "tooltip";
1013
+ /**
1014
+ * Whether the field is disabled
1015
+ */
1016
+ isDisabled?: boolean;
1017
+ /**
1018
+ * A callback to return a custom error message if validation failed
1019
+ *
1020
+ * @param validationRule the validation rule that failed with the error message
1021
+ * @returns the error message to display
1022
+ */
1023
+ onValidationError?: (error: ValidationError) => string;
1024
+ /**
1025
+ * Additional function to validate the field
1026
+ *
1027
+ * @param value the current field value
1028
+ * @returns a boolean promise indicating whether the value is valid
1029
+ */
1030
+ validate?: (value: FieldValueType<Q, K>) => Promise<boolean>;
1031
+ /**
1032
+ * The component props for the form field
1033
+ * Excludes runtime props (key, onChange) which are managed by ActionForm
1034
+ */
1035
+ fieldComponentProps?: Omit<FormFieldPropsByType[ValidFormFieldForPropertyType<FieldDescriptorType<Q, K>>], "key" | "onChange">;
1036
+ }
1037
+ type ValidationError = {
1038
+ type: ValidationRule;
1039
+ error: string;
1040
+ };
1041
+ type ValidationRule = "required" | "min" | "max" | "minLength" | "maxLength" | "pattern" | "validate";
1042
+ /**
1043
+ * Maps field types to their corresponding props
1044
+ */
1045
+ interface FormFieldPropsByType {
1046
+ DATETIME_PICKER: DatetimePickerFieldProps;
1047
+ DROPDOWN: DropdownFieldProps<unknown, boolean>;
1048
+ FILE_PICKER: FilePickerProps;
1049
+ NUMBER_INPUT: NumberInputFieldProps;
1050
+ OBJECT_SET: ObjectSetFieldProps<ObjectTypeDefinition>;
1051
+ RADIO_BUTTONS: RadioButtonsFieldProps<unknown>;
1052
+ TEXT_AREA: TextAreaFieldProps;
1053
+ TEXT_INPUT: TextInputFieldProps;
1054
+ CUSTOM: CustomFieldProps<unknown>;
1055
+ }
1056
+ /**
1057
+ * Datetime picker field props
1058
+ */
1059
+ interface DatetimePickerFieldProps extends BaseFormFieldProps<Date> {
1060
+ /**
1061
+ * The earliest date the user can select
1062
+ * If provided, this will be added to the field validation
1063
+ */
1064
+ min?: Date;
1065
+ /**
1066
+ * The latest date the user can select
1067
+ * If provided, this will be added to the field validation
1068
+ */
1069
+ max?: Date;
1070
+ /**
1071
+ * Whether to show time picker
1072
+ */
1073
+ showTime?: boolean;
1074
+ /**
1075
+ * Function to format the date string
1076
+ */
1077
+ formatDate?: (date: Date) => string;
1078
+ }
1079
+ /**
1080
+ * Dropdown field props with selectable items
1081
+ */
1082
+ interface DropdownFieldProps<V, Multiple extends boolean = false> extends BaseFormFieldProps<Multiple extends true ? V[] : V> {
1083
+ /**
1084
+ * Available items for the dropdown
1085
+ */
1086
+ items: V[];
1087
+ /**
1088
+ * Converts an item to a display string. Defaults to `String()`.
1089
+ */
1090
+ itemToStringLabel?: (item: V) => string;
1091
+ /**
1092
+ * Returns a unique string key for a list item. Used as the React `key`.
1093
+ * Falls back to the item's index when not provided.
1094
+ */
1095
+ itemToKey?: (item: V) => string;
1096
+ /**
1097
+ * Custom equality check for item values. Defaults to `Object.is`.
1098
+ * Required when items are objects to ensure correct selection matching.
1099
+ */
1100
+ isItemEqual?: (a: V, b: V) => boolean;
1101
+ /**
1102
+ * Whether the dropdown allows searching/filtering.
1103
+ * When true, renders a Combobox with a search input.
1104
+ * When false (default), renders a Select dropdown.
1105
+ */
1106
+ isSearchable?: boolean;
1107
+ /**
1108
+ * Placeholder text shown when no value is selected.
1109
+ */
1110
+ placeholder?: string;
1111
+ /**
1112
+ * Whether multiple values can be selected
1113
+ */
1114
+ isMultiple?: Multiple;
1115
+ }
1116
+ interface FilePickerProps extends BaseFormFieldProps<File | File[]> {
1117
+ /**
1118
+ * Whether multiple files can be selected
1119
+ */
1120
+ isMulti?: boolean;
1121
+ /**
1122
+ * Accepted file types (e.g., "image/*", ".pdf")
1123
+ */
1124
+ accept?: string | string[];
1125
+ /**
1126
+ * Maximum file size in bytes
1127
+ */
1128
+ maxSize?: number;
1129
+ }
1130
+ /**
1131
+ * Text area field props
1132
+ */
1133
+ interface TextAreaFieldProps extends BaseFormFieldProps<string>, Pick<React__default.TextareaHTMLAttributes<HTMLTextAreaElement>, "rows" | "wrap"
1134
+ /**
1135
+ * If provided, this will be added to the field validation
1136
+ */
1137
+ | "minLength"
1138
+ /**
1139
+ * If provided, this will be added to the field validation
1140
+ */
1141
+ | "maxLength"> {
1142
+ }
1143
+ interface TextInputFieldProps extends BaseFormFieldProps<string>, Pick<React__default.InputHTMLAttributes<HTMLInputElement>,
1144
+ /**
1145
+ * If provided, this will be added to the field validation
1146
+ */
1147
+ "minLength"
1148
+ /**
1149
+ * If provided, this will be added to the field validation
1150
+ */
1151
+ | "maxLength"> {
1152
+ placeholder?: string;
1153
+ }
1154
+ /**
1155
+ * Number input field props
1156
+ */
1157
+ interface NumberInputFieldProps extends BaseFormFieldProps<number>, Pick<React__default.InputHTMLAttributes<HTMLInputElement>,
1158
+ /**
1159
+ * If provided, this will be added to the field validation
1160
+ */
1161
+ "min"
1162
+ /**
1163
+ * If provided, this will be added to the field validation
1164
+ */
1165
+ | "max" | "step"> {
1166
+ }
1167
+ /**
1168
+ * Radio buttons field props
1169
+ */
1170
+ interface RadioButtonsFieldProps<V> extends BaseFormFieldProps<V> {
1171
+ /**
1172
+ * Available options for radio buttons
1173
+ */
1174
+ options: Option<V>[];
1175
+ }
1176
+ /**
1177
+ * Option interface for radio button options
1178
+ */
1179
+ interface Option<V> {
1180
+ label: string;
1181
+ value: V;
1182
+ }
1183
+ /**
1184
+ * Object set field displays the summary of the count of the given object set
1185
+ */
1186
+ interface ObjectSetFieldProps<T extends ObjectTypeDefinition> extends BaseFormFieldProps<ObjectSet<T>> {
1187
+ }
1188
+ /**
1189
+ * Custom field props for user-defined renderers
1190
+ */
1191
+ interface CustomFieldProps<V> extends BaseFormFieldProps<V> {
1192
+ /**
1193
+ * Custom renderer function
1194
+ */
1195
+ customRenderer: (props: BaseFormFieldProps<V>) => React__default.ReactNode;
1196
+ }
1197
+ interface BaseFormFieldProps<V> {
1198
+ /**
1199
+ * The value of the form field
1200
+ */
1201
+ value: V | null;
1202
+ /**
1203
+ * Called when the field value changes.
1204
+ *
1205
+ * ActionForm internally wraps this to pass the key to `onFieldValueChange`:
1206
+ * ```
1207
+ * <DropdownField
1208
+ * {...fieldDef}
1209
+ * onChange={(value) => onFieldValueChange(fieldDef.key, value)}
1210
+ * />
1211
+ * ```
1212
+ *
1213
+ * @param value The new value of the form field
1214
+ */
1215
+ onChange?: (value: V | null) => void;
1216
+ }
1217
+ type FieldKey<Q extends ActionDefinition<unknown>> = keyof ActionParameters<Q>;
1218
+ /**
1219
+ * Extracts parameters from an ActionDefinition
1220
+ */
1221
+ type ActionParameters<Q extends ActionDefinition<unknown>> = CompileTimeMetadata<Q>["parameters"];
1222
+ /**
1223
+ * Extracts the value type for a specific parameter
1224
+ *
1225
+ * TODO: Re-use `BaseType`
1226
+ */
1227
+ type FieldValueType<Q extends ActionDefinition<unknown>, K extends keyof ActionParameters<Q> = keyof ActionParameters<Q>> = ActionParameters<Q>[K]["type"] extends ActionMetadata.DataType.Object<infer T> ? ActionParam.ObjectType<T> : ActionParameters<Q>[K]["type"] extends ActionMetadata.DataType.ObjectSet<infer T> ? ActionParam.ObjectSetType<T> : ActionParameters<Q>[K]["type"] extends ActionMetadata.DataType.Struct<infer T> ? ActionParam.StructType<T> : ActionParameters<Q>[K]["type"] extends keyof DataValueClientToWire ? DataValueClientToWire[ActionParameters<Q>[K]["type"]] : never;
1228
+ /**
1229
+ * Extracts the parameter type descriptor for a specific action parameter.
1230
+ */
1231
+ type FieldDescriptorType<Q extends ActionDefinition<unknown> = ActionDefinition<unknown>, K extends keyof ActionParameters<Q> = keyof ActionParameters<Q>> = ActionParameters<Q>[K]["type"];
1232
+ /**
1233
+ * Available form field component types
1234
+ */
1235
+ type FieldComponent = "DATETIME_PICKER" | "DROPDOWN" | "FILE_PICKER" | "NUMBER_INPUT" | "RADIO_BUTTONS" | "OBJECT_SET" | "TEXT_AREA" | "TEXT_INPUT" | "CUSTOM";
1236
+ /**
1237
+ * Describes the data type of a form field, independent of OSDK.
1238
+ * Mirrors ActionMetadata.DataType to keep the rendering layer OSDK-agnostic.
1239
+ */
1240
+ type FieldType = "boolean" | "string" | "integer" | "long" | "double" | "datetime" | "timestamp" | "attachment" | "marking" | "mediaReference" | "objectType" | "geoshape" | "geohash" | {
1241
+ type: "object";
1242
+ object: string;
1243
+ } | {
1244
+ type: "objectSet";
1245
+ objectSet: string;
1246
+ } | {
1247
+ type: "interface";
1248
+ interface: string;
1249
+ } | {
1250
+ type: "struct";
1251
+ struct: Record<string, string>;
1252
+ };
1253
+ /**
1254
+ * An OSDK-agnostic field definition used by BaseForm and FormFieldRenderer.
1255
+ * Contains only the information needed to render a single field — no generics,
1256
+ * no compile-time parameter constraints.
1257
+ *
1258
+ * Implemented as a distributed mapped type: switching on `fieldComponent`
1259
+ * narrows `fieldComponentProps` to the correct props type automatically.
1260
+ */
1261
+ type RendererFieldDefinition = {
1262
+ [K in FieldComponent]: {
1263
+ fieldKey: string;
1264
+ fieldComponent: K;
1265
+ fieldType?: FieldType;
1266
+ label?: string;
1267
+ defaultValue?: unknown;
1268
+ isRequired?: boolean;
1269
+ placeholder?: string;
1270
+ helperText?: string;
1271
+ helperTextPlacement?: "bottom" | "tooltip";
1272
+ fieldComponentProps?: Omit<FormFieldPropsByType[K], "value" | "onChange">;
1273
+ };
1274
+ }[FieldComponent];
1275
+ /**
1276
+ * Gets valid form field types for a given property type
1277
+ */
1278
+ type ValidFormFieldForPropertyType<P extends FieldDescriptorType> = P extends "objectSet" ? "OBJECT_SET" : P extends "object" ? "DROPDOWN" : P extends "mediaReference" | "attachment" ? "FILE_PICKER" : P extends "boolean" ? "RADIO_BUTTONS" | "DROPDOWN" : P extends "string" ? "TEXT_INPUT" | "TEXT_AREA" : P extends "datetime" | "timestamp" ? "DATETIME_PICKER" : P extends "double" | "integer" | "long" | "float" | "short" | "byte" | "decimal" ? "NUMBER_INPUT" : never;
1279
+
1280
+ /**
1281
+ * Props for the ActionForm component.
1282
+ *
1283
+ * A discriminated union ensures that controlled mode (formState provided)
1284
+ * always requires onFormStateChange, and uncontrolled mode makes `onFormStateChange` optional
1285
+ */
1286
+ type ActionFormProps<Q extends ActionDefinition<unknown>> = (ActionFormConfigProps<Q> & {
1287
+ formState: FormState<Q>;
1288
+ onFormStateChange: (updater: (prevState: FormState<Q>) => FormState<Q>) => void;
1289
+ }) | (ActionFormConfigProps<Q> & {
1290
+ formState?: undefined;
1291
+ onFormStateChange?: (updater: (prevState: FormState<Q>) => FormState<Q>) => void;
1292
+ });
1293
+ interface ActionFormConfigProps<Q extends ActionDefinition<unknown>> extends Pick<BaseFormProps, "formTitle" | "isSubmitDisabled"> {
1294
+ actionDefinition: Q;
1295
+ /**
1296
+ * If not supplied, field definitions are constructed from `ActionParameters`.
1297
+ */
1298
+ formFieldDefinitions?: ReadonlyArray<FormFieldDefinition<Q>>;
1299
+ /**
1300
+ * If supplied, this will override the default submit action
1301
+ * By default, the action's applyAction will be called
1302
+ *
1303
+ * @param formState all field values when onSubmit is called
1304
+ * @param applyAction the function to execute the action
1305
+ * @returns a promise of the submission response
1306
+ */
1307
+ onSubmit?: (formState: FormState<Q>, applyAction: (args: ActionParameters<Q>) => Promise<ActionEditResponse | undefined>) => Promise<unknown> | void;
1308
+ /**
1309
+ * Called when the validation response is returned from a validateOnly submission
1310
+ *
1311
+ * @param results the validation response
1312
+ */
1313
+ onValidationResponse?: (results: ActionValidationResponse) => void;
1314
+ /**
1315
+ * Called when the action is successfully executed from a non-validateOnly submission
1316
+ *
1317
+ * @param results the submission response
1318
+ */
1319
+ onSuccess?: (results: ActionEditResponse | undefined) => void;
1320
+ /**
1321
+ * Called when there is an error in form submission
1322
+ *
1323
+ * @param error the error that occurred
1324
+ */
1325
+ onError?: (error: FormError) => void;
1326
+ }
1327
+ /**
1328
+ * Form values mapping parameter names to their values
1329
+ */
1330
+ type FormState<Q extends ActionDefinition<unknown>> = {
1331
+ [K in FieldKey<Q>]?: FieldValueType<Q, K>;
1332
+ };
1333
+ /**
1334
+ * Form error discriminated union
1335
+ */
1336
+ type FormError = {
1337
+ type: "validation";
1338
+ error: ActionValidationError;
1339
+ } | {
1340
+ type: "submission";
1341
+ error: unknown;
1342
+ } | {
1343
+ type: "unknown";
1344
+ error: unknown;
1345
+ };
1346
+ /**
1347
+ * Props for the `BaseForm` component, which renders a form without
1348
+ * OSDK data fetching.
1349
+ *
1350
+ * Uses a discriminated union so that controlled mode (`formState` provided)
1351
+ * always requires `onFieldValueChange`, and uncontrolled mode omits both.
1352
+ * `onSubmit` receives the current form state so callers can access values
1353
+ * even in uncontrolled mode.
1354
+ */
1355
+ type BaseFormProps = BaseFormCommonProps & ({
1356
+ formState: Record<string, unknown>;
1357
+ onFieldValueChange: (fieldKey: string, value: unknown) => void;
1358
+ } | {
1359
+ formState?: undefined;
1360
+ onFieldValueChange?: (fieldKey: string, value: unknown) => void;
1361
+ });
1362
+ interface BaseFormCommonProps {
1363
+ formTitle?: string;
1364
+ fieldDefinitions: ReadonlyArray<RendererFieldDefinition>;
1365
+ onSubmit: (formState: Record<string, unknown>) => void;
1366
+ isSubmitDisabled?: boolean;
1367
+ isPending?: boolean;
1368
+ isLoading?: boolean;
1369
+ className?: string;
1370
+ }
1371
+
1372
+ declare const ActionForm: <Q extends ActionDefinition<unknown>>(props: ActionFormProps<Q>) => React__default.ReactElement;
1373
+
1374
+ declare const BaseForm: React__default.FC<BaseFormProps>;
1375
+
1376
+ export { ActionForm, type ActionFormProps, type ActionParameters, type AnnotationType, BaseFilterList, type BaseFilterListProps, BaseForm, type BaseFormFieldProps, type BaseFormProps, BasePdfViewer, BaseTable, type BaseTableProps, type CellEditInfo, ColumnConfigDialog, type ColumnConfigDialogProps, type ColumnConfigOptions, type ColumnDefinition, type ColumnDefinitionLocator, type CustomColumnLocator, type CustomFieldProps, type DatetimePickerFieldProps, type DropdownFieldProps, type FieldComponent, type FieldValueType, type FilePickerProps, type FilterComponentType, type FilterDefinitionUnion, FilterList, type FilterListItemProps, type FilterListProps, type FilterState, type FormError, type FormFieldDefinition, type FormFieldPropsByType, type FormState, type FunctionColumnLocator, type NumberInputFieldProps, type ObjectSetFieldProps, ObjectTable, type ObjectTableProps, type Option, type PdfAnnotation, PdfRenderer, type PdfRendererProps, type PdfViewerProps, type PropertyColumnLocator, type PropertyFilterDefinition, type RadioButtonsFieldProps, type RdpColumnLocator, type RenderFilterInput, type RendererFieldDefinition, type TextAreaFieldProps, type TextInputFieldProps, deserializeFilterStates, serializeFilterStates };
@@ -1 +1 @@
1
- {"version":3,"file":"ActionFormApi.js","names":[],"sources":["ActionFormApi.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 ActionEditResponse,\n ActionValidationResponse,\n} from \"@osdk/api\";\nimport type { ActionValidationError } from \"@osdk/client\";\nimport type {\n ActionParameters,\n FieldKey,\n FieldValueType,\n FormFieldDefinition,\n RendererFieldDefinition,\n} from \"./FormFieldApi.js\";\n\n/**\n * Props for the ActionForm component.\n *\n * A discriminated union ensures that controlled mode (formState provided)\n * always requires onFormStateChange, and uncontrolled mode makes `onFormStateChange` optional\n */\nexport type ActionFormProps<Q extends ActionDefinition<unknown>> =\n | (ActionFormConfigProps<Q> & {\n formState: FormState<Q>;\n onFormStateChange: (\n updater: (prevState: FormState<Q>) => FormState<Q>,\n ) => void;\n })\n | (ActionFormConfigProps<Q> & {\n formState?: undefined;\n onFormStateChange?: (\n updater: (prevState: FormState<Q>) => FormState<Q>,\n ) => void;\n });\n\ninterface ActionFormConfigProps<Q extends ActionDefinition<unknown>>\n extends Pick<BaseFormProps, \"formTitle\" | \"isSubmitDisabled\">\n{\n actionDefinition: Q;\n\n /**\n * If not supplied, field definitions are constructed from `ActionParameters`.\n */\n formFieldDefinitions?: ReadonlyArray<FormFieldDefinition<Q>>;\n\n /**\n * If supplied, this will override the default submit action\n * By default, the action's applyAction will be called\n *\n * @param formState all field values when onSubmit is called\n * @param applyAction the function to execute the action\n * @returns a promise of the submission response\n */\n onSubmit?: (\n formState: FormState<Q>,\n applyAction: (\n args: ActionParameters<Q>,\n ) => Promise<ActionEditResponse | undefined>,\n ) => Promise<unknown> | void;\n\n /**\n * Called when the validation response is returned from a validateOnly submission\n *\n * @param results the validation response\n */\n onValidationResponse?: (results: ActionValidationResponse) => void;\n\n /**\n * Called when the action is successfully executed from a non-validateOnly submission\n *\n * @param results the submission response\n */\n onSuccess?: (results: ActionEditResponse | undefined) => void;\n\n /**\n * Called when there is an error in form submission\n *\n * @param error the error that occurred\n */\n onError?: (error: FormError) => void;\n}\n\n/**\n * Form values mapping parameter names to their values\n */\nexport type FormState<Q extends ActionDefinition<unknown>> = {\n [K in FieldKey<Q>]?: FieldValueType<Q, K>;\n};\n\n/**\n * Form error discriminated union\n */\nexport type FormError =\n | { type: \"validation\"; error: ActionValidationError }\n | { type: \"submission\"; error: unknown }\n | { type: \"unknown\"; error: unknown };\n\n/**\n * Props for the `BaseForm` component, which renders a form without\n * OSDK data fetching.\n *\n * Uses a discriminated union so that controlled mode (`formState` provided)\n * always requires `onFieldValueChange`, and uncontrolled mode omits both.\n * `onSubmit` receives the current form state so callers can access values\n * even in uncontrolled mode.\n */\nexport type BaseFormProps =\n & BaseFormCommonProps\n & (\n | {\n formState: Record<string, unknown>;\n onFieldValueChange: (fieldKey: string, value: unknown) => void;\n }\n | {\n formState?: undefined;\n onFieldValueChange?: (fieldKey: string, value: unknown) => void;\n }\n );\n\ninterface BaseFormCommonProps {\n formTitle?: string;\n fieldDefinitions: ReadonlyArray<RendererFieldDefinition>;\n onSubmit: (formState: Record<string, unknown>) => void;\n isSubmitDisabled?: boolean;\n isPending?: boolean;\n isLoading?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"ActionFormApi.js","names":[],"sources":["ActionFormApi.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 ActionEditResponse,\n ActionValidationResponse,\n} from \"@osdk/api\";\nimport type { ActionValidationError } from \"@osdk/client\";\nimport type {\n ActionParameters,\n FieldKey,\n FieldValueType,\n FormFieldDefinition,\n RendererFieldDefinition,\n} from \"./FormFieldApi.js\";\n\n/**\n * Props for the ActionForm component.\n *\n * A discriminated union ensures that controlled mode (formState provided)\n * always requires onFormStateChange, and uncontrolled mode makes `onFormStateChange` optional\n */\nexport type ActionFormProps<Q extends ActionDefinition<unknown>> =\n | (ActionFormConfigProps<Q> & {\n formState: FormState<Q>;\n onFormStateChange: (\n updater: (prevState: FormState<Q>) => FormState<Q>,\n ) => void;\n })\n | (ActionFormConfigProps<Q> & {\n formState?: undefined;\n onFormStateChange?: (\n updater: (prevState: FormState<Q>) => FormState<Q>,\n ) => void;\n });\n\ninterface ActionFormConfigProps<Q extends ActionDefinition<unknown>>\n extends Pick<BaseFormProps, \"formTitle\" | \"isSubmitDisabled\">\n{\n actionDefinition: Q;\n\n /**\n * If not supplied, field definitions are constructed from `ActionParameters`.\n */\n formFieldDefinitions?: ReadonlyArray<FormFieldDefinition<Q>>;\n\n /**\n * If supplied, this will override the default submit action\n * By default, the action's applyAction will be called\n *\n * @param formState all field values when onSubmit is called\n * @param applyAction the function to execute the action\n * @returns a promise of the submission response\n */\n onSubmit?: (\n formState: FormState<Q>,\n applyAction: (\n args: ActionParameters<Q>,\n ) => Promise<ActionEditResponse | undefined>,\n ) => Promise<unknown> | void;\n\n /**\n * Called when the validation response is returned from a validateOnly submission\n *\n * @param results the validation response\n */\n onValidationResponse?: (results: ActionValidationResponse) => void;\n\n /**\n * Called when the action is successfully executed from a non-validateOnly submission\n *\n * @param results the submission response\n */\n onSuccess?: (results: ActionEditResponse | undefined) => void;\n\n /**\n * Called when there is an error in form submission\n *\n * @param error the error that occurred\n */\n onError?: (error: FormError) => void;\n}\n\n/**\n * Form values mapping parameter names to their values\n */\nexport type FormState<Q extends ActionDefinition<unknown>> = {\n [K in FieldKey<Q>]?: FieldValueType<Q, K>;\n};\n\n/**\n * Form error discriminated union\n */\nexport type FormError =\n | { type: \"validation\"; error: ActionValidationError }\n | { type: \"submission\"; error: unknown }\n | { type: \"unknown\"; error: unknown };\n\n/**\n * Props for the `BaseForm` component, which renders a form without\n * OSDK data fetching.\n *\n * Uses a discriminated union so that controlled mode (`formState` provided)\n * always requires `onFieldValueChange`, and uncontrolled mode omits both.\n * `onSubmit` receives the current form state so callers can access values\n * even in uncontrolled mode.\n */\nexport type BaseFormProps =\n & BaseFormCommonProps\n & (\n | {\n formState: Record<string, unknown>;\n onFieldValueChange: (fieldKey: string, value: unknown) => void;\n }\n | {\n formState?: undefined;\n onFieldValueChange?: (fieldKey: string, value: unknown) => void;\n }\n );\n\ninterface BaseFormCommonProps {\n formTitle?: string;\n fieldDefinitions: ReadonlyArray<RendererFieldDefinition>;\n onSubmit: (formState: Record<string, unknown>) => void;\n isSubmitDisabled?: boolean;\n isPending?: boolean;\n isLoading?: boolean;\n className?: string;\n}\n"],"mappings":"","ignoreList":[]}
@@ -14,9 +14,13 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ import classNames from "classnames";
17
18
  import React, { memo, useCallback, useMemo } from "react";
18
19
  import { useForm } from "react-hook-form";
20
+ import { ActionButton } from "../base-components/action-button/ActionButton.js";
21
+ import styles from "./BaseForm.module.css";
19
22
  import { FieldBridge } from "./fields/FieldBridge.js";
23
+ import { FormHeader } from "./FormHeader.js";
20
24
  export const BaseForm = /*#__PURE__*/memo(function ({
21
25
  formTitle,
22
26
  fieldDefinitions,
@@ -25,7 +29,8 @@ export const BaseForm = /*#__PURE__*/memo(function ({
25
29
  onSubmit,
26
30
  isSubmitDisabled = false,
27
31
  isPending = false,
28
- isLoading = false
32
+ isLoading = false,
33
+ className
29
34
  }) {
30
35
  const defaultValues = useMemo(() => buildDefaultValues(fieldDefinitions), [fieldDefinitions]);
31
36
  const {
@@ -47,18 +52,26 @@ export const BaseForm = /*#__PURE__*/memo(function ({
47
52
  onSubmit(controlledFormState ?? rhfValues);
48
53
  }, [onSubmit, controlledFormState]);
49
54
  return /*#__PURE__*/React.createElement("form", {
55
+ className: classNames(styles.osdkForm, className),
50
56
  onSubmit: rhfHandleSubmit(onFormSubmit)
51
- }, formTitle != null && /*#__PURE__*/React.createElement("h2", null, formTitle), isLoading && fieldDefinitions.length === 0 && /*#__PURE__*/React.createElement("div", {
57
+ }, formTitle != null && /*#__PURE__*/React.createElement(FormHeader, {
58
+ title: formTitle
59
+ }), isLoading && fieldDefinitions.length === 0 && /*#__PURE__*/React.createElement("div", {
52
60
  role: "status"
53
- }, "Loading form fields..."), fieldDefinitions.map(fieldDef => /*#__PURE__*/React.createElement(FieldBridge, {
61
+ }, "Loading form fields..."), /*#__PURE__*/React.createElement("div", {
62
+ className: styles.osdkFormFields
63
+ }, fieldDefinitions.map(fieldDef => /*#__PURE__*/React.createElement(FieldBridge, {
54
64
  key: fieldDef.fieldKey,
55
65
  fieldDef: fieldDef,
56
66
  control: control,
57
67
  onExternalChange: onFieldValueChange
58
- })), /*#__PURE__*/React.createElement("button", {
68
+ }))), /*#__PURE__*/React.createElement("div", {
69
+ className: styles.osdkFormFooter
70
+ }, /*#__PURE__*/React.createElement(ActionButton, {
59
71
  type: "submit",
72
+ variant: "primary",
60
73
  disabled: isSubmitDisabled || isPending
61
- }, isPending ? "Submitting..." : "Submit"));
74
+ }, isPending ? "Submitting" : "Submit")));
62
75
  });
63
76
  function buildDefaultValues(fieldDefinitions) {
64
77
  const values = {};
@@ -1 +1 @@
1
- {"version":3,"file":"BaseForm.js","names":["React","memo","useCallback","useMemo","useForm","FieldBridge","BaseForm","formTitle","fieldDefinitions","formState","controlledFormState","onFieldValueChange","onSubmit","isSubmitDisabled","isPending","isLoading","defaultValues","buildDefaultValues","control","handleSubmit","rhfHandleSubmit","values","onFormSubmit","rhfValues","createElement","length","role","map","fieldDef","key","fieldKey","onExternalChange","type","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 React, { memo, useCallback, useMemo } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport type { BaseFormProps } from \"./ActionFormApi.js\";\nimport { FieldBridge } from \"./fields/FieldBridge.js\";\nimport type { RendererFieldDefinition } from \"./FormFieldApi.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}: 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 onSubmit={rhfHandleSubmit(onFormSubmit)}>\n {formTitle != null && <h2>{formTitle}</h2>}\n {isLoading && fieldDefinitions.length === 0 && (\n <div role=\"status\">Loading form fields...</div>\n )}\n {fieldDefinitions.map((fieldDef) => (\n <FieldBridge\n key={fieldDef.fieldKey}\n fieldDef={fieldDef}\n control={control}\n onExternalChange={onFieldValueChange}\n />\n ))}\n <button\n type=\"submit\"\n disabled={isSubmitDisabled || isPending}\n >\n {isPending ? \"Submitting...\" : \"Submit\"}\n </button>\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,KAAK,IAAIC,IAAI,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACzD,SAASC,OAAO,QAAQ,iBAAiB;AAEzC,SAASC,WAAW,QAAQ,yBAAyB;AAGrD,OAAO,MAAMC,QAAiC,gBAAGL,IAAI,CAAC,UAAoB;EACxEM,SAAS;EACTC,gBAAgB;EAChBC,SAAS,EAAEC,mBAAmB;EAC9BC,kBAAkB;EAClBC,QAAQ;EACRC,gBAAgB,GAAG,KAAK;EACxBC,SAAS,GAAG,KAAK;EACjBC,SAAS,GAAG;AACC,CAAC,EAAsB;EAGpC,MAAMC,aAAa,GAAGb,OAAO,CAC3B,MAAMc,kBAAkB,CAACT,gBAAgB,CAAC,EAC1C,CAACA,gBAAgB,CACnB,CAAC;EAED,MAAM;IAAEU,OAAO;IAAEC,YAAY,EAAEC;EAAgB,CAAC,GAAGhB,OAAO,CAExD;IACA,IAVmBM,mBAAmB,IAAI,IAAI,GAU3B;MAAEW,MAAM,EAAEX;IAAoB,CAAC,GAAG;MAAEM;IAAc,CAAC;EACxE,CAAC,CAAC;EAEF,MAAMM,YAAY,GAAGpB,WAAW,CAC7BqB,SAAkC,IAAK;IACtC;IACA;IACA;IACA;IACA;IACAX,QAAQ,CAACF,mBAAmB,IAAIa,SAAS,CAAC;EAC5C,CAAC,EACD,CAACX,QAAQ,EAAEF,mBAAmB,CAChC,CAAC;EAED,oBACEV,KAAA,CAAAwB,aAAA;IAAMZ,QAAQ,EAAEQ,eAAe,CAACE,YAAY;EAAE,GAC3Cf,SAAS,IAAI,IAAI,iBAAIP,KAAA,CAAAwB,aAAA,aAAKjB,SAAc,CAAC,EACzCQ,SAAS,IAAIP,gBAAgB,CAACiB,MAAM,KAAK,CAAC,iBACzCzB,KAAA,CAAAwB,aAAA;IAAKE,IAAI,EAAC;EAAQ,GAAC,wBAA2B,CAC/C,EACAlB,gBAAgB,CAACmB,GAAG,CAAEC,QAAQ,iBAC7B5B,KAAA,CAAAwB,aAAA,CAACnB,WAAW;IACVwB,GAAG,EAAED,QAAQ,CAACE,QAAS;IACvBF,QAAQ,EAAEA,QAAS;IACnBV,OAAO,EAAEA,OAAQ;IACjBa,gBAAgB,EAAEpB;EAAmB,CACtC,CACF,CAAC,eACFX,KAAA,CAAAwB,aAAA;IACEQ,IAAI,EAAC,QAAQ;IACbC,QAAQ,EAAEpB,gBAAgB,IAAIC;EAAU,GAEvCA,SAAS,GAAG,eAAe,GAAG,QACzB,CACJ,CAAC;AAEX,CAAC,CAAC;AAEF,SAASG,kBAAkBA,CACzBT,gBAAwD,EAC/B;EACzB,MAAMa,MAA+B,GAAG,CAAC,CAAC;EAC1C,KAAK,MAAMa,GAAG,IAAI1B,gBAAgB,EAAE;IAClCa,MAAM,CAACa,GAAG,CAACJ,QAAQ,CAAC,GAAGI,GAAG,CAACC,YAAY;EACzC;EACA,OAAOd,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","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,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;EAC5C,CAAC,EACD,CAACZ,QAAQ,EAAEF,mBAAmB,CAChC,CAAC;EAED,oBACEb,KAAA,CAAA4B,aAAA;IACET,SAAS,EAAEpB,UAAU,CAACO,MAAM,CAACuB,QAAQ,EAAEV,SAAS,CAAE;IAClDJ,QAAQ,EAAES,eAAe,CAACE,YAAY;EAAE,GAEvChB,SAAS,IAAI,IAAI,iBAAIV,KAAA,CAAA4B,aAAA,CAACpB,UAAU;IAACsB,KAAK,EAAEpB;EAAU,CAAE,CAAC,EACrDQ,SAAS,IAAIP,gBAAgB,CAACoB,MAAM,KAAK,CAAC,iBACzC/B,KAAA,CAAA4B,aAAA;IAAKI,IAAI,EAAC;EAAQ,GAAC,wBAA2B,CAC/C,eACDhC,KAAA,CAAA4B,aAAA;IAAKT,SAAS,EAAEb,MAAM,CAAC2B;EAAe,GACnCtB,gBAAgB,CAACuB,GAAG,CAAEC,QAAQ,iBAC7BnC,KAAA,CAAA4B,aAAA,CAACrB,WAAW;IACV6B,GAAG,EAAED,QAAQ,CAACE,QAAS;IACvBF,QAAQ,EAAEA,QAAS;IACnBb,OAAO,EAAEA,OAAQ;IACjBgB,gBAAgB,EAAExB;EAAmB,CACtC,CACF,CACE,CAAC,eACNd,KAAA,CAAA4B,aAAA;IAAKT,SAAS,EAAEb,MAAM,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":[]}
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Copyright 2025 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
+ .osdkForm {
18
+ display: flex;
19
+ flex-direction: column;
20
+ width: 100%;
21
+ }
22
+
23
+ .osdkFormFields {
24
+ display: flex;
25
+ flex-direction: column;
26
+ gap: var(--osdk-form-field-gap);
27
+ padding: var(--osdk-form-content-padding);
28
+ }
29
+
30
+ .osdkFormFooter {
31
+ display: flex;
32
+ flex-direction: row;
33
+ justify-content: flex-end;
34
+ border-top: var(--osdk-surface-border-width) solid
35
+ var(--osdk-form-footer-border-color);
36
+ padding-block: var(--osdk-form-content-padding);
37
+ padding-inline: var(--osdk-form-content-padding);
38
+ }
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import React, { memo } from "react";
18
+ import styles from "./FormField.module.css";
19
+ export const FormField = /*#__PURE__*/memo(function ({
20
+ fieldKey,
21
+ label,
22
+ isRequired,
23
+ helperText,
24
+ error,
25
+ children
26
+ }) {
27
+ return /*#__PURE__*/React.createElement("div", {
28
+ className: styles.osdkFormField
29
+ }, label != null && /*#__PURE__*/React.createElement("label", {
30
+ className: styles.osdkFormFieldLabel,
31
+ htmlFor: fieldKey
32
+ }, label, isRequired === true && /*#__PURE__*/React.createElement("span", {
33
+ className: styles.osdkFormFieldRequired,
34
+ "aria-label": "required"
35
+ }, " ", "*")), children, error != null && /*#__PURE__*/React.createElement("div", {
36
+ className: styles.osdkFormFieldError,
37
+ role: "alert"
38
+ }, error), helperText != null && /*#__PURE__*/React.createElement("div", {
39
+ className: styles.osdkFormFieldHelperText
40
+ }, helperText));
41
+ });
42
+ //# sourceMappingURL=FormField.js.map