@mittwald/flow-react-components 0.2.0-alpha.196 → 0.2.0-alpha.197

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.
@@ -9,15 +9,14 @@ import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
9
9
  import { ReactAriaControlledValueFix } from '../../lib/react/ReactAriaControlledValueFix.mjs';
10
10
 
11
11
  const TextField = flowComponent("TextField", (props) => {
12
- const { children, defaultValue, placeholder, ref, form, ...rest } = props;
12
+ const { children, placeholder, ref, form, ...rest } = props;
13
13
  const input = /* @__PURE__ */ jsx(ReactAriaControlledValueFix, { inputContext: Aria.InputContext, props, children: /* @__PURE__ */ jsx(
14
14
  Aria.Input,
15
15
  {
16
16
  form,
17
17
  placeholder,
18
18
  className: styles.textField,
19
- ref,
20
- defaultValue
19
+ ref
21
20
  }
22
21
  ) });
23
22
  return /* @__PURE__ */ jsx(ClearPropsContext, { children: /* @__PURE__ */ jsx(TextFieldBase, { ...rest, input, children }) });
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.mjs","sources":["../../../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport type { TextFieldBaseProps } from \"@/components/TextFieldBase\";\nimport { TextFieldBase } from \"@/components/TextFieldBase\";\nimport styles from \"./TextField.module.scss\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { ReactAriaControlledValueFix } from \"@/lib/react/ReactAriaControlledValueFix\";\n\nexport interface TextFieldProps\n extends Omit<TextFieldBaseProps, \"input\" | \"className\">,\n Pick<Aria.InputProps, \"placeholder\" | \"form\">,\n PropsWithClassName,\n FlowComponentProps<HTMLInputElement> {}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const TextField = flowComponent(\"TextField\", (props) => {\n const { children, defaultValue, placeholder, ref, form, ...rest } = props;\n\n const input = (\n <ReactAriaControlledValueFix inputContext={Aria.InputContext} props={props}>\n <Aria.Input\n form={form}\n placeholder={placeholder}\n className={styles.textField}\n ref={ref}\n defaultValue={defaultValue}\n />\n </ReactAriaControlledValueFix>\n );\n\n return (\n <ClearPropsContext>\n <TextFieldBase {...rest} input={input}>\n {children}\n </TextFieldBase>\n </ClearPropsContext>\n );\n});\n\nexport default TextField;\n"],"names":[],"mappings":";;;;;;;;AAoBO,MAAM,SAAY,GAAA,aAAA,CAAc,WAAa,EAAA,CAAC,KAAU,KAAA;AAC7D,EAAM,MAAA,EAAE,UAAU,YAAc,EAAA,WAAA,EAAa,KAAK,IAAM,EAAA,GAAG,MAAS,GAAA,KAAA;AAEpE,EAAA,MAAM,wBACH,GAAA,CAAA,2BAAA,EAAA,EAA4B,YAAc,EAAA,IAAA,CAAK,cAAc,KAC5D,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,IAAK,CAAA,KAAA;AAAA,IAAL;AAAA,MACC,IAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAW,MAAO,CAAA,SAAA;AAAA,MAClB,GAAA;AAAA,MACA;AAAA;AAAA,GAEJ,EAAA,CAAA;AAGF,EACE,uBAAA,GAAA,CAAC,qBACC,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAe,GAAG,IAAM,EAAA,KAAA,EACtB,UACH,CACF,EAAA,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"TextField.mjs","sources":["../../../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport {\n TextFieldBase,\n type TextFieldBaseProps,\n} from \"@/components/TextFieldBase\";\nimport styles from \"./TextField.module.scss\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { ReactAriaControlledValueFix } from \"@/lib/react/ReactAriaControlledValueFix\";\n\nexport interface TextFieldProps\n extends Omit<TextFieldBaseProps, \"input\" | \"className\">,\n Pick<Aria.InputProps, \"placeholder\" | \"form\">,\n PropsWithClassName,\n FlowComponentProps<HTMLInputElement> {}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const TextField = flowComponent(\"TextField\", (props) => {\n const { children, placeholder, ref, form, ...rest } = props;\n\n const input = (\n <ReactAriaControlledValueFix inputContext={Aria.InputContext} props={props}>\n <Aria.Input\n form={form}\n placeholder={placeholder}\n className={styles.textField}\n ref={ref}\n />\n </ReactAriaControlledValueFix>\n );\n\n return (\n <ClearPropsContext>\n <TextFieldBase {...rest} input={input}>\n {children}\n </TextFieldBase>\n </ClearPropsContext>\n );\n});\n\nexport default TextField;\n"],"names":[],"mappings":";;;;;;;;AAsBO,MAAM,SAAY,GAAA,aAAA,CAAc,WAAa,EAAA,CAAC,KAAU,KAAA;AAC7D,EAAA,MAAM,EAAE,QAAU,EAAA,WAAA,EAAa,KAAK,IAAM,EAAA,GAAG,MAAS,GAAA,KAAA;AAEtD,EAAA,MAAM,wBACH,GAAA,CAAA,2BAAA,EAAA,EAA4B,YAAc,EAAA,IAAA,CAAK,cAAc,KAC5D,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,IAAK,CAAA,KAAA;AAAA,IAAL;AAAA,MACC,IAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAW,MAAO,CAAA,SAAA;AAAA,MAClB;AAAA;AAAA,GAEJ,EAAA,CAAA;AAGF,EACE,uBAAA,GAAA,CAAC,qBACC,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAe,GAAG,IAAM,EAAA,KAAA,EACtB,UACH,CACF,EAAA,CAAA;AAEJ,CAAC;;;;"}
@@ -54,6 +54,7 @@ const TextFieldBase = (props) => {
54
54
  ...rest,
55
55
  className: rootClassName,
56
56
  onChange: handleOnChange,
57
+ value: rest.value ?? "",
57
58
  children: [
58
59
  input,
59
60
  /* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, children }),
@@ -1 +1 @@
1
- {"version":3,"file":"TextFieldBase.mjs","sources":["../../../../../../src/components/TextFieldBase/TextFieldBase.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, type ReactNode } from \"react\";\nimport React, { useState } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"../FormField/FormField.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { FieldError } from \"@/components/FieldError\";\nimport { FieldDescription } from \"@/components/FieldDescription\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface TextFieldBaseProps\n extends PropsWithChildren<Omit<Aria.TextFieldProps, \"children\">>,\n Pick<FlowComponentProps<HTMLInputElement>, \"ref\"> {\n /** The input element */\n input: ReactNode;\n /** Whether a character count should be displayed inside the field description. */\n showCharacterCount?: boolean;\n}\n\nexport const TextFieldBase: FC<TextFieldBaseProps> = (props) => {\n const { children, className, input, showCharacterCount, ref, ...rest } =\n props;\n const [charactersCount, setCharactersCount] = useState(\n props.value?.length ?? 0,\n );\n\n const rootClassName = clsx(styles.formField, className);\n\n const translation = useLocalizedStringFormatter(locales);\n\n const propsContext: PropsContext = {\n Label: {\n className: styles.label,\n optional: !props.isRequired,\n },\n FieldDescription: {\n className: styles.fieldDescription,\n },\n FieldError: {\n className: styles.customFieldError,\n },\n };\n\n const handleOnChange = (v: string) => {\n if (showCharacterCount) {\n setCharactersCount(v.length);\n }\n if (props.onChange) {\n props.onChange(v);\n }\n };\n\n const charactersCountDescription = translation.format(\n \"textFieldBase.characters\",\n {\n count: charactersCount,\n maxCount: props.maxLength ?? 0,\n },\n );\n\n return (\n <ClearPropsContext>\n <Aria.TextField\n ref={ref}\n {...rest}\n className={rootClassName}\n onChange={handleOnChange}\n >\n {input}\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n {showCharacterCount && (\n <FieldDescription className={styles.fieldDescription}>\n {charactersCountDescription}\n </FieldDescription>\n )}\n <FieldError className={styles.fieldError} />\n </Aria.TextField>\n </ClearPropsContext>\n );\n};\n\nexport default TextFieldBase;\n"],"names":["styles"],"mappings":";;;;;;;;;;;;;AAuBa,MAAA,aAAA,GAAwC,CAAC,KAAU,KAAA;AAC9D,EAAM,MAAA,EAAE,UAAU,SAAW,EAAA,KAAA,EAAO,oBAAoB,GAAK,EAAA,GAAG,MAC9D,GAAA,KAAA;AACF,EAAM,MAAA,CAAC,eAAiB,EAAA,kBAAkB,CAAI,GAAA,QAAA;AAAA,IAC5C,KAAA,CAAM,OAAO,MAAU,IAAA;AAAA,GACzB;AAEA,EAAA,MAAM,aAAgB,GAAA,IAAA,CAAKA,eAAO,CAAA,SAAA,EAAW,SAAS,CAAA;AAEtD,EAAM,MAAA,WAAA,GAAc,4BAA4B,OAAO,CAAA;AAEvD,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,KAAO,EAAA;AAAA,MACL,WAAWA,eAAO,CAAA,KAAA;AAAA,MAClB,QAAA,EAAU,CAAC,KAAM,CAAA;AAAA,KACnB;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,WAAWA,eAAO,CAAA;AAAA,KACpB;AAAA,IACA,UAAY,EAAA;AAAA,MACV,WAAWA,eAAO,CAAA;AAAA;AACpB,GACF;AAEA,EAAM,MAAA,cAAA,GAAiB,CAAC,CAAc,KAAA;AACpC,IAAA,IAAI,kBAAoB,EAAA;AACtB,MAAA,kBAAA,CAAmB,EAAE,MAAM,CAAA;AAAA;AAE7B,IAAA,IAAI,MAAM,QAAU,EAAA;AAClB,MAAA,KAAA,CAAM,SAAS,CAAC,CAAA;AAAA;AAClB,GACF;AAEA,EAAA,MAAM,6BAA6B,WAAY,CAAA,MAAA;AAAA,IAC7C,0BAAA;AAAA,IACA;AAAA,MACE,KAAO,EAAA,eAAA;AAAA,MACP,QAAA,EAAU,MAAM,SAAa,IAAA;AAAA;AAC/B,GACF;AAEA,EAAA,2BACG,iBACC,EAAA,EAAA,QAAA,kBAAA,IAAA;AAAA,IAAC,IAAK,CAAA,SAAA;AAAA,IAAL;AAAA,MACC,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MACJ,SAAW,EAAA,aAAA;AAAA,MACX,QAAU,EAAA,cAAA;AAAA,MAET,QAAA,EAAA;AAAA,QAAA,KAAA;AAAA,wBACA,GAAA,CAAA,oBAAA,EAAA,EAAqB,KAAO,EAAA,YAAA,EAC1B,QACH,EAAA,CAAA;AAAA,QACC,sCACE,GAAA,CAAA,gBAAA,EAAA,EAAiB,SAAW,EAAAA,eAAA,CAAO,kBACjC,QACH,EAAA,0BAAA,EAAA,CAAA;AAAA,wBAED,GAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAAA,eAAA,CAAO,UAAY,EAAA;AAAA;AAAA;AAAA,GAE9C,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TextFieldBase.mjs","sources":["../../../../../../src/components/TextFieldBase/TextFieldBase.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, type ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"../FormField/FormField.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { FieldError } from \"@/components/FieldError\";\nimport { FieldDescription } from \"@/components/FieldDescription\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface TextFieldBaseProps\n extends PropsWithChildren<Omit<Aria.TextFieldProps, \"children\">>,\n Pick<FlowComponentProps<HTMLInputElement>, \"ref\"> {\n /** The input element */\n input: ReactNode;\n /** Whether a character count should be displayed inside the field description. */\n showCharacterCount?: boolean;\n}\n\nexport const TextFieldBase: FC<TextFieldBaseProps> = (props) => {\n const { children, className, input, showCharacterCount, ref, ...rest } =\n props;\n const [charactersCount, setCharactersCount] = useState(\n props.value?.length ?? 0,\n );\n\n const rootClassName = clsx(styles.formField, className);\n\n const translation = useLocalizedStringFormatter(locales);\n\n const propsContext: PropsContext = {\n Label: {\n className: styles.label,\n optional: !props.isRequired,\n },\n FieldDescription: {\n className: styles.fieldDescription,\n },\n FieldError: {\n className: styles.customFieldError,\n },\n };\n\n const handleOnChange = (v: string) => {\n if (showCharacterCount) {\n setCharactersCount(v.length);\n }\n if (props.onChange) {\n props.onChange(v);\n }\n };\n\n const charactersCountDescription = translation.format(\n \"textFieldBase.characters\",\n {\n count: charactersCount,\n maxCount: props.maxLength ?? 0,\n },\n );\n\n return (\n <ClearPropsContext>\n <Aria.TextField\n ref={ref}\n {...rest}\n className={rootClassName}\n onChange={handleOnChange}\n /** Prevent weired reset behavior when value is 'undefined' */\n value={rest.value ?? \"\"}\n >\n {input}\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n {showCharacterCount && (\n <FieldDescription className={styles.fieldDescription}>\n {charactersCountDescription}\n </FieldDescription>\n )}\n <FieldError className={styles.fieldError} />\n </Aria.TextField>\n </ClearPropsContext>\n );\n};\n\nexport default TextFieldBase;\n"],"names":["styles"],"mappings":";;;;;;;;;;;;;AAuBa,MAAA,aAAA,GAAwC,CAAC,KAAU,KAAA;AAC9D,EAAM,MAAA,EAAE,UAAU,SAAW,EAAA,KAAA,EAAO,oBAAoB,GAAK,EAAA,GAAG,MAC9D,GAAA,KAAA;AACF,EAAM,MAAA,CAAC,eAAiB,EAAA,kBAAkB,CAAI,GAAA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H,EAAA,CAAA;AAAA,QACC,sCACE,GAAA,CAAA,gBAAA,EAAA,EAAiB,SAAW,EAAAA,eAAA,CAAO,kBACjC,QACH,EAAA,0BAAA,EAAA,CAAA;AAAA,wBAED,GAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAAA,eAAA,CAAO,UAAY,EAAA;AAAA;AAAA;AAAA,GAE9C,EAAA,CAAA;AAEJ;;;;"}
@@ -12,75 +12,62 @@ import { useController } from 'react-hook-form';
12
12
 
13
13
  function Field(props) {
14
14
  const { children, name, defaultValue, ...rest } = props;
15
+ const controller = useController(props);
15
16
  const formContext = useFormContext();
16
- const form = formContext.form;
17
- const uncontrolledField = {
18
- field: form.register(name),
19
- fieldState: form.getFieldState(name)
20
- };
21
- const controlledField = useController(props);
22
- const buildFieldProps = (field) => ({
23
- ...field.field,
24
- defaultValue,
17
+ const value = controller.field.value;
18
+ const fieldProps = {
19
+ ...controller.field,
25
20
  name,
26
21
  form: formContext.id,
27
22
  isRequired: !!rest.rules?.required,
28
23
  validationBehavior: "aria",
29
- isInvalid: field.fieldState.invalid,
30
- onChange: (value) => {
31
- field.field.onChange({
32
- target: {
33
- value
34
- }
35
- });
36
- },
24
+ defaultValue,
25
+ isInvalid: controller.fieldState.invalid,
37
26
  children: dynamic((p) => /* @__PURE__ */ jsxs(Fragment, { children: [
38
27
  p.children,
39
- /* @__PURE__ */ jsx(FieldErrorView, { children: field.fieldState.error?.message })
28
+ /* @__PURE__ */ jsx(FieldErrorView, { children: controller.fieldState.error?.message })
40
29
  ] }))
41
- });
42
- const uncontrolledProps = buildFieldProps(uncontrolledField);
43
- const controlledProps = buildFieldProps(controlledField);
44
- const controlledValue = controlledField.field.value;
30
+ };
31
+ const { value: ignoredValue, ...fieldPropsWithoutValue } = fieldProps;
45
32
  const propsContext = {
46
- SearchField: uncontrolledProps,
47
- TextField: uncontrolledProps,
48
- TextArea: uncontrolledProps,
33
+ SearchField: fieldProps,
34
+ TextField: fieldProps,
35
+ TextArea: fieldProps,
49
36
  Checkbox: {
50
- ...controlledProps,
51
- isSelected: controlledValue
37
+ ...fieldProps,
38
+ isSelected: value
52
39
  },
53
- CheckboxGroup: controlledProps,
40
+ CheckboxGroup: fieldProps,
54
41
  CheckboxButton: {
55
- ...controlledProps,
56
- isSelected: controlledValue
42
+ ...fieldProps,
43
+ isSelected: value
57
44
  },
58
- FileField: controlledProps,
59
- NumberField: controlledProps,
60
- RadioGroup: controlledProps,
45
+ FileField: fieldProps,
46
+ NumberField: fieldProps,
47
+ RadioGroup: fieldProps,
61
48
  Switch: {
62
- ...controlledProps,
63
- isSelected: controlledValue
49
+ ...fieldProps,
50
+ isSelected: value
64
51
  },
65
52
  Select: {
66
- ...controlledProps,
67
- selectedKey: controlledValue
53
+ ...fieldProps,
54
+ selectedKey: value
68
55
  },
69
- Slider: controlledProps,
70
- DatePicker: controlledProps,
71
- DateRangePicker: controlledProps,
72
- TimeField: controlledProps,
73
- SegmentedControl: controlledProps,
56
+ Slider: fieldProps,
57
+ DatePicker: fieldProps,
58
+ DateRangePicker: fieldProps,
59
+ TimeField: fieldProps,
60
+ SegmentedControl: fieldProps,
74
61
  ComboBox: {
75
- ...controlledProps,
76
- defaultInputValue: controlledValue
62
+ ...fieldPropsWithoutValue,
63
+ selectedKey: value
77
64
  }
78
65
  };
79
66
  return /* @__PURE__ */ jsx(
80
67
  PropsContextProvider,
81
68
  {
82
69
  props: propsContext,
83
- dependencies: [controlledField.fieldState, uncontrolledField.fieldState],
70
+ dependencies: [controller.fieldState, controller.field, value],
84
71
  children
85
72
  }
86
73
  );
@@ -1 +1 @@
1
- {"version":3,"file":"Field.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Field/Field.tsx"],"sourcesContent":["import { useFormContext } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { dynamic, PropsContextProvider } from \"@/lib/propsContext\";\nimport FieldErrorView from \"@/views/FieldErrorView\";\nimport type { PropsWithChildren } from \"react\";\nimport {\n useController,\n type ControllerProps,\n type FieldValues,\n type UseFormReturn,\n} from \"react-hook-form\";\n\nexport interface FieldProps<T extends FieldValues>\n extends Omit<ControllerProps<T>, \"render\" | \"control\">,\n PropsWithChildren {}\n\nexport function Field<T extends FieldValues>(props: FieldProps<T>) {\n const { children, name, defaultValue, ...rest } = props;\n\n const formContext = useFormContext<T>();\n const form = formContext.form;\n\n const uncontrolledField = {\n field: form.register(name),\n fieldState: form.getFieldState(name),\n };\n const controlledField = useController(props);\n\n const buildFieldProps = (\n field: typeof uncontrolledField | typeof controlledField,\n ) => ({\n ...field.field,\n defaultValue,\n name,\n form: formContext.id,\n isRequired: !!rest.rules?.required,\n validationBehavior: \"aria\" as const,\n isInvalid: field.fieldState.invalid,\n onChange: (value: unknown) => {\n field.field.onChange({\n target: {\n value,\n },\n });\n },\n children: dynamic((p) => (\n <>\n {p.children}\n <FieldErrorView>{field.fieldState.error?.message}</FieldErrorView>\n </>\n )),\n });\n\n const uncontrolledProps = buildFieldProps(uncontrolledField);\n const controlledProps = buildFieldProps(controlledField);\n const controlledValue = controlledField.field.value;\n\n const propsContext: PropsContext = {\n SearchField: uncontrolledProps,\n TextField: uncontrolledProps,\n TextArea: uncontrolledProps,\n\n Checkbox: {\n ...controlledProps,\n isSelected: controlledValue,\n },\n CheckboxGroup: controlledProps,\n CheckboxButton: {\n ...controlledProps,\n isSelected: controlledValue,\n },\n FileField: controlledProps,\n NumberField: controlledProps,\n RadioGroup: controlledProps,\n Switch: {\n ...controlledProps,\n isSelected: controlledValue,\n },\n Select: {\n ...controlledProps,\n selectedKey: controlledValue,\n },\n Slider: controlledProps,\n DatePicker: controlledProps,\n DateRangePicker: controlledProps,\n TimeField: controlledProps,\n SegmentedControl: controlledProps,\n ComboBox: {\n ...controlledProps,\n defaultInputValue: controlledValue,\n },\n };\n\n return (\n <PropsContextProvider\n props={propsContext}\n dependencies={[controlledField.fieldState, uncontrolledField.fieldState]}\n >\n {children}\n </PropsContextProvider>\n );\n}\n\nexport const typedField = <T extends FieldValues>(\n ignoredForm: UseFormReturn<T> | UseFormReturn<T>[\"control\"],\n): typeof Field<T> => Field;\n"],"names":[],"mappings":";;;;;;;;;;AAgBO,SAAS,MAA6B,KAAsB,EAAA;AACjE,EAAA,MAAM,EAAE,QAAU,EAAA,IAAA,EAAM,YAAc,EAAA,GAAG,MAAS,GAAA,KAAA;AAElD,EAAA,MAAM,cAAc,cAAkB,EAAA;AACtC,EAAA,MAAM,OAAO,WAAY,CAAA,IAAA;AAEzB,EAAA,MAAM,iBAAoB,GAAA;AAAA,IACxB,KAAA,EAAO,IAAK,CAAA,QAAA,CAAS,IAAI,CAAA;AAAA,IACzB,UAAA,EAAY,IAAK,CAAA,aAAA,CAAc,IAAI;AAAA,GACrC;AACA,EAAM,MAAA,eAAA,GAAkB,cAAc,KAAK,CAAA;AAE3C,EAAM,MAAA,eAAA,GAAkB,CACtB,KACI,MAAA;AAAA,IACJ,GAAG,KAAM,CAAA,KAAA;AAAA,IACT,YAAA;AAAA,IACA,IAAA;AAAA,IACA,MAAM,WAAY,CAAA,EAAA;AAAA,IAClB,UAAY,EAAA,CAAC,CAAC,IAAA,CAAK,KAAO,EAAA,QAAA;AAAA,IAC1B,kBAAoB,EAAA,MAAA;AAAA,IACpB,SAAA,EAAW,MAAM,UAAW,CAAA,OAAA;AAAA,IAC5B,QAAA,EAAU,CAAC,KAAmB,KAAA;AAC5B,MAAA,KAAA,CAAM,MAAM,QAAS,CAAA;AAAA,QACnB,MAAQ,EAAA;AAAA,UACN;AAAA;AACF,OACD,CAAA;AAAA,KACH;AAAA,IACA,QAAU,EAAA,OAAA,CAAQ,CAAC,CAAA,qBAEd,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,MAAE,CAAA,CAAA,QAAA;AAAA,sBACF,GAAA,CAAA,cAAA,EAAA,EAAgB,QAAM,EAAA,KAAA,CAAA,UAAA,CAAW,OAAO,OAAQ,EAAA;AAAA,KAAA,EAC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;;;;"}
1
+ {"version":3,"file":"Field.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Field/Field.tsx"],"sourcesContent":["import { useFormContext } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { dynamic, PropsContextProvider } from \"@/lib/propsContext\";\nimport FieldErrorView from \"@/views/FieldErrorView\";\nimport type { PropsWithChildren } from \"react\";\nimport {\n useController,\n type ControllerProps,\n type FieldValues,\n type UseFormReturn,\n} from \"react-hook-form\";\n\nexport interface FieldProps<T extends FieldValues>\n extends Omit<ControllerProps<T>, \"render\" | \"control\">,\n PropsWithChildren {}\n\nexport function Field<T extends FieldValues>(props: FieldProps<T>) {\n const { children, name, defaultValue, ...rest } = props;\n\n const controller = useController(props);\n const formContext = useFormContext<T>();\n const value = controller.field.value;\n\n const fieldProps = {\n ...controller.field,\n name,\n form: formContext.id,\n isRequired: !!rest.rules?.required,\n validationBehavior: \"aria\" as const,\n defaultValue,\n isInvalid: controller.fieldState.invalid,\n children: dynamic((p) => (\n <>\n {p.children}\n <FieldErrorView>{controller.fieldState.error?.message}</FieldErrorView>\n </>\n )),\n };\n\n const { value: ignoredValue, ...fieldPropsWithoutValue } = fieldProps;\n\n const propsContext: PropsContext = {\n SearchField: fieldProps,\n TextField: fieldProps,\n TextArea: fieldProps,\n\n Checkbox: {\n ...fieldProps,\n isSelected: value,\n },\n CheckboxGroup: fieldProps,\n CheckboxButton: {\n ...fieldProps,\n isSelected: value,\n },\n FileField: fieldProps,\n NumberField: fieldProps,\n RadioGroup: fieldProps,\n Switch: {\n ...fieldProps,\n isSelected: value,\n },\n Select: {\n ...fieldProps,\n selectedKey: value,\n },\n Slider: fieldProps,\n DatePicker: fieldProps,\n DateRangePicker: fieldProps,\n TimeField: fieldProps,\n SegmentedControl: fieldProps,\n ComboBox: {\n ...fieldPropsWithoutValue,\n selectedKey: value,\n },\n };\n\n return (\n <PropsContextProvider\n props={propsContext}\n dependencies={[controller.fieldState, controller.field, value]}\n >\n {children}\n </PropsContextProvider>\n );\n}\n\nexport const typedField = <T extends FieldValues>(\n ignoredForm: UseFormReturn<T> | UseFormReturn<T>[\"control\"],\n): typeof Field<T> => Field;\n"],"names":[],"mappings":";;;;;;;;;;AAgBO,SAAS,MAA6B,KAAsB,EAAA;AACjE,EAAA,MAAM,EAAE,QAAU,EAAA,IAAA,EAAM,YAAc,EAAA,GAAG,MAAS,GAAA,KAAA;AAElD,EAAM,MAAA,UAAA,GAAa,cAAc,KAAK,CAAA;AACtC,EAAA,MAAM,cAAc,cAAkB,EAAA;AACtC,EAAM,MAAA,KAAA,GAAQ,WAAW,KAAM,CAAA,KAAA;AAE/B,EAAA,MAAM,UAAa,GAAA;AAAA,IACjB,GAAG,UAAW,CAAA,KAAA;AAAA,IACd,IAAA;AAAA,IACA,MAAM,WAAY,CAAA,EAAA;AAAA,IAClB,UAAY,EAAA,CAAC,CAAC,IAAA,CAAK,KAAO,EAAA,QAAA;AAAA,IAC1B,kBAAoB,EAAA,MAAA;AAAA,IACpB,YAAA;AAAA,IACA,SAAA,EAAW,WAAW,UAAW,CAAA,OAAA;AAAA,IACjC,QAAU,EAAA,OAAA,CAAQ,CAAC,CAAA,qBAEd,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,MAAE,CAAA,CAAA,QAAA;AAAA,sBACF,GAAA,CAAA,cAAA,EAAA,EAAgB,QAAW,EAAA,UAAA,CAAA,UAAA,CAAW,OAAO,OAAQ,EAAA;AAAA,KAAA,EACxD,CACD;AAAA,GACH;AAEA,EAAA,MAAM,EAAE,KAAA,EAAO,YAAc,EAAA,GAAG,wBAA2B,GAAA,UAAA;AAE3D,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,WAAa,EAAA,UAAA;AAAA,IACb,SAAW,EAAA,UAAA;AAAA,IACX,QAAU,EAAA,UAAA;AAAA,IAEV,QAAU,EAAA;AAAA,MACR,GAAG,UAAA;AAAA,MACH,UAAY,EAAA;AAAA,KACd;AAAA,IACA,aAAe,EAAA,UAAA;AAAA,IACf,cAAgB,EAAA;AAAA,MACd,GAAG,UAAA;AAAA,MACH,UAAY,EAAA;AAAA,KACd;AAAA,IACA,SAAW,EAAA,UAAA;AAAA,IACX,WAAa,EAAA,UAAA;AAAA,IACb,UAAY,EAAA,UAAA;AAAA,IACZ,MAAQ,EAAA;AAAA,MACN,GAAG,UAAA;AAAA,MACH,UAAY,EAAA;AAAA,KACd;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,GAAG,UAAA;AAAA,MACH,WAAa,EAAA;AAAA,KACf;AAAA,IACA,MAAQ,EAAA,UAAA;AAAA,IACR,UAAY,EAAA,UAAA;AAAA,IACZ,eAAiB,EAAA,UAAA;AAAA,IACjB,SAAW,EAAA,UAAA;AAAA,IACX,gBAAkB,EAAA,UAAA;AAAA,IAClB,QAAU,EAAA;AAAA,MACR,GAAG,sBAAA;AAAA,MACH,WAAa,EAAA;AAAA;AACf,GACF;AAEA,EACE,uBAAA,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,YAAA;AAAA,MACP,cAAc,CAAC,UAAA,CAAW,UAAY,EAAA,UAAA,CAAW,OAAO,KAAK,CAAA;AAAA,MAE5D;AAAA;AAAA,GACH;AAEJ;AAEa,MAAA,UAAA,GAAa,CACxB,WACoB,KAAA;;;;"}
@@ -2,25 +2,38 @@
2
2
  /* */
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import * as Aria from 'react-aria-components';
5
- import { Children, isValidElement } from 'react';
5
+ import { Children, isValidElement, cloneElement } from 'react';
6
+ import { mergeRefs } from '@react-aria/utils';
6
7
 
