@mittwald/flow-react-components 0.2.0-alpha.536 → 0.2.0-alpha.538

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/assets/doc-properties.json +25498 -25537
  3. package/dist/css/all.css +1 -1
  4. package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs +2 -2
  5. package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs.map +1 -1
  6. package/dist/js/components/src/components/Checkbox/Checkbox.mjs +8 -3
  7. package/dist/js/components/src/components/Checkbox/Checkbox.mjs.map +1 -1
  8. package/dist/js/components/src/components/CheckboxButton/CheckboxButton.mjs +2 -2
  9. package/dist/js/components/src/components/CheckboxButton/CheckboxButton.mjs.map +1 -1
  10. package/dist/js/components/src/components/CheckboxGroup/CheckboxGroup.mjs +2 -2
  11. package/dist/js/components/src/components/CheckboxGroup/CheckboxGroup.mjs.map +1 -1
  12. package/dist/js/components/src/components/ComboBox/ComboBox.mjs +2 -2
  13. package/dist/js/components/src/components/ComboBox/ComboBox.mjs.map +1 -1
  14. package/dist/js/components/src/components/DatePicker/DatePicker.mjs +19 -12
  15. package/dist/js/components/src/components/DatePicker/DatePicker.mjs.map +1 -1
  16. package/dist/js/components/src/components/DateRangePicker/DateRangePicker.mjs +19 -12
  17. package/dist/js/components/src/components/DateRangePicker/DateRangePicker.mjs.map +1 -1
  18. package/dist/js/components/src/components/FieldError/FieldError.mjs +26 -25
  19. package/dist/js/components/src/components/FieldError/FieldError.mjs.map +1 -1
  20. package/dist/js/components/src/components/FileDropZone/FileDropZone.mjs +2 -2
  21. package/dist/js/components/src/components/FileDropZone/FileDropZone.mjs.map +1 -1
  22. package/dist/js/components/src/components/FileField/FileField.mjs +2 -2
  23. package/dist/js/components/src/components/FileField/FileField.mjs.map +1 -1
  24. package/dist/js/components/src/components/List/components/Items/components/Item/Item.mjs +1 -0
  25. package/dist/js/components/src/components/List/components/Items/components/Item/Item.mjs.map +1 -1
  26. package/dist/js/components/src/components/List/model/item/ItemView.mjs +3 -0
  27. package/dist/js/components/src/components/List/model/item/ItemView.mjs.map +1 -1
  28. package/dist/js/components/src/components/NumberField/NumberField.mjs +7 -2
  29. package/dist/js/components/src/components/NumberField/NumberField.mjs.map +1 -1
  30. package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs +56 -82
  31. package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs.map +1 -1
  32. package/dist/js/components/src/components/RadioGroup/RadioGroup.mjs +2 -2
  33. package/dist/js/components/src/components/RadioGroup/RadioGroup.mjs.map +1 -1
  34. package/dist/js/components/src/components/SearchField/SearchField.mjs +2 -2
  35. package/dist/js/components/src/components/SearchField/SearchField.mjs.map +1 -1
  36. package/dist/js/components/src/components/SegmentedControl/SegmentedControl.mjs +2 -2
  37. package/dist/js/components/src/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
  38. package/dist/js/components/src/components/Select/Select.mjs +2 -2
  39. package/dist/js/components/src/components/Select/Select.mjs.map +1 -1
  40. package/dist/js/components/src/components/Switch/Switch.mjs +8 -3
  41. package/dist/js/components/src/components/Switch/Switch.mjs.map +1 -1
  42. package/dist/js/components/src/components/TextArea/TextArea.mjs +7 -1
  43. package/dist/js/components/src/components/TextArea/TextArea.mjs.map +1 -1
  44. package/dist/js/components/src/components/TextField/TextField.mjs +7 -1
  45. package/dist/js/components/src/components/TextField/TextField.mjs.map +1 -1
  46. package/dist/js/components/src/components/TextFieldBase/TextFieldBase.mjs +6 -3
  47. package/dist/js/components/src/components/TextFieldBase/TextFieldBase.mjs.map +1 -1
  48. package/dist/js/components/src/components/TimeField/TimeField.mjs +10 -3
  49. package/dist/js/components/src/components/TimeField/TimeField.mjs.map +1 -1
  50. package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs +12 -28
  51. package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs.map +1 -1
  52. package/dist/js/components/src/lib/hooks/useFieldComponent.mjs +5 -9
  53. package/dist/js/components/src/lib/hooks/useFieldComponent.mjs.map +1 -1
  54. package/dist/js/components/src/lib/hooks/useFieldError.mjs +132 -21
  55. package/dist/js/components/src/lib/hooks/useFieldError.mjs.map +1 -1
  56. package/dist/js/components/src/lib/propsContext/components/PropsContextProvider.mjs +2 -1
  57. package/dist/js/components/src/lib/propsContext/components/PropsContextProvider.mjs.map +1 -1
  58. package/dist/js/components/src/lib/propsContext/inherit/lib.mjs +11 -2
  59. package/dist/js/components/src/lib/propsContext/inherit/lib.mjs.map +1 -1
  60. package/dist/js/components/src/lib/propsContext/inherit/types.mjs.map +1 -1
  61. package/dist/js/components/src/views/FieldErrorView.mjs +15 -0
  62. package/dist/js/components/src/views/FieldErrorView.mjs.map +1 -0
  63. package/dist/types/components/Checkbox/Checkbox.d.ts.map +1 -1
  64. package/dist/types/components/DatePicker/DatePicker.d.ts.map +1 -1
  65. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
  66. package/dist/types/components/FieldError/FieldError.d.ts.map +1 -1
  67. package/dist/types/components/List/components/Items/components/Item/Item.d.ts.map +1 -1
  68. package/dist/types/components/List/model/item/ItemView.d.ts +3 -1
  69. package/dist/types/components/List/model/item/ItemView.d.ts.map +1 -1
  70. package/dist/types/components/NumberField/NumberField.d.ts.map +1 -1
  71. package/dist/types/components/PasswordCreationField/PasswordCreationField.d.ts.map +1 -1
  72. package/dist/types/components/Switch/Switch.d.ts.map +1 -1
  73. package/dist/types/components/TextArea/TextArea.d.ts +1 -1
  74. package/dist/types/components/TextArea/TextArea.d.ts.map +1 -1
  75. package/dist/types/components/TextField/TextField.d.ts +1 -1
  76. package/dist/types/components/TextField/TextField.d.ts.map +1 -1
  77. package/dist/types/components/TextFieldBase/TextFieldBase.d.ts +1 -1
  78. package/dist/types/components/TextFieldBase/TextFieldBase.d.ts.map +1 -1
  79. package/dist/types/components/TimeField/TimeField.d.ts.map +1 -1
  80. package/dist/types/integrations/react-hook-form/components/Field/Field.d.ts.map +1 -1
  81. package/dist/types/integrations/react-hook-form/components/Field/stories/PasswordCreationField.stories.d.ts.map +1 -1
  82. package/dist/types/lib/hooks/useFieldComponent.d.ts +1 -1
  83. package/dist/types/lib/hooks/useFieldComponent.d.ts.map +1 -1
  84. package/dist/types/lib/hooks/useFieldError.d.ts +5 -7
  85. package/dist/types/lib/hooks/useFieldError.d.ts.map +1 -1
  86. package/dist/types/lib/propsContext/components/PropsContextProvider.d.ts.map +1 -1
  87. package/dist/types/lib/propsContext/inherit/lib.d.ts +2 -0
  88. package/dist/types/lib/propsContext/inherit/lib.d.ts.map +1 -1
  89. package/dist/types/lib/propsContext/inherit/types.d.ts +1 -1
  90. package/dist/types/lib/propsContext/inherit/types.d.ts.map +1 -1
  91. package/dist/types/lib/propsContext/nestedPropsContext/lib.d.ts +1 -1
  92. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.mjs","sources":["../../../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"./Switch.module.scss\";\nimport clsx from \"clsx\";\nimport { IconCheck, IconClose } from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport labelStyles from \"../Label/Label.module.scss\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface SwitchProps\n extends PropsWithChildren<Omit<Aria.SwitchProps, \"children\">>,\n FlowComponentProps<HTMLLabelElement> {\n /**\n * Whether the label should appear before or after the switch. @default\n * \"trailing\"\n */\n labelPosition?: \"leading\" | \"trailing\";\n}\n\n/** @flr-generate all */\nexport const Switch = flowComponent(\"Switch\", (props) => {\n const {\n children,\n className,\n labelPosition = \"trailing\",\n ref,\n inputRef,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.switch,\n className,\n styles[`label-${labelPosition}`],\n );\n\n const localSwitchRef = useObjectRef(ref);\n const localInputRef = useObjectRef(inputRef);\n\n useMakeFocusable(localSwitchRef, () => {\n localInputRef.current?.focus();\n });\n\n const { FieldErrorView, fieldPropsContext, fieldProps } =\n useFieldComponent(props);\n\n const propsContext: PropsContext = {\n ...fieldPropsContext,\n Label: {\n ...fieldPropsContext.Label,\n optional: false,\n },\n };\n\n return (\n <div {...fieldProps}>\n <Aria.Switch\n {...rest}\n className={rootClassName}\n ref={localSwitchRef}\n inputRef={localInputRef}\n >\n {({ isSelected }) => (\n <PropsContextProvider props={propsContext}>\n <div className={styles.track}>\n <div className={styles.handle}>\n {isSelected ? <IconCheck size=\"s\" /> : <IconClose size=\"s\" />}\n </div>\n </div>\n <div className={labelStyles.label}>{children}</div>\n </PropsContextProvider>\n )}\n </Aria.Switch>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default Switch;\n"],"names":["labelStyles"],"mappings":";;;;;;;;;;;;;;;;;;AAwBO,MAAM,MAAA,GAAS,aAAA,CAAc,QAAA,EAAU,CAAC,KAAA,KAAU;AACvD,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,aAAA,GAAgB,UAAA;AAAA,IAChB,GAAA;AAAA,IACA,QAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,aAAA,GAAgB,IAAA;AAAA,IACpB,MAAA,CAAO,MAAA;AAAA,IACP,SAAA;AAAA,IACA,MAAA,CAAO,CAAA,MAAA,EAAS,aAAa,CAAA,CAAE;AAAA,GACjC;AAEA,EAAA,MAAM,cAAA,GAAiB,aAAa,GAAG,CAAA;AACvC,EAAA,MAAM,aAAA,GAAgB,aAAa,QAAQ,CAAA;AAE3C,EAAA,gBAAA,CAAiB,gBAAgB,MAAM;AACrC,IAAA,aAAA,CAAc,SAAS,KAAA,EAAM;AAAA,EAC/B,CAAC,CAAA;AAED,EAAA,MAAM,EAAE,cAAA,EAAgB,iBAAA,EAAmB,UAAA,EAAW,GACpD,kBAAkB,KAAK,CAAA;AAEzB,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,GAAG,iBAAA;AAAA,IACH,KAAA,EAAO;AAAA,MACL,GAAG,iBAAA,CAAkB,KAAA;AAAA,MACrB,QAAA,EAAU;AAAA;AACZ,GACF;AAEA,EAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAK,GAAG,UAAA,EACP,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,IAAA,CAAK,MAAA;AAAA,MAAL;AAAA,QACE,GAAG,IAAA;AAAA,QACJ,SAAA,EAAW,aAAA;AAAA,QACX,GAAA,EAAK,cAAA;AAAA,QACL,QAAA,EAAU,aAAA;AAAA,QAET,WAAC,EAAE,UAAA,uBACF,IAAA,CAAC,oBAAA,EAAA,EAAqB,OAAO,YAAA,EAC3B,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,KAAA,EAAA,EAAI,WAAW,MAAA,CAAO,KAAA,EACrB,8BAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAO,MAAA,EACpB,QAAA,EAAA,UAAA,uBAAc,SAAA,EAAA,EAAU,IAAA,EAAK,KAAI,CAAA,mBAAK,GAAA,CAAC,aAAU,IAAA,EAAK,GAAA,EAAI,GAC7D,CAAA,EACF,CAAA;AAAA,0BACA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAWA,QAAA,CAAY,OAAQ,QAAA,EAAS;AAAA,SAAA,EAC/C;AAAA;AAAA,KAEJ;AAAA,wBACC,cAAA,EAAA,EAAe;AAAA,GAAA,EAClB,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"Switch.mjs","sources":["../../../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"./Switch.module.scss\";\nimport clsx from \"clsx\";\nimport { IconCheck, IconClose } from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport labelStyles from \"../Label/Label.module.scss\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface SwitchProps\n extends PropsWithChildren<Omit<Aria.SwitchProps, \"children\">>,\n FlowComponentProps<HTMLLabelElement> {\n /**\n * Whether the label should appear before or after the switch. @default\n * \"trailing\"\n */\n labelPosition?: \"leading\" | \"trailing\";\n}\n\n/** @flr-generate all */\nexport const Switch = flowComponent(\"Switch\", (props) => {\n const {\n children,\n className,\n labelPosition = \"trailing\",\n ref,\n inputRef,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.switch,\n className,\n styles[`label-${labelPosition}`],\n );\n\n const localSwitchRef = useObjectRef(ref);\n const localInputRef = useObjectRef(inputRef);\n\n useMakeFocusable(localSwitchRef, () => {\n localInputRef.current?.focus();\n });\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props);\n\n const propsContext: PropsContext = {\n ...fieldPropsContext,\n Label: {\n ...fieldPropsContext.Label,\n optional: false,\n },\n };\n\n return (\n <div {...fieldProps}>\n <FieldErrorCaptureContext>\n <Aria.Switch\n {...rest}\n className={rootClassName}\n ref={localSwitchRef}\n inputRef={localInputRef}\n >\n {({ isSelected }) => (\n <PropsContextProvider props={propsContext}>\n <div className={styles.track}>\n <div className={styles.handle}>\n {isSelected ? <IconCheck size=\"s\" /> : <IconClose size=\"s\" />}\n </div>\n </div>\n <div className={labelStyles.label}>{children}</div>\n </PropsContextProvider>\n )}\n </Aria.Switch>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default Switch;\n"],"names":["labelStyles"],"mappings":";;;;;;;;;;;;;;;;;;AAwBO,MAAM,MAAA,GAAS,aAAA,CAAc,QAAA,EAAU,CAAC,KAAA,KAAU;AACvD,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,aAAA,GAAgB,UAAA;AAAA,IAChB,GAAA;AAAA,IACA,QAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,aAAA,GAAgB,IAAA;AAAA,IACpB,MAAA,CAAO,MAAA;AAAA,IACP,SAAA;AAAA,IACA,MAAA,CAAO,CAAA,MAAA,EAAS,aAAa,CAAA,CAAE;AAAA,GACjC;AAEA,EAAA,MAAM,cAAA,GAAiB,aAAa,GAAG,CAAA;AACvC,EAAA,MAAM,aAAA,GAAgB,aAAa,QAAQ,CAAA;AAE3C,EAAA,gBAAA,CAAiB,gBAAgB,MAAM;AACrC,IAAA,aAAA,CAAc,SAAS,KAAA,EAAM;AAAA,EAC/B,CAAC,CAAA;AAED,EAAA,MAAM;AAAA,IACJ,cAAA;AAAA,IACA,wBAAA;AAAA,IACA,iBAAA;AAAA,IACA;AAAA,GACF,GAAI,kBAAkB,KAAK,CAAA;AAE3B,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,GAAG,iBAAA;AAAA,IACH,KAAA,EAAO;AAAA,MACL,GAAG,iBAAA,CAAkB,KAAA;AAAA,MACrB,QAAA,EAAU;AAAA;AACZ,GACF;AAEA,EAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAK,GAAG,UAAA,EACP,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,wBAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,MAAC,IAAA,CAAK,MAAA;AAAA,MAAL;AAAA,QACE,GAAG,IAAA;AAAA,QACJ,SAAA,EAAW,aAAA;AAAA,QACX,GAAA,EAAK,cAAA;AAAA,QACL,QAAA,EAAU,aAAA;AAAA,QAET,WAAC,EAAE,UAAA,uBACF,IAAA,CAAC,oBAAA,EAAA,EAAqB,OAAO,YAAA,EAC3B,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,KAAA,EAAA,EAAI,WAAW,MAAA,CAAO,KAAA,EACrB,8BAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAO,MAAA,EACpB,QAAA,EAAA,UAAA,uBAAc,SAAA,EAAA,EAAU,IAAA,EAAK,KAAI,CAAA,mBAAK,GAAA,CAAC,aAAU,IAAA,EAAK,GAAA,EAAI,GAC7D,CAAA,EACF,CAAA;AAAA,0BACA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAWA,QAAA,CAAY,OAAQ,QAAA,EAAS;AAAA,SAAA,EAC/C;AAAA;AAAA,KAEJ,EACF,CAAA;AAAA,wBACC,cAAA,EAAA,EAAe;AAAA,GAAA,EAClB,CAAA;AAEJ,CAAC;;;;"}
