@mittwald/flow-react-components 0.2.0-alpha.996 → 0.2.0-alpha.997

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 (169) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/assets/doc-properties.json +2767 -2767
  3. package/dist/js/packages/components/src/components/AccentBox/AccentBox.mjs +2 -1
  4. package/dist/js/packages/components/src/components/AccentBox/AccentBox.mjs.map +1 -1
  5. package/dist/js/packages/components/src/components/Accordion/Accordion.mjs +1 -0
  6. package/dist/js/packages/components/src/components/Accordion/Accordion.mjs.map +1 -1
  7. package/dist/js/packages/components/src/components/Action/Action.mjs +1 -0
  8. package/dist/js/packages/components/src/components/Action/Action.mjs.map +1 -1
  9. package/dist/js/packages/components/src/components/ActionGroup/ActionGroup.mjs +1 -0
  10. package/dist/js/packages/components/src/components/ActionGroup/ActionGroup.mjs.map +1 -1
  11. package/dist/js/packages/components/src/components/Alert/Alert.mjs +1 -0
  12. package/dist/js/packages/components/src/components/Alert/Alert.mjs.map +1 -1
  13. package/dist/js/packages/components/src/components/AlertText/AlertText.mjs +1 -0
  14. package/dist/js/packages/components/src/components/AlertText/AlertText.mjs.map +1 -1
  15. package/dist/js/packages/components/src/components/Align/Align.mjs +1 -0
  16. package/dist/js/packages/components/src/components/Align/Align.mjs.map +1 -1
  17. package/dist/js/packages/components/src/components/Autocomplete/Autocomplete.mjs +1 -0
  18. package/dist/js/packages/components/src/components/Autocomplete/Autocomplete.mjs.map +1 -1
  19. package/dist/js/packages/components/src/components/Avatar/Avatar.mjs +1 -0
  20. package/dist/js/packages/components/src/components/Avatar/Avatar.mjs.map +1 -1
  21. package/dist/js/packages/components/src/components/AvatarStack/AvatarStack.mjs +1 -0
  22. package/dist/js/packages/components/src/components/AvatarStack/AvatarStack.mjs.map +1 -1
  23. package/dist/js/packages/components/src/components/Badge/Badge.mjs +1 -0
  24. package/dist/js/packages/components/src/components/Badge/Badge.mjs.map +1 -1
  25. package/dist/js/packages/components/src/components/BigNumber/BigNumber.mjs +1 -0
  26. package/dist/js/packages/components/src/components/BigNumber/BigNumber.mjs.map +1 -1
  27. package/dist/js/packages/components/src/components/Breadcrumb/Breadcrumb.mjs +1 -0
  28. package/dist/js/packages/components/src/components/Breadcrumb/Breadcrumb.mjs.map +1 -1
  29. package/dist/js/packages/components/src/components/BrowserOnly/BrowserOnly.mjs +1 -0
  30. package/dist/js/packages/components/src/components/BrowserOnly/BrowserOnly.mjs.map +1 -1
  31. package/dist/js/packages/components/src/components/Button/Button.mjs +1 -0
  32. package/dist/js/packages/components/src/components/Button/Button.mjs.map +1 -1
  33. package/dist/js/packages/components/src/components/Chat/Chat.mjs +1 -0
  34. package/dist/js/packages/components/src/components/Chat/Chat.mjs.map +1 -1
  35. package/dist/js/packages/components/src/components/Checkbox/Checkbox.mjs +1 -0
  36. package/dist/js/packages/components/src/components/Checkbox/Checkbox.mjs.map +1 -1
  37. package/dist/js/packages/components/src/components/CheckboxButton/CheckboxButton.mjs +1 -0
  38. package/dist/js/packages/components/src/components/CheckboxButton/CheckboxButton.mjs.map +1 -1
  39. package/dist/js/packages/components/src/components/CheckboxGroup/CheckboxGroup.mjs +1 -0
  40. package/dist/js/packages/components/src/components/CheckboxGroup/CheckboxGroup.mjs.map +1 -1
  41. package/dist/js/packages/components/src/components/CodeEditor/CodeEditor.mjs +1 -0
  42. package/dist/js/packages/components/src/components/CodeEditor/CodeEditor.mjs.map +1 -1
  43. package/dist/js/packages/components/src/components/ColumnLayout/ColumnLayout.mjs +1 -0
  44. package/dist/js/packages/components/src/components/ColumnLayout/ColumnLayout.mjs.map +1 -1
  45. package/dist/js/packages/components/src/components/ComboBox/ComboBox.mjs +1 -0
  46. package/dist/js/packages/components/src/components/ComboBox/ComboBox.mjs.map +1 -1
  47. package/dist/js/packages/components/src/components/ContextMenu/ContextMenu.mjs +1 -0
  48. package/dist/js/packages/components/src/components/ContextMenu/ContextMenu.mjs.map +1 -1
  49. package/dist/js/packages/components/src/components/ContextMenu/components/ContextMenuSection/ContextMenuSection.mjs +1 -0
  50. package/dist/js/packages/components/src/components/ContextMenu/components/ContextMenuSection/ContextMenuSection.mjs.map +1 -1
  51. package/dist/js/packages/components/src/components/ContextualHelp/ContextualHelp.mjs +1 -0
  52. package/dist/js/packages/components/src/components/ContextualHelp/ContextualHelp.mjs.map +1 -1
  53. package/dist/js/packages/components/src/components/ContextualHelp/components/ContextualHelpTrigger/ContextualHelpTrigger.mjs +1 -0
  54. package/dist/js/packages/components/src/components/ContextualHelp/components/ContextualHelpTrigger/ContextualHelpTrigger.mjs.map +1 -1
  55. package/dist/js/packages/components/src/components/DatePicker/DatePicker.mjs +1 -0
  56. package/dist/js/packages/components/src/components/DatePicker/DatePicker.mjs.map +1 -1
  57. package/dist/js/packages/components/src/components/DateRangePicker/DateRangePicker.mjs +1 -0
  58. package/dist/js/packages/components/src/components/DateRangePicker/DateRangePicker.mjs.map +1 -1
  59. package/dist/js/packages/components/src/components/FileCard/FileCard.mjs +1 -0
  60. package/dist/js/packages/components/src/components/FileCard/FileCard.mjs.map +1 -1
  61. package/dist/js/packages/components/src/components/FileCardList/FileCardList.mjs +1 -0
  62. package/dist/js/packages/components/src/components/FileCardList/FileCardList.mjs.map +1 -1
  63. package/dist/js/packages/components/src/components/FileDropZone/FileDropZone.mjs +1 -0
  64. package/dist/js/packages/components/src/components/FileDropZone/FileDropZone.mjs.map +1 -1
  65. package/dist/js/packages/components/src/components/FileField/FileField.mjs +1 -0
  66. package/dist/js/packages/components/src/components/FileField/FileField.mjs.map +1 -1
  67. package/dist/js/packages/components/src/components/FileField/components/FileInput.mjs +1 -0
  68. package/dist/js/packages/components/src/components/FileField/components/FileInput.mjs.map +1 -1
  69. package/dist/js/packages/components/src/components/HeaderNavigation/HeaderNavigation.mjs +1 -0
  70. package/dist/js/packages/components/src/components/HeaderNavigation/HeaderNavigation.mjs.map +1 -1
  71. package/dist/js/packages/components/src/components/Heading/Heading.mjs +1 -0
  72. package/dist/js/packages/components/src/components/Heading/Heading.mjs.map +1 -1
  73. package/dist/js/packages/components/src/components/IllustratedMessage/IllustratedMessage.mjs +1 -0
  74. package/dist/js/packages/components/src/components/IllustratedMessage/IllustratedMessage.mjs.map +1 -1
  75. package/dist/js/packages/components/src/components/Label/Label.mjs +1 -0
  76. package/dist/js/packages/components/src/components/Label/Label.mjs.map +1 -1
  77. package/dist/js/packages/components/src/components/LabeledValue/LabeledValue.mjs +1 -0
  78. package/dist/js/packages/components/src/components/LabeledValue/LabeledValue.mjs.map +1 -1
  79. package/dist/js/packages/components/src/components/LayoutCard/LayoutCard.mjs +1 -0
  80. package/dist/js/packages/components/src/components/LayoutCard/LayoutCard.mjs.map +1 -1
  81. package/dist/js/packages/components/src/components/LightBox/LightBox.mjs +1 -0
  82. package/dist/js/packages/components/src/components/LightBox/LightBox.mjs.map +1 -1
  83. package/dist/js/packages/components/src/components/LightBox/components/LightBoxGalleryItem/LightBoxGalleryItem.mjs +1 -0
  84. package/dist/js/packages/components/src/components/LightBox/components/LightBoxGalleryItem/LightBoxGalleryItem.mjs.map +1 -1
  85. package/dist/js/packages/components/src/components/Link/Link.mjs +1 -0
  86. package/dist/js/packages/components/src/components/Link/Link.mjs.map +1 -1
  87. package/dist/js/packages/components/src/components/List/List.mjs +1 -0
  88. package/dist/js/packages/components/src/components/List/List.mjs.map +1 -1
  89. package/dist/js/packages/components/src/components/List/components/Header/components/SearchField/SearchField.mjs +1 -0
  90. package/dist/js/packages/components/src/components/List/components/Header/components/SearchField/SearchField.mjs.map +1 -1
  91. package/dist/js/packages/components/src/components/List/components/Items/components/Item/hooks/useGridItemProps.mjs +1 -0
  92. package/dist/js/packages/components/src/components/List/components/Items/components/Item/hooks/useGridItemProps.mjs.map +1 -1
  93. package/dist/js/packages/components/src/components/List/components/ListItemView/ListItemView.mjs +1 -0
  94. package/dist/js/packages/components/src/components/List/components/ListItemView/ListItemView.mjs.map +1 -1
  95. package/dist/js/packages/components/src/components/List/components/ListItemView/components/ListItemViewContent/ListItemViewContent.mjs +1 -0
  96. package/dist/js/packages/components/src/components/List/components/ListItemView/components/ListItemViewContent/ListItemViewContent.mjs.map +1 -1
  97. package/dist/js/packages/components/src/components/MenuItem/components/MenuItemContent/MenuItemContent.mjs +1 -0
  98. package/dist/js/packages/components/src/components/MenuItem/components/MenuItemContent/MenuItemContent.mjs.map +1 -1
  99. package/dist/js/packages/components/src/components/Message/Message.mjs +1 -0
  100. package/dist/js/packages/components/src/components/Message/Message.mjs.map +1 -1
  101. package/dist/js/packages/components/src/components/MessageThread/MessageThread.mjs +1 -0
  102. package/dist/js/packages/components/src/components/MessageThread/MessageThread.mjs.map +1 -1
  103. package/dist/js/packages/components/src/components/Modal/Modal.mjs +1 -0
  104. package/dist/js/packages/components/src/components/Modal/Modal.mjs.map +1 -1
  105. package/dist/js/packages/components/src/components/Navigation/Navigation.mjs +1 -0
  106. package/dist/js/packages/components/src/components/Navigation/Navigation.mjs.map +1 -1
  107. package/dist/js/packages/components/src/components/Navigation/components/NavigationGroup/NavigationGroup.mjs +1 -0
  108. package/dist/js/packages/components/src/components/Navigation/components/NavigationGroup/NavigationGroup.mjs.map +1 -1
  109. package/dist/js/packages/components/src/components/Notification/Notification.mjs +1 -0
  110. package/dist/js/packages/components/src/components/Notification/Notification.mjs.map +1 -1
  111. package/dist/js/packages/components/src/components/NumberField/NumberField.mjs +1 -0
  112. package/dist/js/packages/components/src/components/NumberField/NumberField.mjs.map +1 -1
  113. package/dist/js/packages/components/src/components/OverlayTrigger/OverlayTrigger.mjs +1 -0
  114. package/dist/js/packages/components/src/components/OverlayTrigger/OverlayTrigger.mjs.map +1 -1
  115. package/dist/js/packages/components/src/components/PasswordCreationField/PasswordCreationField.mjs +1 -0
  116. package/dist/js/packages/components/src/components/PasswordCreationField/PasswordCreationField.mjs.map +1 -1
  117. package/dist/js/packages/components/src/components/ProgressBar/ProgressBar.mjs +1 -0
  118. package/dist/js/packages/components/src/components/ProgressBar/ProgressBar.mjs.map +1 -1
  119. package/dist/js/packages/components/src/components/RadioGroup/RadioGroup.mjs +1 -0
  120. package/dist/js/packages/components/src/components/RadioGroup/RadioGroup.mjs.map +1 -1
  121. package/dist/js/packages/components/src/components/RadioGroup/components/RadioButton/RadioButton.mjs +1 -0
  122. package/dist/js/packages/components/src/components/RadioGroup/components/RadioButton/RadioButton.mjs.map +1 -1
  123. package/dist/js/packages/components/src/components/Rating/Rating.mjs +1 -0
  124. package/dist/js/packages/components/src/components/Rating/Rating.mjs.map +1 -1
  125. package/dist/js/packages/components/src/components/Rating/components/RatingSegment/EmptySegment.mjs +1 -0
  126. package/dist/js/packages/components/src/components/Rating/components/RatingSegment/EmptySegment.mjs.map +1 -1
  127. package/dist/js/packages/components/src/components/Rating/components/RatingSegment/FilledSegment.mjs +1 -0
  128. package/dist/js/packages/components/src/components/Rating/components/RatingSegment/FilledSegment.mjs.map +1 -1
  129. package/dist/js/packages/components/src/components/SearchField/SearchField.mjs +1 -0
  130. package/dist/js/packages/components/src/components/SearchField/SearchField.mjs.map +1 -1
  131. package/dist/js/packages/components/src/components/Section/Section.mjs +1 -0
  132. package/dist/js/packages/components/src/components/Section/Section.mjs.map +1 -1
  133. package/dist/js/packages/components/src/components/Section/components/SectionHeader/SectionHeader.mjs +1 -0
  134. package/dist/js/packages/components/src/components/Section/components/SectionHeader/SectionHeader.mjs.map +1 -1
  135. package/dist/js/packages/components/src/components/SegmentedControl/SegmentedControl.mjs +1 -0
  136. package/dist/js/packages/components/src/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
  137. package/dist/js/packages/components/src/components/Select/Select.mjs +1 -0
  138. package/dist/js/packages/components/src/components/Select/Select.mjs.map +1 -1
  139. package/dist/js/packages/components/src/components/Slider/Slider.mjs +1 -0
  140. package/dist/js/packages/components/src/components/Slider/Slider.mjs.map +1 -1
  141. package/dist/js/packages/components/src/components/Switch/Switch.mjs +1 -0
  142. package/dist/js/packages/components/src/components/Switch/Switch.mjs.map +1 -1
  143. package/dist/js/packages/components/src/components/TabNavigation/TabNavigation.mjs +1 -0
  144. package/dist/js/packages/components/src/components/TabNavigation/TabNavigation.mjs.map +1 -1
  145. package/dist/js/packages/components/src/components/Table/components/TableColumn/TableColumn.mjs +1 -0
  146. package/dist/js/packages/components/src/components/Table/components/TableColumn/TableColumn.mjs.map +1 -1
  147. package/dist/js/packages/components/src/components/Tabs/components/Tab/Tab.mjs +1 -0
  148. package/dist/js/packages/components/src/components/Tabs/components/Tab/Tab.mjs.map +1 -1
  149. package/dist/js/packages/components/src/components/Text/Text.mjs +1 -0
  150. package/dist/js/packages/components/src/components/Text/Text.mjs.map +1 -1
  151. package/dist/js/packages/components/src/components/TextArea/TextArea.mjs +1 -0
  152. package/dist/js/packages/components/src/components/TextArea/TextArea.mjs.map +1 -1
  153. package/dist/js/packages/components/src/components/TextField/TextField.mjs +1 -0
  154. package/dist/js/packages/components/src/components/TextField/TextField.mjs.map +1 -1
  155. package/dist/js/packages/components/src/components/TimeField/TimeField.mjs +1 -0
  156. package/dist/js/packages/components/src/components/TimeField/TimeField.mjs.map +1 -1
  157. package/dist/js/packages/components/src/integrations/react-hook-form/components/Field/Field.mjs +1 -0
  158. package/dist/js/packages/components/src/integrations/react-hook-form/components/Field/Field.mjs.map +1 -1
  159. package/dist/js/packages/components/src/integrations/react-hook-form/components/FormAction/FormResetAction.mjs +1 -0
  160. package/dist/js/packages/components/src/integrations/react-hook-form/components/FormAction/FormResetAction.mjs.map +1 -1
  161. package/dist/js/packages/components/src/integrations/react-hook-form/components/FormAction/FormSubmitAction.mjs +1 -0
  162. package/dist/js/packages/components/src/integrations/react-hook-form/components/FormAction/FormSubmitAction.mjs.map +1 -1
  163. package/dist/js/packages/components/src/lib/controller/overlay/useModalController.mjs +1 -0
  164. package/dist/js/packages/components/src/lib/controller/overlay/useModalController.mjs.map +1 -1
  165. package/dist/js/packages/components/src/lib/hooks/useFieldComponent.mjs +1 -0
  166. package/dist/js/packages/components/src/lib/hooks/useFieldComponent.mjs.map +1 -1
  167. package/dist/js/packages/components/src/lib/hooks/useFieldError.mjs +1 -0
  168. package/dist/js/packages/components/src/lib/hooks/useFieldError.mjs.map +1 -1
  169. package/package.json +6 -6
