@contember/react-form 1.3.0-alpha.14 → 1.3.0-alpha.16
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/dist/development/components/FormCheckbox.cjs +16 -4
- package/dist/development/components/FormCheckbox.cjs.map +1 -1
- package/dist/development/components/FormCheckbox.js +16 -4
- package/dist/development/components/FormCheckbox.js.map +1 -1
- package/dist/development/components/FormFieldScope.cjs +10 -2
- package/dist/development/components/FormFieldScope.cjs.map +1 -1
- package/dist/development/components/FormFieldScope.js +10 -2
- package/dist/development/components/FormFieldScope.js.map +1 -1
- package/dist/development/components/FormHasManyRelationScope.cjs +10 -2
- package/dist/development/components/FormHasManyRelationScope.cjs.map +1 -1
- package/dist/development/components/FormHasManyRelationScope.js +10 -2
- package/dist/development/components/FormHasManyRelationScope.js.map +1 -1
- package/dist/development/components/FormHasOneRelationScope.cjs +10 -2
- package/dist/development/components/FormHasOneRelationScope.cjs.map +1 -1
- package/dist/development/components/FormHasOneRelationScope.js +10 -2
- package/dist/development/components/FormHasOneRelationScope.js.map +1 -1
- package/dist/development/components/FormInput.cjs +16 -4
- package/dist/development/components/FormInput.cjs.map +1 -1
- package/dist/development/components/FormInput.js +16 -4
- package/dist/development/components/FormInput.js.map +1 -1
- package/dist/development/components/FormLabel.cjs +11 -3
- package/dist/development/components/FormLabel.cjs.map +1 -1
- package/dist/development/components/FormLabel.js +11 -3
- package/dist/development/components/FormLabel.js.map +1 -1
- package/dist/development/components/FormRadioInput.cjs +16 -4
- package/dist/development/components/FormRadioInput.cjs.map +1 -1
- package/dist/development/components/FormRadioInput.js +16 -4
- package/dist/development/components/FormRadioInput.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const reactBinding = require("@contember/react-binding");
|
|
6
6
|
const contexts = require("../contexts.cjs");
|
|
@@ -42,7 +42,7 @@ const FormCheckbox = reactBinding.Component(({ field, isNonbearing, defaultValue
|
|
|
42
42
|
checkboxRef.indeterminate = true;
|
|
43
43
|
}
|
|
44
44
|
}, [checkboxRef, ref, value]);
|
|
45
|
-
return /* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
46
46
|
SlotInput,
|
|
47
47
|
{
|
|
48
48
|
ref: setCheckboxRef,
|
|
@@ -57,12 +57,24 @@ const FormCheckbox = reactBinding.Component(({ field, isNonbearing, defaultValue
|
|
|
57
57
|
accessorGetter().updateValue(e.target.checked);
|
|
58
58
|
}, [accessorGetter]),
|
|
59
59
|
...props
|
|
60
|
-
}
|
|
60
|
+
},
|
|
61
|
+
void 0,
|
|
62
|
+
false,
|
|
63
|
+
{
|
|
64
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormCheckbox.tsx",
|
|
65
|
+
lineNumber: 38,
|
|
66
|
+
columnNumber: 4
|
|
67
|
+
},
|
|
68
|
+
void 0
|
|
61
69
|
);
|
|
62
70
|
}, ({ field, isNonbearing, defaultValue }, env) => {
|
|
63
71
|
const node = reactBinding.TreeNodeEnvironmentFactory.createEnvironmentForField(env, { field }).getSubTreeNode();
|
|
64
72
|
const resolvedDefaultValue = defaultValue !== void 0 ? defaultValue : node.field.defaultValue ?? (node.field.nullable ? null : false);
|
|
65
|
-
return /* @__PURE__ */
|
|
73
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactBinding.Field, { field, isNonbearing, defaultValue: resolvedDefaultValue }, void 0, false, {
|
|
74
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormCheckbox.tsx",
|
|
75
|
+
lineNumber: 57,
|
|
76
|
+
columnNumber: 9
|
|
77
|
+
}, void 0);
|
|
66
78
|
});
|
|
67
79
|
exports.FormCheckbox = FormCheckbox;
|
|
68
80
|
//# sourceMappingURL=FormCheckbox.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormCheckbox.cjs","sources":["../../../src/components/FormCheckbox.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ChangeEventHandler, ReactElement, useCallback, useEffect } from 'react'\nimport { Component, Field, OptionallyVariableFieldValue, SugaredRelativeSingleField, TreeNodeEnvironmentFactory, useField } from '@contember/react-binding'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { dataAttribute } from '@contember/utilities'\nimport { useFormInputValidationHandler } from '../hooks'\nimport { Slot } from '@radix-ui/react-slot'\n\nconst SlotInput = Slot as React.ForwardRefExoticComponent<React.RefAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement>>\n\nexport interface FormCheckboxProps {\n\tfield: SugaredRelativeSingleField['field']\n\tisNonbearing?: boolean\n\tdefaultValue?: OptionallyVariableFieldValue\n\tchildren: ReactElement<HTMLInputElement, 'input'>\n}\n\nexport const FormCheckbox = Component<FormCheckboxProps>(({ field, isNonbearing, defaultValue, ...props }) => {\n\tconst id = useFormFieldId()\n\tconst accessor = useField<boolean>(field)\n\tconst value = accessor.value\n\tconst errors = useFormError() ?? accessor.errors?.errors ?? []\n\tconst accessorGetter = accessor.getAccessor\n\tconst { ref, onFocus, onBlur } = useFormInputValidationHandler(accessor)\n\tconst [checkboxRef, setCheckboxRef] = React.useState<HTMLInputElement | null>(null)\n\n\tuseEffect(() => {\n\t\tif (!checkboxRef) {\n\t\t\treturn\n\t\t}\n\t\t(ref as any).current = checkboxRef\n\t\tif (value === null) {\n\t\t\tcheckboxRef.indeterminate = true\n\t\t}\n\t}, [checkboxRef, ref, value])\n\n\treturn (\n\t\t\t<SlotInput\n\t\t\t\tref={setCheckboxRef}\n\t\t\t\ttype=\"checkbox\"\n\t\t\t\tchecked={accessor.value === true}\n\t\t\t\tdata-state={value === null ? 'indeterminate' : (value ? 'checked' : 'unchecked')}\n\t\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\t\tid={`${id}-input`}\n\t\t\t\tonFocus={onFocus}\n\t\t\t\tonBlur={onBlur}\n\t\t\t\tonChange={useCallback<ChangeEventHandler<HTMLInputElement>>(e => {\n\t\t\t\t\taccessorGetter().updateValue(e.target.checked)\n\t\t\t\t}, [accessorGetter])}\n\t\t\t\t{...props}\n\t\t\t/>\n\t)\n}, ({ field, isNonbearing, defaultValue }, env) => {\n\tconst node = TreeNodeEnvironmentFactory.createEnvironmentForField(env, { field }).getSubTreeNode()\n\tconst resolvedDefaultValue = defaultValue !== undefined ? defaultValue : (node.field.defaultValue ?? (node.field.nullable ? null : false))\n\n\treturn <Field field={field} isNonbearing={isNonbearing} defaultValue={resolvedDefaultValue} />\n})\n"],"names":["Slot","Component","useFormFieldId","useField","useFormError","useFormInputValidationHandler","React","useEffect","
|
|
1
|
+
{"version":3,"file":"FormCheckbox.cjs","sources":["../../../src/components/FormCheckbox.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ChangeEventHandler, ReactElement, useCallback, useEffect } from 'react'\nimport { Component, Field, OptionallyVariableFieldValue, SugaredRelativeSingleField, TreeNodeEnvironmentFactory, useField } from '@contember/react-binding'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { dataAttribute } from '@contember/utilities'\nimport { useFormInputValidationHandler } from '../hooks'\nimport { Slot } from '@radix-ui/react-slot'\n\nconst SlotInput = Slot as React.ForwardRefExoticComponent<React.RefAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement>>\n\nexport interface FormCheckboxProps {\n\tfield: SugaredRelativeSingleField['field']\n\tisNonbearing?: boolean\n\tdefaultValue?: OptionallyVariableFieldValue\n\tchildren: ReactElement<HTMLInputElement, 'input'>\n}\n\nexport const FormCheckbox = Component<FormCheckboxProps>(({ field, isNonbearing, defaultValue, ...props }) => {\n\tconst id = useFormFieldId()\n\tconst accessor = useField<boolean>(field)\n\tconst value = accessor.value\n\tconst errors = useFormError() ?? accessor.errors?.errors ?? []\n\tconst accessorGetter = accessor.getAccessor\n\tconst { ref, onFocus, onBlur } = useFormInputValidationHandler(accessor)\n\tconst [checkboxRef, setCheckboxRef] = React.useState<HTMLInputElement | null>(null)\n\n\tuseEffect(() => {\n\t\tif (!checkboxRef) {\n\t\t\treturn\n\t\t}\n\t\t(ref as any).current = checkboxRef\n\t\tif (value === null) {\n\t\t\tcheckboxRef.indeterminate = true\n\t\t}\n\t}, [checkboxRef, ref, value])\n\n\treturn (\n\t\t\t<SlotInput\n\t\t\t\tref={setCheckboxRef}\n\t\t\t\ttype=\"checkbox\"\n\t\t\t\tchecked={accessor.value === true}\n\t\t\t\tdata-state={value === null ? 'indeterminate' : (value ? 'checked' : 'unchecked')}\n\t\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\t\tid={`${id}-input`}\n\t\t\t\tonFocus={onFocus}\n\t\t\t\tonBlur={onBlur}\n\t\t\t\tonChange={useCallback<ChangeEventHandler<HTMLInputElement>>(e => {\n\t\t\t\t\taccessorGetter().updateValue(e.target.checked)\n\t\t\t\t}, [accessorGetter])}\n\t\t\t\t{...props}\n\t\t\t/>\n\t)\n}, ({ field, isNonbearing, defaultValue }, env) => {\n\tconst node = TreeNodeEnvironmentFactory.createEnvironmentForField(env, { field }).getSubTreeNode()\n\tconst resolvedDefaultValue = defaultValue !== undefined ? defaultValue : (node.field.defaultValue ?? (node.field.nullable ? null : false))\n\n\treturn <Field field={field} isNonbearing={isNonbearing} defaultValue={resolvedDefaultValue} />\n})\n"],"names":["Slot","Component","useFormFieldId","useField","useFormError","useFormInputValidationHandler","React","useEffect","jsxDEV","dataAttribute","useCallback","this","TreeNodeEnvironmentFactory","Field"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,YAAYA,UAAAA;AASL,MAAA,eAAeC,uBAA6B,CAAC,EAAE,OAAO,cAAc,cAAc,GAAG,YAAY;AAC7G,QAAM,KAAKC,SAAAA;AACL,QAAA,WAAWC,sBAAkB,KAAK;AACxC,QAAM,QAAQ,SAAS;AACvB,QAAM,SAASC,SAAAA,aAAa,KAAK,SAAS,QAAQ,UAAU;AAC5D,QAAM,iBAAiB,SAAS;AAChC,QAAM,EAAE,KAAK,SAAS,OAAO,IAAIC,8BAAAA,8BAA8B,QAAQ;AACvE,QAAM,CAAC,aAAa,cAAc,IAAIC,iBAAM,SAAkC,IAAI;AAElFC,QAAAA,UAAU,MAAM;AACf,QAAI,CAAC,aAAa;AACjB;AAAA,IACD;AACC,QAAY,UAAU;AACvB,QAAI,UAAU,MAAM;AACnB,kBAAY,gBAAgB;AAAA,IAC7B;AAAA,EACE,GAAA,CAAC,aAAa,KAAK,KAAK,CAAC;AAG1B,SAAAC,8BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,KAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAS,SAAS,UAAU;AAAA,MAC5B,cAAY,UAAU,OAAO,kBAAmB,QAAQ,YAAY;AAAA,MACpE,gBAAcC,UAAA,cAAc,OAAO,SAAS,CAAC;AAAA,MAC7C,IAAI,GAAG,EAAE;AAAA,MACT;AAAA,MACA;AAAA,MACA,UAAUC,MAAAA,YAAkD,CAAK,MAAA;AAChE,uBAAiB,EAAA,YAAY,EAAE,OAAO,OAAO;AAAA,MAAA,GAC3C,CAAC,cAAc,CAAC;AAAA,MAClB,GAAG;AAAA,IAAA;AAAA,IAZL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAAA;AAeH,GAAG,CAAC,EAAE,OAAO,cAAc,aAAA,GAAgB,QAAQ;AAC5C,QAAA,OAAOC,wCAA2B,0BAA0B,KAAK,EAAE,MAAO,CAAA,EAAE;AAC5E,QAAA,uBAAuB,iBAAiB,SAAY,eAAgB,KAAK,MAAM,iBAAiB,KAAK,MAAM,WAAW,OAAO;AAEnI,SAAQJ,8BAAA,OAAAK,oBAAA,EAAM,OAAc,cAA4B,cAAc,qBAA/D,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAqF,GAAAF,MAAA;AAC7F,CAAC;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { useEffect, useCallback } from "react";
|
|
4
4
|
import { Component, useField, TreeNodeEnvironmentFactory, Field } from "@contember/react-binding";
|
|
@@ -24,7 +24,7 @@ const FormCheckbox = Component(({ field, isNonbearing, defaultValue, ...props })
|
|
|
24
24
|
checkboxRef.indeterminate = true;
|
|
25
25
|
}
|
|
26
26
|
}, [checkboxRef, ref, value]);
|
|
27
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ jsxDEV(
|
|
28
28
|
SlotInput,
|
|
29
29
|
{
|
|
30
30
|
ref: setCheckboxRef,
|
|
@@ -39,12 +39,24 @@ const FormCheckbox = Component(({ field, isNonbearing, defaultValue, ...props })
|
|
|
39
39
|
accessorGetter().updateValue(e.target.checked);
|
|
40
40
|
}, [accessorGetter]),
|
|
41
41
|
...props
|
|
42
|
-
}
|
|
42
|
+
},
|
|
43
|
+
void 0,
|
|
44
|
+
false,
|
|
45
|
+
{
|
|
46
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormCheckbox.tsx",
|
|
47
|
+
lineNumber: 38,
|
|
48
|
+
columnNumber: 4
|
|
49
|
+
},
|
|
50
|
+
void 0
|
|
43
51
|
);
|
|
44
52
|
}, ({ field, isNonbearing, defaultValue }, env) => {
|
|
45
53
|
const node = TreeNodeEnvironmentFactory.createEnvironmentForField(env, { field }).getSubTreeNode();
|
|
46
54
|
const resolvedDefaultValue = defaultValue !== void 0 ? defaultValue : node.field.defaultValue ?? (node.field.nullable ? null : false);
|
|
47
|
-
return /* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ jsxDEV(Field, { field, isNonbearing, defaultValue: resolvedDefaultValue }, void 0, false, {
|
|
56
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormCheckbox.tsx",
|
|
57
|
+
lineNumber: 57,
|
|
58
|
+
columnNumber: 9
|
|
59
|
+
}, void 0);
|
|
48
60
|
});
|
|
49
61
|
export {
|
|
50
62
|
FormCheckbox
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormCheckbox.js","sources":["../../../src/components/FormCheckbox.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ChangeEventHandler, ReactElement, useCallback, useEffect } from 'react'\nimport { Component, Field, OptionallyVariableFieldValue, SugaredRelativeSingleField, TreeNodeEnvironmentFactory, useField } from '@contember/react-binding'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { dataAttribute } from '@contember/utilities'\nimport { useFormInputValidationHandler } from '../hooks'\nimport { Slot } from '@radix-ui/react-slot'\n\nconst SlotInput = Slot as React.ForwardRefExoticComponent<React.RefAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement>>\n\nexport interface FormCheckboxProps {\n\tfield: SugaredRelativeSingleField['field']\n\tisNonbearing?: boolean\n\tdefaultValue?: OptionallyVariableFieldValue\n\tchildren: ReactElement<HTMLInputElement, 'input'>\n}\n\nexport const FormCheckbox = Component<FormCheckboxProps>(({ field, isNonbearing, defaultValue, ...props }) => {\n\tconst id = useFormFieldId()\n\tconst accessor = useField<boolean>(field)\n\tconst value = accessor.value\n\tconst errors = useFormError() ?? accessor.errors?.errors ?? []\n\tconst accessorGetter = accessor.getAccessor\n\tconst { ref, onFocus, onBlur } = useFormInputValidationHandler(accessor)\n\tconst [checkboxRef, setCheckboxRef] = React.useState<HTMLInputElement | null>(null)\n\n\tuseEffect(() => {\n\t\tif (!checkboxRef) {\n\t\t\treturn\n\t\t}\n\t\t(ref as any).current = checkboxRef\n\t\tif (value === null) {\n\t\t\tcheckboxRef.indeterminate = true\n\t\t}\n\t}, [checkboxRef, ref, value])\n\n\treturn (\n\t\t\t<SlotInput\n\t\t\t\tref={setCheckboxRef}\n\t\t\t\ttype=\"checkbox\"\n\t\t\t\tchecked={accessor.value === true}\n\t\t\t\tdata-state={value === null ? 'indeterminate' : (value ? 'checked' : 'unchecked')}\n\t\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\t\tid={`${id}-input`}\n\t\t\t\tonFocus={onFocus}\n\t\t\t\tonBlur={onBlur}\n\t\t\t\tonChange={useCallback<ChangeEventHandler<HTMLInputElement>>(e => {\n\t\t\t\t\taccessorGetter().updateValue(e.target.checked)\n\t\t\t\t}, [accessorGetter])}\n\t\t\t\t{...props}\n\t\t\t/>\n\t)\n}, ({ field, isNonbearing, defaultValue }, env) => {\n\tconst node = TreeNodeEnvironmentFactory.createEnvironmentForField(env, { field }).getSubTreeNode()\n\tconst resolvedDefaultValue = defaultValue !== undefined ? defaultValue : (node.field.defaultValue ?? (node.field.nullable ? null : false))\n\n\treturn <Field field={field} isNonbearing={isNonbearing} defaultValue={resolvedDefaultValue} />\n})\n"],"names":[],"mappings":";;;;;;;;AAQA,MAAM,YAAY;AASL,MAAA,eAAe,UAA6B,CAAC,EAAE,OAAO,cAAc,cAAc,GAAG,YAAY;AAC7G,QAAM,KAAK;AACL,QAAA,WAAW,SAAkB,KAAK;AACxC,QAAM,QAAQ,SAAS;AACvB,QAAM,SAAS,aAAa,KAAK,SAAS,QAAQ,UAAU;AAC5D,QAAM,iBAAiB,SAAS;AAChC,QAAM,EAAE,KAAK,SAAS,OAAO,IAAI,8BAA8B,QAAQ;AACvE,QAAM,CAAC,aAAa,cAAc,IAAI,MAAM,SAAkC,IAAI;AAElF,YAAU,MAAM;AACf,QAAI,CAAC,aAAa;AACjB;AAAA,IACD;AACC,QAAY,UAAU;AACvB,QAAI,UAAU,MAAM;AACnB,kBAAY,gBAAgB;AAAA,IAC7B;AAAA,EACE,GAAA,CAAC,aAAa,KAAK,KAAK,CAAC;AAG1B,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,KAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAS,SAAS,UAAU;AAAA,MAC5B,cAAY,UAAU,OAAO,kBAAmB,QAAQ,YAAY;AAAA,MACpE,gBAAc,cAAc,OAAO,SAAS,CAAC;AAAA,MAC7C,IAAI,GAAG,EAAE;AAAA,MACT;AAAA,MACA;AAAA,MACA,UAAU,YAAkD,CAAK,MAAA;AAChE,uBAAiB,EAAA,YAAY,EAAE,OAAO,OAAO;AAAA,MAAA,GAC3C,CAAC,cAAc,CAAC;AAAA,MAClB,GAAG;AAAA,IAAA;AAAA,EAAA;
|
|
1
|
+
{"version":3,"file":"FormCheckbox.js","sources":["../../../src/components/FormCheckbox.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ChangeEventHandler, ReactElement, useCallback, useEffect } from 'react'\nimport { Component, Field, OptionallyVariableFieldValue, SugaredRelativeSingleField, TreeNodeEnvironmentFactory, useField } from '@contember/react-binding'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { dataAttribute } from '@contember/utilities'\nimport { useFormInputValidationHandler } from '../hooks'\nimport { Slot } from '@radix-ui/react-slot'\n\nconst SlotInput = Slot as React.ForwardRefExoticComponent<React.RefAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement>>\n\nexport interface FormCheckboxProps {\n\tfield: SugaredRelativeSingleField['field']\n\tisNonbearing?: boolean\n\tdefaultValue?: OptionallyVariableFieldValue\n\tchildren: ReactElement<HTMLInputElement, 'input'>\n}\n\nexport const FormCheckbox = Component<FormCheckboxProps>(({ field, isNonbearing, defaultValue, ...props }) => {\n\tconst id = useFormFieldId()\n\tconst accessor = useField<boolean>(field)\n\tconst value = accessor.value\n\tconst errors = useFormError() ?? accessor.errors?.errors ?? []\n\tconst accessorGetter = accessor.getAccessor\n\tconst { ref, onFocus, onBlur } = useFormInputValidationHandler(accessor)\n\tconst [checkboxRef, setCheckboxRef] = React.useState<HTMLInputElement | null>(null)\n\n\tuseEffect(() => {\n\t\tif (!checkboxRef) {\n\t\t\treturn\n\t\t}\n\t\t(ref as any).current = checkboxRef\n\t\tif (value === null) {\n\t\t\tcheckboxRef.indeterminate = true\n\t\t}\n\t}, [checkboxRef, ref, value])\n\n\treturn (\n\t\t\t<SlotInput\n\t\t\t\tref={setCheckboxRef}\n\t\t\t\ttype=\"checkbox\"\n\t\t\t\tchecked={accessor.value === true}\n\t\t\t\tdata-state={value === null ? 'indeterminate' : (value ? 'checked' : 'unchecked')}\n\t\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\t\tid={`${id}-input`}\n\t\t\t\tonFocus={onFocus}\n\t\t\t\tonBlur={onBlur}\n\t\t\t\tonChange={useCallback<ChangeEventHandler<HTMLInputElement>>(e => {\n\t\t\t\t\taccessorGetter().updateValue(e.target.checked)\n\t\t\t\t}, [accessorGetter])}\n\t\t\t\t{...props}\n\t\t\t/>\n\t)\n}, ({ field, isNonbearing, defaultValue }, env) => {\n\tconst node = TreeNodeEnvironmentFactory.createEnvironmentForField(env, { field }).getSubTreeNode()\n\tconst resolvedDefaultValue = defaultValue !== undefined ? defaultValue : (node.field.defaultValue ?? (node.field.nullable ? null : false))\n\n\treturn <Field field={field} isNonbearing={isNonbearing} defaultValue={resolvedDefaultValue} />\n})\n"],"names":["this"],"mappings":";;;;;;;;AAQA,MAAM,YAAY;AASL,MAAA,eAAe,UAA6B,CAAC,EAAE,OAAO,cAAc,cAAc,GAAG,YAAY;AAC7G,QAAM,KAAK;AACL,QAAA,WAAW,SAAkB,KAAK;AACxC,QAAM,QAAQ,SAAS;AACvB,QAAM,SAAS,aAAa,KAAK,SAAS,QAAQ,UAAU;AAC5D,QAAM,iBAAiB,SAAS;AAChC,QAAM,EAAE,KAAK,SAAS,OAAO,IAAI,8BAA8B,QAAQ;AACvE,QAAM,CAAC,aAAa,cAAc,IAAI,MAAM,SAAkC,IAAI;AAElF,YAAU,MAAM;AACf,QAAI,CAAC,aAAa;AACjB;AAAA,IACD;AACC,QAAY,UAAU;AACvB,QAAI,UAAU,MAAM;AACnB,kBAAY,gBAAgB;AAAA,IAC7B;AAAA,EACE,GAAA,CAAC,aAAa,KAAK,KAAK,CAAC;AAG1B,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,KAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAS,SAAS,UAAU;AAAA,MAC5B,cAAY,UAAU,OAAO,kBAAmB,QAAQ,YAAY;AAAA,MACpE,gBAAc,cAAc,OAAO,SAAS,CAAC;AAAA,MAC7C,IAAI,GAAG,EAAE;AAAA,MACT;AAAA,MACA;AAAA,MACA,UAAU,YAAkD,CAAK,MAAA;AAChE,uBAAiB,EAAA,YAAY,EAAE,OAAO,OAAO;AAAA,MAAA,GAC3C,CAAC,cAAc,CAAC;AAAA,MAClB,GAAG;AAAA,IAAA;AAAA,IAZL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AAeH,GAAG,CAAC,EAAE,OAAO,cAAc,aAAA,GAAgB,QAAQ;AAC5C,QAAA,OAAO,2BAA2B,0BAA0B,KAAK,EAAE,MAAO,CAAA,EAAE;AAC5E,QAAA,uBAAuB,iBAAiB,SAAY,eAAgB,KAAK,MAAM,iBAAiB,KAAK,MAAM,WAAW,OAAO;AAEnI,SAAQ,uBAAA,OAAA,EAAM,OAAc,cAA4B,cAAc,qBAA/D,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAqF,GAAAA,MAAA;AAC7F,CAAC;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const contexts = require("../contexts.cjs");
|
|
6
6
|
const reactBinding = require("@contember/react-binding");
|
|
@@ -9,7 +9,15 @@ const FormFieldScope = ({ field, children }) => {
|
|
|
9
9
|
const id = React.useId();
|
|
10
10
|
const fieldAccessor = reactBinding.useField({ field });
|
|
11
11
|
const errors = fieldAccessor.errors?.errors;
|
|
12
|
-
return /* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.FormFieldIdContext.Provider, { value: id, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.FormErrorContext.Provider, { value: errors ?? emptyArr, children }, void 0, false, {
|
|
13
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormFieldScope.tsx",
|
|
14
|
+
lineNumber: 19,
|
|
15
|
+
columnNumber: 4
|
|
16
|
+
}, void 0) }, void 0, false, {
|
|
17
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormFieldScope.tsx",
|
|
18
|
+
lineNumber: 18,
|
|
19
|
+
columnNumber: 3
|
|
20
|
+
}, void 0);
|
|
13
21
|
};
|
|
14
22
|
exports.FormFieldScope = FormFieldScope;
|
|
15
23
|
//# sourceMappingURL=FormFieldScope.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldScope.cjs","sources":["../../../src/components/FormFieldScope.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useId } from 'react'\nimport { FormErrorContext, FormFieldIdContext } from '../contexts'\nimport { SugaredRelativeSingleField, useField } from '@contember/react-binding'\n\nconst emptyArr: [] = []\n\nexport type FormFieldScopeProps = {\n\tfield: SugaredRelativeSingleField['field']\n\tchildren: React.ReactNode\n}\n\nexport const FormFieldScope = ({ field, children }: FormFieldScopeProps) => {\n\tconst id = useId()\n\tconst fieldAccessor = useField({ field })\n\tconst errors = fieldAccessor.errors?.errors\n\treturn (\n\t\t<FormFieldIdContext.Provider value={id}>\n\t\t\t<FormErrorContext.Provider value={errors ?? emptyArr}>\n\t\t\t\t{children}\n\t\t\t</FormErrorContext.Provider>\n\t\t</FormFieldIdContext.Provider>\n\t)\n}\n"],"names":["useId","useField","
|
|
1
|
+
{"version":3,"file":"FormFieldScope.cjs","sources":["../../../src/components/FormFieldScope.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useId } from 'react'\nimport { FormErrorContext, FormFieldIdContext } from '../contexts'\nimport { SugaredRelativeSingleField, useField } from '@contember/react-binding'\n\nconst emptyArr: [] = []\n\nexport type FormFieldScopeProps = {\n\tfield: SugaredRelativeSingleField['field']\n\tchildren: React.ReactNode\n}\n\nexport const FormFieldScope = ({ field, children }: FormFieldScopeProps) => {\n\tconst id = useId()\n\tconst fieldAccessor = useField({ field })\n\tconst errors = fieldAccessor.errors?.errors\n\treturn (\n\t\t<FormFieldIdContext.Provider value={id}>\n\t\t\t<FormErrorContext.Provider value={errors ?? emptyArr}>\n\t\t\t\t{children}\n\t\t\t</FormErrorContext.Provider>\n\t\t</FormFieldIdContext.Provider>\n\t)\n}\n"],"names":["useId","useField","jsxDEV","FormFieldIdContext","FormErrorContext","this"],"mappings":";;;;;;AAKA,MAAM,WAAe,CAAA;AAOd,MAAM,iBAAiB,CAAC,EAAE,OAAO,eAAoC;AAC3E,QAAM,KAAKA,MAAAA;AACX,QAAM,gBAAgBC,aAAAA,SAAS,EAAE,MAAO,CAAA;AAClC,QAAA,SAAS,cAAc,QAAQ;AACrC,SACEC,8BAAAA,OAAAC,SAAAA,mBAAmB,UAAnB,EAA4B,OAAO,IACnC,UAACD,qCAAAE,SAAAA,iBAAiB,UAAjB,EAA0B,OAAO,UAAU,UAC1C,YADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAIA,GAAAA,MAAA;AAEF;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import { useId } from "react";
|
|
3
3
|
import { FormFieldIdContext, FormErrorContext } from "../contexts.js";
|
|
4
4
|
import { useField } from "@contember/react-binding";
|
|
@@ -7,7 +7,15 @@ const FormFieldScope = ({ field, children }) => {
|
|
|
7
7
|
const id = useId();
|
|
8
8
|
const fieldAccessor = useField({ field });
|
|
9
9
|
const errors = fieldAccessor.errors?.errors;
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ jsxDEV(FormFieldIdContext.Provider, { value: id, children: /* @__PURE__ */ jsxDEV(FormErrorContext.Provider, { value: errors ?? emptyArr, children }, void 0, false, {
|
|
11
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormFieldScope.tsx",
|
|
12
|
+
lineNumber: 19,
|
|
13
|
+
columnNumber: 4
|
|
14
|
+
}, void 0) }, void 0, false, {
|
|
15
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormFieldScope.tsx",
|
|
16
|
+
lineNumber: 18,
|
|
17
|
+
columnNumber: 3
|
|
18
|
+
}, void 0);
|
|
11
19
|
};
|
|
12
20
|
export {
|
|
13
21
|
FormFieldScope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldScope.js","sources":["../../../src/components/FormFieldScope.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useId } from 'react'\nimport { FormErrorContext, FormFieldIdContext } from '../contexts'\nimport { SugaredRelativeSingleField, useField } from '@contember/react-binding'\n\nconst emptyArr: [] = []\n\nexport type FormFieldScopeProps = {\n\tfield: SugaredRelativeSingleField['field']\n\tchildren: React.ReactNode\n}\n\nexport const FormFieldScope = ({ field, children }: FormFieldScopeProps) => {\n\tconst id = useId()\n\tconst fieldAccessor = useField({ field })\n\tconst errors = fieldAccessor.errors?.errors\n\treturn (\n\t\t<FormFieldIdContext.Provider value={id}>\n\t\t\t<FormErrorContext.Provider value={errors ?? emptyArr}>\n\t\t\t\t{children}\n\t\t\t</FormErrorContext.Provider>\n\t\t</FormFieldIdContext.Provider>\n\t)\n}\n"],"names":[],"mappings":";;;;AAKA,MAAM,WAAe,CAAA;AAOd,MAAM,iBAAiB,CAAC,EAAE,OAAO,eAAoC;AAC3E,QAAM,KAAK;AACX,QAAM,gBAAgB,SAAS,EAAE,MAAO,CAAA;AAClC,QAAA,SAAS,cAAc,QAAQ;AACrC,SACE,
|
|
1
|
+
{"version":3,"file":"FormFieldScope.js","sources":["../../../src/components/FormFieldScope.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useId } from 'react'\nimport { FormErrorContext, FormFieldIdContext } from '../contexts'\nimport { SugaredRelativeSingleField, useField } from '@contember/react-binding'\n\nconst emptyArr: [] = []\n\nexport type FormFieldScopeProps = {\n\tfield: SugaredRelativeSingleField['field']\n\tchildren: React.ReactNode\n}\n\nexport const FormFieldScope = ({ field, children }: FormFieldScopeProps) => {\n\tconst id = useId()\n\tconst fieldAccessor = useField({ field })\n\tconst errors = fieldAccessor.errors?.errors\n\treturn (\n\t\t<FormFieldIdContext.Provider value={id}>\n\t\t\t<FormErrorContext.Provider value={errors ?? emptyArr}>\n\t\t\t\t{children}\n\t\t\t</FormErrorContext.Provider>\n\t\t</FormFieldIdContext.Provider>\n\t)\n}\n"],"names":["this"],"mappings":";;;;AAKA,MAAM,WAAe,CAAA;AAOd,MAAM,iBAAiB,CAAC,EAAE,OAAO,eAAoC;AAC3E,QAAM,KAAK;AACX,QAAM,gBAAgB,SAAS,EAAE,MAAO,CAAA;AAClC,QAAA,SAAS,cAAc,QAAQ;AACrC,SACE,uBAAA,mBAAmB,UAAnB,EAA4B,OAAO,IACnC,UAAC,uBAAA,iBAAiB,UAAjB,EAA0B,OAAO,UAAU,UAC1C,YADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAIA,GAAAA,MAAA;AAEF;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
4
|
const reactBinding = require("@contember/react-binding");
|
|
5
5
|
const React = require("react");
|
|
6
6
|
const contexts = require("../contexts.cjs");
|
|
@@ -9,7 +9,15 @@ const FormHasManyRelationScope = ({ field, children }) => {
|
|
|
9
9
|
const id = React.useId();
|
|
10
10
|
const entityRelation = reactBinding.useEntityList({ field });
|
|
11
11
|
const errors = entityRelation.errors?.errors;
|
|
12
|
-
return /* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.FormFieldIdContext.Provider, { value: id, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.FormErrorContext.Provider, { value: errors ?? emptyArr, children }, void 0, false, {
|
|
13
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormHasManyRelationScope.tsx",
|
|
14
|
+
lineNumber: 19,
|
|
15
|
+
columnNumber: 4
|
|
16
|
+
}, void 0) }, void 0, false, {
|
|
17
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormHasManyRelationScope.tsx",
|
|
18
|
+
lineNumber: 18,
|
|
19
|
+
columnNumber: 3
|
|
20
|
+
}, void 0);
|
|
13
21
|
};
|
|
14
22
|
exports.FormHasManyRelationScope = FormHasManyRelationScope;
|
|
15
23
|
//# sourceMappingURL=FormHasManyRelationScope.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormHasManyRelationScope.cjs","sources":["../../../src/components/FormHasManyRelationScope.tsx"],"sourcesContent":["import { SugaredRelativeEntityList, useEntityList } from '@contember/react-binding'\nimport * as React from 'react'\nimport { useId } from 'react'\nimport { FormErrorContext, FormFieldIdContext } from '../contexts'\n\nconst emptyArr: [] = []\n\nexport type FormHasManyRelationScopeProps = {\n\tfield: SugaredRelativeEntityList['field']\n\tchildren: React.ReactNode\n}\n\nexport const FormHasManyRelationScope = ({ field, children }: FormHasManyRelationScopeProps) => {\n\tconst id = useId()\n\tconst entityRelation = useEntityList({ field })\n\tconst errors = entityRelation.errors?.errors\n\treturn (\n\t\t<FormFieldIdContext.Provider value={id}>\n\t\t\t<FormErrorContext.Provider value={errors ?? emptyArr}>\n\t\t\t\t{children}\n\t\t\t</FormErrorContext.Provider>\n\t\t</FormFieldIdContext.Provider>\n\t)\n}\n"],"names":["useId","useEntityList","
|
|
1
|
+
{"version":3,"file":"FormHasManyRelationScope.cjs","sources":["../../../src/components/FormHasManyRelationScope.tsx"],"sourcesContent":["import { SugaredRelativeEntityList, useEntityList } from '@contember/react-binding'\nimport * as React from 'react'\nimport { useId } from 'react'\nimport { FormErrorContext, FormFieldIdContext } from '../contexts'\n\nconst emptyArr: [] = []\n\nexport type FormHasManyRelationScopeProps = {\n\tfield: SugaredRelativeEntityList['field']\n\tchildren: React.ReactNode\n}\n\nexport const FormHasManyRelationScope = ({ field, children }: FormHasManyRelationScopeProps) => {\n\tconst id = useId()\n\tconst entityRelation = useEntityList({ field })\n\tconst errors = entityRelation.errors?.errors\n\treturn (\n\t\t<FormFieldIdContext.Provider value={id}>\n\t\t\t<FormErrorContext.Provider value={errors ?? emptyArr}>\n\t\t\t\t{children}\n\t\t\t</FormErrorContext.Provider>\n\t\t</FormFieldIdContext.Provider>\n\t)\n}\n"],"names":["useId","useEntityList","jsxDEV","FormFieldIdContext","FormErrorContext","this"],"mappings":";;;;;;AAKA,MAAM,WAAe,CAAA;AAOd,MAAM,2BAA2B,CAAC,EAAE,OAAO,eAA8C;AAC/F,QAAM,KAAKA,MAAAA;AACX,QAAM,iBAAiBC,aAAAA,cAAc,EAAE,MAAO,CAAA;AACxC,QAAA,SAAS,eAAe,QAAQ;AACtC,SACEC,8BAAAA,OAAAC,SAAAA,mBAAmB,UAAnB,EAA4B,OAAO,IACnC,UAACD,qCAAAE,SAAAA,iBAAiB,UAAjB,EAA0B,OAAO,UAAU,UAC1C,YADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAIA,GAAAA,MAAA;AAEF;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import { useEntityList } from "@contember/react-binding";
|
|
3
3
|
import { useId } from "react";
|
|
4
4
|
import { FormFieldIdContext, FormErrorContext } from "../contexts.js";
|
|
@@ -7,7 +7,15 @@ const FormHasManyRelationScope = ({ field, children }) => {
|
|
|
7
7
|
const id = useId();
|
|
8
8
|
const entityRelation = useEntityList({ field });
|
|
9
9
|
const errors = entityRelation.errors?.errors;
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ jsxDEV(FormFieldIdContext.Provider, { value: id, children: /* @__PURE__ */ jsxDEV(FormErrorContext.Provider, { value: errors ?? emptyArr, children }, void 0, false, {
|
|
11
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormHasManyRelationScope.tsx",
|
|
12
|
+
lineNumber: 19,
|
|
13
|
+
columnNumber: 4
|
|
14
|
+
}, void 0) }, void 0, false, {
|
|
15
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormHasManyRelationScope.tsx",
|
|
16
|
+
lineNumber: 18,
|
|
17
|
+
columnNumber: 3
|
|
18
|
+
}, void 0);
|
|
11
19
|
};
|
|
12
20
|
export {
|
|
13
21
|
FormHasManyRelationScope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormHasManyRelationScope.js","sources":["../../../src/components/FormHasManyRelationScope.tsx"],"sourcesContent":["import { SugaredRelativeEntityList, useEntityList } from '@contember/react-binding'\nimport * as React from 'react'\nimport { useId } from 'react'\nimport { FormErrorContext, FormFieldIdContext } from '../contexts'\n\nconst emptyArr: [] = []\n\nexport type FormHasManyRelationScopeProps = {\n\tfield: SugaredRelativeEntityList['field']\n\tchildren: React.ReactNode\n}\n\nexport const FormHasManyRelationScope = ({ field, children }: FormHasManyRelationScopeProps) => {\n\tconst id = useId()\n\tconst entityRelation = useEntityList({ field })\n\tconst errors = entityRelation.errors?.errors\n\treturn (\n\t\t<FormFieldIdContext.Provider value={id}>\n\t\t\t<FormErrorContext.Provider value={errors ?? emptyArr}>\n\t\t\t\t{children}\n\t\t\t</FormErrorContext.Provider>\n\t\t</FormFieldIdContext.Provider>\n\t)\n}\n"],"names":[],"mappings":";;;;AAKA,MAAM,WAAe,CAAA;AAOd,MAAM,2BAA2B,CAAC,EAAE,OAAO,eAA8C;AAC/F,QAAM,KAAK;AACX,QAAM,iBAAiB,cAAc,EAAE,MAAO,CAAA;AACxC,QAAA,SAAS,eAAe,QAAQ;AACtC,SACE,
|
|
1
|
+
{"version":3,"file":"FormHasManyRelationScope.js","sources":["../../../src/components/FormHasManyRelationScope.tsx"],"sourcesContent":["import { SugaredRelativeEntityList, useEntityList } from '@contember/react-binding'\nimport * as React from 'react'\nimport { useId } from 'react'\nimport { FormErrorContext, FormFieldIdContext } from '../contexts'\n\nconst emptyArr: [] = []\n\nexport type FormHasManyRelationScopeProps = {\n\tfield: SugaredRelativeEntityList['field']\n\tchildren: React.ReactNode\n}\n\nexport const FormHasManyRelationScope = ({ field, children }: FormHasManyRelationScopeProps) => {\n\tconst id = useId()\n\tconst entityRelation = useEntityList({ field })\n\tconst errors = entityRelation.errors?.errors\n\treturn (\n\t\t<FormFieldIdContext.Provider value={id}>\n\t\t\t<FormErrorContext.Provider value={errors ?? emptyArr}>\n\t\t\t\t{children}\n\t\t\t</FormErrorContext.Provider>\n\t\t</FormFieldIdContext.Provider>\n\t)\n}\n"],"names":["this"],"mappings":";;;;AAKA,MAAM,WAAe,CAAA;AAOd,MAAM,2BAA2B,CAAC,EAAE,OAAO,eAA8C;AAC/F,QAAM,KAAK;AACX,QAAM,iBAAiB,cAAc,EAAE,MAAO,CAAA;AACxC,QAAA,SAAS,eAAe,QAAQ;AACtC,SACE,uBAAA,mBAAmB,UAAnB,EAA4B,OAAO,IACnC,UAAC,uBAAA,iBAAiB,UAAjB,EAA0B,OAAO,UAAU,UAC1C,YADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAIA,GAAAA,MAAA;AAEF;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const contexts = require("../contexts.cjs");
|
|
6
6
|
const reactBinding = require("@contember/react-binding");
|
|
@@ -9,7 +9,15 @@ const FormHasOneRelationScope = ({ field, children }) => {
|
|
|
9
9
|
const id = React.useId();
|
|
10
10
|
const entityRelation = reactBinding.useEntity({ field });
|
|
11
11
|
const errors = entityRelation.errors?.errors;
|
|
12
|
-
return /* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.FormFieldIdContext.Provider, { value: id, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.FormErrorContext.Provider, { value: errors ?? emptyArr, children }, void 0, false, {
|
|
13
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormHasOneRelationScope.tsx",
|
|
14
|
+
lineNumber: 19,
|
|
15
|
+
columnNumber: 4
|
|
16
|
+
}, void 0) }, void 0, false, {
|
|
17
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormHasOneRelationScope.tsx",
|
|
18
|
+
lineNumber: 18,
|
|
19
|
+
columnNumber: 3
|
|
20
|
+
}, void 0);
|
|
13
21
|
};
|
|
14
22
|
exports.FormHasOneRelationScope = FormHasOneRelationScope;
|
|
15
23
|
//# sourceMappingURL=FormHasOneRelationScope.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormHasOneRelationScope.cjs","sources":["../../../src/components/FormHasOneRelationScope.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useId } from 'react'\nimport { FormErrorContext, FormFieldIdContext } from '../contexts'\nimport { SugaredRelativeSingleEntity, useEntity } from '@contember/react-binding'\n\nconst emptyArr: [] = []\n\nexport type FormHasOneRelationScopeProps = {\n\tfield: SugaredRelativeSingleEntity['field']\n\tchildren: React.ReactNode\n}\n\nexport const FormHasOneRelationScope = ({ field, children }: FormHasOneRelationScopeProps) => {\n\tconst id = useId()\n\tconst entityRelation = useEntity({ field })\n\tconst errors = entityRelation.errors?.errors\n\treturn (\n\t\t<FormFieldIdContext.Provider value={id}>\n\t\t\t<FormErrorContext.Provider value={errors ?? emptyArr}>\n\t\t\t\t{children}\n\t\t\t</FormErrorContext.Provider>\n\t\t</FormFieldIdContext.Provider>\n\t)\n}\n"],"names":["useId","useEntity","
|
|
1
|
+
{"version":3,"file":"FormHasOneRelationScope.cjs","sources":["../../../src/components/FormHasOneRelationScope.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useId } from 'react'\nimport { FormErrorContext, FormFieldIdContext } from '../contexts'\nimport { SugaredRelativeSingleEntity, useEntity } from '@contember/react-binding'\n\nconst emptyArr: [] = []\n\nexport type FormHasOneRelationScopeProps = {\n\tfield: SugaredRelativeSingleEntity['field']\n\tchildren: React.ReactNode\n}\n\nexport const FormHasOneRelationScope = ({ field, children }: FormHasOneRelationScopeProps) => {\n\tconst id = useId()\n\tconst entityRelation = useEntity({ field })\n\tconst errors = entityRelation.errors?.errors\n\treturn (\n\t\t<FormFieldIdContext.Provider value={id}>\n\t\t\t<FormErrorContext.Provider value={errors ?? emptyArr}>\n\t\t\t\t{children}\n\t\t\t</FormErrorContext.Provider>\n\t\t</FormFieldIdContext.Provider>\n\t)\n}\n"],"names":["useId","useEntity","jsxDEV","FormFieldIdContext","FormErrorContext","this"],"mappings":";;;;;;AAKA,MAAM,WAAe,CAAA;AAOd,MAAM,0BAA0B,CAAC,EAAE,OAAO,eAA6C;AAC7F,QAAM,KAAKA,MAAAA;AACX,QAAM,iBAAiBC,aAAAA,UAAU,EAAE,MAAO,CAAA;AACpC,QAAA,SAAS,eAAe,QAAQ;AACtC,SACEC,8BAAAA,OAAAC,SAAAA,mBAAmB,UAAnB,EAA4B,OAAO,IACnC,UAACD,qCAAAE,SAAAA,iBAAiB,UAAjB,EAA0B,OAAO,UAAU,UAC1C,YADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAIA,GAAAA,MAAA;AAEF;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import { useId } from "react";
|
|
3
3
|
import { FormFieldIdContext, FormErrorContext } from "../contexts.js";
|
|
4
4
|
import { useEntity } from "@contember/react-binding";
|
|
@@ -7,7 +7,15 @@ const FormHasOneRelationScope = ({ field, children }) => {
|
|
|
7
7
|
const id = useId();
|
|
8
8
|
const entityRelation = useEntity({ field });
|
|
9
9
|
const errors = entityRelation.errors?.errors;
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ jsxDEV(FormFieldIdContext.Provider, { value: id, children: /* @__PURE__ */ jsxDEV(FormErrorContext.Provider, { value: errors ?? emptyArr, children }, void 0, false, {
|
|
11
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormHasOneRelationScope.tsx",
|
|
12
|
+
lineNumber: 19,
|
|
13
|
+
columnNumber: 4
|
|
14
|
+
}, void 0) }, void 0, false, {
|
|
15
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormHasOneRelationScope.tsx",
|
|
16
|
+
lineNumber: 18,
|
|
17
|
+
columnNumber: 3
|
|
18
|
+
}, void 0);
|
|
11
19
|
};
|
|
12
20
|
export {
|
|
13
21
|
FormHasOneRelationScope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormHasOneRelationScope.js","sources":["../../../src/components/FormHasOneRelationScope.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useId } from 'react'\nimport { FormErrorContext, FormFieldIdContext } from '../contexts'\nimport { SugaredRelativeSingleEntity, useEntity } from '@contember/react-binding'\n\nconst emptyArr: [] = []\n\nexport type FormHasOneRelationScopeProps = {\n\tfield: SugaredRelativeSingleEntity['field']\n\tchildren: React.ReactNode\n}\n\nexport const FormHasOneRelationScope = ({ field, children }: FormHasOneRelationScopeProps) => {\n\tconst id = useId()\n\tconst entityRelation = useEntity({ field })\n\tconst errors = entityRelation.errors?.errors\n\treturn (\n\t\t<FormFieldIdContext.Provider value={id}>\n\t\t\t<FormErrorContext.Provider value={errors ?? emptyArr}>\n\t\t\t\t{children}\n\t\t\t</FormErrorContext.Provider>\n\t\t</FormFieldIdContext.Provider>\n\t)\n}\n"],"names":[],"mappings":";;;;AAKA,MAAM,WAAe,CAAA;AAOd,MAAM,0BAA0B,CAAC,EAAE,OAAO,eAA6C;AAC7F,QAAM,KAAK;AACX,QAAM,iBAAiB,UAAU,EAAE,MAAO,CAAA;AACpC,QAAA,SAAS,eAAe,QAAQ;AACtC,SACE,
|
|
1
|
+
{"version":3,"file":"FormHasOneRelationScope.js","sources":["../../../src/components/FormHasOneRelationScope.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useId } from 'react'\nimport { FormErrorContext, FormFieldIdContext } from '../contexts'\nimport { SugaredRelativeSingleEntity, useEntity } from '@contember/react-binding'\n\nconst emptyArr: [] = []\n\nexport type FormHasOneRelationScopeProps = {\n\tfield: SugaredRelativeSingleEntity['field']\n\tchildren: React.ReactNode\n}\n\nexport const FormHasOneRelationScope = ({ field, children }: FormHasOneRelationScopeProps) => {\n\tconst id = useId()\n\tconst entityRelation = useEntity({ field })\n\tconst errors = entityRelation.errors?.errors\n\treturn (\n\t\t<FormFieldIdContext.Provider value={id}>\n\t\t\t<FormErrorContext.Provider value={errors ?? emptyArr}>\n\t\t\t\t{children}\n\t\t\t</FormErrorContext.Provider>\n\t\t</FormFieldIdContext.Provider>\n\t)\n}\n"],"names":["this"],"mappings":";;;;AAKA,MAAM,WAAe,CAAA;AAOd,MAAM,0BAA0B,CAAC,EAAE,OAAO,eAA6C;AAC7F,QAAM,KAAK;AACX,QAAM,iBAAiB,UAAU,EAAE,MAAO,CAAA;AACpC,QAAA,SAAS,eAAe,QAAQ;AACtC,SACE,uBAAA,mBAAmB,UAAnB,EAA4B,OAAO,IACnC,UAAC,uBAAA,iBAAiB,UAAjB,EAA0B,OAAO,UAAU,UAC1C,YADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAIA,GAAAA,MAAA;AAEF;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const reactSlot = require("@radix-ui/react-slot");
|
|
6
6
|
const reactBinding = require("@contember/react-binding");
|
|
@@ -16,7 +16,7 @@ const FormInput = reactBinding.Component(({ field, isNonbearing, defaultValue, .
|
|
|
16
16
|
const { parseValue, formatValue, defaultInputProps } = useFormInputHandler.useFormInputHandler(accessor);
|
|
17
17
|
const accessorGetter = accessor.getAccessor;
|
|
18
18
|
const { ref, onFocus, onBlur } = useFormInputValidationHandler.useFormInputValidationHandler(accessor);
|
|
19
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
20
20
|
SlotInput,
|
|
21
21
|
{
|
|
22
22
|
ref,
|
|
@@ -31,10 +31,22 @@ const FormInput = reactBinding.Component(({ field, isNonbearing, defaultValue, .
|
|
|
31
31
|
id: id ? `${id}-input` : void 0,
|
|
32
32
|
required: !accessor.schema.nullable,
|
|
33
33
|
...props
|
|
34
|
-
}
|
|
34
|
+
},
|
|
35
|
+
void 0,
|
|
36
|
+
false,
|
|
37
|
+
{
|
|
38
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormInput.tsx",
|
|
39
|
+
lineNumber: 29,
|
|
40
|
+
columnNumber: 3
|
|
41
|
+
},
|
|
42
|
+
void 0
|
|
35
43
|
);
|
|
36
44
|
}, ({ field, isNonbearing, defaultValue }) => {
|
|
37
|
-
return /* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactBinding.Field, { field, isNonbearing, defaultValue }, void 0, false, {
|
|
46
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormInput.tsx",
|
|
47
|
+
lineNumber: 45,
|
|
48
|
+
columnNumber: 9
|
|
49
|
+
}, void 0);
|
|
38
50
|
});
|
|
39
51
|
exports.FormInput = FormInput;
|
|
40
52
|
//# sourceMappingURL=FormInput.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormInput.cjs","sources":["../../../src/components/FormInput.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ChangeEventHandler, ComponentType, useCallback } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { Component, Field, OptionallyVariableFieldValue, SugaredRelativeSingleField, useField } from '@contember/react-binding'\nimport { dataAttribute } from '@contember/utilities'\nimport { useFormInputHandler } from '../internal/useFormInputHandler'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { useFormInputValidationHandler } from '../hooks/useFormInputValidationHandler'\n\ntype InputProps = React.JSX.IntrinsicElements['input']\nconst SlotInput = Slot as ComponentType<InputProps>\n\nexport interface FormInputProps {\n\tfield: SugaredRelativeSingleField['field']\n\tisNonbearing?: boolean\n\tdefaultValue?: OptionallyVariableFieldValue\n\tchildren: React.ReactElement\n}\n\nexport const FormInput = Component<FormInputProps>(({ field, isNonbearing, defaultValue, ...props }) => {\n\tconst id = useFormFieldId()\n\tconst accessor = useField(field)\n\tconst errors = useFormError() ?? accessor.errors?.errors ?? []\n\tconst { parseValue, formatValue, defaultInputProps } = useFormInputHandler(accessor)\n\tconst accessorGetter = accessor.getAccessor\n\tconst { ref, onFocus, onBlur } = useFormInputValidationHandler(accessor)\n\n\treturn (\n\t\t<SlotInput\n\t\t\tref={ref}\n\t\t\tvalue={formatValue(accessor.value)}\n\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\tonFocus={onFocus}\n\t\t\tonBlur={onBlur}\n\t\t\tonChange={useCallback<ChangeEventHandler<HTMLInputElement>>(e => {\n\t\t\t\taccessorGetter().updateValue(parseValue(e.target.value))\n\t\t\t}, [accessorGetter, parseValue])}\n\t\t\t{...defaultInputProps}\n\t\t\tid={id ? `${id}-input` : undefined}\n\t\t\trequired={!accessor.schema.nullable}\n\t\t\t{...props}\n\t\t/>\n\t)\n}, ({ field, isNonbearing, defaultValue }) => {\n\treturn <Field field={field} isNonbearing={isNonbearing} defaultValue={defaultValue} />\n})\n"],"names":["Slot","Component","useFormFieldId","useField","useFormError","useFormInputHandler","useFormInputValidationHandler","
|
|
1
|
+
{"version":3,"file":"FormInput.cjs","sources":["../../../src/components/FormInput.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ChangeEventHandler, ComponentType, useCallback } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { Component, Field, OptionallyVariableFieldValue, SugaredRelativeSingleField, useField } from '@contember/react-binding'\nimport { dataAttribute } from '@contember/utilities'\nimport { useFormInputHandler } from '../internal/useFormInputHandler'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { useFormInputValidationHandler } from '../hooks/useFormInputValidationHandler'\n\ntype InputProps = React.JSX.IntrinsicElements['input']\nconst SlotInput = Slot as ComponentType<InputProps>\n\nexport interface FormInputProps {\n\tfield: SugaredRelativeSingleField['field']\n\tisNonbearing?: boolean\n\tdefaultValue?: OptionallyVariableFieldValue\n\tchildren: React.ReactElement\n}\n\nexport const FormInput = Component<FormInputProps>(({ field, isNonbearing, defaultValue, ...props }) => {\n\tconst id = useFormFieldId()\n\tconst accessor = useField(field)\n\tconst errors = useFormError() ?? accessor.errors?.errors ?? []\n\tconst { parseValue, formatValue, defaultInputProps } = useFormInputHandler(accessor)\n\tconst accessorGetter = accessor.getAccessor\n\tconst { ref, onFocus, onBlur } = useFormInputValidationHandler(accessor)\n\n\treturn (\n\t\t<SlotInput\n\t\t\tref={ref}\n\t\t\tvalue={formatValue(accessor.value)}\n\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\tonFocus={onFocus}\n\t\t\tonBlur={onBlur}\n\t\t\tonChange={useCallback<ChangeEventHandler<HTMLInputElement>>(e => {\n\t\t\t\taccessorGetter().updateValue(parseValue(e.target.value))\n\t\t\t}, [accessorGetter, parseValue])}\n\t\t\t{...defaultInputProps}\n\t\t\tid={id ? `${id}-input` : undefined}\n\t\t\trequired={!accessor.schema.nullable}\n\t\t\t{...props}\n\t\t/>\n\t)\n}, ({ field, isNonbearing, defaultValue }) => {\n\treturn <Field field={field} isNonbearing={isNonbearing} defaultValue={defaultValue} />\n})\n"],"names":["Slot","Component","useFormFieldId","useField","useFormError","useFormInputHandler","useFormInputValidationHandler","jsxDEV","dataAttribute","useCallback","this","Field"],"mappings":";;;;;;;;;;AAUA,MAAM,YAAYA,UAAAA;AASL,MAAA,YAAYC,uBAA0B,CAAC,EAAE,OAAO,cAAc,cAAc,GAAG,YAAY;AACvG,QAAM,KAAKC,SAAAA;AACL,QAAA,WAAWC,sBAAS,KAAK;AAC/B,QAAM,SAASC,SAAAA,aAAa,KAAK,SAAS,QAAQ,UAAU;AAC5D,QAAM,EAAE,YAAY,aAAa,kBAAkB,IAAIC,oBAAAA,oBAAoB,QAAQ;AACnF,QAAM,iBAAiB,SAAS;AAChC,QAAM,EAAE,KAAK,SAAS,OAAO,IAAIC,8BAAAA,8BAA8B,QAAQ;AAGtE,SAAAC,8BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,OAAO,YAAY,SAAS,KAAK;AAAA,MACjC,gBAAcC,UAAA,cAAc,OAAO,SAAS,CAAC;AAAA,MAC7C;AAAA,MACA;AAAA,MACA,UAAUC,MAAAA,YAAkD,CAAK,MAAA;AAChE,uBAAA,EAAiB,YAAY,WAAW,EAAE,OAAO,KAAK,CAAC;AAAA,MAAA,GACrD,CAAC,gBAAgB,UAAU,CAAC;AAAA,MAC9B,GAAG;AAAA,MACJ,IAAI,KAAK,GAAG,EAAE,WAAW;AAAA,MACzB,UAAU,CAAC,SAAS,OAAO;AAAA,MAC1B,GAAG;AAAA,IAAA;AAAA,IAZL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAAA;AAeF,GAAG,CAAC,EAAE,OAAO,cAAc,mBAAmB;AAC7C,SAAQH,8BAAA,OAAAI,aAAA,OAAA,EAAM,OAAc,cAA4B,aAAjD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAA6E,GAAAD,MAAA;AACrF,CAAC;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { Slot } from "@radix-ui/react-slot";
|
|
4
4
|
import { Component, useField, Field } from "@contember/react-binding";
|
|
@@ -14,7 +14,7 @@ const FormInput = Component(({ field, isNonbearing, defaultValue, ...props }) =>
|
|
|
14
14
|
const { parseValue, formatValue, defaultInputProps } = useFormInputHandler(accessor);
|
|
15
15
|
const accessorGetter = accessor.getAccessor;
|
|
16
16
|
const { ref, onFocus, onBlur } = useFormInputValidationHandler(accessor);
|
|
17
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ jsxDEV(
|
|
18
18
|
SlotInput,
|
|
19
19
|
{
|
|
20
20
|
ref,
|
|
@@ -29,10 +29,22 @@ const FormInput = Component(({ field, isNonbearing, defaultValue, ...props }) =>
|
|
|
29
29
|
id: id ? `${id}-input` : void 0,
|
|
30
30
|
required: !accessor.schema.nullable,
|
|
31
31
|
...props
|
|
32
|
-
}
|
|
32
|
+
},
|
|
33
|
+
void 0,
|
|
34
|
+
false,
|
|
35
|
+
{
|
|
36
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormInput.tsx",
|
|
37
|
+
lineNumber: 29,
|
|
38
|
+
columnNumber: 3
|
|
39
|
+
},
|
|
40
|
+
void 0
|
|
33
41
|
);
|
|
34
42
|
}, ({ field, isNonbearing, defaultValue }) => {
|
|
35
|
-
return /* @__PURE__ */
|
|
43
|
+
return /* @__PURE__ */ jsxDEV(Field, { field, isNonbearing, defaultValue }, void 0, false, {
|
|
44
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormInput.tsx",
|
|
45
|
+
lineNumber: 45,
|
|
46
|
+
columnNumber: 9
|
|
47
|
+
}, void 0);
|
|
36
48
|
});
|
|
37
49
|
export {
|
|
38
50
|
FormInput
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormInput.js","sources":["../../../src/components/FormInput.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ChangeEventHandler, ComponentType, useCallback } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { Component, Field, OptionallyVariableFieldValue, SugaredRelativeSingleField, useField } from '@contember/react-binding'\nimport { dataAttribute } from '@contember/utilities'\nimport { useFormInputHandler } from '../internal/useFormInputHandler'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { useFormInputValidationHandler } from '../hooks/useFormInputValidationHandler'\n\ntype InputProps = React.JSX.IntrinsicElements['input']\nconst SlotInput = Slot as ComponentType<InputProps>\n\nexport interface FormInputProps {\n\tfield: SugaredRelativeSingleField['field']\n\tisNonbearing?: boolean\n\tdefaultValue?: OptionallyVariableFieldValue\n\tchildren: React.ReactElement\n}\n\nexport const FormInput = Component<FormInputProps>(({ field, isNonbearing, defaultValue, ...props }) => {\n\tconst id = useFormFieldId()\n\tconst accessor = useField(field)\n\tconst errors = useFormError() ?? accessor.errors?.errors ?? []\n\tconst { parseValue, formatValue, defaultInputProps } = useFormInputHandler(accessor)\n\tconst accessorGetter = accessor.getAccessor\n\tconst { ref, onFocus, onBlur } = useFormInputValidationHandler(accessor)\n\n\treturn (\n\t\t<SlotInput\n\t\t\tref={ref}\n\t\t\tvalue={formatValue(accessor.value)}\n\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\tonFocus={onFocus}\n\t\t\tonBlur={onBlur}\n\t\t\tonChange={useCallback<ChangeEventHandler<HTMLInputElement>>(e => {\n\t\t\t\taccessorGetter().updateValue(parseValue(e.target.value))\n\t\t\t}, [accessorGetter, parseValue])}\n\t\t\t{...defaultInputProps}\n\t\t\tid={id ? `${id}-input` : undefined}\n\t\t\trequired={!accessor.schema.nullable}\n\t\t\t{...props}\n\t\t/>\n\t)\n}, ({ field, isNonbearing, defaultValue }) => {\n\treturn <Field field={field} isNonbearing={isNonbearing} defaultValue={defaultValue} />\n})\n"],"names":[],"mappings":";;;;;;;;AAUA,MAAM,YAAY;AASL,MAAA,YAAY,UAA0B,CAAC,EAAE,OAAO,cAAc,cAAc,GAAG,YAAY;AACvG,QAAM,KAAK;AACL,QAAA,WAAW,SAAS,KAAK;AAC/B,QAAM,SAAS,aAAa,KAAK,SAAS,QAAQ,UAAU;AAC5D,QAAM,EAAE,YAAY,aAAa,kBAAkB,IAAI,oBAAoB,QAAQ;AACnF,QAAM,iBAAiB,SAAS;AAChC,QAAM,EAAE,KAAK,SAAS,OAAO,IAAI,8BAA8B,QAAQ;AAGtE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,OAAO,YAAY,SAAS,KAAK;AAAA,MACjC,gBAAc,cAAc,OAAO,SAAS,CAAC;AAAA,MAC7C;AAAA,MACA;AAAA,MACA,UAAU,YAAkD,CAAK,MAAA;AAChE,uBAAA,EAAiB,YAAY,WAAW,EAAE,OAAO,KAAK,CAAC;AAAA,MAAA,GACrD,CAAC,gBAAgB,UAAU,CAAC;AAAA,MAC9B,GAAG;AAAA,MACJ,IAAI,KAAK,GAAG,EAAE,WAAW;AAAA,MACzB,UAAU,CAAC,SAAS,OAAO;AAAA,MAC1B,GAAG;AAAA,IAAA;AAAA,EAAA;
|
|
1
|
+
{"version":3,"file":"FormInput.js","sources":["../../../src/components/FormInput.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ChangeEventHandler, ComponentType, useCallback } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { Component, Field, OptionallyVariableFieldValue, SugaredRelativeSingleField, useField } from '@contember/react-binding'\nimport { dataAttribute } from '@contember/utilities'\nimport { useFormInputHandler } from '../internal/useFormInputHandler'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { useFormInputValidationHandler } from '../hooks/useFormInputValidationHandler'\n\ntype InputProps = React.JSX.IntrinsicElements['input']\nconst SlotInput = Slot as ComponentType<InputProps>\n\nexport interface FormInputProps {\n\tfield: SugaredRelativeSingleField['field']\n\tisNonbearing?: boolean\n\tdefaultValue?: OptionallyVariableFieldValue\n\tchildren: React.ReactElement\n}\n\nexport const FormInput = Component<FormInputProps>(({ field, isNonbearing, defaultValue, ...props }) => {\n\tconst id = useFormFieldId()\n\tconst accessor = useField(field)\n\tconst errors = useFormError() ?? accessor.errors?.errors ?? []\n\tconst { parseValue, formatValue, defaultInputProps } = useFormInputHandler(accessor)\n\tconst accessorGetter = accessor.getAccessor\n\tconst { ref, onFocus, onBlur } = useFormInputValidationHandler(accessor)\n\n\treturn (\n\t\t<SlotInput\n\t\t\tref={ref}\n\t\t\tvalue={formatValue(accessor.value)}\n\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\tonFocus={onFocus}\n\t\t\tonBlur={onBlur}\n\t\t\tonChange={useCallback<ChangeEventHandler<HTMLInputElement>>(e => {\n\t\t\t\taccessorGetter().updateValue(parseValue(e.target.value))\n\t\t\t}, [accessorGetter, parseValue])}\n\t\t\t{...defaultInputProps}\n\t\t\tid={id ? `${id}-input` : undefined}\n\t\t\trequired={!accessor.schema.nullable}\n\t\t\t{...props}\n\t\t/>\n\t)\n}, ({ field, isNonbearing, defaultValue }) => {\n\treturn <Field field={field} isNonbearing={isNonbearing} defaultValue={defaultValue} />\n})\n"],"names":["this"],"mappings":";;;;;;;;AAUA,MAAM,YAAY;AASL,MAAA,YAAY,UAA0B,CAAC,EAAE,OAAO,cAAc,cAAc,GAAG,YAAY;AACvG,QAAM,KAAK;AACL,QAAA,WAAW,SAAS,KAAK;AAC/B,QAAM,SAAS,aAAa,KAAK,SAAS,QAAQ,UAAU;AAC5D,QAAM,EAAE,YAAY,aAAa,kBAAkB,IAAI,oBAAoB,QAAQ;AACnF,QAAM,iBAAiB,SAAS;AAChC,QAAM,EAAE,KAAK,SAAS,OAAO,IAAI,8BAA8B,QAAQ;AAGtE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,OAAO,YAAY,SAAS,KAAK;AAAA,MACjC,gBAAc,cAAc,OAAO,SAAS,CAAC;AAAA,MAC7C;AAAA,MACA;AAAA,MACA,UAAU,YAAkD,CAAK,MAAA;AAChE,uBAAA,EAAiB,YAAY,WAAW,EAAE,OAAO,KAAK,CAAC;AAAA,MAAA,GACrD,CAAC,gBAAgB,UAAU,CAAC;AAAA,MAC9B,GAAG;AAAA,MACJ,IAAI,KAAK,GAAG,EAAE,WAAW;AAAA,MACzB,UAAU,CAAC,SAAS,OAAO;AAAA,MAC1B,GAAG;AAAA,IAAA;AAAA,IAZL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AAeF,GAAG,CAAC,EAAE,OAAO,cAAc,mBAAmB;AAC7C,SAAQ,uBAAA,OAAA,EAAM,OAAc,cAA4B,aAAjD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAA6E,GAAAA,MAAA;AACrF,CAAC;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
4
|
const reactSlot = require("@radix-ui/react-slot");
|
|
5
5
|
const utilities = require("@contember/utilities");
|
|
6
6
|
const contexts = require("../contexts.cjs");
|
|
@@ -11,13 +11,21 @@ const FormLabel = (props) => {
|
|
|
11
11
|
if (errors === void 0 || id === void 0) {
|
|
12
12
|
throw new reactBinding.BindingError("FormLabel must be used inside a FormField");
|
|
13
13
|
}
|
|
14
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
15
15
|
reactSlot.Slot,
|
|
16
16
|
{
|
|
17
17
|
"data-invalid": utilities.dataAttribute(errors.length > 0),
|
|
18
18
|
...{ htmlFor: `${id}-input` },
|
|
19
19
|
...props
|
|
20
|
-
}
|
|
20
|
+
},
|
|
21
|
+
void 0,
|
|
22
|
+
false,
|
|
23
|
+
{
|
|
24
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormLabel.tsx",
|
|
25
|
+
lineNumber: 16,
|
|
26
|
+
columnNumber: 3
|
|
27
|
+
},
|
|
28
|
+
void 0
|
|
21
29
|
);
|
|
22
30
|
};
|
|
23
31
|
exports.FormLabel = FormLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormLabel.cjs","sources":["../../../src/components/FormLabel.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { dataAttribute } from '@contember/utilities'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { BindingError } from '@contember/react-binding'\n\nexport const FormLabel = (props: {\n\tchildren: React.ReactElement\n}) => {\n\tconst id = useFormFieldId()\n\tconst errors = useFormError()\n\tif (errors === undefined || id === undefined) {\n\t\tthrow new BindingError('FormLabel must be used inside a FormField')\n\t}\n\treturn (\n\t\t<Slot\n\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\t{...{ htmlFor: `${id}-input` }}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n"],"names":["useFormFieldId","useFormError","BindingError","
|
|
1
|
+
{"version":3,"file":"FormLabel.cjs","sources":["../../../src/components/FormLabel.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { dataAttribute } from '@contember/utilities'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { BindingError } from '@contember/react-binding'\n\nexport const FormLabel = (props: {\n\tchildren: React.ReactElement\n}) => {\n\tconst id = useFormFieldId()\n\tconst errors = useFormError()\n\tif (errors === undefined || id === undefined) {\n\t\tthrow new BindingError('FormLabel must be used inside a FormField')\n\t}\n\treturn (\n\t\t<Slot\n\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\t{...{ htmlFor: `${id}-input` }}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n"],"names":["useFormFieldId","useFormError","BindingError","jsxDEV","Slot","dataAttribute","this"],"mappings":";;;;;;;AAMa,MAAA,YAAY,CAAC,UAEpB;AACL,QAAM,KAAKA,SAAAA;AACX,QAAM,SAASC,SAAAA;AACX,MAAA,WAAW,UAAa,OAAO,QAAW;AACvC,UAAA,IAAIC,aAAAA,aAAa,2CAA2C;AAAA,EACnE;AAEC,SAAAC,8BAAA;AAAA,IAACC,UAAA;AAAA,IAAA;AAAA,MACA,gBAAcC,UAAA,cAAc,OAAO,SAAS,CAAC;AAAA,MAC5C,GAAG,EAAE,SAAS,GAAG,EAAE,SAAS;AAAA,MAC5B,GAAG;AAAA,IAAA;AAAA,IAHL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAAA;AAMF;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
3
|
import { dataAttribute } from "@contember/utilities";
|
|
4
4
|
import { useFormFieldId, useFormError } from "../contexts.js";
|
|
@@ -9,13 +9,21 @@ const FormLabel = (props) => {
|
|
|
9
9
|
if (errors === void 0 || id === void 0) {
|
|
10
10
|
throw new BindingError("FormLabel must be used inside a FormField");
|
|
11
11
|
}
|
|
12
|
-
return /* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ jsxDEV(
|
|
13
13
|
Slot,
|
|
14
14
|
{
|
|
15
15
|
"data-invalid": dataAttribute(errors.length > 0),
|
|
16
16
|
...{ htmlFor: `${id}-input` },
|
|
17
17
|
...props
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
|
+
void 0,
|
|
20
|
+
false,
|
|
21
|
+
{
|
|
22
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormLabel.tsx",
|
|
23
|
+
lineNumber: 16,
|
|
24
|
+
columnNumber: 3
|
|
25
|
+
},
|
|
26
|
+
void 0
|
|
19
27
|
);
|
|
20
28
|
};
|
|
21
29
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormLabel.js","sources":["../../../src/components/FormLabel.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { dataAttribute } from '@contember/utilities'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { BindingError } from '@contember/react-binding'\n\nexport const FormLabel = (props: {\n\tchildren: React.ReactElement\n}) => {\n\tconst id = useFormFieldId()\n\tconst errors = useFormError()\n\tif (errors === undefined || id === undefined) {\n\t\tthrow new BindingError('FormLabel must be used inside a FormField')\n\t}\n\treturn (\n\t\t<Slot\n\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\t{...{ htmlFor: `${id}-input` }}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n"],"names":[],"mappings":";;;;;AAMa,MAAA,YAAY,CAAC,UAEpB;AACL,QAAM,KAAK;AACX,QAAM,SAAS;AACX,MAAA,WAAW,UAAa,OAAO,QAAW;AACvC,UAAA,IAAI,aAAa,2CAA2C;AAAA,EACnE;AAEC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,gBAAc,cAAc,OAAO,SAAS,CAAC;AAAA,MAC5C,GAAG,EAAE,SAAS,GAAG,EAAE,SAAS;AAAA,MAC5B,GAAG;AAAA,IAAA;AAAA,EAAA;
|
|
1
|
+
{"version":3,"file":"FormLabel.js","sources":["../../../src/components/FormLabel.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { dataAttribute } from '@contember/utilities'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { BindingError } from '@contember/react-binding'\n\nexport const FormLabel = (props: {\n\tchildren: React.ReactElement\n}) => {\n\tconst id = useFormFieldId()\n\tconst errors = useFormError()\n\tif (errors === undefined || id === undefined) {\n\t\tthrow new BindingError('FormLabel must be used inside a FormField')\n\t}\n\treturn (\n\t\t<Slot\n\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\t{...{ htmlFor: `${id}-input` }}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n"],"names":["this"],"mappings":";;;;;AAMa,MAAA,YAAY,CAAC,UAEpB;AACL,QAAM,KAAK;AACX,QAAM,SAAS;AACX,MAAA,WAAW,UAAa,OAAO,QAAW;AACvC,UAAA,IAAI,aAAa,2CAA2C;AAAA,EACnE;AAEC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,gBAAc,cAAc,OAAO,SAAS,CAAC;AAAA,MAC5C,GAAG,EAAE,SAAS,GAAG,EAAE,SAAS;AAAA,MAC5B,GAAG;AAAA,IAAA;AAAA,IAHL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AAMF;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
4
|
const reactBinding = require("@contember/react-binding");
|
|
5
5
|
const React = require("react");
|
|
6
6
|
const reactSlot = require("@radix-ui/react-slot");
|
|
@@ -14,7 +14,7 @@ const FormRadioInput = reactBinding.Component(({ field, value, defaultValue, isN
|
|
|
14
14
|
const errors = contexts.useFormError() ?? accessor.errors?.errors ?? [];
|
|
15
15
|
const accessorGetter = accessor.getAccessor;
|
|
16
16
|
const { ref, onFocus, onBlur } = useFormInputValidationHandler.useFormInputValidationHandler(accessor);
|
|
17
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
18
18
|
SlotInput,
|
|
19
19
|
{
|
|
20
20
|
ref,
|
|
@@ -30,10 +30,22 @@ const FormRadioInput = reactBinding.Component(({ field, value, defaultValue, isN
|
|
|
30
30
|
accessorGetter().updateValue(value);
|
|
31
31
|
}, [accessorGetter, value]),
|
|
32
32
|
...props
|
|
33
|
-
}
|
|
33
|
+
},
|
|
34
|
+
void 0,
|
|
35
|
+
false,
|
|
36
|
+
{
|
|
37
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormRadioInput.tsx",
|
|
38
|
+
lineNumber: 27,
|
|
39
|
+
columnNumber: 3
|
|
40
|
+
},
|
|
41
|
+
void 0
|
|
34
42
|
);
|
|
35
43
|
}, ({ field, isNonbearing, defaultValue }) => {
|
|
36
|
-
return /* @__PURE__ */
|
|
44
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactBinding.Field, { field, isNonbearing, defaultValue }, void 0, false, {
|
|
45
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormRadioInput.tsx",
|
|
46
|
+
lineNumber: 44,
|
|
47
|
+
columnNumber: 9
|
|
48
|
+
}, void 0);
|
|
37
49
|
});
|
|
38
50
|
exports.FormRadioInput = FormRadioInput;
|
|
39
51
|
//# sourceMappingURL=FormRadioInput.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormRadioInput.cjs","sources":["../../../src/components/FormRadioInput.tsx"],"sourcesContent":["import { Component, Field, OptionallyVariableFieldValue, SugaredRelativeSingleField, useField } from '@contember/react-binding'\nimport * as React from 'react'\nimport { ChangeEventHandler, useCallback } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { useFormInputValidationHandler } from '../hooks'\nimport { dataAttribute } from '@contember/utilities'\n\nconst SlotInput = Slot as React.ForwardRefExoticComponent<React.RefAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement>>\n\nexport interface FormRadioItemProps {\n\tfield: SugaredRelativeSingleField['field']\n\tvalue: string\n\tisNonbearing?: boolean\n\tdefaultValue?: OptionallyVariableFieldValue\n\tchildren: React.ReactNode\n}\n\nexport const FormRadioInput = Component<FormRadioItemProps>(({ field, value, defaultValue, isNonbearing, ...props }) => {\n\tconst id = useFormFieldId()\n\tconst accessor = useField<string>(field)\n\tconst errors = useFormError() ?? accessor.errors?.errors ?? []\n\tconst accessorGetter = accessor.getAccessor\n\tconst { ref, onFocus, onBlur } = useFormInputValidationHandler(accessor)\n\n\treturn (\n\t\t<SlotInput\n\t\t\tref={ref}\n\t\t\ttype=\"radio\"\n\t\t\tvalue={value}\n\t\t\tchecked={accessor.value === value}\n\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\tname={id + '-input'}\n\t\t\tid={`${id}-input-${value}`}\n\t\t\tonFocus={onFocus}\n\t\t\tonBlur={onBlur}\n\t\t\tonChange={useCallback<ChangeEventHandler<HTMLInputElement>>(e => {\n\t\t\t\taccessorGetter().updateValue(value)\n\t\t\t}, [accessorGetter, value])}\n\t\t\t{...props}\n\t\t/>\n\t)\n}, ({ field, isNonbearing, defaultValue }) => {\n\treturn <Field field={field} isNonbearing={isNonbearing} defaultValue={defaultValue} />\n})\n"],"names":["Slot","Component","useFormFieldId","useField","useFormError","useFormInputValidationHandler","
|
|
1
|
+
{"version":3,"file":"FormRadioInput.cjs","sources":["../../../src/components/FormRadioInput.tsx"],"sourcesContent":["import { Component, Field, OptionallyVariableFieldValue, SugaredRelativeSingleField, useField } from '@contember/react-binding'\nimport * as React from 'react'\nimport { ChangeEventHandler, useCallback } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { useFormInputValidationHandler } from '../hooks'\nimport { dataAttribute } from '@contember/utilities'\n\nconst SlotInput = Slot as React.ForwardRefExoticComponent<React.RefAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement>>\n\nexport interface FormRadioItemProps {\n\tfield: SugaredRelativeSingleField['field']\n\tvalue: string\n\tisNonbearing?: boolean\n\tdefaultValue?: OptionallyVariableFieldValue\n\tchildren: React.ReactNode\n}\n\nexport const FormRadioInput = Component<FormRadioItemProps>(({ field, value, defaultValue, isNonbearing, ...props }) => {\n\tconst id = useFormFieldId()\n\tconst accessor = useField<string>(field)\n\tconst errors = useFormError() ?? accessor.errors?.errors ?? []\n\tconst accessorGetter = accessor.getAccessor\n\tconst { ref, onFocus, onBlur } = useFormInputValidationHandler(accessor)\n\n\treturn (\n\t\t<SlotInput\n\t\t\tref={ref}\n\t\t\ttype=\"radio\"\n\t\t\tvalue={value}\n\t\t\tchecked={accessor.value === value}\n\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\tname={id + '-input'}\n\t\t\tid={`${id}-input-${value}`}\n\t\t\tonFocus={onFocus}\n\t\t\tonBlur={onBlur}\n\t\t\tonChange={useCallback<ChangeEventHandler<HTMLInputElement>>(e => {\n\t\t\t\taccessorGetter().updateValue(value)\n\t\t\t}, [accessorGetter, value])}\n\t\t\t{...props}\n\t\t/>\n\t)\n}, ({ field, isNonbearing, defaultValue }) => {\n\treturn <Field field={field} isNonbearing={isNonbearing} defaultValue={defaultValue} />\n})\n"],"names":["Slot","Component","useFormFieldId","useField","useFormError","useFormInputValidationHandler","jsxDEV","dataAttribute","useCallback","this","Field"],"mappings":";;;;;;;;;AAQA,MAAM,YAAYA,UAAAA;AAUL,MAAA,iBAAiBC,aAAAA,UAA8B,CAAC,EAAE,OAAO,OAAO,cAAc,cAAc,GAAG,YAAY;AACvH,QAAM,KAAKC,SAAAA;AACL,QAAA,WAAWC,sBAAiB,KAAK;AACvC,QAAM,SAASC,SAAAA,aAAa,KAAK,SAAS,QAAQ,UAAU;AAC5D,QAAM,iBAAiB,SAAS;AAChC,QAAM,EAAE,KAAK,SAAS,OAAO,IAAIC,8BAAAA,8BAA8B,QAAQ;AAGtE,SAAAC,8BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MACL;AAAA,MACA,SAAS,SAAS,UAAU;AAAA,MAC5B,gBAAcC,UAAA,cAAc,OAAO,SAAS,CAAC;AAAA,MAC7C,MAAM,KAAK;AAAA,MACX,IAAI,GAAG,EAAE,UAAU,KAAK;AAAA,MACxB;AAAA,MACA;AAAA,MACA,UAAUC,MAAAA,YAAkD,CAAK,MAAA;AACjD,uBAAA,EAAE,YAAY,KAAK;AAAA,MAAA,GAChC,CAAC,gBAAgB,KAAK,CAAC;AAAA,MACzB,GAAG;AAAA,IAAA;AAAA,IAbL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAAA;AAgBF,GAAG,CAAC,EAAE,OAAO,cAAc,mBAAmB;AAC7C,SAAQH,8BAAA,OAAAI,aAAA,OAAA,EAAM,OAAc,cAA4B,aAAjD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAA6E,GAAAD,MAAA;AACrF,CAAC;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import { Component, useField, Field } from "@contember/react-binding";
|
|
3
3
|
import { useCallback } from "react";
|
|
4
4
|
import { Slot } from "@radix-ui/react-slot";
|
|
@@ -12,7 +12,7 @@ const FormRadioInput = Component(({ field, value, defaultValue, isNonbearing, ..
|
|
|
12
12
|
const errors = useFormError() ?? accessor.errors?.errors ?? [];
|
|
13
13
|
const accessorGetter = accessor.getAccessor;
|
|
14
14
|
const { ref, onFocus, onBlur } = useFormInputValidationHandler(accessor);
|
|
15
|
-
return /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ jsxDEV(
|
|
16
16
|
SlotInput,
|
|
17
17
|
{
|
|
18
18
|
ref,
|
|
@@ -28,10 +28,22 @@ const FormRadioInput = Component(({ field, value, defaultValue, isNonbearing, ..
|
|
|
28
28
|
accessorGetter().updateValue(value);
|
|
29
29
|
}, [accessorGetter, value]),
|
|
30
30
|
...props
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
|
+
void 0,
|
|
33
|
+
false,
|
|
34
|
+
{
|
|
35
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormRadioInput.tsx",
|
|
36
|
+
lineNumber: 27,
|
|
37
|
+
columnNumber: 3
|
|
38
|
+
},
|
|
39
|
+
void 0
|
|
32
40
|
);
|
|
33
41
|
}, ({ field, isNonbearing, defaultValue }) => {
|
|
34
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ jsxDEV(Field, { field, isNonbearing, defaultValue }, void 0, false, {
|
|
43
|
+
fileName: "/__w/interface/interface/packages/react-form/src/components/FormRadioInput.tsx",
|
|
44
|
+
lineNumber: 44,
|
|
45
|
+
columnNumber: 9
|
|
46
|
+
}, void 0);
|
|
35
47
|
});
|
|
36
48
|
export {
|
|
37
49
|
FormRadioInput
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormRadioInput.js","sources":["../../../src/components/FormRadioInput.tsx"],"sourcesContent":["import { Component, Field, OptionallyVariableFieldValue, SugaredRelativeSingleField, useField } from '@contember/react-binding'\nimport * as React from 'react'\nimport { ChangeEventHandler, useCallback } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { useFormInputValidationHandler } from '../hooks'\nimport { dataAttribute } from '@contember/utilities'\n\nconst SlotInput = Slot as React.ForwardRefExoticComponent<React.RefAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement>>\n\nexport interface FormRadioItemProps {\n\tfield: SugaredRelativeSingleField['field']\n\tvalue: string\n\tisNonbearing?: boolean\n\tdefaultValue?: OptionallyVariableFieldValue\n\tchildren: React.ReactNode\n}\n\nexport const FormRadioInput = Component<FormRadioItemProps>(({ field, value, defaultValue, isNonbearing, ...props }) => {\n\tconst id = useFormFieldId()\n\tconst accessor = useField<string>(field)\n\tconst errors = useFormError() ?? accessor.errors?.errors ?? []\n\tconst accessorGetter = accessor.getAccessor\n\tconst { ref, onFocus, onBlur } = useFormInputValidationHandler(accessor)\n\n\treturn (\n\t\t<SlotInput\n\t\t\tref={ref}\n\t\t\ttype=\"radio\"\n\t\t\tvalue={value}\n\t\t\tchecked={accessor.value === value}\n\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\tname={id + '-input'}\n\t\t\tid={`${id}-input-${value}`}\n\t\t\tonFocus={onFocus}\n\t\t\tonBlur={onBlur}\n\t\t\tonChange={useCallback<ChangeEventHandler<HTMLInputElement>>(e => {\n\t\t\t\taccessorGetter().updateValue(value)\n\t\t\t}, [accessorGetter, value])}\n\t\t\t{...props}\n\t\t/>\n\t)\n}, ({ field, isNonbearing, defaultValue }) => {\n\treturn <Field field={field} isNonbearing={isNonbearing} defaultValue={defaultValue} />\n})\n"],"names":[],"mappings":";;;;;;;AAQA,MAAM,YAAY;AAUL,MAAA,iBAAiB,UAA8B,CAAC,EAAE,OAAO,OAAO,cAAc,cAAc,GAAG,YAAY;AACvH,QAAM,KAAK;AACL,QAAA,WAAW,SAAiB,KAAK;AACvC,QAAM,SAAS,aAAa,KAAK,SAAS,QAAQ,UAAU;AAC5D,QAAM,iBAAiB,SAAS;AAChC,QAAM,EAAE,KAAK,SAAS,OAAO,IAAI,8BAA8B,QAAQ;AAGtE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MACL;AAAA,MACA,SAAS,SAAS,UAAU;AAAA,MAC5B,gBAAc,cAAc,OAAO,SAAS,CAAC;AAAA,MAC7C,MAAM,KAAK;AAAA,MACX,IAAI,GAAG,EAAE,UAAU,KAAK;AAAA,MACxB;AAAA,MACA;AAAA,MACA,UAAU,YAAkD,CAAK,MAAA;AACjD,uBAAA,EAAE,YAAY,KAAK;AAAA,MAAA,GAChC,CAAC,gBAAgB,KAAK,CAAC;AAAA,MACzB,GAAG;AAAA,IAAA;AAAA,EAAA;
|
|
1
|
+
{"version":3,"file":"FormRadioInput.js","sources":["../../../src/components/FormRadioInput.tsx"],"sourcesContent":["import { Component, Field, OptionallyVariableFieldValue, SugaredRelativeSingleField, useField } from '@contember/react-binding'\nimport * as React from 'react'\nimport { ChangeEventHandler, useCallback } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useFormError, useFormFieldId } from '../contexts'\nimport { useFormInputValidationHandler } from '../hooks'\nimport { dataAttribute } from '@contember/utilities'\n\nconst SlotInput = Slot as React.ForwardRefExoticComponent<React.RefAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement>>\n\nexport interface FormRadioItemProps {\n\tfield: SugaredRelativeSingleField['field']\n\tvalue: string\n\tisNonbearing?: boolean\n\tdefaultValue?: OptionallyVariableFieldValue\n\tchildren: React.ReactNode\n}\n\nexport const FormRadioInput = Component<FormRadioItemProps>(({ field, value, defaultValue, isNonbearing, ...props }) => {\n\tconst id = useFormFieldId()\n\tconst accessor = useField<string>(field)\n\tconst errors = useFormError() ?? accessor.errors?.errors ?? []\n\tconst accessorGetter = accessor.getAccessor\n\tconst { ref, onFocus, onBlur } = useFormInputValidationHandler(accessor)\n\n\treturn (\n\t\t<SlotInput\n\t\t\tref={ref}\n\t\t\ttype=\"radio\"\n\t\t\tvalue={value}\n\t\t\tchecked={accessor.value === value}\n\t\t\tdata-invalid={dataAttribute(errors.length > 0)}\n\t\t\tname={id + '-input'}\n\t\t\tid={`${id}-input-${value}`}\n\t\t\tonFocus={onFocus}\n\t\t\tonBlur={onBlur}\n\t\t\tonChange={useCallback<ChangeEventHandler<HTMLInputElement>>(e => {\n\t\t\t\taccessorGetter().updateValue(value)\n\t\t\t}, [accessorGetter, value])}\n\t\t\t{...props}\n\t\t/>\n\t)\n}, ({ field, isNonbearing, defaultValue }) => {\n\treturn <Field field={field} isNonbearing={isNonbearing} defaultValue={defaultValue} />\n})\n"],"names":["this"],"mappings":";;;;;;;AAQA,MAAM,YAAY;AAUL,MAAA,iBAAiB,UAA8B,CAAC,EAAE,OAAO,OAAO,cAAc,cAAc,GAAG,YAAY;AACvH,QAAM,KAAK;AACL,QAAA,WAAW,SAAiB,KAAK;AACvC,QAAM,SAAS,aAAa,KAAK,SAAS,QAAQ,UAAU;AAC5D,QAAM,iBAAiB,SAAS;AAChC,QAAM,EAAE,KAAK,SAAS,OAAO,IAAI,8BAA8B,QAAQ;AAGtE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MACL;AAAA,MACA,SAAS,SAAS,UAAU;AAAA,MAC5B,gBAAc,cAAc,OAAO,SAAS,CAAC;AAAA,MAC7C,MAAM,KAAK;AAAA,MACX,IAAI,GAAG,EAAE,UAAU,KAAK;AAAA,MACxB;AAAA,MACA;AAAA,MACA,UAAU,YAAkD,CAAK,MAAA;AACjD,uBAAA,EAAE,YAAY,KAAK;AAAA,MAAA,GAChC,CAAC,gBAAgB,KAAK,CAAC;AAAA,MACzB,GAAG;AAAA,IAAA;AAAA,IAbL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AAgBF,GAAG,CAAC,EAAE,OAAO,cAAc,mBAAmB;AAC7C,SAAQ,uBAAA,OAAA,EAAM,OAAc,cAA4B,aAAjD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAA6E,GAAAA,MAAA;AACrF,CAAC;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/react-form",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "1.3.0-alpha.
|
|
4
|
+
"version": "1.3.0-alpha.16",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/production/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"typings": "./dist/types/index.d.ts",
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "yarn build:js:dev && yarn build:js:prod",
|
|
31
|
-
"build:js:dev": "vite build --mode development",
|
|
31
|
+
"build:js:dev": "NODE_ENV=development vite build --mode development",
|
|
32
32
|
"build:js:prod": "vite build --mode production",
|
|
33
33
|
"ae:build": "api-extractor run --local",
|
|
34
34
|
"ae:test": "api-extractor run",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"directory": "packages/react-form"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@contember/react-binding": "1.3.0-alpha.
|
|
44
|
-
"@contember/react-utils": "1.3.0-alpha.
|
|
45
|
-
"@contember/utilities": "1.3.0-alpha.
|
|
43
|
+
"@contember/react-binding": "1.3.0-alpha.16",
|
|
44
|
+
"@contember/react-utils": "1.3.0-alpha.16",
|
|
45
|
+
"@contember/utilities": "1.3.0-alpha.16",
|
|
46
46
|
"@radix-ui/react-slot": "^1.0.2"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|