@@ -94,7 +94,12 @@ const TextArea = flowComponent("TextArea", (props) => {
94
94
  )
95
95
  }
96
96
  );
97
- const { FieldErrorView, fieldPropsContext, fieldProps } = useFieldComponent(props);
97
+ const {
98
+ FieldErrorView,
99
+ FieldErrorCaptureContext,
100
+ fieldPropsContext,
101
+ fieldProps
102
+ } = useFieldComponent(props);
98
103
  return /* @__PURE__ */ jsx(
99
104
  TextFieldBase,
100
105
  {
@@ -102,6 +107,7 @@ const TextArea = flowComponent("TextArea", (props) => {
102
107
  ...fieldProps,
103
108
  className: clsx(rest.className, fieldProps.className),
104
109
  FieldErrorView,
110
+ FieldErrorCaptureContext,
105
111
  input,
106
112
  children: /* @__PURE__ */ jsx(PropsContextProvider, { props: fieldPropsContext, children })
107
113
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.mjs","sources":["../../../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport type { TextFieldBaseProps } from \"@/components/TextFieldBase\";\nimport { TextFieldBase } from \"@/components/TextFieldBase\";\nimport styles from \"./TextArea.module.scss\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { ReactAriaControlledValueFix } from \"@/lib/react/ReactAriaControlledValueFix\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport { useEffect, useState } from \"react\";\n\nexport interface TextAreaProps\n extends Omit<TextFieldBaseProps, \"FieldErrorView\" | \"input\" | \"ref\">,\n Pick<Aria.TextAreaProps, \"placeholder\" | \"rows\">,\n FlowComponentProps<HTMLTextAreaElement> {\n /**\n * Whether the text area should grow if its content gets longer than its\n * initial height.\n */\n autoResizeMaxRows?: number;\n /** Allows the user to manually resize the textArea horizontally. */\n allowHorizontalResize?: boolean;\n /** Allows the user to manually resize the textArea vertically. */\n allowVerticalResize?: boolean;\n /**\n * Allows the user to manually resize the textArea horizontally and\n * vertically.\n */\n allowResize?: boolean;\n}\n\n/** @flr-generate all */\nexport const TextArea = flowComponent(\"TextArea\", (props) => {\n const {\n children,\n placeholder,\n rows = 5,\n autoResizeMaxRows = rows,\n ref,\n allowResize,\n allowVerticalResize,\n allowHorizontalResize,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.textArea,\n allowResize && styles.resize,\n allowVerticalResize && styles.verticalResize,\n allowHorizontalResize && styles.horizontalResize,\n );\n\n const localRef = useObjectRef(ref);\n\n const getHeight = (rows: number) => {\n return `calc(var(--line-height--m) * ${rows} + (var(--form-control--padding-y) * 2))`;\n };\n\n const [resized, setResized] = useState(false);\n\n const autoResizable = rows !== autoResizeMaxRows;\n\n const verticallyResizable =\n (allowResize || allowVerticalResize) &&\n (!autoResizable || (autoResizable && resized));\n\n useEffect(() => {\n const textarea = localRef.current;\n if (!textarea) return;\n\n const startHeight = textarea.offsetHeight;\n let tracking = false;\n\n const handleMouseDown = () => {\n tracking = true;\n };\n\n const handleMouseMove = () => {\n if (!tracking || resized) return;\n\n const currentHeight = textarea.offsetHeight;\n\n if (currentHeight !== startHeight) {\n setResized(true);\n tracking = false;\n }\n };\n\n const handleMouseUp = () => {\n tracking = false;\n };\n\n window.addEventListener(\"mousedown\", handleMouseDown);\n window.addEventListener(\"mousemove\", handleMouseMove);\n window.addEventListener(\"mouseup\", handleMouseUp);\n\n return () => {\n window.removeEventListener(\"mousedown\", handleMouseDown);\n window.removeEventListener(\"mousemove\", handleMouseMove);\n window.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [resized]);\n\n const updateHeight = () => {\n if (localRef.current && autoResizable && !verticallyResizable) {\n // https://stackoverflow.com/a/60795884\n localRef.current.style.height = \"0px\";\n const scrollHeight = localRef.current.scrollHeight;\n // + 2 to add border height\n localRef.current.style.height = scrollHeight + 2 + \"px\";\n }\n };\n\n const input = (\n <ReactAriaControlledValueFix\n inputContext={Aria.TextAreaContext}\n props={props}\n >\n <Aria.TextArea\n rows={rows}\n placeholder={placeholder}\n className={rootClassName}\n ref={localRef}\n onChange={updateHeight}\n style={{\n minHeight: getHeight(rows),\n maxHeight: verticallyResizable\n ? undefined\n : getHeight(autoResizeMaxRows),\n }}\n />\n </ReactAriaControlledValueFix>\n );\n\n const { FieldErrorView, fieldPropsContext, fieldProps } =\n useFieldComponent(props);\n\n return (\n <TextFieldBase\n {...rest}\n {...fieldProps}\n className={clsx(rest.className, fieldProps.className)}\n FieldErrorView={FieldErrorView}\n input={input}\n >\n <PropsContextProvider props={fieldPropsContext}>\n {children}\n </PropsContextProvider>\n </TextFieldBase>\n );\n});\n\nexport default TextArea;\n"],"names":["rows"],"mappings":";;;;;;;;;;;;;AAkCO,MAAM,QAAA,GAAW,aAAA,CAAc,UAAA,EAAY,CAAC,KAAA,KAAU;AAC3D,EAAA,MAAM;AAAA,IACJ,QAAA;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AA,UACV,KAAA,EAAO;AAAA,YACL,SAAA,EAAW,UAAU,IAAI,CAAA;AAAA,YACzB,SAAA,EAAW,mBAAA,GACP,MAAA,GACA,SAAA,CAAU,iBAAiB;AAAA;AACjC;AAAA;AACF;AAAA,GACF;AAGF,EAAA,MAAM,EAAE,cAAA,EAAgB,iBAAA,EAAmB,UAAA,EAAW,GACpD,kBAAkB,KAAK,CAAA;AAEzB,EAAA,uBACE,GAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACH,GAAG,UAAA;AAAA,MACJ,SAAA,EAAW,IAAA,CAAK,IAAA,CAAK,SAAA,EAAW,WAAW,SAAS,CAAA;AAAA,MACpD,cAAA;AAAA,MACA,KAAA;AAAA,MAEA,QAAA,kBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,iBAAA,EAC1B,QAAA,EACH;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"TextArea.mjs","sources":["../../../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport type { TextFieldBaseProps } from \"@/components/TextFieldBase\";\nimport { TextFieldBase } from \"@/components/TextFieldBase\";\nimport styles from \"./TextArea.module.scss\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { ReactAriaControlledValueFix } from \"@/lib/react/ReactAriaControlledValueFix\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport { useEffect, useState } from \"react\";\n\nexport interface TextAreaProps\n extends Omit<\n TextFieldBaseProps,\n \"FieldErrorView\" | \"FieldErrorCaptureContext\" | \"input\" | \"ref\"\n >,\n Pick<Aria.TextAreaProps, \"placeholder\" | \"rows\">,\n FlowComponentProps<HTMLTextAreaElement> {\n /**\n * Whether the text area should grow if its content gets longer than its\n * initial height.\n */\n autoResizeMaxRows?: number;\n /** Allows the user to manually resize the textArea horizontally. */\n allowHorizontalResize?: boolean;\n /** Allows the user to manually resize the textArea vertically. */\n allowVerticalResize?: boolean;\n /**\n * Allows the user to manually resize the textArea horizontally and\n * vertically.\n */\n allowResize?: boolean;\n}\n\n/** @flr-generate all */\nexport const TextArea = flowComponent(\"TextArea\", (props) => {\n const {\n children,\n placeholder,\n rows = 5,\n autoResizeMaxRows = rows,\n ref,\n allowResize,\n allowVerticalResize,\n allowHorizontalResize,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.textArea,\n allowResize && styles.resize,\n allowVerticalResize && styles.verticalResize,\n allowHorizontalResize && styles.horizontalResize,\n );\n\n const localRef = useObjectRef(ref);\n\n const getHeight = (rows: number) => {\n return `calc(var(--line-height--m) * ${rows} + (var(--form-control--padding-y) * 2))`;\n };\n\n const [resized, setResized] = useState(false);\n\n const autoResizable = rows !== autoResizeMaxRows;\n\n const verticallyResizable =\n (allowResize || allowVerticalResize) &&\n (!autoResizable || (autoResizable && resized));\n\n useEffect(() => {\n const textarea = localRef.current;\n if (!textarea) return;\n\n const startHeight = textarea.offsetHeight;\n let tracking = false;\n\n const handleMouseDown = () => {\n tracking = true;\n };\n\n const handleMouseMove = () => {\n if (!tracking || resized) return;\n\n const currentHeight = textarea.offsetHeight;\n\n if (currentHeight !== startHeight) {\n setResized(true);\n tracking = false;\n }\n };\n\n const handleMouseUp = () => {\n tracking = false;\n };\n\n window.addEventListener(\"mousedown\", handleMouseDown);\n window.addEventListener(\"mousemove\", handleMouseMove);\n window.addEventListener(\"mouseup\", handleMouseUp);\n\n return () => {\n window.removeEventListener(\"mousedown\", handleMouseDown);\n window.removeEventListener(\"mousemove\", handleMouseMove);\n window.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [resized]);\n\n const updateHeight = () => {\n if (localRef.current && autoResizable && !verticallyResizable) {\n // https://stackoverflow.com/a/60795884\n localRef.current.style.height = \"0px\";\n const scrollHeight = localRef.current.scrollHeight;\n // + 2 to add border height\n localRef.current.style.height = scrollHeight + 2 + \"px\";\n }\n };\n\n const input = (\n <ReactAriaControlledValueFix\n inputContext={Aria.TextAreaContext}\n props={props}\n >\n <Aria.TextArea\n rows={rows}\n placeholder={placeholder}\n className={rootClassName}\n ref={localRef}\n onChange={updateHeight}\n style={{\n minHeight: getHeight(rows),\n maxHeight: verticallyResizable\n ? undefined\n : getHeight(autoResizeMaxRows),\n }}\n />\n </ReactAriaControlledValueFix>\n );\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props);\n\n return (\n <TextFieldBase\n {...rest}\n {...fieldProps}\n className={clsx(rest.className, fieldProps.className)}\n FieldErrorView={FieldErrorView}\n FieldErrorCaptureContext={FieldErrorCaptureContext}\n input={input}\n >\n <PropsContextProvider props={fieldPropsContext}>\n {children}\n </PropsContextProvider>\n </TextFieldBase>\n );\n});\n\nexport default TextArea;\n"],"names":["rows"],"mappings":";;;;;;;;;;;;;AAqCO,MAAM,QAAA,GAAW,aAAA,CAAc,UAAA,EAAY,CAAC,KAAA,KAAU;AAC3D,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,WAAA;AAAA,IACA,IAAA,GAAO,CAAA;AAAA,IACP,iBAAA,GAAoB,IAAA;AAAA,IACpB,GAAA;AAAA,IACA,WAAA;AAAA,IACA,mBAAA;AAAA,IACA,qBAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,aAAA,GAAgB,IAAA;AAAA,IACpB,MAAA,CAAO,QAAA;AAAA,IACP,eAAe,MAAA,CAAO,MAAA;AAAA,IACtB,uBAAuB,MAAA,CAAO,cAAA;AAAA,IAC9B,yBAAyB,MAAA,CAAO;AAAA,GAClC;AAEA,EAAA,MAAM,QAAA,GAAW,aAAa,GAAG,CAAA;AAEjC,EAAA,MAA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AW,WAAW,SAAS,CAAA;AAAA,MACpD,cAAA;AAAA,MACA,wBAAA;AAAA,MACA,KAAA;AAAA,MAEA,QAAA,kBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,iBAAA,EAC1B,QAAA,EACH;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
@@ -21,13 +21,19 @@ const TextField = flowComponent("TextField", (props) => {
21
21
  ref
22
22
  }
23
23
  ) });