@@ -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/FormContextProvider/FormContextProvider\";\nimport {\n dynamic,\n type PropsContext,\n PropsContextProvider,\n} 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 \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport locales from \"./locales/*.locale.json\";\nimport FieldErrorView from \"@/views/FieldErrorView\";\nimport { useUpdateFormDefaultValue } from \"@/integrations/react-hook-form/components/Field/hooks/useUpdateFormDefaultValue\";\n\nexport interface FieldProps<T extends FieldValues>\n extends Omit<ControllerProps<T>, \"render\">, PropsWithChildren {}\n\nexport function Field<T extends FieldValues>(props: FieldProps<T>) {\n const { children, name, defaultValue, ...rest } = props;\n\n const stringFormatter = useLocalizedStringFormatter(\n locales,\n \"ReactHookForm.Field\",\n );\n\n const controller = useController({\n ...props,\n rules: {\n ...props.rules,\n min:\n typeof rest.rules?.min === \"number\"\n ? {\n value: rest.rules.min,\n message: stringFormatter.format(\"validation.min\", {\n number: rest.rules.min,\n }),\n }\n : rest.rules?.min,\n max:\n typeof rest.rules?.max === \"number\"\n ? {\n value: rest.rules.max,\n message: stringFormatter.format(\"validation.max\", {\n number: rest.rules.max,\n }),\n }\n : rest.rules?.max,\n required:\n typeof rest.rules?.required === \"boolean\"\n ? stringFormatter.format(\"validation.required\")\n : rest.rules?.required,\n pattern:\n rest.rules?.pattern instanceof RegExp\n ? {\n value: rest.rules.pattern,\n message: stringFormatter.format(\"validation.pattern\", {\n pattern: rest.rules.pattern.source,\n }),\n }\n : rest.rules?.pattern,\n minLength:\n typeof rest.rules?.minLength === \"number\"\n ? {\n value: rest.rules.minLength,\n message: stringFormatter.format(\"validation.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(\"validation.maxLength\", {\n number: rest.rules.maxLength,\n }),\n }\n : rest.rules?.maxLength,\n },\n });\n const formContext = useFormContext<T>();\n\n useUpdateFormDefaultValue(props, formContext.form);\n\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 ...controller.field,\n value,\n name,\n form: formContext.id,\n isRequired: !!rest.rules?.required,\n isReadOnly: formContext.isReadOnly,\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 propsContext: PropsContext = {\n Autocomplete: {\n SearchField: fieldProps,\n TextField: fieldProps,\n },\n SearchField: fieldProps,\n TextField: fieldProps,\n TextArea: fieldProps,\n MarkdownEditor: fieldProps,\n CodeEditor: 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 ...fieldProps,\n selectedKey: value,\n },\n Rating: fieldProps,\n };\n\n return (\n <PropsContextProvider\n props={propsContext}\n dependencies={[\n controller.fieldState,\n controller.field,\n value,\n formContext.isReadOnly,\n ]}\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":";;;;;;;;;;;AAsBO,SAAS,MAA6B,KAAA,EAAsB;AACjE,EAAA,MAAM,EAAE,QAAA,EAAU,IAAA,EAAM,YAAA,EAAc,GAAG,MAAK,GAAI,KAAA;AAElD,EAAA,MAAM,eAAA,GAAkB,2BAAA;AAAA,IACtB,OAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,MAAM,aAAa,aAAA,CAAc;AAAA,IAC/B,GAAG,KAAA;AAAA,IACH,KAAA,EAAO;AAAA,MACL,GAAG,KAAA,CAAM,KAAA;AAAA,MACT,GAAA,EACE,OAAO,IAAA,CAAK,KAAA,EAAO,QAAQ,QAAA,GACvB;AAAA,QACE,KAAA,EAAO,KAAK,KAAA,CAAM,GAAA;AAAA,QAClB,OAAA,EAAS,eAAA,CAAgB,MAAA,CAAO,gBAAA,EAAkB;AAAA,UAChD,MAAA,EAAQ,KAAK,KAAA,CAAM;AAAA,SACpB;AAAA,OACH,GACA,KAAK,KAAA,EAAO,GAAA;AAAA,MAClB,GAAA,EACE,OAAO,IAAA,CAAK,KAAA,EAAO,QAAQ,QAAA,GACvB;AAAA,QACE,KAAA,EAAO,KAAK,KAAA,CAAM,GAAA;AAAA,QAClB,OAAA,EAAS,eAAA,CAAgB,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,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,UAAA;AAAA,MACH,WAAA,EAAa;AAAA,KACf;AAAA,IACA,MAAA,EAAQ;AAAA,GACV;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAA;AAAA,MACP,YAAA,EAAc;AAAA,QACZ,UAAA,CAAW,UAAA;AAAA,QACX,UAAA,CAAW,KAAA;AAAA,QACX,KAAA;AAAA,QACA,WAAA,CAAY;AAAA,OACd;AAAA,MAEC;AAAA;AAAA,GACH;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/FormContextProvider/FormContextProvider\";\nimport {\n dynamic,\n type PropsContext,\n PropsContextProvider,\n} 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 \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport locales from \"./locales/*.locale.json\";\nimport FieldErrorView from \"@/views/FieldErrorView\";\nimport { useUpdateFormDefaultValue } from \"@/integrations/react-hook-form/components/Field/hooks/useUpdateFormDefaultValue\";\n\nexport interface FieldProps<T extends FieldValues>\n extends Omit<ControllerProps<T>, \"render\">, PropsWithChildren {}\n\nexport function Field<T extends FieldValues>(props: FieldProps<T>) {\n const { children, name, defaultValue, ...rest } = props;\n\n const stringFormatter = useLocalizedStringFormatter(\n locales,\n \"ReactHookForm.Field\",\n );\n\n const controller = useController({\n ...props,\n rules: {\n ...props.rules,\n min:\n typeof rest.rules?.min === \"number\"\n ? {\n value: rest.rules.min,\n message: stringFormatter.format(\"validation.min\", {\n number: rest.rules.min,\n }),\n }\n : rest.rules?.min,\n max:\n typeof rest.rules?.max === \"number\"\n ? {\n value: rest.rules.max,\n message: stringFormatter.format(\"validation.max\", {\n number: rest.rules.max,\n }),\n }\n : rest.rules?.max,\n required:\n typeof rest.rules?.required === \"boolean\"\n ? stringFormatter.format(\"validation.required\")\n : rest.rules?.required,\n pattern:\n rest.rules?.pattern instanceof RegExp\n ? {\n value: rest.rules.pattern,\n message: stringFormatter.format(\"validation.pattern\", {\n pattern: rest.rules.pattern.source,\n }),\n }\n : rest.rules?.pattern,\n minLength:\n typeof rest.rules?.minLength === \"number\"\n ? {\n value: rest.rules.minLength,\n message: stringFormatter.format(\"validation.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(\"validation.maxLength\", {\n number: rest.rules.maxLength,\n }),\n }\n : rest.rules?.maxLength,\n },\n });\n const formContext = useFormContext<T>();\n\n useUpdateFormDefaultValue(props, formContext.form);\n\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 ...controller.field,\n value,\n name,\n form: formContext.id,\n isRequired: !!rest.rules?.required,\n isReadOnly: formContext.isReadOnly,\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 propsContext: PropsContext = {\n Autocomplete: {\n SearchField: fieldProps,\n TextField: fieldProps,\n },\n SearchField: fieldProps,\n TextField: fieldProps,\n TextArea: fieldProps,\n MarkdownEditor: fieldProps,\n CodeEditor: 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 ...fieldProps,\n selectedKey: value,\n },\n Rating: fieldProps,\n };\n\n return (\n <PropsContextProvider\n props={propsContext}\n dependencies={[\n controller.fieldState,\n controller.field,\n value,\n formContext.isReadOnly,\n ]}\n >\n {children}\n </PropsContextProvider>\n );\n}\n\nexport const typedField = <T extends FieldValues>(\n ignoredForm: UseFormReturn<T> | UseFormReturn<T>[\"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AA;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,UAAA;AAAA,MACH,WAAA,EAAa;AAAA,KACf;AAAA,IACA,MAAA,EAAQ;AAAA,GACV;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAA;AAAA,MACP,YAAA,EAAc;AAAA,QACZ,UAAA,CAAW,UAAA;AAAA,QACX,UAAA,CAAW,KAAA;AAAA,QACX,KAAA;AAAA,QACA,WAAA,CAAY;AAAA,OACd;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ;AAEO,MAAM,UAAA,GAAa,CACxB,WAAA,KACoB;;;;"}
@@ -2,6 +2,7 @@
2
2
  /* */
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import { Action } from '../../../../components/Action/Action.mjs';
5
+ import '../../../../lib/propsContext/propsContext.mjs';
5
6
  import { PropsContextProvider } from '../../../../lib/propsContext/components/PropsContextProvider.mjs';
