@epam/ai-dial-ui-kit 0.15.0-dev.45 → 0.15.0-dev.47

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 (66) hide show
  1. package/README.md +2 -0
  2. package/dist/CHANGELOG.md +9 -0
  3. package/dist/{DateCellRenderer-Cl_mNbi1.cjs → DateCellRenderer-CZNa4jVJ.cjs} +1 -1
  4. package/dist/{DateCellRenderer-ChqbDlQ2.cjs → DateCellRenderer-X6vXPDIG.cjs} +1 -1
  5. package/dist/components/New/SchemaRenderer/SchemaRenderer.js +164 -0
  6. package/dist/components/New/SchemaRenderer/components/SchemaAnyOfEditor.js +65 -0
  7. package/dist/components/New/SchemaRenderer/components/SchemaArrayEditor.js +109 -0
  8. package/dist/components/New/SchemaRenderer/components/SchemaField.js +83 -0
  9. package/dist/components/New/SchemaRenderer/components/SchemaFieldContent.js +72 -0
  10. package/dist/components/New/SchemaRenderer/components/SchemaJsonEditor.js +41 -0
  11. package/dist/components/New/SchemaRenderer/components/SchemaKeyValueEditor.js +250 -0
  12. package/dist/components/New/SchemaRenderer/components/SchemaObjectEditor.js +36 -0
  13. package/dist/components/New/SchemaRenderer/components/SchemaOneOfEditor.js +163 -0
  14. package/dist/components/New/SchemaRenderer/components/SchemaPrimitiveField.js +150 -0
  15. package/dist/components/New/SchemaRenderer/components/SchemaSection.js +135 -0
  16. package/dist/components/New/SchemaRenderer/context.js +17 -0
  17. package/dist/components/New/Slider/Slider.js +151 -90
  18. package/dist/components/New/Slider/utils.js +12 -0
  19. package/dist/components/New/Textarea/Textarea.js +21 -20
  20. package/dist/components/SchemaRenderer/SchemaRenderer.js +16 -15
  21. package/dist/components/SchemaRenderer/components/SchemaAnyOfEditor.js +2 -2
  22. package/dist/components/SchemaRenderer/components/SchemaArrayEditor.js +1 -1
  23. package/dist/components/SchemaRenderer/components/SchemaField.js +8 -8
  24. package/dist/components/SchemaRenderer/components/SchemaFieldContent.js +2 -2
  25. package/dist/components/SchemaRenderer/components/SchemaKeyValueEditor.js +2 -2
  26. package/dist/components/SchemaRenderer/components/SchemaObjectEditor.js +1 -1
  27. package/dist/components/SchemaRenderer/components/SchemaOneOfEditor.js +13 -13
  28. package/dist/components/SchemaRenderer/components/SchemaPrimitiveField.js +5 -5
  29. package/dist/components-manifest.json +175 -12
  30. package/dist/constants/public-class-names.js +8 -0
  31. package/dist/{components/SchemaRenderer/types.js → constants/schema-renderer.js} +2 -7
  32. package/dist/dial-ui-kit.cjs +2 -2
  33. package/dist/dial-ui-kit.js +241 -239
  34. package/dist/file-manager.cjs +1 -1
  35. package/dist/grid.cjs +1 -1
  36. package/dist/index.css +2 -2
  37. package/dist/migration-guides/0.15.0/slider-redesign.md +110 -0
  38. package/dist/migration-guides/README.md +1 -0
  39. package/dist/src/components/New/SchemaRenderer/SchemaRenderer.d.ts +38 -0
  40. package/dist/src/components/New/SchemaRenderer/components/SchemaAnyOfEditor.d.ts +37 -0
  41. package/dist/src/components/New/SchemaRenderer/components/SchemaArrayEditor.d.ts +35 -0
  42. package/dist/src/components/New/SchemaRenderer/components/SchemaField.d.ts +33 -0
  43. package/dist/src/components/New/SchemaRenderer/components/SchemaFieldContent.d.ts +30 -0
  44. package/dist/src/components/New/SchemaRenderer/components/SchemaJsonEditor.d.ts +29 -0
  45. package/dist/src/components/New/SchemaRenderer/components/SchemaKeyValueEditor.d.ts +37 -0
  46. package/dist/src/components/New/SchemaRenderer/components/SchemaObjectEditor.d.ts +32 -0
  47. package/dist/src/components/New/SchemaRenderer/components/SchemaOneOfEditor.d.ts +39 -0
  48. package/dist/src/components/New/SchemaRenderer/components/SchemaPrimitiveField.d.ts +38 -0
  49. package/dist/src/components/New/SchemaRenderer/components/SchemaSection.d.ts +39 -0
  50. package/dist/src/components/New/SchemaRenderer/context.d.ts +8 -0
  51. package/dist/src/components/New/SchemaRenderer/types.d.ts +76 -0
  52. package/dist/src/components/New/Slider/Slider.d.ts +20 -1
  53. package/dist/src/components/New/Slider/utils.d.ts +6 -0
  54. package/dist/src/components/New/Slider/utils.spec.d.ts +1 -0
  55. package/dist/src/components/SchemaRenderer/types.d.ts +5 -93
  56. package/dist/src/components/SchemaRenderer/utils.d.ts +1 -22
  57. package/dist/src/constants/public-class-names.d.ts +8 -0
  58. package/dist/src/constants/schema-renderer.d.ts +2 -0
  59. package/dist/src/index.d.ts +3 -1
  60. package/dist/src/models/json-schema.d.ts +71 -0
  61. package/dist/src/types/json-schema.d.ts +22 -0
  62. package/dist/src/utils/json-schema.d.ts +23 -0
  63. package/dist/types/json-schema.js +7 -0
  64. package/dist/{use-file-manager-tabs-C-dMqEFy.cjs → use-file-manager-tabs-Bzzwwcgk.cjs} +1 -1
  65. package/dist/{components/SchemaRenderer/utils.js → utils/json-schema.js} +1 -1
  66. package/package.json +1 -1