24
- const { FieldErrorView, fieldPropsContext, fieldProps } = useFieldComponent(props);
24
+ const {
25
+ FieldErrorView,
26
+ FieldErrorCaptureContext,
27
+ fieldPropsContext,
28
+ fieldProps
29
+ } = useFieldComponent(props);
25
30
  return /* @__PURE__ */ jsx(
26
31
  TextFieldBase,
27
32
  {
28
33
  ...rest,
29
34
  ...fieldProps,
30
35
  FieldErrorView,
36
+ FieldErrorCaptureContext,
31
37
  input,
32
38
  children: /* @__PURE__ */ jsx(PropsContextProvider, { props: fieldPropsContext, children })
33
39
  }
@@ -1 +1 @@
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 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\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\n\nexport interface TextFieldProps\n extends Omit<TextFieldBaseProps, \"FieldErrorView\" | \"input\" | \"className\">,\n Pick<Aria.InputProps, \"placeholder\" | \"form\">,\n PropsWithClassName,\n FlowComponentProps<HTMLInputElement> {}\n\n/** @flr-generate all */\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 const { FieldErrorView, fieldPropsContext, fieldProps } =\n useFieldComponent(props);\n\n return (\n <TextFieldBase\n {...rest}\n {...fieldProps}\n FieldErrorView={FieldErrorView}\n input={input}\n >\n <PropsContextProvider props={fieldPropsContext}>\n {children}\n </PropsContextProvider>\n </TextFieldBase>\n );\n});\n\nexport default TextField;\n"],"names":[],"mappings":";;;;;;;;;;AAoBO,MAAM,SAAA,GAAY,aAAA,CAAc,WAAA,EAAa,CAAC,KAAA,KAAU;AAC7D,EAAA,MAAM,EAAE,QAAA,EAAU,WAAA,EAAa,KAAK,IAAA,EAAM,GAAG,MAAK,GAAI,KAAA;AAEtD,EAAA,MAAM,wBACJ,GAAA,CAAC,2BAAA,EAAA,EAA4B,YAAA,EAAc,IAAA,CAAK,cAAc,KAAA,EAC5D,QAAA,kBAAA,GAAA;AAAA,IAAC,IAAA,CAAK,KAAA;AAAA,IAAL;AAAA,MACC,IAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAW,MAAA,CAAO,SAAA;AAAA,MAClB;AAAA;AAAA,GACF,EACF,CAAA;AAGF,EAAA,MAAM,EAAE,cAAA,EAAgB,iBAAA,EAAmB,UAAA,EAAW,GACpD,kBAAkB,KAAK,CAAA;AAEzB,EAAA,uBACE,GAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACH,GAAG,UAAA;AAAA,MACJ,cAAA;AAAA,MACA,KAAA;AAAA,MAEA,QAAA,kBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,iBAAA,EAC1B,QAAA,EACH;AAAA;AAAA,GACF;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 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\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\n\nexport interface TextFieldProps\n extends Omit<\n TextFieldBaseProps,\n \"FieldErrorView\" | \"FieldErrorCaptureContext\" | \"input\" | \"className\"\n >,\n Pick<Aria.InputProps, \"placeholder\" | \"form\">,\n PropsWithClassName,\n FlowComponentProps<HTMLInputElement> {}\n\n/** @flr-generate all */\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 const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props);\n\n return (\n <TextFieldBase\n {...rest}\n {...fieldProps}\n FieldErrorView={FieldErrorView}\n FieldErrorCaptureContext={FieldErrorCaptureContext}\n input={input}\n >\n <PropsContextProvider props={fieldPropsContext}>\n {children}\n </PropsContextProvider>\n </TextFieldBase>\n );\n});\n\nexport default TextField;\n"],"names":[],"mappings":";;;;;;;;;;AAuBO,MAAM,SAAA,GAAY,aAAA,CAAc,WAAA,EAAa,CAAC,KAAA,KAAU;AAC7D,EAAA,MAAM,EAAE,QAAA,EAAU,WAAA,EAAa,KAAK,IAAA,EAAM,GAAG,MAAK,GAAI,KAAA;AAEtD,EAAA,MAAM,wBACJ,GAAA,CAAC,2BAAA,EAAA,EAA4B,YAAA,EAAc,IAAA,CAAK,cAAc,KAAA,EAC5D,QAAA,kBAAA,GAAA;AAAA,IAAC,IAAA,CAAK,KAAA;AAAA,IAAL;AAAA,MACC,IAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAW,MAAA,CAAO,SAAA;AAAA,MAClB;AAAA;AAAA,GACF,EACF,CAAA;AAGF,EAAA,MAAM;AAAA,IACJ,cAAA;AAAA,IACA,wBAAA;AAAA,IACA,iBAAA;AAAA,IACA;AAAA,GACF,GAAI,kBAAkB,KAAK,CAAA;AAE3B,EAAA,uBACE,GAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACH,GAAG,UAAA;AAAA,MACJ,cAAA;AAAA,MACA,wBAAA;AAAA,MACA,KAAA;AAAA,MAEA,QAAA,kBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,iBAAA,EAC1B,QAAA,EACH;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
@@ -16,6 +16,7 @@ const TextFieldBase = (props) => {
16
16
  showCharacterCount,
17
17
  ref,
18
18
  FieldErrorView,
19
+ FieldErrorCaptureContext,
19
20
  ...rest
20
21
  } = props;