6
7
  import { useFormContext } from '../FormContextProvider/FormContextProvider.mjs';
7
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"FormResetAction.mjs","sources":["../../../../../../../../../src/integrations/react-hook-form/components/FormAction/FormResetAction.tsx"],"sourcesContent":["import Action, { type ActionProps } from \"@/components/Action\";\nimport { useFormContext } from \"@/integrations/react-hook-form/components/FormContextProvider\";\nimport { PropsContextProvider, type PropsContext } from \"@/lib/propsContext\";\nimport type { FC, PropsWithChildren } from \"react\";\n\ntype SupportedActionProps = Pick<ActionProps, \"showFeedback\">;\n\nexport const FormResetAction: FC<PropsWithChildren<SupportedActionProps>> = (\n props,\n) => {\n const { children, ...actionProps } = props;\n\n const { form, isReadOnly, id } = useFormContext();\n\n const propsContext: PropsContext = {\n Button: {\n isReadOnly,\n form: id,\n color: \"secondary\",\n variant: \"soft\",\n type: \"button\",\n },\n };\n\n return (\n <Action onAction={() => form.reset()} {...actionProps}>\n <PropsContextProvider\n props={propsContext}\n dependencies={[isReadOnly, id]}\n >\n {children}\n </PropsContextProvider>\n </Action>\n );\n};\n"],"names":[],"mappings":";;;;;AAOO,MAAM,eAAA,GAA+D,CAC1E,KAAA,KACG;AACH,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,WAAA,EAAY,GAAI,KAAA;AAErC,EAAA,MAAM,EAAE,IAAA,EAAM,UAAA,EAAY,EAAA,KAAO,cAAA,EAAe;AAEhD,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,MAAA,EAAQ;AAAA,MACN,UAAA;AAAA,MACA,IAAA,EAAM,EAAA;AAAA,MACN,KAAA,EAAO,WAAA;AAAA,MACP,OAAA,EAAS,MAAA;AAAA,MACT,IAAA,EAAM;AAAA;AACR,GACF;AAEA,EAAA,uBACE,GAAA,CAAC,UAAO,QAAA,EAAU,MAAM,KAAK,KAAA,EAAM,EAAI,GAAG,WAAA,EACxC,QAAA,kBAAA,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAA;AAAA,MACP,YAAA,EAAc,CAAC,UAAA,EAAY,EAAE,CAAA;AAAA,MAE5B;AAAA;AAAA,GACH,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"FormResetAction.mjs","sources":["../../../../../../../../../src/integrations/react-hook-form/components/FormAction/FormResetAction.tsx"],"sourcesContent":["import Action, { type ActionProps } from \"@/components/Action\";\nimport { useFormContext } from \"@/integrations/react-hook-form/components/FormContextProvider\";\nimport { PropsContextProvider, type PropsContext } from \"@/lib/propsContext\";\nimport type { FC, PropsWithChildren } from \"react\";\n\ntype SupportedActionProps = Pick<ActionProps, \"showFeedback\">;\n\nexport const FormResetAction: FC<PropsWithChildren<SupportedActionProps>> = (\n props,\n) => {\n const { children, ...actionProps } = props;\n\n const { form, isReadOnly, id } = useFormContext();\n\n const propsContext: PropsContext = {\n Button: {\n isReadOnly,\n form: id,\n color: \"secondary\",\n variant: \"soft\",\n type: \"button\",\n },\n };\n\n return (\n <Action onAction={() => form.reset()} {...actionProps}>\n <PropsContextProvider\n props={propsContext}\n dependencies={[isReadOnly, id]}\n >\n {children}\n </PropsContextProvider>\n </Action>\n );\n};\n"],"names":[],"mappings":";;;;;;AAOO,MAAM,eAAA,GAA+D,CAC1E,KAAA,KACG;AACH,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,WAAA,EAAY,GAAI,KAAA;AAErC,EAAA,MAAM,EAAE,IAAA,EAAM,UAAA,EAAY,EAAA,KAAO,cAAA,EAAe;AAEhD,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,MAAA,EAAQ;AAAA,MACN,UAAA;AAAA,MACA,IAAA,EAAM,EAAA;AAAA,MACN,KAAA,EAAO,WAAA;AAAA,MACP,OAAA,EAAS,MAAA;AAAA,MACT,IAAA,EAAM;AAAA;AACR,GACF;AAEA,EAAA,uBACE,GAAA,CAAC,UAAO,QAAA,EAAU,MAAM,KAAK,KAAA,EAAM,EAAI,GAAG,WAAA,EACxC,QAAA,kBAAA,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAA;AAAA,MACP,YAAA,EAAc,CAAC,UAAA,EAAY,EAAE,CAAA;AAAA,MAE5B;AAAA;AAAA,GACH,EACF,CAAA;AAEJ;;;;"}
@@ -4,6 +4,7 @@ import { jsx } from 'react/jsx-runtime';
4
4
  import { Action } from '../../../../components/Action/Action.mjs';
