@gravitee/graphene-core 3.54.0 → 3.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/composed/JsonSchemaForm/JsonSchemaForm.d.ts +21 -1
  2. package/dist/composed/JsonSchemaForm/JsonSchemaForm.d.ts.map +1 -1
  3. package/dist/composed/JsonSchemaForm/conditional/concretizePath.d.ts +1 -1
  4. package/dist/composed/JsonSchemaForm/fields/__test-utils__/errorVisibility.d.ts +39 -0
  5. package/dist/composed/JsonSchemaForm/fields/__test-utils__/errorVisibility.d.ts.map +1 -0
  6. package/dist/composed/JsonSchemaForm/fields/oneOf/OneOfField.d.ts.map +1 -1
  7. package/dist/composed/JsonSchemaForm/form-bindings/extractDefaults.d.ts.map +1 -1
  8. package/dist/composed/JsonSchemaForm/form-bindings/hiddenFormErrors.d.ts +38 -0
  9. package/dist/composed/JsonSchemaForm/form-bindings/hiddenFormErrors.d.ts.map +1 -0
  10. package/dist/composed/JsonSchemaForm/form-bindings/jsonSchemaResolver.d.ts.map +1 -1
  11. package/dist/composed/JsonSchemaForm/form-bindings/pruneHiddenValues.d.ts +4 -3
  12. package/dist/composed/JsonSchemaForm/form-bindings/pruneHiddenValues.d.ts.map +1 -1
  13. package/dist/composed/JsonSchemaForm/form-bindings/resolveAt.d.ts +11 -5
  14. package/dist/composed/JsonSchemaForm/form-bindings/resolveAt.d.ts.map +1 -1
  15. package/dist/composed/JsonSchemaForm/index.d.ts +2 -0
  16. package/dist/composed/JsonSchemaForm/index.d.ts.map +1 -1
  17. package/dist/composed/JsonSchemaForm/models/JsonSchemaFormContext.d.ts +7 -3
  18. package/dist/composed/JsonSchemaForm/models/JsonSchemaFormContext.d.ts.map +1 -1
  19. package/dist/composed/JsonSchemaForm/models/jsonSchemaResolver.types.d.ts +2 -0
  20. package/dist/composed/JsonSchemaForm/models/jsonSchemaResolver.types.d.ts.map +1 -1
  21. package/dist/composed/JsonSchemaForm/schema/buildIndex.d.ts.map +1 -1
  22. package/dist/composed/JsonSchemaForm/schema/displayedErrorPaths.d.ts +21 -0
  23. package/dist/composed/JsonSchemaForm/schema/displayedErrorPaths.d.ts.map +1 -0
  24. package/dist/composed/JsonSchemaForm/schema/types.d.ts +6 -5
  25. package/dist/composed/JsonSchemaForm/schema/types.d.ts.map +1 -1
  26. package/dist/composed/JsonSchemaForm/schema/visibleFields.d.ts +2 -0
  27. package/dist/composed/JsonSchemaForm/schema/visibleFields.d.ts.map +1 -1
  28. package/dist/composed/JsonSchemaForm/utils/readPath.d.ts +1 -2
  29. package/dist/composed/JsonSchemaForm/utils/readPath.d.ts.map +1 -1
  30. package/dist/index.js +1298 -439
  31. package/package.json +1 -1
  32. package/snippets/json-schema-form-simple.tsx +12 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravitee/graphene-core",
3
- "version": "3.54.0",
3
+ "version": "3.55.0",
4
4
  "type": "module",
5
5
  "description": "Gravitee's Graphene design system: accessible React components, design tokens, icons, and shared ESLint/TypeScript configs. Built on shadcn/ui and Tailwind.",
6
6
  "keywords": [
@@ -41,18 +41,23 @@ export function PluginConfigPage({
41
41
  readonlyMode,
42
42
  onSave,
43
43
  }: PluginConfigPageProps) {
44
- // Memoize so `jsonSchemaResolver` does not recompile ajv on every parent render.
45
- const resolver = useMemo(() => jsonSchemaResolver(pluginSchema), [pluginSchema]);
46
- const defaultValues = useMemo(
47
- () => initialValue ?? (extractDefaults(pluginSchema) as Record<string, unknown>) ?? {},
48
- [pluginSchema, initialValue],
49
- );
50
-
51
44
  // Stable object identity for the `context` prop. An inline `context={{ environment, readonlyMode }}`
52
45
  // would create a new ref on every parent render and bust JsonSchemaForm's internal memo, re-rendering
53
46
  // every field. `useMemo` keyed on the actual values keeps the ref stable until they change.
54
47
  const formContext = useMemo(() => ({ environment, readonlyMode }), [environment, readonlyMode]);
55
48
 
49
+ // Memoize so `jsonSchemaResolver` does not recompile ajv on every parent render. Give it the same
50
+ // `context` as the form: without it, every `context.X` condition reads as false and the fields
51
+ // it shows are validated as hidden.
52
+ const resolver = useMemo(
53
+ () => jsonSchemaResolver(pluginSchema, { context: formContext }),
54
+ [pluginSchema, formContext],
55
+ );
56
+ const defaultValues = useMemo(
57
+ () => initialValue ?? (extractDefaults(pluginSchema) as Record<string, unknown>) ?? {},
58
+ [pluginSchema, initialValue],
59
+ );
60
+
56
61
  const form = useForm({
57
62
  resolver,
58
63
  defaultValues,