7
8
  const ReactAriaControlledValueFix = (props) => {
8
- const { inputContext: context, children, props: originalInputProps } = props;
9
+ const { inputContext: context, children } = props;
9
10
  const child = Children.only(children);
10
11
  if (!isValidElement(child)) {
11
12
  throw new Error("Expected valid element");
12
13
  }
13
14
  const inputProps = child.props;
14
- const inputRef = inputProps["ref"];
15
+ const ref = inputProps["ref"];
15
16
  const [contextProps, contextRef] = Aria.useContextProps(
16
17
  inputProps,
17
- inputRef,
18
+ ref,
18
19
  context
19
20
  );
20
- if (originalInputProps && typeof originalInputProps === "object" && !("value" in originalInputProps)) {
21
- delete contextProps["value"];
22
- }
23
- return /* @__PURE__ */ jsx(Aria.Provider, { values: [[context, { ...contextProps, ref: contextRef }]], children: child });
21
+ const mergedRef = mergeRefs((el) => {
22
+ if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
23
+ el.value = String(contextProps.value ?? "");
24
+ }
25
+ }, contextRef);
26
+ const uncontrolledContextProps = {
27
+ ...contextProps,
28
+ value: void 0,
29
+ ref: mergedRef
30
+ };
31
+ const uncontrolledInputProps = {
32
+ ...inputProps,
33
+ ref: void 0,
34
+ value: void 0
35
+ };
36
+ return /* @__PURE__ */ jsx(Aria.Provider, { values: [[context, uncontrolledContextProps]], children: cloneElement(child, uncontrolledInputProps) });
24
37
  };