5
5
  import { ActionBatch } from '../../../../components/Action/ActionBatch.mjs';
6
6
  import { useFormSubmitAction } from '../FormContextProvider/useFormSubmitAction.mjs';
7
+ import '../../../../lib/propsContext/propsContext.mjs';
7
8
  import { PropsContextProvider } from '../../../../lib/propsContext/components/PropsContextProvider.mjs';
8
9
  import { useFormContext } from '../FormContextProvider/FormContextProvider.mjs';
9
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"FormSubmitAction.mjs","sources":["../../../../../../../../../src/integrations/react-hook-form/components/FormAction/FormSubmitAction.tsx"],"sourcesContent":["import Action, { ActionBatch, type ActionProps } from \"@/components/Action\";\nimport { useFormContext } from \"@/integrations/react-hook-form/components/FormContextProvider\";\nimport { useFormSubmitAction } from \"@/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction\";\nimport { PropsContextProvider, type PropsContext } from \"@/lib/propsContext\";\nimport type { FC, PropsWithChildren } from \"react\";\n\nconst InnerFormSubmitAction: FC<PropsWithChildren<SupportedActionProps>> = (\n props,\n) => {\n const { children, ...actionProps } = props;\n const { form } = useFormContext();\n const formSubmitAction = useFormSubmitAction(form.formState, actionProps);\n return (\n <Action actionModel={formSubmitAction} {...actionProps}>\n {children}\n </Action>\n );\n};\n\ntype SupportedActionProps = Pick<ActionProps, \"showFeedback\">;\n\nexport const FormSubmitAction: FC<PropsWithChildren<SupportedActionProps>> = (\n props,\n) => {\n const { children, ...actionProps } = props;\n\n const { onAfterSuccessFeedback, isReadOnly, id } = useFormContext();\n\n const propsContext: PropsContext = {\n Button: {\n isReadOnly,\n type: \"submit\",\n form: id,\n },\n };\n\n const innerSubmitAction = (\n <InnerFormSubmitAction {...actionProps}>\n <PropsContextProvider\n props={propsContext}\n dependencies={[isReadOnly, id]}\n >\n {children}\n </PropsContextProvider>\n </InnerFormSubmitAction>\n );\n\n if (onAfterSuccessFeedback) {\n return (\n <Action onAction={onAfterSuccessFeedback}>\n <ActionBatch>{innerSubmitAction}</ActionBatch>\n </Action>\n );\n }\n\n return innerSubmitAction;\n};\n\nexport default FormSubmitAction;\n"],"names":[],"mappings":";;;;;;;AAMA,MAAM,qBAAA,GAAqE,CACzE,KAAA,KACG;AACH,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,WAAA,EAAY,GAAI,KAAA;AACrC,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,cAAA,EAAe;AAChC,EAAA,MAAM,gBAAA,GAAmB,mBAAA,CAAoB,IAAA,CAAK,SAAA,EAAW,WAAW,CAAA;AACxE,EAAA,2BACG,MAAA,EAAA,EAAO,WAAA,EAAa,gBAAA,EAAmB,GAAG,aACxC,QAAA,EACH,CAAA;AAEJ,CAAA;AAIO,MAAM,gBAAA,GAAgE,CAC3E,KAAA,KACG;AACH,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,WAAA,EAAY,GAAI,KAAA;AAErC,EAAA,MAAM,EAAE,sBAAA,EAAwB,UAAA,EAAY,EAAA,KAAO,cAAA,EAAe;AAElE,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,MAAA,EAAQ;AAAA,MACN,UAAA;AAAA,MACA,IAAA,EAAM,QAAA;AAAA,MACN,IAAA,EAAM;AAAA;AACR,GACF;AAEA,EAAA,MAAM,iBAAA,mBACJ,GAAA,CAAC,qBAAA,EAAA,EAAuB,GAAG,WAAA,EACzB,QAAA,kBAAA,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAA;AAAA,MACP,YAAA,EAAc,CAAC,UAAA,EAAY,EAAE,CAAA;AAAA,MAE5B;AAAA;AAAA,GACH,EACF,CAAA;AAGF,EAAA,IAAI,sBAAA,EAAwB;AAC1B,IAAA,2BACG,MAAA,EAAA,EAAO,QAAA,EAAU,wBAChB,QAAA,kBAAA,GAAA,CAAC,WAAA,EAAA,EAAa,6BAAkB,CAAA,EAClC,CAAA;AAAA,EAEJ;AAEA,EAAA,OAAO,iBAAA;AACT;;;;"}
1
+ {"version":3,"file":"FormSubmitAction.mjs","sources":["../../../../../../../../../src/integrations/react-hook-form/components/FormAction/FormSubmitAction.tsx"],"sourcesContent":["import Action, { ActionBatch, type ActionProps } from \"@/components/Action\";\nimport { useFormContext } from \"@/integrations/react-hook-form/components/FormContextProvider\";\nimport { useFormSubmitAction } from \"@/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction\";\nimport { PropsContextProvider, type PropsContext } from \"@/lib/propsContext\";\nimport type { FC, PropsWithChildren } from \"react\";\n\nconst InnerFormSubmitAction: FC<PropsWithChildren<SupportedActionProps>> = (\n props,\n) => {\n const { children, ...actionProps } = props;\n const { form } = useFormContext();\n const formSubmitAction = useFormSubmitAction(form.formState, actionProps);\n return (\n <Action actionModel={formSubmitAction} {...actionProps}>\n {children}\n </Action>\n );\n};\n\ntype SupportedActionProps = Pick<ActionProps, \"showFeedback\">;\n\nexport const FormSubmitAction: FC<PropsWithChildren<SupportedActionProps>> = (\n props,\n) => {\n const { children, ...actionProps } = props;\n\n const { onAfterSuccessFeedback, isReadOnly, id } = useFormContext();\n\n const propsContext: PropsContext = {\n Button: {\n isReadOnly,\n type: \"submit\",\n form: id,\n },\n };\n\n const innerSubmitAction = (\n <InnerFormSubmitAction {...actionProps}>\n <PropsContextProvider\n props={propsContext}\n dependencies={[isReadOnly, id]}\n >\n {children}\n </PropsContextProvider>\n </InnerFormSubmitAction>\n );\n\n if (onAfterSuccessFeedback) {\n return (\n <Action onAction={onAfterSuccessFeedback}>\n <ActionBatch>{innerSubmitAction}</ActionBatch>\n </Action>\n );\n }\n\n return innerSubmitAction;\n};\n\nexport default FormSubmitAction;\n"],"names":[],"mappings":";;;;;;;;AAMA,MAAM,qBAAA,GAAqE,CACzE,KAAA,KACG;AACH,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,WAAA,EAAY,GAAI,KAAA;AACrC,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,cAAA,EAAe;AAChC,EAAA,MAAM,gBAAA,GAAmB,mBAAA,CAAoB,IAAA,CAAK,SAAA,EAAW,WAAW,CAAA;AACxE,EAAA,2BACG,MAAA,EAAA,EAAO,WAAA,EAAa,gBAAA,EAAmB,GAAG,aACxC,QAAA,EACH,CAAA;AAEJ,CAAA;AAIO,MAAM,gBAAA,GAAgE,CAC3E,KAAA,KACG;AACH,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,WAAA,EAAY,GAAI,KAAA;AAErC,EAAA,MAAM,EAAE,sBAAA,EAAwB,UAAA,EAAY,EAAA,KAAO,cAAA,EAAe;AAElE,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,MAAA,EAAQ;AAAA,MACN,UAAA;AAAA,MACA,IAAA,EAAM,QAAA;AAAA,MACN,IAAA,EAAM;AAAA;AACR,GACF;AAEA,EAAA,MAAM,iBAAA,mBACJ,GAAA,CAAC,qBAAA,EAAA,EAAuB,GAAG,WAAA,EACzB,QAAA,kBAAA,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAA;AAAA,MACP,YAAA,EAAc,CAAC,UAAA,EAAY,EAAE,CAAA;AAAA,MAE5B;AAAA;AAAA,GACH,EACF,CAAA;AAGF,EAAA,IAAI,sBAAA,EAAwB;AAC1B,IAAA,2BACG,MAAA,EAAA,EAAO,QAAA,EAAU,wBAChB,QAAA,kBAAA,GAAA,CAAC,WAAA,EAAA,EAAa,6BAAkB,CAAA,EAClC,CAAA;AAAA,EAEJ;AAEA,EAAA,OAAO,iBAAA;AACT;;;;"}
@@ -1,6 +1,7 @@
1
1
  "use client"