@@ -0,0 +1,37 @@
1
+ import { FC } from 'react';
2
+ import { JsonSchemaDef } from '../../../../models/json-schema';
3
+ export interface SchemaAnyOfEditorProps {
4
+ schema: JsonSchemaDef;
5
+ value: unknown;
6
+ onChange: (value: unknown) => void;
7
+ path: string[];
8
+ level: number;
9
+ ariaLabel?: string;
10
+ }
11
+ /**
12
+ * Renders an `anyOf` schema field as a type select with the selected variant's editor.
13
+ * aliases: AnyOfSchemaEditor|SchemaUnionEditor
14
+ * Design system 2.0
15
+ *
16
+ * A `null` variant has no editor, so selecting it clears the value.
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * <SchemaAnyOfEditor
21
+ * schema={{ anyOf: [{ type: 'null' }, { type: 'string' }] }}
22
+ * value={null}
23
+ * onChange={(v) => console.log(v)}
24
+ * path={['field']}
25
+ * level={1}
26
+ * ariaLabel="Field"
27
+ * />
28
+ * ```
29
+ *
30
+ * @param schema - The JSON Schema definition containing an `anyOf` array
31
+ * @param value - Current field value
32
+ * @param onChange - Called with the new value when the type or sub-value changes
33
+ * @param path - Field path segments used for validation error tracking
34
+ * @param level - Nesting depth passed to child field components
35
+ * @param [ariaLabel] - Accessible name of the type select and the variant's control
36
+ */
37
+ export declare const SchemaAnyOfEditor: FC<SchemaAnyOfEditorProps>;
@@ -0,0 +1,35 @@
1
+ import { FC } from 'react';
2
+ import { JsonSchemaDef } from '../../../../models/json-schema';
3
+ export interface SchemaArrayEditorProps {
4
+ schema: JsonSchemaDef;
5
+ value: unknown;
6
+ onChange: (value: unknown) => void;
7
+ path: string[];
8
+ level: number;
9
+ }
10
+ /**
11
+ * Renders a JSON Schema array as a list of collapsible items with add and remove controls.
12
+ * aliases: ArraySchemaEditor|SchemaListEditor
13
+ * Design system 2.0
14
+ *
15
+ * An item schema with a `discriminator` adds a type select next to the add
16
+ * button; the new item gets that variant's defaults.
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * <SchemaArrayEditor
21
+ * schema={{ type: 'array', items: { type: 'string' } }}
22
+ * value={['foo', 'bar']}
23
+ * onChange={(v) => console.log(v)}
24
+ * path={['tags']}
25
+ * level={1}
26
+ * />
27
+ * ```
28
+ *
29
+ * @param schema - The JSON Schema array definition (must include an `items` sub-schema)
30
+ * @param value - Current array value
31
+ * @param onChange - Called with the updated array when items are added, removed, or changed
32
+ * @param path - Field path segments used for validation error tracking
33
+ * @param level - Nesting depth passed to child section components
34
+ */
35
+ export declare const SchemaArrayEditor: FC<SchemaArrayEditorProps>;
@@ -0,0 +1,33 @@
1
+ import { FC } from 'react';
2
+ import { SchemaFieldProps } from '../types';
3
+ /**
4
+ * Renders a single schema property: a labelled field for a primitive, or a
5
+ * collapsible section for an object or an array.
6
+ * aliases: SchemaPropertyField|SchemaFormField
7
+ * Design system 2.0
8
+ *
9
+ * The label and the required error sit outside {@link SchemaFieldContent}, so
10
+ * a `renderField` override replaces the control and keeps both.
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * <SchemaField
15
+ * schema={{ type: 'string' }}
16
+ * value="hello"
17
+ * onChange={(v) => console.log(v)}
18
+ * path={['name']}
19
+ * level={1}
20
+ * required
21
+ * label="Name"
22
+ * />
23
+ * ```
24
+ *
25
+ * @param schema - The JSON Schema definition for this field
26
+ * @param value - Current field value
27
+ * @param onChange - Called with the updated value when the field changes
28
+ * @param path - Field path segments used for validation error tracking
29
+ * @param [level=0] - Nesting depth; object/array fields render as collapsible sections
30
+ * @param [required] - Whether the field is required (shows error when empty)
31
+ * @param [label] - Display label; falls back to schema title or path segment
32
+ */
33
+ export declare const SchemaField: FC<SchemaFieldProps>;
@@ -0,0 +1,30 @@
1
+ import { FC } from 'react';
2
+ import { SchemaFieldContentProps } from '../types';
3
+ /**
4
+ * Routes a resolved schema to the editor that renders it.
5
+ * aliases: SchemaEditorRouter|SchemaContentDispatcher
6
+ * Design system 2.0
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * <SchemaFieldContent
11
+ * schema={{ type: 'string' }}
12
+ * value="hello"
13
+ * onChange={(v) => console.log(v)}
14
+ * path={['name']}
15
+ * level={1}
16
+ * ariaLabel="Name"
17
+ * />
18
+ * ```
19
+ *
20
+ * @param schema - The JSON Schema definition to render
21
+ * @param value - Current field value
22
+ * @param onChange - Called with the updated value when the field changes
23
+ * @param path - Field path segments used for validation error tracking
24
+ * @param level - Nesting depth passed to child editor components
25
+ * @param [required] - Whether the field is required (passed to primitive fields for error styling)
26
+ * @param [suppressInlineError=false] - Leaves the required error to the caller, which renders it under its own label
27
+ * @param [fieldId] - Id given to a primitive control, for a visible label to point at
28
+ * @param [ariaLabel] - Accessible name of the control
29
+ */
30
+ export declare const SchemaFieldContent: FC<SchemaFieldContentProps>;
@@ -0,0 +1,29 @@
1
+ import { FC } from 'react';
2
+ export interface SchemaJsonEditorProps {
3
+ value: unknown;
4
+ onChange: (value: unknown) => void;
5
+ id?: string;
6
+ ariaLabel?: string;
7
+ }
8
+ /**
9
+ * Edits a value the schema does not describe as raw JSON text: a key absent
10
+ * from the schema's `properties`, an object with no fixed properties, or a
11
+ * key-value entry switched to the object or array type.
12
+ * aliases: SchemaRawJsonEditor|SchemaUnknownPropertyEditor
13
+ * Design system 2.0
14
+ *
15
+ * A plain monospace {@link Textarea} rather than a code editor, so the form
16
+ * pulls in no editor bundle. The draft text is kept locally and `onChange`
17
+ * fires only once it parses.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * <SchemaJsonEditor value={{ retries: 3 }} onChange={setValue} />
22
+ * ```
23
+ *
24
+ * @param value - The current value (any JSON type)
25
+ * @param onChange - Called with the parsed value whenever the edited text is valid JSON
26
+ * @param [id] - Id of the textarea, for a visible label to point at
27
+ * @param [ariaLabel] - Accessible name of the textarea
28
+ */
29
+ export declare const SchemaJsonEditor: FC<SchemaJsonEditorProps>;
@@ -0,0 +1,37 @@
1
+ import { FC } from 'react';
2
+ import { JsonSchemaDef } from '../../../../models/json-schema';
3
+ export interface SchemaKeyValueEditorProps {
4
+ schema: JsonSchemaDef;
5
+ value: unknown;
6
+ onChange: (value: unknown) => void;
7
+ path: string[];
8
+ level: number;
9
+ }
10
+ /**
11
+ * Renders an `additionalProperties` object schema as an editable key-value list.
12
+ * aliases: KeyValueSchemaEditor|AdditionalPropertiesEditor
13
+ * Design system 2.0
14
+ *
15
+ * Primitive values render inline; object, `oneOf` and array values render as a
16
+ * collapsible section recursing back into `SchemaFieldContent`. With
17
+ * `additionalProperties: true` each entry also gets a type select, and an
18
+ * object or array entry is edited as raw JSON.
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * <SchemaKeyValueEditor
23
+ * schema={{ type: 'object', additionalProperties: { type: 'string' } }}
24
+ * value={{ foo: 'bar' }}
25
+ * onChange={(v) => console.log(v)}
26
+ * path={['metadata']}
27
+ * level={1}
28
+ * />
29
+ * ```
30
+ *
31
+ * @param schema - The JSON Schema object definition with `additionalProperties`
32
+ * @param value - Current object value (treated as a key-value map)
33
+ * @param onChange - Called with the updated object when pairs are added, removed, or changed
34
+ * @param path - Field path segments used for validation error tracking
35
+ * @param level - Nesting depth passed to child section components
36
+ */
37
+ export declare const SchemaKeyValueEditor: FC<SchemaKeyValueEditorProps>;
@@ -0,0 +1,32 @@
1
+ import { FC } from 'react';
2
+ import { JsonSchemaDef } from '../../../../models/json-schema';
3
+ export interface SchemaObjectEditorProps {
4
+ schema: JsonSchemaDef;
5
+ value: unknown;
6
+ onChange: (value: unknown) => void;
7
+ path: string[];
8
+ level: number;
9
+ }
10
+ /**
11
+ * Renders the properties of a JSON Schema object as labelled form fields.
12
+ * aliases: ObjectSchemaEditor|SchemaPropertiesEditor
13
+ * Design system 2.0
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * <SchemaObjectEditor
18
+ * schema={{ type: 'object', properties: { name: { type: 'string' } } }}
19
+ * value={{ name: 'Alice' }}
20
+ * onChange={(v) => console.log(v)}
21
+ * path={['config']}
22
+ * level={1}
23
+ * />
24
+ * ```
25
+ *
26
+ * @param schema - The JSON Schema object definition
27
+ * @param value - Current object value
28
+ * @param onChange - Called with the updated object when any property changes
29
+ * @param path - Field path segments used for validation error tracking
30
+ * @param level - Nesting depth passed to child SchemaField instances
31
+ */
32
+ export declare const SchemaObjectEditor: FC<SchemaObjectEditorProps>;
@@ -0,0 +1,39 @@
1
+ import { FC } from 'react';
2
+ import { JsonSchemaDef } from '../../../../models/json-schema';
3
+ export interface SchemaOneOfEditorProps {
4
+ schema: JsonSchemaDef;
5
+ value: unknown;
6
+ onChange: (value: unknown) => void;
7
+ path: string[];
8
+ level: number;
9
+ ariaLabel?: string;
10
+ }
11
+ /**
12
+ * Renders a `oneOf` schema field as a type selector with the selected variant's editor.
13
+ * aliases: OneOfSchemaEditor|SchemaDiscriminatorEditor
14
+ * Design system 2.0
15
+ *
16
+ * The selector is a select by default, or a radio group with
17
+ * `discriminatorDisplay: 'radio'`. A column radio group reveals the variant's
18
+ * editor under its own option; a row one shows it below the whole row.
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * <SchemaOneOfEditor
23
+ * schema={{ oneOf: [...], discriminator: { propertyName: 'type', mapping: {...} } }}
24
+ * value={{ type: 'foo' }}
25
+ * onChange={(v) => console.log(v)}
26
+ * path={['config']}
27
+ * level={1}
28
+ * ariaLabel="Provider"
29
+ * />
30
+ * ```
31
+ *
32
+ * @param schema - The JSON Schema definition containing a `oneOf` array and optional `discriminator`
33
+ * @param value - Current field value
34
+ * @param onChange - Called with the new value when the selected type or sub-value changes
35
+ * @param path - Field path segments used for validation error tracking
36
+ * @param level - Nesting depth passed to child editor components
37
+ * @param [ariaLabel] - Accessible name of the type selector; defaults to the select-type placeholder
38
+ */
39
+ export declare const SchemaOneOfEditor: FC<SchemaOneOfEditorProps>;
@@ -0,0 +1,38 @@
1
+ import { FC } from 'react';
2
+ import { JsonSchemaDef } from '../../../../models/json-schema';
3
+ export interface SchemaPrimitiveFieldProps {
4
+ schema: JsonSchemaDef;
5
+ value: unknown;
6
+ onChange: (value: unknown) => void;
7
+ invalid?: boolean;
8
+ id?: string;
9
+ ariaLabel?: string;
10
+ }
11
+ /**
12
+ * Renders a single primitive schema field: string, integer, number, boolean, enum, or const.
13
+ * - `dial:resource` with `acceptableResourceTypes` → select over the live resource options
14
+ * - `isProtected: true` → masked password input
15
+ * - `enum` + `enumDisplay: 'radio'` → radio group (`enumOrientation: 'row'` lays it out horizontally)
16
+ * - `enum` without `enumDisplay` → select
17
+ * - `const` → disabled read-only input
18
+ * aliases: SchemaInputField|PrimitiveSchemaField
19
+ * Design system 2.0
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * <SchemaPrimitiveField
24
+ * schema={{ type: 'string', enum: ['a', 'b'], enumDisplay: 'radio', enumOrientation: 'row' }}
25
+ * value="a"
26
+ * onChange={(v) => console.log(v)}
27
+ * ariaLabel="Mode"
28
+ * />
29
+ * ```
30
+ *
31
+ * @param schema - The resolved JSON Schema definition; supports `isProtected`, `enumDisplay`, `enumOrientation`
32
+ * @param value - Current field value
33
+ * @param onChange - Called with the new value when the field changes
34
+ * @param [invalid] - Whether the field has a validation error (applies error styling)
35
+ * @param [id] - Id of the control, for a visible label to point at
36
+ * @param [ariaLabel] - Accessible name of the control
37
+ */
38
+ export declare const SchemaPrimitiveField: FC<SchemaPrimitiveFieldProps>;
@@ -0,0 +1,39 @@
1
+ import { FC, ReactNode } from 'react';
2
+ export interface SchemaSectionProps {
3
+ title: string;
4
+ description?: string;
5
+ summary?: string;
6
+ errorCount?: number;
7
+ level?: number;
8
+ children?: ReactNode;
9
+ onRemove?: () => void;
10
+ defaultExpanded?: boolean;
11
+ removeItemAriaLabel?: string;
12
+ }
13
+ /**
14
+ * A collapsible card wrapping a group of schema properties.
15
+ * aliases: CollapsibleSchemaSection|SchemaCard
16
+ * Design system 2.0
17
+ *
18
+ * Only the chevron and the title sit inside the toggle button. The info button
19
+ * and the remove button are its siblings, since a button nested in a button is
20
+ * invalid and its clicks would toggle the section too.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * <SchemaSection title="Settings" level={0} summary="3/4 fields" errorCount={1}>
25
+ * <p>Content</p>
26
+ * </SchemaSection>
27
+ * ```
28
+ *
29
+ * @param title - Section header title
30
+ * @param [description] - Explanatory text, exposed through an info button in the header
31
+ * @param [summary] - Short summary text shown in the header (e.g. "3/4 fields", "2 items")
32
+ * @param [errorCount=0] - Number of validation errors; shows an error count when > 0
33
+ * @param [level=0] - Nesting depth; 0 is the top-level card, 1+ the nested one
34
+ * @param [children] - Section body, mounted only while expanded
35
+ * @param [onRemove] - If provided, shows a remove button in the header
36
+ * @param [defaultExpanded=true] - Whether the section starts expanded
37
+ * @param [removeItemAriaLabel='Remove item'] - Accessible name of the remove button
38
+ */
39
+ export declare const SchemaSection: FC<SchemaSectionProps>;
@@ -0,0 +1,8 @@
1
+ import { SchemaRendererContextValue } from './types';
2
+ export declare const SchemaRendererContext: import('react').Context<SchemaRendererContextValue | null>;
3
+ export declare const useSchemaContext: () => SchemaRendererContextValue;
4
+ /**
5
+ * Whether a path, or any path under it, has been touched. Every field counts as
6
+ * touched while `skipUntouched` is off, so errors show from the first render.
7
+ */
8
+ export declare const isPathTouched: (path: string, touchedPaths?: ReadonlySet<string>, skipUntouched?: boolean, includeDescendants?: boolean) => boolean;
@@ -0,0 +1,76 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ import { JsonSchema, JsonSchemaDef, SchemaRendererTexts } from '../../../models/json-schema';
3
+ import { SchemaRendererVariant } from '../../../types/json-schema';
4
+ export type SchemaRenderField = (path: string[], schema: JsonSchemaDef, defaultElement: ReactElement) => ReactNode;
5
+ export interface SchemaRendererProps {
6
+ schema: JsonSchema;
7
+ defaultValue?: Record<string, unknown>;
8
+ texts?: Partial<SchemaRendererTexts>;
9
+ className?: string;
10
+ readonly?: boolean;
11
+ defaultExpanded?: boolean;
12
+ /** Additional classes for the container of every text, number and select field. */
13
+ inputClassName?: string;
14
+ /**
15
+ * `Sections` (default) — every top-level property is a collapsible section card.
16
+ * `Flat` — primitive top-level properties render as labelled fields; object and
17
+ * array properties still use collapsible sections.
18
+ * `FlatSections` — every top-level property renders under a plain heading.
19
+ */
20
+ variant?: SchemaRendererVariant;
21
+ /**
22
+ * When `true`, required-field errors are only shown after the user has interacted
23
+ * with a field. When `false` (default), all unfilled required fields are highlighted immediately.
24
+ */
25
+ skipUntouched?: boolean;
26
+ /**
27
+ * Live resource options for schema properties flagged with `dial:resource: true`.
28
+ * Keyed by the resource type name referenced in a property's `acceptableResourceTypes`
29
+ * array; each value provides the selectable entries for that resource type (a string
30
+ * array for string-typed properties).
31
+ */
32
+ acceptableResourceTypes?: Record<string, unknown>;
33
+ onChange?: (value: Record<string, unknown>) => void;
34
+ onPropertyChange?: (path: string, value: unknown) => void;
35
+ onDefaultValues?: (value: Record<string, unknown>) => void;
36
+ /**
37
+ * Override the rendered element for any field by path. The field's label and
38
+ * error stay outside the element, so an override replaces the control only.
39
+ * Return `defaultElement` to fall back to the built-in renderer.
40
+ * @param path - Array of schema property keys leading to this field (e.g. ['connection', 'token'])
41
+ * @param schema - The resolved JSON Schema definition for this field
42
+ * @param defaultElement - The element that would be rendered without customization
43
+ */
44
+ renderField?: SchemaRenderField;
45
+ }
46
+ export interface SchemaFieldContentProps {
47
+ schema: JsonSchemaDef;
48
+ value: unknown;
49
+ onChange: (value: unknown) => void;
50
+ path: string[];
51
+ level: number;
52
+ required?: boolean;
53
+ suppressInlineError?: boolean;
54
+ /** The id given to a primitive control, so a visible label can point at it. */
55
+ fieldId?: string;
56
+ /**
57
+ * Accessible name for the control. Sections, array items and key-value rows
58
+ * have no visible label next to their control, so this is what names it.
59
+ */
60
+ ariaLabel?: string;
61
+ }
62
+ export interface SchemaFieldProps extends Omit<SchemaFieldContentProps, 'fieldId' | 'ariaLabel' | 'suppressInlineError'> {
63
+ label?: string;
64
+ }
65
+ export interface SchemaRendererContextValue {
66
+ rootSchema: JsonSchema;
67
+ texts: SchemaRendererTexts;
68
+ readonly?: boolean;
69
+ defaultExpanded?: boolean;
70
+ inputClassName?: string;
71
+ acceptableResourceTypes?: Record<string, unknown>;
72
+ renderField?: SchemaRenderField;
73
+ touchedPaths?: ReadonlySet<string>;
74
+ markTouched?: (path: string) => void;
75
+ skipUntouched?: boolean;
76
+ }
@@ -1,4 +1,4 @@
1
- import { FC, InputHTMLAttributes } from 'react';
1
+ import { FC, InputHTMLAttributes, ReactNode } from 'react';
2
2
  import { LabelProps } from '../Label/Label';