21
22
  const [charactersCount, setCharactersCount] = useState(
@@ -49,9 +50,11 @@ const TextFieldBase = (props) => {
49
50
  onChange: handleOnChange,
50
51
  ...propsWithOptionalStringValue,
51
52
  children: [
52
- children,
53
- input,
54
- showCharacterCount && /* @__PURE__ */ jsx(FieldDescription, { className: formFieldStyles.fieldDescription, children: charactersCountDescription }),
53
+ /* @__PURE__ */ jsxs(FieldErrorCaptureContext, { children: [
54
+ children,
55
+ input,
56
+ showCharacterCount && /* @__PURE__ */ jsx(FieldDescription, { className: formFieldStyles.fieldDescription, children: charactersCountDescription })
57
+ ] }),
55
58
  /* @__PURE__ */ jsx(FieldErrorView, {})
56
59
  ]
57
60
  }
@@ -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 { useState } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport { FieldDescription } from \"@/components/FieldDescription\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport type { UseFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport styles from \"../FormField/FormField.module.scss\";\n\nexport interface TextFieldBaseProps\n extends PropsWithChildren<Omit<Aria.TextFieldProps, \"children\">>,\n Pick<FlowComponentProps<HTMLInputElement>, \"ref\">,\n Pick<UseFieldComponent, \"FieldErrorView\"> {\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 {\n children,\n className,\n input,\n showCharacterCount,\n ref,\n FieldErrorView,\n ...rest\n } = props;\n\n const [charactersCount, setCharactersCount] = useState(\n props.value?.length ?? 0,\n );\n\n const translation = useLocalizedStringFormatter(locales);\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 /** Prevent weird reset behavior when value is 'undefined' */\n const propsWithOptionalStringValue =\n \"value\" in props\n ? {\n value: props.value ?? \"\",\n }\n : {};\n\n return (\n <Aria.TextField\n ref={ref}\n {...rest}\n className={className}\n onChange={handleOnChange}\n {...propsWithOptionalStringValue}\n >\n {children}\n {input}\n {showCharacterCount && (\n <FieldDescription className={styles.fieldDescription}>\n {charactersCountDescription}\n </FieldDescription>\n )}\n <FieldErrorView />\n </Aria.TextField>\n );\n};\n\nexport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A,eAAA,CAAO,kBACjC,QAAA,EAAA,0BAAA,EACH,CAAA;AAAA,4BAED,cAAA,EAAA,EAAe;AAAA;AAAA;AAAA,GAClB;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 { FieldDescription } from \"@/components/FieldDescription\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport type { UseFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport styles from \"../FormField/FormField.module.scss\";\n\nexport interface TextFieldBaseProps\n extends PropsWithChildren<Omit<Aria.TextFieldProps, \"children\">>,\n Pick<FlowComponentProps<HTMLInputElement>, \"ref\">,\n Pick<UseFieldComponent, \"FieldErrorView\" | \"FieldErrorCaptureContext\"> {\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 {\n children,\n className,\n input,\n showCharacterCount,\n ref,\n FieldErrorView,\n FieldErrorCaptureContext,\n ...rest\n } = props;\n\n const [charactersCount, setCharactersCount] = useState(\n props.value?.length ?? 0,\n );\n\n const translation = useLocalizedStringFormatter(locales);\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 /** Prevent weird reset behavior when value is 'undefined' */\n const propsWithOptionalStringValue =\n \"value\" in props\n ? {\n value: props.value ?? \"\",\n }\n : {};\n\n return (\n <Aria.TextField\n ref={ref}\n {...rest}\n className={className}\n onChange={handleOnChange}\n {...propsWithOptionalStringValue}\n >\n <FieldErrorCaptureContext>\n {children}\n {input}\n {showCharacterCount && (\n <FieldDescription className={styles.fieldDescription}>\n {charactersCountDescription}\n </FieldDescription>\n )}\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </Aria.TextField>\n );\n};\n\nexport default TextFieldBase;\n"],"names":["styles"],"mappings":";;;;;;;;AAoBO,MAAM,aAAA,GAAwC,CAAC,KAAA,KAAU;AAC9D,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,kBAAA;AAAA,IACA,GAAA;AAAA,IACA,cAAA;AAAA,IACA,wBAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,QAAA;AAAA,IAC5C,KAAA,CAAM,OAAO,MAAA,IAAU;AAAA,GACzB;AAEA,EAAA,MAAM,WAAA,GAAc,4BAA4B,OAAO,CAAA;AAEvD,EAAA,MAAM,cAAA,GAAiB,CAAC,CAAA,KAAc;AACpC,IAAA,IAAI,kBAAA,EAAoB;AACtB,MAAA,kBAAA,CAAmB,EAAE,MAAM,CAAA;AAAA,IAC7B;AACA,IAAA,IAAI,MAAM,QAAA,EAAU;AAClB,MAAA,KAAA,CAAM,SAAS,CAAC,CAAA;AAAA,IAClB;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,6BAA6B,WAAA,CAAY,MAAA;AAAA,IAC7C,0BAAA;AAAA,IACA;AAAA,MACE,KAAA,EAAO,eAAA;AAAA,MACP,QAAA,EAAU,MAAM,SAAA,IAAa;AAAA;AAC/B,GACF;AAGA,EAAA,MAAM,4BAAA,GACJ,WAAW,KAAA,GACP;AAAA,IACE,KAAA,EAAO,MAAM,KAAA,IAAS;AAAA,MAExB,EAAC;AAEP,EAAA,uBACE,IAAA;AAAA,IAAC,IAAA,CAAK,SAAA;AAAA,IAAL;AAAA,MACC,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MACJ,SAAA;AAAA,MACA,QAAA,EAAU,cAAA;AAAA,MACT,GAAG,4BAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAA,IAAA,CAAC,wBAAA,EAAA,EACE,QAAA,EAAA;AAAA,UAAA,QAAA;AAAA,UACA,KAAA;AAAA,UACA,sCACC,GAAA,CAAC,gBAAA,EAAA,EAAiB,SAAA,EAAWA,eAAA,CAAO,kBACjC,QAAA,EAAA,0BAAA,EACH;AAAA,SAAA,EAEJ,CAAA;AAAA,4BACC,cAAA,EAAA,EAAe;AAAA;AAAA;AAAA,GAClB;AAEJ;;;;"}
@@ -13,12 +13,19 @@ import { useFieldComponent } from '../../lib/hooks/useFieldComponent.mjs';
13
13
 
14
14
  const TimeField = flowComponent("TimeField", (props) => {
15
15
  const { children, ref, ...rest } = props;
16
- const { FieldErrorView, fieldPropsContext, fieldProps } = useFieldComponent(props);
16
+ const {
17
+ FieldErrorView,
18
+ FieldErrorCaptureContext,
19
+ fieldPropsContext,
20
+ fieldProps
21
+ } = useFieldComponent(props);
17
22
  const localRef = useObjectRef(ref);
18
23
  useMakeFocusable(localRef);
19
24
  return /* @__PURE__ */ jsxs(Aria.TimeField, { ref: localRef, hourCycle: 24, ...rest, ...fieldProps, children: [
20
- /* @__PURE__ */ jsx(Aria.DateInput, { className: styles.dateInput, children: (segment) => /* @__PURE__ */ jsx(Aria.DateSegment, { segment }) }),
21
- /* @__PURE__ */ jsx(PropsContextProvider, { props: fieldPropsContext, children }),
25
+ /* @__PURE__ */ jsxs(FieldErrorCaptureContext, { children: [
26
+ /* @__PURE__ */ jsx(Aria.DateInput, { className: styles.dateInput, children: (segment) => /* @__PURE__ */ jsx(Aria.DateSegment, { segment }) }),
27
+ /* @__PURE__ */ jsx(PropsContextProvider, { props: fieldPropsContext, children })
28
+ ] }),
22
29
  /* @__PURE__ */ jsx(FieldErrorView, {})
23
30
  ] });
24
31
  });
@@ -1 +1 @@
1
- {"version":3,"file":"TimeField.mjs","sources":["../../../../../../src/components/TimeField/TimeField.tsx"],"sourcesContent":["import React, { type PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport styles from \"./TimeField.module.scss\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nexport interface TimeFieldProps<T extends Aria.TimeValue = Aria.TimeValue>\n extends PropsWithChildren<Omit<Aria.TimeFieldProps<T>, \"children\">>,\n FlowComponentProps<HTMLInputElement> {}\n\n/** @flr-generate all */\nexport const TimeField = flowComponent(\"TimeField\", (props) => {\n const { children, ref, ...rest } = props;\n\n const { FieldErrorView, fieldPropsContext, fieldProps } =\n useFieldComponent(props);\n\n const localRef = useObjectRef(ref);\n useMakeFocusable(localRef);\n\n return (\n <Aria.TimeField ref={localRef} hourCycle={24} {...rest} {...fieldProps}>\n <Aria.DateInput className={styles.dateInput}>\n {(segment) => <Aria.DateSegment segment={segment} />}\n </Aria.DateInput>\n <PropsContextProvider props={fieldPropsContext}>\n {children}\n </PropsContextProvider>\n <FieldErrorView />\n </Aria.TimeField>\n );\n});\n\nexport default TimeField;\n"],"names":[],"mappings":";;;;;;;;;;;AAgBO,MAAM,SAAA,GAAY,aAAA,CAAc,WAAA,EAAa,CAAC,KAAA,KAAU;AAC7D,EAAA,MAAM,EAAE,QAAA,EAAU,GAAA,EAAK,GAAG,MAAK,GAAI,KAAA;AAEnC,EAAA,MAAM,EAAE,cAAA,EAAgB,iBAAA,EAAmB,UAAA,EAAW,GACpD,kBAAkB,KAAK,CAAA;AAEzB,EAAA,MAAM,QAAA,GAAW,aAAa,GAAG,CAAA;AACjC,EAAA,gBAAA,CAAiB,QAAQ,CAAA;AAEzB,EAAA,uBACE,IAAA,CAAC,IAAA,CAAK,SAAA,EAAL,EAAe,GAAA,EAAK,QAAA,EAAU,SAAA,EAAW,EAAA,EAAK,GAAG,IAAA,EAAO,GAAG,UAAA,EAC1D,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,CAAK,SAAA,EAAL,EAAe,SAAA,EAAW,MAAA,CAAO,SAAA,EAC/B,QAAA,EAAA,CAAC,OAAA,qBAAY,GAAA,CAAC,IAAA,CAAK,WAAA,EAAL,EAAiB,SAAkB,CAAA,EACpD,CAAA;AAAA,oBACA,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,iBAAA,EAC1B,QAAA,EACH,CAAA;AAAA,wBACC,cAAA,EAAA,EAAe;AAAA,GAAA,EAClB,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"TimeField.mjs","sources":["../../../../../../src/components/TimeField/TimeField.tsx"],"sourcesContent":["import React, { type PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport styles from \"./TimeField.module.scss\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nexport interface TimeFieldProps<T extends Aria.TimeValue = Aria.TimeValue>\n extends PropsWithChildren<Omit<Aria.TimeFieldProps<T>, \"children\">>,\n FlowComponentProps<HTMLInputElement> {}\n\n/** @flr-generate all */\nexport const TimeField = flowComponent(\"TimeField\", (props) => {\n const { children, ref, ...rest } = props;\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props);\n\n const localRef = useObjectRef(ref);\n useMakeFocusable(localRef);\n\n return (\n <Aria.TimeField ref={localRef} hourCycle={24} {...rest} {...fieldProps}>\n <FieldErrorCaptureContext>\n <Aria.DateInput className={styles.dateInput}>\n {(segment) => <Aria.DateSegment segment={segment} />}\n </Aria.DateInput>\n <PropsContextProvider props={fieldPropsContext}>\n {children}\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </Aria.TimeField>\n );\n});\n\nexport default TimeField;\n"],"names":[],"mappings":";;;;;;;;;;;AAgBO,MAAM,SAAA,GAAY,aAAA,CAAc,WAAA,EAAa,CAAC,KAAA,KAAU;AAC7D,EAAA,MAAM,EAAE,QAAA,EAAU,GAAA,EAAK,GAAG,MAAK,GAAI,KAAA;AAEnC,EAAA,MAAM;AAAA,IACJ,cAAA;AAAA,IACA,wBAAA;AAAA,IACA,iBAAA;AAAA,IACA;AAAA,GACF,GAAI,kBAAkB,KAAK,CAAA;AAE3B,EAAA,MAAM,QAAA,GAAW,aAAa,GAAG,CAAA;AACjC,EAAA,gBAAA,CAAiB,QAAQ,CAAA;AAEzB,EAAA,uBACE,IAAA,CAAC,IAAA,CAAK,SAAA,EAAL,EAAe,GAAA,EAAK,QAAA,EAAU,SAAA,EAAW,EAAA,EAAK,GAAG,IAAA,EAAO,GAAG,UAAA,EAC1D,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,wBAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,IAAA,CAAK,SAAA,EAAL,EAAe,SAAA,EAAW,MAAA,CAAO,SAAA,EAC/B,QAAA,EAAA,CAAC,OAAA,qBAAY,GAAA,CAAC,IAAA,CAAK,WAAA,EAAL,EAAiB,SAAkB,CAAA,EACpD,CAAA;AAAA,sBACA,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,iBAAA,EAC1B,QAAA,EACH;AAAA,KAAA,EACF,CAAA;AAAA,wBACC,cAAA,EAAA,EAAe;AAAA,GAAA,EAClB,CAAA;AAEJ,CAAC;;;;"}
@@ -1,14 +1,16 @@
1
1
  "use client"