2
2
  /* */
3
3
  import 'react';
4
+ import '../../propsContext/propsContext.mjs';
4
5
  import 'remeda';
5
6
  import '@react-aria/utils';
6
7
  import 'dot-prop';
@@ -1 +1 @@
1
- {"version":3,"file":"useModalController.mjs","sources":["../../../../../../../../src/lib/controller/overlay/useModalController.ts"],"sourcesContent":["import { useOverlayController } from \"@/lib/hooks\";\n\ntype UseModalControllerArgs = Parameters<typeof useOverlayController>;\n\nexport const useModalController = (options?: UseModalControllerArgs[1]) =>\n useOverlayController(\"Modal\", options);\n"],"names":[],"mappings":";;;;;;AAIO,MAAM,kBAAA,GAAqB,CAAC,OAAA,KACjC,oBAAA,CAAqB,SAAS,OAAO;;;;"}
1
+ {"version":3,"file":"useModalController.mjs","sources":["../../../../../../../../src/lib/controller/overlay/useModalController.ts"],"sourcesContent":["import { useOverlayController } from \"@/lib/hooks\";\n\ntype UseModalControllerArgs = Parameters<typeof useOverlayController>;\n\nexport const useModalController = (options?: UseModalControllerArgs[1]) =>\n useOverlayController(\"Modal\", options);\n"],"names":[],"mappings":";;;;;;;AAIO,MAAM,kBAAA,GAAqB,CAAC,OAAA,KACjC,oBAAA,CAAqB,SAAS,OAAO;;;;"}
@@ -1,6 +1,7 @@
1
1
  "use client"
