@contember/react-form 1.3.0-alpha.15 → 1.3.0-alpha.17
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/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -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;"}
|