@osdk/react-components 0.57.0 → 0.57.1-ading-window-9d7d68c38a079178b6cb5333855d9a35c5563004
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.
- package/CHANGELOG.md +13 -0
- package/build/browser/action-form/FormFieldApi.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/cjs/{action-form-4OvVNZ6i.d.cts → action-form-BVxkzJBM.d.cts} +19 -4
- package/build/cjs/{chunk-UUFLIPNK.cjs → chunk-2HDZMYVX.cjs} +4 -4
- package/build/cjs/{chunk-UUFLIPNK.cjs.map → chunk-2HDZMYVX.cjs.map} +1 -1
- package/build/cjs/chunk-5AILJ7IY.cjs +11 -0
- package/build/cjs/{chunk-LBNNFF3S.cjs.map → chunk-5AILJ7IY.cjs.map} +1 -1
- package/build/cjs/chunk-5C5CO6IV.cjs +11 -0
- package/build/cjs/{chunk-ULPBZR2D.cjs.map → chunk-5C5CO6IV.cjs.map} +1 -1
- package/build/cjs/chunk-5NO5YIOO.cjs +12 -0
- package/build/cjs/{chunk-AFUUE7G6.cjs.map → chunk-5NO5YIOO.cjs.map} +1 -1
- package/build/cjs/chunk-A7UO4QTE.cjs +11 -0
- package/build/cjs/{chunk-GBYCW42X.cjs.map → chunk-A7UO4QTE.cjs.map} +1 -1
- package/build/cjs/chunk-BE5DFM7I.cjs +11 -0
- package/build/cjs/{chunk-IIEPBUXO.cjs.map → chunk-BE5DFM7I.cjs.map} +1 -1
- package/build/cjs/{chunk-6ITSZSOU.cjs → chunk-D6KESFUY.cjs} +4 -4
- package/build/cjs/{chunk-6ITSZSOU.cjs.map → chunk-D6KESFUY.cjs.map} +1 -1
- package/build/cjs/{chunk-DZZ3OFOS.cjs → chunk-ENIWQAQR.cjs} +4 -4
- package/build/cjs/{chunk-DZZ3OFOS.cjs.map → chunk-ENIWQAQR.cjs.map} +1 -1
- package/build/cjs/{chunk-N7TLEX4B.cjs → chunk-FU2IO5E4.cjs} +4 -4
- package/build/cjs/{chunk-N7TLEX4B.cjs.map → chunk-FU2IO5E4.cjs.map} +1 -1
- package/build/cjs/chunk-GU4FV6A2.cjs +11 -0
- package/build/cjs/{chunk-VMK3VHM2.cjs.map → chunk-GU4FV6A2.cjs.map} +1 -1
- package/build/cjs/{chunk-5R7ABK77.cjs → chunk-GU7H4QMQ.cjs} +4 -4
- package/build/cjs/{chunk-5R7ABK77.cjs.map → chunk-GU7H4QMQ.cjs.map} +1 -1
- package/build/cjs/chunk-HTJIZ7N4.cjs +48 -0
- package/build/cjs/{chunk-JYVWTCYD.cjs.map → chunk-HTJIZ7N4.cjs.map} +1 -1
- package/build/cjs/{chunk-YU43XRV5.cjs → chunk-JGQLOSLE.cjs} +4 -4
- package/build/cjs/{chunk-YU43XRV5.cjs.map → chunk-JGQLOSLE.cjs.map} +1 -1
- package/build/cjs/{chunk-GCNFNJ3H.cjs → chunk-MCECIYFC.cjs} +8 -8
- package/build/cjs/{chunk-GCNFNJ3H.cjs.map → chunk-MCECIYFC.cjs.map} +1 -1
- package/build/cjs/chunk-MWHWBGAU.cjs +12 -0
- package/build/cjs/{chunk-EYJX267D.cjs.map → chunk-MWHWBGAU.cjs.map} +1 -1
- package/build/cjs/{chunk-QHOLN7FM.cjs → chunk-PIXC5VKL.cjs} +4 -4
- package/build/cjs/{chunk-QHOLN7FM.cjs.map → chunk-PIXC5VKL.cjs.map} +1 -1
- package/build/cjs/{chunk-UITQPGV6.cjs → chunk-RST4CZUX.cjs} +3 -3
- package/build/cjs/chunk-RST4CZUX.cjs.map +1 -0
- package/build/cjs/{chunk-IU7D74NJ.cjs → chunk-SERFWIY7.cjs} +4 -4
- package/build/cjs/{chunk-IU7D74NJ.cjs.map → chunk-SERFWIY7.cjs.map} +1 -1
- package/build/cjs/{chunk-AJJEUYFU.cjs → chunk-TGGBI3QG.cjs} +5 -5
- package/build/cjs/{chunk-AJJEUYFU.cjs.map → chunk-TGGBI3QG.cjs.map} +1 -1
- package/build/cjs/chunk-THQL6U45.cjs +11 -0
- package/build/cjs/{chunk-BDIYRBYG.cjs.map → chunk-THQL6U45.cjs.map} +1 -1
- package/build/cjs/{chunk-7U7ICK2U.cjs → chunk-TO6DFGMK.cjs} +4 -4
- package/build/cjs/{chunk-7U7ICK2U.cjs.map → chunk-TO6DFGMK.cjs.map} +1 -1
- package/build/cjs/{chunk-RO2TS7FZ.cjs → chunk-UDM4SY46.cjs} +5 -5
- package/build/cjs/{chunk-RO2TS7FZ.cjs.map → chunk-UDM4SY46.cjs.map} +1 -1
- package/build/cjs/{chunk-TTFGBGL6.cjs → chunk-VK5YJ66F.cjs} +4 -4
- package/build/cjs/{chunk-TTFGBGL6.cjs.map → chunk-VK5YJ66F.cjs.map} +1 -1
- package/build/cjs/chunk-VLNLHGQW.cjs +34 -0
- package/build/cjs/{chunk-PSRGZXBB.cjs.map → chunk-VLNLHGQW.cjs.map} +1 -1
- package/build/cjs/{chunk-DK7LMMSR.cjs → chunk-VRHBAKNC.cjs} +4 -4
- package/build/cjs/{chunk-DK7LMMSR.cjs.map → chunk-VRHBAKNC.cjs.map} +1 -1
- package/build/cjs/{chunk-KFDBR74X.cjs → chunk-Y6VIQT72.cjs} +4 -4
- package/build/cjs/{chunk-KFDBR74X.cjs.map → chunk-Y6VIQT72.cjs.map} +1 -1
- package/build/cjs/public/action-form.cjs +4 -4
- package/build/cjs/public/action-form.d.cts +1 -1
- package/build/cjs/public/document-viewer.cjs +4 -4
- package/build/cjs/public/email-viewer.cjs +3 -3
- package/build/cjs/public/experimental/action-form.cjs +5 -5
- package/build/cjs/public/experimental/action-form.d.cts +1 -1
- package/build/cjs/public/experimental/cbac-picker.cjs +11 -11
- package/build/cjs/public/experimental/document-viewer.cjs +5 -5
- package/build/cjs/public/experimental/email-viewer.cjs +5 -5
- package/build/cjs/public/experimental/filter-list.cjs +16 -16
- package/build/cjs/public/experimental/image-viewer.cjs +5 -5
- package/build/cjs/public/experimental/markdown-renderer.cjs +7 -7
- package/build/cjs/public/experimental/object-table.cjs +23 -23
- package/build/cjs/public/experimental/pdf-viewer.cjs +25 -25
- package/build/cjs/public/experimental/spreadsheet-viewer.cjs +5 -5
- package/build/cjs/public/experimental/tiff-renderer.cjs +7 -7
- package/build/cjs/public/experimental/video-viewer.cjs +5 -5
- package/build/cjs/public/experimental/xml-viewer.cjs +5 -5
- package/build/cjs/public/experimental.cjs +112 -112
- package/build/cjs/public/experimental.d.cts +1 -1
- package/build/cjs/public/filter-list.cjs +15 -15
- package/build/cjs/public/image-viewer.cjs +3 -3
- package/build/cjs/public/markdown-viewer.cjs +3 -3
- package/build/cjs/public/object-table.cjs +22 -22
- package/build/cjs/public/pdf-viewer.cjs +7 -7
- package/build/cjs/public/spreadsheet-viewer.cjs +3 -3
- package/build/cjs/public/tiff-viewer.cjs +3 -3
- package/build/cjs/public/video-viewer.cjs +3 -3
- package/build/cjs/public/xml-viewer.cjs +3 -3
- package/build/esm/action-form/FormFieldApi.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/types/action-form/FormFieldApi.d.ts +21 -4
- package/build/types/action-form/FormFieldApi.d.ts.map +1 -1
- package/package.json +9 -9
- package/build/cjs/chunk-AFUUE7G6.cjs +0 -12
- package/build/cjs/chunk-BDIYRBYG.cjs +0 -11
- package/build/cjs/chunk-EYJX267D.cjs +0 -12
- package/build/cjs/chunk-GBYCW42X.cjs +0 -11
- package/build/cjs/chunk-IIEPBUXO.cjs +0 -11
- package/build/cjs/chunk-JYVWTCYD.cjs +0 -48
- package/build/cjs/chunk-LBNNFF3S.cjs +0 -11
- package/build/cjs/chunk-PSRGZXBB.cjs +0 -34
- package/build/cjs/chunk-UITQPGV6.cjs.map +0 -1
- package/build/cjs/chunk-ULPBZR2D.cjs +0 -11
- package/build/cjs/chunk-VMK3VHM2.cjs +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @osdk/react-components
|
|
2
2
|
|
|
3
|
+
## 0.57.1-ading-window-9d7d68c38a079178b6cb5333855d9a35c5563004
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 488376f: Configure the CI JUnit reporter in each package's vitest config instead of passing it as a turbo `--` argument. Turbo folds passthrough arguments into its global hash, so passing them there made every task in a `turbo run test` invocation a cache miss rather than only the `test` tasks. Test configuration only; no runtime or API changes.
|
|
8
|
+
- 0053052: Preserve scalar action parameter types and align action form submission callback types with form state.
|
|
9
|
+
- Updated dependencies [92b158d]
|
|
10
|
+
- Updated dependencies [488376f]
|
|
11
|
+
- @osdk/client@2.66.1-ading-window-9d7d68c38a079178b6cb5333855d9a35c5563004
|
|
12
|
+
- @osdk/aip-core@0.10.1-ading-window-9d7d68c38a079178b6cb5333855d9a35c5563004
|
|
13
|
+
- @osdk/api@2.66.1-ading-window-9d7d68c38a079178b6cb5333855d9a35c5563004
|
|
14
|
+
- @osdk/react@2.66.1-ading-window-9d7d68c38a079178b6cb5333855d9a35c5563004
|
|
15
|
+
|
|
3
16
|
## 0.57.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldApi.js","names":[],"sources":["FormFieldApi.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n ActionParam,\n CompileTimeMetadata,\n DataValueClientToWire,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n} from \"@osdk/api\";\nimport type React from \"react\";\n\nimport type {\n DatePickerProps,\n DateRangePickerProps,\n} from \"../shared/calendar/index.js\";\nimport type { PortalContainer } from \"../shared/PortalDismissLayer.js\";\n\nexport type { PortalContainer };\n\n/**\n * A form field definition specifies configuration for a single field.\n * Implemented as a distributed mapped type so `fieldComponent` narrows\n * `fieldComponentProps` to the matching component prop type.\n */\nexport type FormFieldDefinition<\n Q extends ActionDefinition<unknown>,\n K extends FieldKey<Q> = FieldKey<Q>,\n> = K extends unknown\n ? {\n // Distribute over each field key so a field's key, value type, and allowed\n // components stay correlated when K is the default union of all keys.\n [C in ValidFormFieldForPropertyType<FieldDescriptorType<Q, K>>]: {\n /**\n * The field's unique key\n */\n fieldKey: K;\n\n /**\n * Display label for the field\n */\n label: string;\n\n /**\n * Default value of the field\n */\n defaultValue?: FieldValueType<Q, K>;\n\n /**\n * 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 * Accepts plain text or rich content (e.g. JSX with links or formatting).\n * Rendered as a tooltip icon next to the label by default, or below the\n * label when helperTextPlacement is \"bottom\".\n */\n helperText?: React.ReactNode;\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 disabled?: boolean;\n\n /**\n * A callback to customize error messages when a built-in validation rule fails.\n * Receives a discriminated union with the constraint data (e.g., the min value\n * that was exceeded) so the message can reference the threshold.\n *\n * Return a string to override the default message, or `undefined` to keep it.\n */\n onValidationError?: (error: ValidationError) => string | undefined;\n\n /**\n * Additional function to validate the field.\n *\n * Return `undefined` if valid, or an error message string if invalid.\n */\n validate?: (value: FieldValueType<Q, K>) => Promise<string | undefined>;\n\n /**\n * The form field component type to render\n */\n fieldComponent: C;\n\n /**\n * The component props for the form field.\n * Excludes runtime props (value, onChange) which are managed by ActionForm.\n */\n fieldComponentProps: DistributiveOmit<\n FormFieldPropsByType[C],\n FormManagedProps<C>\n >;\n };\n }[ValidFormFieldForPropertyType<FieldDescriptorType<Q, K>>]\n : never;\n\n/**\n * A discriminated union describing which validation rule failed and the\n * constraint data the user needs to build a meaningful error message.\n */\nexport type ValidationError =\n | { type: \"required\" }\n | { type: \"min\"; min: number | Date }\n | { type: \"max\"; max: number | Date }\n | { type: \"minLength\"; minLength: number }\n | { type: \"maxLength\"; maxLength: number }\n | { type: \"maxSize\"; maxSize: number }\n | { type: \"validate\"; message: string };\n\n/**\n * Maps field types to their corresponding props\n */\nexport interface FormFieldPropsByType {\n DATE_RANGE_INPUT: DateRangePickerProps;\n DATETIME_PICKER: DatePickerProps;\n DROPDOWN: DropdownFieldProps<unknown, boolean>;\n FILE_PICKER: FilePickerProps;\n NUMBER_INPUT: NumberInputFieldProps;\n OBJECT_SELECT: ObjectSelectFieldProps<ObjectTypeDefinition>;\n OBJECT_SET: ObjectSetFieldProps<ObjectTypeDefinition>;\n RADIO_BUTTONS: RadioButtonsFieldProps<unknown>;\n SWITCH: SwitchFieldProps;\n TEXT_AREA: TextAreaFieldProps;\n TEXT_INPUT: TextInputFieldProps;\n CUSTOM: CustomFieldProps<unknown>;\n UNSUPPORTED: UnsupportedFieldProps;\n}\n\n/**\n * Dropdown field props with selectable items\n */\nexport interface DropdownFieldProps<\n V,\n Multiple extends boolean = false,\n> extends BaseFormFieldProps<Multiple extends true ? V[] : V> {\n /**\n * Available items for the dropdown\n */\n items: V[];\n\n /**\n * Converts an item to searchable text and the default visual label. Defaults to `String()`.\n * Use `renderItemLabel` when the visible label needs rich React content.\n */\n itemToStringLabel?: (item: V) => string;\n\n /**\n * Renders an item label with custom React content.\n * `itemToStringLabel` is still used for search, accessibility, and fallback keys.\n */\n renderItemLabel?: (item: V) => React.ReactNode;\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 /**\n * Ref forwarded to the portal container element.\n * Used to track portaled content for click-outside detection.\n */\n portalRef?: React.Ref<HTMLDivElement>;\n\n /**\n * Element that receives the dropdown portal. Use this when rendering inside\n * modal dialogs so popups stay in the dialog's stacking and focus context\n * instead of being appended directly to document.body.\n */\n portalContainer?: PortalContainer;\n\n /**\n * Controlled search input value. Must be provided together with `onQueryChange`.\n */\n query?: string;\n\n /**\n * Callback when the search input value changes.\n * Can be used standalone as an event listener or together with `query`\n * for fully controlled search state.\n */\n onQueryChange?: (query: string) => void;\n\n /**\n * When true, disables the combobox's built-in client-side filtering.\n * Use when items are already filtered server-side (e.g. via `onQueryChange`).\n *\n * @default false\n */\n disableClientSideFiltering?: boolean;\n\n /**\n * Status message rendered below the search input and above the item list\n * inside the popup. Use for loading/error/empty messages.\n */\n popupStatus?: React.ReactNode;\n\n /**\n * A React node to render after the item list.\n * Use for infinite scroll sentinels, \"load more\" buttons, etc.\n */\n trailingItem?: React.ReactNode;\n\n /**\n * Whether the dropdown locks page scroll and renders a full-viewport\n * dismiss layer when open. Set to `false` when the dropdown is not\n * inside a `<label>` to allow normal page scrolling.\n *\n * @default true\n */\n modal?: boolean;\n}\n\nexport interface FilePickerProps extends BaseFormFieldProps<File | File[]> {\n /**\n * Whether multiple files can be selected\n */\n isMulti?: boolean;\n\n /**\n * Accepted file types (e.g., \"image/*\", \".pdf\")\n */\n accept?: string | string[];\n\n /**\n * Maximum file size in bytes\n */\n maxSize?: number;\n\n /**\n * The text displayed when no file is selected.\n *\n * @default \"No file chosen\"\n */\n text?: string;\n\n /**\n * The text displayed on the browse button.\n *\n * @default \"Browse\"\n */\n buttonText?: string;\n}\n\n/**\n * Text area field props\n */\nexport interface TextAreaFieldProps\n 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 placeholder?: string;\n}\n\nexport interface TextInputFieldProps\n 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 placeholder?: string;\n}\n\n/**\n * Number input field props\n */\nexport interface NumberInputFieldProps extends BaseFormFieldProps<number> {\n /**\n * Minimum allowed value.\n */\n min?: number;\n\n /**\n * Maximum allowed value.\n */\n max?: number;\n\n /**\n * Step increment for the input. Used by the stepper buttons and ArrowUp/ArrowDown keyboard stepping.\n *\n * @default 1\n */\n step?: number;\n\n /**\n * Placeholder text shown when the input is empty.\n */\n placeholder?: string;\n}\n\n/**\n * Radio buttons field props\n */\nexport interface RadioButtonsFieldProps<V> extends BaseFormFieldProps<V> {\n /**\n * Available options for radio buttons.\n *\n * Values are compared by reference equality (`===`). When options contain\n * non-primitive values, pass the same object references for `value` and\n * the corresponding option entry.\n */\n options: Option<V>[];\n\n /**\n * Controls the layout direction of the radio buttons.\n *\n * - `\"vertical\"` (default): options are stacked in a column\n * - `\"horizontal\"`: options are laid out in a row, wrapping when needed\n */\n orientation?: \"horizontal\" | \"vertical\";\n}\n\n/**\n * Switch field props for boolean values.\n */\nexport type SwitchFieldProps = BaseFormFieldProps<boolean>;\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<\n T extends ObjectTypeDefinition,\n> extends Pick<BaseFormFieldProps<ObjectSet<T>>, \"id\" | \"value\" | \"disabled\"> {\n /**\n * Message displayed when no object set is provided.\n *\n * @default \"Object set is not defined\"\n */\n emptyMessage?: string;\n}\n\ntype ObjectSelectDataSource<Q extends ObjectTypeDefinition> =\n | {\n /**\n * The object type definition to search across.\n */\n objectType: Q;\n objectSet?: never;\n }\n | {\n /**\n * A pre-scoped object set to search within.\n *\n * Use this when selectable options should be limited to a subset of\n * objects. User-entered search text is applied within this set.\n */\n objectSet: ObjectSet<Q>;\n objectType?: never;\n };\n\n/**\n * Object select field props for selecting object instances from the ontology.\n * Used for action parameters that accept a single object or multiple objects.\n *\n * Extends DropdownFieldProps with props that ObjectSelectField\n * manages internally (items, search, filtering) omitted from the public surface.\n */\nexport type ObjectSelectFieldProps<\n Q extends ObjectTypeDefinition = ObjectTypeDefinition,\n> = Omit<\n DropdownFieldProps<Osdk.Instance<Q>>,\n | \"items\"\n | \"itemToStringLabel\"\n | \"itemToKey\"\n | \"isItemEqual\"\n | \"isSearchable\"\n | \"query\"\n | \"onQueryChange\"\n | \"disableClientSideFiltering\"\n | \"renderItemList\"\n> &\n ObjectSelectDataSource<Q>;\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 UnsupportedFieldProps extends Pick<\n BaseFormFieldProps<string>,\n \"id\" | \"error\"\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 validation error message for this field, if any.\n * When set, the field should display a visual error state.\n */\n error?: string;\n\n /**\n * The value of the form field\n */\n value: V | null;\n\n /**\n * The default value of the form field.\n */\n defaultValue?: V;\n\n /**\n * Whether the field is disabled.\n *\n * Disabled fields keep their current value in form state and submit payloads,\n * but built-in renderers block user edits and remove disabled controls from\n * keyboard navigation.\n */\n disabled?: boolean;\n\n /**\n * Called when the field value changes.\n *\n * ActionForm internally wraps this to pass the key to `onFieldValueChange`:\n * ```\n * <DropdownField\n * {...fieldDef}\n * onChange={(value) => onFieldValueChange(fieldDef.key, value)}\n * />\n * ```\n *\n * @param value The new value of the form field\n */\n onChange?: (value: V | null) => void;\n}\n\nexport type FieldKey<Q extends ActionDefinition<unknown>> =\n keyof ActionParameters<Q>;\n\n/**\n * Extracts parameters from an ActionDefinition\n */\nexport type ActionParameters<Q extends ActionDefinition<unknown>> =\n CompileTimeMetadata<Q>[\"parameters\"];\n\n/**\n * Extracts the value type for a specific parameter\n */\nexport type FieldValueType<\n Q extends ActionDefinition<unknown>,\n K extends keyof ActionParameters<Q> = keyof ActionParameters<Q>,\n> =\n ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.Object<infer T>\n ? ActionParam.ObjectType<T>\n : ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.ObjectSet<\n infer T\n >\n ? ActionParam.ObjectSetType<T>\n : ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.Interface<\n infer T\n >\n ? ActionParam.InterfaceType<T>\n : ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.Struct<\n infer T\n >\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 | \"DATE_RANGE_INPUT\"\n | \"DATETIME_PICKER\"\n | \"DROPDOWN\"\n | \"FILE_PICKER\"\n | \"NUMBER_INPUT\"\n | \"OBJECT_SELECT\"\n | \"OBJECT_SET\"\n | \"RADIO_BUTTONS\"\n | \"SWITCH\"\n | \"TEXT_AREA\"\n | \"TEXT_INPUT\"\n | \"CUSTOM\"\n | \"UNSUPPORTED\";\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 | \"scenarioReference\"\n | { type: \"object\"; object: string }\n | { type: \"objectSet\"; objectSet: string }\n | { type: \"interface\"; interface: string }\n | { type: \"struct\"; struct: Record<string, string> };\n\n/**\n * Props managed by form state infrastructure (FieldBridge / RHF).\n * Fields with onChange participate in form state → value and onChange are managed\n * externally. Read-only fields (no onChange, e.g. ObjectSetField) keep value in\n * fieldComponentProps so it bypasses form state cloning.\n */\ntype FormManagedProps<K extends FieldComponent> =\n \"onChange\" extends keyof FormFieldPropsByType[K]\n ? \"value\" | \"onChange\" | \"disabled\"\n : \"onChange\" | \"disabled\";\n\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown\n ? Omit<T, Extract<keyof T, K>>\n : never;\n\n/**\n * An OSDK-agnostic field definition used by BaseForm and FormFieldRenderer.\n * Contains only the information needed to render a single field — no generics,\n * no compile-time parameter constraints.\n *\n * Implemented as a distributed mapped type: switching on `fieldComponent`\n * narrows `fieldComponentProps` to the correct props type automatically.\n */\nexport type RendererFieldDefinition = {\n [K in FieldComponent]: {\n fieldKey: string;\n fieldComponent: K;\n fieldType?: FieldType;\n label: string;\n isRequired?: boolean;\n placeholder?: string;\n helperText?: React.ReactNode;\n helperTextPlacement?: \"bottom\" | \"tooltip\";\n disabled?: boolean;\n validate?: (value: unknown) => Promise<string | undefined>;\n onValidationError?: (error: ValidationError) => string | undefined;\n fieldComponentProps: DistributiveOmit<\n FormFieldPropsByType[K],\n FormManagedProps<K>\n >;\n };\n}[FieldComponent];\n\n/**\n * Gets valid form field types for a given property type\n */\nexport type ValidFormFieldForPropertyType<P extends FieldDescriptorType> =\n | \"CUSTOM\"\n | (P extends { type: \"objectSet\" }\n ? \"OBJECT_SET\"\n : P extends { type: \"object\" }\n ? \"OBJECT_SELECT\"\n : P extends { type: \"interface\" }\n ? \"UNSUPPORTED\"\n : P extends { type: \"struct\" }\n ? \"UNSUPPORTED\"\n : P extends \"mediaReference\" | \"attachment\"\n ? \"FILE_PICKER\"\n : P extends \"boolean\"\n ? \"RADIO_BUTTONS\" | \"DROPDOWN\" | \"SWITCH\"\n : P extends \"string\"\n ? \"TEXT_INPUT\" | \"TEXT_AREA\"\n : P extends \"datetime\" | \"timestamp\"\n ? \"DATETIME_PICKER\"\n : P extends\n | \"marking\"\n | \"geohash\"\n | \"geoshape\"\n | \"objectType\"\n ? \"UNSUPPORTED\"\n : P extends\n | \"double\"\n | \"integer\"\n | \"long\"\n | \"float\"\n | \"short\"\n | \"byte\"\n | \"decimal\"\n ? \"NUMBER_INPUT\"\n : never);\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FormFieldApi.js","names":[],"sources":["FormFieldApi.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n ActionParam,\n CompileTimeMetadata,\n DataValueClientToWire,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n} from \"@osdk/api\";\nimport type React from \"react\";\n\nimport type {\n DatePickerProps,\n DateRangePickerProps,\n} from \"../shared/calendar/index.js\";\nimport type { PortalContainer } from \"../shared/PortalDismissLayer.js\";\n\nexport type { PortalContainer };\n\n/**\n * A form field definition specifies configuration for a single field.\n * Implemented as a distributed mapped type so `fieldComponent` narrows\n * `fieldComponentProps` to the matching component prop type.\n */\nexport type FormFieldDefinition<\n Q extends ActionDefinition<unknown>,\n K extends FieldKey<Q> = FieldKey<Q>,\n> = K extends unknown\n ? {\n // Distribute over each field key so a field's key, value type, and allowed\n // components stay correlated when K is the default union of all keys.\n [C in ValidFormFieldForPropertyType<ActionParameter<Q, K>[\"type\"]>]: {\n /**\n * The field's unique key\n */\n fieldKey: K;\n\n /**\n * Display label for the field\n */\n label: string;\n\n /**\n * Default value of the field\n */\n defaultValue?: FieldValueType<Q, K>;\n\n /**\n * 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 * Accepts plain text or rich content (e.g. JSX with links or formatting).\n * Rendered as a tooltip icon next to the label by default, or below the\n * label when helperTextPlacement is \"bottom\".\n */\n helperText?: React.ReactNode;\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 disabled?: boolean;\n\n /**\n * A callback to customize error messages when a built-in validation rule fails.\n * Receives a discriminated union with the constraint data (e.g., the min value\n * that was exceeded) so the message can reference the threshold.\n *\n * Return a string to override the default message, or `undefined` to keep it.\n */\n onValidationError?: (error: ValidationError) => string | undefined;\n\n /**\n * Additional function to validate the field.\n *\n * Return `undefined` if valid, or an error message string if invalid.\n */\n validate?: (value: FieldValueType<Q, K>) => Promise<string | undefined>;\n\n /**\n * The form field component type to render\n */\n fieldComponent: C;\n\n /**\n * The component props for the form field.\n * Excludes runtime props (value, onChange) which are managed by ActionForm.\n */\n fieldComponentProps: DistributiveOmit<\n FormFieldComponentPropsByActionParameter<\n ActionParameter<Q, K>,\n FieldValueType<Q, K>\n >[C],\n FormManagedProps<C>\n >;\n };\n }[ValidFormFieldForPropertyType<ActionParameter<Q, K>[\"type\"]>]\n : never;\n\n/**\n * A discriminated union describing which validation rule failed and the\n * constraint data the user needs to build a meaningful error message.\n */\nexport type ValidationError =\n | { type: \"required\" }\n | { type: \"min\"; min: number | Date }\n | { type: \"max\"; max: number | Date }\n | { type: \"minLength\"; minLength: number }\n | { type: \"maxLength\"; maxLength: number }\n | { type: \"maxSize\"; maxSize: number }\n | { type: \"validate\"; message: string };\n\n/**\n * Maps field types to their corresponding props\n */\nexport interface FormFieldPropsByType {\n DATE_RANGE_INPUT: DateRangePickerProps;\n DATETIME_PICKER: DatePickerProps;\n DROPDOWN: DropdownFieldProps<unknown, boolean>;\n FILE_PICKER: FilePickerProps;\n NUMBER_INPUT: NumberInputFieldProps;\n OBJECT_SELECT: ObjectSelectFieldProps<ObjectTypeDefinition>;\n OBJECT_SET: ObjectSetFieldProps<ObjectTypeDefinition>;\n RADIO_BUTTONS: RadioButtonsFieldProps<unknown>;\n SWITCH: SwitchFieldProps;\n TEXT_AREA: TextAreaFieldProps;\n TEXT_INPUT: TextInputFieldProps;\n CUSTOM: CustomFieldProps<unknown>;\n UNSUPPORTED: UnsupportedFieldProps;\n}\n\n/**\n * Maps the components supported by an action parameter to props that preserve\n * the parameter's value type and, where applicable, the object type referenced\n * by the parameter.\n * Components without action-specific props reuse the renderer-facing mapping.\n */\ntype FormFieldComponentPropsByActionParameter<\n P extends ActionMetadata.Parameter,\n V,\n> = {\n // Only concrete scalar parameters gain more precise props. Metadata-agnostic\n // and repeated parameters retain the renderer-facing types used previously.\n [C in ValidFormFieldForPropertyType<\n P[\"type\"]\n >]: IsBroadActionParameter<P> extends true\n ? FormFieldPropsByType[C]\n : P extends { multiplicity: true }\n ? FormFieldPropsByType[C]\n : C extends \"DROPDOWN\"\n ? DropdownFieldProps<V, boolean>\n : C extends \"RADIO_BUTTONS\"\n ? RadioButtonsFieldProps<V>\n : C extends \"CUSTOM\"\n ? CustomFieldProps<V>\n : C extends \"OBJECT_SELECT\"\n ? P[\"type\"] extends ActionMetadata.DataType.Object<infer T>\n ? ObjectSelectFieldProps<T>\n : never\n : C extends \"OBJECT_SET\"\n ? P[\"type\"] extends ActionMetadata.DataType.ObjectSet<infer T>\n ? ObjectSetFieldProps<T>\n : never\n : FormFieldPropsByType[C];\n};\n\n// Actions without concrete definition metadata expose the base parameter type.\ntype IsBroadActionParameter<P extends ActionMetadata.Parameter> = [\n ActionMetadata.Parameter,\n] extends [P]\n ? true\n : false;\n\n/**\n * Dropdown field props with selectable items\n */\nexport interface DropdownFieldProps<\n V,\n Multiple extends boolean = false,\n> extends BaseFormFieldProps<Multiple extends true ? V[] : V> {\n /**\n * Available items for the dropdown\n */\n items: V[];\n\n /**\n * Converts an item to searchable text and the default visual label. Defaults to `String()`.\n * Use `renderItemLabel` when the visible label needs rich React content.\n */\n itemToStringLabel?: (item: V) => string;\n\n /**\n * Renders an item label with custom React content.\n * `itemToStringLabel` is still used for search, accessibility, and fallback keys.\n */\n renderItemLabel?: (item: V) => React.ReactNode;\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 /**\n * Ref forwarded to the portal container element.\n * Used to track portaled content for click-outside detection.\n */\n portalRef?: React.Ref<HTMLDivElement>;\n\n /**\n * Element that receives the dropdown portal. Use this when rendering inside\n * modal dialogs so popups stay in the dialog's stacking and focus context\n * instead of being appended directly to document.body.\n */\n portalContainer?: PortalContainer;\n\n /**\n * Controlled search input value. Must be provided together with `onQueryChange`.\n */\n query?: string;\n\n /**\n * Callback when the search input value changes.\n * Can be used standalone as an event listener or together with `query`\n * for fully controlled search state.\n */\n onQueryChange?: (query: string) => void;\n\n /**\n * When true, disables the combobox's built-in client-side filtering.\n * Use when items are already filtered server-side (e.g. via `onQueryChange`).\n *\n * @default false\n */\n disableClientSideFiltering?: boolean;\n\n /**\n * Status message rendered below the search input and above the item list\n * inside the popup. Use for loading/error/empty messages.\n */\n popupStatus?: React.ReactNode;\n\n /**\n * A React node to render after the item list.\n * Use for infinite scroll sentinels, \"load more\" buttons, etc.\n */\n trailingItem?: React.ReactNode;\n\n /**\n * Whether the dropdown locks page scroll and renders a full-viewport\n * dismiss layer when open. Set to `false` when the dropdown is not\n * inside a `<label>` to allow normal page scrolling.\n *\n * @default true\n */\n modal?: boolean;\n}\n\nexport interface FilePickerProps extends BaseFormFieldProps<File | File[]> {\n /**\n * Whether multiple files can be selected\n */\n isMulti?: boolean;\n\n /**\n * Accepted file types (e.g., \"image/*\", \".pdf\")\n */\n accept?: string | string[];\n\n /**\n * Maximum file size in bytes\n */\n maxSize?: number;\n\n /**\n * The text displayed when no file is selected.\n *\n * @default \"No file chosen\"\n */\n text?: string;\n\n /**\n * The text displayed on the browse button.\n *\n * @default \"Browse\"\n */\n buttonText?: string;\n}\n\n/**\n * Text area field props\n */\nexport interface TextAreaFieldProps\n 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 placeholder?: string;\n}\n\nexport interface TextInputFieldProps\n 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 placeholder?: string;\n}\n\n/**\n * Number input field props\n */\nexport interface NumberInputFieldProps extends BaseFormFieldProps<number> {\n /**\n * Minimum allowed value.\n */\n min?: number;\n\n /**\n * Maximum allowed value.\n */\n max?: number;\n\n /**\n * Step increment for the input. Used by the stepper buttons and ArrowUp/ArrowDown keyboard stepping.\n *\n * @default 1\n */\n step?: number;\n\n /**\n * Placeholder text shown when the input is empty.\n */\n placeholder?: string;\n}\n\n/**\n * Radio buttons field props\n */\nexport interface RadioButtonsFieldProps<V> extends BaseFormFieldProps<V> {\n /**\n * Available options for radio buttons.\n *\n * Values are compared by reference equality (`===`). When options contain\n * non-primitive values, pass the same object references for `value` and\n * the corresponding option entry.\n */\n options: Option<V>[];\n\n /**\n * Controls the layout direction of the radio buttons.\n *\n * - `\"vertical\"` (default): options are stacked in a column\n * - `\"horizontal\"`: options are laid out in a row, wrapping when needed\n */\n orientation?: \"horizontal\" | \"vertical\";\n}\n\n/**\n * Switch field props for boolean values.\n */\nexport type SwitchFieldProps = BaseFormFieldProps<boolean>;\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<\n T extends ObjectTypeDefinition,\n> extends Pick<BaseFormFieldProps<ObjectSet<T>>, \"id\" | \"value\" | \"disabled\"> {\n /**\n * Message displayed when no object set is provided.\n *\n * @default \"Object set is not defined\"\n */\n emptyMessage?: string;\n}\n\ntype ObjectSelectDataSource<Q extends ObjectTypeDefinition> =\n | {\n /**\n * The object type definition to search across.\n */\n objectType: Q;\n objectSet?: never;\n }\n | {\n /**\n * A pre-scoped object set to search within.\n *\n * Use this when selectable options should be limited to a subset of\n * objects. User-entered search text is applied within this set.\n */\n objectSet: ObjectSet<Q>;\n objectType?: never;\n };\n\n/**\n * Object select field props for selecting object instances from the ontology.\n * Used for action parameters that accept a single object or multiple objects.\n *\n * Extends DropdownFieldProps with props that ObjectSelectField\n * manages internally (items, search, filtering) omitted from the public surface.\n */\nexport type ObjectSelectFieldProps<\n Q extends ObjectTypeDefinition = ObjectTypeDefinition,\n> = Omit<\n DropdownFieldProps<Osdk.Instance<Q>>,\n | \"items\"\n | \"itemToStringLabel\"\n | \"itemToKey\"\n | \"isItemEqual\"\n | \"isSearchable\"\n | \"query\"\n | \"onQueryChange\"\n | \"disableClientSideFiltering\"\n | \"renderItemList\"\n> &\n ObjectSelectDataSource<Q>;\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 UnsupportedFieldProps extends Pick<\n BaseFormFieldProps<string>,\n \"id\" | \"error\"\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 validation error message for this field, if any.\n * When set, the field should display a visual error state.\n */\n error?: string;\n\n /**\n * The value of the form field\n */\n value: V | null;\n\n /**\n * The default value of the form field.\n */\n defaultValue?: V;\n\n /**\n * Whether the field is disabled.\n *\n * Disabled fields keep their current value in form state and submit payloads,\n * but built-in renderers block user edits and remove disabled controls from\n * keyboard navigation.\n */\n disabled?: boolean;\n\n /**\n * Called when the field value changes.\n *\n * ActionForm internally wraps this to pass the key to `onFieldValueChange`:\n * ```\n * <DropdownField\n * {...fieldDef}\n * onChange={(value) => onFieldValueChange(fieldDef.key, value)}\n * />\n * ```\n *\n * @param value The new value of the form field\n */\n onChange?: (value: V | null) => void;\n}\n\nexport type FieldKey<Q extends ActionDefinition<unknown>> =\n keyof ActionParameters<Q>;\n\n/**\n * Extracts parameters from an ActionDefinition\n */\nexport type ActionParameters<Q extends ActionDefinition<unknown>> =\n CompileTimeMetadata<Q>[\"parameters\"];\n\ntype ActionParameter<\n Q extends ActionDefinition<unknown>,\n K extends keyof ActionParameters<Q>,\n> = ActionParameters<Q>[K] extends ActionMetadata.Parameter\n ? ActionParameters<Q>[K]\n : never;\n\n/**\n * Extracts the value type for a specific parameter\n */\nexport type FieldValueType<\n Q extends ActionDefinition<unknown>,\n K extends keyof ActionParameters<Q> = keyof ActionParameters<Q>,\n> =\n ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.Object<infer T>\n ? ActionParam.ObjectType<T>\n : ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.ObjectSet<\n infer T\n >\n ? ActionParam.ObjectSetType<T>\n : ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.Interface<\n infer T\n >\n ? ActionParam.InterfaceType<T>\n : ActionParameters<Q>[K][\"type\"] extends ActionMetadata.DataType.Struct<\n infer T\n >\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 | \"DATE_RANGE_INPUT\"\n | \"DATETIME_PICKER\"\n | \"DROPDOWN\"\n | \"FILE_PICKER\"\n | \"NUMBER_INPUT\"\n | \"OBJECT_SELECT\"\n | \"OBJECT_SET\"\n | \"RADIO_BUTTONS\"\n | \"SWITCH\"\n | \"TEXT_AREA\"\n | \"TEXT_INPUT\"\n | \"CUSTOM\"\n | \"UNSUPPORTED\";\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 | \"scenarioReference\"\n | { type: \"object\"; object: string }\n | { type: \"objectSet\"; objectSet: string }\n | { type: \"interface\"; interface: string }\n | { type: \"struct\"; struct: Record<string, string> };\n\n/**\n * Props managed by form state infrastructure (FieldBridge / RHF).\n * Fields with onChange participate in form state → value and onChange are managed\n * externally. Read-only fields (no onChange, e.g. ObjectSetField) keep value in\n * fieldComponentProps so it bypasses form state cloning.\n */\ntype FormManagedProps<K extends FieldComponent> =\n \"onChange\" extends keyof FormFieldPropsByType[K]\n ? \"value\" | \"onChange\" | \"disabled\"\n : \"onChange\" | \"disabled\";\n\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown\n ? Omit<T, Extract<keyof T, K>>\n : never;\n\n/**\n * An OSDK-agnostic field definition used by BaseForm and FormFieldRenderer.\n * Contains only the information needed to render a single field — no generics,\n * no compile-time parameter constraints.\n *\n * Implemented as a distributed mapped type: switching on `fieldComponent`\n * narrows `fieldComponentProps` to the correct props type automatically.\n */\nexport type RendererFieldDefinition = {\n [K in FieldComponent]: {\n fieldKey: string;\n fieldComponent: K;\n fieldType?: FieldType;\n label: string;\n isRequired?: boolean;\n placeholder?: string;\n helperText?: React.ReactNode;\n helperTextPlacement?: \"bottom\" | \"tooltip\";\n disabled?: boolean;\n validate?: (value: unknown) => Promise<string | undefined>;\n onValidationError?: (error: ValidationError) => string | undefined;\n fieldComponentProps: DistributiveOmit<\n FormFieldPropsByType[K],\n FormManagedProps<K>\n >;\n };\n}[FieldComponent];\n\n/**\n * Gets valid form field types for a given property type\n */\nexport type ValidFormFieldForPropertyType<P extends FieldDescriptorType> =\n | \"CUSTOM\"\n | (P extends { type: \"objectSet\" }\n ? \"OBJECT_SET\"\n : P extends { type: \"object\" }\n ? \"OBJECT_SELECT\"\n : P extends { type: \"interface\" }\n ? \"UNSUPPORTED\"\n : P extends { type: \"struct\" }\n ? \"UNSUPPORTED\"\n : P extends \"mediaReference\" | \"attachment\"\n ? \"FILE_PICKER\"\n : P extends \"boolean\"\n ? \"RADIO_BUTTONS\" | \"DROPDOWN\" | \"SWITCH\"\n : P extends \"string\"\n ? \"TEXT_INPUT\" | \"TEXT_AREA\" | \"DROPDOWN\" | \"RADIO_BUTTONS\"\n : P extends \"datetime\" | \"timestamp\"\n ? \"DATETIME_PICKER\"\n : P extends\n | \"marking\"\n | \"geohash\"\n | \"geoshape\"\n | \"objectType\"\n ? \"UNSUPPORTED\"\n : P extends\n | \"double\"\n | \"integer\"\n | \"long\"\n | \"float\"\n | \"short\"\n | \"byte\"\n | \"decimal\"\n ? \"NUMBER_INPUT\"\n : never);\n"],"mappings":"","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
const PACKAGE_USER_AGENT = `osdk-react-components/${"0.57.
|
|
17
|
+
const PACKAGE_USER_AGENT = `osdk-react-components/${"0.57.1-ading-window-9d7d68c38a079178b6cb5333855d9a35c5563004"}`;
|
|
18
18
|
export function componentUserAgent(componentName) {
|
|
19
19
|
return `${PACKAGE_USER_AGENT}/${componentName}`;
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserAgent.js","names":["PACKAGE_USER_AGENT","componentUserAgent","componentName"],"sources":["UserAgent.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\nconst PACKAGE_USER_AGENT = `osdk-react-components/${process.env.PACKAGE_VERSION}`;\n\nexport function componentUserAgent(componentName: string): string {\n return `${PACKAGE_USER_AGENT}/${componentName}`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,kBAAkB,GAAG,
|
|
1
|
+
{"version":3,"file":"UserAgent.js","names":["PACKAGE_USER_AGENT","componentUserAgent","componentName"],"sources":["UserAgent.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\nconst PACKAGE_USER_AGENT = `osdk-react-components/${process.env.PACKAGE_VERSION}`;\n\nexport function componentUserAgent(componentName: string): string {\n return `${PACKAGE_USER_AGENT}/${componentName}`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,kBAAkB,GAAG,yFAAsD;AAEjF,OAAO,SAASC,kBAAkBA,CAACC,aAAqB,EAAU;EAChE,OAAO,GAAGF,kBAAkB,IAAIE,aAAa,EAAE;AACjD","ignoreList":[]}
|
|
@@ -157,7 +157,7 @@ interface DateRangePickerProps {
|
|
|
157
157
|
* `fieldComponentProps` to the matching component prop type.
|
|
158
158
|
*/
|
|
159
159
|
type FormFieldDefinition<Q extends ActionDefinition<unknown>, K extends FieldKey<Q> = FieldKey<Q>> = K extends unknown ? {
|
|
160
|
-
[C in ValidFormFieldForPropertyType<
|
|
160
|
+
[C in ValidFormFieldForPropertyType<ActionParameter<Q, K>["type"]>]: {
|
|
161
161
|
/**
|
|
162
162
|
* The field's unique key
|
|
163
163
|
*/
|
|
@@ -217,9 +217,9 @@ type FormFieldDefinition<Q extends ActionDefinition<unknown>, K extends FieldKey
|
|
|
217
217
|
* The component props for the form field.
|
|
218
218
|
* Excludes runtime props (value, onChange) which are managed by ActionForm.
|
|
219
219
|
*/
|
|
220
|
-
fieldComponentProps: DistributiveOmit<
|
|
220
|
+
fieldComponentProps: DistributiveOmit<FormFieldComponentPropsByActionParameter<ActionParameter<Q, K>, FieldValueType<Q, K>>[C], FormManagedProps<C>>;
|
|
221
221
|
};
|
|
222
|
-
}[ValidFormFieldForPropertyType<
|
|
222
|
+
}[ValidFormFieldForPropertyType<ActionParameter<Q, K>["type"]>] : never;
|
|
223
223
|
/**
|
|
224
224
|
* A discriminated union describing which validation rule failed and the
|
|
225
225
|
* constraint data the user needs to build a meaningful error message.
|
|
@@ -263,6 +263,20 @@ interface FormFieldPropsByType {
|
|
|
263
263
|
CUSTOM: CustomFieldProps<unknown>;
|
|
264
264
|
UNSUPPORTED: UnsupportedFieldProps;
|
|
265
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* Maps the components supported by an action parameter to props that preserve
|
|
268
|
+
* the parameter's value type and, where applicable, the object type referenced
|
|
269
|
+
* by the parameter.
|
|
270
|
+
* Components without action-specific props reuse the renderer-facing mapping.
|
|
271
|
+
*/
|
|
272
|
+
type FormFieldComponentPropsByActionParameter<P extends ActionMetadata.Parameter, V> = {
|
|
273
|
+
[C in ValidFormFieldForPropertyType<P["type"]>]: IsBroadActionParameter<P> extends true ? FormFieldPropsByType[C] : P extends {
|
|
274
|
+
multiplicity: true;
|
|
275
|
+
} ? FormFieldPropsByType[C] : C extends "DROPDOWN" ? DropdownFieldProps<V, boolean> : C extends "RADIO_BUTTONS" ? RadioButtonsFieldProps<V> : C extends "CUSTOM" ? CustomFieldProps<V> : C extends "OBJECT_SELECT" ? P["type"] extends ActionMetadata.DataType.Object<infer T> ? ObjectSelectFieldProps<T> : never : C extends "OBJECT_SET" ? P["type"] extends ActionMetadata.DataType.ObjectSet<infer T> ? ObjectSetFieldProps<T> : never : FormFieldPropsByType[C];
|
|
276
|
+
};
|
|
277
|
+
type IsBroadActionParameter<P extends ActionMetadata.Parameter> = [
|
|
278
|
+
ActionMetadata.Parameter
|
|
279
|
+
] extends [P] ? true : false;
|
|
266
280
|
/**
|
|
267
281
|
* Dropdown field props with selectable items
|
|
268
282
|
*/
|
|
@@ -550,6 +564,7 @@ type FieldKey<Q extends ActionDefinition<unknown>> = keyof ActionParameters<Q>;
|
|
|
550
564
|
* Extracts parameters from an ActionDefinition
|
|
551
565
|
*/
|
|
552
566
|
type ActionParameters<Q extends ActionDefinition<unknown>> = CompileTimeMetadata<Q>["parameters"];
|
|
567
|
+
type ActionParameter<Q extends ActionDefinition<unknown>, K extends keyof ActionParameters<Q>> = ActionParameters<Q>[K] extends ActionMetadata.Parameter ? ActionParameters<Q>[K] : never;
|
|
553
568
|
/**
|
|
554
569
|
* Extracts the value type for a specific parameter
|
|
555
570
|
*/
|
|
@@ -622,7 +637,7 @@ type ValidFormFieldForPropertyType<P extends FieldDescriptorType> = "CUSTOM" | (
|
|
|
622
637
|
type: "interface";
|
|
623
638
|
} ? "UNSUPPORTED" : P extends {
|
|
624
639
|
type: "struct";
|
|
625
|
-
} ? "UNSUPPORTED" : P extends "mediaReference" | "attachment" ? "FILE_PICKER" : P extends "boolean" ? "RADIO_BUTTONS" | "DROPDOWN" | "SWITCH" : P extends "string" ? "TEXT_INPUT" | "TEXT_AREA" : P extends "datetime" | "timestamp" ? "DATETIME_PICKER" : P extends "marking" | "geohash" | "geoshape" | "objectType" ? "UNSUPPORTED" : P extends "double" | "integer" | "long" | "float" | "short" | "byte" | "decimal" ? "NUMBER_INPUT" : never);
|
|
640
|
+
} ? "UNSUPPORTED" : P extends "mediaReference" | "attachment" ? "FILE_PICKER" : P extends "boolean" ? "RADIO_BUTTONS" | "DROPDOWN" | "SWITCH" : P extends "string" ? "TEXT_INPUT" | "TEXT_AREA" | "DROPDOWN" | "RADIO_BUTTONS" : P extends "datetime" | "timestamp" ? "DATETIME_PICKER" : P extends "marking" | "geohash" | "geoshape" | "objectType" ? "UNSUPPORTED" : P extends "double" | "integer" | "long" | "float" | "short" | "byte" | "decimal" ? "NUMBER_INPUT" : never);
|
|
626
641
|
|
|
627
642
|
/**
|
|
628
643
|
* Props for the ActionForm component.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkBE5DFM7I_cjs = require('./chunk-BE5DFM7I.cjs');
|
|
4
4
|
var chunkRVZE7LPI_cjs = require('./chunk-RVZE7LPI.cjs');
|
|
5
5
|
|
|
6
6
|
// src/public/experimental/xml-viewer.ts
|
|
7
7
|
var BaseXmlViewer2 = chunkRVZE7LPI_cjs.BaseXmlViewer;
|
|
8
|
-
var XmlViewer2 =
|
|
8
|
+
var XmlViewer2 = chunkBE5DFM7I_cjs.XmlViewer;
|
|
9
9
|
|
|
10
10
|
exports.BaseXmlViewer = BaseXmlViewer2;
|
|
11
11
|
exports.XmlViewer = XmlViewer2;
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
12
|
+
//# sourceMappingURL=chunk-2HDZMYVX.cjs.map
|
|
13
|
+
//# sourceMappingURL=chunk-2HDZMYVX.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/experimental/xml-viewer.ts"],"names":["BaseXmlViewer","XmlViewer"],"mappings":";;;;;;AAmBO,IAAMA,cAAAA,GAAuBA;AAO7B,IAAMC,UAAAA,GAAmBA","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/experimental/xml-viewer.ts"],"names":["BaseXmlViewer","XmlViewer"],"mappings":";;;;;;AAmBO,IAAMA,cAAAA,GAAuBA;AAO7B,IAAMC,UAAAA,GAAmBA","file":"chunk-2HDZMYVX.cjs","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 * as Stable from \"../xml-viewer.js\";\n\n/** @deprecated Import from `@osdk/react-components/xml-viewer` instead. */\nexport const BaseXmlViewer = Stable.BaseXmlViewer;\n\n/** @deprecated Import from `@osdk/react-components/xml-viewer` instead. */\n\n/** @deprecated Import from `@osdk/react-components/xml-viewer` instead. */\n\n/** @deprecated Import from `@osdk/react-components/xml-viewer` instead. */\nexport const XmlViewer = Stable.XmlViewer;"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkDTYFQRFD_cjs = require('./chunk-DTYFQRFD.cjs');
|
|
4
|
+
var chunkRST4CZUX_cjs = require('./chunk-RST4CZUX.cjs');
|
|
5
|
+
|
|
6
|
+
// src/public/tiff-viewer.ts
|
|
7
|
+
var TiffViewer2 = chunkRST4CZUX_cjs.withOsdkMetrics(chunkDTYFQRFD_cjs.TiffViewer, "TiffViewer");
|
|
8
|
+
|
|
9
|
+
exports.TiffViewer = TiffViewer2;
|
|
10
|
+
//# sourceMappingURL=chunk-5AILJ7IY.cjs.map
|
|
11
|
+
//# sourceMappingURL=chunk-5AILJ7IY.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/tiff-viewer.ts"],"names":["TiffViewer","withOsdkMetrics"],"mappings":";;;;;;AAsBO,IAAMA,WAAAA,GAAaC,iCAAA,CAAgBD,4BAAA,EAAa,YAAY","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/tiff-viewer.ts"],"names":["TiffViewer","withOsdkMetrics"],"mappings":";;;;;;AAsBO,IAAMA,WAAAA,GAAaC,iCAAA,CAAgBD,4BAAA,EAAa,YAAY","file":"chunk-5AILJ7IY.cjs","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 { TiffViewer as _TiffViewer } from \"../images/tiff-viewer/TiffViewer.js\";\nimport { withOsdkMetrics } from \"../util/withOsdkMetrics.js\";\n\n// BaseTiffViewer\nexport { BaseTiffViewer } from \"../images/tiff-viewer/BaseTiffViewer.js\";\n// TiffViewer (Media wrapper)\nexport const TiffViewer = withOsdkMetrics(_TiffViewer, \"TiffViewer\");"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkKFV264XS_cjs = require('./chunk-KFV264XS.cjs');
|
|
4
|
+
var chunkRST4CZUX_cjs = require('./chunk-RST4CZUX.cjs');
|
|
5
|
+
|
|
6
|
+
// src/public/markdown-viewer.ts
|
|
7
|
+
var MarkdownViewer2 = chunkRST4CZUX_cjs.withOsdkMetrics(chunkKFV264XS_cjs.MarkdownViewer, "MarkdownViewer");
|
|
8
|
+
|
|
9
|
+
exports.MarkdownViewer = MarkdownViewer2;
|
|
10
|
+
//# sourceMappingURL=chunk-5C5CO6IV.cjs.map
|
|
11
|
+
//# sourceMappingURL=chunk-5C5CO6IV.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/markdown-viewer.ts"],"names":["MarkdownViewer","withOsdkMetrics"],"mappings":";;;;;;AAsBO,IAAMA,eAAAA,GAAiBC,iCAAA,CAAgBD,gCAAA,EAAiB,gBAAgB","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/markdown-viewer.ts"],"names":["MarkdownViewer","withOsdkMetrics"],"mappings":";;;;;;AAsBO,IAAMA,eAAAA,GAAiBC,iCAAA,CAAgBD,gCAAA,EAAiB,gBAAgB","file":"chunk-5C5CO6IV.cjs","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 { MarkdownViewer as _MarkdownViewer } from \"../markdown-viewer/MarkdownViewer.js\";\nimport { withOsdkMetrics } from \"../util/withOsdkMetrics.js\";\n\n// BaseMarkdownViewer\nexport { BaseMarkdownViewer } from \"../markdown-viewer/BaseMarkdownViewer.js\";\n// MarkdownViewer (Media wrapper)\nexport const MarkdownViewer = withOsdkMetrics(_MarkdownViewer, \"MarkdownViewer\");"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkVRHBAKNC_cjs = require('./chunk-VRHBAKNC.cjs');
|
|
4
|
+
|
|
5
|
+
// src/public/experimental/action-form.ts
|
|
6
|
+
var ActionForm2 = chunkVRHBAKNC_cjs.ActionForm;
|
|
7
|
+
var BaseForm2 = chunkVRHBAKNC_cjs.BaseForm;
|
|
8
|
+
|
|
9
|
+
exports.ActionForm = ActionForm2;
|
|
10
|
+
exports.BaseForm = BaseForm2;
|
|
11
|
+
//# sourceMappingURL=chunk-5NO5YIOO.cjs.map
|
|
12
|
+
//# sourceMappingURL=chunk-5NO5YIOO.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/experimental/action-form.ts"],"names":["ActionForm","BaseForm"],"mappings":";;;;;AAmBO,IAAMA,WAAAA,GAAoBA;AAe1B,IAAMC,SAAAA,GAAkBA","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/experimental/action-form.ts"],"names":["ActionForm","BaseForm"],"mappings":";;;;;AAmBO,IAAMA,WAAAA,GAAoBA;AAe1B,IAAMC,SAAAA,GAAkBA","file":"chunk-5NO5YIOO.cjs","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 * as Stable from \"../action-form.js\";\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\nexport const ActionForm = Stable.ActionForm;\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\nexport const BaseForm = Stable.BaseForm;\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */\n\n/** @deprecated Import from `@osdk/react-components/action-form` instead. */"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkKHMOMROL_cjs = require('./chunk-KHMOMROL.cjs');
|
|
4
|
+
var chunkRST4CZUX_cjs = require('./chunk-RST4CZUX.cjs');
|
|
5
|
+
|
|
6
|
+
// src/public/video-viewer.ts
|
|
7
|
+
var VideoViewer2 = chunkRST4CZUX_cjs.withOsdkMetrics(chunkKHMOMROL_cjs.VideoViewer, "VideoViewer");
|
|
8
|
+
|
|
9
|
+
exports.VideoViewer = VideoViewer2;
|
|
10
|
+
//# sourceMappingURL=chunk-A7UO4QTE.cjs.map
|
|
11
|
+
//# sourceMappingURL=chunk-A7UO4QTE.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/video-viewer.ts"],"names":["VideoViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,YAAAA,GAAcC,iCAAA,CAAgBD,6BAAA,EAAc,aAAa","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/video-viewer.ts"],"names":["VideoViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,YAAAA,GAAcC,iCAAA,CAAgBD,6BAAA,EAAc,aAAa","file":"chunk-A7UO4QTE.cjs","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\n// BaseVideoViewer\nexport { BaseVideoViewer } from \"../video-viewer/BaseVideoViewer.js\";\n// VideoViewer (Media wrapper)\nimport { withOsdkMetrics } from \"../util/withOsdkMetrics.js\";\nimport { VideoViewer as _VideoViewer } from \"../video-viewer/VideoViewer.js\";\nexport const VideoViewer = withOsdkMetrics(_VideoViewer, \"VideoViewer\");"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkRVZE7LPI_cjs = require('./chunk-RVZE7LPI.cjs');
|
|
4
|
+
var chunkRST4CZUX_cjs = require('./chunk-RST4CZUX.cjs');
|
|
5
|
+
|
|
6
|
+
// src/public/xml-viewer.ts
|
|
7
|
+
var XmlViewer2 = chunkRST4CZUX_cjs.withOsdkMetrics(chunkRVZE7LPI_cjs.XmlViewer, "XmlViewer");
|
|
8
|
+
|
|
9
|
+
exports.XmlViewer = XmlViewer2;
|
|
10
|
+
//# sourceMappingURL=chunk-BE5DFM7I.cjs.map
|
|
11
|
+
//# sourceMappingURL=chunk-BE5DFM7I.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/xml-viewer.ts"],"names":["XmlViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,UAAAA,GAAYC,iCAAA,CAAgBD,2BAAA,EAAY,WAAW","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/xml-viewer.ts"],"names":["XmlViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,UAAAA,GAAYC,iCAAA,CAAgBD,2BAAA,EAAY,WAAW","file":"chunk-BE5DFM7I.cjs","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\n// BaseXmlViewer\nexport { BaseXmlViewer } from \"../xml-viewer/BaseXmlViewer.js\";\n// XmlViewer (Media wrapper)\nimport { withOsdkMetrics } from \"../util/withOsdkMetrics.js\";\nimport { XmlViewer as _XmlViewer } from \"../xml-viewer/XmlViewer.js\";\nexport const XmlViewer = withOsdkMetrics(_XmlViewer, \"XmlViewer\");"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk4KHF42ZL_cjs = require('./chunk-4KHF42ZL.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkRST4CZUX_cjs = require('./chunk-RST4CZUX.cjs');
|
|
5
5
|
var icons = require('@blueprintjs/icons');
|
|
6
6
|
var classnames = require('classnames');
|
|
7
7
|
require('pdfjs-dist/web/pdf_viewer.css');
|
|
@@ -187,12 +187,12 @@ function usePdfViewerInstance(options) {
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
// src/public/pdf-viewer.ts
|
|
190
|
-
var PdfViewer2 =
|
|
190
|
+
var PdfViewer2 = chunkRST4CZUX_cjs.withOsdkMetrics(chunk4KHF42ZL_cjs.PdfViewer, "PdfViewer");
|
|
191
191
|
|
|
192
192
|
exports.PdfViewer = PdfViewer2;
|
|
193
193
|
exports.PdfViewerContent = PdfViewerContent;
|
|
194
194
|
exports.PdfViewerProvider = PdfViewerProvider;
|
|
195
195
|
exports.usePdfViewerContext = usePdfViewerContext;
|
|
196
196
|
exports.usePdfViewerInstance = usePdfViewerInstance;
|
|
197
|
-
//# sourceMappingURL=chunk-
|
|
198
|
-
//# sourceMappingURL=chunk-
|
|
197
|
+
//# sourceMappingURL=chunk-D6KESFUY.cjs.map
|
|
198
|
+
//# sourceMappingURL=chunk-D6KESFUY.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pdf-viewer/components/PdfViewerContent.tsx","../../src/pdf-viewer/PdfViewerContext.tsx","../../src/public/pdf-viewer.ts"],"names":["EMPTY_ANNOTATION_ARRAY","usePdfViewerCore","usePdfAnnotationsByPage","usePdfFormFields","useRef","useEffect","classnames","BasePdfViewer_default","React","Spin","ErrorIcon","PdfAnnotationOverlay","useContext","usePdfViewerState","usePdfHighlightMode","useMemo","PdfViewer","withOsdkMetrics"],"mappings":";;;;;;;;;;;;;;AA0BO,SAAS,gBAAA,CAAiB;AAAA,EAC/B,GAAA;AAAA,EACA,WAAA,GAAcA,wCAAA;AAAA,EACd,iBAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA,EAAc,gBAAA;AAAA,EACd,aAAA,EAAe,iBAAA;AAAA,EACf,QAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAA,EAAG;AACD,EAAA,MAAM,SAASC,kCAAA,CAAiB;AAAA,IAC9B,GAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA;AAAA,GACD,CAA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AAQ,aAAA;AACvD,EAAA,MAAM;AAAA,IACJ,iBAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AACJ,EAAA,OAAOa,cAAQ,OAAO;AAAA,IACpB,GAAG,MAAA;AAAA,IACH,gBAAA;AAAA,IACA,mBAAA;AAAA,IACA,mBAAA;AAAA,IACA,aAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,iBAAA;AAAA,IACA,iBAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACF,CAAA,EAAI,CAAC,MAAA,EAAQ,gBAAA,EAAkB,qBAAqB,mBAAA,EAAqB,aAAA,EAAe,cAAA,EAAgB,WAAA,EAAa,iBAAA,EAAmB,iBAAA,EAAmB,cAAA,EAAgB,cAAA,EAAgB,YAAY,CAAC,CAAA;AAC1M;;;ACjEO,IAAMC,UAAAA,GAAYC,iCAAA,CAAgBD,2BAAA,EAAY,WAAW","file":"chunk-6ITSZSOU.cjs","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 { Error as ErrorIcon, Spin } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport \"pdfjs-dist/web/pdf_viewer.css\";\nimport React, { useEffect, useRef } from \"react\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"../constants.js\";\nimport { usePdfAnnotationsByPage } from \"../hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"../hooks/usePdfFormFields.js\";\nimport { usePdfViewerCore } from \"../hooks/usePdfViewerCore.js\";\nimport { PdfAnnotationOverlay } from \"./PdfAnnotationOverlay.js\";\nimport styles from \"../BasePdfViewer.module.css\";\nexport function PdfViewerContent({\n src,\n annotations = EMPTY_ANNOTATION_ARRAY,\n onAnnotationClick,\n defaultPage,\n initialPage,\n defaultScale,\n initialScale,\n onPageChange: onPageChangeProp,\n onScaleChange: onScaleChangeProp,\n formData,\n onFormChange,\n className\n}) {\n const viewer = usePdfViewerCore({\n src,\n defaultPage,\n initialPage,\n defaultScale,\n initialScale\n });\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData,\n onFormChange\n });\n\n // Use refs for callbacks to avoid firing on initial mount\n const onPageChangeRef = useRef(onPageChangeProp);\n onPageChangeRef.current = onPageChangeProp;\n const onScaleChangeRef = useRef(onScaleChangeProp);\n onScaleChangeRef.current = onScaleChangeProp;\n const isInitialMountRef = useRef(true);\n useEffect(function notifyPageChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onPageChangeRef.current?.(viewer.currentPage);\n }, [viewer.currentPage]);\n useEffect(function notifyScaleChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onScaleChangeRef.current?.(viewer.scale);\n }, [viewer.scale]);\n useEffect(function clearInitialMount() {\n isInitialMountRef.current = false;\n }, []);\n const rootClassName = classnames(styles.pdfViewer, className);\n if (viewer.loading) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, /*#__PURE__*/React.createElement(Spin, {\n className: styles.spinnerIcon\n }), \"Loading\\u2026\"));\n }\n if (viewer.error != null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.errorContainer\n }, /*#__PURE__*/React.createElement(ErrorIcon, {\n className: styles.errorIcon\n }), \"Failed to load PDF: \", viewer.error.message));\n }\n if (viewer.document == null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, \"No document\"));\n }\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.scrollContainerWrapper\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.containerRef,\n className: styles.scrollContainer\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.viewerRef,\n className: \"pdfViewer\"\n }), viewer.portalTargets.map(target => {\n const pageAnnotations = annotationsByPage[target.pageNumber] ?? EMPTY_ANNOTATION_ARRAY;\n if (pageAnnotations.length === 0) {\n return null;\n }\n return /*#__PURE__*/React.createElement(PdfAnnotationOverlay, {\n key: target.pageNumber,\n target: target,\n annotations: pageAnnotations,\n onAnnotationClick: onAnnotationClick\n });\n }))));\n}","/*\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, { createContext, useContext, useMemo } from \"react\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"./constants.js\";\nimport { usePdfAnnotationsByPage } from \"./hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"./hooks/usePdfFormFields.js\";\nimport { usePdfHighlightMode } from \"./hooks/usePdfHighlightMode.js\";\nimport { usePdfViewerState } from \"./hooks/usePdfViewerState.js\";\n\n/** The shape of the value provided by {@link PdfViewerProvider}. */\n\nconst PdfViewerContext = /*#__PURE__*/createContext(null);\n/** Provides {@link PdfViewerContextValue} to descendant components. */\nexport function PdfViewerProvider({\n value,\n children\n}) {\n return /*#__PURE__*/React.createElement(PdfViewerContext.Provider, {\n value: value\n }, children);\n}\n\n/**\n * Returns the nearest {@link PdfViewerContextValue} from a {@link PdfViewerProvider}.\n * Throws if called outside a provider.\n */\nexport function usePdfViewerContext() {\n const ctx = useContext(PdfViewerContext);\n if (ctx == null) {\n throw new Error(\"usePdfViewerContext must be used within a PdfViewerProvider\");\n }\n return ctx;\n}\n\n/**\n * Consumer-facing setup hook analogous to react-hook-form's `useForm()`.\n * Accepts viewer options and returns a {@link PdfViewerContextValue} suitable\n * for passing to {@link PdfViewerProvider}.\n */\nexport function usePdfViewerInstance(options) {\n const viewer = usePdfViewerState({\n src: options.src,\n defaultPage: options.defaultPage,\n initialPage: options.initialPage,\n defaultScale: options.defaultScale,\n initialScale: options.initialScale,\n defaultAutoSize: options.defaultAutoSize,\n initialAutoSize: options.initialAutoSize,\n defaultSidebarOpen: options.defaultSidebarOpen,\n initialSidebarOpen: options.initialSidebarOpen,\n sidebarMode: options.sidebarMode,\n onDownload: options.onDownload\n });\n const {\n highlightModeActive,\n toggleHighlightMode\n } = usePdfHighlightMode({\n pdfViewerRef: viewer.pdfViewerRef,\n document: viewer.document,\n enabled: options.enableHighlight ?? options.highlightEnabled ?? false,\n onTextHighlight: options.onTextHighlight,\n onHighlightDelete: options.onHighlightDelete\n });\n const {\n hasFormFields,\n submitFormData\n } = usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData: options.formData,\n onFormSubmit: options.onFormSubmit,\n onFormChange: options.onFormChange\n });\n const annotations = options.annotations ?? EMPTY_ANNOTATION_ARRAY;\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n\n // `highlightEnabled` is the deprecated spelling of `enableHighlight`.\n const highlightEnabled = options.enableHighlight ?? options.highlightEnabled ?? false;\n const enableDownload = options.enableDownload ?? false;\n const enableFormSave = options.onFormSubmit != null && hasFormFields;\n const {\n onAnnotationClick,\n outlineIcons\n } = options;\n return useMemo(() => ({\n ...viewer,\n highlightEnabled,\n highlightModeActive,\n toggleHighlightMode,\n hasFormFields,\n submitFormData,\n annotations,\n annotationsByPage,\n onAnnotationClick,\n enableDownload,\n enableFormSave,\n outlineIcons\n }), [viewer, highlightEnabled, highlightModeActive, toggleHighlightMode, hasFormFields, submitFormData, annotations, annotationsByPage, onAnnotationClick, enableDownload, enableFormSave, outlineIcons]);\n}","/*\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\n// BasePdfViewer\nexport { BasePdfViewer } from \"../pdf-viewer/BasePdfViewer.js\";\n// PdfViewer building blocks\nexport { PdfViewerAnnotationLayer } from \"../pdf-viewer/components/PdfViewerAnnotationLayer.js\";\nexport { PdfViewerContent } from \"../pdf-viewer/components/PdfViewerContent.js\";\nexport { PdfViewerOutlineSidebar } from \"../pdf-viewer/components/PdfViewerOutlineSidebar.js\";\nexport { PdfViewerSearchBar } from \"../pdf-viewer/components/PdfViewerSearchBar.js\";\nexport { PdfViewerSidebar } from \"../pdf-viewer/components/PdfViewerSidebar.js\";\nexport { PdfViewerToolbar } from \"../pdf-viewer/components/PdfViewerToolbar.js\";\n\n// PdfViewer hooks — primitive\nexport { usePdfAnnotationPortals } from \"../pdf-viewer/hooks/usePdfAnnotationPortals.js\";\nexport { usePdfAnnotationsByPage } from \"../pdf-viewer/hooks/usePdfAnnotationsByPage.js\";\nexport { usePdfDocument } from \"../pdf-viewer/hooks/usePdfDocument.js\";\nexport { usePdfFormFields } from \"../pdf-viewer/hooks/usePdfFormFields.js\";\nexport { usePdfHighlightMode } from \"../pdf-viewer/hooks/usePdfHighlightMode.js\";\nexport { usePdfOutline } from \"../pdf-viewer/hooks/usePdfOutline.js\";\nexport { usePdfViewer } from \"../pdf-viewer/hooks/usePdfViewer.js\";\nexport { usePdfViewerSearch } from \"../pdf-viewer/hooks/usePdfViewerSearch.js\";\nexport { usePdfViewerSync } from \"../pdf-viewer/hooks/usePdfViewerSync.js\";\n\n// PdfViewer context\n\nexport { PdfViewerProvider, usePdfViewerContext, usePdfViewerInstance } from \"../pdf-viewer/PdfViewerContext.js\";\n\n// PdfViewer hooks — composition\nexport { usePdfViewerCore } from \"../pdf-viewer/hooks/usePdfViewerCore.js\";\nexport { usePdfViewerState } from \"../pdf-viewer/hooks/usePdfViewerState.js\";\n\n// PdfViewer (Media wrapper)\nimport { PdfViewer as _PdfViewer } from \"../pdf-viewer/PdfViewer.js\";\nimport { withOsdkMetrics } from \"../util/withOsdkMetrics.js\";\nexport const PdfViewer = withOsdkMetrics(_PdfViewer, \"PdfViewer\");"]}
|
|
1
|
+
{"version":3,"sources":["../../src/pdf-viewer/components/PdfViewerContent.tsx","../../src/pdf-viewer/PdfViewerContext.tsx","../../src/public/pdf-viewer.ts"],"names":["EMPTY_ANNOTATION_ARRAY","usePdfViewerCore","usePdfAnnotationsByPage","usePdfFormFields","useRef","useEffect","classnames","BasePdfViewer_default","React","Spin","ErrorIcon","PdfAnnotationOverlay","useContext","usePdfViewerState","usePdfHighlightMode","useMemo","PdfViewer","withOsdkMetrics"],"mappings":";;;;;;;;;;;;;;AA0BO,SAAS,gBAAA,CAAiB;AAAA,EAC/B,GAAA;AAAA,EACA,WAAA,GAAcA,wCAAA;AAAA,EACd,iBAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA,EAAc,gBAAA;AAAA,EACd,aAAA,EAAe,iBAAA;AAAA,EACf,QAAA;AAAA,EACA,YAAA;AAAA,EACA;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AAQ,gBAAA,IAAoB,KAAA;AAChF,EAAA,MAAM,cAAA,GAAiB,QAAQ,cAAA,IAAkB,KAAA;AACjD,EAAA,MAAM,cAAA,GAAiB,OAAA,CAAQ,YAAA,IAAgB,IAAA,IAAQ,aAAA;AACvD,EAAA,MAAM;AAAA,IACJ,iBAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AACJ,EAAA,OAAOa,cAAQ,OAAO;AAAA,IACpB,GAAG,MAAA;AAAA,IACH,gBAAA;AAAA,IACA,mBAAA;AAAA,IACA,mBAAA;AAAA,IACA,aAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,iBAAA;AAAA,IACA,iBAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACF,CAAA,EAAI,CAAC,MAAA,EAAQ,gBAAA,EAAkB,qBAAqB,mBAAA,EAAqB,aAAA,EAAe,cAAA,EAAgB,WAAA,EAAa,iBAAA,EAAmB,iBAAA,EAAmB,cAAA,EAAgB,cAAA,EAAgB,YAAY,CAAC,CAAA;AAC1M;;;ACjEO,IAAMC,UAAAA,GAAYC,iCAAA,CAAgBD,2BAAA,EAAY,WAAW","file":"chunk-D6KESFUY.cjs","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 { Error as ErrorIcon, Spin } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport \"pdfjs-dist/web/pdf_viewer.css\";\nimport React, { useEffect, useRef } from \"react\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"../constants.js\";\nimport { usePdfAnnotationsByPage } from \"../hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"../hooks/usePdfFormFields.js\";\nimport { usePdfViewerCore } from \"../hooks/usePdfViewerCore.js\";\nimport { PdfAnnotationOverlay } from \"./PdfAnnotationOverlay.js\";\nimport styles from \"../BasePdfViewer.module.css\";\nexport function PdfViewerContent({\n src,\n annotations = EMPTY_ANNOTATION_ARRAY,\n onAnnotationClick,\n defaultPage,\n initialPage,\n defaultScale,\n initialScale,\n onPageChange: onPageChangeProp,\n onScaleChange: onScaleChangeProp,\n formData,\n onFormChange,\n className\n}) {\n const viewer = usePdfViewerCore({\n src,\n defaultPage,\n initialPage,\n defaultScale,\n initialScale\n });\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData,\n onFormChange\n });\n\n // Use refs for callbacks to avoid firing on initial mount\n const onPageChangeRef = useRef(onPageChangeProp);\n onPageChangeRef.current = onPageChangeProp;\n const onScaleChangeRef = useRef(onScaleChangeProp);\n onScaleChangeRef.current = onScaleChangeProp;\n const isInitialMountRef = useRef(true);\n useEffect(function notifyPageChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onPageChangeRef.current?.(viewer.currentPage);\n }, [viewer.currentPage]);\n useEffect(function notifyScaleChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onScaleChangeRef.current?.(viewer.scale);\n }, [viewer.scale]);\n useEffect(function clearInitialMount() {\n isInitialMountRef.current = false;\n }, []);\n const rootClassName = classnames(styles.pdfViewer, className);\n if (viewer.loading) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, /*#__PURE__*/React.createElement(Spin, {\n className: styles.spinnerIcon\n }), \"Loading\\u2026\"));\n }\n if (viewer.error != null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.errorContainer\n }, /*#__PURE__*/React.createElement(ErrorIcon, {\n className: styles.errorIcon\n }), \"Failed to load PDF: \", viewer.error.message));\n }\n if (viewer.document == null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, \"No document\"));\n }\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.scrollContainerWrapper\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.containerRef,\n className: styles.scrollContainer\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.viewerRef,\n className: \"pdfViewer\"\n }), viewer.portalTargets.map(target => {\n const pageAnnotations = annotationsByPage[target.pageNumber] ?? EMPTY_ANNOTATION_ARRAY;\n if (pageAnnotations.length === 0) {\n return null;\n }\n return /*#__PURE__*/React.createElement(PdfAnnotationOverlay, {\n key: target.pageNumber,\n target: target,\n annotations: pageAnnotations,\n onAnnotationClick: onAnnotationClick\n });\n }))));\n}","/*\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, { createContext, useContext, useMemo } from \"react\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"./constants.js\";\nimport { usePdfAnnotationsByPage } from \"./hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"./hooks/usePdfFormFields.js\";\nimport { usePdfHighlightMode } from \"./hooks/usePdfHighlightMode.js\";\nimport { usePdfViewerState } from \"./hooks/usePdfViewerState.js\";\n\n/** The shape of the value provided by {@link PdfViewerProvider}. */\n\nconst PdfViewerContext = /*#__PURE__*/createContext(null);\n/** Provides {@link PdfViewerContextValue} to descendant components. */\nexport function PdfViewerProvider({\n value,\n children\n}) {\n return /*#__PURE__*/React.createElement(PdfViewerContext.Provider, {\n value: value\n }, children);\n}\n\n/**\n * Returns the nearest {@link PdfViewerContextValue} from a {@link PdfViewerProvider}.\n * Throws if called outside a provider.\n */\nexport function usePdfViewerContext() {\n const ctx = useContext(PdfViewerContext);\n if (ctx == null) {\n throw new Error(\"usePdfViewerContext must be used within a PdfViewerProvider\");\n }\n return ctx;\n}\n\n/**\n * Consumer-facing setup hook analogous to react-hook-form's `useForm()`.\n * Accepts viewer options and returns a {@link PdfViewerContextValue} suitable\n * for passing to {@link PdfViewerProvider}.\n */\nexport function usePdfViewerInstance(options) {\n const viewer = usePdfViewerState({\n src: options.src,\n defaultPage: options.defaultPage,\n initialPage: options.initialPage,\n defaultScale: options.defaultScale,\n initialScale: options.initialScale,\n defaultAutoSize: options.defaultAutoSize,\n initialAutoSize: options.initialAutoSize,\n defaultSidebarOpen: options.defaultSidebarOpen,\n initialSidebarOpen: options.initialSidebarOpen,\n sidebarMode: options.sidebarMode,\n onDownload: options.onDownload\n });\n const {\n highlightModeActive,\n toggleHighlightMode\n } = usePdfHighlightMode({\n pdfViewerRef: viewer.pdfViewerRef,\n document: viewer.document,\n enabled: options.enableHighlight ?? options.highlightEnabled ?? false,\n onTextHighlight: options.onTextHighlight,\n onHighlightDelete: options.onHighlightDelete\n });\n const {\n hasFormFields,\n submitFormData\n } = usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData: options.formData,\n onFormSubmit: options.onFormSubmit,\n onFormChange: options.onFormChange\n });\n const annotations = options.annotations ?? EMPTY_ANNOTATION_ARRAY;\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n\n // `highlightEnabled` is the deprecated spelling of `enableHighlight`.\n const highlightEnabled = options.enableHighlight ?? options.highlightEnabled ?? false;\n const enableDownload = options.enableDownload ?? false;\n const enableFormSave = options.onFormSubmit != null && hasFormFields;\n const {\n onAnnotationClick,\n outlineIcons\n } = options;\n return useMemo(() => ({\n ...viewer,\n highlightEnabled,\n highlightModeActive,\n toggleHighlightMode,\n hasFormFields,\n submitFormData,\n annotations,\n annotationsByPage,\n onAnnotationClick,\n enableDownload,\n enableFormSave,\n outlineIcons\n }), [viewer, highlightEnabled, highlightModeActive, toggleHighlightMode, hasFormFields, submitFormData, annotations, annotationsByPage, onAnnotationClick, enableDownload, enableFormSave, outlineIcons]);\n}","/*\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\n// BasePdfViewer\nexport { BasePdfViewer } from \"../pdf-viewer/BasePdfViewer.js\";\n// PdfViewer building blocks\nexport { PdfViewerAnnotationLayer } from \"../pdf-viewer/components/PdfViewerAnnotationLayer.js\";\nexport { PdfViewerContent } from \"../pdf-viewer/components/PdfViewerContent.js\";\nexport { PdfViewerOutlineSidebar } from \"../pdf-viewer/components/PdfViewerOutlineSidebar.js\";\nexport { PdfViewerSearchBar } from \"../pdf-viewer/components/PdfViewerSearchBar.js\";\nexport { PdfViewerSidebar } from \"../pdf-viewer/components/PdfViewerSidebar.js\";\nexport { PdfViewerToolbar } from \"../pdf-viewer/components/PdfViewerToolbar.js\";\n\n// PdfViewer hooks — primitive\nexport { usePdfAnnotationPortals } from \"../pdf-viewer/hooks/usePdfAnnotationPortals.js\";\nexport { usePdfAnnotationsByPage } from \"../pdf-viewer/hooks/usePdfAnnotationsByPage.js\";\nexport { usePdfDocument } from \"../pdf-viewer/hooks/usePdfDocument.js\";\nexport { usePdfFormFields } from \"../pdf-viewer/hooks/usePdfFormFields.js\";\nexport { usePdfHighlightMode } from \"../pdf-viewer/hooks/usePdfHighlightMode.js\";\nexport { usePdfOutline } from \"../pdf-viewer/hooks/usePdfOutline.js\";\nexport { usePdfViewer } from \"../pdf-viewer/hooks/usePdfViewer.js\";\nexport { usePdfViewerSearch } from \"../pdf-viewer/hooks/usePdfViewerSearch.js\";\nexport { usePdfViewerSync } from \"../pdf-viewer/hooks/usePdfViewerSync.js\";\n\n// PdfViewer context\n\nexport { PdfViewerProvider, usePdfViewerContext, usePdfViewerInstance } from \"../pdf-viewer/PdfViewerContext.js\";\n\n// PdfViewer hooks — composition\nexport { usePdfViewerCore } from \"../pdf-viewer/hooks/usePdfViewerCore.js\";\nexport { usePdfViewerState } from \"../pdf-viewer/hooks/usePdfViewerState.js\";\n\n// PdfViewer (Media wrapper)\nimport { PdfViewer as _PdfViewer } from \"../pdf-viewer/PdfViewer.js\";\nimport { withOsdkMetrics } from \"../util/withOsdkMetrics.js\";\nexport const PdfViewer = withOsdkMetrics(_PdfViewer, \"PdfViewer\");"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkGU4FV6A2_cjs = require('./chunk-GU4FV6A2.cjs');
|
|
4
4
|
var chunkVOROB7KJ_cjs = require('./chunk-VOROB7KJ.cjs');
|
|
5
5
|
|
|
6
6
|
// src/public/experimental/image-viewer.ts
|
|
7
7
|
var BaseImageViewer2 = chunkVOROB7KJ_cjs.BaseImageViewer;
|
|
8
|
-
var ImageViewer2 =
|
|
8
|
+
var ImageViewer2 = chunkGU4FV6A2_cjs.ImageViewer;
|
|
9
9
|
|
|
10
10
|
exports.BaseImageViewer = BaseImageViewer2;
|
|
11
11
|
exports.ImageViewer = ImageViewer2;
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
12
|
+
//# sourceMappingURL=chunk-ENIWQAQR.cjs.map
|
|
13
|
+
//# sourceMappingURL=chunk-ENIWQAQR.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/experimental/image-viewer.ts"],"names":["BaseImageViewer","ImageViewer"],"mappings":";;;;;;AAmBO,IAAMA,gBAAAA,GAAyBA;AAO/B,IAAMC,YAAAA,GAAqBA","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/experimental/image-viewer.ts"],"names":["BaseImageViewer","ImageViewer"],"mappings":";;;;;;AAmBO,IAAMA,gBAAAA,GAAyBA;AAO/B,IAAMC,YAAAA,GAAqBA","file":"chunk-ENIWQAQR.cjs","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 * as Stable from \"../image-viewer.js\";\n\n/** @deprecated Import from `@osdk/react-components/image-viewer` instead. */\nexport const BaseImageViewer = Stable.BaseImageViewer;\n\n/** @deprecated Import from `@osdk/react-components/image-viewer` instead. */\n\n/** @deprecated Import from `@osdk/react-components/image-viewer` instead. */\n\n/** @deprecated Import from `@osdk/react-components/image-viewer` instead. */\nexport const ImageViewer = Stable.ImageViewer;"]}
|
|
@@ -9,7 +9,7 @@ var chunkPA7IYPBX_cjs = require('./chunk-PA7IYPBX.cjs');
|
|
|
9
9
|
var chunkUCTQICPR_cjs = require('./chunk-UCTQICPR.cjs');
|
|
10
10
|
var chunkVOROB7KJ_cjs = require('./chunk-VOROB7KJ.cjs');
|
|
11
11
|
var chunkKFV264XS_cjs = require('./chunk-KFV264XS.cjs');
|
|
12
|
-
var
|
|
12
|
+
var chunkRST4CZUX_cjs = require('./chunk-RST4CZUX.cjs');
|
|
13
13
|
var icons = require('@blueprintjs/icons');
|
|
14
14
|
var classnames = require('classnames');
|
|
15
15
|
var React2 = require('react');
|
|
@@ -307,9 +307,9 @@ function DocumentViewer({
|
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
// src/public/document-viewer.ts
|
|
310
|
-
var DocumentViewer2 =
|
|
310
|
+
var DocumentViewer2 = chunkRST4CZUX_cjs.withOsdkMetrics(DocumentViewer, "DocumentViewer");
|
|
311
311
|
|
|
312
312
|
exports.DocumentViewer = DocumentViewer2;
|
|
313
313
|
exports.ViewerType = ViewerType;
|
|
314
|
-
//# sourceMappingURL=chunk-
|
|
315
|
-
//# sourceMappingURL=chunk-
|
|
314
|
+
//# sourceMappingURL=chunk-FU2IO5E4.cjs.map
|
|
315
|
+
//# sourceMappingURL=chunk-FU2IO5E4.cjs.map
|