2
2
  /* */
3
3
  import { useId } from 'react';
4
+ import '../propsContext/propsContext.mjs';
4
5
  import formFieldStyles from '../../components/FormField/FormField.module.scss.mjs';
5
6
  import { useFieldError } from './useFieldError.mjs';
6
7
  import clsx from 'clsx';
@@ -1 +1 @@
1
- {"version":3,"file":"useFieldComponent.mjs","sources":["../../../../../../../src/lib/hooks/useFieldComponent.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, useId } 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\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\n\ninterface FieldComponentProps {\n className?: ClassValue;\n isRequired?: boolean;\n isDisabled?: boolean;\n isInvalid?: boolean;\n \"aria-describedby\"?: string;\n}\n\nexport interface UseFieldComponent {\n FieldErrorCaptureContext: FC<PropsWithChildren>;\n FieldErrorView: FC;\n fieldPropsContext: PropsContext;\n fieldProps: {\n \"aria-describedby\"?: string;\n className?: ReturnType<typeof clsx>;\n };\n}\n\nexport const useFieldComponent = (\n props: FieldComponentProps,\n component: FlowComponentName,\n): UseFieldComponent => {\n const fieldErrorId = useId();\n const { FieldErrorView, FieldErrorCaptureContext } = useFieldError({\n fieldErrorId,\n component,\n });\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 \"aria-describedby\": props.isInvalid\n ? fieldErrorId\n : props[\"aria-describedby\"],\n className: clsx(formFieldStyles.formField),\n },\n } as const;\n};\n"],"names":[],"mappings":";;;;;AAyBO,MAAM,iBAAA,GAAoB,CAC/B,KAAA,EACA,SAAA,KACsB;AACtB,EAAA,MAAM,eAAe,KAAA,EAAM;AAC3B,EAAA,MAAM,EAAE,cAAA,EAAgB,wBAAA,EAAyB,GAAI,aAAA,CAAc;AAAA,IACjE,YAAA;AAAA,IACA;AAAA,GACD,CAAA;AAID,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,kBAAA,EAAoB,KAAA,CAAM,SAAA,GACtB,YAAA,GACA,MAAM,kBAAkB,CAAA;AAAA,MAC5B,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, type PropsWithChildren, useId } 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\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\n\ninterface FieldComponentProps {\n className?: ClassValue;\n isRequired?: boolean;\n isDisabled?: boolean;\n isInvalid?: boolean;\n \"aria-describedby\"?: string;\n}\n\nexport interface UseFieldComponent {\n FieldErrorCaptureContext: FC<PropsWithChildren>;\n FieldErrorView: FC;\n fieldPropsContext: PropsContext;\n fieldProps: {\n \"aria-describedby\"?: string;\n className?: ReturnType<typeof clsx>;\n };\n}\n\nexport const useFieldComponent = (\n props: FieldComponentProps,\n component: FlowComponentName,\n): UseFieldComponent => {\n const fieldErrorId = useId();\n const { FieldErrorView, FieldErrorCaptureContext } = useFieldError({\n fieldErrorId,\n component,\n });\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 \"aria-describedby\": props.isInvalid\n ? fieldErrorId\n : props[\"aria-describedby\"],\n className: clsx(formFieldStyles.formField),\n },\n } as const;\n};\n"],"names":[],"mappings":";;;;;;AAyBO,MAAM,iBAAA,GAAoB,CAC/B,KAAA,EACA,SAAA,KACsB;AACtB,EAAA,MAAM,eAAe,KAAA,EAAM;AAC3B,EAAA,MAAM,EAAE,cAAA,EAAgB,wBAAA,EAAyB,GAAI,aAAA,CAAc;AAAA,IACjE,YAAA;AAAA,IACA;AAAA,GACD,CAAA;AAID,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,kBAAA,EAAoB,KAAA,CAAM,SAAA,GACtB,YAAA,GACA,MAAM,kBAAkB,CAAA;AAAA,MAC5B,SAAA,EAAW,IAAA,CAAK,eAAA,CAAgB,SAAS;AAAA;AAC3C,GACF;AACF;;;;"}
@@ -2,6 +2,7 @@
2
2
  /* */
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import React, { useMemo } from 'react';
5
+ import '../propsContext/propsContext.mjs';
5
6
  import { PropsContextProvider } from '../propsContext/components/PropsContextProvider.mjs';