2
2
  /* */
3
- import { jsx } from 'react/jsx-runtime';
3
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useFormContext } from '../context/formContext.mjs';
5
+ import { dynamic } from '../../../../lib/propsContext/dynamicProps/dynamic.mjs';
5
6
  import '../../../../lib/propsContext/propsContext.mjs';
6
7
  import { PropsContextProvider } from '../../../../lib/propsContext/components/PropsContextProvider.mjs';
8
+ import 'react';
7
9
  import { useController, useWatch } from 'react-hook-form';
8
10
  import { useLocalizedStringFormatter } from 'react-aria';
9
11
  import locales from '../../../../../../_virtual/_.locale.json@72ba2ce40f190df671686fec50c04ddf.mjs';
10
12
  import { inheritProps } from '../../../../lib/propsContext/inherit/types.mjs';
11
- import { FieldErrorContext } from 'react-aria-components';
13
+ import FieldErrorView from '../../../../views/FieldErrorView.mjs';
12
14
 
13
15
  function Field(props) {
14
16
  const { children, name, defaultValue, ...rest } = props;
@@ -46,7 +48,13 @@ function Field(props) {
46
48
  isRequired: !!rest.rules?.required,
47
49
  validationBehavior: "aria",
48
50
  defaultValue,
49
- isInvalid: isFieldInvalid
51
+ isInvalid: isFieldInvalid,
52
+ children: dynamic((p) => {
53
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
54
+ p.children,
55
+ /* @__PURE__ */ jsx(FieldErrorView, { children: controller.fieldState.error?.message })
56
+ ] });
57
+ })
50
58
  };
51
59
  const { value: ignoredValue, ...fieldPropsWithoutValue } = fieldProps;
52
60
  const propsContext = {
@@ -93,31 +101,7 @@ function Field(props) {
93
101
  {
94
102
  props: propsContext,
95
103
  dependencies: [controller.fieldState, controller.field, value],
96
- children: /* @__PURE__ */ jsx(
97
- FieldErrorContext,
98
- {
99
- value: {
100
- isInvalid: isFieldInvalid,
101
- validationErrors: [
102
- controller.fieldState.error?.message ?? "noMessage"
103
- ],
104
- validationDetails: {
105
- valid: !isFieldInvalid,
106
- badInput: false,
107
- customError: isFieldInvalid,
108
- patternMismatch: false,
109
- rangeOverflow: false,
110
- rangeUnderflow: false,
111
- stepMismatch: false,
112
- tooLong: false,
113
- tooShort: false,
114
- valueMissing: false,
115
- typeMismatch: false
116
- }
117
- },
118
- children
119
- }
120
- )
104
+ children
121
105
  }
122
106
  );
123
107
  }
@@ -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 { PropsContextProvider } from \"@/lib/propsContext\";\nimport type { PropsWithChildren } from \"react\";\nimport {\n type ControllerProps,\n type FieldValues,\n useController,\n type UseFormReturn,\n useWatch,\n} from \"react-hook-form\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport locales from \"./locales/*.locale.json\";\nimport { inheritProps } from \"@/lib/propsContext/inherit/types\";\nimport { FieldErrorContext } from \"react-aria-components\";\n\nexport interface FieldProps<T extends FieldValues>\n extends Omit<ControllerProps<T>, \"render\">,\n PropsWithChildren {}\n\nexport function Field<T extends FieldValues>(props: FieldProps<T>) {\n const { children, name, defaultValue, ...rest } = props;\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const controller = useController({\n ...props,\n rules: {\n ...props.rules,\n minLength:\n typeof rest.rules?.minLength === \"number\"\n ? {\n value: rest.rules.minLength,\n message: stringFormatter.format(\"minLength\", {\n number: rest.rules.minLength,\n }),\n }\n : rest.rules?.minLength,\n maxLength:\n typeof rest.rules?.maxLength === \"number\"\n ? {\n value: rest.rules.maxLength,\n message: stringFormatter.format(\"maxLength\", {\n number: rest.rules.maxLength,\n }),\n }\n : rest.rules?.maxLength,\n },\n });\n const formContext = useFormContext<T>();\n /**\n * We don't use controller.field.value here, because it doesn't update when\n * the form value is updated outside of this field (e.g. when setting values\n * with form.setValue or resetting the form), and the Field unmounts in\n * between. This is generally a feature of React Hook Form, but this breaks\n * dynamic forms where fields are conditionally rendered.\n *\n * By using formContext.form.watch(name), we ensure that the field value is\n * always in sync with the form state. See:\n * https://react-hook-form.com/api/usecontroller/controller/\n */\n const value =\n useWatch({\n control: formContext.form.control,\n name,\n }) ?? controller.field.value;\n\n const isFieldInvalid = controller.fieldState.invalid;\n\n const fieldProps = {\n ...inheritProps,\n ...controller.field,\n value,\n name,\n form: formContext.id,\n isRequired: !!rest.rules?.required,\n validationBehavior: \"aria\" as const,\n defaultValue,\n isInvalid: isFieldInvalid,\n };\n\n const { value: ignoredValue, ...fieldPropsWithoutValue } = fieldProps;\n\n const propsContext: PropsContext = {\n SearchField: fieldProps,\n TextField: fieldProps,\n TextArea: fieldProps,\n MarkdownEditor: fieldProps,\n Checkbox: {\n ...fieldProps,\n isSelected: value,\n },\n CheckboxGroup: {\n ...fieldProps,\n },\n CheckboxButton: {\n ...fieldProps,\n isSelected: value,\n },\n FileField: fieldProps,\n FileDropZone: fieldProps,\n NumberField: fieldProps,\n RadioGroup: fieldProps,\n Switch: {\n ...fieldProps,\n isSelected: value,\n },\n Slider: fieldProps,\n PasswordCreationField: fieldProps,\n DatePicker: fieldProps,\n DateRangePicker: fieldProps,\n TimeField: fieldProps,\n SegmentedControl: fieldProps,\n Select: {\n ...fieldProps,\n selectedKey: value,\n },\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 <FieldErrorContext\n value={{\n isInvalid: isFieldInvalid,\n validationErrors: [\n controller.fieldState.error?.message ?? \"noMessage\",\n ],\n validationDetails: {\n valid: !isFieldInvalid,\n badInput: false,\n customError: isFieldInvalid,\n patternMismatch: false,\n rangeOverflow: false,\n rangeUnderflow: false,\n stepMismatch: false,\n tooLong: false,\n tooShort: false,\n valueMissing: false,\n typeMismatch: false,\n },\n }}\n >\n {children}\n </FieldErrorContext>\n </PropsContextProvider>\n );\n}\n\nexport const typedField = <T extends FieldValues>(\n ignoredForm: UseFormReturn<T> | UseFormReturn<T>[\"control\"],\n): typeof Field<T> => Field;\n\nexport default Field;\n"],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;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAA;AAAA,MACP,cAAc,CAAC,UAAA,CAAW,UAAA,EAAY,UAAA,CAAW,OAAO,KAAK,CAAA;AAAA,MAE7D,QAAA,kBAAA,GAAA;AAAA,QAAC,iBAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO;AAAA,YACL,SAAA,EAAW,cAAA;AAAA,YACX,gBAAA,EAAkB;AAAA,cAChB,UAAA,CAAW,UAAA,CAAW,KAAA,EAAO,OAAA,IAAW;AAAA,aAC1C;AAAA,YACA,iBAAA,EAAmB;AAAA,cACjB,OAAO,CAAC,cAAA;AAAA,cACR,QAAA,EAAU,KAAA;AAAA,cACV,WAAA,EAAa,cAAA;AAAA,cACb,eAAA,EAAiB,KAAA;AAAA,cACjB,aAAA,EAAe,KAAA;AAAA,cACf,cAAA,EAAgB,KAAA;AAAA,cAChB,YAAA,EAAc,KAAA;AAAA,cACd,OAAA,EAAS,KAAA;AAAA,cACT,QAAA,EAAU,KAAA;AAAA,cACV,YAAA,EAAc,KAAA;AAAA,cACd,YAAA,EAAc;AAAA;AAChB,WACF;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GACF;AAEJ;AAEO,MAAM,UAAA,GAAa,CACxB,WAAA,KACoB;;;;"}
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 { dynamic, type PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { type PropsWithChildren } from \"react\";\nimport {\n type ControllerProps,\n type FieldValues,\n useController,\n type UseFormReturn,\n useWatch,\n} from \"react-hook-form\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport locales from \"./locales/*.locale.json\";\nimport { inheritProps } from \"@/lib/propsContext/inherit/types\";\nimport FieldErrorView from \"@/views/FieldErrorView\";\n\nexport interface FieldProps<T extends FieldValues>\n extends Omit<ControllerProps<T>, \"render\">,\n PropsWithChildren {}\n\nexport function Field<T extends FieldValues>(props: FieldProps<T>) {\n const { children, name, defaultValue, ...rest } = props;\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const controller = useController({\n ...props,\n rules: {\n ...props.rules,\n minLength:\n typeof rest.rules?.minLength === \"number\"\n ? {\n value: rest.rules.minLength,\n message: stringFormatter.format(\"minLength\", {\n number: rest.rules.minLength,\n }),\n }\n : rest.rules?.minLength,\n maxLength:\n typeof rest.rules?.maxLength === \"number\"\n ? {\n value: rest.rules.maxLength,\n message: stringFormatter.format(\"maxLength\", {\n number: rest.rules.maxLength,\n }),\n }\n : rest.rules?.maxLength,\n },\n });\n const formContext = useFormContext<T>();\n /**\n * We don't use controller.field.value here, because it doesn't update when\n * the form value is updated outside of this field (e.g. when setting values\n * with form.setValue or resetting the form), and the Field unmounts in\n * between. This is generally a feature of React Hook Form, but this breaks\n * dynamic forms where fields are conditionally rendered.\n *\n * By using formContext.form.watch(name), we ensure that the field value is\n * always in sync with the form state. See:\n * https://react-hook-form.com/api/usecontroller/controller/\n */\n const value =\n useWatch({\n control: formContext.form.control,\n name,\n }) ?? controller.field.value;\n\n const isFieldInvalid = controller.fieldState.invalid;\n\n const fieldProps = {\n ...inheritProps,\n ...controller.field,\n value,\n name,\n form: formContext.id,\n isRequired: !!rest.rules?.required,\n validationBehavior: \"aria\" as const,\n defaultValue,\n isInvalid: isFieldInvalid,\n children: dynamic((p) => {\n return (\n <>\n {p.children}\n <FieldErrorView>\n {controller.fieldState.error?.message}\n </FieldErrorView>\n </>\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 MarkdownEditor: fieldProps,\n Checkbox: {\n ...fieldProps,\n isSelected: value,\n },\n CheckboxGroup: {\n ...fieldProps,\n },\n CheckboxButton: {\n ...fieldProps,\n isSelected: value,\n },\n FileField: fieldProps,\n FileDropZone: fieldProps,\n NumberField: fieldProps,\n RadioGroup: fieldProps,\n Switch: {\n ...fieldProps,\n isSelected: value,\n },\n Slider: fieldProps,\n PasswordCreationField: fieldProps,\n DatePicker: fieldProps,\n DateRangePicker: fieldProps,\n TimeField: fieldProps,\n SegmentedControl: fieldProps,\n Select: {\n ...fieldProps,\n selectedKey: value,\n },\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\nexport default Field;\n"],"names":[],"mappings":";;;;;;;;;;;;AAoBO,SAAS,MAA6B,KAAA,EAAsB;AACjE,EAAA,MAAM,EAAE,QAAA,EAAU,IAAA,EAAM,YAAA,EAAc,GAAG,MAAK,GAAI,KAAA;AAElD,EAAA,MAAM,eAAA,GAAkB,4BAA4B,OAAO,CAAA;AAE3D,EAAA,MAAM,aAAa,aAAA,CAAc;AAAA,IAC/B,GAAG,KAAA;AAAA,IACH,KAAA,EAAO;AAAA,MACL,GAAG,KAAA,CAAM,KAAA;AAAA,MACT,SAAA,EACE,OAAO,IAAA,CAAK,KAAA,EAAO,cAAc,QAAA,GAC7B;AAAA,QACE,KAAA,EAAO,KAAK,KAAA,CAAM,SAAA;AAAA,QAClB,OAAA,EAAS,eAAA,CAAgB,MAAA,CAAO,WAAA,EAAa;AAAA,UAC3C,MAAA,EAAQ,KAAK,KAAA,CAAM;AAAA,SACpB;AAAA,OACH,GACA,KAAK,KAAA,EAAO,SAAA;AAAA,MAClB,SAAA,EACE,OAAO,IAAA,CAAK,KAAA,EAAO,cAAc,QAAA,GAC7B;AAAA,QACE,KAAA,EAAO,KAAK,KAAA,CAAM,SAAA;AAAA,QAClB,OAAA,EAA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AA,EAAU;AAAA,MACR,GAAG,UAAA;AAAA,MACH,UAAA,EAAY;AAAA,KACd;AAAA,IACA,aAAA,EAAe;AAAA,MACb,GAAG;AAAA,KACL;AAAA,IACA,cAAA,EAAgB;AAAA,MACd,GAAG,UAAA;AAAA,MACH,UAAA,EAAY;AAAA,KACd;AAAA,IACA,SAAA,EAAW,UAAA;AAAA,IACX,YAAA,EAAc,UAAA;AAAA,IACd,WAAA,EAAa,UAAA;AAAA,IACb,UAAA,EAAY,UAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,GAAG,UAAA;AAAA,MACH,UAAA,EAAY;AAAA,KACd;AAAA,IACA,MAAA,EAAQ,UAAA;AAAA,IACR,qBAAA,EAAuB,UAAA;AAAA,IACvB,UAAA,EAAY,UAAA;AAAA,IACZ,eAAA,EAAiB,UAAA;AAAA,IACjB,SAAA,EAAW,UAAA;AAAA,IACX,gBAAA,EAAkB,UAAA;AAAA,IAClB,MAAA,EAAQ;AAAA,MACN,GAAG,UAAA;AAAA,MACH,WAAA,EAAa;AAAA,KACf;AAAA,IACA,QAAA,EAAU;AAAA,MACR,GAAG,sBAAA;AAAA,MACH,WAAA,EAAa;AAAA;AACf,GACF;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAA;AAAA,MACP,cAAc,CAAC,UAAA,CAAW,UAAA,EAAY,UAAA,CAAW,OAAO,KAAK,CAAA;AAAA,MAE5D;AAAA;AAAA,GACH;AAEJ;AAEO,MAAM,UAAA,GAAa,CACxB,WAAA,KACoB;;;;"}
@@ -1,15 +1,13 @@
1
1
  "use client"