3
3
  type NativeInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'defaultValue' | 'onChange' | 'size'>;
4
4
  export interface SliderProps extends NativeInputProps {
@@ -14,6 +14,14 @@ export interface SliderProps extends NativeInputProps {
14
14
  formatValue?: (value: number) => string;
15
15
  /** Renders the current value at the end of the label row */
16
16
  showValue?: boolean;
17
+ /** Renders the current value in a bubble above the thumb */
18
+ showTooltip?: boolean;
19
+ /** Renders a tick mark at every value the thumb can snap to */
20
+ showTicks?: boolean;
21
+ /** Content before the track, e.g. an icon */
22
+ leftContent?: ReactNode;
23
+ /** Content after the track, e.g. a `NumberInput` or the formatted value */
24
+ rightContent?: ReactNode;
17
25
  caption?: string;
18
26
  error?: string;
19
27
  onChange?: (value: number) => void;
@@ -39,6 +47,13 @@ export interface SliderProps extends NativeInputProps {
39
47
  * />
40
48
  * ```
41
49
  *
50
+ * With `showTooltip` the value sits in a bubble above the thumb, and with
51
+ * `showTicks` the track marks every value the thumb snaps to — the discrete
52
+ * slider of the design. `leftContent` and `rightContent` are the container's
53
+ * side slots, centred on the track: an icon on the left, a `NumberInput` or the
54
+ * formatted value on the right. The kit does not wire a `NumberInput` to the
55
+ * slider; the caller passes both the same `value` and `onChange`.
56
+ *
42
57
  * Built on a native `<input type="range">`, so the browser owns the drag, the
43
58
  * arrow / Home / End steps, touch and the writing direction. Only the thumb is
44
59
  * restyled; the track and its fill are separate elements so the fill can be
@@ -58,6 +73,10 @@ export interface SliderProps extends NativeInputProps {
58
73
  * @param [labels] - 2 or 3 strings rendered below the track (start, [middle,] end)
59
74
  * @param [formatValue] - Custom formatter for the displayed value; also becomes the announced `aria-valuetext`
60
75
  * @param [showValue=false] - Renders the current value at the end of the label row
76
+ * @param [showTooltip=false] - Renders the current value in a bubble above the thumb; hidden while disabled
77
+ * @param [showTicks=false] - Renders a tick mark at every step on the unfilled track; hidden while disabled
78
+ * @param [leftContent] - Content before the track, vertically centred on it
79
+ * @param [rightContent] - Content after the track, vertically centred on it
61
80
  * @param [caption] - Helper text rendered below the track, and described by the slider
62
81
  * @param [error] - Error message rendered below the track; replaces the caption
63
82
  * @param [onChange] - Callback fired with the new value
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Percent positions of every value a slider thumb can snap to, from `min` (0)
3
+ * up. A step that does not divide the range stops short of `max`, the way the
4
+ * native range input does.
5
+ */
6
+ export declare const getTickPercents: (range: number, step: number) => number[];
@@ -0,0 +1 @@
1
+ export {};
@@ -1,98 +1,10 @@
1
1
  import { default as React } from 'react';
2
2
  import { EditorThemes } from '../../types/editor';
3
- export declare enum SchemaRendererVariant {
4
- Sections = "sections",
5
- Flat = "flat",
6
- FlatSections = "flat-sections"
7
- }
8
- export declare enum SchemaDisplayMode {
9
- Select = "select",
10
- Radio = "radio"
11
- }
12
- export declare enum SchemaOrientation {
13
- Row = "row",
14
- Column = "column"
15
- }
16
- export declare enum JsonSchemaType {
17
- String = "string",
18
- Number = "number",
19
- Integer = "integer",
20
- Boolean = "boolean",
21
- Object = "object",
22
- Array = "array",
23
- Null = "null"
24
- }
25
- export interface DialMeta {
26
- 'dial:propertyOrder'?: number;
27
- [key: string]: unknown;
28
- }
29
- export interface JsonSchemaDef {
30
- $ref?: string;
31
- type?: string | string[];
32
- title?: string;
33
- description?: string;
34
- isHidden?: boolean;
35
- isProtected?: boolean;
36
- enumDisplay?: SchemaDisplayMode;
37
- enumOrientation?: SchemaOrientation;
38
- discriminatorDisplay?: SchemaDisplayMode;
39
- discriminatorOrientation?: SchemaOrientation;
40
- default?: unknown;
41
- const?: unknown;
42
- enum?: unknown[];
43
- properties?: Record<string, JsonSchemaDef>;
44
- required?: string[];
45
- items?: JsonSchemaDef;
46
- oneOf?: JsonSchemaDef[];
47
- anyOf?: JsonSchemaDef[];
48
- allOf?: JsonSchemaDef[];
49
- discriminator?: {
50
- propertyName: string;
51
- mapping: Record<string, string>;
52
- };
53
- 'dial:meta'?: DialMeta;
54
- 'dial:resource'?: boolean;
55
- acceptableResourceTypes?: string[];
56
- [key: string]: unknown;
57
- }
58
- export interface JsonSchema extends JsonSchemaDef {
59
- $defs?: Record<string, JsonSchemaDef>;
60
- }
61
- export interface ValidationError {
62
- path: string;
63
- message: string;
64
- }
65
- export interface SchemaRendererTexts {
66
- noItemSchema: string;
67
- noItemsYet: string;
68
- addItem: string;
69
- selectTypeToAdd: string;
70
- noConfigurableProperties: string;
71
- noFieldsYet: string;
72
- keyColumnHeader: string;
73
- valueColumnHeader: string;
74
- addField: string;
75
- keyInputPlaceholder: string;
76
- stringInputPlaceholder: string;
77
- integerInputPlaceholder: string;
78
- numberInputPlaceholder: string;
79
- enumSelectPlaceholder: string;
80
- selectTypePlaceholder: string;
81
- removeItemAriaLabel: string;
82
- removeFieldAriaLabel: string;
83
- typeColumnHeader: string;
84
- entryTypeString: string;
85
- entryTypeNumber: string;
86
- entryTypeBoolean: string;
87
- entryTypeNull: string;
88
- entryTypeObject: string;
89
- entryTypeArray: string;
90
- entryTypeChangeWarning: string;
91
- booleanTrueOption: string;
92
- booleanFalseOption: string;
93
- invalidJsonError: string;
94
- }
95
- export declare const DEFAULT_SCHEMA_TEXTS: SchemaRendererTexts;
3
+ import { SchemaRendererVariant } from '../../types/json-schema';
4
+ import { JsonSchema, JsonSchemaDef, SchemaRendererTexts } from '../../models/json-schema';
5
+ export { SchemaRendererVariant, SchemaDisplayMode, SchemaOrientation, JsonSchemaType, } from '../../types/json-schema';
6
+ export type { DialMeta, JsonSchemaDef, JsonSchema, ValidationError, SchemaRendererTexts, } from '../../models/json-schema';
7
+ export { DEFAULT_SCHEMA_TEXTS } from '../../constants/schema-renderer';
96
8
  export interface DialSchemaRendererProps {
97
9
  schema: JsonSchema;
98
10
  defaultValue?: Record<string, unknown>;
@@ -1,22 +1 @@
1
- import { JsonSchemaType, JsonSchema, JsonSchemaDef, ValidationError } from './types';
2
- export declare function resolveRef(schema: JsonSchemaDef, rootSchema: JsonSchema, depth?: number): JsonSchemaDef;
3
- export declare function sortByPropertyOrder(entries: [string, JsonSchemaDef][]): [string, JsonSchemaDef][];
4
- export declare function isMissingRequiredValue(value: unknown): boolean;
5
- export declare function isObjectType(schema: JsonSchemaDef): boolean;
6
- export declare function toFieldLabel(key: string): string;
7
- /**
8
- * Builds the "required" error message for a field. The label is quoted so a
9
- * long title stays visually separate from the "is required" suffix.
10
- */
11
- export declare const toRequiredMessage: (label: string) => string;
12
- export declare function getOptionLabel(schema: JsonSchemaDef, rootSchema: JsonSchema): string;
13
- export declare function extractDefaults(schema: JsonSchemaDef, rootSchema: JsonSchema, depth?: number): unknown;
14
- export declare function validateRequired(value: unknown, schema: JsonSchemaDef, rootSchema: JsonSchema, path?: string, depth?: number): ValidationError[];
15
- export declare function buildSummary(value: unknown, schema: JsonSchemaDef, rootSchema: JsonSchema): string;
16
- export declare function detectAnyOfVariant(value: unknown, schemas: JsonSchemaDef[], rootSchema: JsonSchema): number;
17
- export declare function getItemTitle(item: unknown, discriminatorProp: string | undefined, index: number): string;
18
- export declare function getSchemaDefault(schema: JsonSchemaDef): unknown;
19
- export type EntryType = JsonSchemaType.String | JsonSchemaType.Number | JsonSchemaType.Boolean | JsonSchemaType.Null | JsonSchemaType.Object | JsonSchemaType.Array;
20
- export declare const ENTRY_TYPE_OPTIONS: EntryType[];
21
- export declare function inferEntryType(value: unknown): EntryType;
22
- export declare function getEntryTypeDefault(type: EntryType): unknown;
1
+ export * from '../../utils/json-schema';
@@ -111,6 +111,14 @@ export declare const DIAL_KIT_CLASS: {
111
111
  readonly inlineSelect: "dial-kit-inline-select";
112
112
  /** The root of a `Calendar`, wrapping its label and date field. */
113
113
  readonly calendar: "dial-kit-calendar";
114
+ /** The root of a `SchemaRenderer`, wrapping its top-level sections or fields. */
115
+ readonly schemaRenderer: "dial-kit-schema-renderer";
116
+ /**
117
+ * The card of one collapsible `SchemaRenderer` section, at any depth: a
118
+ * top-level property, a nested object or array, an array item, or a
119
+ * key-value entry holding an object.
120
+ */
121
+ readonly schemaRendererSection: "dial-kit-schema-renderer-section";
114
122
  /** The drop area of a `FileDropzone`. */
115
123
  readonly fileDropzone: "dial-kit-file-dropzone";
116
124
  /**
@@ -0,0 +1,2 @@
1
+ import { SchemaRendererTexts } from '../models/json-schema';
2
+ export declare const DEFAULT_SCHEMA_TEXTS: SchemaRendererTexts;
@@ -146,7 +146,9 @@ export { NOT_ALLOWED_SYMBOLS, NOT_ALLOWED_SPACES, NOT_ALLOWED_SYMBOLS_REGEXP, NO
146
146
  export { DIAL_KIT_CLASS } from './constants/public-class-names';
147
147
  export { DialSchemaRenderer } from './components/SchemaRenderer/SchemaRenderer';
148
148
  export { SchemaRendererVariant, SchemaDisplayMode, SchemaOrientation, JsonSchemaType, } from './components/SchemaRenderer/types';
149
- export type { DialSchemaRendererProps, JsonSchema, JsonSchemaDef, ValidationError, } from './components/SchemaRenderer/types';
149
+ export type { DialSchemaRendererProps, JsonSchema, JsonSchemaDef, ValidationError, SchemaRendererTexts, } from './components/SchemaRenderer/types';
150
+ export { SchemaRenderer } from './components/New/SchemaRenderer/SchemaRenderer';
151
+ export type { SchemaRendererProps, SchemaRenderField, } from './components/New/SchemaRenderer/types';
150
152
  export { LazyDialJsonEditor } from './components/JsonEditor/lazy';
151
153
  export { LazyDialMarkdownEditor } from './components/MarkdownEditor/lazy';
152
154
  export { NotificationVariant, NotificationType } from './types/notification.ts';