@texaryn/react 0.2.4 → 0.4.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.
- package/CHANGELOG.md +52 -0
- package/README.md +24 -2
- package/dist/components/ErrorSummary.d.ts +6 -0
- package/dist/components/ErrorSummary.d.ts.map +1 -1
- package/dist/components/ErrorSummary.js +9 -1
- package/dist/components/ErrorSummary.js.map +1 -1
- package/dist/components/FieldErrors.d.ts +6 -1
- package/dist/components/FieldErrors.d.ts.map +1 -1
- package/dist/components/FieldErrors.js +9 -5
- package/dist/components/FieldErrors.js.map +1 -1
- package/dist/components/FieldLabelContent.d.ts +22 -0
- package/dist/components/FieldLabelContent.d.ts.map +1 -0
- package/dist/components/FieldLabelContent.js +21 -0
- package/dist/components/FieldLabelContent.js.map +1 -0
- package/dist/context.d.ts +15 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +15 -1
- package/dist/context.js.map +1 -1
- package/dist/hooks/use-array-actions.d.ts +15 -0
- package/dist/hooks/use-array-actions.d.ts.map +1 -0
- package/dist/hooks/use-array-actions.js +21 -0
- package/dist/hooks/use-array-actions.js.map +1 -0
- package/dist/hooks/use-field-binding.d.ts +8 -0
- package/dist/hooks/use-field-binding.d.ts.map +1 -1
- package/dist/hooks/use-field-binding.js +28 -7
- package/dist/hooks/use-field-binding.js.map +1 -1
- package/dist/hooks/use-object-group.d.ts +22 -0
- package/dist/hooks/use-object-group.d.ts.map +1 -0
- package/dist/hooks/use-object-group.js +18 -0
- package/dist/hooks/use-object-group.js.map +1 -0
- package/dist/id-prefix.d.ts +10 -0
- package/dist/id-prefix.d.ts.map +1 -0
- package/dist/id-prefix.js +31 -0
- package/dist/id-prefix.js.map +1 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/props/action-names.d.ts +19 -0
- package/dist/props/action-names.d.ts.map +1 -0
- package/dist/props/action-names.js +30 -0
- package/dist/props/action-names.js.map +1 -0
- package/dist/props/field-props.d.ts +24 -7
- package/dist/props/field-props.d.ts.map +1 -1
- package/dist/props/field-props.js +30 -14
- package/dist/props/field-props.js.map +1 -1
- package/dist/props/index.d.ts +1 -1
- package/dist/props/index.d.ts.map +1 -1
- package/dist/props/index.js +1 -1
- package/dist/props/index.js.map +1 -1
- package/dist/widgets/ArrayControl.d.ts.map +1 -1
- package/dist/widgets/ArrayControl.js +8 -2
- package/dist/widgets/ArrayControl.js.map +1 -1
- package/dist/widgets/Checkbox.d.ts.map +1 -1
- package/dist/widgets/Checkbox.js +2 -1
- package/dist/widgets/Checkbox.js.map +1 -1
- package/dist/widgets/NumberInput.d.ts.map +1 -1
- package/dist/widgets/NumberInput.js +2 -1
- package/dist/widgets/NumberInput.js.map +1 -1
- package/dist/widgets/ObjectLayout.d.ts.map +1 -1
- package/dist/widgets/ObjectLayout.js +12 -9
- package/dist/widgets/ObjectLayout.js.map +1 -1
- package/dist/widgets/Select.d.ts.map +1 -1
- package/dist/widgets/Select.js +2 -1
- package/dist/widgets/Select.js.map +1 -1
- package/dist/widgets/TextInput.d.ts.map +1 -1
- package/dist/widgets/TextInput.js +2 -1
- package/dist/widgets/TextInput.js.map +1 -1
- package/dist/widgets/Textarea.d.ts.map +1 -1
- package/dist/widgets/Textarea.js +2 -1
- package/dist/widgets/Textarea.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -6,14 +6,23 @@ export type { UseFieldReturn } from './hooks/use-field.js';
|
|
|
6
6
|
export { useFieldArray } from './hooks/use-field-array.js';
|
|
7
7
|
export type { UseFieldArrayReturn } from './hooks/use-field-array.js';
|
|
8
8
|
export { useFieldBinding } from './hooks/use-field-binding.js';
|
|
9
|
+
export { useObjectGroup } from './hooks/use-object-group.js';
|
|
10
|
+
export { useArrayActions } from './hooks/use-array-actions.js';
|
|
11
|
+
export type { ArrayActions } from './hooks/use-array-actions.js';
|
|
12
|
+
export { removeActionName, moveUpActionName, addActionName } from './props/action-names.js';
|
|
13
|
+
export type { ObjectGroup } from './hooks/use-object-group.js';
|
|
9
14
|
export type { FieldBinding, DomValueInputProps, DomCheckedInputProps, DomInputBaseProps, } from './hooks/use-field-binding.js';
|
|
10
15
|
export { FormContext, FormProvider, useFormContext } from './context.js';
|
|
11
|
-
export {
|
|
16
|
+
export type { FormProviderProps } from './context.js';
|
|
17
|
+
export { useFormIdPrefix } from './id-prefix.js';
|
|
18
|
+
export { getInputProps, getLabelProps, getErrorProps, getDescriptionProps, hasNativeReadOnly, } from './props/index.js';
|
|
12
19
|
export type { InputProps, LabelProps, ErrorProps, DescriptionProps, FieldState } from './props/index.js';
|
|
13
20
|
export { FormRoot } from './components/FormRoot.js';
|
|
14
21
|
export type { FormRootProps } from './components/FormRoot.js';
|
|
15
22
|
export { NodeRenderer } from './components/NodeRenderer.js';
|
|
16
23
|
export type { NodeRendererProps } from './components/NodeRenderer.js';
|
|
24
|
+
export { FieldLabelContent, REQUIRED_INDICATOR } from './components/FieldLabelContent.js';
|
|
25
|
+
export type { FieldLabelContentProps } from './components/FieldLabelContent.js';
|
|
17
26
|
export { FieldErrors } from './components/FieldErrors.js';
|
|
18
27
|
export type { FieldErrorsProps } from './components/FieldErrors.js';
|
|
19
28
|
export { ErrorSummary } from './components/ErrorSummary.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,aAAa,EA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AE,MAAM,cAAc,CAAA;AACxE,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EACL,aAAa,EACb,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxG,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACzF,YAAY,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAC7F,OAAO,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,qBAAqB,GACtB,MAAM,oBAAoB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -3,10 +3,15 @@ export { useForm } from './hooks/use-form.js';
|
|
|
3
3
|
export { useField } from './hooks/use-field.js';
|
|
4
4
|
export { useFieldArray } from './hooks/use-field-array.js';
|
|
5
5
|
export { useFieldBinding } from './hooks/use-field-binding.js';
|
|
6
|
+
export { useObjectGroup } from './hooks/use-object-group.js';
|
|
7
|
+
export { useArrayActions } from './hooks/use-array-actions.js';
|
|
8
|
+
export { removeActionName, moveUpActionName, addActionName } from './props/action-names.js';
|
|
6
9
|
export { FormContext, FormProvider, useFormContext } from './context.js';
|
|
7
|
-
export {
|
|
10
|
+
export { useFormIdPrefix } from './id-prefix.js';
|
|
11
|
+
export { getInputProps, getLabelProps, getErrorProps, getDescriptionProps, hasNativeReadOnly, } from './props/index.js';
|
|
8
12
|
export { FormRoot } from './components/FormRoot.js';
|
|
9
13
|
export { NodeRenderer } from './components/NodeRenderer.js';
|
|
14
|
+
export { FieldLabelContent, REQUIRED_INDICATOR } from './components/FieldLabelContent.js';
|
|
10
15
|
export { FieldErrors } from './components/FieldErrors.js';
|
|
11
16
|
export { ErrorSummary } from './components/ErrorSummary.js';
|
|
12
17
|
export { useRendererContext } from './components/renderer-context.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAE9D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAQ3F,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EACL,aAAa,EACb,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAE3D,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAEzF,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAErE,OAAO,EACL,SAAS,EACT,WAAW,EACX,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,qBAAqB,GACtB,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accessible names for the controls an array renders.
|
|
3
|
+
*
|
|
4
|
+
* Five identical "Remove" buttons tell a screen reader user nothing about
|
|
5
|
+
* which row they act on. The name carries the current 1-based position, which
|
|
6
|
+
* is what a person means by "the second contact"; the stable item id is
|
|
7
|
+
* implementation identity and means nothing to them.
|
|
8
|
+
*
|
|
9
|
+
* The row's own value is deliberately not used. It is mutable, often blank,
|
|
10
|
+
* frequently duplicated, sometimes long, and sometimes sensitive.
|
|
11
|
+
*
|
|
12
|
+
* Titles come from the schema: the array's own title, and the item title,
|
|
13
|
+
* which repeats across rows and so cannot distinguish them on its own. Each
|
|
14
|
+
* name degrades cleanly as those go missing.
|
|
15
|
+
*/
|
|
16
|
+
export declare function removeActionName(position: number, itemTitle: string | undefined, arrayTitle: string | undefined): string;
|
|
17
|
+
export declare function moveUpActionName(position: number, itemTitle: string | undefined, arrayTitle: string | undefined): string;
|
|
18
|
+
export declare function addActionName(itemTitle: string | undefined, arrayTitle: string | undefined): string;
|
|
19
|
+
//# sourceMappingURL=action-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-names.d.ts","sourceRoot":"","sources":["../../src/props/action-names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,MAAM,CAER;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,MAAM,CAER;AAED,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,MAAM,CAGR"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accessible names for the controls an array renders.
|
|
3
|
+
*
|
|
4
|
+
* Five identical "Remove" buttons tell a screen reader user nothing about
|
|
5
|
+
* which row they act on. The name carries the current 1-based position, which
|
|
6
|
+
* is what a person means by "the second contact"; the stable item id is
|
|
7
|
+
* implementation identity and means nothing to them.
|
|
8
|
+
*
|
|
9
|
+
* The row's own value is deliberately not used. It is mutable, often blank,
|
|
10
|
+
* frequently duplicated, sometimes long, and sometimes sensitive.
|
|
11
|
+
*
|
|
12
|
+
* Titles come from the schema: the array's own title, and the item title,
|
|
13
|
+
* which repeats across rows and so cannot distinguish them on its own. Each
|
|
14
|
+
* name degrades cleanly as those go missing.
|
|
15
|
+
*/
|
|
16
|
+
export function removeActionName(position, itemTitle, arrayTitle) {
|
|
17
|
+
return withContainer(`Remove ${itemTitle ?? 'item'} ${position}`, 'from', arrayTitle);
|
|
18
|
+
}
|
|
19
|
+
export function moveUpActionName(position, itemTitle, arrayTitle) {
|
|
20
|
+
return withContainer(`Move up ${itemTitle ?? 'item'} ${position}`, 'in', arrayTitle);
|
|
21
|
+
}
|
|
22
|
+
export function addActionName(itemTitle, arrayTitle) {
|
|
23
|
+
if (arrayTitle !== undefined)
|
|
24
|
+
return `Add item to ${arrayTitle}`;
|
|
25
|
+
return itemTitle === undefined ? 'Add item' : `Add ${itemTitle}`;
|
|
26
|
+
}
|
|
27
|
+
function withContainer(name, preposition, arrayTitle) {
|
|
28
|
+
return arrayTitle === undefined ? name : `${name} ${preposition} ${arrayTitle}`;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=action-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-names.js","sourceRoot":"","sources":["../../src/props/action-names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAgB,EAChB,SAA6B,EAC7B,UAA8B;IAE9B,OAAO,aAAa,CAAC,UAAU,SAAS,IAAI,MAAM,IAAI,QAAQ,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,CAAA;AACvF,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,QAAgB,EAChB,SAA6B,EAC7B,UAA8B;IAE9B,OAAO,aAAa,CAAC,WAAW,SAAS,IAAI,MAAM,IAAI,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,CAAA;AACtF,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,SAA6B,EAC7B,UAA8B;IAE9B,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,eAAe,UAAU,EAAE,CAAA;IAChE,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,SAAS,EAAE,CAAA;AAClE,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,WAAmB,EAAE,UAA8B;IACtF,OAAO,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,WAAW,IAAI,UAAU,EAAE,CAAA;AACjF,CAAC"}
|
|
@@ -26,6 +26,10 @@ export interface InputProps extends Record<string, unknown> {
|
|
|
26
26
|
name: string;
|
|
27
27
|
value: unknown;
|
|
28
28
|
disabled: boolean;
|
|
29
|
+
/** Native `readonly`, set only on a control HTML honours it for. */
|
|
30
|
+
readOnly?: boolean;
|
|
31
|
+
/** Set instead where HTML has no native read-only, so select and checkbox. */
|
|
32
|
+
'aria-readonly'?: true;
|
|
29
33
|
'aria-required': boolean;
|
|
30
34
|
'aria-invalid'?: boolean;
|
|
31
35
|
'aria-describedby'?: string;
|
|
@@ -41,11 +45,18 @@ export interface LabelProps extends Record<string, unknown> {
|
|
|
41
45
|
htmlFor: string;
|
|
42
46
|
}
|
|
43
47
|
/**
|
|
44
|
-
* HTML/ARIA attributes for an error container
|
|
48
|
+
* HTML/ARIA attributes for an error container.
|
|
49
|
+
*
|
|
50
|
+
* The container is a live region that exists from mount and is empty while the
|
|
51
|
+
* field is valid, because a region inserted with its content already in place
|
|
52
|
+
* is not reliably announced. It is polite rather than an alert: validation runs
|
|
53
|
+
* on change, blur and submit, so assertive would interrupt typing and would
|
|
54
|
+
* speak once per failing field on submit.
|
|
45
55
|
*/
|
|
46
56
|
export interface ErrorProps extends Record<string, unknown> {
|
|
47
57
|
id: string;
|
|
48
|
-
|
|
58
|
+
'aria-live': 'polite';
|
|
59
|
+
'aria-atomic': true;
|
|
49
60
|
}
|
|
50
61
|
/**
|
|
51
62
|
* HTML/ARIA attributes for a description element
|
|
@@ -53,22 +64,28 @@ export interface ErrorProps extends Record<string, unknown> {
|
|
|
53
64
|
export interface DescriptionProps extends Record<string, unknown> {
|
|
54
65
|
id: string;
|
|
55
66
|
}
|
|
56
|
-
export declare function makeId(nodeId: string, suffix: string): string;
|
|
67
|
+
export declare function makeId(idPrefix: string, nodeId: string, suffix: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* HTML honours `readonly` on text, number and textarea only. A select or a
|
|
70
|
+
* checkbox says so through ARIA instead, and the widget refuses the change.
|
|
71
|
+
* Shared with useFieldBinding so the two public surfaces cannot drift apart.
|
|
72
|
+
*/
|
|
73
|
+
export declare function hasNativeReadOnly(node: FieldNode): boolean;
|
|
57
74
|
/**
|
|
58
75
|
* getInputProps: Returns ARIA-correct props for an input element
|
|
59
76
|
* Includes id, name, value, disabled, aria-required, aria-invalid, aria-describedby
|
|
60
77
|
*/
|
|
61
|
-
export declare function getInputProps(node: FieldNode, fieldState: FieldState): InputProps;
|
|
78
|
+
export declare function getInputProps(node: FieldNode, fieldState: FieldState, idPrefix: string): InputProps;
|
|
62
79
|
/**
|
|
63
80
|
* getLabelProps: Returns ARIA-correct props for a label element
|
|
64
81
|
*/
|
|
65
|
-
export declare function getLabelProps(node: FieldNode): LabelProps;
|
|
82
|
+
export declare function getLabelProps(node: FieldNode, idPrefix: string): LabelProps;
|
|
66
83
|
/**
|
|
67
84
|
* getErrorProps: Returns ARIA-correct props for an error container
|
|
68
85
|
*/
|
|
69
|
-
export declare function getErrorProps(node: FieldNode): ErrorProps;
|
|
86
|
+
export declare function getErrorProps(node: FieldNode, idPrefix: string): ErrorProps;
|
|
70
87
|
/**
|
|
71
88
|
* getDescriptionProps: Returns ARIA-correct props for a description element
|
|
72
89
|
*/
|
|
73
|
-
export declare function getDescriptionProps(node: FieldNode): DescriptionProps;
|
|
90
|
+
export declare function getDescriptionProps(node: FieldNode, idPrefix: string): DescriptionProps;
|
|
74
91
|
//# sourceMappingURL=field-props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-props.d.ts","sourceRoot":"","sources":["../../src/props/field-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,KAAK,CAAC;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAA;IAC9G,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAClC,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,OAAO,CAAA;IACjB,eAAe,EAAE,OAAO,CAAA;IACxB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAClC,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,MA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eId(idPrefix, nodeId, suffix) {
|
|
2
|
+
return `${idPrefix}-${nodeId}-${suffix}`;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* HTML honours `readonly` on text, number and textarea only. A select or a
|
|
6
|
+
* checkbox says so through ARIA instead, and the widget refuses the change.
|
|
7
|
+
* Shared with useFieldBinding so the two public surfaces cannot drift apart.
|
|
8
|
+
*/
|
|
9
|
+
export function hasNativeReadOnly(node) {
|
|
10
|
+
if (node.enumValues != null && node.enumValues.length > 0)
|
|
11
|
+
return false;
|
|
12
|
+
return node.fieldType !== 'boolean';
|
|
3
13
|
}
|
|
4
14
|
/**
|
|
5
15
|
* getInputProps: Returns ARIA-correct props for an input element
|
|
6
16
|
* Includes id, name, value, disabled, aria-required, aria-invalid, aria-describedby
|
|
7
17
|
*/
|
|
8
|
-
export function getInputProps(node, fieldState) {
|
|
9
|
-
const id = makeId(node.id, 'input');
|
|
18
|
+
export function getInputProps(node, fieldState, idPrefix) {
|
|
19
|
+
const id = makeId(idPrefix, node.id, 'input');
|
|
10
20
|
const hasDescription = Boolean(node.helpText ?? node.annotations?.description);
|
|
11
21
|
// Build aria-describedby from description and error IDs, in that order
|
|
12
22
|
const describedByIds = [];
|
|
13
23
|
if (hasDescription) {
|
|
14
|
-
describedByIds.push(makeId(node.id, 'description'));
|
|
24
|
+
describedByIds.push(makeId(idPrefix, node.id, 'description'));
|
|
15
25
|
}
|
|
16
26
|
if (fieldState.showErrors && fieldState.errors.length > 0) {
|
|
17
|
-
describedByIds.push(makeId(node.id, 'error'));
|
|
27
|
+
describedByIds.push(makeId(idPrefix, node.id, 'error'));
|
|
18
28
|
}
|
|
19
29
|
const props = {
|
|
20
30
|
id,
|
|
21
31
|
name: node.dataPointer || node.id,
|
|
22
32
|
value: fieldState.value,
|
|
23
33
|
disabled: fieldState.disabled,
|
|
34
|
+
...(node.readOnly
|
|
35
|
+
? hasNativeReadOnly(node)
|
|
36
|
+
? { readOnly: true }
|
|
37
|
+
: { 'aria-readonly': true }
|
|
38
|
+
: {}),
|
|
24
39
|
'aria-required': Boolean(node.constraints?.required),
|
|
25
40
|
'aria-describedby': describedByIds.length > 0 ? describedByIds.join(' ') : undefined,
|
|
26
41
|
onChange: fieldState.onChange,
|
|
@@ -37,27 +52,28 @@ export function getInputProps(node, fieldState) {
|
|
|
37
52
|
/**
|
|
38
53
|
* getLabelProps: Returns ARIA-correct props for a label element
|
|
39
54
|
*/
|
|
40
|
-
export function getLabelProps(node) {
|
|
55
|
+
export function getLabelProps(node, idPrefix) {
|
|
41
56
|
return {
|
|
42
|
-
id: makeId(node.id, 'label'),
|
|
43
|
-
htmlFor: makeId(node.id, 'input'),
|
|
57
|
+
id: makeId(idPrefix, node.id, 'label'),
|
|
58
|
+
htmlFor: makeId(idPrefix, node.id, 'input'),
|
|
44
59
|
};
|
|
45
60
|
}
|
|
46
61
|
/**
|
|
47
62
|
* getErrorProps: Returns ARIA-correct props for an error container
|
|
48
63
|
*/
|
|
49
|
-
export function getErrorProps(node) {
|
|
64
|
+
export function getErrorProps(node, idPrefix) {
|
|
50
65
|
return {
|
|
51
|
-
id: makeId(node.id, 'error'),
|
|
52
|
-
|
|
66
|
+
id: makeId(idPrefix, node.id, 'error'),
|
|
67
|
+
'aria-live': 'polite',
|
|
68
|
+
'aria-atomic': true,
|
|
53
69
|
};
|
|
54
70
|
}
|
|
55
71
|
/**
|
|
56
72
|
* getDescriptionProps: Returns ARIA-correct props for a description element
|
|
57
73
|
*/
|
|
58
|
-
export function getDescriptionProps(node) {
|
|
74
|
+
export function getDescriptionProps(node, idPrefix) {
|
|
59
75
|
return {
|
|
60
|
-
id: makeId(node.id, 'description'),
|
|
76
|
+
id: makeId(idPrefix, node.id, 'description'),
|
|
61
77
|
};
|
|
62
78
|
}
|
|
63
79
|
//# sourceMappingURL=field-props.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-props.js","sourceRoot":"","sources":["../../src/props/field-props.ts"],"names":[],"mappings":"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,CAAC,EAAE,EAAE,OAAO,CAAC;QACtC,WAAW,EAAE,QAAQ;QACrB,aAAa,EAAE,IAAI;KACpB,CAAA;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAe,EAAE,QAAgB;IACnE,OAAO;QACL,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,aAAa,CAAC;KAC7C,CAAA;AACH,CAAC"}
|
package/dist/props/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { getInputProps, getLabelProps, getErrorProps, getDescriptionProps } from './field-props.js';
|
|
1
|
+
export { getInputProps, getLabelProps, getErrorProps, getDescriptionProps, hasNativeReadOnly, } from './field-props.js';
|
|
2
2
|
export type { InputProps, LabelProps, ErrorProps, DescriptionProps, FieldState } from './field-props.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/props/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/props/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/props/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getInputProps, getLabelProps, getErrorProps, getDescriptionProps } from './field-props.js';
|
|
1
|
+
export { getInputProps, getLabelProps, getErrorProps, getDescriptionProps, hasNativeReadOnly, } from './field-props.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/props/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/props/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/props/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,kBAAkB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayControl.d.ts","sourceRoot":"","sources":["../../src/widgets/ArrayControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"ArrayControl.d.ts","sourceRoot":"","sources":["../../src/widgets/ArrayControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAA;AAM1D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,iBAAS,gBAAgB,CAAC,EAAE,IAAI,EAAE,EAAE,WAAW,qBAqC9C;AAED,eAAO,MAAM,YAAY,oDAGxB,CAAA"}
|
|
@@ -3,14 +3,20 @@ import React from 'react';
|
|
|
3
3
|
import { useFieldArray } from '../hooks/use-field-array.js';
|
|
4
4
|
import { NodeRenderer } from '../components/NodeRenderer.js';
|
|
5
5
|
import { useRendererContext } from '../components/renderer-context.js';
|
|
6
|
+
import { useArrayActions } from '../hooks/use-array-actions.js';
|
|
6
7
|
function ArrayControlImpl({ node }) {
|
|
7
8
|
const containerNode = node;
|
|
8
9
|
const fieldArray = useFieldArray(containerNode.id);
|
|
9
10
|
const { document, registry } = useRendererContext();
|
|
11
|
+
const actions = useArrayActions(node);
|
|
10
12
|
return (_jsxs("div", { children: [fieldArray.items.map((item, index) => {
|
|
11
13
|
const childNode = item.nodeId ? document.nodes[item.nodeId] : undefined;
|
|
12
|
-
return (_jsxs("div", { children: [childNode ? (_jsx(NodeRenderer, { node: childNode, document: document, registry: registry })) : null, fieldArray.canRemove ? (
|
|
13
|
-
|
|
14
|
+
return (_jsxs("div", { children: [childNode ? (_jsx(NodeRenderer, { node: childNode, document: document, registry: registry })) : null, fieldArray.canRemove ? (
|
|
15
|
+
// The visible word stays short; the name that distinguishes the
|
|
16
|
+
// row goes in aria-label, which contains it so speech input
|
|
17
|
+
// still works.
|
|
18
|
+
_jsx("button", { type: "button", "aria-label": actions.removeName(index + 1, childNode), onClick: () => fieldArray.remove(index), children: "Remove" })) : null] }, item.id));
|
|
19
|
+
}), fieldArray.canAdd ? (_jsx("button", { type: "button", "aria-label": actions.addName, onClick: () => fieldArray.add(), children: "Add" })) : null] }));
|
|
14
20
|
}
|
|
15
21
|
export const ArrayControl = React.memo(ArrayControlImpl, (prev, next) => prev.node.id === next.node.id);
|
|
16
22
|
//# sourceMappingURL=ArrayControl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayControl.js","sourceRoot":"","sources":["../../src/widgets/ArrayControl.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"ArrayControl.js","sourceRoot":"","sources":["../../src/widgets/ArrayControl.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAE,eAAe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oBAEzE,CACV,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CACpC,gBAAgB,EAChB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,CAC9C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/widgets/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/widgets/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,eAAe,CAAA;AAKtD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,iBAAS,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE,WAAW,qBAW1C;AAED,eAAO,MAAM,QAAQ,gDAGpB,CAAA"}
|
package/dist/widgets/Checkbox.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useFieldBinding } from '../hooks/use-field-binding.js';
|
|
4
|
+
import { FieldLabelContent } from '../components/FieldLabelContent.js';
|
|
4
5
|
import { FieldErrors } from '../components/FieldErrors.js';
|
|
5
6
|
function CheckboxImpl({ node }) {
|
|
6
7
|
const field = useFieldBinding(node);
|
|
7
|
-
return (_jsxs("div", { children: [_jsx("input", { ...field.domCheckboxProps, type: "checkbox" }), _jsx("label", { ...field.labelProps, children: field.label }), field.description ? _jsx("div", { ...field.descriptionProps, children: field.description }) : null, _jsx(FieldErrors, { node: field.node, errors: field.errors, showErrors: field.invalid })] }));
|
|
8
|
+
return (_jsxs("div", { children: [_jsx("input", { ...field.domCheckboxProps, type: "checkbox" }), _jsx("label", { ...field.labelProps, children: _jsx(FieldLabelContent, { label: field.label, required: field.required }) }), field.description ? _jsx("div", { ...field.descriptionProps, children: field.description }) : null, _jsx(FieldErrors, { node: field.node, errors: field.errors, showErrors: field.invalid })] }));
|
|
8
9
|
}
|
|
9
10
|
export const Checkbox = React.memo(CheckboxImpl, (prev, next) => prev.node.id === next.node.id);
|
|
10
11
|
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../src/widgets/Checkbox.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAM1D,SAAS,YAAY,CAAC,EAAE,IAAI,EAAe;IACzC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAiB,CAAC,CAAA;IAEhD,OAAO,CACL,0BACE,mBAAW,KAAK,CAAC,gBAAgB,EAAE,IAAI,EAAC,UAAU,GAAG,EACrD,mBAAW,KAAK,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../src/widgets/Checkbox.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAM1D,SAAS,YAAY,CAAC,EAAE,IAAI,EAAe;IACzC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAiB,CAAC,CAAA;IAEhD,OAAO,CACL,0BACE,mBAAW,KAAK,CAAC,gBAAgB,EAAE,IAAI,EAAC,UAAU,GAAG,EACrD,mBAAW,KAAK,CAAC,UAAU,YAAE,KAAC,iBAAiB,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,GAAQ,EACvG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,iBAAS,KAAK,CAAC,gBAAgB,YAAG,KAAK,CAAC,WAAW,GAAO,CAAC,CAAC,CAAC,IAAI,EACtF,KAAC,WAAW,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,GAAI,IAC9E,CACP,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAChC,YAAY,EACZ,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,CAC9C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../src/widgets/NumberInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../src/widgets/NumberInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,eAAe,CAAA;AAKtD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,iBAAS,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,WAAW,qBAW7C;AAED,eAAO,MAAM,WAAW,mDAGvB,CAAA"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useFieldBinding } from '../hooks/use-field-binding.js';
|
|
4
|
+
import { FieldLabelContent } from '../components/FieldLabelContent.js';
|
|
4
5
|
import { FieldErrors } from '../components/FieldErrors.js';
|
|
5
6
|
function NumberInputImpl({ node }) {
|
|
6
7
|
const field = useFieldBinding(node);
|
|
7
|
-
return (_jsxs("div", { children: [_jsx("label", { ...field.labelProps, children: field.label }), _jsx("input", { ...field.domInputProps, type: "number" }), field.description ? _jsx("div", { ...field.descriptionProps, children: field.description }) : null, _jsx(FieldErrors, { node: field.node, errors: field.errors, showErrors: field.invalid })] }));
|
|
8
|
+
return (_jsxs("div", { children: [_jsx("label", { ...field.labelProps, children: _jsx(FieldLabelContent, { label: field.label, required: field.required }) }), _jsx("input", { ...field.domInputProps, type: "number" }), field.description ? _jsx("div", { ...field.descriptionProps, children: field.description }) : null, _jsx(FieldErrors, { node: field.node, errors: field.errors, showErrors: field.invalid })] }));
|
|
8
9
|
}
|
|
9
10
|
export const NumberInput = React.memo(NumberInputImpl, (prev, next) => prev.node.id === next.node.id);
|
|
10
11
|
//# sourceMappingURL=NumberInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.js","sourceRoot":"","sources":["../../src/widgets/NumberInput.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAM1D,SAAS,eAAe,CAAC,EAAE,IAAI,EAAe;IAC5C,MAAM,KAAK,GAAG,eAAe,CAAC,IAAiB,CAAC,CAAA;IAEhD,OAAO,CACL,0BACE,mBAAW,KAAK,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"NumberInput.js","sourceRoot":"","sources":["../../src/widgets/NumberInput.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAM1D,SAAS,eAAe,CAAC,EAAE,IAAI,EAAe;IAC5C,MAAM,KAAK,GAAG,eAAe,CAAC,IAAiB,CAAC,CAAA;IAEhD,OAAO,CACL,0BACE,mBAAW,KAAK,CAAC,UAAU,YAAE,KAAC,iBAAiB,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,GAAQ,EACxG,mBAAW,KAAK,CAAC,aAAa,EAAE,IAAI,EAAC,QAAQ,GAAG,EAC/C,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,iBAAS,KAAK,CAAC,gBAAgB,YAAG,KAAK,CAAC,WAAW,GAAO,CAAC,CAAC,CAAC,IAAI,EACtF,KAAC,WAAW,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,GAAI,IAC9E,CACP,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CACnC,eAAe,EACf,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,CAC9C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectLayout.d.ts","sourceRoot":"","sources":["../../src/widgets/ObjectLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ObjectLayout.d.ts","sourceRoot":"","sources":["../../src/widgets/ObjectLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAK3C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,iBAAS,gBAAgB,CAAC,EAAE,IAAI,EAAE,EAAE,WAAW,qBAsB9C;AAED,eAAO,MAAM,YAAY,oDAGxB,CAAA"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { NodeRenderer } from '../components/NodeRenderer.js';
|
|
4
4
|
import { useRendererContext } from '../components/renderer-context.js';
|
|
5
|
+
import { useObjectGroup } from '../hooks/use-object-group.js';
|
|
5
6
|
function ObjectLayoutImpl({ node }) {
|
|
6
|
-
const containerNode = node;
|
|
7
7
|
const { document, registry } = useRendererContext();
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const { nested, title, children } = useObjectGroup(node);
|
|
9
|
+
const rendered = children.map((child) => (_jsx(NodeRenderer, { node: child, document: document, registry: registry }, child.id)));
|
|
10
|
+
if (!nested) {
|
|
11
|
+
return _jsx("div", { children: rendered });
|
|
12
|
+
}
|
|
13
|
+
// The element is chosen once and only the grouping semantics are re-derived:
|
|
14
|
+
// swapping div for fieldset when a title appears would remount the subtree
|
|
15
|
+
// and drop focus. Children sit in their own element so the legend is never a
|
|
16
|
+
// candidate for reorder.
|
|
17
|
+
return (_jsxs("fieldset", { role: title === undefined ? 'none' : undefined, children: [title === undefined ? null : _jsx("legend", { children: title }), _jsx("div", { children: rendered })] }));
|
|
15
18
|
}
|
|
16
19
|
export const ObjectLayout = React.memo(ObjectLayoutImpl, (prev, next) => prev.node.id === next.node.id);
|
|
17
20
|
//# sourceMappingURL=ObjectLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectLayout.js","sourceRoot":"","sources":["../../src/widgets/ObjectLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"ObjectLayout.js","sourceRoot":"","sources":["../../src/widgets/ObjectLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAM7D,SAAS,gBAAgB,CAAC,EAAE,IAAI,EAAe;IAC7C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,kBAAkB,EAAE,CAAA;IACnD,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,CAAA;IAExD,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACvC,KAAC,YAAY,IAAgB,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,IAA7D,KAAK,CAAC,EAAE,CAAyD,CACrF,CAAC,CAAA;IAEF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,wBAAM,QAAQ,GAAO,CAAA;IAC9B,CAAC;IAED,6EAA6E;IAC7E,2EAA2E;IAC3E,6EAA6E;IAC7E,yBAAyB;IACzB,OAAO,CACL,oBAAU,IAAI,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,aACrD,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,2BAAS,KAAK,GAAU,EACtD,wBAAM,QAAQ,GAAO,IACZ,CACZ,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CACpC,gBAAgB,EAChB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,CAC9C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/widgets/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/widgets/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,eAAe,CAAA;AAKtD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,iBAAS,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE,WAAW,qBAkBxC;AAED,eAAO,MAAM,MAAM,8CAGlB,CAAA"}
|
package/dist/widgets/Select.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useFieldBinding } from '../hooks/use-field-binding.js';
|
|
4
|
+
import { FieldLabelContent } from '../components/FieldLabelContent.js';
|
|
4
5
|
import { FieldErrors } from '../components/FieldErrors.js';
|
|
5
6
|
function SelectImpl({ node }) {
|
|
6
7
|
const field = useFieldBinding(node);
|
|
7
8
|
const enumValues = field.node.enumValues ?? [];
|
|
8
|
-
return (_jsxs("div", { children: [_jsx("label", { ...field.labelProps, children: field.label }), _jsx("select", { ...field.domInputProps, children: enumValues.map((option) => (_jsx("option", { value: String(option.value), children: option.title ?? String(option.value) }, String(option.value)))) }), field.description ? _jsx("div", { ...field.descriptionProps, children: field.description }) : null, _jsx(FieldErrors, { node: field.node, errors: field.errors, showErrors: field.invalid })] }));
|
|
9
|
+
return (_jsxs("div", { children: [_jsx("label", { ...field.labelProps, children: _jsx(FieldLabelContent, { label: field.label, required: field.required }) }), _jsx("select", { ...field.domInputProps, children: enumValues.map((option) => (_jsx("option", { value: String(option.value), children: option.title ?? String(option.value) }, String(option.value)))) }), field.description ? _jsx("div", { ...field.descriptionProps, children: field.description }) : null, _jsx(FieldErrors, { node: field.node, errors: field.errors, showErrors: field.invalid })] }));
|
|
9
10
|
}
|
|
10
11
|
export const Select = React.memo(SelectImpl, (prev, next) => prev.node.id === next.node.id);
|
|
11
12
|
//# sourceMappingURL=Select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../src/widgets/Select.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAM1D,SAAS,UAAU,CAAC,EAAE,IAAI,EAAe;IACvC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAiB,CAAC,CAAA;IAChD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAA;IAE9C,OAAO,CACL,0BACE,mBAAW,KAAK,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../src/widgets/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AI,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,CAC9C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/widgets/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/widgets/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,eAAe,CAAA;AAKtD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,iBAAS,aAAa,CAAC,EAAE,IAAI,EAAE,EAAE,WAAW,qBAW3C;AAED,eAAO,MAAM,SAAS,iDAGrB,CAAA"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useFieldBinding } from '../hooks/use-field-binding.js';
|
|
4
|
+
import { FieldLabelContent } from '../components/FieldLabelContent.js';
|
|
4
5
|
import { FieldErrors } from '../components/FieldErrors.js';
|
|
5
6
|
function TextInputImpl({ node }) {
|
|
6
7
|
const field = useFieldBinding(node);
|
|
7
|
-
return (_jsxs("div", { children: [_jsx("label", { ...field.labelProps, children: field.label }), _jsx("input", { ...field.domInputProps, type: "text" }), field.description ? _jsx("div", { ...field.descriptionProps, children: field.description }) : null, _jsx(FieldErrors, { node: field.node, errors: field.errors, showErrors: field.invalid })] }));
|
|
8
|
+
return (_jsxs("div", { children: [_jsx("label", { ...field.labelProps, children: _jsx(FieldLabelContent, { label: field.label, required: field.required }) }), _jsx("input", { ...field.domInputProps, type: "text" }), field.description ? _jsx("div", { ...field.descriptionProps, children: field.description }) : null, _jsx(FieldErrors, { node: field.node, errors: field.errors, showErrors: field.invalid })] }));
|
|
8
9
|
}
|
|
9
10
|
export const TextInput = React.memo(TextInputImpl, (prev, next) => prev.node.id === next.node.id);
|
|
10
11
|
//# sourceMappingURL=TextInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../src/widgets/TextInput.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAM1D,SAAS,aAAa,CAAC,EAAE,IAAI,EAAe;IAC1C,MAAM,KAAK,GAAG,eAAe,CAAC,IAAiB,CAAC,CAAA;IAEhD,OAAO,CACL,0BACE,mBAAW,KAAK,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../src/widgets/TextInput.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAM1D,SAAS,aAAa,CAAC,EAAE,IAAI,EAAe;IAC1C,MAAM,KAAK,GAAG,eAAe,CAAC,IAAiB,CAAC,CAAA;IAEhD,OAAO,CACL,0BACE,mBAAW,KAAK,CAAC,UAAU,YAAE,KAAC,iBAAiB,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,GAAQ,EACxG,mBAAW,KAAK,CAAC,aAAa,EAAE,IAAI,EAAC,MAAM,GAAG,EAC7C,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,iBAAS,KAAK,CAAC,gBAAgB,YAAG,KAAK,CAAC,WAAW,GAAO,CAAC,CAAC,CAAC,IAAI,EACtF,KAAC,WAAW,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,GAAI,IAC9E,CACP,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CACjC,aAAa,EACb,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,CAC9C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/widgets/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/widgets/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,eAAe,CAAA;AAKtD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,iBAAS,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE,WAAW,qBAW1C;AAED,eAAO,MAAM,QAAQ,gDAGpB,CAAA"}
|
package/dist/widgets/Textarea.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useFieldBinding } from '../hooks/use-field-binding.js';
|
|
4
|
+
import { FieldLabelContent } from '../components/FieldLabelContent.js';
|
|
4
5
|
import { FieldErrors } from '../components/FieldErrors.js';
|
|
5
6
|
function TextareaImpl({ node }) {
|
|
6
7
|
const field = useFieldBinding(node);
|
|
7
|
-
return (_jsxs("div", { children: [_jsx("label", { ...field.labelProps, children: field.label }), _jsx("textarea", { ...field.domInputProps }), field.description ? _jsx("div", { ...field.descriptionProps, children: field.description }) : null, _jsx(FieldErrors, { node: field.node, errors: field.errors, showErrors: field.invalid })] }));
|
|
8
|
+
return (_jsxs("div", { children: [_jsx("label", { ...field.labelProps, children: _jsx(FieldLabelContent, { label: field.label, required: field.required }) }), _jsx("textarea", { ...field.domInputProps }), field.description ? _jsx("div", { ...field.descriptionProps, children: field.description }) : null, _jsx(FieldErrors, { node: field.node, errors: field.errors, showErrors: field.invalid })] }));
|
|
8
9
|
}
|
|
9
10
|
export const Textarea = React.memo(TextareaImpl, (prev, next) => prev.node.id === next.node.id);
|
|
10
11
|
//# sourceMappingURL=Textarea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../src/widgets/Textarea.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAM1D,SAAS,YAAY,CAAC,EAAE,IAAI,EAAe;IACzC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAiB,CAAC,CAAA;IAEhD,OAAO,CACL,0BACE,mBAAW,KAAK,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../src/widgets/Textarea.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAM1D,SAAS,YAAY,CAAC,EAAE,IAAI,EAAe;IACzC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAiB,CAAC,CAAA;IAEhD,OAAO,CACL,0BACE,mBAAW,KAAK,CAAC,UAAU,YAAE,KAAC,iBAAiB,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,GAAQ,EACxG,sBAAc,KAAK,CAAC,aAAa,GAAI,EACpC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,iBAAS,KAAK,CAAC,gBAAgB,YAAG,KAAK,CAAC,WAAW,GAAO,CAAC,CAAC,CAAC,IAAI,EACtF,KAAC,WAAW,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,GAAI,IAC9E,CACP,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAChC,YAAY,EACZ,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,CAC9C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@texaryn/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "React bindings, hooks, prop getters, and default widgets for Texaryn",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"CHANGELOG.md"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@texaryn/core": "^0.
|
|
47
|
+
"@texaryn/core": "^0.7.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"react": ">=18.0.0"
|
|
@@ -52,10 +52,11 @@
|
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@testing-library/react": "^16.0.0",
|
|
54
54
|
"@types/react": "^19.0.0",
|
|
55
|
+
"@types/react-dom": "^19.0.0",
|
|
55
56
|
"jsdom": "^25.0.0",
|
|
56
57
|
"react": "^19.0.0",
|
|
57
58
|
"react-dom": "^19.0.0",
|
|
58
|
-
"@texaryn/schema-json": "0.
|
|
59
|
+
"@texaryn/schema-json": "0.3.0"
|
|
59
60
|
},
|
|
60
61
|
"scripts": {
|
|
61
62
|
"build": "tsc --build"
|