2
2
  /* */
3
- import { jsx } from 'react/jsx-runtime';
4
- import 'react';
5
3
  import '../propsContext/propsContext.mjs';
6
- import { PropsContextProvider } from '../propsContext/components/PropsContextProvider.mjs';
4
+ import '../propsContext/components/PropsContextProvider.mjs';
7
5
  import formFieldStyles from '../../components/FormField/FormField.module.scss.mjs';
8
6
  import { useFieldError } from './useFieldError.mjs';
9
7
  import clsx from 'clsx';
10
8
 
11
9
  const useFieldComponent = (props) => {
12
- const { FieldErrorView, fieldErrorViewPropsContext, FieldErrorResetContext } = useFieldError();
10
+ const { FieldErrorView, FieldErrorCaptureContext } = useFieldError();
13
11
  const fieldPropsContext = {
14
12
  Label: {
15
13
  className: formFieldStyles.label,
@@ -18,13 +16,11 @@ const useFieldComponent = (props) => {
18
16
  },
19
17
  FieldDescription: {
20
18
  className: formFieldStyles.fieldDescription
21
- },
22
- ...fieldErrorViewPropsContext
19
+ }
23
20
  };
24
- const FieldErrorViewWithPropsContext = () => /* @__PURE__ */ jsx(PropsContextProvider, { props: fieldErrorViewPropsContext, children: /* @__PURE__ */ jsx(FieldErrorView, {}) });
25
21
  return {
26
- FieldErrorResetContext,
27
- FieldErrorView: FieldErrorViewWithPropsContext,
22
+ FieldErrorView,
23
+ FieldErrorCaptureContext,
28
24
  fieldPropsContext,
29
25
  fieldProps: {
30
26
  className: clsx(formFieldStyles.formField)
@@ -1 +1 @@
1
- {"version":3,"file":"useFieldComponent.mjs","sources":["../../../../../../src/lib/hooks/useFieldComponent.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { useFieldError } from \"@/lib/hooks/useFieldError\";\nimport clsx, { type ClassValue } from \"clsx\";\n\ninterface FieldComponentProps {\n className?: ClassValue;\n isRequired?: boolean;\n isDisabled?: boolean;\n}\n\nexport interface UseFieldComponent {\n FieldErrorResetContext: FC<PropsWithChildren>;\n FieldErrorView: FC;\n fieldPropsContext: PropsContext;\n fieldProps: {\n className?: ReturnType<typeof clsx>;\n };\n}\n\nexport const useFieldComponent = (\n props: FieldComponentProps,\n): UseFieldComponent => {\n const { FieldErrorView, fieldErrorViewPropsContext, FieldErrorResetContext } =\n useFieldError();\n\n // setting up the props context for all components that\n // are part of a form control\n const fieldPropsContext: PropsContext = {\n Label: {\n className: formFieldStyles.label,\n optional: !props.isRequired,\n isDisabled: !!props.isDisabled,\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n },\n ...fieldErrorViewPropsContext,\n };\n\n // wrapping the FieldErrorView in a PropsContextProvider to ensure\n // it's always in the correct props context\n const FieldErrorViewWithPropsContext = () => (\n <PropsContextProvider props={fieldErrorViewPropsContext}>\n <FieldErrorView />\n </PropsContextProvider>\n );\n\n return {\n FieldErrorResetContext,\n FieldErrorView: FieldErrorViewWithPropsContext,\n fieldPropsContext,\n fieldProps: {\n className: clsx(formFieldStyles.formField),\n },\n } as const;\n};\n"],"names":[],"mappings":";;;;;;;;AAsBO,MAAM,iBAAA,GAAoB,CAC/B,KAAA,KACsB;AACtB,EAAA,MAAM,EAAE,cAAA,EAAgB,0BAAA,EAA4B,sBAAA,KAClD,aAAA,EAAc;AAIhB,EAAA,MAAM,iBAAA,GAAkC;AAAA,IACtC,KAAA,EAAO;AAAA,MACL,WAAW,eAAA,CAAgB,KAAA;AAAA,MAC3B,QAAA,EAAU,CAAC,KAAA,CAAM,UAAA;AAAA,MACjB,UAAA,EAAY,CAAC,CAAC,KAAA,CAAM;AAAA,KACtB;AAAA,IACA,gBAAA,EAAkB;AAAA,MAChB,WAAW,eAAA,CAAgB;AAAA,KAC7B;AAAA,IACA,GAAG;AAAA,GACL;AAIA,EAAA,MAAM,8BAAA,GAAiC,sBACrC,GAAA,CAAC,oBAAA,EAAA,EAAqB,OAAO,0BAAA,EAC3B,QAAA,kBAAA,GAAA,CAAC,kBAAe,CAAA,EAClB,CAAA;AAGF,EAAA,OAAO;AAAA,IACL,sBAAA;AAAA,IACA,cAAA,EAAgB,8BAAA;AAAA,IAChB,iBAAA;AAAA,IACA,UAAA,EAAY;AAAA,MACV,SAAA,EAAW,IAAA,CAAK,eAAA,CAAgB,SAAS;AAAA;AAC3C,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useFieldComponent.mjs","sources":["../../../../../../src/lib/hooks/useFieldComponent.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { type PropsContext } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { useFieldError } from \"@/lib/hooks/useFieldError\";\nimport clsx, { type ClassValue } from \"clsx\";\n\ninterface FieldComponentProps {\n className?: ClassValue;\n isRequired?: boolean;\n isDisabled?: boolean;\n}\n\nexport interface UseFieldComponent {\n FieldErrorCaptureContext: FC<PropsWithChildren>;\n FieldErrorView: FC;\n fieldPropsContext: PropsContext;\n fieldProps: {\n className?: ReturnType<typeof clsx>;\n };\n}\n\nexport const useFieldComponent = (\n props: FieldComponentProps,\n): UseFieldComponent => {\n const { FieldErrorView, FieldErrorCaptureContext } = useFieldError();\n\n // setting up the props context for all components that\n // are part of a form control\n const fieldPropsContext: PropsContext = {\n Label: {\n className: formFieldStyles.label,\n optional: !props.isRequired,\n isDisabled: !!props.isDisabled,\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n },\n };\n\n return {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps: {\n className: clsx(formFieldStyles.formField),\n },\n } as const;\n};\n"],"names":[],"mappings":";;;;;;AAqBO,MAAM,iBAAA,GAAoB,CAC/B,KAAA,KACsB;AACtB,EAAA,MAAM,EAAE,cAAA,EAAgB,wBAAA,EAAyB,GAAI,aAAA,EAAc;AAInE,EAAA,MAAM,iBAAA,GAAkC;AAAA,IACtC,KAAA,EAAO;AAAA,MACL,WAAW,eAAA,CAAgB,KAAA;AAAA,MAC3B,QAAA,EAAU,CAAC,KAAA,CAAM,UAAA;AAAA,MACjB,UAAA,EAAY,CAAC,CAAC,KAAA,CAAM;AAAA,KACtB;AAAA,IACA,gBAAA,EAAkB;AAAA,MAChB,WAAW,eAAA,CAAgB;AAAA;AAC7B,GACF;AAEA,EAAA,OAAO;AAAA,IACL,cAAA;AAAA,IACA,wBAAA;AAAA,IACA,iBAAA;AAAA,IACA,UAAA,EAAY;AAAA,MACV,SAAA,EAAW,IAAA,CAAK,eAAA,CAAgB,SAAS;AAAA;AAC3C,GACF;AACF;;;;"}
@@ -1,41 +1,152 @@
1
1
  "use client"
2
2
  /* */
3
3
  import { jsx } from 'react/jsx-runtime';
4
- import React, { memo, useId, useContext } from 'react';
4
+ import React, { useId, useMemo } from 'react';
5
5
  import '../propsContext/propsContext.mjs';
6
- import '../propsContext/components/PropsContextProvider.mjs';
6
+ import { PropsContextProvider } from '../propsContext/components/PropsContextProvider.mjs';
7
7
  import formFieldStyles from '../../components/FormField/FormField.module.scss.mjs';
8
- import { FieldErrorContext } from 'react-aria-components';
9
- import { FieldError } from '../../components/FieldError/FieldError.mjs';
10
8
  import { TunnelExit } from '@mittwald/react-tunnel';
11
9
  import { ClearPropsContext } from '../propsContext/components/ClearPropsContext.mjs';
10
+ import '../../components/AccentBox/AccentBox.mjs';
11
+ import 'clsx';
12
+ import '../../components/Button/Button.mjs';
13
+ import '@tabler/icons-react';
14
+ import '../../components/Icon/Icon.mjs';
15
+ import '../../views/IconView.mjs';
16
+ import '../../components/SuspenseTrigger/SuspenseTrigger.mjs';
17
+ import 'react-aria';
18
+ import '../../components/Action/Action.mjs';
19
+ import '@react-aria/live-announcer';
20
+ import '../../components/ActionGroup/ActionGroup.mjs';
21
+ import '../../components/Alert/Alert.mjs';
22
+ import '../../components/AlertBadge/AlertBadge.mjs';
23
+ import '../../components/Align/Align.mjs';
24
+ import '../../components/Autocomplete/Autocomplete.mjs';
25
+ import '../../components/Avatar/Avatar.mjs';
26
+ import '../../components/Badge/Badge.mjs';
27
+ import 'react-aria-components';
28
+ import 'mobx';
29
+ import '../controller/overlay/context.mjs';
30
+ import { useProps } from './useProps.mjs';
31
+ import 'recharts';
32
+ import '../../components/Heading/Heading.mjs';
33
+ import '../../components/Text/Text.mjs';
34
+ import '../../components/Checkbox/Checkbox.mjs';
35
+ import '../../components/CheckboxButton/CheckboxButton.mjs';
36
+ import '../../components/CheckboxGroup/CheckboxGroup.mjs';
37
+ import 'react-syntax-highlighter';
38
+ import '../../components/CopyButton/CopyButton.mjs';
39
+ import '../../components/ColumnLayout/ColumnLayout.mjs';
40
+ import '../../components/ComboBox/ComboBox.mjs';
41
+ import '../propsContext/components/ComponentPropsContextProvider.mjs';
42
+ import '../../components/Content/Content.mjs';
43
+ import '../../components/ContextMenu/ContextMenu.mjs';
44
+ import '../../components/MenuItem/MenuItem.mjs';
45
+ import '../../components/ContextMenu/components/ContextMenuTrigger/ContextMenuTrigger.mjs';
46
+ import '../../components/ContextMenu/components/ContextMenuSection/ContextMenuSection.mjs';
47
+ import '../../components/ContextualHelp/ContextualHelp.mjs';
48
+ import '../../components/ContextualHelp/components/ContextualHelpTrigger/ContextualHelpTrigger.mjs';
49
+ import '../../components/CounterBadge/CounterBadge.mjs';
50
+ import '../../components/CountryOptions/CountryOptions.mjs';
51
+ import '../../components/DatePicker/DatePicker.mjs';
52
+ import '../../components/DateRangePicker/DateRangePicker.mjs';
53
+ import '../../components/FieldDescription/FieldDescription.mjs';
54
+ import '../../components/FieldError/FieldError.mjs';
55
+ import '../../components/FileCard/FileCard.mjs';
56
+ import '../../components/FileCardList/FileCardList.mjs';
57
+ import '../../components/FileDropZone/FileDropZone.mjs';
58
+ import '../../components/FileField/FileField.mjs';
59
+ import '../../components/Header/Header.mjs';
60
+ import '../../components/Image/Image.mjs';
61
+ import '../../components/Initials/Initials.mjs';
62
+ import '../../components/Label/Label.mjs';
63
+ import '../../components/LayoutCard/LayoutCard.mjs';
64
+ import '../../components/OverlayTrigger/components/MenuTrigger/MenuTrigger.mjs';
65
+ import '../../views/DialogTriggerView.mjs';
66
+ import '../../components/LightBox/LightBox.mjs';
67
+ import '../../components/Link/Link.mjs';
68
+ import 'invariant';
69
+ import '../../views/ListItemViewContentView.mjs';
70
+ import '../../views/ButtonView.mjs';
71
+ import '../../views/ContextMenuTriggerView.mjs';
72
+ import '../../components/List/components/ListSummary/ListSummary.mjs';
73
+ import '../../components/List/listContext.mjs';
74
+ import '../../components/List/List.mjs';
75
+ import 'react-markdown';
76
+ import 'remeda';
77
+ import 'remark-gfm';
78
+ import '../../components/MarkdownEditor/MarkdownEditor.mjs';
79
+ import '../../components/Message/Message.mjs';
80
+ import '../../components/MessageThread/MessageThread.mjs';
81
+ import '../../components/Modal/Modal.mjs';
82
+ import '../../components/Navigation/Navigation.mjs';
83
+ import '../../components/Navigation/components/NavigationGroup/NavigationGroup.mjs';
84
+ import '../../components/NotificationProvider/NotificationProvider.mjs';
85
+ import 'luxon';
86
+ import '../../components/NumberField/NumberField.mjs';
87
+ import '../../components/Option/Option.mjs';
88
+ import '../../views/OverlayContentView.mjs';
89
+ import '../../views/ClearPropsContextView.mjs';
90
+ import '../../views/LoadingSpinnerView.mjs';
91
+ import '../../components/PasswordCreationField/PasswordCreationField.mjs';
92
+ import '../../components/Popover/components/PopoverTrigger/PopoverTrigger.mjs';
93
+ import '../../components/Popover/Popover.mjs';
94
+ import '../../components/ProgressBar/ProgressBar.mjs';
95
+ import '../../components/RadioGroup/RadioGroup.mjs';
96
+ import '../../components/RadioGroup/components/Radio/Radio.mjs';
97
+ import '../../components/RadioGroup/components/RadioButton/RadioButton.mjs';
98
+ import '../../components/SearchField/SearchField.mjs';
99
+ import '../../components/Section/Section.mjs';
100
+ import '../../components/SegmentedControl/SegmentedControl.mjs';
101
+ import '../../components/SegmentedControl/components/Segment/Segment.mjs';
102
+ import '../../components/Select/Select.mjs';
103
+ import '../../components/SettingsProvider/SettingsProvider.mjs';
104
+ import '../../components/Slider/Slider.mjs';
105
+ import '../../components/Switch/Switch.mjs';
106
+ import '../../components/Tabs/Tabs.mjs';
107
+ import '../../components/Tabs/components/Tab/context.mjs';
108
+ import '../../components/TextArea/TextArea.mjs';
109
+ import '../../components/TextField/TextField.mjs';
110
+ import '../../components/TimeField/TimeField.mjs';
111
+ import '../../components/TranslationProvider/TranslationProvider.mjs';
12
112
 
13
- const FieldErrorResetContext = memo((props) => /* @__PURE__ */ jsx(FieldErrorContext, { value: null, children: props.children }));
14
- const useFieldError = () => {
113
+ const useFieldError = (tunnelIdFromProps) => {
15
114
  const id = useId();
16
- const tunnelId = `${id}.fieldError`;
17
- const currentOuterErrorContext = useContext(FieldErrorContext);
18
- const fieldErrorViewPropsContext = {
115
+ const currentTunnelId = useProps("FieldError", {}).tunnelId;
116
+ const tunnelId = currentTunnelId ?? `${id}.fieldError`;
117
+ const fieldErrorCapturePropsContext = {
19
118
  FieldError: {
119
+ ___inherit: "preserve",
20
120
  tunnelId,
21
121
  className: formFieldStyles.fieldError
22
122
  }
23
123
  };
24
- const FieldErrorView = () => /* @__PURE__ */ jsx(TunnelExit, { id: tunnelId, children: (children) => {
25
- const currentInnerErrorContext = useContext(FieldErrorContext);
26
- const errorContext = currentOuterErrorContext ?? currentInnerErrorContext;
27
- if (React.Children.count(children) >= 1) {
28
- return /* @__PURE__ */ jsx(ClearPropsContext, { children });
29
- }
30
- if (errorContext?.isInvalid && errorContext.validationErrors.length === 0) {
124
+ const FieldErrorCaptureContext = useMemo(
125
+ () => (props) => {
126
+ return /* @__PURE__ */ jsx(
127
+ PropsContextProvider,
128
+ {
129
+ levelMode: "keep",
130
+ props: fieldErrorCapturePropsContext,
131
+ dependencies: [tunnelId],
132
+ children: props.children
133
+ }
134
+ );
135
+ },
136
+ [tunnelId]
137
+ );
138
+ const FieldErrorView = () => {
139
+ if (currentTunnelId) {
31
140
  return null;
32
141
  }
33
- return /* @__PURE__ */ jsx(ClearPropsContext, { children: /* @__PURE__ */ jsx(FieldErrorContext, { value: errorContext, children: /* @__PURE__ */ jsx(FieldError, { className: formFieldStyles.fieldError }) }) });
34
- } });
142
+ return /* @__PURE__ */ jsx(TunnelExit, { id: tunnelId, children: (children) => {
143
+ const childrenArray = React.Children.toArray(children);
144
+ return /* @__PURE__ */ jsx(ClearPropsContext, { children: childrenArray[0] });
145
+ } });
146
+ };
35
147
  return {
36
- fieldErrorViewPropsContext,
37
- FieldErrorView,
38
- FieldErrorResetContext
148
+ FieldErrorCaptureContext,
149
+ FieldErrorView
39
150
  };
40
151
  };
41
152
 
@@ -1 +1 @@
1
- {"version":3,"file":"useFieldError.mjs","sources":["../../../../../../src/lib/hooks/useFieldError.tsx"],"sourcesContent":["import React, {\n type FC,\n type PropsWithChildren,\n memo,\n useContext,\n useId,\n type ReactNode,\n} from \"react\";\nimport { type PropsContext } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { FieldErrorContext } from \"react-aria-components\";\nimport { FieldError } from \"@/components/FieldError\";\nimport { TunnelExit } from \"@mittwald/react-tunnel\";\nimport ClearPropsContext from \"@/lib/propsContext/components/ClearPropsContext\";\n\nconst FieldErrorResetContext: FC<PropsWithChildren> = memo((props) => (\n <FieldErrorContext value={null}>{props.children}</FieldErrorContext>\n));\n\nexport const useFieldError = () => {\n const id = useId();\n const tunnelId = `${id}.fieldError`;\n const currentOuterErrorContext = useContext(FieldErrorContext);\n\n const fieldErrorViewPropsContext: PropsContext = {\n FieldError: {\n tunnelId,\n className: formFieldStyles.fieldError,\n },\n };\n\n const FieldErrorView = () => (\n <TunnelExit id={tunnelId}>\n {(children: ReactNode) => {\n const currentInnerErrorContext = useContext(FieldErrorContext);\n\n const errorContext =\n currentOuterErrorContext ?? currentInnerErrorContext;\n\n if (React.Children.count(children) >= 1) {\n return <ClearPropsContext>{children}</ClearPropsContext>;\n }\n\n if (\n errorContext?.isInvalid &&\n errorContext.validationErrors.length === 0\n ) {\n return null;\n }\n\n return (\n <ClearPropsContext>\n <FieldErrorContext value={errorContext}>\n <FieldError className={formFieldStyles.fieldError} />\n </FieldErrorContext>\n </ClearPropsContext>\n );\n }}\n </TunnelExit>\n );\n\n return {\n fieldErrorViewPropsContext,\n FieldErrorView,\n FieldErrorResetContext,\n } as const;\n};\n"],"names":[],"mappings":";;;;;;;;;;AAeA,MAAM,sBAAA,GAAgD,IAAA,CAAK,CAAC,KAAA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mjs","sources":["../../../../../../src/lib/hooks/useFieldError.tsx"],"sourcesContent":["import React, { type FC, type PropsWithChildren, useId, useMemo } from \"react\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { TunnelExit } from \"@mittwald/react-tunnel\";\nimport ClearPropsContext from \"@/lib/propsContext/components/ClearPropsContext\";\nimport { useProps } from \"@/index/default\";\n\nexport const useFieldError = (tunnelIdFromProps?: string) => {\n const id = useId();\n const currentTunnelId = useProps(\"FieldError\", {}).tunnelId;\n const tunnelId = tunnelIdFromProps ?? currentTunnelId ?? `${id}.fieldError`;\n\n const fieldErrorCapturePropsContext: PropsContext = {\n FieldError: {\n ___inherit: \"preserve\",\n tunnelId,\n className: formFieldStyles.fieldError,\n },\n };\n\n const FieldErrorCaptureContext: FC<PropsWithChildren> = useMemo(\n () => (props) => {\n return (\n <PropsContextProvider\n levelMode=\"keep\"\n props={fieldErrorCapturePropsContext}\n dependencies={[tunnelId]}\n >\n {props.children}\n </PropsContextProvider>\n );\n },\n [tunnelId],\n );\n\n const FieldErrorView = () => {\n if (currentTunnelId) {\n return null;\n }\n\n return (\n <TunnelExit id={tunnelId}>\n {(children) => {\n const childrenArray = React.Children.toArray(children);\n return <ClearPropsContext>{childrenArray[0]}</ClearPropsContext>;\n }}\n </TunnelExit>\n );\n };\n\n return {\n FieldErrorCaptureContext,\n FieldErrorView,\n } as const;\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,MAAM,aAAA,GAAgB,CAAC,iBAAA,KAA+B;AAC3D,EAAA,MAAM,KAAK,KAAA,EAAM;AACjB,EAAA,MAAM,eAAA,GAAkB,QAAA,CAAS,YAAA,EAAc,EAAE,CAAA,CAAE,QAAA;AACnD,EAAA,MAAM,QAAA,GAAgC,eAAA,IAAmB,CAAA,EAAG,EAAE,CAAA,WAAA,CAAA;AAE9D,EAAA,MAAM,6BAAA,GAA8C;AAAA,IAClD,UAAA,EAAY;AAAA,MACV,UAAA,EAAY,UAAA;AAAA,MACZ,QAAA;AAAA,MACA,WAAW,eAAA,CAAgB;AAAA;AAC7B,GACF;AAEA,EAAA,MAAM,wBAAA,GAAkD,OAAA;AAAA,IACtD,MAAM,CAAC,KAAA,KAAU;AACf,MAAA,uBACE,GAAA;AAAA,QAAC,oBAAA;AAAA,QAAA;AAAA,UACC,SAAA,EAAU,MAAA;AAAA,UACV,KAAA,EAAO,6BAAA;AAAA,UACP,YAAA,EAAc,CAAC,QAAQ,CAAA;AAAA,UAEtB,QAAA,EAAA,KAAA,CAAM;AAAA;AAAA,OACT;AAAA,IAEJ,CAAA;AAAA,IACA,CAAC,QAAQ;AAAA,GACX;AAEA,EAAA,MAAM,iBAAiB,MAAM;AAC3B,IAAA,IAAI,eAAA,EAAiB;AACnB,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,uBACE,GAAA,CAAC,UAAA,EAAA,EAAW,EAAA,EAAI,QAAA,EACb,WAAC,QAAA,KAAa;AACb,MAAA,MAAM,aAAA,GAAgB,KAAA,CAAM,QAAA,CAAS,OAAA,CAAQ,QAAQ,CAAA;AACrD,MAAA,uBAAO,GAAA,CAAC,iBAAA,EAAA,EAAmB,QAAA,EAAA,aAAA,CAAc,CAAC,CAAA,EAAE,CAAA;AAAA,IAC9C,CAAA,EACF,CAAA;AAAA,EAEJ,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,wBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
@@ -6,6 +6,7 @@ import { PropsContextLevelProvider } from '../inherit/PropsContextLevelProvider.
6
6
  import { mergePropsContext } from '../mergePropsContext.mjs';
7
7
  import { propsContext, usePropsContext } from '../propsContext.mjs';
8
8
  import { memo, useMemo } from 'react';
9
+ import { filterPreservedInheritEntries } from '../inherit/lib.mjs';
9
10
 
10
11
  const Provider = memo(propsContext.Provider);
11
12
  Provider.displayName = "PropsContextProviderInner";
@@ -23,7 +24,7 @@ const PropsContextProvider = memo((props) => {
23
24
  );
24
25
  const propsWithParentPropsContext = useMemo(
25
26
  () => mergePropsContext(
26
- clear ? void 0 : parentPropsContext,
27
+ clear ? filterPreservedInheritEntries(parentPropsContext) : parentPropsContext,
27
28
  providedProps,
28
29
  readPropsContextLevel
29
30
  ),
@@ -1 +1 @@
1
- {"version":3,"file":"PropsContextProvider.mjs","sources":["../../../../../../../src/lib/propsContext/components/PropsContextProvider.tsx"],"sourcesContent":["import { usePropsContextLevel } from \"@/lib/propsContext/inherit/propsContextLevel\";\nimport { PropsContextLevelProvider } from \"@/lib/propsContext/inherit/PropsContextLevelProvider\";\nimport type { PropsContextLevelMode } from \"@/lib/propsContext/inherit/types\";\nimport mergePropsContext from \"@/lib/propsContext/mergePropsContext\";\nimport { propsContext, usePropsContext } from \"@/lib/propsContext/propsContext\";\nimport type { PropsContext as PropsContextShape } from \"@/lib/propsContext/types\";\nimport type { DependencyList, FC, PropsWithChildren } from \"react\";\nimport { memo, useMemo } from \"react\";\n\ninterface Props extends PropsWithChildren {\n props: PropsContextShape;\n dependencies?: DependencyList;\n clear?: boolean;\n levelMode?: PropsContextLevelMode;\n}\n\nconst Provider = memo(propsContext.Provider);\nProvider.displayName = \"PropsContextProviderInner\";\n\nexport const PropsContextProvider: FC<Props> = memo((props) => {\n const {\n props: providedProps,\n dependencies = [],\n levelMode = \"reset\",\n children,\n clear = false,\n } = props;\n\n const parentPropsContext = usePropsContext();\n\n const readPropsContextLevel = usePropsContextLevel(\n levelMode === \"keep\" ? \"decrement\" : levelMode,\n );\n\n const propsWithParentPropsContext = useMemo(\n () =>\n mergePropsContext(\n clear ? undefined : parentPropsContext,\n providedProps,\n readPropsContextLevel,\n ),\n [parentPropsContext, clear, readPropsContextLevel, ...dependencies],\n );\n\n return (\n <PropsContextLevelProvider mode={levelMode}>\n <Provider value={propsWithParentPropsContext}>{children}</Provider>\n </PropsContextLevelProvider>\n );\n});\n\nPropsContextProvider.displayName = \"PropsContextProvider\";\n\nexport default PropsContextProvider;\n"],"names":[],"mappings":";;;;;;;AAgBA,MAAM,QAAA,GAAW,IAAA,CAAK,YAAA,CAAa,QAAQ,CAAA;AAC3C,QAAA,CAAS,WAAA,GAAc,2BAAA;AAEhB,MAAM,oBAAA,GAAkC,IAAA,CAAK,CAAC,KAAA,KAAU;AAC7D,EAAA,MAAM;AAAA,IACJ,KAAA,EAAO,aAAA;AAAA,IACP,eAAe,EAAC;AAAA,IAChB,SAAA,GAAY,OAAA;AAAA,IACZ,QAAA;AAAA,IACA,KAAA,GAAQ;AAAA,GACV,GAAI,KAAA;AAEJ,EAAA,MAAM,qBAAqB,eAAA,EAAgB;AAE3C,EAAA,MAAM,qBAAA,GAAwB,oBAAA;AAAA,IAC5B,SAAA,KAAc,SAAS,WAAA,GAAc;AAAA,GACvC;AAEA,EAAA,MAAM,2BAAA,GAA8B,OAAA;AAAA,IAClC,MACE,iBAAA;AAAA,MACE,QAAQ,MAAA,GAAY,kBAAA;AAAA,MACpB,aAAA;AAAA,MACA;AAAA,KACF;AAAA,IACF,CAAC,kBAAA,EAAoB,KAAA,EAAO,qBAAA,EAAuB,GAAG,YAAY;AAAA,GACpE;AAEA,EAAA,uBACE,GAAA,CAAC,6BAA0B,IAAA,EAAM,SAAA,EAC/B,8BAAC,QAAA,EAAA,EAAS,KAAA,EAAO,2BAAA,EAA8B,QAAA,EAAS,CAAA,EAC1D,CAAA;AAEJ,CAAC;AAED,oBAAA,CAAqB,WAAA,GAAc,sBAAA;;;;"}
1
+ {"version":3,"file":"PropsContextProvider.mjs","sources":["../../../../../../../src/lib/propsContext/components/PropsContextProvider.tsx"],"sourcesContent":["import { usePropsContextLevel } from \"@/lib/propsContext/inherit/propsContextLevel\";\nimport { PropsContextLevelProvider } from \"@/lib/propsContext/inherit/PropsContextLevelProvider\";\nimport type { PropsContextLevelMode } from \"@/lib/propsContext/inherit/types\";\nimport mergePropsContext from \"@/lib/propsContext/mergePropsContext\";\nimport { propsContext, usePropsContext } from \"@/lib/propsContext/propsContext\";\nimport type { PropsContext as PropsContextShape } from \"@/lib/propsContext/types\";\nimport type { DependencyList, FC, PropsWithChildren } from \"react\";\nimport { memo, useMemo } from \"react\";\nimport { filterPreservedInheritEntries } from \"@/lib/propsContext/inherit/lib\";\n\ninterface Props extends PropsWithChildren {\n props: PropsContextShape;\n dependencies?: DependencyList;\n clear?: boolean;\n levelMode?: PropsContextLevelMode;\n}\n\nconst Provider = memo(propsContext.Provider);\nProvider.displayName = \"PropsContextProviderInner\";\n\nexport const PropsContextProvider: FC<Props> = memo((props) => {\n const {\n props: providedProps,\n dependencies = [],\n levelMode = \"reset\",\n children,\n clear = false,\n } = props;\n\n const parentPropsContext = usePropsContext();\n\n const readPropsContextLevel = usePropsContextLevel(\n levelMode === \"keep\" ? \"decrement\" : levelMode,\n );\n\n const propsWithParentPropsContext = useMemo(\n () =>\n mergePropsContext(\n clear\n ? filterPreservedInheritEntries(parentPropsContext)\n : parentPropsContext,\n providedProps,\n readPropsContextLevel,\n ),\n [parentPropsContext, clear, readPropsContextLevel, ...dependencies],\n );\n\n return (\n <PropsContextLevelProvider mode={levelMode}>\n <Provider value={propsWithParentPropsContext}>{children}</Provider>\n </PropsContextLevelProvider>\n );\n});\n\nPropsContextProvider.displayName = \"PropsContextProvider\";\n\nexport default PropsContextProvider;\n"],"names":[],"mappings":";;;;;;;;AAiBA,MAAM,QAAA,GAAW,IAAA,CAAK,YAAA,CAAa,QAAQ,CAAA;AAC3C,QAAA,CAAS,WAAA,GAAc,2BAAA;AAEhB,MAAM,oBAAA,GAAkC,IAAA,CAAK,CAAC,KAAA,KAAU;AAC7D,EAAA,MAAM;AAAA,IACJ,KAAA,EAAO,aAAA;AAAA,IACP,eAAe,EAAC;AAAA,IAChB,SAAA,GAAY,OAAA;AAAA,IACZ,QAAA;AAAA,IACA,KAAA,GAAQ;AAAA,GACV,GAAI,KAAA;AAEJ,EAAA,MAAM,qBAAqB,eAAA,EAAgB;AAE3C,EAAA,MAAM,qBAAA,GAAwB,oBAAA;AAAA,IAC5B,SAAA,KAAc,SAAS,WAAA,GAAc;AAAA,GACvC;AAEA,EAAA,MAAM,2BAAA,GAA8B,OAAA;AAAA,IAClC,MACE,iBAAA;AAAA,MACE,KAAA,GACI,6BAAA,CAA8B,kBAAkB,CAAA,GAChD,kBAAA;AAAA,MACJ,aAAA;AAAA,MACA;AAAA,KACF;AAAA,IACF,CAAC,kBAAA,EAAoB,KAAA,EAAO,qBAAA,EAAuB,GAAG,YAAY;AAAA,GACpE;AAEA,EAAA,uBACE,GAAA,CAAC,6BAA0B,IAAA,EAAM,SAAA,EAC/B,8BAAC,QAAA,EAAA,EAAS,KAAA,EAAO,2BAAA,EAA8B,QAAA,EAAS,CAAA,EAC1D,CAAA;AAEJ,CAAC;AAED,oBAAA,CAAqB,WAAA,GAAc,sBAAA;;;;"}