@persona/design-system 0.10.12 → 0.10.13
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 +31 -0
- package/dist/{CheckboxGroupField-XSVAmESI.d.mts → CheckboxGroupField-BW_BcW3L.d.mts} +2 -2
- package/dist/CheckboxGroupField.d.mts +1 -1
- package/dist/{Combobox-DbcSss15.d.mts → Combobox-DgYwerwd.d.mts} +3 -3
- package/dist/{Combobox-BNjYEAmv.mjs → Combobox-DmFQ5cAy.mjs} +63 -51
- package/dist/Combobox-DmFQ5cAy.mjs.map +1 -0
- package/dist/Combobox.d.mts +2 -2
- package/dist/{ComboboxBase-CrFweFGi.d.mts → ComboboxBase-DoKiRjgS.d.mts} +2 -2
- package/dist/ComboboxBase.d.mts +1 -1
- package/dist/{ComboboxMultiSelect-Cp5GBGQj.d.mts → ComboboxMultiSelect-DsoIMJiZ.d.mts} +2 -2
- package/dist/ComboboxMultiSelect.d.mts +1 -1
- package/dist/{ComboboxSingleSelect-u7fK3Yvy.d.mts → ComboboxSingleSelect-CKsqOAGB.d.mts} +3 -3
- package/dist/ComboboxSingleSelect.d.mts +1 -1
- package/dist/{CompactBar-BLZZWtIE.d.mts → CompactBar-tNtY2EhN.d.mts} +2 -2
- package/dist/CompactBar.d.mts +1 -1
- package/dist/{ControlBar-B3Jn8G0k.d.mts → ControlBar-CDb6b1_6.d.mts} +5 -3
- package/dist/ControlBar.d.mts +1 -1
- package/dist/{DataTable-DdSY9mzT.mjs → DataTable-DZ0B2Zm9.mjs} +146 -77
- package/dist/DataTable-DZ0B2Zm9.mjs.map +1 -0
- package/dist/{DataTable-C1mdfmQa.d.mts → DataTable-on3vGhyi.d.mts} +31 -7
- package/dist/DataTable.d.mts +1 -1
- package/dist/{DatePicker-DiilpYQg.mjs → DatePicker-CHVYVKB-.mjs} +2 -2
- package/dist/{DatePicker-DiilpYQg.mjs.map → DatePicker-CHVYVKB-.mjs.map} +1 -1
- package/dist/DropdownButton.d.mts +1 -1
- package/dist/{DropdownMenu-CQR0U-zM.d.mts → DropdownMenu-eVY-Yjpq.d.mts} +2 -2
- package/dist/DropdownMenu.d.mts +1 -1
- package/dist/{FloatingActionBar-BUgSKimy.d.mts → FloatingActionBar-CfgjHs81.d.mts} +5 -1
- package/dist/FloatingActionBar.d.mts +1 -1
- package/dist/{FormField-yYJFkJ6R.mjs → FormField-BfVrDOY0.mjs} +4 -4
- package/dist/{FormField-yYJFkJ6R.mjs.map → FormField-BfVrDOY0.mjs.map} +1 -1
- package/dist/{HoverCopyableField-X2XfKTTh.mjs → HoverCopyableField-CJ_p3llp.mjs} +2 -2
- package/dist/{HoverCopyableField-X2XfKTTh.mjs.map → HoverCopyableField-CJ_p3llp.mjs.map} +1 -1
- package/dist/IndexTableLayout.d.mts +3 -3
- package/dist/InlineCombobox.d.mts +1 -1
- package/dist/InlineInput.d.mts +1 -1
- package/dist/{Link-B29ZMN6m.mjs → Link-Df3zJrj2.mjs} +1 -1
- package/dist/{Link-B29ZMN6m.mjs.map → Link-Df3zJrj2.mjs.map} +1 -1
- package/dist/{ListBox-4rTgr3IJ.mjs → ListBox-BRgjgUSp.mjs} +2 -2
- package/dist/{ListBox-4rTgr3IJ.mjs.map → ListBox-BRgjgUSp.mjs.map} +1 -1
- package/dist/{ListBox-ZDaitaXR.d.mts → ListBox-Bgug8YZF.d.mts} +2 -2
- package/dist/ListBox.d.mts +1 -1
- package/dist/{ListBoxField-CGvVWKyL.d.mts → ListBoxField-Cc1sX2bo.d.mts} +4 -4
- package/dist/ListBoxField.d.mts +1 -1
- package/dist/{LogicRow-Bzp5o1sL.d.mts → LogicRow-B1_35ZJT.d.mts} +2 -2
- package/dist/LogicRow.d.mts +1 -1
- package/dist/{Menu-DviYNrFd.d.mts → Menu-keVl-eKm.d.mts} +2 -2
- package/dist/Menu.d.mts +1 -1
- package/dist/{Modal-CiPFqr0L.mjs → Modal-SnCo7ecm.mjs} +3 -2
- package/dist/Modal-SnCo7ecm.mjs.map +1 -0
- package/dist/{Pii-jSYND7Cn.mjs → Pii-BYPkrBuT.mjs} +1 -1
- package/dist/{Pii-jSYND7Cn.mjs.map → Pii-BYPkrBuT.mjs.map} +1 -1
- package/dist/{Popover-CVX-dfYb.mjs → Popover-DP9DXReH.mjs} +1 -1
- package/dist/{Popover-CVX-dfYb.mjs.map → Popover-DP9DXReH.mjs.map} +1 -1
- package/dist/{Select-DsVeAyZy.d.mts → Select-CiofH5-f.d.mts} +2 -2
- package/dist/Select.d.mts +1 -1
- package/dist/SmartTextInputField.d.mts +2 -2
- package/dist/SmartTextInputListbox.d.mts +8 -3
- package/dist/{TableBox-D9NA-s9l.mjs → TableBox-RxpwflEb.mjs} +3 -3
- package/dist/{TableBox-D9NA-s9l.mjs.map → TableBox-RxpwflEb.mjs.map} +1 -1
- package/dist/TableBox.d.mts +1 -1
- package/dist/{TableBoxCell-CQOL30et.d.mts → TableBoxCell-C65YFYqj.d.mts} +4 -4
- package/dist/TableBoxCell.d.mts +1 -1
- package/dist/{TableBoxField-z0GIFeQw.d.mts → TableBoxField-CHpClgsE.d.mts} +5 -5
- package/dist/TableBoxField.d.mts +1 -1
- package/dist/{TableBoxRow-tb9-KMr9.d.mts → TableBoxRow-CK-b79uD.d.mts} +2 -2
- package/dist/TableBoxRow.d.mts +1 -1
- package/dist/{TableBoxRowActions-BZwulsFP.d.mts → TableBoxRowActions-CRaabjaY.d.mts} +2 -2
- package/dist/TableBoxRowActions.d.mts +1 -1
- package/dist/{TableControls-BXykbUBf.mjs → TableControls-DM4RddQ_.mjs} +31 -12
- package/dist/TableControls-DM4RddQ_.mjs.map +1 -0
- package/dist/{TableControls-DE6eHq8h.d.mts → TableControls-v1NmlFTW.d.mts} +4 -4
- package/dist/TableControls.d.mts +1 -1
- package/dist/{TableControlsContext-C2_2EuMh.d.mts → TableControlsContext-DHYICXxy.d.mts} +2 -2
- package/dist/TableControlsContext.d.mts +1 -1
- package/dist/{TableViewConfigurationDropdown-DE9HFXYY.d.mts → TableViewConfigurationDropdown-1nT8wneI.d.mts} +2 -2
- package/dist/TableViewConfigurationDropdown.d.mts +1 -1
- package/dist/{clientFilterUtils-2TBUC31K.d.mts → clientFilterUtils-CaF2QZBy.d.mts} +2 -2
- package/dist/clientFilterUtils.d.mts +1 -1
- package/dist/components/Combobox/index.d.mts +4 -4
- package/dist/components/Combobox/index.mjs +1 -1
- package/dist/components/DataTable/TableControls/index.d.mts +7 -7
- package/dist/components/DataTable/TableControls/index.mjs +1 -1
- package/dist/components/DataTable/index.d.mts +6 -6
- package/dist/components/DataTable/index.mjs +1 -1
- package/dist/components/DataTable/types.d.mts +1 -1
- package/dist/components/DatePicker/index.mjs +1 -1
- package/dist/components/DropdownMenu/index.d.mts +1 -1
- package/dist/components/FormField/index.d.mts +4 -4
- package/dist/components/FormField/index.mjs +1 -1
- package/dist/components/HoverCopyableField/index.mjs +1 -1
- package/dist/components/Link/index.mjs +1 -1
- package/dist/components/ListBox/index.d.mts +3 -3
- package/dist/components/ListBox/index.mjs +1 -1
- package/dist/components/Menu/index.d.mts +1 -1
- package/dist/components/Modal/index.mjs +1 -1
- package/dist/components/Pii/index.mjs +1 -1
- package/dist/components/Popover/index.mjs +1 -1
- package/dist/components/RichTextEditor/index.mjs +2 -2
- package/dist/components/Select/index.d.mts +1 -1
- package/dist/components/SmartTextInput/index.mjs +104 -48
- package/dist/components/SmartTextInput/index.mjs.map +1 -1
- package/dist/components/TableBox/index.d.mts +1 -1
- package/dist/components/TableBox/index.mjs +1 -1
- package/dist/components/VersionHistory/index.mjs +1 -1
- package/dist/fieldPickerOptions.d.mts +1 -1
- package/dist/{filters-DW7pqWv3.d.mts → filters-CShP0Jag.d.mts} +2 -2
- package/dist/filters.d.mts +1 -1
- package/dist/{helpers-BTD2kXLs.d.mts → helpers-Bbi1LyMW.d.mts} +5 -3
- package/dist/helpers.d.mts +1 -1
- package/dist/{index-B4tE0RxY.d.mts → index-3-eDlpcj.d.mts} +3 -3
- package/dist/{inputFields-DnBb3NhK.d.mts → inputFields-Dobwb4kT.d.mts} +4 -4
- package/dist/inputFields.d.mts +1 -1
- package/dist/lib/PDSProvider.d.mts +2 -1
- package/dist/lib/PDSProvider.mjs +8 -3
- package/dist/lib/PDSProvider.mjs.map +1 -1
- package/dist/lib/colorMode.d.mts +18 -7
- package/dist/lib/colorMode.mjs +47 -13
- package/dist/lib/colorMode.mjs.map +1 -1
- package/dist/lib/schemaOptions.mjs +1 -1
- package/dist/lib/schemaOptions.mjs.map +1 -1
- package/dist/patterns/IndexTableLayout/index.mjs +1 -1
- package/dist/patterns/WizardModal/index.mjs +1 -1
- package/dist/{types-NO2GRlM-.d.mts → types-BTaKBrxG.d.mts} +2 -2
- package/dist/{types-Dws2XDz2.d.mts → types-CUnL8JJj.d.mts} +6 -4
- package/dist/types5.d.mts +1 -1
- package/dist/useColumnConfiguration.d.mts +2 -2
- package/dist/useComboboxFooterAction.d.mts +1 -1
- package/dist/{useTableColumns-tITjHasE.d.mts → useTableColumns-BuxN7Usm.d.mts} +17 -2
- package/dist/useTableColumns.d.mts +1 -1
- package/dist/useTruncation.d.mts +1 -1
- package/dist/utils4.d.mts +1 -1
- package/dist/withDisabledReason.d.mts +19 -0
- package/llms.txt +4 -3
- package/package.json +4 -12
- package/skills/ui-authoring/COMPONENTS.md +0 -1
- package/skills/ui-authoring/PATTERNS.md +0 -64
- package/skills/ui-authoring/TOKENS.md +14 -25
- package/dist/ChartFrame.d.mts +0 -61
- package/dist/ChartLegend.d.mts +0 -60
- package/dist/ChartPopover.d.mts +0 -155
- package/dist/Combobox-BNjYEAmv.mjs.map +0 -1
- package/dist/DataTable-DdSY9mzT.mjs.map +0 -1
- package/dist/Modal-CiPFqr0L.mjs.map +0 -1
- package/dist/TableControls-BXykbUBf.mjs.map +0 -1
- package/dist/chartColors.d.mts +0 -92
- package/dist/chartFrameLayout.d.mts +0 -46
- package/dist/components/Chart/index.d.mts +0 -9
- package/dist/components/Chart/index.mjs +0 -680
- package/dist/components/Chart/index.mjs.map +0 -1
- package/dist/useChartColors.d.mts +0 -30
- package/dist/useChartSeriesVisibility.d.mts +0 -22
- package/dist/useChartStyles.d.mts +0 -108
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaOptions.mjs","names":[],"sources":["../../src/lib/schemaOptions.ts"],"sourcesContent":["import { compact, flatten, last, sortBy, trim } from 'lodash-es';\n\nimport { assertNever } from './assertNever';\nimport {\n JsonSchemaAllTypes,\n type JsonSchemaCustomTypes,\n JsonSchemaStringifiableTypes,\n EMPTY_JSON_SCHEMA_OBJECT,\n getNonNullableRefSchema,\n genericArrayItemSchema,\n getNonNullableType,\n isConvertedTypeSchema,\n isFileType,\n isFunctionSchema,\n isGenericParameterSchema,\n isJsonSchemaArray,\n isJsonSchemaDate,\n isJsonSchemaDateTime,\n isJsonSchemaObject,\n isJsonSchemaRef,\n isJsonSchemaString,\n isJsonType,\n isPrecedingSchema,\n type JsonSchema,\n type JsonSchemaArray,\n type JsonSchemaBasicTypes,\n type JsonSchemaObject,\n JsonSchemaTypes,\n type JsonSchemaObjectKey,\n} from './jsonSchema';\nimport { getJsonSchemaType } from './jsonSchemaType';\nimport {\n appendedMethodChain,\n type Chain,\n EMPTY_METHOD_CHAIN,\n isIdentifierNode,\n isFunctionNode,\n isStringNode,\n isValid,\n type MethodChainNode,\n MethodChainNodeTypes,\n methodChainToString,\n parseMethodChain,\n parseWithPartialOption,\n type StringNode,\n} from './methodChain';\nimport type { FunctionJsonSchema, ObjectSchemaMap } from './objectSchemaTypes';\nimport {\n getPlatformObjectTypeFromJsonSchema,\n getSchemaId,\n MERGED_SCHEMA_ID,\n PrimitiveSchemaId,\n resolveJssRef,\n} from './platformObject';\n\ntype VariableSchemaObject = {\n value: string;\n schema?: JsonSchema | null;\n isVariable?: boolean;\n};\n\nconst fullNodeName = (node: MethodChainNode): string =>\n `${node.type === MethodChainNodeTypes.CustomFunction ? '@' : ''}${node.name}`;\n\nexport type Option = {\n label: string;\n value: string;\n property: string;\n schema: JsonSchema | FunctionJsonSchema;\n methodChain: Chain | null;\n utility?: boolean;\n workflowObjectKey?: string;\n isVariable?: boolean;\n};\n\nconst SCHEMA_PATH_PATTERN = /\\/schema\\/([a-z][a-z0-9-_]*)/i;\n\n/**\n * Extracts the top-level platform-object key from a schema's `$ref`/`$id`/\n * `objectKey`/`objectType.const` markers. Collapses subtypes to their root\n * (`/schema/verification/document/merged` -> `verification`) because callers\n * compare against top-level `ApiModel` values.\n */\nexport const extractPlatformObjectKey = (\n schema: JsonSchema | null | undefined,\n platformObjectJsonSchema: ObjectSchemaMap = {},\n): string | null => {\n if (!schema) {\n return null;\n }\n if (isJsonSchemaRef(schema)) {\n const refMatch = schema.$ref?.match(SCHEMA_PATH_PATTERN);\n if (refMatch) {\n return refMatch[1];\n }\n return extractPlatformObjectKey(\n resolveJssRef(schema, platformObjectJsonSchema),\n platformObjectJsonSchema,\n );\n }\n if ('$id' in schema && typeof schema.$id === 'string') {\n const idMatch = schema.$id.match(SCHEMA_PATH_PATTERN);\n if (idMatch) {\n return idMatch[1];\n }\n }\n // Serialized PLOB columns carry `objectKey` on a scalar schema (no `$ref`), so\n // read it regardless of `type`, collapsing subtypes to root like the `$ref` branch.\n if ('objectKey' in schema && typeof schema.objectKey === 'string') {\n return schema.objectKey.split('/')[0];\n }\n return getPlatformObjectTypeFromJsonSchema(schema);\n};\n\ntype PossibleType = JsonSchemaTypes | JsonSchemaCustomTypes | JsonSchemaObjectKey;\ntype PossibleArrayType = JsonSchemaBasicTypes | JsonSchemaTypes.Object | JsonSchemaObjectKey;\n\nconst isMatchingType = (\n schema: JsonSchema,\n allowedTypes: PossibleType[],\n allowedArrayTypes: PossibleArrayType[],\n) => {\n if (allowedTypes.length === 0) {\n return true;\n }\n const jsonSchemaType = getJsonSchemaType(schema);\n // If strings are allowed and the field is string-able, let it through.\n if (\n allowedTypes.some((schemaType) => schemaType === JsonSchemaTypes.String) &&\n JsonSchemaStringifiableTypes.some((schemaType) => schemaType === jsonSchemaType)\n ) {\n return true;\n } else if (jsonSchemaType === JsonSchemaAllTypes.Array) {\n const itemsSchema = 'items' in schema ? schema.items : null;\n if (\n !allowedTypes.includes(JsonSchemaAllTypes.Array) ||\n // Don't recurse on array, otherwise we risk matching on objects within the array\n (allowedArrayTypes?.length &&\n !allowedArrayTypes.some((schemaType) => schemaType === getJsonSchemaType(itemsSchema)))\n ) {\n return false;\n }\n } else if (\n jsonSchemaType !== JsonSchemaAllTypes.Object &&\n !allowedTypes.some((schemaType) => schemaType === jsonSchemaType)\n ) {\n return false;\n }\n return true;\n};\n\n// isValidOptionHelper returns true if the schema provided is (in order of precedence)\n// 1) not a disallowed by name\n// AND 2) not a disallowed type\n// AND 3) allowed field by name (either explicitly or implicitly)\n// at each level (we recurse down for object types), we check that the fields at the level fit the above 1,2 and 3\n//\n// 1) is straight forward. if a field is named as disallowed it has the most precedence\n// 2) the field is disallowed by type if the allowedTypes are specified AND\n// - if the field is an array, then\n// - arrays are in allowedTypes\n// - AND (its `items` type is in `allowedArrayTypes` OR `allowedArrayTypes` is empty)\n// - if the field is an object, we do nothing since the recursion is handled at the `isValidOptionHelper` level\n// - else, the field type appears in allowedTypes\n// 3) we can be allowed by name\n// - explicitly, which means the field is named explicitly as an allowedFieldPath (this has precedence)\n// - implicitly, which means that there are no fields explicitly named in allowedFieldPath\n// - an object field can be allowed implicitly if it has at least one valid children\nconst isValidOptionHelper = (\n schema: JsonSchema,\n allowedFieldPaths: Set<string>,\n disallowedFieldPaths: Set<string>,\n allowedTypes: PossibleType[],\n allowedArrayTypes: PossibleArrayType[],\n path: string[],\n platformObjectJsonSchema: ObjectSchemaMap,\n traversedSchemaIds = new Set(),\n): boolean => {\n const resolvedSchema = isJsonSchemaRef(schema)\n ? resolveJssRef(schema, platformObjectJsonSchema)\n : schema;\n\n if (resolvedSchema.$id) {\n if (traversedSchemaIds.has(resolvedSchema.$id)) {\n // We've already traversed this schema ID, which there were no\n // valid types found for it, so return false to avoid infinite loops\n return false;\n } else {\n // If we haven't traversed this schema ID yet, add it to the set\n // This allows us to avoid infinite loops when resolving references\n // in recursive schemas\n traversedSchemaIds.add(resolvedSchema.$id);\n }\n }\n const dotPath = path.join('.');\n if (disallowedFieldPaths.has(dotPath)) {\n return false;\n }\n if (!isMatchingType(resolvedSchema, allowedTypes, allowedArrayTypes)) {\n return false;\n }\n if (allowedFieldPaths.has(dotPath)) {\n return true;\n }\n // if we are here it means\n // - our type is valid\n // - we are not disallowed\n // - we are not explicitly allowed\n // if we are here, we are only valid if\n // - we are an object and at least one of our properties are valid\n // OR, we are not an object and allowedFieldPaths is empty\n const jsonSchemaType = getJsonSchemaType(resolvedSchema);\n if (jsonSchemaType === JsonSchemaTypes.Object) {\n // A schemaless JSON field is an opaque leaf, so it has no child to qualify it as an option.\n if ('fieldType' in resolvedSchema && isJsonType(resolvedSchema.fieldType)) {\n return allowedFieldPaths.size === 0;\n }\n return (\n 'properties' in resolvedSchema &&\n resolvedSchema.properties != null &&\n Object.entries(resolvedSchema.properties).some(([prop, propSchema]) =>\n isValidOptionHelper(\n propSchema,\n allowedFieldPaths,\n disallowedFieldPaths,\n allowedTypes,\n allowedArrayTypes,\n [...path, prop],\n platformObjectJsonSchema,\n traversedSchemaIds,\n ),\n )\n );\n }\n return allowedFieldPaths.size === 0;\n};\n\nexport const isValidOption = (\n schema: JsonSchema,\n allowedFieldPaths: string[],\n disallowedFieldPaths: string[],\n allowedTypes: PossibleType[],\n allowedArrayTypes: PossibleArrayType[],\n path: string[] = [],\n platformObjectJsonSchema: ObjectSchemaMap,\n): boolean => {\n const allowedFieldPathsSet =\n allowedFieldPaths == null ? new Set<string>() : new Set<string>(allowedFieldPaths);\n const disallowedFieldPathsSet =\n disallowedFieldPaths == null ? new Set<string>() : new Set<string>(disallowedFieldPaths);\n if (\n allowedFieldPathsSet.size === 0 &&\n disallowedFieldPathsSet.size === 0 &&\n allowedTypes.length === 0 &&\n allowedArrayTypes.length === 0\n ) {\n return true;\n }\n return isValidOptionHelper(\n schema,\n allowedFieldPathsSet,\n disallowedFieldPathsSet,\n allowedTypes ?? [],\n allowedArrayTypes ?? [],\n path,\n platformObjectJsonSchema,\n );\n};\n\nconst buildSchemaOptionsFor = (rootSchema: JsonSchemaObject, baseChain: Chain | null) =>\n Object.entries(rootSchema?.properties ?? {}).map(([property, propSchema]) => {\n const appended = appendedMethodChain(baseChain ?? EMPTY_METHOD_CHAIN, property);\n return {\n label: methodChainToString(appended),\n value: methodChainToString(appended),\n property,\n schema: propSchema,\n methodChain: appended,\n workflowObjectKey: 'objectKey' in propSchema ? propSchema.objectKey : undefined,\n isVariable: 'isVariable' in propSchema ? propSchema.isVariable : false,\n };\n });\n\nconst getSupportedArrayFunctions = (\n schema: JsonSchema,\n arrayPrimitive: JsonSchemaObject,\n): string[] => {\n if (isJsonSchemaArray(schema) && schema['supportedFunctions']) {\n return schema['supportedFunctions'];\n }\n return arrayPrimitive['baseSupportedFunctions'] ?? [];\n};\n\nexport const getSchemaOptions = ({\n option,\n optionFilters,\n platformObjectJsonSchema,\n primitiveUtilities,\n digPrimitives = false,\n}: {\n option: Pick<Option, 'schema' | 'methodChain'>;\n optionFilters?: OptionFilters;\n platformObjectJsonSchema: ObjectSchemaMap;\n primitiveUtilities: ObjectSchemaMap;\n digPrimitives?: boolean;\n}): Option[] => {\n const { schema, methodChain } = option;\n const nullableRefSchema = getNonNullableRefSchema(schema);\n const baseSchema = nullableRefSchema ?? schema;\n const refResolved = isJsonSchemaRef(baseSchema)\n ? resolveJssRef(baseSchema, platformObjectJsonSchema)\n : baseSchema;\n const nonNullable = refResolved && getNonNullableType(refResolved);\n const resolvedSchema = nonNullable\n ? ({ ...refResolved, type: nonNullable } as JsonSchema)\n : refResolved;\n const schemaType = getJsonSchemaType(resolvedSchema);\n\n const schemaOptions = (() => {\n switch (schemaType) {\n case JsonSchemaAllTypes.Object:\n return buildSchemaOptionsFor(resolvedSchema as JsonSchemaObject, methodChain);\n case JsonSchemaAllTypes.Array:\n case JsonSchemaAllTypes.MultiEnum: {\n if (!digPrimitives) {\n return [];\n }\n const arrayPrimitive = primitiveUtilities[PrimitiveSchemaId.Array];\n if (!arrayPrimitive) {\n return [];\n }\n const allOptions = buildSchemaOptionsFor(arrayPrimitive, methodChain);\n const supported = getSupportedArrayFunctions(resolvedSchema, arrayPrimitive);\n return allOptions.filter((opt) => supported.includes(opt.property));\n }\n case JsonSchemaAllTypes.String:\n return digPrimitives\n ? buildSchemaOptionsFor(primitiveUtilities[PrimitiveSchemaId.String], methodChain)\n : [];\n case JsonSchemaAllTypes.Enum: {\n if (digPrimitives && isJsonSchemaString(resolvedSchema)) {\n return buildSchemaOptionsFor(primitiveUtilities[PrimitiveSchemaId.String], methodChain);\n }\n return [];\n }\n case JsonSchemaAllTypes.File:\n return digPrimitives\n ? buildSchemaOptionsFor(primitiveUtilities[PrimitiveSchemaId.File], methodChain)\n : [];\n // Integer/Number share a single /schema/number bucket — see the collapse\n // in `getPrimitiveSchemaId` and the backend `JSON_TYPE_TO_SCHEMA_ID`. The\n // default mock primitives don't ship utilities for these, so the lookup\n // returns CCFs only (the only properties merged in by `useChain`).\n case JsonSchemaAllTypes.Integer:\n case JsonSchemaAllTypes.Number:\n return digPrimitives && primitiveUtilities[PrimitiveSchemaId.Number]\n ? buildSchemaOptionsFor(primitiveUtilities[PrimitiveSchemaId.Number], methodChain)\n : [];\n case JsonSchemaAllTypes.Boolean:\n return digPrimitives && primitiveUtilities[PrimitiveSchemaId.Boolean]\n ? buildSchemaOptionsFor(primitiveUtilities[PrimitiveSchemaId.Boolean], methodChain)\n : [];\n // Date and Datetime are distinct buckets, mirroring the backend\n // `PlatformPrimitive::Date` / `PlatformPrimitive::Datetime` split. A\n // calendar-only Date receiver shouldn't surface CCFs authored against\n // timezone-bearing Datetimes (or vice versa).\n case JsonSchemaAllTypes.Date:\n return digPrimitives && primitiveUtilities[PrimitiveSchemaId.Date]\n ? buildSchemaOptionsFor(primitiveUtilities[PrimitiveSchemaId.Date], methodChain)\n : [];\n case JsonSchemaAllTypes.Datetime:\n return digPrimitives && primitiveUtilities[PrimitiveSchemaId.Datetime]\n ? buildSchemaOptionsFor(primitiveUtilities[PrimitiveSchemaId.Datetime], methodChain)\n : [];\n case JsonSchemaAllTypes.GroupedEnum:\n case JsonSchemaAllTypes.Null:\n case JsonSchemaAllTypes.Relation:\n case JsonSchemaAllTypes.MaskedString:\n case JsonSchemaAllTypes.Unknown:\n return [];\n default:\n assertNever(schemaType);\n }\n })();\n\n // After a possibly-null value, offer a CCF only when its receiver schema\n // accepts null. Non-CCF members stay for nullable `type` arrays but not\n // for a nullable `$ref | null` union, whose member paths `nextLinkSchema`\n // cannot resolve.\n const possiblyNull = nullableRefSchema != null || nonNullable != null;\n const nullSafeOptions = possiblyNull\n ? schemaOptions.filter((opt) => {\n if (isFunctionSchema(opt.schema) && opt.schema.codeChainFunctionToken != null) {\n return opt.schema.acceptsNullReceiver === true;\n }\n return nullableRefSchema == null;\n })\n : schemaOptions;\n\n const containsFilters = optionFilters && !!flatten(compact(Object.values(optionFilters))).length;\n const finalOptions = containsFilters\n ? filterForAllowedSchemaOptions(nullSafeOptions, optionFilters, platformObjectJsonSchema)\n : nullSafeOptions;\n return sortBy(finalOptions, (opt: Option) => opt.property.replace(/^@/, '')) as Option[];\n};\n\nexport const formatDisplayValue = (value: any) => {\n return typeof value === 'string' ? value : trim(JSON.stringify(value, null, 1), '\"');\n};\n\n/**\n * Resolves the schema at a dotted path (e.g. \"account.birthDate\").\n * Tries direct key lookup first, then traverses into nested object .properties by path part.\n * Normalizes kebab/snake at each level for key lookup.\n */\nexport function getSchemaByPath(\n properties: Record<string, JsonSchema> | null | undefined,\n path: string,\n): JsonSchema | undefined {\n if (!properties || !path) {\n return undefined;\n }\n\n const lookup = (props: Record<string, JsonSchema>, key: string): JsonSchema | undefined =>\n props[key] ?? props[key.replace(/_/g, '-')] ?? props[key.replace(/-/g, '_')];\n\n const byFullPath = lookup(properties, path);\n if (byFullPath != null) {\n return byFullPath;\n }\n\n const i = path.indexOf('.');\n if (i === -1) {\n return undefined;\n }\n const nestedKey = path.slice(0, i);\n const rest = path.slice(i + 1);\n const next = lookup(properties, nestedKey);\n if (next == null || !isJsonSchemaObject(next) || !next.properties) {\n return undefined;\n }\n return getSchemaByPath(next.properties, rest);\n}\n\nconst parseMethodChainForJSS = (path: string): Chain | null => {\n const { methodChain, partial, valid } = parseWithPartialOption(path);\n if (!valid) {\n return null;\n }\n\n if (partial.length > 0) {\n return appendedMethodChain(methodChain, partial);\n }\n\n return methodChain;\n};\n\n/**\n * The schema resolved for a key admitted by `additionalProperties: true`: valid, with an unknown\n * type. Compared by identity (e.g. by the SmartTextInput validator), so do not copy it.\n */\nexport const UNTYPED_ADDITIONAL_PROPERTY_SCHEMA: JsonSchema = Object.freeze({});\n\n/**\n * Resolves an identifier that is not a declared property of `currentSchema` through the object's\n * `additionalProperties`: its schema when one is given, `UNTYPED_ADDITIONAL_PROPERTY_SCHEMA` when\n * it is `true`, and null when extra keys are not allowed.\n */\nconst additionalPropertySchema = (\n currentSchema: JsonSchema | null,\n link: MethodChainNode,\n platformObjectJsonSchema: ObjectSchemaMap,\n): JsonSchema | null => {\n if (currentSchema == null || !isIdentifierNode(link)) {\n return null;\n }\n const resolved = isJsonSchemaRef(currentSchema)\n ? resolveJssRef(currentSchema, platformObjectJsonSchema)\n : currentSchema;\n if (!isJsonSchemaObject(resolved) || resolved.properties?.[link.name] != null) {\n return null;\n }\n const { additionalProperties } = resolved;\n if (additionalProperties === true) {\n return UNTYPED_ADDITIONAL_PROPERTY_SCHEMA;\n }\n return typeof additionalProperties === 'object' && additionalProperties != null\n ? additionalProperties\n : null;\n};\n\nexport const getSchemaForFieldPath = ({\n path,\n initialSchema,\n platformObjectJsonSchema = {},\n primitiveUtilities = {},\n}: {\n path: string;\n initialSchema: JsonSchema;\n platformObjectJsonSchema?: ObjectSchemaMap;\n primitiveUtilities?: ObjectSchemaMap;\n}): {\n schema: JsonSchema | null;\n propertyName: string | null;\n} => {\n if (!initialSchema || (!('type' in initialSchema) && !('$ref' in initialSchema))) {\n return { schema: null, propertyName: null };\n }\n\n const schema: JsonSchema = isJsonSchemaRef(initialSchema)\n ? resolveJssRef(initialSchema, platformObjectJsonSchema)\n : initialSchema;\n\n if (path === '' || !isValid(path)) {\n return { schema: null, propertyName: null };\n }\n const methodChain = parseMethodChain(path);\n if (!methodChain) {\n return { schema: null, propertyName: null };\n }\n const result = methodChain.links.reduce<JsonSchema | null>((currentSchema, link) => {\n return (\n nextLinkSchema({\n currentSchema,\n nextLink: link,\n platformObjectJsonSchema,\n primitiveUtilities,\n }) ?? additionalPropertySchema(currentSchema, link, platformObjectJsonSchema)\n );\n }, schema);\n\n const propertyName = result ? last(methodChain.links)?.name || null : null;\n return { schema: result, propertyName };\n};\n\n/**\n * Get the schema for a variable path from usableObjects.\n */\nexport const getSchemaForVariablePath = ({\n path,\n usableObjects,\n}: {\n path: string;\n usableObjects: VariableSchemaObject[];\n}): {\n schema: JsonSchema | null;\n propertyName: string | null;\n} => {\n // just variables\n const syntheticSchema: JsonSchemaObject = {\n type: JsonSchemaTypes.Object,\n properties: Object.fromEntries(\n usableObjects\n .filter((obj) => obj.schema != null && obj.isVariable === true)\n .map((obj) => [obj.value, obj.schema!]),\n ),\n };\n\n return getSchemaForFieldPath({\n path,\n initialSchema: syntheticSchema,\n });\n};\n\nconst getPrimitiveSchemaId = (schema: JsonSchema): string | null => {\n if (!('type' in schema)) {\n return null;\n }\n // The object/date/date-time guards match an exact scalar `type`, so narrow an exactly-nullable\n // union to its non-null member first. The cast mirrors `nextLinkSchema`'s receiver narrowing:\n // spreading a union member with a different `type` can't be expressed as a `JsonSchema` member.\n const nonNullableType = Array.isArray(schema.type) ? getNonNullableType(schema) : null;\n const narrowedSchema = nonNullableType\n ? ({ ...schema, type: nonNullableType } as JsonSchema)\n : schema;\n // File type has special naming: 'file' -> '/schema/field/file'\n // because the backend uses Field::File.name.underscore = 'field/file'\n // File fields have type: 'object' with fieldType: 'file'\n if (isJsonSchemaObject(narrowedSchema) && isFileType(narrowedSchema.fieldType)) {\n return PrimitiveSchemaId.File;\n }\n // Date and Datetime are encoded as `{type: 'string', format: 'date'|'date-time'}`.\n // Check before the generic string branch so date receivers don't bucket as String.\n if (isJsonSchemaDate(narrowedSchema)) {\n return PrimitiveSchemaId.Date;\n }\n if (isJsonSchemaDateTime(narrowedSchema)) {\n return PrimitiveSchemaId.Datetime;\n }\n const type = Array.isArray(schema.type) ? nonNullableType : schema.type;\n if (!type) {\n return null;\n }\n // Integer and Number share one CCF bucket — mirrors the backend collapse\n // in JSON_TYPE_TO_SCHEMA_ID. A CCF authored against a Number receiver\n // fires for both .length-style integers and float-typed values.\n if (type === JsonSchemaTypes.Integer || type === JsonSchemaTypes.Number) {\n return PrimitiveSchemaId.Number;\n }\n if (type === JsonSchemaTypes.Boolean) {\n return PrimitiveSchemaId.Boolean;\n }\n return getSchemaId(type);\n};\n\nexport const nextLinkSchema = ({\n currentSchema,\n nextLink,\n platformObjectJsonSchema,\n primitiveUtilities,\n}: {\n currentSchema: JsonSchema | null;\n nextLink: MethodChainNode;\n platformObjectJsonSchema: ObjectSchemaMap;\n primitiveUtilities: ObjectSchemaMap;\n}): JsonSchema | null => {\n if (!currentSchema) {\n return null;\n }\n // Runtime dispatches a typed null only to a CCF whose receiver schema\n // accepts null, so a nullable value resolves only through such CCFs.\n if (nextLink.type === MethodChainNodeTypes.CustomFunction) {\n const unwrapped = getNonNullableRefSchema(currentSchema);\n const nonNullType = unwrapped ? null : getNonNullableType(currentSchema);\n const receiver =\n unwrapped ?? (nonNullType ? ({ ...currentSchema, type: nonNullType } as JsonSchema) : null);\n if (receiver) {\n const fn = getFunctionSchemaForNode({\n parentSchema: currentSchema,\n functionName: fullNodeName(nextLink),\n isCustomFunction: true,\n platformObjectJsonSchema,\n primitiveUtilities,\n });\n if (fn?.acceptsNullReceiver !== true) {\n return null;\n }\n currentSchema = receiver;\n }\n }\n if (isJsonSchemaRef(currentSchema)) {\n currentSchema = resolveJssRef(currentSchema, platformObjectJsonSchema);\n } else if (isJsonSchemaArray(currentSchema) && isJsonSchemaRef(currentSchema.items)) {\n currentSchema = {\n ...currentSchema,\n items: {\n ...resolveJssRef(currentSchema.items, platformObjectJsonSchema),\n },\n };\n }\n if (!('type' in currentSchema)) {\n return null;\n }\n\n const schemaId = getPrimitiveSchemaId(currentSchema);\n if (schemaId && schemaId in primitiveUtilities) {\n const utilityReturnType = getPrimitiveUtilitiesReturnSchema(\n currentSchema,\n nextLink,\n primitiveUtilities[schemaId],\n );\n if (utilityReturnType) {\n return utilityReturnType;\n }\n }\n if ('properties' in currentSchema) {\n const propertySchema = currentSchema.properties[fullNodeName(nextLink)];\n if (propertySchema && isFunctionSchema(propertySchema)) {\n return propertySchema.properties.returnType;\n }\n return propertySchema ?? null;\n }\n return null;\n};\n\n/**\n * Returns the FunctionJsonSchema for `functionName` within `parentSchema`, checking both\n * primitive utilities (e.g. array/string methods) and direct object properties.\n * Returns null if not found or not a function schema.\n */\nexport const getFunctionSchemaForNode = ({\n parentSchema,\n functionName,\n isCustomFunction,\n platformObjectJsonSchema,\n primitiveUtilities,\n}: {\n parentSchema: JsonSchema;\n functionName: string;\n isCustomFunction: boolean;\n platformObjectJsonSchema: ObjectSchemaMap;\n primitiveUtilities: ObjectSchemaMap;\n}): FunctionJsonSchema | null => {\n if (isCustomFunction) {\n parentSchema = getNonNullableRefSchema(parentSchema) ?? parentSchema;\n }\n if (isJsonSchemaRef(parentSchema)) {\n parentSchema = resolveJssRef(parentSchema, platformObjectJsonSchema);\n }\n\n const schemaId = getPrimitiveSchemaId(parentSchema);\n if (schemaId && schemaId in primitiveUtilities) {\n const utilitySchema = primitiveUtilities[schemaId].properties[functionName];\n if (utilitySchema && isFunctionSchema(utilitySchema)) {\n return utilitySchema;\n }\n }\n\n if (isJsonSchemaObject(parentSchema) && functionName in parentSchema.properties) {\n const propSchema = parentSchema.properties[functionName];\n if (isFunctionSchema(propSchema)) {\n return propSchema;\n }\n }\n\n return null;\n};\n\n// When the result is an array of platform objects (identified by objectKey on items),\n// inject a $ref so the schema structure matches has_many associations.\n// This ensures consistent operator options in conditionals.\nconst injectRefForPlatformObjectArray = (schema: JsonSchema | null): JsonSchema | null => {\n if (\n schema &&\n isJsonSchemaArray(schema) &&\n isJsonSchemaObject(schema.items) &&\n 'objectKey' in schema.items &&\n schema.items.objectKey\n ) {\n const schemaId = getSchemaId(schema.items.objectKey, MERGED_SCHEMA_ID);\n return {\n ...schema,\n items: {\n ...schema.items,\n $ref: schemaId,\n },\n };\n }\n return schema;\n};\n\nconst getPrimitiveUtilitiesReturnSchema = (\n object: JsonSchema,\n node: MethodChainNode,\n schema: JsonSchemaObject<JsonSchema | FunctionJsonSchema>,\n): JsonSchema | null => {\n const name = fullNodeName(node);\n if (!(name in schema.properties)) {\n return null;\n }\n\n const utilitySchema = schema.properties[name];\n\n const returnSchema = isFunctionSchema(utilitySchema)\n ? utilitySchema.properties.returnType\n : utilitySchema;\n\n const itemSchema = genericArrayItemSchema(object, returnSchema);\n if (itemSchema) {\n return itemSchema;\n }\n\n if (isPrecedingSchema(returnSchema)) {\n return object;\n }\n\n if (\n isConvertedTypeSchema(returnSchema) &&\n isFunctionNode(node) &&\n node.params[returnSchema.position] &&\n isStringNode(node.params[returnSchema.position])\n ) {\n const stringNode = node.params[returnSchema.position] as StringNode;\n return returnSchema.schemaByValue[stringNode.value] ?? EMPTY_JSON_SCHEMA_OBJECT;\n }\n\n if (\n isGenericParameterSchema(returnSchema) &&\n isFunctionNode(node) &&\n node.params[returnSchema.position] &&\n isStringNode(node.params[returnSchema.position])\n ) {\n const stringNode = node.params[returnSchema.position] as StringNode;\n const objectSchema = isJsonSchemaArray(object) ? object.items : object;\n if (isJsonSchemaObject(objectSchema)) {\n const path = stringNode.value.split('.');\n const resultSchema = path.reduce<JsonSchema | null>((schema, key) => {\n if (schema == null || !isJsonSchemaObject(schema) || !schema.properties[key]) {\n return null;\n }\n return schema.properties[key];\n }, objectSchema);\n\n return injectRefForPlatformObjectArray(resultSchema);\n }\n }\n\n return 'genericType' in returnSchema ? EMPTY_JSON_SCHEMA_OBJECT : returnSchema;\n};\n\n/**\n * @param path\n * @param allowedFieldPaths - can be a complete path to a base type field\n * (e.g. 'data.some.string_field'), or a partial path to an object ('data')\n * @param fieldPathsAreStrictMatch - true if we only want to match exact paths in allowedFieldPaths and disallowedFieldPaths\n */\nconst isAllowedPath = (path: string, allowedFieldPaths: string[]) => {\n return allowedFieldPaths.some((fieldPath) => {\n const valueIsPartialMatch = fieldPath.startsWith(path);\n const valueIsNestedProp = path.startsWith(`${fieldPath}.`);\n return valueIsPartialMatch || valueIsNestedProp;\n });\n};\n\n/**\n * @param path\n * @param disallowedFieldPaths - can be a complete path to a base type field\n * (e.g. 'data.some.string_field'), or a partial path to an object ('data')\n */\nconst isDisallowedPath = (path: string, disallowedFieldPaths: string[]) => {\n return disallowedFieldPaths.some((fieldPath) => {\n const valueIsMatch = fieldPath === path;\n const valueIsNestedProp = path.startsWith(`${fieldPath}.`);\n return valueIsMatch || valueIsNestedProp;\n });\n};\n\nexport const isTypeMatch = ({\n fieldJsonSchema,\n types,\n platformObjectJsonSchema = {},\n arrayTypes,\n traversedSchemaIds = new Set(),\n}: {\n fieldJsonSchema: JsonSchema;\n types: PossibleType[];\n platformObjectJsonSchema: ObjectSchemaMap;\n arrayTypes?: PossibleArrayType[];\n traversedSchemaIds?: Set<string>;\n}): boolean => {\n const resolvedSchema = isJsonSchemaRef(fieldJsonSchema)\n ? resolveJssRef(fieldJsonSchema, platformObjectJsonSchema)\n : fieldJsonSchema;\n\n if (resolvedSchema.$id) {\n if (traversedSchemaIds.has(resolvedSchema.$id)) {\n // We've already traversed this schema ID, which there were no\n // valid types found for it, so return false to avoid infinite loops\n return false;\n } else {\n // If we haven't traversed this schema ID yet, add it to the set\n // This allows us to avoid infinite loops when resolving references\n // in recursive schemas\n traversedSchemaIds.add(resolvedSchema.$id);\n }\n }\n\n const fieldJsonSchemaType = getJsonSchemaType(resolvedSchema);\n switch (fieldJsonSchemaType) {\n case JsonSchemaAllTypes.Object: {\n const objectSchema = resolvedSchema as JsonSchemaObject;\n // For generic JsonSchemaObjectKey such as 'report' or 'verification', we match on subtypes\n // like 'business-watchlist' as well; otherwise, generics don't show anything\n const isObjectKeyOfType = (type: JsonSchemaObjectKey) =>\n objectSchema.objectKey &&\n types.includes(type) &&\n objectSchema.objectKey.split('/')[0] === type;\n\n if (\n types.includes(JsonSchemaTypes.Object) ||\n (objectSchema.objectKey && types.includes(objectSchema.objectKey)) ||\n isObjectKeyOfType('report') ||\n isObjectKeyOfType('verification')\n ) {\n return true;\n }\n\n return Object.values(objectSchema.properties || {}).some((propJsonSchema) =>\n isTypeMatch({\n fieldJsonSchema: propJsonSchema,\n types,\n platformObjectJsonSchema,\n arrayTypes,\n traversedSchemaIds: traversedSchemaIds,\n }),\n );\n }\n case JsonSchemaAllTypes.Array: {\n const arraySchema = resolvedSchema as JsonSchemaArray;\n const itemSchema = isJsonSchemaRef(arraySchema.items)\n ? resolveJssRef(arraySchema.items, platformObjectJsonSchema)\n : arraySchema.items;\n return (\n types.includes(JsonSchemaAllTypes.Array) &&\n // Don't recurse on array, otherwise we risk matching on objects within the array\n !!arrayTypes &&\n arrayTypes.some(\n (schemaType) =>\n schemaType === getJsonSchemaType(itemSchema) ||\n (isJsonSchemaObject(itemSchema) && schemaType === itemSchema.objectKey),\n )\n );\n }\n case JsonSchemaAllTypes.String:\n case JsonSchemaAllTypes.Number:\n case JsonSchemaAllTypes.Boolean:\n case JsonSchemaAllTypes.Integer:\n case JsonSchemaAllTypes.Date:\n case JsonSchemaAllTypes.Datetime:\n case JsonSchemaAllTypes.Enum:\n case JsonSchemaAllTypes.MultiEnum:\n case JsonSchemaAllTypes.GroupedEnum:\n case JsonSchemaAllTypes.Unknown: {\n return types.some((schemaType) => schemaType === fieldJsonSchemaType);\n }\n default:\n return false;\n }\n};\n\nexport interface OptionFilters {\n allowedArrayTypes?: PossibleArrayType[];\n allowedFieldPaths?: string[];\n allowedTypes?: PossibleType[];\n disallowedFieldPaths?: string[];\n fieldPathsAreStrictMatch?: boolean;\n requiredPropertyShape?: string[]; // Array of property names that must exist in the schema\n}\n\nexport const hasRequiredPropertyShape = (\n schema: JsonSchema,\n requiredPropertyShape: string[],\n platformObjectJsonSchema: ObjectSchemaMap = {},\n checkRecursively: boolean = true,\n): boolean => {\n if (!requiredPropertyShape?.length) {\n return true;\n }\n\n const resolvedSchema = isJsonSchemaRef(schema)\n ? resolveJssRef(schema, platformObjectJsonSchema)\n : schema;\n\n if (\n resolvedSchema &&\n 'type' in resolvedSchema &&\n resolvedSchema.type === JsonSchemaTypes.Object &&\n 'properties' in resolvedSchema &&\n resolvedSchema.properties\n ) {\n const schemaProperties = resolvedSchema.properties as Record<string, JsonSchema>;\n const hasAllProperties = requiredPropertyShape.every(\n (propName) => propName in schemaProperties,\n );\n\n if (hasAllProperties) {\n return true;\n }\n\n if (checkRecursively) {\n return Object.values(schemaProperties).some((propSchema) =>\n hasRequiredPropertyShape(\n propSchema,\n requiredPropertyShape,\n platformObjectJsonSchema,\n checkRecursively,\n ),\n );\n }\n }\n return false;\n};\n\nconst filterForAllowedSchemaOptions = (\n options: Option[] = [],\n {\n allowedArrayTypes,\n allowedFieldPaths,\n allowedTypes,\n disallowedFieldPaths,\n fieldPathsAreStrictMatch,\n requiredPropertyShape,\n }: OptionFilters,\n platformObjectJsonSchema: ObjectSchemaMap = {},\n) => {\n let filteredOptions = options;\n\n if (fieldPathsAreStrictMatch) {\n if (allowedFieldPaths?.length || disallowedFieldPaths?.length || allowedTypes?.length) {\n filteredOptions = filteredOptions.filter((option) =>\n isValidOption(\n option.schema,\n allowedFieldPaths ?? [],\n disallowedFieldPaths ?? [],\n allowedTypes ?? [],\n allowedArrayTypes ?? [],\n option.value.split('.'),\n platformObjectJsonSchema,\n ),\n );\n }\n } else {\n if (allowedFieldPaths?.length) {\n filteredOptions = filteredOptions.filter((option) =>\n isAllowedPath(option.value, allowedFieldPaths),\n );\n }\n if (disallowedFieldPaths?.length) {\n filteredOptions = filteredOptions.filter(\n (option) => !isDisallowedPath(option.value, disallowedFieldPaths),\n );\n }\n if (allowedTypes?.length) {\n filteredOptions = filteredOptions.filter((option) =>\n isTypeMatch({\n fieldJsonSchema: option.schema,\n types: allowedTypes,\n platformObjectJsonSchema,\n arrayTypes: allowedArrayTypes,\n }),\n );\n }\n }\n\n // Add a recursive function to check if schema or any nested schema has the required properties\n if (requiredPropertyShape?.length) {\n filteredOptions = filteredOptions.filter((option) =>\n hasRequiredPropertyShape(option.schema, requiredPropertyShape, platformObjectJsonSchema),\n );\n }\n\n return filteredOptions;\n};\n\nexport const getOptionForValue = ({\n value,\n jsonSchema,\n schemaForFieldPath,\n}: {\n value: string;\n jsonSchema: JsonSchema;\n schemaForFieldPath: (\n path: string,\n initialSchema: JsonSchema,\n ) => { schema: JsonSchema | null; propertyName: string | null };\n}): Option | null => {\n const { schema, propertyName } = schemaForFieldPath(value, jsonSchema);\n if (!schema || !propertyName) {\n return null;\n }\n\n const methodChain = parseMethodChainForJSS(value);\n return {\n label: methodChain ? methodChainToString(methodChain) : value,\n value: methodChain ? methodChainToString(methodChain) : value,\n property: propertyName,\n schema,\n methodChain,\n };\n};\n\nexport const validatePath = ({\n path,\n jsonSchema,\n platformObjectJsonSchema = {},\n primitiveUtilities = {},\n optionFilters,\n}: {\n path: string;\n jsonSchema: JsonSchema;\n platformObjectJsonSchema: ObjectSchemaMap;\n primitiveUtilities: ObjectSchemaMap;\n optionFilters?: OptionFilters;\n}) => {\n const schemaOptions = getSchemaOptions({\n option: { schema: jsonSchema, methodChain: parseMethodChainForJSS('') },\n optionFilters,\n platformObjectJsonSchema,\n primitiveUtilities,\n });\n const { methodChain, partial } = parseWithPartialOption(path);\n\n const matchedSchemaOptions = methodChain.links.reduce<Option[]>((currentSchema, link) => {\n if (currentSchema.length === 0) {\n return [];\n }\n const optionMatch = currentSchema.find((option) => option.property === link.name);\n if (optionMatch) {\n return getSchemaOptions({\n option: optionMatch,\n optionFilters,\n platformObjectJsonSchema,\n primitiveUtilities,\n });\n }\n return [];\n }, schemaOptions);\n\n const optionsWithPartiallyMatchedFinalLink = matchedSchemaOptions.filter((option) =>\n option.property.includes(partial),\n );\n return {\n valid: optionsWithPartiallyMatchedFinalLink.length > 0,\n schemaOptions: optionsWithPartiallyMatchedFinalLink,\n partial,\n };\n};\n\n/**\n * Given a method chain that corresponds to the passed schema, find the right-most indentifier that\n * is a platform object and split the method chain on that identifier, with the platform object on\n * the left side.\n *\n * This function is used to optimize a method chain into two parts, left side for server resolution\n * and right side for client resolution.\n *\n * For example:\n * current_case.fields.field_a -> ['current_case', 'fields.field_a']\n * current_case.inquiries.first.id -> ['current_case.inquiries.first', 'id']\n * current_case.account.fields.field_b -> ['current_case.account', 'fields.field_b']\n */\nexport const splitAtNearestParentObject = (\n chain: Chain,\n currentSchema: JsonSchemaObject,\n platformSchemaMap: ObjectSchemaMap,\n primitiveUtilities: ObjectSchemaMap,\n): [leftChain: Chain, rightChain: Chain] => {\n // Create a list of schemas that match each link in the method chain.\n // The list is reversed such that the first schema matches the last link of the method chain\n // for the next step.\n const leafUpLinkSchemas: (JsonSchema | null)[] = [currentSchema];\n for (const link of chain.links) {\n const nextSchema = nextLinkSchema({\n currentSchema: leafUpLinkSchemas[0],\n nextLink: link,\n platformObjectJsonSchema: platformSchemaMap,\n primitiveUtilities,\n });\n leafUpLinkSchemas.unshift(nextSchema);\n }\n\n // List of links that correspond to the left and right sides of the split.\n // As we walk the schema from leaf to root, we move links to the right side.\n const leafUpLeftLinks = [...chain.links].reverse();\n const leafUpRightLinks: typeof leafUpLeftLinks = [];\n\n for (const [i, linkSchema] of leafUpLinkSchemas.entries()) {\n if (!linkSchema) {\n // When the schema is unknown, check if the current link is an identifier accessing a\n // property on an unresolvable platform object ref. If any remaining schema in the\n // ancestor chain is a $ref (or array of $refs), we're within a platform object whose\n // schema couldn't be resolved — push the identifier to the client (right) side.\n if (isIdentifierNode(leafUpLeftLinks[0])) {\n const nearestPlatformAncestor = leafUpLinkSchemas\n .slice(i + 1)\n .find(\n (s) => s && (isJsonSchemaRef(s) || (isJsonSchemaArray(s) && isJsonSchemaRef(s.items))),\n );\n if (nearestPlatformAncestor) {\n leafUpRightLinks.push(leafUpLeftLinks.shift()!);\n continue;\n }\n }\n // If we are missing schema, break out asap to keep links on the left.\n break;\n } else if ('$id' in linkSchema || isJsonSchemaRef(linkSchema)) {\n break;\n } else if (isJsonSchemaArray(linkSchema)) {\n if ('$id' in linkSchema.items || isJsonSchemaRef(linkSchema.items)) {\n break;\n }\n // Array-returning functions (filter, sort, etc.) on platform object arrays\n // must be resolved server-side even when the items ref cannot be resolved.\n if (isFunctionNode(leafUpLeftLinks[0])) {\n break;\n }\n } else if (isFunctionNode(leafUpLeftLinks[0])) {\n break;\n } else if (isIdentifierNode(leafUpLeftLinks[0])) {\n const nextSchema = leafUpLinkSchemas[i + 1];\n // If the preceding schema has a primitive schema ID in the utilities, the identifier\n // was resolved via primitive utilities (e.g. 'trim' on a string, 'count' on an array).\n // The server handles these inline, so keep the whole chain server-side.\n if (nextSchema) {\n const primitiveId = getPrimitiveSchemaId(nextSchema);\n if (primitiveId && primitiveId in primitiveUtilities) {\n break;\n }\n }\n // Real special case here. If:\n // - The current link is an identifier\n // - The next schema is an array\n // = break out, because we don't want to load the whole array into the client\n if (nextSchema && isJsonSchemaArray(nextSchema)) {\n break;\n }\n }\n\n leafUpRightLinks.push(leafUpLeftLinks.shift()!);\n }\n\n const leftChain: Chain = {\n type: MethodChainNodeTypes.Chain,\n links: leafUpLeftLinks.reverse(),\n };\n const rightChain: Chain = {\n type: MethodChainNodeTypes.Chain,\n links: leafUpRightLinks.reverse(),\n };\n return [leftChain, rightChain];\n};\n"],"mappings":";;;;;;AA6DA,MAAM,gBAAgB,SACpB,GAAG,KAAK,SAAS,qBAAqB,iBAAiB,MAAM,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AAE;;AAWjD,QAAO,CAAC;EAPN,MAAM,qBAAqB;EAC3B,OAAO,gBAAgB,SAAS;EAMjB,EAAE;EAHjB,MAAM,qBAAqB;EAC3B,OAAO,iBAAiB,SAAS;EAEN,CAAC"}
|
|
1
|
+
{"version":3,"file":"schemaOptions.mjs","names":[],"sources":["../../src/lib/schemaOptions.ts"],"sourcesContent":["import { compact, flatten, last, sortBy, trim } from 'lodash-es';\n\nimport { assertNever } from './assertNever';\nimport {\n JsonSchemaAllTypes,\n type JsonSchemaCustomTypes,\n JsonSchemaStringifiableTypes,\n EMPTY_JSON_SCHEMA_OBJECT,\n getNonNullableRefSchema,\n genericArrayItemSchema,\n getNonNullableType,\n isConvertedTypeSchema,\n isFileType,\n isFunctionSchema,\n isGenericParameterSchema,\n isJsonSchemaArray,\n isJsonSchemaDate,\n isJsonSchemaDateTime,\n isJsonSchemaObject,\n isJsonSchemaRef,\n isJsonSchemaString,\n isJsonType,\n isPrecedingSchema,\n type JsonSchema,\n type JsonSchemaArray,\n type JsonSchemaBasicTypes,\n type JsonSchemaObject,\n JsonSchemaTypes,\n type JsonSchemaObjectKey,\n} from './jsonSchema';\nimport { getJsonSchemaType } from './jsonSchemaType';\nimport {\n appendedMethodChain,\n type Chain,\n EMPTY_METHOD_CHAIN,\n isIdentifierNode,\n isFunctionNode,\n isStringNode,\n isValid,\n type MethodChainNode,\n MethodChainNodeTypes,\n methodChainToString,\n parseMethodChain,\n parseWithPartialOption,\n type StringNode,\n} from './methodChain';\nimport type { FunctionJsonSchema, ObjectSchemaMap } from './objectSchemaTypes';\nimport {\n getPlatformObjectTypeFromJsonSchema,\n getSchemaId,\n MERGED_SCHEMA_ID,\n PrimitiveSchemaId,\n resolveJssRef,\n} from './platformObject';\n\ntype VariableSchemaObject = {\n value: string;\n schema?: JsonSchema | null;\n isVariable?: boolean;\n};\n\nconst fullNodeName = (node: MethodChainNode): string =>\n `${node.type === MethodChainNodeTypes.CustomFunction ? '@' : ''}${node.name}`;\n\nexport type Option = {\n label: string;\n value: string;\n property: string;\n schema: JsonSchema | FunctionJsonSchema;\n methodChain: Chain | null;\n utility?: boolean;\n workflowObjectKey?: string;\n isVariable?: boolean;\n};\n\nconst SCHEMA_PATH_PATTERN = /\\/schema\\/([a-z][a-z0-9-_]*)/i;\n\n/**\n * Extracts the top-level platform-object key from a schema's `$ref`/`$id`/\n * `objectKey`/`objectType.const` markers. Collapses subtypes to their root\n * (`/schema/verification/document/merged` -> `verification`) because callers\n * compare against top-level `ApiModel` values.\n */\nexport const extractPlatformObjectKey = (\n schema: JsonSchema | null | undefined,\n platformObjectJsonSchema: ObjectSchemaMap = {},\n): string | null => {\n if (!schema) {\n return null;\n }\n if (isJsonSchemaRef(schema)) {\n const refMatch = schema.$ref?.match(SCHEMA_PATH_PATTERN);\n if (refMatch) {\n return refMatch[1];\n }\n return extractPlatformObjectKey(\n resolveJssRef(schema, platformObjectJsonSchema),\n platformObjectJsonSchema,\n );\n }\n if ('$id' in schema && typeof schema.$id === 'string') {\n const idMatch = schema.$id.match(SCHEMA_PATH_PATTERN);\n if (idMatch) {\n return idMatch[1];\n }\n }\n // Serialized PLOB columns carry `objectKey` on a scalar schema (no `$ref`), so\n // read it regardless of `type`, collapsing subtypes to root like the `$ref` branch.\n if ('objectKey' in schema && typeof schema.objectKey === 'string') {\n return schema.objectKey.split('/')[0];\n }\n return getPlatformObjectTypeFromJsonSchema(schema);\n};\n\ntype PossibleType = JsonSchemaTypes | JsonSchemaCustomTypes | JsonSchemaObjectKey;\ntype PossibleArrayType = JsonSchemaBasicTypes | JsonSchemaTypes.Object | JsonSchemaObjectKey;\n\nconst isMatchingType = (\n schema: JsonSchema,\n allowedTypes: PossibleType[],\n allowedArrayTypes: PossibleArrayType[],\n) => {\n if (allowedTypes.length === 0) {\n return true;\n }\n const jsonSchemaType = getJsonSchemaType(schema);\n // If strings are allowed and the field is string-able, let it through.\n if (\n allowedTypes.some((schemaType) => schemaType === JsonSchemaTypes.String) &&\n JsonSchemaStringifiableTypes.some((schemaType) => schemaType === jsonSchemaType)\n ) {\n return true;\n } else if (jsonSchemaType === JsonSchemaAllTypes.Array) {\n const itemsSchema = 'items' in schema ? schema.items : null;\n if (\n !allowedTypes.includes(JsonSchemaAllTypes.Array) ||\n // Don't recurse on array, otherwise we risk matching on objects within the array\n (allowedArrayTypes?.length &&\n !allowedArrayTypes.some((schemaType) => schemaType === getJsonSchemaType(itemsSchema)))\n ) {\n return false;\n }\n } else if (\n jsonSchemaType !== JsonSchemaAllTypes.Object &&\n !allowedTypes.some((schemaType) => schemaType === jsonSchemaType)\n ) {\n return false;\n }\n return true;\n};\n\n// isValidOptionHelper returns true if the schema provided is (in order of precedence)\n// 1) not a disallowed by name\n// AND 2) not a disallowed type\n// AND 3) allowed field by name (either explicitly or implicitly)\n// at each level (we recurse down for object types), we check that the fields at the level fit the above 1,2 and 3\n//\n// 1) is straight forward. if a field is named as disallowed it has the most precedence\n// 2) the field is disallowed by type if the allowedTypes are specified AND\n// - if the field is an array, then\n// - arrays are in allowedTypes\n// - AND (its `items` type is in `allowedArrayTypes` OR `allowedArrayTypes` is empty)\n// - if the field is an object, we do nothing since the recursion is handled at the `isValidOptionHelper` level\n// - else, the field type appears in allowedTypes\n// 3) we can be allowed by name\n// - explicitly, which means the field is named explicitly as an allowedFieldPath (this has precedence)\n// - implicitly, which means that there are no fields explicitly named in allowedFieldPath\n// - an object field can be allowed implicitly if it has at least one valid children\nconst isValidOptionHelper = (\n schema: JsonSchema,\n allowedFieldPaths: Set<string>,\n disallowedFieldPaths: Set<string>,\n allowedTypes: PossibleType[],\n allowedArrayTypes: PossibleArrayType[],\n path: string[],\n platformObjectJsonSchema: ObjectSchemaMap,\n traversedSchemaIds = new Set(),\n): boolean => {\n const resolvedSchema = isJsonSchemaRef(schema)\n ? resolveJssRef(schema, platformObjectJsonSchema)\n : schema;\n\n if (resolvedSchema.$id) {\n if (traversedSchemaIds.has(resolvedSchema.$id)) {\n // We've already traversed this schema ID, which there were no\n // valid types found for it, so return false to avoid infinite loops\n return false;\n } else {\n // If we haven't traversed this schema ID yet, add it to the set\n // This allows us to avoid infinite loops when resolving references\n // in recursive schemas\n traversedSchemaIds.add(resolvedSchema.$id);\n }\n }\n const dotPath = path.join('.');\n if (disallowedFieldPaths.has(dotPath)) {\n return false;\n }\n if (!isMatchingType(resolvedSchema, allowedTypes, allowedArrayTypes)) {\n return false;\n }\n if (allowedFieldPaths.has(dotPath)) {\n return true;\n }\n // if we are here it means\n // - our type is valid\n // - we are not disallowed\n // - we are not explicitly allowed\n // if we are here, we are only valid if\n // - we are an object and at least one of our properties are valid\n // OR, we are not an object and allowedFieldPaths is empty\n const jsonSchemaType = getJsonSchemaType(resolvedSchema);\n if (jsonSchemaType === JsonSchemaTypes.Object) {\n // A schemaless JSON field is an opaque leaf, so it has no child to qualify it as an option.\n if ('fieldType' in resolvedSchema && isJsonType(resolvedSchema.fieldType)) {\n return allowedFieldPaths.size === 0;\n }\n return (\n 'properties' in resolvedSchema &&\n resolvedSchema.properties != null &&\n Object.entries(resolvedSchema.properties).some(([prop, propSchema]) =>\n isValidOptionHelper(\n propSchema,\n allowedFieldPaths,\n disallowedFieldPaths,\n allowedTypes,\n allowedArrayTypes,\n [...path, prop],\n platformObjectJsonSchema,\n traversedSchemaIds,\n ),\n )\n );\n }\n return allowedFieldPaths.size === 0;\n};\n\nexport const isValidOption = (\n schema: JsonSchema,\n allowedFieldPaths: string[],\n disallowedFieldPaths: string[],\n allowedTypes: PossibleType[],\n allowedArrayTypes: PossibleArrayType[],\n path: string[] = [],\n platformObjectJsonSchema: ObjectSchemaMap,\n): boolean => {\n const allowedFieldPathsSet =\n allowedFieldPaths == null ? new Set<string>() : new Set<string>(allowedFieldPaths);\n const disallowedFieldPathsSet =\n disallowedFieldPaths == null ? new Set<string>() : new Set<string>(disallowedFieldPaths);\n if (\n allowedFieldPathsSet.size === 0 &&\n disallowedFieldPathsSet.size === 0 &&\n allowedTypes.length === 0 &&\n allowedArrayTypes.length === 0\n ) {\n return true;\n }\n return isValidOptionHelper(\n schema,\n allowedFieldPathsSet,\n disallowedFieldPathsSet,\n allowedTypes ?? [],\n allowedArrayTypes ?? [],\n path,\n platformObjectJsonSchema,\n );\n};\n\nconst buildSchemaOptionsFor = (rootSchema: JsonSchemaObject, baseChain: Chain | null) =>\n Object.entries(rootSchema?.properties ?? {}).map(([property, propSchema]) => {\n const appended = appendedMethodChain(baseChain ?? EMPTY_METHOD_CHAIN, property);\n return {\n label: methodChainToString(appended),\n value: methodChainToString(appended),\n property,\n schema: propSchema,\n methodChain: appended,\n workflowObjectKey: 'objectKey' in propSchema ? propSchema.objectKey : undefined,\n isVariable: 'isVariable' in propSchema ? propSchema.isVariable : false,\n };\n });\n\nconst getSupportedArrayFunctions = (\n schema: JsonSchema,\n arrayPrimitive: JsonSchemaObject,\n): string[] => {\n if (isJsonSchemaArray(schema) && schema['supportedFunctions']) {\n return schema['supportedFunctions'];\n }\n return arrayPrimitive['baseSupportedFunctions'] ?? [];\n};\n\nexport const getSchemaOptions = ({\n option,\n optionFilters,\n platformObjectJsonSchema,\n primitiveUtilities,\n digPrimitives = false,\n}: {\n option: Pick<Option, 'schema' | 'methodChain'>;\n optionFilters?: OptionFilters;\n platformObjectJsonSchema: ObjectSchemaMap;\n primitiveUtilities: ObjectSchemaMap;\n digPrimitives?: boolean;\n}): Option[] => {\n const { schema, methodChain } = option;\n const nullableRefSchema = getNonNullableRefSchema(schema);\n const baseSchema = nullableRefSchema ?? schema;\n const refResolved = isJsonSchemaRef(baseSchema)\n ? resolveJssRef(baseSchema, platformObjectJsonSchema)\n : baseSchema;\n const nonNullable = refResolved && getNonNullableType(refResolved);\n const resolvedSchema = nonNullable\n ? ({ ...refResolved, type: nonNullable } as JsonSchema)\n : refResolved;\n const schemaType = getJsonSchemaType(resolvedSchema);\n\n const schemaOptions = (() => {\n switch (schemaType) {\n case JsonSchemaAllTypes.Object:\n return buildSchemaOptionsFor(resolvedSchema as JsonSchemaObject, methodChain);\n case JsonSchemaAllTypes.Array:\n case JsonSchemaAllTypes.MultiEnum: {\n if (!digPrimitives) {\n return [];\n }\n const arrayPrimitive = primitiveUtilities[PrimitiveSchemaId.Array];\n if (!arrayPrimitive) {\n return [];\n }\n const allOptions = buildSchemaOptionsFor(arrayPrimitive, methodChain);\n const supported = getSupportedArrayFunctions(resolvedSchema, arrayPrimitive);\n return allOptions.filter((opt) => supported.includes(opt.property));\n }\n case JsonSchemaAllTypes.String:\n return digPrimitives\n ? buildSchemaOptionsFor(primitiveUtilities[PrimitiveSchemaId.String], methodChain)\n : [];\n case JsonSchemaAllTypes.Enum: {\n if (digPrimitives && isJsonSchemaString(resolvedSchema)) {\n return buildSchemaOptionsFor(primitiveUtilities[PrimitiveSchemaId.String], methodChain);\n }\n return [];\n }\n case JsonSchemaAllTypes.File:\n return digPrimitives\n ? buildSchemaOptionsFor(primitiveUtilities[PrimitiveSchemaId.File], methodChain)\n : [];\n // Integer/Number share a single /schema/number bucket — see the collapse\n // in `getPrimitiveSchemaId` and the backend `JSON_TYPE_TO_SCHEMA_ID`. The\n // default mock primitives don't ship utilities for these, so the lookup\n // returns CCFs only (the only properties merged in by `useChain`).\n case JsonSchemaAllTypes.Integer:\n case JsonSchemaAllTypes.Number:\n return digPrimitives && primitiveUtilities[PrimitiveSchemaId.Number]\n ? buildSchemaOptionsFor(primitiveUtilities[PrimitiveSchemaId.Number], methodChain)\n : [];\n case JsonSchemaAllTypes.Boolean:\n return digPrimitives && primitiveUtilities[PrimitiveSchemaId.Boolean]\n ? buildSchemaOptionsFor(primitiveUtilities[PrimitiveSchemaId.Boolean], methodChain)\n : [];\n // Date and Datetime are distinct buckets, mirroring the backend\n // `PlatformPrimitive::Date` / `PlatformPrimitive::Datetime` split. A\n // calendar-only Date receiver shouldn't surface CCFs authored against\n // timezone-bearing Datetimes (or vice versa).\n case JsonSchemaAllTypes.Date:\n return digPrimitives && primitiveUtilities[PrimitiveSchemaId.Date]\n ? buildSchemaOptionsFor(primitiveUtilities[PrimitiveSchemaId.Date], methodChain)\n : [];\n case JsonSchemaAllTypes.Datetime:\n return digPrimitives && primitiveUtilities[PrimitiveSchemaId.Datetime]\n ? buildSchemaOptionsFor(primitiveUtilities[PrimitiveSchemaId.Datetime], methodChain)\n : [];\n case JsonSchemaAllTypes.GroupedEnum:\n case JsonSchemaAllTypes.Null:\n case JsonSchemaAllTypes.Relation:\n case JsonSchemaAllTypes.MaskedString:\n case JsonSchemaAllTypes.Unknown:\n return [];\n default:\n assertNever(schemaType);\n }\n })();\n\n // After a possibly-null value, offer a CCF only when its receiver schema\n // accepts null. Non-CCF members stay for nullable `type` arrays but not\n // for a nullable `$ref | null` union, whose member paths `nextLinkSchema`\n // cannot resolve.\n const possiblyNull = nullableRefSchema != null || nonNullable != null;\n const nullSafeOptions = possiblyNull\n ? schemaOptions.filter((opt) => {\n if (isFunctionSchema(opt.schema) && opt.schema.codeChainFunctionToken != null) {\n return opt.schema.acceptsNullReceiver === true;\n }\n return nullableRefSchema == null;\n })\n : schemaOptions;\n\n const containsFilters = optionFilters && !!flatten(compact(Object.values(optionFilters))).length;\n const finalOptions = containsFilters\n ? filterForAllowedSchemaOptions(nullSafeOptions, optionFilters, platformObjectJsonSchema)\n : nullSafeOptions;\n return sortBy(finalOptions, (opt: Option) => opt.property.replace(/^@/, '')) as Option[];\n};\n\nexport const formatDisplayValue = (value: any) => {\n return typeof value === 'string' ? value : trim(JSON.stringify(value, null, 1), '\"');\n};\n\n/**\n * Resolves the schema at a dotted path (e.g. \"account.birthDate\").\n * Tries direct key lookup first, then traverses into nested object .properties by path part.\n * Normalizes kebab/snake at each level for key lookup.\n */\nexport function getSchemaByPath(\n properties: Record<string, JsonSchema> | null | undefined,\n path: string,\n): JsonSchema | undefined {\n if (!properties || !path) {\n return undefined;\n }\n\n const lookup = (props: Record<string, JsonSchema>, key: string): JsonSchema | undefined =>\n props[key] ?? props[key.replace(/_/g, '-')] ?? props[key.replace(/-/g, '_')];\n\n const byFullPath = lookup(properties, path);\n if (byFullPath != null) {\n return byFullPath;\n }\n\n const i = path.indexOf('.');\n if (i === -1) {\n return undefined;\n }\n const nestedKey = path.slice(0, i);\n const rest = path.slice(i + 1);\n const next = lookup(properties, nestedKey);\n if (next == null || !isJsonSchemaObject(next) || !next.properties) {\n return undefined;\n }\n return getSchemaByPath(next.properties, rest);\n}\n\nconst parseMethodChainForJSS = (path: string): Chain | null => {\n const { methodChain, partial, valid } = parseWithPartialOption(path);\n if (!valid) {\n return null;\n }\n\n if (partial.length > 0) {\n return appendedMethodChain(methodChain, partial);\n }\n\n return methodChain;\n};\n\n/**\n * The schema resolved for a key admitted by `additionalProperties: true`: valid, with an unknown\n * type. Compared by identity (e.g. by the SmartTextInput validator), so do not copy it.\n */\nexport const UNTYPED_ADDITIONAL_PROPERTY_SCHEMA: JsonSchema = Object.freeze({});\n\n/**\n * Resolves an identifier that is not a declared property of `currentSchema` through the object's\n * `additionalProperties`: its schema when one is given, `UNTYPED_ADDITIONAL_PROPERTY_SCHEMA` when\n * it is `true`, and null when extra keys are not allowed.\n */\nconst additionalPropertySchema = (\n currentSchema: JsonSchema | null,\n link: MethodChainNode,\n platformObjectJsonSchema: ObjectSchemaMap,\n): JsonSchema | null => {\n if (currentSchema == null || !isIdentifierNode(link)) {\n return null;\n }\n const resolved = isJsonSchemaRef(currentSchema)\n ? resolveJssRef(currentSchema, platformObjectJsonSchema)\n : currentSchema;\n if (!isJsonSchemaObject(resolved) || resolved.properties?.[link.name] != null) {\n return null;\n }\n const { additionalProperties } = resolved;\n if (additionalProperties === true) {\n return UNTYPED_ADDITIONAL_PROPERTY_SCHEMA;\n }\n return typeof additionalProperties === 'object' && additionalProperties != null\n ? additionalProperties\n : null;\n};\n\nexport const getSchemaForFieldPath = ({\n path,\n initialSchema,\n platformObjectJsonSchema = {},\n primitiveUtilities = {},\n}: {\n path: string;\n initialSchema: JsonSchema;\n platformObjectJsonSchema?: ObjectSchemaMap;\n primitiveUtilities?: ObjectSchemaMap;\n}): {\n schema: JsonSchema | null;\n propertyName: string | null;\n} => {\n if (!initialSchema || (!('type' in initialSchema) && !('$ref' in initialSchema))) {\n return { schema: null, propertyName: null };\n }\n\n const schema: JsonSchema = isJsonSchemaRef(initialSchema)\n ? resolveJssRef(initialSchema, platformObjectJsonSchema)\n : initialSchema;\n\n if (path === '' || !isValid(path)) {\n return { schema: null, propertyName: null };\n }\n const methodChain = parseMethodChain(path);\n if (!methodChain) {\n return { schema: null, propertyName: null };\n }\n const result = methodChain.links.reduce<JsonSchema | null>((currentSchema, link) => {\n return (\n nextLinkSchema({\n currentSchema,\n nextLink: link,\n platformObjectJsonSchema,\n primitiveUtilities,\n }) ?? additionalPropertySchema(currentSchema, link, platformObjectJsonSchema)\n );\n }, schema);\n\n const propertyName = result ? last(methodChain.links)?.name || null : null;\n return { schema: result, propertyName };\n};\n\n/**\n * Get the schema for a variable path from usableObjects.\n */\nexport const getSchemaForVariablePath = ({\n path,\n usableObjects,\n}: {\n path: string;\n usableObjects: VariableSchemaObject[];\n}): {\n schema: JsonSchema | null;\n propertyName: string | null;\n} => {\n // just variables\n const syntheticSchema: JsonSchemaObject = {\n type: JsonSchemaTypes.Object,\n properties: Object.fromEntries(\n usableObjects\n .filter((obj) => obj.schema != null && obj.isVariable === true)\n .map((obj) => [obj.value, obj.schema!]),\n ),\n };\n\n return getSchemaForFieldPath({\n path,\n initialSchema: syntheticSchema,\n });\n};\n\nconst getPrimitiveSchemaId = (schema: JsonSchema): string | null => {\n if (!('type' in schema)) {\n return null;\n }\n // The object/date/date-time guards match an exact scalar `type`, so narrow an exactly-nullable\n // union to its non-null member first. The cast mirrors `nextLinkSchema`'s receiver narrowing:\n // spreading a union member with a different `type` can't be expressed as a `JsonSchema` member.\n const nonNullableType = Array.isArray(schema.type) ? getNonNullableType(schema) : null;\n const narrowedSchema = nonNullableType\n ? ({ ...schema, type: nonNullableType } as JsonSchema)\n : schema;\n // File type has special naming: 'file' -> '/schema/field/file'\n // because the backend uses Field::File.name.underscore = 'field/file'\n // File fields have type: 'object' with fieldType: 'file'\n if (isJsonSchemaObject(narrowedSchema) && isFileType(narrowedSchema.fieldType)) {\n return PrimitiveSchemaId.File;\n }\n // Date and Datetime are encoded as `{type: 'string', format: 'date'|'date-time'}`.\n // Check before the generic string branch so date receivers don't bucket as String.\n if (isJsonSchemaDate(narrowedSchema)) {\n return PrimitiveSchemaId.Date;\n }\n if (isJsonSchemaDateTime(narrowedSchema)) {\n return PrimitiveSchemaId.Datetime;\n }\n const type = Array.isArray(schema.type) ? nonNullableType : schema.type;\n if (!type) {\n return null;\n }\n // Integer and Number share one CCF bucket — mirrors the backend collapse\n // in JSON_TYPE_TO_SCHEMA_ID. A CCF authored against a Number receiver\n // fires for both .length-style integers and float-typed values.\n if (type === JsonSchemaTypes.Integer || type === JsonSchemaTypes.Number) {\n return PrimitiveSchemaId.Number;\n }\n if (type === JsonSchemaTypes.Boolean) {\n return PrimitiveSchemaId.Boolean;\n }\n return getSchemaId(type);\n};\n\nexport const nextLinkSchema = ({\n currentSchema,\n nextLink,\n platformObjectJsonSchema,\n primitiveUtilities,\n}: {\n currentSchema: JsonSchema | null;\n nextLink: MethodChainNode;\n platformObjectJsonSchema: ObjectSchemaMap;\n primitiveUtilities: ObjectSchemaMap;\n}): JsonSchema | null => {\n if (!currentSchema) {\n return null;\n }\n // Runtime dispatches a typed null only to a CCF whose receiver schema\n // accepts null, so a nullable value resolves only through such CCFs.\n if (nextLink.type === MethodChainNodeTypes.CustomFunction) {\n const unwrapped = getNonNullableRefSchema(currentSchema);\n const nonNullType = unwrapped ? null : getNonNullableType(currentSchema);\n const receiver =\n unwrapped ?? (nonNullType ? ({ ...currentSchema, type: nonNullType } as JsonSchema) : null);\n if (receiver) {\n const fn = getFunctionSchemaForNode({\n parentSchema: currentSchema,\n functionName: fullNodeName(nextLink),\n isCustomFunction: true,\n platformObjectJsonSchema,\n primitiveUtilities,\n });\n if (fn?.acceptsNullReceiver !== true) {\n return null;\n }\n currentSchema = receiver;\n }\n }\n if (isJsonSchemaRef(currentSchema)) {\n currentSchema = resolveJssRef(currentSchema, platformObjectJsonSchema);\n } else if (isJsonSchemaArray(currentSchema) && isJsonSchemaRef(currentSchema.items)) {\n currentSchema = {\n ...currentSchema,\n items: {\n ...resolveJssRef(currentSchema.items, platformObjectJsonSchema),\n },\n };\n }\n if (!('type' in currentSchema)) {\n return null;\n }\n\n const schemaId = getPrimitiveSchemaId(currentSchema);\n if (schemaId && schemaId in primitiveUtilities) {\n const utilityReturnType = getPrimitiveUtilitiesReturnSchema(\n currentSchema,\n nextLink,\n primitiveUtilities[schemaId],\n );\n if (utilityReturnType) {\n return utilityReturnType;\n }\n }\n if ('properties' in currentSchema) {\n const propertySchema = currentSchema.properties[fullNodeName(nextLink)];\n if (propertySchema && isFunctionSchema(propertySchema)) {\n return propertySchema.properties.returnType;\n }\n return propertySchema ?? null;\n }\n return null;\n};\n\n/**\n * Returns the FunctionJsonSchema for `functionName` within `parentSchema`, checking both\n * primitive utilities (e.g. array/string methods) and direct object properties.\n * Returns null if not found or not a function schema.\n */\nexport const getFunctionSchemaForNode = ({\n parentSchema,\n functionName,\n isCustomFunction,\n platformObjectJsonSchema,\n primitiveUtilities,\n}: {\n parentSchema: JsonSchema;\n functionName: string;\n isCustomFunction: boolean;\n platformObjectJsonSchema: ObjectSchemaMap;\n primitiveUtilities: ObjectSchemaMap;\n}): FunctionJsonSchema | null => {\n if (isCustomFunction) {\n parentSchema = getNonNullableRefSchema(parentSchema) ?? parentSchema;\n }\n if (isJsonSchemaRef(parentSchema)) {\n parentSchema = resolveJssRef(parentSchema, platformObjectJsonSchema);\n }\n\n const schemaId = getPrimitiveSchemaId(parentSchema);\n if (schemaId && schemaId in primitiveUtilities) {\n const utilitySchema = primitiveUtilities[schemaId].properties[functionName];\n if (utilitySchema && isFunctionSchema(utilitySchema)) {\n return utilitySchema;\n }\n }\n\n if (isJsonSchemaObject(parentSchema) && functionName in parentSchema.properties) {\n const propSchema = parentSchema.properties[functionName];\n if (isFunctionSchema(propSchema)) {\n return propSchema;\n }\n }\n\n return null;\n};\n\n// When the result is an array of platform objects (identified by objectKey on items),\n// inject a $ref so the schema structure matches has_many associations.\n// This ensures consistent operator options in conditionals.\nconst injectRefForPlatformObjectArray = (schema: JsonSchema | null): JsonSchema | null => {\n if (\n schema &&\n isJsonSchemaArray(schema) &&\n isJsonSchemaObject(schema.items) &&\n 'objectKey' in schema.items &&\n schema.items.objectKey\n ) {\n const schemaId = getSchemaId(schema.items.objectKey, MERGED_SCHEMA_ID);\n return {\n ...schema,\n items: {\n ...schema.items,\n $ref: schemaId,\n },\n };\n }\n return schema;\n};\n\nconst getPrimitiveUtilitiesReturnSchema = (\n object: JsonSchema,\n node: MethodChainNode,\n schema: JsonSchemaObject<JsonSchema | FunctionJsonSchema>,\n): JsonSchema | null => {\n const name = fullNodeName(node);\n if (!(name in schema.properties)) {\n return null;\n }\n\n const utilitySchema = schema.properties[name];\n\n const returnSchema = isFunctionSchema(utilitySchema)\n ? utilitySchema.properties.returnType\n : utilitySchema;\n\n const itemSchema = genericArrayItemSchema(object, returnSchema);\n if (itemSchema) {\n return itemSchema;\n }\n\n if (isPrecedingSchema(returnSchema)) {\n return object;\n }\n\n if (\n isConvertedTypeSchema(returnSchema) &&\n isFunctionNode(node) &&\n node.params[returnSchema.position] &&\n isStringNode(node.params[returnSchema.position])\n ) {\n const stringNode = node.params[returnSchema.position] as StringNode;\n return returnSchema.schemaByValue[stringNode.value] ?? EMPTY_JSON_SCHEMA_OBJECT;\n }\n\n if (\n isGenericParameterSchema(returnSchema) &&\n isFunctionNode(node) &&\n node.params[returnSchema.position] &&\n isStringNode(node.params[returnSchema.position])\n ) {\n const stringNode = node.params[returnSchema.position] as StringNode;\n const objectSchema = isJsonSchemaArray(object) ? object.items : object;\n if (isJsonSchemaObject(objectSchema)) {\n const path = stringNode.value.split('.');\n const resultSchema = path.reduce<JsonSchema | null>((schema, key) => {\n if (schema == null || !isJsonSchemaObject(schema) || !schema.properties[key]) {\n return null;\n }\n return schema.properties[key];\n }, objectSchema);\n\n return injectRefForPlatformObjectArray(resultSchema);\n }\n }\n\n return 'genericType' in returnSchema ? EMPTY_JSON_SCHEMA_OBJECT : returnSchema;\n};\n\n/**\n * @param path\n * @param allowedFieldPaths - can be a complete path to a base type field\n * (e.g. 'data.some.string_field'), or a partial path to an object ('data')\n * @param fieldPathsAreStrictMatch - true if we only want to match exact paths in allowedFieldPaths and disallowedFieldPaths\n */\nconst isAllowedPath = (path: string, allowedFieldPaths: string[]) => {\n return allowedFieldPaths.some((fieldPath) => {\n const valueIsPartialMatch = fieldPath.startsWith(path);\n const valueIsNestedProp = path.startsWith(`${fieldPath}.`);\n return valueIsPartialMatch || valueIsNestedProp;\n });\n};\n\n/**\n * @param path\n * @param disallowedFieldPaths - can be a complete path to a base type field\n * (e.g. 'data.some.string_field'), or a partial path to an object ('data')\n */\nconst isDisallowedPath = (path: string, disallowedFieldPaths: string[]) => {\n return disallowedFieldPaths.some((fieldPath) => {\n const valueIsMatch = fieldPath === path;\n const valueIsNestedProp = path.startsWith(`${fieldPath}.`);\n return valueIsMatch || valueIsNestedProp;\n });\n};\n\nexport const isTypeMatch = ({\n fieldJsonSchema,\n types,\n platformObjectJsonSchema = {},\n arrayTypes,\n traversedSchemaIds = new Set(),\n}: {\n fieldJsonSchema: JsonSchema;\n types: PossibleType[];\n platformObjectJsonSchema: ObjectSchemaMap;\n arrayTypes?: PossibleArrayType[];\n traversedSchemaIds?: Set<string>;\n}): boolean => {\n const resolvedSchema = isJsonSchemaRef(fieldJsonSchema)\n ? resolveJssRef(fieldJsonSchema, platformObjectJsonSchema)\n : fieldJsonSchema;\n\n if (resolvedSchema.$id) {\n if (traversedSchemaIds.has(resolvedSchema.$id)) {\n // We've already traversed this schema ID, which there were no\n // valid types found for it, so return false to avoid infinite loops\n return false;\n } else {\n // If we haven't traversed this schema ID yet, add it to the set\n // This allows us to avoid infinite loops when resolving references\n // in recursive schemas\n traversedSchemaIds.add(resolvedSchema.$id);\n }\n }\n\n const fieldJsonSchemaType = getJsonSchemaType(resolvedSchema);\n switch (fieldJsonSchemaType) {\n case JsonSchemaAllTypes.Object: {\n const objectSchema = resolvedSchema as JsonSchemaObject;\n // For generic JsonSchemaObjectKey such as 'report' or 'verification', we match on subtypes\n // like 'business-watchlist' as well; otherwise, generics don't show anything\n const isObjectKeyOfType = (type: JsonSchemaObjectKey) =>\n objectSchema.objectKey &&\n types.includes(type) &&\n objectSchema.objectKey.split('/')[0] === type;\n\n if (\n types.includes(JsonSchemaTypes.Object) ||\n (objectSchema.objectKey && types.includes(objectSchema.objectKey)) ||\n isObjectKeyOfType('report') ||\n isObjectKeyOfType('verification')\n ) {\n return true;\n }\n\n return Object.values(objectSchema.properties || {}).some((propJsonSchema) =>\n isTypeMatch({\n fieldJsonSchema: propJsonSchema,\n types,\n platformObjectJsonSchema,\n arrayTypes,\n traversedSchemaIds: traversedSchemaIds,\n }),\n );\n }\n case JsonSchemaAllTypes.Array: {\n const arraySchema = resolvedSchema as JsonSchemaArray;\n const itemSchema = isJsonSchemaRef(arraySchema.items)\n ? resolveJssRef(arraySchema.items, platformObjectJsonSchema)\n : arraySchema.items;\n return (\n types.includes(JsonSchemaAllTypes.Array) &&\n // Don't recurse on array, otherwise we risk matching on objects within the array\n !!arrayTypes &&\n arrayTypes.some(\n (schemaType) =>\n schemaType === getJsonSchemaType(itemSchema) ||\n (isJsonSchemaObject(itemSchema) && schemaType === itemSchema.objectKey),\n )\n );\n }\n case JsonSchemaAllTypes.String:\n case JsonSchemaAllTypes.Number:\n case JsonSchemaAllTypes.Boolean:\n case JsonSchemaAllTypes.Integer:\n case JsonSchemaAllTypes.Date:\n case JsonSchemaAllTypes.Datetime:\n case JsonSchemaAllTypes.Enum:\n case JsonSchemaAllTypes.MultiEnum:\n case JsonSchemaAllTypes.GroupedEnum:\n case JsonSchemaAllTypes.Unknown: {\n return types.some((schemaType) => schemaType === fieldJsonSchemaType);\n }\n default:\n return false;\n }\n};\n\nexport interface OptionFilters {\n allowedArrayTypes?: PossibleArrayType[];\n allowedFieldPaths?: string[];\n allowedTypes?: PossibleType[];\n disallowedFieldPaths?: string[];\n fieldPathsAreStrictMatch?: boolean;\n requiredPropertyShape?: string[]; // Array of property names that must exist in the schema\n}\n\nexport const hasRequiredPropertyShape = (\n schema: JsonSchema,\n requiredPropertyShape: string[],\n platformObjectJsonSchema: ObjectSchemaMap = {},\n checkRecursively: boolean = true,\n): boolean => {\n if (!requiredPropertyShape?.length) {\n return true;\n }\n\n const resolvedSchema = isJsonSchemaRef(schema)\n ? resolveJssRef(schema, platformObjectJsonSchema)\n : schema;\n\n if (\n resolvedSchema &&\n 'type' in resolvedSchema &&\n resolvedSchema.type === JsonSchemaTypes.Object &&\n 'properties' in resolvedSchema &&\n resolvedSchema.properties\n ) {\n const schemaProperties = resolvedSchema.properties as Record<string, JsonSchema>;\n const hasAllProperties = requiredPropertyShape.every(\n (propName) => propName in schemaProperties,\n );\n\n if (hasAllProperties) {\n return true;\n }\n\n if (checkRecursively) {\n return Object.values(schemaProperties).some((propSchema) =>\n hasRequiredPropertyShape(\n propSchema,\n requiredPropertyShape,\n platformObjectJsonSchema,\n checkRecursively,\n ),\n );\n }\n }\n return false;\n};\n\nconst filterForAllowedSchemaOptions = (\n options: Option[] = [],\n {\n allowedArrayTypes,\n allowedFieldPaths,\n allowedTypes,\n disallowedFieldPaths,\n fieldPathsAreStrictMatch,\n requiredPropertyShape,\n }: OptionFilters,\n platformObjectJsonSchema: ObjectSchemaMap = {},\n) => {\n let filteredOptions = options;\n\n if (fieldPathsAreStrictMatch) {\n if (allowedFieldPaths?.length || disallowedFieldPaths?.length || allowedTypes?.length) {\n filteredOptions = filteredOptions.filter((option) =>\n isValidOption(\n option.schema,\n allowedFieldPaths ?? [],\n disallowedFieldPaths ?? [],\n allowedTypes ?? [],\n allowedArrayTypes ?? [],\n option.value.split('.'),\n platformObjectJsonSchema,\n ),\n );\n }\n } else {\n if (allowedFieldPaths?.length) {\n filteredOptions = filteredOptions.filter((option) =>\n isAllowedPath(option.value, allowedFieldPaths),\n );\n }\n if (disallowedFieldPaths?.length) {\n filteredOptions = filteredOptions.filter(\n (option) => !isDisallowedPath(option.value, disallowedFieldPaths),\n );\n }\n if (allowedTypes?.length) {\n filteredOptions = filteredOptions.filter((option) =>\n isTypeMatch({\n fieldJsonSchema: option.schema,\n types: allowedTypes,\n platformObjectJsonSchema,\n arrayTypes: allowedArrayTypes,\n }),\n );\n }\n }\n\n // Add a recursive function to check if schema or any nested schema has the required properties\n if (requiredPropertyShape?.length) {\n filteredOptions = filteredOptions.filter((option) =>\n hasRequiredPropertyShape(option.schema, requiredPropertyShape, platformObjectJsonSchema),\n );\n }\n\n return filteredOptions;\n};\n\nexport const getOptionForValue = ({\n value,\n jsonSchema,\n schemaForFieldPath,\n}: {\n value: string;\n jsonSchema: JsonSchema;\n schemaForFieldPath: (\n path: string,\n initialSchema: JsonSchema,\n ) => { schema: JsonSchema | null; propertyName: string | null };\n}): Option | null => {\n const { schema, propertyName } = schemaForFieldPath(value, jsonSchema);\n if (!schema || !propertyName) {\n return null;\n }\n\n const methodChain = parseMethodChainForJSS(value);\n return {\n label: methodChain ? methodChainToString(methodChain) : value,\n value: methodChain ? methodChainToString(methodChain) : value,\n property: propertyName,\n schema,\n methodChain,\n };\n};\n\nexport const validatePath = ({\n path,\n jsonSchema,\n platformObjectJsonSchema = {},\n primitiveUtilities = {},\n optionFilters,\n}: {\n path: string;\n jsonSchema: JsonSchema;\n platformObjectJsonSchema: ObjectSchemaMap;\n primitiveUtilities: ObjectSchemaMap;\n optionFilters?: OptionFilters;\n}) => {\n const schemaOptions = getSchemaOptions({\n option: { schema: jsonSchema, methodChain: parseMethodChainForJSS('') },\n optionFilters,\n platformObjectJsonSchema,\n primitiveUtilities,\n });\n const { methodChain, partial } = parseWithPartialOption(path);\n\n const matchedSchemaOptions = methodChain.links.reduce<Option[]>((currentSchema, link) => {\n if (currentSchema.length === 0) {\n return [];\n }\n const optionMatch = currentSchema.find((option) => option.property === fullNodeName(link));\n if (optionMatch) {\n return getSchemaOptions({\n option: optionMatch,\n optionFilters,\n platformObjectJsonSchema,\n primitiveUtilities,\n });\n }\n return [];\n }, schemaOptions);\n\n const optionsWithPartiallyMatchedFinalLink = matchedSchemaOptions.filter((option) =>\n option.property.includes(partial),\n );\n return {\n valid: optionsWithPartiallyMatchedFinalLink.length > 0,\n schemaOptions: optionsWithPartiallyMatchedFinalLink,\n partial,\n };\n};\n\n/**\n * Given a method chain that corresponds to the passed schema, find the right-most indentifier that\n * is a platform object and split the method chain on that identifier, with the platform object on\n * the left side.\n *\n * This function is used to optimize a method chain into two parts, left side for server resolution\n * and right side for client resolution.\n *\n * For example:\n * current_case.fields.field_a -> ['current_case', 'fields.field_a']\n * current_case.inquiries.first.id -> ['current_case.inquiries.first', 'id']\n * current_case.account.fields.field_b -> ['current_case.account', 'fields.field_b']\n */\nexport const splitAtNearestParentObject = (\n chain: Chain,\n currentSchema: JsonSchemaObject,\n platformSchemaMap: ObjectSchemaMap,\n primitiveUtilities: ObjectSchemaMap,\n): [leftChain: Chain, rightChain: Chain] => {\n // Create a list of schemas that match each link in the method chain.\n // The list is reversed such that the first schema matches the last link of the method chain\n // for the next step.\n const leafUpLinkSchemas: (JsonSchema | null)[] = [currentSchema];\n for (const link of chain.links) {\n const nextSchema = nextLinkSchema({\n currentSchema: leafUpLinkSchemas[0],\n nextLink: link,\n platformObjectJsonSchema: platformSchemaMap,\n primitiveUtilities,\n });\n leafUpLinkSchemas.unshift(nextSchema);\n }\n\n // List of links that correspond to the left and right sides of the split.\n // As we walk the schema from leaf to root, we move links to the right side.\n const leafUpLeftLinks = [...chain.links].reverse();\n const leafUpRightLinks: typeof leafUpLeftLinks = [];\n\n for (const [i, linkSchema] of leafUpLinkSchemas.entries()) {\n if (!linkSchema) {\n // When the schema is unknown, check if the current link is an identifier accessing a\n // property on an unresolvable platform object ref. If any remaining schema in the\n // ancestor chain is a $ref (or array of $refs), we're within a platform object whose\n // schema couldn't be resolved — push the identifier to the client (right) side.\n if (isIdentifierNode(leafUpLeftLinks[0])) {\n const nearestPlatformAncestor = leafUpLinkSchemas\n .slice(i + 1)\n .find(\n (s) => s && (isJsonSchemaRef(s) || (isJsonSchemaArray(s) && isJsonSchemaRef(s.items))),\n );\n if (nearestPlatformAncestor) {\n leafUpRightLinks.push(leafUpLeftLinks.shift()!);\n continue;\n }\n }\n // If we are missing schema, break out asap to keep links on the left.\n break;\n } else if ('$id' in linkSchema || isJsonSchemaRef(linkSchema)) {\n break;\n } else if (isJsonSchemaArray(linkSchema)) {\n if ('$id' in linkSchema.items || isJsonSchemaRef(linkSchema.items)) {\n break;\n }\n // Array-returning functions (filter, sort, etc.) on platform object arrays\n // must be resolved server-side even when the items ref cannot be resolved.\n if (isFunctionNode(leafUpLeftLinks[0])) {\n break;\n }\n } else if (isFunctionNode(leafUpLeftLinks[0])) {\n break;\n } else if (isIdentifierNode(leafUpLeftLinks[0])) {\n const nextSchema = leafUpLinkSchemas[i + 1];\n // If the preceding schema has a primitive schema ID in the utilities, the identifier\n // was resolved via primitive utilities (e.g. 'trim' on a string, 'count' on an array).\n // The server handles these inline, so keep the whole chain server-side.\n if (nextSchema) {\n const primitiveId = getPrimitiveSchemaId(nextSchema);\n if (primitiveId && primitiveId in primitiveUtilities) {\n break;\n }\n }\n // Real special case here. If:\n // - The current link is an identifier\n // - The next schema is an array\n // = break out, because we don't want to load the whole array into the client\n if (nextSchema && isJsonSchemaArray(nextSchema)) {\n break;\n }\n }\n\n leafUpRightLinks.push(leafUpLeftLinks.shift()!);\n }\n\n const leftChain: Chain = {\n type: MethodChainNodeTypes.Chain,\n links: leafUpLeftLinks.reverse(),\n };\n const rightChain: Chain = {\n type: MethodChainNodeTypes.Chain,\n links: leafUpRightLinks.reverse(),\n };\n return [leftChain, rightChain];\n};\n"],"mappings":";;;;;;AA6DA,MAAM,gBAAgB,SACpB,GAAG,KAAK,SAAS,qBAA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iB,KAAK,gBAAgB,OAAO,CAAE;;AAWjD,QAAO,CAAC;EAPN,MAAM,qBAAqB;EAC3B,OAAO,gBAAgB,SAAS;EAMjB,EAAE;EAHjB,MAAM,qBAAqB;EAC3B,OAAO,iBAAiB,SAAS;EAEN,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as styled } from "../../styledComponentsInterop-Cs5CCPRy.mjs";
|
|
2
2
|
import { t as Card_default } from "../../Card-DuQHyroh.mjs";
|
|
3
|
-
import { t as DataTable } from "../../DataTable-
|
|
3
|
+
import { t as DataTable } from "../../DataTable-DZ0B2Zm9.mjs";
|
|
4
4
|
import { t as PageHeader } from "../../PageHeader-6KvtGED-.mjs";
|
|
5
5
|
import { n as SingleColumnLayout } from "../../PageLayout-CPiVnS_r.mjs";
|
|
6
6
|
import { useMemo } from "react";
|
|
@@ -2,7 +2,7 @@ import { a as styled } from "../../styledComponentsInterop-Cs5CCPRy.mjs";
|
|
|
2
2
|
import { semanticColor } from "../../lib/semanticColor.mjs";
|
|
3
3
|
import { t as HStack } from "../../Stack-Bzom2BTR.mjs";
|
|
4
4
|
import { n as Button } from "../../IconButton-Bj1fry_K.mjs";
|
|
5
|
-
import { i as Modal_default } from "../../Modal-
|
|
5
|
+
import { i as Modal_default } from "../../Modal-SnCo7ecm.mjs";
|
|
6
6
|
import { t as ProgressIndicator } from "../../ProgressIndicator-zt3ndT9U.mjs";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
import { Color, Spacing } from "@persona/design-tokens";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ComboboxProps } from "./Combobox-
|
|
1
|
+
import { n as ComboboxProps } from "./Combobox-DgYwerwd.mjs";
|
|
2
2
|
import { n as DateRange } from "./DateRangePicker-DlHC2q--.mjs";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
import { DateValue } from "@internationalized/date";
|
|
@@ -92,4 +92,4 @@ interface FilterTypeDefinition<TFilter extends BaseFilterConfig = FilterConfig>
|
|
|
92
92
|
type FilterTypeResolver<TFilter extends BaseFilterConfig = FilterConfig> = (config: TFilter) => FilterTypeDefinition<TFilter> | undefined;
|
|
93
93
|
//#endregion
|
|
94
94
|
export { ComboboxFilterConfig as a, FilterRenderOptions as c, InputFilterConfig as d, MultiSelectFilterConfig as f, BaseFilterConfig as i, FilterTypeDefinition as l, AttributeColumn as n, DateRangeFilterConfig as o, SelectFilterConfig as p, BaseActiveFilter as r, FilterConfig as s, ActiveFilter as t, FilterTypeResolver as u };
|
|
95
|
-
//# sourceMappingURL=types-
|
|
95
|
+
//# sourceMappingURL=types-BTaKBrxG.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as MenuItemProps } from "./Menu-
|
|
1
|
+
import { l as MenuItemProps } from "./Menu-keVl-eKm.mjs";
|
|
2
2
|
import { o as StickerProps } from "./Sticker-CLvRB8V5.mjs";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
import { Column, DeepKeys, FilterFnOption, Header, RowData, SortingState, Table } from "@tanstack/react-table";
|
|
@@ -153,7 +153,8 @@ type RowDataWithTourTarget<T extends RowData> = T & {
|
|
|
153
153
|
type BulkAction = {
|
|
154
154
|
label: string;
|
|
155
155
|
icon?: ReactNode;
|
|
156
|
-
disabled?: boolean;
|
|
156
|
+
disabled?: boolean; /** Tooltip explaining why the action is disabled; shown only while `disabled` is set. */
|
|
157
|
+
disabledReason?: string;
|
|
157
158
|
onClick: (selectedRows: string[], clearSelection: () => void) => void | Promise<void>;
|
|
158
159
|
popover?: {
|
|
159
160
|
options: {
|
|
@@ -165,7 +166,8 @@ type BulkAction = {
|
|
|
165
166
|
} | {
|
|
166
167
|
'aria-label': string;
|
|
167
168
|
icon: ReactNode;
|
|
168
|
-
disabled?: boolean;
|
|
169
|
+
disabled?: boolean; /** Tooltip explaining why the action is disabled; shown only while `disabled` is set. */
|
|
170
|
+
disabledReason?: string;
|
|
169
171
|
onClick: (selectedRows: string[], clearSelection: () => void) => void | Promise<void>;
|
|
170
172
|
popover?: {
|
|
171
173
|
options: {
|
|
@@ -177,4 +179,4 @@ type BulkAction = {
|
|
|
177
179
|
};
|
|
178
180
|
//#endregion
|
|
179
181
|
export { RowAction as C, RowDataWithTourTarget as D, RowDataWithSubrowsToAlwaysShowIds as E, SortProps as O, RenderValueStickerFormatConfig as S, RowDataWithSubrows as T, DataTableColumns as _, DataTableColumnBaseFormat as a, DatetimeConfig as b, DataTableColumnDatetimeFormat as c, DataTableColumnImageFormat as d, DataTableColumnNumberFormat as f, DataTableColumnURLFormat as g, DataTableColumnStringFormat as h, ColumnConfig as i, StickerMapping as k, DataTableColumnFormat as l, DataTableColumnStickerFormat as m, ClientFilterConfig as n, DataTableColumnCheckboxFormat as o, DataTableColumnPiiFormat as p, ClientFilterType as r, DataTableColumnDateFormat as s, BulkAction as t, DataTableColumnIDFormat as u, DataTableVariables as v, RowDataWithDetails as w, HeadlessFilterConfig as x, DateConfig as y };
|
|
180
|
-
//# sourceMappingURL=types-
|
|
182
|
+
//# sourceMappingURL=types-CUnL8JJj.d.mts.map
|
package/dist/types5.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ComboboxFilterConfig, c as FilterRenderOptions, d as InputFilterConfig, f as MultiSelectFilterConfig, i as BaseFilterConfig, l as FilterTypeDefinition, n as AttributeColumn, o as DateRangeFilterConfig, p as SelectFilterConfig, r as BaseActiveFilter, s as FilterConfig, t as ActiveFilter, u as FilterTypeResolver } from "./types-
|
|
1
|
+
import { a as ComboboxFilterConfig, c as FilterRenderOptions, d as InputFilterConfig, f as MultiSelectFilterConfig, i as BaseFilterConfig, l as FilterTypeDefinition, n as AttributeColumn, o as DateRangeFilterConfig, p as SelectFilterConfig, r as BaseActiveFilter, s as FilterConfig, t as ActiveFilter, u as FilterTypeResolver } from "./types-BTaKBrxG.mjs";
|
|
2
2
|
export { ActiveFilter, AttributeColumn, BaseActiveFilter, BaseFilterConfig, ComboboxFilterConfig, DateRangeFilterConfig, FilterConfig, FilterRenderOptions, FilterTypeDefinition, FilterTypeResolver, InputFilterConfig, MultiSelectFilterConfig, SelectFilterConfig };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as TableViewConfigurationProps } from "./TableViewConfigurationDropdown-
|
|
2
|
-
import { i as ColumnConfig } from "./types-
|
|
1
|
+
import { i as TableViewConfigurationProps } from "./TableViewConfigurationDropdown-1nT8wneI.mjs";
|
|
2
|
+
import { i as ColumnConfig } from "./types-CUnL8JJj.mjs";
|
|
3
3
|
import { RowData } from "@tanstack/react-table";
|
|
4
4
|
|
|
5
5
|
//#region src/patterns/IndexTableLayout/useColumnConfiguration.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as RowAction, O as SortProps, _ as DataTableColumns, l as DataTableColumnFormat } from "./types-
|
|
1
|
+
import { C as RowAction, O as SortProps, _ as DataTableColumns, l as DataTableColumnFormat } from "./types-CUnL8JJj.mjs";
|
|
2
2
|
import { ColumnDef, Row, RowData, Table } from "@tanstack/react-table";
|
|
3
3
|
|
|
4
4
|
//#region src/components/DataTable/useTableColumns.d.ts
|
|
@@ -29,6 +29,18 @@ interface UseTableColumnsParams<TData extends RowData, TFormat extends {
|
|
|
29
29
|
enableSubRowSelection?: boolean;
|
|
30
30
|
rowActions?: RowAction[] | ((row: TData) => RowAction[]);
|
|
31
31
|
getRowId?: (row: TData) => string;
|
|
32
|
+
/** Names each row's selection checkbox; the row id when omitted. */
|
|
33
|
+
getRowLabel?: (row: TData) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Show the select-all header's dash only when a row in the table is selected, ignoring selected
|
|
36
|
+
* ids for rows not in `data` (controlled selection across pages).
|
|
37
|
+
*/
|
|
38
|
+
scopeSelectAllToRows?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Keep the select column's header and cell renderers stable across column rebuilds (for example
|
|
41
|
+
* on every `data` change), so checkboxes aren't remounted and a click during a refresh isn't lost.
|
|
42
|
+
*/
|
|
43
|
+
stableSelectCells?: boolean;
|
|
32
44
|
expandedRows: Set<string>;
|
|
33
45
|
toggleRowExpansion: (rowId: string) => void;
|
|
34
46
|
canRowExpand: (rowData: TData) => boolean;
|
|
@@ -54,6 +66,9 @@ declare function useTableColumns<TData extends RowData, TFormat extends {
|
|
|
54
66
|
enableSubRowSelection,
|
|
55
67
|
rowActions,
|
|
56
68
|
getRowId,
|
|
69
|
+
getRowLabel,
|
|
70
|
+
scopeSelectAllToRows,
|
|
71
|
+
stableSelectCells,
|
|
57
72
|
expandedRows,
|
|
58
73
|
toggleRowExpansion,
|
|
59
74
|
canRowExpand,
|
|
@@ -69,4 +84,4 @@ declare function useTableColumns<TData extends RowData, TFormat extends {
|
|
|
69
84
|
}[]];
|
|
70
85
|
//#endregion
|
|
71
86
|
export { UseTableColumnsParams as n, useTableColumns as r, RenderFormatFn as t };
|
|
72
|
-
//# sourceMappingURL=useTableColumns-
|
|
87
|
+
//# sourceMappingURL=useTableColumns-BuxN7Usm.d.mts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as UseTableColumnsParams, r as useTableColumns, t as RenderFormatFn } from "./useTableColumns-
|
|
1
|
+
import { n as UseTableColumnsParams, r as useTableColumns, t as RenderFormatFn } from "./useTableColumns-BuxN7Usm.mjs";
|
|
2
2
|
export { RenderFormatFn, UseTableColumnsParams, useTableColumns };
|
package/dist/useTruncation.d.mts
CHANGED
package/dist/utils4.d.mts
CHANGED
|
@@ -103,7 +103,7 @@ declare const getConfirmLinkCursorPos: (tree: ASTNode, valueType: ValueType, cur
|
|
|
103
103
|
*
|
|
104
104
|
* TODO: Add more sophistication here (e.g. fuzzy matching, etc.)
|
|
105
105
|
*/
|
|
106
|
-
declare const isQueryMatch: (
|
|
106
|
+
declare const isQueryMatch: (rawQuery: string, chain: {
|
|
107
107
|
property: string;
|
|
108
108
|
}) => boolean;
|
|
109
109
|
//#endregion
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/DataTable/withDisabledReason.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Wraps a disabled bulk-action control in a tooltip that explains why it's disabled. Returns the
|
|
6
|
+
* control unchanged unless it is disabled and has a reason.
|
|
7
|
+
*/
|
|
8
|
+
declare const withDisabledReason: (control: ReactElement, {
|
|
9
|
+
key,
|
|
10
|
+
disabled,
|
|
11
|
+
disabledReason
|
|
12
|
+
}: {
|
|
13
|
+
key: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
disabledReason?: string;
|
|
16
|
+
}) => ReactElement;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { withDisabledReason };
|
|
19
|
+
//# sourceMappingURL=withDisabledReason.d.mts.map
|
package/llms.txt
CHANGED
|
@@ -16,7 +16,7 @@ For exact prop types, prefer the published type declarations (`dist/**/*.d.mts`,
|
|
|
16
16
|
- [ui-authoring](skills/ui-authoring/SKILL.md): design tokens, PDS implementation guidelines, table guidelines (DataTable vs TableBox vs TableLayout), routing/link adapters (react-router, TanStack, custom), localization (PDSProvider strings/locale), loading states, testing, Storybook
|
|
17
17
|
- [Product UI standard](skills/ui-authoring/STANDARD.md): the rules every screen meets (11 px minimum for copy and 8 px for labels inside charts and diagrams, WCAG AA contrast, reduced motion, status not by colour alone), the screen brief, the `pds/*` oxlint rules that check it (`@persona/design-system/lint`), and the `new-screen` skill for building one screen
|
|
18
18
|
- [Tokens](skills/ui-authoring/TOKENS.md): semantic color tokens (Fg / Surface / Border / Action / Input / Feedback / Status / Opacity) with recipes and a dark-mode checklist; Spacing / Typography catalog, radius, elevation, charts
|
|
19
|
-
- [Patterns](skills/ui-authoring/PATTERNS.md): forms, layout, index tables, versioned resource headers, indicators, feedback, empty states,
|
|
19
|
+
- [Patterns](skills/ui-authoring/PATTERNS.md): forms, layout, index tables, versioned resource headers, indicators, feedback, empty states, panels
|
|
20
20
|
- [Components](skills/ui-authoring/COMPONENTS.md): which PDS component to use (and its import path); APIs live in that component's `.mdx` when one exists, otherwise in `dist/components/<Name>/index.d.mts`
|
|
21
21
|
- [design-system-component-authoring](skills/design-system-component-authoring/SKILL.md): authoring a new PDS component in this repo — clarifying scope, component conventions, prop interface patterns
|
|
22
22
|
|
|
@@ -64,5 +64,6 @@ without registration both widen to `string`.
|
|
|
64
64
|
|
|
65
65
|
`lib/colorMode` follows the dashboard's light/dark mode: `<PDSProvider colorMode={readDocumentColorMode()}>`
|
|
66
66
|
installs the semantic palette and publishes it as `--pds-*` CSS variables (`FgPrimary` ->
|
|
67
|
-
`var(--pds-fg-primary)`); `<ColorModeScope mode='dark'>` renders a subtree in the other mode
|
|
68
|
-
|
|
67
|
+
`var(--pds-fg-primary)`); `<ColorModeScope mode='dark'>` renders a subtree in the other mode (pass `theme` to scope a
|
|
68
|
+
custom base theme); `useColorMode()` returns the mode in effect. Plain CSS in portaled overlays
|
|
69
|
+
reads the `:root` variables. See `tokens/README.md` ("Colour mode in apps").
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@persona/design-system",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.13",
|
|
4
4
|
"description": "React components for Persona UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tanstack-intent"
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"./components/ButtonGroup": "./dist/components/ButtonGroup/index.mjs",
|
|
42
42
|
"./components/Card": "./dist/components/Card/index.mjs",
|
|
43
43
|
"./components/CardV2": "./dist/components/CardV2/index.mjs",
|
|
44
|
-
"./components/Chart": "./dist/components/Chart/index.mjs",
|
|
45
44
|
"./components/Checkbox": "./dist/components/Checkbox/index.mjs",
|
|
46
45
|
"./components/CodeHighlight": "./dist/components/CodeHighlight/index.mjs",
|
|
47
46
|
"./components/CodeHighlight/PrismWithLanguages": "./dist/components/CodeHighlight/PrismWithLanguages.mjs",
|
|
@@ -187,7 +186,6 @@
|
|
|
187
186
|
"build": "tsdown && node scripts/assert-no-node-imports.mjs && node scripts/assert-styled-components-interop.mjs && node scripts/assert-parser-declarations.mjs",
|
|
188
187
|
"release": "scripts/release.sh --dry-run",
|
|
189
188
|
"skills:validate": "intent validate skills",
|
|
190
|
-
"typecheck:charts": "node scripts/typecheck-charts.mjs",
|
|
191
189
|
"tokens:generate": "node scripts/generate-semantic-tokens.mjs && node scripts/generate-charting-tokens.mjs",
|
|
192
190
|
"tokens:check": "node scripts/generate-semantic-tokens.mjs --check && node scripts/generate-charting-tokens.mjs --check",
|
|
193
191
|
"skills:stale": "intent stale"
|
|
@@ -228,7 +226,7 @@
|
|
|
228
226
|
"color": "^5.0.3",
|
|
229
227
|
"csstype": "^3.1.2",
|
|
230
228
|
"dompurify": "^3.4.17",
|
|
231
|
-
"downshift": "^9.0
|
|
229
|
+
"downshift": "^9.4.0",
|
|
232
230
|
"framer-motion": "^6.5.1",
|
|
233
231
|
"fuse.js": "^7.1.0",
|
|
234
232
|
"lodash-es": "^4.18.1",
|
|
@@ -248,8 +246,8 @@
|
|
|
248
246
|
"@faker-js/faker": "^10.5.0",
|
|
249
247
|
"@figma/code-connect": "^1.4.4",
|
|
250
248
|
"@oxlint/plugins": "1.72.0",
|
|
251
|
-
"@persona/design-tokens": "0.4.
|
|
252
|
-
"@persona/icons": "0.1.
|
|
249
|
+
"@persona/design-tokens": "0.4.27",
|
|
250
|
+
"@persona/icons": "0.1.16",
|
|
253
251
|
"@storybook/react": "^10.6.2",
|
|
254
252
|
"@storybook/react-vite": "^10.6.2",
|
|
255
253
|
"@tanstack/intent": "^0.3.6",
|
|
@@ -282,7 +280,6 @@
|
|
|
282
280
|
"react-dom": "^17.0.2",
|
|
283
281
|
"react-router-dom": "^6.30.5",
|
|
284
282
|
"recharts": "^2.13.3",
|
|
285
|
-
"recharts-v3": "npm:recharts@^3.2.1",
|
|
286
283
|
"storybook": "^10.6.2",
|
|
287
284
|
"styled-components": "^5.3.5",
|
|
288
285
|
"tsdown": "^0.21.0",
|
|
@@ -300,7 +297,6 @@
|
|
|
300
297
|
"react": ">=17",
|
|
301
298
|
"react-dom": ">=17",
|
|
302
299
|
"react-router-dom": "^6.30.1 || ^7.18.2",
|
|
303
|
-
"recharts": "^2.13.3 || ^3",
|
|
304
300
|
"styled-components": "^5.3.5"
|
|
305
301
|
},
|
|
306
302
|
"peerDependenciesMeta": {
|
|
@@ -312,9 +308,6 @@
|
|
|
312
308
|
},
|
|
313
309
|
"oxlint": {
|
|
314
310
|
"optional": true
|
|
315
|
-
},
|
|
316
|
-
"recharts": {
|
|
317
|
-
"optional": true
|
|
318
311
|
}
|
|
319
312
|
},
|
|
320
313
|
"publishConfig": {
|
|
@@ -330,7 +323,6 @@
|
|
|
330
323
|
"./components/ButtonGroup": "./dist/components/ButtonGroup/index.mjs",
|
|
331
324
|
"./components/Card": "./dist/components/Card/index.mjs",
|
|
332
325
|
"./components/CardV2": "./dist/components/CardV2/index.mjs",
|
|
333
|
-
"./components/Chart": "./dist/components/Chart/index.mjs",
|
|
334
326
|
"./components/Checkbox": "./dist/components/Checkbox/index.mjs",
|
|
335
327
|
"./components/CodeHighlight": "./dist/components/CodeHighlight/index.mjs",
|
|
336
328
|
"./components/CodeHighlight/PrismWithLanguages": "./dist/components/CodeHighlight/PrismWithLanguages.mjs",
|
|
@@ -17,7 +17,6 @@ exists. If there is no `.mdx`, use the published type declarations
|
|
|
17
17
|
| `Button` | Triggering an action. Use `IconButton` when there is no label | `@persona/design-system/components/Button` |
|
|
18
18
|
| `ButtonGroup` | Choosing among related modes in a compact connected button set (often icons, e.g. alignment). Use `Toggle` for a single on/off setting; `RadioGroup` for a visible list of labeled choices | `@persona/design-system/components/ButtonGroup` |
|
|
19
19
|
| `Card` + `Card.Section` | Grouping related content and actions so they're easier to scan. Collapsible sections on long settings pages | `@persona/design-system/components/CardV2` |
|
|
20
|
-
| `ChartFrame`, `ChartLegend`, `ChartPopover` | Experimental (beta). Charts built on `recharts` (optional peer, 2.x or 3.x): `ChartFrame` lays out legend and plot, `ChartLegend` keys and toggles series, `ChartPopover` is the `<Tooltip>` content. Colour series with `useChartColors` / `resolveSeriesColors`; style hand-built Recharts parts with `useChartStyles`. See Storybook Charts → Design | `@persona/design-system/components/Chart` |
|
|
21
20
|
| `Checkbox` | Selecting one or more options from a visible list | `@persona/design-system/components/Checkbox` |
|
|
22
21
|
| `Combobox` | Picking from a long list that needs search (single or multi). Use `RadioGroup` when every choice should stay visible (one); `Checkbox` when every choice should stay visible (several); `Select` for a short closed list with no search | `@persona/design-system/components/Combobox` |
|
|
23
22
|
| `ConfigFormGroup` | Form fields — spacing a group of config fields and setting `configField` via context. Pair with `TextField` / `TextAreaField` | `@persona/design-system/components/ConfigFormGroup` |
|