6
7
  import formFieldStyles from '../../components/FormField/FormField.module.scss.mjs';
7
8
  import { ClearPropsContext } from '../propsContext/components/ClearPropsContext.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"useFieldError.mjs","sources":["../../../../../../../src/lib/hooks/useFieldError.tsx"],"sourcesContent":["import React, { type FC, type PropsWithChildren, useMemo } from \"react\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport ClearPropsContext from \"@/lib/propsContext/components/ClearPropsContext\";\nimport { useProps } from \"@/lib/hooks/useProps\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\n\nexport interface UseFieldErrorOptions {\n fieldErrorId: string;\n tunnelId?: string;\n component: FlowComponentName;\n}\n\nexport const useFieldError = (options: UseFieldErrorOptions) => {\n const fieldErrorProps = useProps(\"FieldError\", {});\n const currentTunnelId = fieldErrorProps.tunnel?.id;\n const tunnelId =\n options.tunnelId ?? currentTunnelId ?? `${options.fieldErrorId}.fieldError`;\n\n const fieldErrorCapturePropsContext: PropsContext = {\n FieldError: {\n id: options.fieldErrorId,\n tunnel: { id: tunnelId, component: options.component },\n className: formFieldStyles.fieldError,\n },\n };\n\n const FieldErrorCaptureContext: FC<PropsWithChildren> = useMemo(\n () => (props) => {\n return (\n <PropsContextProvider\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 <UiComponentTunnelExit id={tunnelId} component={options.component}>\n {(children) => {\n const childrenArray = React.Children.toArray(children);\n return <ClearPropsContext>{childrenArray[0]}</ClearPropsContext>;\n }}\n </UiComponentTunnelExit>\n );\n };\n\n return {\n FieldErrorCaptureContext,\n FieldErrorView,\n } as const;\n};\n"],"names":[],"mappings":";;;;;;;;AAcO,MAAM,aAAA,GAAgB,CAAC,OAAA,KAAkC;AAC9D,EAAA,MAAM,eAAA,GAAkB,QAAA,CAAS,YAAA,EAAc,EAAE,CAAA;AACjD,EAAA,MAAM,eAAA,GAAkB,gBAAgB,MAAA,EAAQ,EAAA;AAChD,EAAA,MAAM,WACJ,OAAA,CAAQ,QAAA,IAAY,eAAA,IAAmB,CAAA,EAAG,QAAQ,YAAY,CAAA,WAAA,CAAA;AAEhE,EAAA,MAAM,6BAAA,GAA8C;AAAA,IAClD,UAAA,EAAY;AAAA,MACV,IAAI,OAAA,CAAQ,YAAA;AAAA,MACZ,QAAQ,EAAE,EAAA,EAAI,QAAA,EAAU,SAAA,EAAW,QAAQ,SAAA,EAAU;AAAA,MACrD,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,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,yBAAsB,EAAA,EAAI,QAAA,EAAU,WAAW,OAAA,CAAQ,SAAA,EACrD,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;;;;"}
