@mittwald/flow-react-components 0.2.0-alpha.567 → 0.2.0-alpha.568

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 (177) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/assets/doc-properties.json +1910 -743
  3. package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs +62 -50
  4. package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs.map +1 -1
  5. package/dist/js/components/src/components/CartesianChart/CartesianChart.mjs +1 -0
  6. package/dist/js/components/src/components/CartesianChart/CartesianChart.mjs.map +1 -1
  7. package/dist/js/components/src/components/Checkbox/Checkbox.mjs +4 -11
  8. package/dist/js/components/src/components/Checkbox/Checkbox.mjs.map +1 -1
  9. package/dist/js/components/src/components/CheckboxButton/CheckboxButton.mjs +2 -19
  10. package/dist/js/components/src/components/CheckboxButton/CheckboxButton.mjs.map +1 -1
  11. package/dist/js/components/src/components/CheckboxGroup/CheckboxGroup.mjs +3 -3
  12. package/dist/js/components/src/components/CheckboxGroup/CheckboxGroup.mjs.map +1 -1
  13. package/dist/js/components/src/components/ComboBox/ComboBox.mjs +11 -37
  14. package/dist/js/components/src/components/ComboBox/ComboBox.mjs.map +1 -1
  15. package/dist/js/components/src/components/DateInput/DateInput.mjs +20 -0
  16. package/dist/js/components/src/components/DateInput/DateInput.mjs.map +1 -0
  17. package/dist/js/components/src/components/DatePicker/DatePicker.mjs +1 -6
  18. package/dist/js/components/src/components/DatePicker/DatePicker.mjs.map +1 -1
  19. package/dist/js/components/src/components/DatePicker/components/DateInput/DateInput.mjs +3 -2
  20. package/dist/js/components/src/components/DatePicker/components/DateInput/DateInput.mjs.map +1 -1
  21. package/dist/js/components/src/components/DateRangePicker/DateRangePicker.mjs +1 -6
  22. package/dist/js/components/src/components/DateRangePicker/DateRangePicker.mjs.map +1 -1
  23. package/dist/js/components/src/components/DateRangePicker/components/DateRangeInput/DateRangeInput.mjs +4 -3
  24. package/dist/js/components/src/components/DateRangePicker/components/DateRangeInput/DateRangeInput.mjs.map +1 -1
  25. package/dist/js/components/src/components/FileField/FileField.mjs +4 -10
  26. package/dist/js/components/src/components/FileField/FileField.mjs.map +1 -1
  27. package/dist/js/components/src/components/List/components/Header/components/ActiveFilters/ActiveFilters.mjs +1 -0
  28. package/dist/js/components/src/components/List/components/Header/components/ActiveFilters/ActiveFilters.mjs.map +1 -1
  29. package/dist/js/components/src/components/List/hooks/useAriaAnnounceSearchState.mjs +1 -0
  30. package/dist/js/components/src/components/List/hooks/useAriaAnnounceSearchState.mjs.map +1 -1
  31. package/dist/js/components/src/components/Markdown/Markdown.mjs.map +1 -1
  32. package/dist/js/components/src/components/MarkdownEditor/MarkdownEditor.mjs +19 -24
  33. package/dist/js/components/src/components/MarkdownEditor/MarkdownEditor.mjs.map +1 -1
  34. package/dist/js/components/src/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.mjs +2 -2
  35. package/dist/js/components/src/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.mjs.map +1 -1
  36. package/dist/js/components/src/components/MarkdownEditor/lib/modifyValueByType.mjs +1 -1
  37. package/dist/js/components/src/components/MarkdownEditor/lib/modifyValueByType.mjs.map +1 -1
  38. package/dist/js/components/src/components/Modal/components/OffCanvasSuspenseFallback/OffCanvasSuspenseFallback.mjs +1 -0
  39. package/dist/js/components/src/components/Modal/components/OffCanvasSuspenseFallback/OffCanvasSuspenseFallback.mjs.map +1 -1
  40. package/dist/js/components/src/components/NumberField/NumberField.mjs +4 -22
  41. package/dist/js/components/src/components/NumberField/NumberField.mjs.map +1 -1
  42. package/dist/js/components/src/components/Overlay/Overlay.mjs +1 -0
  43. package/dist/js/components/src/components/Overlay/Overlay.mjs.map +1 -1
  44. package/dist/js/components/src/components/Overlay/components/OverlaySuspenseFallback.mjs +1 -0
  45. package/dist/js/components/src/components/Overlay/components/OverlaySuspenseFallback.mjs.map +1 -1
  46. package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs +8 -15
  47. package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs.map +1 -1
  48. package/dist/js/components/src/components/Popover/Popover.mjs +1 -2
  49. package/dist/js/components/src/components/Popover/Popover.mjs.map +1 -1
  50. package/dist/js/components/src/components/SearchField/SearchField.mjs +6 -13
  51. package/dist/js/components/src/components/SearchField/SearchField.mjs.map +1 -1
  52. package/dist/js/components/src/components/SegmentedControl/SegmentedControl.mjs +3 -3
  53. package/dist/js/components/src/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
  54. package/dist/js/components/src/components/Select/Select.mjs +5 -16
  55. package/dist/js/components/src/components/Select/Select.mjs.map +1 -1
  56. package/dist/js/components/src/components/Slider/Slider.mjs +2 -9
  57. package/dist/js/components/src/components/Slider/Slider.mjs.map +1 -1
  58. package/dist/js/components/src/components/Switch/Switch.mjs +6 -21
  59. package/dist/js/components/src/components/Switch/Switch.mjs.map +1 -1
  60. package/dist/js/components/src/components/TextArea/TextArea.mjs +13 -20
  61. package/dist/js/components/src/components/TextArea/TextArea.mjs.map +1 -1
  62. package/dist/js/components/src/components/TextField/TextField.mjs +4 -11
  63. package/dist/js/components/src/components/TextField/TextField.mjs.map +1 -1
  64. package/dist/js/components/src/components/TextFieldBase/TextFieldBase.mjs +9 -23
  65. package/dist/js/components/src/components/TextFieldBase/TextFieldBase.mjs.map +1 -1
  66. package/dist/js/components/src/components/TimeField/TimeField.mjs +3 -6
  67. package/dist/js/components/src/components/TimeField/TimeField.mjs.map +1 -1
  68. package/dist/js/components/src/components/Tooltip/Tooltip.mjs +1 -0
  69. package/dist/js/components/src/components/Tooltip/Tooltip.mjs.map +1 -1
  70. package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs +6 -7
  71. package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs.map +1 -1
  72. package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs +4 -6
  73. package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs.map +1 -1
  74. package/dist/js/components/src/integrations/react-hook-form/components/ResetButton/ResetButton.mjs +1 -3
  75. package/dist/js/components/src/integrations/react-hook-form/components/ResetButton/ResetButton.mjs.map +1 -1
  76. package/dist/js/components/src/integrations/react-hook-form/components/SubmitButton/SubmitButton.mjs +2 -2
  77. package/dist/js/components/src/lib/controller/overlay/OverlayController.mjs +6 -0
  78. package/dist/js/components/src/lib/controller/overlay/OverlayController.mjs.map +1 -1
  79. package/dist/js/components/src/lib/form/isFocused.mjs +8 -0
  80. package/dist/js/components/src/lib/form/isFocused.mjs.map +1 -0
  81. package/dist/js/components/src/lib/hooks/useFieldError.mjs +1 -0
  82. package/dist/js/components/src/lib/hooks/useFieldError.mjs.map +1 -1
  83. package/dist/js/components/src/lib/remote/eventHandlerContext.mjs +9 -0
  84. package/dist/js/components/src/lib/remote/eventHandlerContext.mjs.map +1 -0
  85. package/dist/js/components/src/lib/remote/useControlledHostValueProps.mjs +31 -0
  86. package/dist/js/components/src/lib/remote/useControlledHostValueProps.mjs.map +1 -0
  87. package/dist/js/components/src/lib/remote/useControlledRemoteValueProps.mjs +20 -0
  88. package/dist/js/components/src/lib/remote/useControlledRemoteValueProps.mjs.map +1 -0
  89. package/dist/js/default.mjs +2 -0
  90. package/dist/js/default.mjs.map +1 -1
  91. package/dist/js/flr-universal.mjs +1 -0
  92. package/dist/js/flr-universal.mjs.map +1 -1
  93. package/dist/types/components/Autocomplete/Autocomplete.d.ts +2 -2
  94. package/dist/types/components/Autocomplete/Autocomplete.d.ts.map +1 -1
  95. package/dist/types/components/Checkbox/Checkbox.d.ts +3 -4
  96. package/dist/types/components/Checkbox/Checkbox.d.ts.map +1 -1
  97. package/dist/types/components/CheckboxButton/CheckboxButton.d.ts +2 -4
  98. package/dist/types/components/CheckboxButton/CheckboxButton.d.ts.map +1 -1
  99. package/dist/types/components/ComboBox/ComboBox.d.ts +3 -6
  100. package/dist/types/components/ComboBox/ComboBox.d.ts.map +1 -1
  101. package/dist/types/components/DateInput/DateInput.d.ts +8 -0
  102. package/dist/types/components/DateInput/DateInput.d.ts.map +1 -0
  103. package/dist/types/components/DateInput/index.d.ts +3 -0
  104. package/dist/types/components/DateInput/index.d.ts.map +1 -0
  105. package/dist/types/components/DatePicker/DatePicker.d.ts +2 -2
  106. package/dist/types/components/DatePicker/DatePicker.d.ts.map +1 -1
  107. package/dist/types/components/DatePicker/components/DateInput/DateInput.d.ts +2 -1
  108. package/dist/types/components/DatePicker/components/DateInput/DateInput.d.ts.map +1 -1
  109. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +2 -2
  110. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
  111. package/dist/types/components/DateRangePicker/components/DateRangeInput/DateRangeInput.d.ts +2 -1
  112. package/dist/types/components/DateRangePicker/components/DateRangeInput/DateRangeInput.d.ts.map +1 -1
  113. package/dist/types/components/FileField/FileField.d.ts +1 -2
  114. package/dist/types/components/FileField/FileField.d.ts.map +1 -1
  115. package/dist/types/components/Header/Header.d.ts +1 -1
  116. package/dist/types/components/List/typedList.d.ts +2 -2
  117. package/dist/types/components/Markdown/Markdown.d.ts +2 -2
  118. package/dist/types/components/Markdown/Markdown.d.ts.map +1 -1
  119. package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts +3 -7
  120. package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
  121. package/dist/types/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.d.ts +2 -2
  122. package/dist/types/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.d.ts.map +1 -1
  123. package/dist/types/components/MarkdownEditor/lib/modifyValueByType.d.ts +1 -1
  124. package/dist/types/components/MarkdownEditor/lib/modifyValueByType.d.ts.map +1 -1
  125. package/dist/types/components/NumberField/NumberField.d.ts +3 -4
  126. package/dist/types/components/NumberField/NumberField.d.ts.map +1 -1
  127. package/dist/types/components/PasswordCreationField/PasswordCreationField.d.ts.map +1 -1
  128. package/dist/types/components/Popover/Popover.d.ts +1 -1
  129. package/dist/types/components/Popover/Popover.d.ts.map +1 -1
  130. package/dist/types/components/SearchField/SearchField.d.ts.map +1 -1
  131. package/dist/types/components/SegmentedControl/SegmentedControl.d.ts +3 -3
  132. package/dist/types/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  133. package/dist/types/components/Select/Select.d.ts +2 -5
  134. package/dist/types/components/Select/Select.d.ts.map +1 -1
  135. package/dist/types/components/Slider/Slider.d.ts +3 -3
  136. package/dist/types/components/Slider/Slider.d.ts.map +1 -1
  137. package/dist/types/components/Switch/Switch.d.ts +2 -2
  138. package/dist/types/components/Switch/Switch.d.ts.map +1 -1
  139. package/dist/types/components/TextArea/TextArea.d.ts.map +1 -1
  140. package/dist/types/components/TextField/TextField.d.ts.map +1 -1
  141. package/dist/types/components/TextFieldBase/TextFieldBase.d.ts.map +1 -1
  142. package/dist/types/components/TimeField/TimeField.d.ts +3 -3
  143. package/dist/types/components/TimeField/TimeField.d.ts.map +1 -1
  144. package/dist/types/index/default.d.ts +2 -0
  145. package/dist/types/index/default.d.ts.map +1 -1
  146. package/dist/types/integrations/react-hook-form/components/Field/Field.d.ts.map +1 -1
  147. package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts +2 -2
  148. package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts.map +1 -1
  149. package/dist/types/integrations/react-hook-form/components/ResetButton/ResetButton.d.ts +1 -1
  150. package/dist/types/integrations/react-hook-form/components/ResetButton/ResetButton.d.ts.map +1 -1
  151. package/dist/types/integrations/react-hook-form/components/SubmitButton/SubmitButton.d.ts +1 -1
  152. package/dist/types/lib/controller/overlay/OverlayController.d.ts.map +1 -1
  153. package/dist/types/lib/form/isFocused.d.ts +2 -0
  154. package/dist/types/lib/form/isFocused.d.ts.map +1 -0
  155. package/dist/types/lib/remote/eventHandlerContext.d.ts +11 -0
  156. package/dist/types/lib/remote/eventHandlerContext.d.ts.map +1 -0
  157. package/dist/types/lib/remote/types.d.ts +6 -0
  158. package/dist/types/lib/remote/types.d.ts.map +1 -0
  159. package/dist/types/lib/remote/useControlledHostValueProps.d.ts +18 -0
  160. package/dist/types/lib/remote/useControlledHostValueProps.d.ts.map +1 -0
  161. package/dist/types/lib/remote/useControlledRemoteValueProps.d.ts +11 -0
  162. package/dist/types/lib/remote/useControlledRemoteValueProps.d.ts.map +1 -0
  163. package/package.json +5 -4
  164. package/dist/js/components/src/lib/hooks/useManagedValue.mjs +0 -27
  165. package/dist/js/components/src/lib/hooks/useManagedValue.mjs.map +0 -1
  166. package/dist/js/components/src/lib/react/ReactAriaControlledValueFix.mjs +0 -65
  167. package/dist/js/components/src/lib/react/ReactAriaControlledValueFix.mjs.map +0 -1
  168. package/dist/js/components/src/lib/react/emitElementValueChange.mjs +0 -22
  169. package/dist/js/components/src/lib/react/emitElementValueChange.mjs.map +0 -1
  170. package/dist/types/lib/hooks/useManagedValue.d.ts +0 -13
  171. package/dist/types/lib/hooks/useManagedValue.d.ts.map +0 -1
  172. package/dist/types/lib/react/ReactAriaControlledValueFix.d.ts +0 -16
  173. package/dist/types/lib/react/ReactAriaControlledValueFix.d.ts.map +0 -1
  174. package/dist/types/lib/react/ReactAriaControlledValueFix.test.d.ts +0 -2
  175. package/dist/types/lib/react/ReactAriaControlledValueFix.test.d.ts.map +0 -1
  176. package/dist/types/lib/react/emitElementValueChange.d.ts +0 -6
  177. package/dist/types/lib/react/emitElementValueChange.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Select.mjs","sources":["../../../../../../src/components/Select/Select.tsx"],"sourcesContent":["import { type PropsWithChildren, useRef } from \"react\";\nimport type { Key } from \"react-aria-components\";\nimport * as Aria from \"react-aria-components\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport styles from \"./Select.module.scss\";\nimport clsx from \"clsx\";\nimport { IconChevronDown } from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { Options } from \"@/components/Options\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { type OverlayController, useOverlayController } from \"@/lib/controller\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\n\nexport interface SelectProps\n extends PropsWithChildren<Omit<Aria.SelectProps, \"children\" | \"className\">>,\n FlowComponentProps,\n PropsWithClassName {\n /** Handler that is called when the selected value changes. */\n onChange?: (value: Key | null) => void;\n /** An overlay controller to control the select option popover state. */\n controller?: OverlayController;\n /** Whether the component is read only. */\n isReadOnly?: boolean;\n}\n\n/** @flr-generate all */\nexport const Select = flowComponent(\"Select\", (props) => {\n const {\n children,\n className,\n onChange,\n onSelectionChange,\n controller: controllerFromProps,\n ref,\n isReadOnly,\n ...rest\n } = props;\n\n const {\n FieldErrorView,\n fieldPropsContext,\n fieldProps,\n FieldErrorCaptureContext,\n } = useFieldComponent(props);\n\n const rootClassName = clsx(\n styles.select,\n formFieldStyles.formField,\n className,\n );\n\n const propsContext: PropsContext = {\n Option: {\n tunnelId: \"options\",\n },\n ...fieldPropsContext,\n };\n\n const controllerFromContext = useOverlayController(\"Select\", {\n reuseControllerFromContext: true,\n });\n\n const localSelectRef = useObjectRef(ref);\n const localButtonRef = useRef<HTMLButtonElement>(null);\n\n useMakeFocusable(localSelectRef, () => {\n localButtonRef.current?.focus();\n controller.setOpen(true);\n });\n\n const controller = controllerFromProps ?? controllerFromContext;\n const isOpen = controller.useIsOpen();\n\n return (\n <Aria.Select\n {...rest}\n {...fieldProps}\n className={clsx(rootClassName, fieldProps.className)}\n ref={localSelectRef}\n onChange={(value) => {\n if (!isReadOnly) {\n onChange?.(value);\n onSelectionChange?.(value);\n }\n }}\n onOpenChange={(isOpen) => !isReadOnly && controller.setOpen(isOpen)}\n isOpen={isOpen}\n data-readonly={isReadOnly}\n >\n <TunnelProvider>\n <FieldErrorCaptureContext>\n <PropsContextProvider props={propsContext}>\n <Aria.Button\n ref={localButtonRef}\n data-readonly={isReadOnly}\n className={styles.toggle}\n >\n <Aria.SelectValue />\n <IconChevronDown />\n </Aria.Button>\n {children}\n <Options controller={controller}>\n <TunnelExit id=\"options\" />\n </Options>\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </TunnelProvider>\n </Aria.Select>\n );\n});\n\nexport default Select;\n"],"names":["isOpen"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgCO,MAAM,MAAA,GAAS,aAAA,CAAc,QAAA,EAAU,CAAC,KAAA,KAAU;AACvD,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,iBAAA;AAAA,IACA,UAAA,EAAY,mBAAA;AAAA,IACZ,GAAA;AAAA,IACA,UAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM;AAAA,IACJ,cAAA;AAAA,IACA,iBAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF,GAAI,kBAAkB,KAAK,CAAA;AAE3B,EAAA,MAAM,aAAA,GAAgB,IAAA;AAAA,IACpB,MAAA,CAAO,MAAA;AAAA,IACP,eAAA,CAAgB,SAAA;AAAA,IAChB;AAAA,GACF;AAEA,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,MAAA,EAAQ;AAAA,MACN,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,GAAG;AAAA,GACL;AAEA,EAAA,MAAM,qBAAA,GAAwB,qBAAqB,QAAA,EAAU;AAAA,IAC3D,0BAAA,EAA4B;AAAA,GAC7B,CAAA;AAED,EAAA,MAAM,cAAA,GAAiB,aAAa,GAAG,CAAA;AACvC,EAAA,MAAM,cAAA,GAAiB,OAA0B,IA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AAA;AAAA,WACnB;AAAA,UACC,QAAA;AAAA,8BACA,OAAA,EAAA,EAAQ,UAAA,EACP,8BAAC,UAAA,EAAA,EAAW,EAAA,EAAG,WAAU,CAAA,EAC3B;AAAA,SAAA,EACF,CAAA,EACF,CAAA;AAAA,4BACC,cAAA,EAAA,EAAe;AAAA,OAAA,EAClB;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"Select.mjs","sources":["../../../../../../src/components/Select/Select.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport type { Key } from \"react-aria-components\";\nimport * as Aria from \"react-aria-components\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport styles from \"./Select.module.scss\";\nimport clsx from \"clsx\";\nimport { IconChevronDown } from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { Options } from \"@/components/Options\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\n\nexport interface SelectProps\n extends PropsWithChildren<\n Omit<Aria.SelectProps, \"children\" | \"className\" | \"ref\">\n >,\n FlowComponentProps<HTMLButtonElement>,\n PropsWithClassName {\n /** Handler that is called when the selected value changes. */\n onChange?: (value: Key | null) => void;\n /** Whether the component is read only. */\n isReadOnly?: boolean;\n}\n\n/** @flr-generate all */\nexport const Select = flowComponent(\"Select\", (props) => {\n const {\n children,\n className,\n onChange,\n onSelectionChange,\n isReadOnly,\n ref,\n ...rest\n } = props;\n\n const {\n FieldErrorView,\n fieldPropsContext,\n fieldProps,\n FieldErrorCaptureContext,\n } = useFieldComponent(props);\n\n const rootClassName = clsx(\n styles.select,\n formFieldStyles.formField,\n className,\n );\n\n const propsContext: PropsContext = {\n Option: {\n tunnelId: \"options\",\n },\n ...fieldPropsContext,\n };\n\n const controller = useOverlayController(\"Select\", {\n reuseControllerFromContext: false,\n });\n const isOpen = controller.useIsOpen();\n\n return (\n <Aria.Select\n {...rest}\n {...fieldProps}\n className={clsx(rootClassName, fieldProps.className)}\n onChange={(value) => {\n if (!isReadOnly) {\n onChange?.(value);\n onSelectionChange?.(value);\n }\n }}\n onOpenChange={(isOpen) => !isReadOnly && controller.setOpen(isOpen)}\n isOpen={isOpen}\n data-readonly={isReadOnly}\n >\n <TunnelProvider>\n <FieldErrorCaptureContext>\n <PropsContextProvider props={propsContext}>\n <Aria.Button\n data-readonly={isReadOnly}\n className={styles.toggle}\n ref={ref}\n >\n <Aria.SelectValue />\n <IconChevronDown />\n </Aria.Button>\n {children}\n <Options controller={controller}>\n <TunnelExit id=\"options\" />\n </Options>\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </TunnelProvider>\n </Aria.Select>\n );\n});\n\nexport default Select;\n"],"names":["isOpen"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BO,MAAM,MAAA,GAAS,aAAA,CAAc,QAAA,EAAU,CAAC,KAAA,KAAU;AACvD,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,iBAAA;AAAA,IACA,UAAA;AAAA,IACA,GAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM;AAAA,IACJ,cAAA;AAAA,IACA,iBAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF,GAAI,kBAAkB,KAAK,CAAA;AAE3B,EAAA,MAAM,aAAA,GAAgB,IAAA;AAAA,IACpB,MAAA,CAAO,MAAA;AAAA,IACP,eAAA,CAAgB,SAAA;AAAA,IAChB;AAAA,GACF;AAEA,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,MAAA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C,UAAA,EAAA,EAAW,EAAA,EAAG,WAAU,CAAA,EAC3B;AAAA,SAAA,EACF,CAAA,EACF,CAAA;AAAA,4BACC,cAAA,EAAA,EAAe;AAAA,OAAA,EAClB;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
@@ -18,7 +18,6 @@ import locales from '../../../../_virtual/_.locale.json@3ed2dc50f997451bdd85a713
18
18
  import { useLocalizedStringFormatter } from 'react-aria';
19
19
  import { TunnelExit } from '@mittwald/react-tunnel';
20
20
  import { useObjectRef } from '@react-aria/utils';
21
- import { useMakeFocusable } from '../../lib/hooks/dom/useMakeFocusable.mjs';
22
21
  import { useFieldComponent } from '../../lib/hooks/useFieldComponent.mjs';
23
22
 
24
23
  const Slider = flowComponent("Slider", (props) => {
@@ -31,7 +30,6 @@ const Slider = flowComponent("Slider", (props) => {
31
30
  showInitialMarker,
32
31
  isReadOnly,
33
32
  ref,
34
- inputRef,
35
33
  ...rest
36
34
  } = props;
37
35
  const rootClassName = clsx(
@@ -41,11 +39,7 @@ const Slider = flowComponent("Slider", (props) => {
41
39
  );
42
40
  const { FieldErrorView, fieldPropsContext, fieldProps } = useFieldComponent(props);
43
41
  const stringFormatter = useLocalizedStringFormatter(locales);
44
- const localSliderRef = useObjectRef(ref);
45
- const localInputRef = useObjectRef(inputRef);
46
- useMakeFocusable(localSliderRef, () => {
47
- localInputRef.current?.focus();
48
- });
42
+ const objectRef = useObjectRef(ref);
49
43
  const propsContext = {
50
44
  ...fieldPropsContext,
51
45
  Label: {
@@ -58,7 +52,6 @@ const Slider = flowComponent("Slider", (props) => {
58
52
  Aria.Slider,
59
53
  {
60
54
  ...rest,
61
- ref: localSliderRef,
62
55
  className: rootClassName,
63
56
  isDisabled,
64
57
  defaultValue,
@@ -120,7 +113,7 @@ const Slider = flowComponent("Slider", (props) => {
120
113
  /* @__PURE__ */ jsx(
121
114
  Aria.SliderThumb,
122
115
  {
123
- inputRef: localInputRef,
116
+ inputRef: objectRef,
124
117
  name,
125
118
  className: styles.handle,
126
119
  isDisabled: isReadOnly
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.mjs","sources":["../../../../../../src/components/Slider/Slider.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"./Slider.module.scss\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { Button } from \"@/components/Button\";\nimport { IconMinus, IconPlus } from \"@/components/Icon/components/icons\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport { TunnelExit } from \"@mittwald/react-tunnel\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\n\nexport interface SliderProps\n extends FlowComponentProps,\n PropsWithChildren<Aria.SliderProps>,\n Pick<Aria.SliderThumbProps, \"inputRef\" | \"name\"> {\n showInitialMarker?: boolean;\n /** Whether the component is read only. */\n isReadOnly?: boolean;\n isInvalid?: boolean;\n}\n\n/** @flr-generate all */\nexport const Slider = flowComponent(\"Slider\", (props) => {\n const {\n className,\n children,\n name,\n isDisabled,\n defaultValue,\n showInitialMarker,\n isReadOnly,\n ref,\n inputRef,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.slider,\n isDisabled && styles.disabled,\n className,\n );\n\n const { FieldErrorView, fieldPropsContext, fieldProps } =\n useFieldComponent(props);\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const localSliderRef = useObjectRef(ref);\n const localInputRef = useObjectRef(inputRef);\n\n useMakeFocusable(localSliderRef, () => {\n localInputRef.current?.focus();\n });\n\n const propsContext: PropsContext = {\n ...fieldPropsContext,\n Label: {\n unstyled: true,\n tunnelId: \"label\",\n ...fieldPropsContext.Label,\n },\n };\n\n return (\n <div {...fieldProps}>\n <Aria.Slider\n {...rest}\n ref={localSliderRef}\n className={rootClassName}\n isDisabled={isDisabled}\n defaultValue={defaultValue}\n >\n <PropsContextProvider props={propsContext}>\n <div className={styles.text}>\n <Aria.SliderOutput className={styles.value} />\n <TunnelExit id=\"label\" />\n </div>\n\n <Aria.SliderTrack className={styles.track}>\n {({ state }) => (\n <PropsContextProvider\n props={{\n Button: {\n isPending: false,\n isFailed: false,\n isSucceeded: false,\n isReadOnly: isReadOnly,\n excludeFromTabOrder: true,\n isDisabled,\n variant: \"plain\",\n color: \"secondary\",\n },\n }}\n >\n <Button\n onPress={() => state.decrementThumb(0)}\n aria-label={stringFormatter.format(\"slider.decrement\")}\n className={styles.decrement}\n >\n <IconMinus />\n </Button>\n\n <Button\n onPress={() => state.incrementThumb(0)}\n aria-label={stringFormatter.format(\"slider.increment\")}\n className={styles.increment}\n >\n <IconPlus />\n </Button>\n\n <div\n className={styles.fill}\n style={{ width: state.getThumbPercent(0) * 100 + \"%\" }}\n />\n\n {showInitialMarker &&\n defaultValue &&\n typeof defaultValue === \"number\" && (\n <div\n className={styles.initialMarker}\n style={{\n left: `calc(${state.getValuePercent(defaultValue) * 100}% - 2px)`,\n }}\n />\n )}\n <Aria.SliderThumb\n inputRef={localInputRef}\n name={name}\n className={styles.handle}\n isDisabled={isReadOnly}\n />\n </PropsContextProvider>\n )}\n </Aria.SliderTrack>\n {children}\n <FieldErrorView />\n </PropsContextProvider>\n </Aria.Slider>\n </div>\n );\n});\n\nexport default Slider;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6BO,MAAM,MAAA,GAAS,aAAA,CAAc,QAAA,EAAU,CAAC,KAAA,KAAU;AACvD,EAAA,MAAM;AAAA,IACJ,SAAA;AAAA,IACA,QAAA;AAAA,IACA,IAAA;AAAA,IACA,UAAA;AAAA,IACA,YAAA;AAAA,IACA,iBAA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A,CAAO,IAAA;AAAA,kBAClB,KAAA,EAAO,EAAE,KAAA,EAAO,KAAA,CAAM,gBAAgB,CAAC,CAAA,GAAI,MAAM,GAAA;AAAI;AAAA,eACvD;AAAA,cAEC,iBAAA,IACC,YAAA,IACA,OAAO,YAAA,KAAiB,QAAA,oBACtB,GAAA;AAAA,gBAAC,KAAA;AAAA,gBAAA;AAAA,kBACC,WAAW,MAAA,CAAO,aAAA;AAAA,kBAClB,KAAA,EAAO;AAAA,oBACL,MAAM,CAAA,KAAA,EAAQ,KAAA,CAAM,eAAA,CAAgB,YAAY,IAAI,GAAG,CAAA,QAAA;AAAA;AACzD;AAAA,eACF;AAAA,8BAEJ,GAAA;AAAA,gBAAC,IAAA,CAAK,WAAA;AAAA,gBAAL;AAAA,kBACC,QAAA,EAAU,aAAA;AAAA,kBACV,IAAA;AAAA,kBACA,WAAW,MAAA,CAAO,MAAA;AAAA,kBAClB,UAAA,EAAY;AAAA;AAAA;AACd;AAAA;AAAA,SACF,EAEJ,CAAA;AAAA,QACC,QAAA;AAAA,4BACA,cAAA,EAAA,EAAe;AAAA,OAAA,EAClB;AAAA;AAAA,GACF,EACF,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"Slider.mjs","sources":["../../../../../../src/components/Slider/Slider.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"./Slider.module.scss\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { Button } from \"@/components/Button\";\nimport { IconMinus, IconPlus } from \"@/components/Icon/components/icons\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport { TunnelExit } from \"@mittwald/react-tunnel\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\n\nexport interface SliderProps\n extends FlowComponentProps<HTMLInputElement>,\n PropsWithChildren<Aria.SliderProps>,\n Pick<Aria.SliderThumbProps, \"name\"> {\n showInitialMarker?: boolean;\n /** Whether the component is read only. */\n isReadOnly?: boolean;\n isInvalid?: boolean;\n}\n\n/** @flr-generate all */\nexport const Slider = flowComponent(\"Slider\", (props) => {\n const {\n className,\n children,\n name,\n isDisabled,\n defaultValue,\n showInitialMarker,\n isReadOnly,\n ref,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.slider,\n isDisabled && styles.disabled,\n className,\n );\n\n const { FieldErrorView, fieldPropsContext, fieldProps } =\n useFieldComponent(props);\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const objectRef = useObjectRef(ref);\n\n const propsContext: PropsContext = {\n ...fieldPropsContext,\n Label: {\n unstyled: true,\n tunnelId: \"label\",\n ...fieldPropsContext.Label,\n },\n };\n\n return (\n <div {...fieldProps}>\n <Aria.Slider\n {...rest}\n className={rootClassName}\n isDisabled={isDisabled}\n defaultValue={defaultValue}\n >\n <PropsContextProvider props={propsContext}>\n <div className={styles.text}>\n <Aria.SliderOutput className={styles.value} />\n <TunnelExit id=\"label\" />\n </div>\n\n <Aria.SliderTrack className={styles.track}>\n {({ state }) => (\n <PropsContextProvider\n props={{\n Button: {\n isPending: false,\n isFailed: false,\n isSucceeded: false,\n isReadOnly: isReadOnly,\n excludeFromTabOrder: true,\n isDisabled,\n variant: \"plain\",\n color: \"secondary\",\n },\n }}\n >\n <Button\n onPress={() => state.decrementThumb(0)}\n aria-label={stringFormatter.format(\"slider.decrement\")}\n className={styles.decrement}\n >\n <IconMinus />\n </Button>\n\n <Button\n onPress={() => state.incrementThumb(0)}\n aria-label={stringFormatter.format(\"slider.increment\")}\n className={styles.increment}\n >\n <IconPlus />\n </Button>\n\n <div\n className={styles.fill}\n style={{ width: state.getThumbPercent(0) * 100 + \"%\" }}\n />\n\n {showInitialMarker &&\n defaultValue &&\n typeof defaultValue === \"number\" && (\n <div\n className={styles.initialMarker}\n style={{\n left: `calc(${state.getValuePercent(defaultValue) * 100}% - 2px)`,\n }}\n />\n )}\n <Aria.SliderThumb\n inputRef={objectRef}\n name={name}\n className={styles.handle}\n isDisabled={isReadOnly}\n />\n </PropsContextProvider>\n )}\n </Aria.SliderTrack>\n {children}\n <FieldErrorView />\n </PropsContextProvider>\n </Aria.Slider>\n </div>\n );\n});\n\nexport default Slider;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BO,MAAM,MAAA,GAAS,aAAA,CAAc,QAAA,EAAU,CAAC,KAAA,KAAU;AACvD,EAAA,MAAM;AAAA,IACJ,SAAA;AAAA,IACA,QAAA;AAAA,IACA,IAAA;AAAA,IACA,UAAA;AAAA,IACA,YAAA;AAAA,IACA,iBAAA;AAAA,IACA,UAAA;AAAA,IACA,GAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,aAAA,GAAgB,IAAA;AAAA,IACpB,MAAA,CAAO,MAAA;AAAA,IACP,cAAc,MAAA,CAAO,QAAA;AAAA,IACrB;AAAA,GACF;AAEA,EAAA,MAAM,EAAE,cAAA,EAAgB,iBAAA,EAAmB,UAAA,EAAW,GACpD,kBAAkB,KAAK,CAAA;AAEzB,EAAA,MAAM,eAAA,GAAkB,4BAA4B,OAAO,CAAA;AAE3D,EAAA,MAAM,SAAA,GAAY,aAAa,GAAG,CAAA;AAElC,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,GAAG,iBAAA;AAAA,IACH,KAAA,EAAO;AAAA,MACL,QAAA,EAAU,IAAA;AAAA,MACV,QAAA,EAAU,OAAA;AAAA,MACV,GAAG,iBAAA,CAAkB;AAAA;AACvB,GACF;AAEA,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAK,GAAG,UAAA,EACP,QAAA,kBAAA,GAAA;AAAA,IAAC,IAAA,CAAK,MAAA;A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AAAA,gBAAC,MAAA;AAAA,gBAAA;AAAA,kBACC,OAAA,EAAS,MAAM,KAAA,CAAM,cAAA,CAAe,CAAC,CAAA;AAAA,kBACrC,YAAA,EAAY,eAAA,CAAgB,MAAA,CAAO,kBAAkB,CAAA;AAAA,kBACrD,WAAW,MAAA,CAAO,SAAA;AAAA,kBAElB,8BAAC,QAAA,EAAA,EAAS;AAAA;AAAA,eACZ;AAAA,8BAEA,GAAA;AAAA,gBAAC,KAAA;AAAA,gBAAA;AAAA,kBACC,WAAW,MAAA,CAAO,IAAA;AAAA,kBAClB,KAAA,EAAO,EAAE,KAAA,EAAO,KAAA,CAAM,gBAAgB,CAAC,CAAA,GAAI,MAAM,GAAA;AAAI;AAAA,eACvD;AAAA,cAEC,iBAAA,IACC,YAAA,IACA,OAAO,YAAA,KAAiB,QAAA,oBACtB,GAAA;AAAA,gBAAC,KAAA;AAAA,gBAAA;AAAA,kBACC,WAAW,MAAA,CAAO,aAAA;AAAA,kBAClB,KAAA,EAAO;AAAA,oBACL,MAAM,CAAA,KAAA,EAAQ,KAAA,CAAM,eAAA,CAAgB,YAAY,IAAI,GAAG,CAAA,QAAA;AAAA;AACzD;AAAA,eACF;AAAA,8BAEJ,GAAA;AAAA,gBAAC,IAAA,CAAK,WAAA;AAAA,gBAAL;AAAA,kBACC,QAAA,EAAU,SAAA;AAAA,kBACV,IAAA;AAAA,kBACA,WAAW,MAAA,CAAO,MAAA;AAAA,kBAClB,UAAA,EAAY;AAAA;AAAA;AACd;AAAA;AAAA,SACF,EAEJ,CAAA;AAAA,QACC,QAAA;AAAA,4BACA,cAAA,EAAA,EAAe;AAAA,OAAA,EAClB;AAAA;AAAA,GACF,EACF,CAAA;AAEJ,CAAC;;;;"}
@@ -14,9 +14,8 @@ import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
14
14
  import { useFieldComponent } from '../../lib/hooks/useFieldComponent.mjs';
15
15
  import '../../lib/propsContext/propsContext.mjs';
16
16
  import { PropsContextProvider } from '../../lib/propsContext/components/PropsContextProvider.mjs';
17
- import { useObjectRef } from '@react-aria/utils';
18
17
  import styles$1 from '../Label/Label.module.scss.mjs';
19
- import { useMakeFocusable } from '../../lib/hooks/dom/useMakeFocusable.mjs';
18
+ import { useObjectRef } from 'react-aria';
20
19
 
21
20
  const Switch = flowComponent("Switch", (props) => {
22
21
  const {
@@ -24,7 +23,6 @@ const Switch = flowComponent("Switch", (props) => {
24
23
  className,
25
24
  labelPosition = "trailing",
26
25
  ref,
27
- inputRef,
28
26
  ...rest
29
27
  } = props;
30
28
  const rootClassName = clsx(
@@ -32,11 +30,7 @@ const Switch = flowComponent("Switch", (props) => {
32
30
  className,
33
31
  styles[`label-${labelPosition}`]
34
32
  );
35
- const localSwitchRef = useObjectRef(ref);
36
- const localInputRef = useObjectRef(inputRef);
37
- useMakeFocusable(localSwitchRef, () => {
38
- localInputRef.current?.focus();
39
- });
33
+ const objectRef = useObjectRef(ref);
40
34
  const {
41
35
  FieldErrorView,
42
36
  FieldErrorCaptureContext,
@@ -51,19 +45,10 @@ const Switch = flowComponent("Switch", (props) => {
51
45
  }
52
46
  };
53
47
  return /* @__PURE__ */ jsxs("div", { ...fieldProps, children: [
54
- /* @__PURE__ */ jsx(FieldErrorCaptureContext, { children: /* @__PURE__ */ jsx(
55
- Aria.Switch,
56
- {
57
- ...rest,
58
- className: rootClassName,
59
- ref: localSwitchRef,
60
- inputRef: localInputRef,
61
- children: ({ isSelected }) => /* @__PURE__ */ jsxs(PropsContextProvider, { props: propsContext, children: [
62
- /* @__PURE__ */ jsx("div", { className: styles.track, children: /* @__PURE__ */ jsx("div", { className: styles.handle, children: isSelected ? /* @__PURE__ */ jsx(IconCheck, { size: "s" }) : /* @__PURE__ */ jsx(IconClose, { size: "s" }) }) }),
63
- /* @__PURE__ */ jsx("div", { className: styles$1.label, children })
64
- ] })
65
- }
66
- ) }),
48
+ /* @__PURE__ */ jsx(FieldErrorCaptureContext, { children: /* @__PURE__ */ jsx(Aria.Switch, { ...rest, className: rootClassName, inputRef: objectRef, children: ({ isSelected }) => /* @__PURE__ */ jsxs(PropsContextProvider, { props: propsContext, children: [
49
+ /* @__PURE__ */ jsx("div", { className: styles.track, children: /* @__PURE__ */ jsx("div", { className: styles.handle, children: isSelected ? /* @__PURE__ */ jsx(IconCheck, { size: "s" }) : /* @__PURE__ */ jsx(IconClose, { size: "s" }) }) }),
50
+ /* @__PURE__ */ jsx("div", { className: styles$1.label, children })
51
+ ] }) }) }),
67
52
  /* @__PURE__ */ jsx(FieldErrorView, {})
68
53
  ] });
69
54
  });
@@ -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 {\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;;;;"}
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 labelStyles from \"../Label/Label.module.scss\";\nimport { useObjectRef } from \"react-aria\";\n\nexport interface SwitchProps\n extends PropsWithChildren<Omit<Aria.SwitchProps, \"children\" | \"inputRef\">>,\n FlowComponentProps<HTMLInputElement> {\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 ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.switch,\n className,\n styles[`label-${labelPosition}`],\n );\n\n const objectRef = useObjectRef(ref);\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 {...rest} className={rootClassName} inputRef={objectRef}>\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":";;;;;;;;;;;;;;;;;AAuBO,MAAM,MAAA,GAAS,aAAA,CAAc,QAAA,EAAU,CAAC,KAAA,KAAU;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AA,EAAI,SAAA,EAAWA,QAAA,CAAY,OAAQ,QAAA,EAAS;AAAA,KAAA,EAC/C,GAEJ,CAAA,EACF,CAAA;AAAA,wBACC,cAAA,EAAA,EAAe;AAAA,GAAA,EAClB,CAAA;AAEJ,CAAC;;;;"}
@@ -6,12 +6,12 @@ import { TextFieldBase } from '../TextFieldBase/TextFieldBase.mjs';
6
6
  import styles from './TextArea.module.scss.mjs';
7
7
  import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
8
8
  import { useObjectRef } from '@react-aria/utils';
9
- import { ReactAriaControlledValueFix } from '../../lib/react/ReactAriaControlledValueFix.mjs';
10
9
  import { useFieldComponent } from '../../lib/hooks/useFieldComponent.mjs';
11
10
  import '../../lib/propsContext/propsContext.mjs';
12
11
  import { PropsContextProvider } from '../../lib/propsContext/components/PropsContextProvider.mjs';
13
12
  import clsx from 'clsx';
14
13
  import { useState, useEffect } from 'react';
14
+ import { useControlledHostValueProps } from '../../lib/remote/useControlledHostValueProps.mjs';
15
15
 
16
16
  const TextArea = flowComponent("TextArea", (props) => {
17
17
  const {
@@ -23,7 +23,7 @@ const TextArea = flowComponent("TextArea", (props) => {
23
23
  allowVerticalResize,
24
24
  allowHorizontalResize,
25
25
  ...rest
26
- } = props;
26
+ } = useControlledHostValueProps(props);
27
27
  let { allowResize } = props;
28
28
  if (allowVerticalResize) {
29
29
  allowResize = "vertical";
@@ -78,25 +78,18 @@ const TextArea = flowComponent("TextArea", (props) => {
78
78
  }
79
79
  };
80
80
  const input = /* @__PURE__ */ jsx(
81
- ReactAriaControlledValueFix,
81
+ Aria.TextArea,
82
82
  {
83
- inputContext: Aria.TextAreaContext,
84
- props,
85
- children: /* @__PURE__ */ jsx(
86
- Aria.TextArea,
87
- {
88
- rows,
89
- "aria-hidden": props["aria-hidden"],
90
- placeholder,
91
- className: rootClassName,
92
- ref: localRef,
93
- onChange: updateHeight,
94
- style: {
95
- minHeight: getHeight(rows),
96
- maxHeight: verticallyResizable ? void 0 : getHeight(autoResizeMaxRows)
97
- }
98
- }
99
- )
83
+ rows,
84
+ "aria-hidden": props["aria-hidden"],
85
+ placeholder,
86
+ className: rootClassName,
87
+ ref: localRef,
88
+ onChange: updateHeight,
89
+ style: {
90
+ minHeight: getHeight(rows),
91
+ maxHeight: verticallyResizable ? void 0 : getHeight(autoResizeMaxRows)
92
+ }
100
93
  }
101
94
  );
102
95
  const {
@@ -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<\n TextFieldBaseProps,\n \"FieldErrorView\" | \"FieldErrorCaptureContext\" | \"input\" | \"ref\"\n >,\n Pick<Aria.TextAreaProps, \"placeholder\" | \"rows\" | \"aria-hidden\">,\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 allowResize?: boolean | \"horizontal\" | \"vertical\";\n\n /** @deprecated Use `allowResize` instead. */\n allowHorizontalResize?: boolean;\n /** @deprecated Use `allowResize` instead. */\n allowVerticalResize?: 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 allowVerticalResize,\n allowHorizontalResize,\n ...rest\n } = props;\n\n let { allowResize } = props;\n if (allowVerticalResize) {\n allowResize = \"vertical\";\n } else if (allowHorizontalResize) {\n allowResize = \"horizontal\";\n }\n\n const rootClassName = clsx(\n styles.textArea,\n typeof allowResize === \"boolean\" && allowResize ? styles.resize : null,\n allowResize === \"horizontal\"\n ? styles.horizontalResize\n : allowResize === \"vertical\"\n ? styles.verticalResize\n : null,\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 && (!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 aria-hidden={props[\"aria-hidden\"]}\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":";;;;;;;;;;;;;AAmCO,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,mBAAA;AAAA,IACA,qBAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,IAAI,EAAE,aAAY,GAAI,KAAA;AACtB,EAAA,IAAI,mBAAA,EAAqB;AACvB,IAAA,WAAA,GAAc,UAAA;AAAA,EAChB,WAAW,qBAAA,EAAuB;AAChC,IAAA,WAAA,GAAc,YAAA;AAAA,EAChB;AAEA,EAAA,MAAM,aAAA,GAAgB,IAAA;AAAA,IACpB,MAAA,CAAO,QAAA;AAAA,IACP,OAAO,WAAA,KAAgB,SAAA,IAAa,WAAA,GAAc,OAAO,MAAA,GAAS,IAAA;AAAA,IAClE,gBAAgB,YAAA,GACZ,MAAA,CAAO,mBACP,WAAA,KAAgB,UAAA,GACd,OAAO,cAAA,GACP;AAAA,GACR;AAEA,EAAA,MAAM,QAAA,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ACH,GAAG,UAAA;AAAA,MACJ,SAAA,EAAW,IAAA,CAAK,IAAA,CAAK,SAAA,EAAW,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;;;;"}
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 { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport { useEffect, useState } from \"react\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\n\nexport interface TextAreaProps\n extends Omit<\n TextFieldBaseProps,\n \"FieldErrorView\" | \"FieldErrorCaptureContext\" | \"input\" | \"ref\"\n >,\n Pick<Aria.TextAreaProps, \"placeholder\" | \"rows\" | \"aria-hidden\">,\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 allowResize?: boolean | \"horizontal\" | \"vertical\";\n\n /** @deprecated Use `allowResize` instead. */\n allowHorizontalResize?: boolean;\n /** @deprecated Use `allowResize` instead. */\n allowVerticalResize?: 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 allowVerticalResize,\n allowHorizontalResize,\n ...rest\n } = useControlledHostValueProps(props);\n\n let { allowResize } = props;\n if (allowVerticalResize) {\n allowResize = \"vertical\";\n } else if (allowHorizontalResize) {\n allowResize = \"horizontal\";\n }\n\n const rootClassName = clsx(\n styles.textArea,\n typeof allowResize === \"boolean\" && allowResize ? styles.resize : null,\n allowResize === \"horizontal\"\n ? styles.horizontalResize\n : allowResize === \"vertical\"\n ? styles.verticalResize\n : null,\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 && (!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 <Aria.TextArea\n rows={rows}\n aria-hidden={props[\"aria-hidden\"]}\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 );\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":";;;;;;;;;;;;;AAmCO,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,mBAAA;AAAA,IACA,qBAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,4BAA4B,KAAK,CAAA;AAErC,EAAA,IAAI,EAAE,aAAY,GAAI,KAAA;AACtB,EAAA,IAAI,mBAAA,EAAqB;AACvB,IAAA,WAAA,GAAc,UAAA;AAAA,EAChB,WAAW,qBAAA,EAAuB;AAChC,IAAA,WAAA,GAAc,YAAA;AAAA,EAChB;AAEA,EAAA,MAAM,aAAA,GAAgB,IAAA;AAAA,IACpB,MAAA,CAAO,QAAA;AAAA,IACP,OAAO,WAAA,KAAgB,SAAA,IAAa,WAAA,GAAc,OAAO,MAAA,GAAS,IAAA;AAAA,IAClE,gBAAgB,YAAA,GACZ,MAAA,CAAO,mBACP,WAAA,KAAgB,UAAA,GACd,OAAO,cAAA,GACP;AAAA,GACR;AAEA,EAAA,MAAM,QAAA,GAAW,aAAa,GAAG,CAAA;AAEjC,EAAA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A,kBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,iBAAA,EAC1B,QAAA,EACH;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
@@ -5,21 +5,14 @@ import * as Aria from 'react-aria-components';
5
5
  import { TextFieldBase } from '../TextFieldBase/TextFieldBase.mjs';
6
6
  import styles from './TextField.module.scss.mjs';
7
7
  import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
8
- import { ReactAriaControlledValueFix } from '../../lib/react/ReactAriaControlledValueFix.mjs';
9
8
  import { useFieldComponent } from '../../lib/hooks/useFieldComponent.mjs';
10
9
  import '../../lib/propsContext/propsContext.mjs';
11
10
  import { PropsContextProvider } from '../../lib/propsContext/components/PropsContextProvider.mjs';
11
+ import { useControlledHostValueProps } from '../../lib/remote/useControlledHostValueProps.mjs';
12
12
 
13
13
  const TextField = flowComponent("TextField", (props) => {
14
- const {
15
- children,
16
- placeholder,
17
- ref,
18
- form,
19
- inputContext = Aria.TextFieldContext,
20
- ...rest
21
- } = props;
22
- const input = /* @__PURE__ */ jsx(ReactAriaControlledValueFix, { inputContext, props, children: /* @__PURE__ */ jsx(
14
+ const { children, placeholder, form, ref, ...rest } = useControlledHostValueProps(props);
15
+ const input = /* @__PURE__ */ jsx(
23
16
  Aria.Input,
24
17
  {
25
18
  form,
@@ -27,7 +20,7 @@ const TextField = flowComponent("TextField", (props) => {
27
20
  className: styles.textField,
28
21
  ref
29
22
  }
30
- ) });
23
+ );
31
24
  const {
32
25
  FieldErrorView,
33
26
  FieldErrorCaptureContext,
@@ -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 {\n ReactAriaControlledValueFix,\n type ReactAriaControlledValueFixProps,\n} 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 /** @internal */\n inputContext?: ReactAriaControlledValueFixProps[\"inputContext\"];\n}\n\n/** @flr-generate all */\nexport const TextField = flowComponent(\"TextField\", (props) => {\n const {\n children,\n placeholder,\n ref,\n form,\n inputContext = Aria.TextFieldContext,\n ...rest\n } = props;\n\n const input = (\n <ReactAriaControlledValueFix inputContext={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":";;;;;;;;;;AA6BO,MAAM,SAAA,GAAY,aAAA,CAAc,WAAA,EAAa,CAAC,KAAA,KAAU;AAC7D,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,WAAA;AAAA,IACA,GAAA;AAAA,IACA,IAAA;AAAA,IACA,eAAe,IAAA,CAAK,gBAAA;AAAA,IACpB,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,KAAA,mBACJ,GAAA,CAAC,2BAAA,EAAA,EAA4B,YAAA,EAA4B,KAAA,EACvD,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;;;;"}
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 { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\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, form, ref, ...rest } =\n useControlledHostValueProps(props);\n\n const input = (\n <Aria.Input\n form={form}\n placeholder={placeholder}\n className={styles.textField}\n ref={ref}\n />\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,UAAU,WAAA,EAAa,IAAA,EAAM,KAAK,GAAG,IAAA,EAAK,GAChD,2BAAA,CAA4B,KAAK,CAAA;AAEnC,EAAA,MAAM,KAAA,mBACJ,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;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;;;;"}
@@ -14,7 +14,6 @@ const TextFieldBase = (props) => {
14
14
  className,
15
15
  input,
16
16
  showCharacterCount,
17
- ref,
18
17
  FieldErrorView,
19
18
  FieldErrorCaptureContext,
20
19
  ...rest
@@ -23,7 +22,7 @@ const TextFieldBase = (props) => {
23
22
  props.defaultValue?.length ?? props.value?.length ?? 0
24
23
  );
25
24
  const translation = useLocalizedStringFormatter(locales);
26
- const handleOnChange = (v) => {
25
+ const handleChange = (v) => {
27
26
  if (showCharacterCount) {
28
27
  setCharactersCount(v.length);
29
28
  }
@@ -38,27 +37,14 @@ const TextFieldBase = (props) => {
38
37
  maxCount: props.maxLength ?? 0
39
38
  }
40
39
  );
41
- const propsWithOptionalStringValue = "value" in props ? {
42
- value: props.value ?? ""
43
- } : {};
44
- return /* @__PURE__ */ jsxs(
45
- Aria.TextField,
46
- {
47
- ref,
48
- ...rest,
49
- className,
50
- onChange: handleOnChange,
51
- ...propsWithOptionalStringValue,
52
- children: [
53
- /* @__PURE__ */ jsxs(FieldErrorCaptureContext, { children: [
54
- children,
55
- input,
56
- showCharacterCount && /* @__PURE__ */ jsx(FieldDescription, { className: formFieldStyles.fieldDescription, children: charactersCountDescription })
57
- ] }),
58
- /* @__PURE__ */ jsx(FieldErrorView, {})
59
- ]
60
- }
61
- );
40
+ return /* @__PURE__ */ jsxs(Aria.TextField, { ...rest, className, onChange: handleChange, children: [
41
+ /* @__PURE__ */ jsxs(FieldErrorCaptureContext, { children: [
42
+ children,
43
+ input,
44
+ showCharacterCount && /* @__PURE__ */ jsx(FieldDescription, { className: formFieldStyles.fieldDescription, children: charactersCountDescription })
45
+ ] }),
46
+ /* @__PURE__ */ jsx(FieldErrorView, {})
47
+ ] });
62
48
  };
63
49
 
64
50
  export { TextFieldBase, TextFieldBase as default };
@@ -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\" | \"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.defaultValue?.length ?? 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,aA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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;;;;"}
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 FieldErrorView,\n FieldErrorCaptureContext,\n ...rest\n } = props;\n\n const [charactersCount, setCharactersCount] = useState(\n props.defaultValue?.length ?? props.value?.length ?? 0,\n );\n\n const translation = useLocalizedStringFormatter(locales);\n\n const handleChange = (v: string) => {\n if (showCharacterCount) {\n setCharactersCount(v.length);\n }\n if (props.onChange) {\n props.onChange(v);\n }\n };\n\n const charactersCountDescription = translation.format(\n \"textFieldBase.characters\",\n {\n count: charactersCount,\n maxCount: props.maxLength ?? 0,\n },\n );\n\n return (\n <Aria.TextField {...rest} className={className} onChange={handleChange}>\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,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,YAAA,EAAc,MAAA,IAAU,KAAA,CAAM,OAAO,MAAA,IAAU;AAAA,GACvD;AAEA,EAAA,MAAM,WAAA,GAAc,4BAA4B,OAAO,CAAA;AAEvD,EAAA,MAAM,YAAA,GAAe,CAAC,CAAA,KAAc;AAClC,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;AAEA,EAAA,uBACE,IAAA,CAAC,KAAK,SAAA,EAAL,EAAgB,GAAG,IAAA,EAAM,SAAA,EAAsB,UAAU,YAAA,EACxD,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,wBAAA,EAAA,EACE,QAAA,EAAA;AAAA,MAAA,QAAA;AAAA,MACA,KAAA;AAAA,MACA,sCACC,GAAA,CAAC,gBAAA,EAAA,EAAiB,SAAA,EAAWA,eAAA,CAAO,kBACjC,QAAA,EAAA,0BAAA,EACH;AAAA,KAAA,EAEJ,CAAA;AAAA,wBACC,cAAA,EAAA,EAAe;AAAA,GAAA,EAClB,CAAA;AAEJ;;;;"}
@@ -7,9 +7,8 @@ import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
7
7
  import '../../lib/propsContext/propsContext.mjs';
8
8
  import { PropsContextProvider } from '../../lib/propsContext/components/PropsContextProvider.mjs';
9
9
  import styles from './TimeField.module.scss.mjs';
10
- import { useMakeFocusable } from '../../lib/hooks/dom/useMakeFocusable.mjs';
11
- import { useObjectRef } from '@react-aria/utils';
12
10
  import { useFieldComponent } from '../../lib/hooks/useFieldComponent.mjs';
11
+ import { DateInput } from '../DateInput/DateInput.mjs';
13
12
 
14
13
  const TimeField = flowComponent("TimeField", (props) => {
15
14
  const { children, ref, ...rest } = props;
@@ -19,11 +18,9 @@ const TimeField = flowComponent("TimeField", (props) => {
19
18
  fieldPropsContext,
20
19
  fieldProps
21
20
  } = useFieldComponent(props);
22
- const localRef = useObjectRef(ref);
23
- useMakeFocusable(localRef);
24
- return /* @__PURE__ */ jsxs(Aria.TimeField, { ref: localRef, hourCycle: 24, ...rest, ...fieldProps, children: [
21
+ return /* @__PURE__ */ jsxs(Aria.TimeField, { hourCycle: 24, ...rest, ...fieldProps, children: [
25
22
  /* @__PURE__ */ jsxs(FieldErrorCaptureContext, { children: [
26
- /* @__PURE__ */ jsx(Aria.DateInput, { className: styles.dateInput, children: (segment) => /* @__PURE__ */ jsx(Aria.DateSegment, { segment }) }),
23
+ /* @__PURE__ */ jsx(DateInput, { className: styles.dateInput, ref }),
27
24
  /* @__PURE__ */ jsx(PropsContextProvider, { props: fieldPropsContext, children })
28
25
  ] }),
29
26
  /* @__PURE__ */ jsx(FieldErrorView, {})
@@ -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 {\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
+ {"version":3,"file":"TimeField.mjs","sources":["../../../../../../src/components/TimeField/TimeField.tsx"],"sourcesContent":["import { 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 { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport DateInput from \"@/components/DateInput\";\n\nexport interface TimeFieldProps<T extends Aria.TimeValue = Aria.TimeValue>\n extends PropsWithChildren<Omit<Aria.TimeFieldProps<T>, \"children\">>,\n FlowComponentProps<HTMLSpanElement> {}\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 return (\n <Aria.TimeField hourCycle={24} {...rest} {...fieldProps}>\n <FieldErrorCaptureContext>\n <DateInput className={styles.dateInput} ref={ref} />\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,uBACE,IAAA,CAAC,KAAK,SAAA,EAAL,EAAe,WAAW,EAAA,EAAK,GAAG,IAAA,EAAO,GAAG,UAAA,EAC3C,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,wBAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,SAAA,EAAA,EAAU,SAAA,EAAW,MAAA,CAAO,SAAA,EAAW,GAAA,EAAU,CAAA;AAAA,sBAClD,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;;;;"}
@@ -109,6 +109,7 @@ import '../TextArea/TextArea.mjs';
109
109
  import '../TextField/TextField.mjs';
110
110
  import '../TimeField/TimeField.mjs';
111
111
  import '../TranslationProvider/TranslationProvider.mjs';
112
+ import '../../lib/remote/eventHandlerContext.mjs';
112
113
 
113
114
  const Tooltip = (props) => {
114
115
  const { children, className, ...rest } = props;
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.mjs","sources":["../../../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport type { FC, PropsWithChildren } from \"react\";\nimport styles from \"./Tooltip.module.scss\";\nimport clsx from \"clsx\";\nimport { ClearPropsContext } from \"@/index/default\";\n\nexport type TooltipProps = PropsWithChildren<\n Omit<Aria.TooltipProps, \"children\">\n>;\n\n/** @flr-generate all */\nexport const Tooltip: FC<TooltipProps> = (props) => {\n const { children, className, ...rest } = props;\n\n const rootClassName = clsx(styles.tooltip, className);\n\n return (\n <ClearPropsContext>\n <Aria.Tooltip {...rest} className={rootClassName}>\n <Aria.OverlayArrow className={styles.tip}>\n <svg viewBox=\"0 0 8 8\">\n <path d=\"M0 0 L4 4 L8 0\" />\n </svg>\n </Aria.OverlayArrow>\n {children}\n </Aria.Tooltip>\n </ClearPropsContext>\n );\n};\n\nexport default Tooltip;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,MAAM,OAAA,GAA4B,CAAC,KAAA,KAAU;AAClD,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,GAAG,MAAK,GAAI,KAAA;AAEzC,EAAA,MAAM,aAAA,GAAgB,IAAA,CAAK,MAAA,CAAO,OAAA,EAAS,SAAS,CAAA;AAEpD,EAAA,uBACE,GAAA,CAAC,qBACC,QAAA,kBAAA,IAAA,CAAC,IAAA,CAAK,SAAL,EAAc,GAAG,IAAA,EAAM,SAAA,EAAW,aAAA,EACjC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,CAAK,YAAA,EAAL,EAAkB,SAAA,EAAW,OAAO,GAAA,EACnC,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,OAAA,EAAQ,WACX,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,CAAA,EAAE,gBAAA,EAAiB,GAC3B,CAAA,EACF,CAAA;AAAA,IACC;AAAA,GAAA,EACH,CAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Tooltip.mjs","sources":["../../../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport type { FC, PropsWithChildren } from \"react\";\nimport styles from \"./Tooltip.module.scss\";\nimport clsx from \"clsx\";\nimport { ClearPropsContext } from \"@/index/default\";\n\nexport type TooltipProps = PropsWithChildren<\n Omit<Aria.TooltipProps, \"children\">\n>;\n\n/** @flr-generate all */\nexport const Tooltip: FC<TooltipProps> = (props) => {\n const { children, className, ...rest } = props;\n\n const rootClassName = clsx(styles.tooltip, className);\n\n return (\n <ClearPropsContext>\n <Aria.Tooltip {...rest} className={rootClassName}>\n <Aria.OverlayArrow className={styles.tip}>\n <svg viewBox=\"0 0 8 8\">\n <path d=\"M0 0 L4 4 L8 0\" />\n </svg>\n </Aria.OverlayArrow>\n {children}\n </Aria.Tooltip>\n </ClearPropsContext>\n );\n};\n\nexport default Tooltip;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,MAAM,OAAA,GAA4B,CAAC,KAAA,KAAU;AAClD,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,GAAG,MAAK,GAAI,KAAA;AAEzC,EAAA,MAAM,aAAA,GAAgB,IAAA,CAAK,MAAA,CAAO,OAAA,EAAS,SAAS,CAAA;AAEpD,EAAA,uBACE,GAAA,CAAC,qBACC,QAAA,kBAAA,IAAA,CAAC,IAAA,CAAK,SAAL,EAAc,GAAG,IAAA,EAAM,SAAA,EAAW,aAAA,EACjC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,CAAK,YAAA,EAAL,EAAkB,SAAA,EAAW,OAAO,GAAA,EACnC,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,OAAA,EAAQ,WACX,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,CAAA,EAAE,gBAAA,EAAiB,GAC3B,CAAA,EACF,CAAA;AAAA,IACC;AAAA,GAAA,EACH,CAAA,EACF,CAAA;AAEJ;;;;"}
@@ -7,11 +7,11 @@ import '../../../../lib/propsContext/propsContext.mjs';
7
7
  import { PropsContextProvider } from '../../../../lib/propsContext/components/PropsContextProvider.mjs';
8
8
  import 'react';
9
9
  import { useController, useWatch } from 'react-hook-form';
10
+ import { useHotkeys } from 'react-hotkeys-hook';
10
11
  import { useLocalizedStringFormatter } from 'react-aria';
11
12
  import locales from '../../../../../../_virtual/_.locale.json@72ba2ce40f190df671686fec50c04ddf.mjs';
12
13
  import FieldErrorView from '../../../../views/FieldErrorView.mjs';
13
- import { useHotkeys } from 'react-hotkeys-hook';
14
- import { useMergeRefs } from 'use-callback-ref';
14
+ import { mergeRefs } from '@react-aria/utils';
15
15
 
16
16
  function Field(props) {
17
17
  const { children, name, defaultValue, ...rest } = props;
@@ -41,7 +41,7 @@ function Field(props) {
41
41
  }) ?? controller.field.value;
42
42
  const isFieldInvalid = controller.fieldState.invalid;
43
43
  const hotkeyRef = useHotkeys(
44
- "meta+enter, ctrl+enter",
44
+ "mod+enter",
45
45
  () => {
46
46
  formContext.submit();
47
47
  },
@@ -50,10 +50,10 @@ function Field(props) {
50
50
  enableOnContentEditable: true
51
51
  }
52
52
  );
53
- const fieldRef = useMergeRefs([controller.field.ref, hotkeyRef]);
53
+ const refWithHotkey = mergeRefs(controller.field.ref, hotkeyRef);
54
54
  const fieldProps = {
55
55
  ...controller.field,
56
- ref: fieldRef,
56
+ ref: refWithHotkey,
57
57
  value,
58
58
  name,
59
59
  form: formContext.id,
@@ -69,7 +69,6 @@ function Field(props) {
69
69
  ] });
70
70
  })
71
71
  };
72
- const { value: ignoredValue, ...fieldPropsWithoutValue } = fieldProps;
73
72
  const propsContext = {
74
73
  Autocomplete: fieldProps,
75
74
  SearchField: fieldProps,
@@ -106,7 +105,7 @@ function Field(props) {
106
105
  selectedKey: value
107
106
  },
108
107
  ComboBox: {
109
- ...fieldPropsWithoutValue,
108
+ ...fieldProps,
110
109
  selectedKey: value
111
110
  }
112
111
  };
@@ -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 { 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 FieldErrorView from \"@/views/FieldErrorView\";\nimport { useHotkeys } from \"react-hotkeys-hook\";\nimport { useMergeRefs } from \"use-callback-ref\";\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 hotkeyRef = useHotkeys<never>(\n \"meta+enter, ctrl+enter\",\n () => {\n formContext.submit();\n },\n {\n enableOnFormTags: true,\n enableOnContentEditable: true,\n },\n );\n const fieldRef = useMergeRefs([controller.field.ref, hotkeyRef]);\n\n const fieldProps = {\n ...controller.field,\n ref: fieldRef,\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 { value: ignoredValue, ...fieldPropsWithoutValue } = fieldProps;\n\n const propsContext: PropsContext = {\n Autocomplete: fieldProps,\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={[\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":";;;;;;;;;;;;;AAqBO,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,EAAS,eAAA,CAAgB,MAAA,CAAO,WAAA,EAAa;AAAA,UAC3C,MAAA,EAAQ,KAAK,KAAA,CAAM;AAAA,SACpB;AAAA,OACH,GACA,KAAK,KAAA,EAAO;AAAA;AACpB,GACD,CAAA;AACD,EAAA,MAAM,cAAc,cAAA,EAAkB;AAYtC,EAAA,MAAM,QACJ,QAAA,CAAS;AAAA,IACP,OAAA,EAAS,YAAY,IAAA,CAAK,OAAA;AAAA,IAC1B;AAAA,GACD,CAAA,IAAK,UAAA,CAAW,KAAA,CAAM,KAAA;AAEzB,EAAA,MAAM,cAAA,G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IAChB,QAAA,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,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/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 { useHotkeys } from \"react-hotkeys-hook\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport locales from \"./locales/*.locale.json\";\nimport FieldErrorView from \"@/views/FieldErrorView\";\nimport { mergeRefs } from \"@react-aria/utils\";\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 hotkeyRef = useHotkeys<never>(\n \"mod+enter\",\n () => {\n formContext.submit();\n },\n {\n enableOnFormTags: true,\n enableOnContentEditable: true,\n },\n );\n\n const refWithHotkey = mergeRefs(controller.field.ref, hotkeyRef);\n\n const fieldProps = {\n ...controller.field,\n ref: refWithHotkey,\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: fieldProps,\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 ...fieldProps,\n selectedKey: value,\n },\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":";;;;;;;;;;;;;AAqBO,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,K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