25
38
 
26
39
  export { ReactAriaControlledValueFix };
@@ -1 +1 @@
1
- {"version":3,"file":"ReactAriaControlledValueFix.mjs","sources":["../../../../../../src/lib/react/ReactAriaControlledValueFix.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport {\n Children,\n isValidElement,\n type Context,\n type FC,\n type ForwardedRef,\n type PropsWithChildren,\n} from \"react\";\n\nexport interface ReactAriaControlledValueFixProps extends PropsWithChildren {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputContext: Context<any>;\n props: unknown;\n}\n\ninterface ChildProps {\n [key: string]: unknown;\n ref: ForwardedRef<Element>;\n}\n\n/**\n * React Aria (accidentally?!) enforces controlled inputs by always setting the\n * value prop on Inputs and TextAreas. This component uses React Arias context\n * prop API to only set the value prop, if it is present in the original\n * Input/TextArea component.\n *\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/textfield/src/useTextField.ts#L182\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/numberfield/src/useNumberField.ts#L206\n */\nexport const ReactAriaControlledValueFix: FC<\n ReactAriaControlledValueFixProps\n> = (props) => {\n const { inputContext: context, children, props: originalInputProps } = props;\n\n const child = Children.only(children);\n if (!isValidElement<ChildProps>(child)) {\n throw new Error(\"Expected valid element\");\n }\n\n const inputProps = child.props;\n const inputRef = inputProps[\"ref\"];\n\n const [contextProps, contextRef] = Aria.useContextProps(\n inputProps,\n inputRef,\n context,\n );\n\n // Here does the workaround his job\n if (\n originalInputProps &&\n typeof originalInputProps === \"object\" &&\n !(\"value\" in originalInputProps)\n ) {\n delete contextProps[\"value\"];\n }\n\n return (\n <Aria.Provider values={[[context, { ...contextProps, ref: contextRef }]]}>\n {child}\n </Aria.Provider>\n );\n};\n"],"names":[],"mappings":";;;;AA8Ba,MAAA,2BAAA,GAET,CAAC,KAAU,KAAA;AACb,EAAA,MAAM,EAAE,YAAc,EAAA,OAAA,EAAS,QAAU,EAAA,KAAA,EAAO,oBAAuB,GAAA,KAAA;AAEvE,EAAM,MAAA,KAAA,GAAQ,QAAS,CAAA,IAAA,CAAK,QAAQ,CAAA;AACpC,EAAI,IAAA,CAAC,cAA2B,CAAA,KAAK,CAAG,EAAA;AACtC,IAAM,MAAA,IAAI,MAAM,wBAAwB,CAAA;AAAA;AAG1C,EAAA,MAAM,aAAa,KAAM,CAAA,KAAA;AACzB,EAAM,MAAA,QAAA,GAAW,WAAW,KAAK,CAAA;AAEjC,EAAA,MAAM,CAAC,YAAA,EAAc,UAAU,CAAA,GAAI,IAAK,CAAA,eAAA;AAAA,IACtC,UAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACF;AAGA,EAAA,IACE,sBACA,OAAO,kBAAA,KAAuB,QAC9B,IAAA,EAAE,WAAW,kBACb,CAAA,EAAA;AACA,IAAA,OAAO,aAAa,OAAO,CAAA;AAAA;AAG7B,EAAA,2BACG,IAAK,CAAA,QAAA,EAAL,EAAc,MAAA,EAAQ,CAAC,CAAC,OAAA,EAAS,EAAE,GAAG,cAAc,GAAK,EAAA,UAAA,EAAY,CAAC,GACpE,QACH,EAAA,KAAA,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ReactAriaControlledValueFix.mjs","sources":["../../../../../../src/lib/react/ReactAriaControlledValueFix.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport {\n Children,\n cloneElement,\n isValidElement,\n type Context,\n type FC,\n type ForwardedRef,\n type PropsWithChildren,\n} from \"react\";\nimport { mergeRefs } from \"@react-aria/utils\";\n\nexport interface ReactAriaControlledValueFixProps extends PropsWithChildren {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputContext: Context<any>;\n props: unknown;\n}\n\ninterface ChildProps {\n [key: string]: unknown;\n ref: ForwardedRef<Element>;\n}\n\n/**\n * React Aria (accidentally?!) enforces controlled inputs by always setting the\n * value prop on Inputs and TextAreas with its context props API. This component\n * also uses this API to only unset the value prop. Furthermore setting an input\n * value is finally done by directly on the DOM element.\n *\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/textfield/src/useTextField.ts#L182\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/numberfield/src/useNumberField.ts#L206\n */\nexport const ReactAriaControlledValueFix: FC<\n ReactAriaControlledValueFixProps\n> = (props) => {\n const { inputContext: context, children } = props;\n\n const child = Children.only(children);\n if (!isValidElement<ChildProps>(child)) {\n throw new Error(\"Expected valid element\");\n }\n\n const inputProps = child.props;\n const ref = inputProps[\"ref\"];\n\n const [contextProps, contextRef] = Aria.useContextProps(\n inputProps,\n ref,\n context,\n );\n\n const mergedRef = mergeRefs((el) => {\n if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {\n el.value = String(contextProps.value ?? \"\");\n }\n }, contextRef);\n\n const uncontrolledContextProps = {\n ...contextProps,\n value: undefined,\n ref: mergedRef,\n };\n\n const uncontrolledInputProps = {\n ...inputProps,\n ref: undefined,\n value: undefined,\n };\n\n return (\n <Aria.Provider values={[[context, uncontrolledContextProps]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sB,CAC7C,EAAA,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,WAAW,CAAC,EACrD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,GAAG,MAAM,CAAC,EAC7C,kBAAkB,EAClB,kBAAkB,CAAC,gBAAgB,CAAC;CAAG;AAE3C;;;GAGG;AACH,eAAO,MAAM,SAAS,qGAsBpB,CAAC;AAEH,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,WAAW,CAAC,EACrD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,GAAG,MAAM,CAAC,EAC7C,kBAAkB,EAClB,kBAAkB,CAAC,gBAAgB,CAAC;CAAG;AAE3C;;;GAGG;AACH,eAAO,MAAM,SAAS,qGAqBpB,CAAC;AAEH,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextFieldBase.d.ts","sourceRoot":"","sources":["../../../../src/components/TextFieldBase/TextFieldBase.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAU9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,MAAM,WAAW,kBACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,EAC9D,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACnD,wBAAwB;IACxB,KAAK,EAAE,SAAS,CAAC;IACjB,kFAAkF;IAClF,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA8DhD,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"TextFieldBase.d.ts","sourceRoot":"","sources":["../../../../src/components/TextFieldBase/TextFieldBase.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAU9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,MAAM,WAAW,kBACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,EAC9D,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACnD,wBAAwB;IACxB,KAAK,EAAE,SAAS,CAAC;IACjB,kFAAkF;IAClF,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAgEhD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export * from '../components/Icon/components/icons';
2
- export { Action, BrowserOnly, ContextMenu, ContextMenuTrigger, List, ListItemView, Modal, ModalTrigger, Popover, PopoverTrigger, SettingsProvider, typedList, NotificationProvider, Wrap, type ActionFn, type ActionProps, type BrowserOnlyProps, type ContextMenuProps, type ContextMenuTriggerProps, type ListItemViewProps, type ListProps, type ModalProps, type ModalTriggerProps, type NotificationProviderProps, type WrapProps, } from '../components/public';
2
+ export { Action, type ActionFn, type ActionProps, BrowserOnly, type BrowserOnlyProps, ContextMenu, type ContextMenuProps, ContextMenuTrigger, type ContextMenuTriggerProps, List, type ListProps, ListItemView, type ListItemViewProps, Modal, type ModalProps, ModalTrigger, type ModalTriggerProps, Popover, type PopoverProps, PopoverTrigger, type PopoverTriggerProps, SettingsProvider, typedList, NotificationProvider, type NotificationProviderProps, Wrap, type WrapProps, } from '../components/public';
3
3
  export * from '../lib/controller/public';
4
4
  export * from '../lib/hooks/public';
5
5
  //# sourceMappingURL=flr-universal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flr-universal.d.ts","sourceRoot":"","sources":["../../../src/index/flr-universal.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AAEnD,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,IAAI,EACJ,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,SAAS,GACf,MAAM,qBAAqB,CAAC;AAE7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"flr-universal.d.ts","sourceRoot":"","sources":["../../../src/index/flr-universal.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AAEnD,OAAO,EACL,MAAM,EACN,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,WAAW,EACX,KAAK,gBAAgB,EACrB,WAAW,EACX,KAAK,gBAAgB,EACrB,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,IAAI,EACJ,KAAK,SAAS,EACd,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,EACL,KAAK,UAAU,EACf,YAAY,EACZ,KAAK,iBAAiB,EACtB,OAAO,EACP,KAAK,YAAY,EACjB,cAAc,EACd,KAAK,mBAAmB,EACxB,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,IAAI,EACJ,KAAK,SAAS,GACf,MAAM,qBAAqB,CAAC;AAE7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/Field/Field.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,WAAW,CAC/C,SAAQ,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC,EACpD,iBAAiB;CAAG;AAExB,wBAAgB,KAAK,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,2CAqFhE;AAED,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,WAAW,EAC9C,aAAa,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAC1D,OAAO,KAAK,CAAC,CAAC,CAAU,CAAC"}
1
+ {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/Field/Field.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,WAAW,CAC/C,SAAQ,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC,EACpD,iBAAiB;CAAG;AAExB,wBAAgB,KAAK,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,2CAqEhE;AAED,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,WAAW,EAC9C,aAAa,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAC1D,OAAO,KAAK,CAAC,CAAC,CAAU,CAAC"}
@@ -5,9 +5,9 @@ export interface ReactAriaControlledValueFixProps extends PropsWithChildren {
5
5
  }
6
6
  /**
7
7
  * React Aria (accidentally?!) enforces controlled inputs by always setting the
8
- * value prop on Inputs and TextAreas. This component uses React Arias context
9
- * prop API to only set the value prop, if it is present in the original
10
- * Input/TextArea component.
8
+ * value prop on Inputs and TextAreas with its context props API. This component
9
+ * also uses this API to only unset the value prop. Furthermore setting an input
10
+ * value is finally done by directly on the DOM element.
11
11
  *
12
12
  * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/textfield/src/useTextField.ts#L182
13
13
  * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/numberfield/src/useNumberField.ts#L206
@@ -1 +1 @@
1
- {"version":3,"file":"ReactAriaControlledValueFix.d.ts","sourceRoot":"","sources":["../../../../src/lib/react/ReactAriaControlledValueFix.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,EAAE,EAEP,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,gCAAiC,SAAQ,iBAAiB;IAEzE,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,KAAK,EAAE,OAAO,CAAC;CAChB;AAOD;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAC1C,gCAAgC,CAgCjC,CAAC"}
1
+ {"version":3,"file":"ReactAriaControlledValueFix.d.ts","sourceRoot":"","sources":["../../../../src/lib/react/ReactAriaControlledValueFix.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,EAAE,EAEP,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AAGf,MAAM,WAAW,gCAAiC,SAAQ,iBAAiB;IAEzE,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,KAAK,EAAE,OAAO,CAAC;CAChB;AAOD;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAC1C,gCAAgC,CAyCjC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/flow-react-components",
3
- "version": "0.2.0-alpha.196",
3
+ "version": "0.2.0-alpha.197",
4
4
  "type": "module",
5
5
  "description": "A React implementation of Flow, mittwald’s design system",
6
6
  "homepage": "https://mittwald.github.io/flow",
@@ -53,7 +53,7 @@
53
53
  "dependencies": {
54
54
  "@chakra-ui/live-region": "^2.1.0",
55
55
  "@internationalized/string-compiler": "^3.2.6",
56
- "@mittwald/react-tunnel": "0.2.0-alpha.196",
56
+ "@mittwald/react-tunnel": "0.2.0-alpha.197",
57
57
  "@mittwald/react-use-promise": "^3.0.4",
58
58
  "@react-aria/form": "^3.0.14",
59
59
  "@react-aria/utils": "^3.28.1",
@@ -92,7 +92,7 @@
92
92
  "devDependencies": {
93
93
  "@faker-js/faker": "^9.6.0",
94
94
  "@internationalized/date": "^3.7.0",
95
- "@mittwald/flow-design-tokens": "0.2.0-alpha.196",
95
+ "@mittwald/flow-design-tokens": "0.2.0-alpha.197",
96
96
  "@mittwald/react-use-promise": "^2.6.0",
97
97
  "@mittwald/remote-dom-react": "1.2.2-mittwald.3",
98
98
  "@mittwald/typescript-config": "",
@@ -173,5 +173,5 @@
173
173
  "optional": true
174
174
  }
175
175
  },
176
- "gitHead": "a41e7343793f038ea87b790a88cb35ea4828913a"
176
+ "gitHead": "61f07e056e1f7f034820439186c9fc56d51bc19c"
177
177
  }