1
+ {"version":3,"file":"useFieldError.mjs","sources":["../../../../../../../src/lib/hooks/useFieldError.tsx"],"sourcesContent":["import React, { type FC, type PropsWithChildren, useMemo } from \"react\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport ClearPropsContext from \"@/lib/propsContext/components/ClearPropsContext\";\nimport { useProps } from \"@/lib/hooks/useProps\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\n\nexport interface UseFieldErrorOptions {\n fieldErrorId: string;\n tunnelId?: string;\n component: FlowComponentName;\n}\n\nexport const useFieldError = (options: UseFieldErrorOptions) => {\n const fieldErrorProps = useProps(\"FieldError\", {});\n const currentTunnelId = fieldErrorProps.tunnel?.id;\n const tunnelId =\n options.tunnelId ?? currentTunnelId ?? `${options.fieldErrorId}.fieldError`;\n\n const fieldErrorCapturePropsContext: PropsContext = {\n FieldError: {\n id: options.fieldErrorId,\n tunnel: { id: tunnelId, component: options.component },\n className: formFieldStyles.fieldError,\n },\n };\n\n const FieldErrorCaptureContext: FC<PropsWithChildren> = useMemo(\n () => (props) => {\n return (\n <PropsContextProvider\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 <UiComponentTunnelExit id={tunnelId} component={options.component}>\n {(children) => {\n const childrenArray = React.Children.toArray(children);\n return <ClearPropsContext>{childrenArray[0]}</ClearPropsContext>;\n }}\n </UiComponentTunnelExit>\n );\n };\n\n return {\n FieldErrorCaptureContext,\n FieldErrorView,\n } as const;\n};\n"],"names":[],"mappings":";;;;;;;;;AAcO,MAAM,aAAA,GAAgB,CAAC,OAAA,KAAkC;AAC9D,EAAA,MAAM,eAAA,GAAkB,QAAA,CAAS,YAAA,EAAc,EAAE,CAAA;AACjD,EAAA,MAAM,eAAA,GAAkB,gBAAgB,MAAA,EAAQ,EAAA;AAChD,EAAA,MAAM,WACJ,OAAA,CAAQ,QAAA,IAAY,eAAA,IAAmB,CAAA,EAAG,QAAQ,YAAY,CAAA,WAAA,CAAA;AAEhE,EAAA,MAAM,6BAAA,GAA8C;AAAA,IAClD,UAAA,EAAY;AAAA,MACV,IAAI,OAAA,CAAQ,YAAA;AAAA,MACZ,QAAQ,EAAE,EAAA,EAAI,QAAA,EAAU,SAAA,EAAW,QAAQ,SAAA,EAAU;AAAA,MACrD,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,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,yBAAsB,EAAA,EAAI,QAAA,EAAU,WAAW,OAAA,CAAQ,SAAA,EACrD,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;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/flow-react-components",
3
- "version": "0.2.0-alpha.996",
3
+ "version": "0.2.0-alpha.997",
4
4
  "type": "module",
5
5
  "description": "A React implementation of Flow, mittwald’s design system",
6
6
  "homepage": "https://flow.mittwald.de",
@@ -72,9 +72,9 @@
72
72
  "@internationalized/string-compiler": "^3.4.1",
73
73
  "@lezer/common": "^1.5.2",
74
74
  "@lezer/highlight": "^1.2.3",
75
- "@mittwald/flow-icons": "0.2.0-alpha.996",
75
+ "@mittwald/flow-icons": "0.2.0-alpha.997",
76
76
  "@mittwald/password-tools-js": "3.0.0-alpha.31",
77
- "@mittwald/react-tunnel": "0.2.0-alpha.996",
77
+ "@mittwald/react-tunnel": "0.2.0-alpha.997",
78
78
  "@mittwald/react-use-promise": "^4.2.2",
79
79
  "@react-aria/form": "^3.2.1",
80
80
  "@react-aria/i18n": "^3.13.1",
@@ -129,7 +129,7 @@
129
129
  "@lezer/generator": "^1.8.0",
130
130
  "@lezer/lr": "^1.4.10",
131
131
  "@mittwald/flow-core": "",
132
- "@mittwald/flow-design-tokens": "0.2.0-alpha.996",
132
+ "@mittwald/flow-design-tokens": "0.2.0-alpha.997",
133
133
  "@mittwald/flow-icons-base": "",
134
134
  "@mittwald/react-use-promise": "^4.2.2",
135
135
  "@mittwald/remote-dom-react": "1.2.2-mittwald.10",
@@ -184,7 +184,7 @@
184
184
  },
185
185
  "peerDependencies": {
186
186
  "@internationalized/date": "^3.12.2",
187
- "@mittwald/flow-icons-pro": "0.2.0-alpha.996",
187
+ "@mittwald/flow-icons-pro": "0.2.0-alpha.997",
188
188
  "@mittwald/react-use-promise": "^4.2.2",
189
189
  "next": "^16.2.3",
190
190
  "react": "^19.2.0",
@@ -205,5 +205,5 @@
205
205
  "optional": true
206
206
  }
207
207
  },
208
- "gitHead": "d334ad535b6034f14c84eba20b4b7f6c70c8754a"
208
+ "gitHead": "241af9b8fc8ed6b45ba7b2fa6f99d54d50dc021d"
209
209
  }