@mittwald/flow-react-components 0.2.0-alpha.567 → 0.2.0-alpha.569
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/assets/doc-properties.json +2065 -878
- package/dist/css/all.css +1 -1
- package/dist/js/components/src/components/AccentBox/AccentBox.mjs +22 -21
- package/dist/js/components/src/components/AccentBox/AccentBox.mjs.map +1 -1
- package/dist/js/components/src/components/ActionGroup/ActionGroup.mjs +37 -31
- package/dist/js/components/src/components/ActionGroup/ActionGroup.mjs.map +1 -1
- package/dist/js/components/src/components/Align/Align.mjs +22 -16
- package/dist/js/components/src/components/Align/Align.mjs.map +1 -1
- package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs +61 -50
- package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs.map +1 -1
- package/dist/js/components/src/components/BrowserOnly/BrowserOnly.mjs +7 -0
- package/dist/js/components/src/components/BrowserOnly/BrowserOnly.mjs.map +1 -1
- package/dist/js/components/src/components/CartesianChart/CartesianChart.mjs +5 -2
- package/dist/js/components/src/components/CartesianChart/CartesianChart.mjs.map +1 -1
- package/dist/js/components/src/components/Checkbox/Checkbox.mjs +4 -11
- package/dist/js/components/src/components/Checkbox/Checkbox.mjs.map +1 -1
- package/dist/js/components/src/components/CheckboxButton/CheckboxButton.mjs +2 -19
- package/dist/js/components/src/components/CheckboxButton/CheckboxButton.mjs.map +1 -1
- package/dist/js/components/src/components/CheckboxGroup/CheckboxGroup.mjs +4 -4
- package/dist/js/components/src/components/CheckboxGroup/CheckboxGroup.mjs.map +1 -1
- package/dist/js/components/src/components/ColumnLayout/ColumnLayout.mjs +64 -58
- package/dist/js/components/src/components/ColumnLayout/ColumnLayout.mjs.map +1 -1
- package/dist/js/components/src/components/ComboBox/ComboBox.mjs +11 -37
- package/dist/js/components/src/components/ComboBox/ComboBox.mjs.map +1 -1
- package/dist/js/components/src/components/ContextMenu/components/ContextMenuSection/ContextMenuSection.mjs +2 -1
- package/dist/js/components/src/components/ContextMenu/components/ContextMenuSection/ContextMenuSection.mjs.map +1 -1
- package/dist/js/components/src/components/DateInput/DateInput.mjs +20 -0
- package/dist/js/components/src/components/DateInput/DateInput.mjs.map +1 -0
- package/dist/js/components/src/components/DatePicker/DatePicker.mjs +1 -6
- package/dist/js/components/src/components/DatePicker/DatePicker.mjs.map +1 -1
- package/dist/js/components/src/components/DatePicker/components/DateInput/DateInput.mjs +3 -2
- package/dist/js/components/src/components/DatePicker/components/DateInput/DateInput.mjs.map +1 -1
- package/dist/js/components/src/components/DateRangePicker/DateRangePicker.mjs +1 -6
- package/dist/js/components/src/components/DateRangePicker/DateRangePicker.mjs.map +1 -1
- package/dist/js/components/src/components/DateRangePicker/components/DateRangeInput/DateRangeInput.mjs +4 -3
- package/dist/js/components/src/components/DateRangePicker/components/DateRangeInput/DateRangeInput.mjs.map +1 -1
- package/dist/js/components/src/components/FileField/FileField.mjs +4 -10
- package/dist/js/components/src/components/FileField/FileField.mjs.map +1 -1
- package/dist/js/components/src/components/Header/Header.mjs +20 -15
- package/dist/js/components/src/components/Header/Header.mjs.map +1 -1
- package/dist/js/components/src/components/IllustratedMessage/IllustratedMessage.mjs +1 -1
- package/dist/js/components/src/components/IllustratedMessage/IllustratedMessage.mjs.map +1 -1
- package/dist/js/components/src/components/LayoutCard/LayoutCard.mjs +16 -12
- package/dist/js/components/src/components/LayoutCard/LayoutCard.mjs.map +1 -1
- package/dist/js/components/src/components/List/components/Header/components/ActiveFilters/ActiveFilters.mjs +5 -2
- package/dist/js/components/src/components/List/components/Header/components/ActiveFilters/ActiveFilters.mjs.map +1 -1
- package/dist/js/components/src/components/List/components/Header/components/SearchField/SearchField.mjs +6 -0
- package/dist/js/components/src/components/List/components/Header/components/SearchField/SearchField.mjs.map +1 -1
- package/dist/js/components/src/components/List/hooks/useAriaAnnounceSearchState.mjs +5 -2
- package/dist/js/components/src/components/List/hooks/useAriaAnnounceSearchState.mjs.map +1 -1
- package/dist/js/components/src/components/Markdown/Markdown.mjs.map +1 -1
- package/dist/js/components/src/components/MarkdownEditor/MarkdownEditor.mjs +19 -24
- package/dist/js/components/src/components/MarkdownEditor/MarkdownEditor.mjs.map +1 -1
- package/dist/js/components/src/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.mjs +2 -2
- package/dist/js/components/src/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.mjs.map +1 -1
- package/dist/js/components/src/components/MarkdownEditor/lib/modifyValueByType.mjs +1 -1
- package/dist/js/components/src/components/MarkdownEditor/lib/modifyValueByType.mjs.map +1 -1
- package/dist/js/components/src/components/Modal/Modal.mjs +70 -76
- package/dist/js/components/src/components/Modal/Modal.mjs.map +1 -1
- package/dist/js/components/src/components/Modal/components/OffCanvasSuspenseFallback/OffCanvasSuspenseFallback.mjs +5 -2
- package/dist/js/components/src/components/Modal/components/OffCanvasSuspenseFallback/OffCanvasSuspenseFallback.mjs.map +1 -1
- package/dist/js/components/src/components/Navigation/components/NavigationGroup/NavigationGroup.mjs +1 -4
- package/dist/js/components/src/components/Navigation/components/NavigationGroup/NavigationGroup.mjs.map +1 -1
- package/dist/js/components/src/components/NumberField/NumberField.mjs +4 -22
- package/dist/js/components/src/components/NumberField/NumberField.mjs.map +1 -1
- package/dist/js/components/src/components/Overlay/Overlay.mjs +2 -104
- package/dist/js/components/src/components/Overlay/Overlay.mjs.map +1 -1
- package/dist/js/components/src/components/Overlay/components/OverlaySuspenseFallback.mjs +5 -2
- package/dist/js/components/src/components/Overlay/components/OverlaySuspenseFallback.mjs.map +1 -1
- package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs +10 -16
- package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs.map +1 -1
- package/dist/js/components/src/components/Popover/Popover.mjs +2 -106
- package/dist/js/components/src/components/Popover/Popover.mjs.map +1 -1
- package/dist/js/components/src/components/RadioGroup/RadioGroup.mjs +1 -1
- package/dist/js/components/src/components/RadioGroup/RadioGroup.mjs.map +1 -1
- package/dist/js/components/src/components/SearchField/SearchField.mjs +6 -13
- package/dist/js/components/src/components/SearchField/SearchField.mjs.map +1 -1
- package/dist/js/components/src/components/Section/Section.mjs +41 -35
- package/dist/js/components/src/components/Section/Section.mjs.map +1 -1
- package/dist/js/components/src/components/SegmentedControl/SegmentedControl.mjs +3 -3
- package/dist/js/components/src/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
- package/dist/js/components/src/components/Select/Select.mjs +5 -16
- package/dist/js/components/src/components/Select/Select.mjs.map +1 -1
- package/dist/js/components/src/components/Slider/Slider.mjs +2 -9
- package/dist/js/components/src/components/Slider/Slider.mjs.map +1 -1
- package/dist/js/components/src/components/Switch/Switch.mjs +6 -21
- package/dist/js/components/src/components/Switch/Switch.mjs.map +1 -1
- package/dist/js/components/src/components/TextArea/TextArea.mjs +13 -20
- package/dist/js/components/src/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/js/components/src/components/TextField/TextField.mjs +4 -11
- package/dist/js/components/src/components/TextField/TextField.mjs.map +1 -1
- package/dist/js/components/src/components/TextFieldBase/TextFieldBase.mjs +9 -23
- package/dist/js/components/src/components/TextFieldBase/TextFieldBase.mjs.map +1 -1
- package/dist/js/components/src/components/TimeField/TimeField.mjs +3 -6
- package/dist/js/components/src/components/TimeField/TimeField.mjs.map +1 -1
- package/dist/js/components/src/components/Tooltip/Tooltip.mjs +6 -2
- package/dist/js/components/src/components/Tooltip/Tooltip.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs +6 -7
- package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs +4 -6
- package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/ResetButton/ResetButton.mjs +1 -3
- package/dist/js/components/src/integrations/react-hook-form/components/ResetButton/ResetButton.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/SubmitButton/SubmitButton.mjs +2 -2
- package/dist/js/components/src/lib/componentFactory/flowComponent.mjs +7 -23
- package/dist/js/components/src/lib/componentFactory/flowComponent.mjs.map +1 -1
- package/dist/js/components/src/lib/controller/overlay/OverlayController.mjs +6 -0
- package/dist/js/components/src/lib/controller/overlay/OverlayController.mjs.map +1 -1
- package/dist/js/components/src/lib/form/isFocused.mjs +8 -0
- package/dist/js/components/src/lib/form/isFocused.mjs.map +1 -0
- package/dist/js/components/src/lib/hooks/useFieldError.mjs +1 -2
- package/dist/js/components/src/lib/hooks/useFieldError.mjs.map +1 -1
- package/dist/js/components/src/lib/hooks/useProps.mjs +1 -2
- package/dist/js/components/src/lib/hooks/useProps.mjs.map +1 -1
- package/dist/js/components/src/lib/propsContext/components/ClearPropsContext.mjs +4 -10
- package/dist/js/components/src/lib/propsContext/components/ClearPropsContext.mjs.map +1 -1
- package/dist/js/components/src/lib/propsContext/components/ComponentPropsContextProvider.mjs +2 -2
- package/dist/js/components/src/lib/propsContext/components/ComponentPropsContextProvider.mjs.map +1 -1
- package/dist/js/components/src/lib/propsContext/components/PropsContextProvider.mjs +7 -22
- package/dist/js/components/src/lib/propsContext/components/PropsContextProvider.mjs.map +1 -1
- package/dist/js/components/src/lib/propsContext/mergePropsContext.mjs +22 -30
- package/dist/js/components/src/lib/propsContext/mergePropsContext.mjs.map +1 -1
- package/dist/js/components/src/lib/propsContext/nestedPropsContext/lib.mjs +27 -7
- package/dist/js/components/src/lib/propsContext/nestedPropsContext/lib.mjs.map +1 -1
- package/dist/js/components/src/lib/react/getPropsMerger.mjs +7 -2
- package/dist/js/components/src/lib/react/getPropsMerger.mjs.map +1 -1
- package/dist/js/components/src/lib/remote/eventHandlerContext.mjs +9 -0
- package/dist/js/components/src/lib/remote/eventHandlerContext.mjs.map +1 -0
- package/dist/js/components/src/lib/remote/useControlledHostValueProps.mjs +31 -0
- package/dist/js/components/src/lib/remote/useControlledHostValueProps.mjs.map +1 -0
- package/dist/js/components/src/lib/remote/useControlledRemoteValueProps.mjs +20 -0
- package/dist/js/components/src/lib/remote/useControlledRemoteValueProps.mjs.map +1 -0
- package/dist/js/default.mjs +2 -0
- package/dist/js/default.mjs.map +1 -1
- package/dist/js/flr-universal.mjs +2 -2
- package/dist/types/components/AccentBox/AccentBox.d.ts.map +1 -1
- package/dist/types/components/AccentBox/stories/Default.stories.d.ts +1 -0
- package/dist/types/components/AccentBox/stories/Default.stories.d.ts.map +1 -1
- package/dist/types/components/ActionGroup/ActionGroup.d.ts.map +1 -1
- package/dist/types/components/Align/Align.d.ts.map +1 -1
- package/dist/types/components/Autocomplete/Autocomplete.d.ts +2 -2
- package/dist/types/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/types/components/Checkbox/Checkbox.d.ts +3 -4
- package/dist/types/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/types/components/CheckboxButton/CheckboxButton.d.ts +2 -4
- package/dist/types/components/CheckboxButton/CheckboxButton.d.ts.map +1 -1
- package/dist/types/components/ColumnLayout/ColumnLayout.d.ts.map +1 -1
- package/dist/types/components/ComboBox/ComboBox.d.ts +3 -6
- package/dist/types/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/dist/types/components/ContextMenu/components/ContextMenuSection/ContextMenuSection.d.ts.map +1 -1
- package/dist/types/components/DateInput/DateInput.d.ts +8 -0
- package/dist/types/components/DateInput/DateInput.d.ts.map +1 -0
- package/dist/types/components/DateInput/index.d.ts +3 -0
- package/dist/types/components/DateInput/index.d.ts.map +1 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts +2 -2
- package/dist/types/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/types/components/DatePicker/components/DateInput/DateInput.d.ts +2 -1
- package/dist/types/components/DatePicker/components/DateInput/DateInput.d.ts.map +1 -1
- package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/dist/types/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/types/components/DateRangePicker/components/DateRangeInput/DateRangeInput.d.ts +2 -1
- package/dist/types/components/DateRangePicker/components/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/types/components/FileField/FileField.d.ts +1 -2
- package/dist/types/components/FileField/FileField.d.ts.map +1 -1
- package/dist/types/components/Header/Header.d.ts +2 -2
- package/dist/types/components/Header/Header.d.ts.map +1 -1
- package/dist/types/components/LayoutCard/LayoutCard.d.ts.map +1 -1
- package/dist/types/components/List/typedList.d.ts +2 -2
- package/dist/types/components/Markdown/Markdown.d.ts +2 -2
- package/dist/types/components/Markdown/Markdown.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts +3 -7
- package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.d.ts +2 -2
- package/dist/types/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/lib/modifyValueByType.d.ts +1 -1
- package/dist/types/components/MarkdownEditor/lib/modifyValueByType.d.ts.map +1 -1
- package/dist/types/components/Message/stories/Default.stories.d.ts.map +1 -1
- package/dist/types/components/Modal/Modal.d.ts.map +1 -1
- package/dist/types/components/Navigation/components/NavigationGroup/NavigationGroup.d.ts.map +1 -1
- package/dist/types/components/NumberField/NumberField.d.ts +3 -4
- package/dist/types/components/NumberField/NumberField.d.ts.map +1 -1
- package/dist/types/components/Overlay/Overlay.d.ts.map +1 -1
- package/dist/types/components/PasswordCreationField/PasswordCreationField.d.ts.map +1 -1
- package/dist/types/components/Popover/Popover.d.ts +1 -1
- package/dist/types/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/components/SearchField/SearchField.d.ts.map +1 -1
- package/dist/types/components/Section/Section.d.ts.map +1 -1
- package/dist/types/components/SegmentedControl/SegmentedControl.d.ts +3 -3
- package/dist/types/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/types/components/Select/Select.d.ts +2 -5
- package/dist/types/components/Select/Select.d.ts.map +1 -1
- package/dist/types/components/Slider/Slider.d.ts +3 -3
- package/dist/types/components/Slider/Slider.d.ts.map +1 -1
- package/dist/types/components/Switch/Switch.d.ts +2 -2
- package/dist/types/components/Switch/Switch.d.ts.map +1 -1
- package/dist/types/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/types/components/TextField/TextField.d.ts.map +1 -1
- package/dist/types/components/TextFieldBase/TextFieldBase.d.ts.map +1 -1
- package/dist/types/components/TimeField/TimeField.d.ts +3 -3
- package/dist/types/components/TimeField/TimeField.d.ts.map +1 -1
- package/dist/types/index/default.d.ts +2 -0
- package/dist/types/index/default.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/Field.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts +2 -2
- package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/ResetButton/ResetButton.d.ts +1 -1
- package/dist/types/integrations/react-hook-form/components/ResetButton/ResetButton.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/SubmitButton/SubmitButton.d.ts +1 -1
- package/dist/types/lib/componentFactory/flowComponent.d.ts +1 -1
- package/dist/types/lib/componentFactory/flowComponent.d.ts.map +1 -1
- package/dist/types/lib/controller/overlay/OverlayController.d.ts.map +1 -1
- package/dist/types/lib/form/isFocused.d.ts +2 -0
- package/dist/types/lib/form/isFocused.d.ts.map +1 -0
- package/dist/types/lib/hooks/useFieldError.d.ts.map +1 -1
- package/dist/types/lib/hooks/useProps.d.ts.map +1 -1
- package/dist/types/lib/propsContext/components/ClearPropsContext.d.ts +1 -5
- package/dist/types/lib/propsContext/components/ClearPropsContext.d.ts.map +1 -1
- package/dist/types/lib/propsContext/components/ComponentPropsContextProvider.d.ts +0 -2
- package/dist/types/lib/propsContext/components/ComponentPropsContextProvider.d.ts.map +1 -1
- package/dist/types/lib/propsContext/components/PropsContextProvider.d.ts +0 -3
- package/dist/types/lib/propsContext/components/PropsContextProvider.d.ts.map +1 -1
- package/dist/types/lib/propsContext/mergePropsContext.d.ts +1 -1
- package/dist/types/lib/propsContext/mergePropsContext.d.ts.map +1 -1
- package/dist/types/lib/propsContext/nestedPropsContext/lib.d.ts +3 -84
- package/dist/types/lib/propsContext/nestedPropsContext/lib.d.ts.map +1 -1
- package/dist/types/lib/propsContext/types.d.ts +1 -2
- package/dist/types/lib/propsContext/types.d.ts.map +1 -1
- package/dist/types/lib/react/getPropsMerger.d.ts.map +1 -1
- package/dist/types/lib/remote/eventHandlerContext.d.ts +11 -0
- package/dist/types/lib/remote/eventHandlerContext.d.ts.map +1 -0
- package/dist/types/lib/remote/types.d.ts +6 -0
- package/dist/types/lib/remote/types.d.ts.map +1 -0
- package/dist/types/lib/remote/useControlledHostValueProps.d.ts +18 -0
- package/dist/types/lib/remote/useControlledHostValueProps.d.ts.map +1 -0
- package/dist/types/lib/remote/useControlledRemoteValueProps.d.ts +11 -0
- package/dist/types/lib/remote/useControlledRemoteValueProps.d.ts.map +1 -0
- package/package.json +5 -4
- package/dist/js/components/src/lib/hooks/useManagedValue.mjs +0 -27
- package/dist/js/components/src/lib/hooks/useManagedValue.mjs.map +0 -1
- package/dist/js/components/src/lib/propsContext/inherit/PropsContextLevelProvider.mjs +0 -20
- package/dist/js/components/src/lib/propsContext/inherit/PropsContextLevelProvider.mjs.map +0 -1
- package/dist/js/components/src/lib/propsContext/inherit/lib.mjs +0 -39
- package/dist/js/components/src/lib/propsContext/inherit/lib.mjs.map +0 -1
- package/dist/js/components/src/lib/propsContext/inherit/propsContextLevel.mjs +0 -13
- package/dist/js/components/src/lib/propsContext/inherit/propsContextLevel.mjs.map +0 -1
- package/dist/js/components/src/lib/propsContext/inherit/types.mjs +0 -6
- package/dist/js/components/src/lib/propsContext/inherit/types.mjs.map +0 -1
- package/dist/js/components/src/lib/react/ReactAriaControlledValueFix.mjs +0 -65
- package/dist/js/components/src/lib/react/ReactAriaControlledValueFix.mjs.map +0 -1
- package/dist/js/components/src/lib/react/emitElementValueChange.mjs +0 -22
- package/dist/js/components/src/lib/react/emitElementValueChange.mjs.map +0 -1
- package/dist/types/lib/hooks/useManagedValue.d.ts +0 -13
- package/dist/types/lib/hooks/useManagedValue.d.ts.map +0 -1
- package/dist/types/lib/propsContext/inherit/PropsContextLevelProvider.d.ts +0 -8
- package/dist/types/lib/propsContext/inherit/PropsContextLevelProvider.d.ts.map +0 -1
- package/dist/types/lib/propsContext/inherit/lib.d.ts +0 -8
- package/dist/types/lib/propsContext/inherit/lib.d.ts.map +0 -1
- package/dist/types/lib/propsContext/inherit/propsContextLevel.d.ts +0 -4
- package/dist/types/lib/propsContext/inherit/propsContextLevel.d.ts.map +0 -1
- package/dist/types/lib/propsContext/inherit/types.d.ts +0 -6
- package/dist/types/lib/propsContext/inherit/types.d.ts.map +0 -1
- package/dist/types/lib/react/ReactAriaControlledValueFix.d.ts +0 -16
- package/dist/types/lib/react/ReactAriaControlledValueFix.d.ts.map +0 -1
- package/dist/types/lib/react/ReactAriaControlledValueFix.test.d.ts +0 -2
- package/dist/types/lib/react/ReactAriaControlledValueFix.test.d.ts.map +0 -1
- package/dist/types/lib/react/emitElementValueChange.d.ts +0 -6
- package/dist/types/lib/react/emitElementValueChange.d.ts.map +0 -1
|
@@ -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
|
|
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
|
-
|
|
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(
|
|
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
|
|
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;;;;"}
|
|
@@ -27,6 +27,11 @@ import '../Badge/Badge.mjs';
|
|
|
27
27
|
import 'mobx';
|
|
28
28
|
import '../../lib/controller/overlay/context.mjs';
|
|
29
29
|
import 'remeda';
|
|
30
|
+
import '../../lib/slotContext/SlotContextProvider.mjs';
|
|
31
|
+
import '../../lib/propsContext/components/ComponentPropsContextProvider.mjs';
|
|
32
|
+
import '../../views/ComponentPropsContextProviderView.mjs';
|
|
33
|
+
import { ClearPropsContext } from '../../lib/propsContext/components/ClearPropsContext.mjs';
|
|
34
|
+
import '../../lib/viewComponentContext/viewComponentContext.mjs';
|
|
30
35
|
import '@react-aria/utils';
|
|
31
36
|
import 'dot-prop';
|
|
32
37
|
import 'recharts';
|
|
@@ -35,12 +40,10 @@ import '../Text/Text.mjs';
|
|
|
35
40
|
import '../Checkbox/Checkbox.mjs';
|
|
36
41
|
import '../CheckboxButton/CheckboxButton.mjs';
|
|
37
42
|
import '../CheckboxGroup/CheckboxGroup.mjs';
|
|
38
|
-
import { ClearPropsContext } from '../../lib/propsContext/components/ClearPropsContext.mjs';
|
|
39
43
|
import 'react-syntax-highlighter';
|
|
40
44
|
import '../CopyButton/CopyButton.mjs';
|
|
41
45
|
import '../ColumnLayout/ColumnLayout.mjs';
|
|
42
46
|
import '../ComboBox/ComboBox.mjs';
|
|
43
|
-
import '../../lib/propsContext/components/ComponentPropsContextProvider.mjs';
|
|
44
47
|
import '../Content/Content.mjs';
|
|
45
48
|
import '../ContextMenu/ContextMenu.mjs';
|
|
46
49
|
import '../MenuItem/MenuItem.mjs';
|
|
@@ -109,6 +112,7 @@ import '../TextArea/TextArea.mjs';
|
|
|
109
112
|
import '../TextField/TextField.mjs';
|
|
110
113
|
import '../TimeField/TimeField.mjs';
|
|
111
114
|
import '../TranslationProvider/TranslationProvider.mjs';
|
|
115
|
+
import '../../lib/remote/eventHandlerContext.mjs';
|
|
112
116
|
|
|
113
117
|
const Tooltip = (props) => {
|
|
114
118
|
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":"
|
|
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 {
|
|
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
|
-
"
|
|
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
|
|
53
|
+
const refWithHotkey = mergeRefs(controller.field.ref, hotkeyRef);
|
|
54
54
|
const fieldProps = {
|
|
55
55
|
...controller.field,
|
|
56
|
-
ref:
|
|
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
|
-
...
|
|
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 {
|
|
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,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,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,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;;;;"}
|
|
@@ -4,7 +4,6 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import { FormContextProvider } from '../context/formContext.mjs';
|
|
5
5
|
import { useState, useId, useMemo, useRef } from 'react';
|
|
6
6
|
import { FormProvider } from 'react-hook-form';
|
|
7
|
-
import { useObjectRef } from '@react-aria/utils';
|
|
8
7
|
import { useRegisterActionStateContext } from './lib/useRegisterActionStateContext.mjs';
|
|
9
8
|
|
|
10
9
|
const DefaultFormComponent = (p) => /* @__PURE__ */ jsx("form", { ...p });
|
|
@@ -21,11 +20,10 @@ function Form(props) {
|
|
|
21
20
|
const [readonlyContextState, setReadOnlyContextState] = useState(!!isReadOnlyFromProps);
|
|
22
21
|
const formId = useId();
|
|
23
22
|
const FormViewComponent = useMemo(() => FormView, [formId]);
|
|
24
|
-
const formRef = useObjectRef(ref);
|
|
25
23
|
const submitButtonRef = useRef(null);
|
|
26
24
|
const isReadOnly = isReadOnlyFromProps || readonlyContextState;
|
|
27
25
|
const { action, registerSubmitResult } = useRegisterActionStateContext(form);
|
|
28
|
-
const
|
|
26
|
+
const handleSubmit = (e) => {
|
|
29
27
|
const { isSubmitting, isValidating } = form.control._formState;
|
|
30
28
|
const formEvent = e && "nativeEvent" in e ? e : void 0;
|
|
31
29
|
formEvent?.stopPropagation();
|
|
@@ -51,7 +49,7 @@ function Form(props) {
|
|
|
51
49
|
id: formId,
|
|
52
50
|
isReadOnly,
|
|
53
51
|
setReadOnly: setReadOnlyContextState,
|
|
54
|
-
submit:
|
|
52
|
+
submit: handleSubmit,
|
|
55
53
|
submitButtonRef,
|
|
56
54
|
formActionModel: action
|
|
57
55
|
},
|
|
@@ -59,9 +57,9 @@ function Form(props) {
|
|
|
59
57
|
FormViewComponent,
|
|
60
58
|
{
|
|
61
59
|
...formProps,
|
|
62
|
-
ref
|
|
60
|
+
ref,
|
|
63
61
|
id: formId,
|
|
64
|
-
onSubmit:
|
|
62
|
+
onSubmit: handleSubmit,
|
|
65
63
|
children
|
|
66
64
|
}
|
|
67
65
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"sourcesContent":["import { FormContextProvider } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport {\n type ComponentProps,\n type FC,\n type FormEvent,\n type FormEventHandler,\n type PropsWithChildren,\n type
|
|
1
|
+
{"version":3,"file":"Form.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"sourcesContent":["import { FormContextProvider } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport {\n type ComponentProps,\n type FC,\n type FormEvent,\n type FormEventHandler,\n type PropsWithChildren,\n type Ref,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type {\n FieldValues,\n SubmitHandler,\n UseFormReturn,\n} from \"react-hook-form\";\nimport { FormProvider as RhfFormContextProvider } from \"react-hook-form\";\nimport { useRegisterActionStateContext } from \"@/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext\";\n\nexport type FormOnSubmitHandler<F extends FieldValues> = SubmitHandler<F>;\n\ntype FormComponentType = FC<\n PropsWithChildren<{\n id: string;\n onSubmit?: FormEventHandler | FormOnSubmitHandler<never>;\n ref?: Ref<HTMLFormElement>;\n }>\n>;\n\nexport interface FormProps<F extends FieldValues>\n extends Omit<ComponentProps<\"form\">, \"onSubmit\">,\n PropsWithChildren {\n form: UseFormReturn<F>;\n onSubmit: FormOnSubmitHandler<F>;\n formComponent?: FC<Omit<FormComponentType, \"ref\">>;\n isReadOnly?: boolean;\n}\n\nconst DefaultFormComponent: FormComponentType = (p) => <form {...p} />;\n\nexport function Form<F extends FieldValues>(props: FormProps<F>) {\n const {\n form,\n children,\n onSubmit,\n formComponent: FormView = DefaultFormComponent,\n isReadOnly: isReadOnlyFromProps,\n ref,\n ...formProps\n } = props;\n\n const [readonlyContextState, setReadOnlyContextState] =\n useState(!!isReadOnlyFromProps);\n\n const formId = useId();\n const FormViewComponent = useMemo(() => FormView, [formId]);\n\n const submitButtonRef = useRef<HTMLButtonElement>(null);\n\n const isReadOnly = isReadOnlyFromProps || readonlyContextState;\n const { action, registerSubmitResult } = useRegisterActionStateContext(form);\n\n const handleSubmit = (e?: FormEvent<HTMLFormElement> | F) => {\n const { isSubmitting, isValidating } = form.control._formState;\n const formEvent =\n e && \"nativeEvent\" in e ? (e as FormEvent<HTMLFormElement>) : undefined;\n\n formEvent?.stopPropagation();\n\n if (isSubmitting || isValidating) {\n formEvent?.preventDefault();\n return;\n }\n\n const submit = form.handleSubmit((values) => {\n setReadOnlyContextState(true);\n const result = onSubmit(values, formEvent);\n registerSubmitResult(result);\n return result;\n });\n\n return submit(formEvent).finally(() => {\n setReadOnlyContextState(false);\n });\n };\n\n return (\n <RhfFormContextProvider {...form}>\n <FormContextProvider\n value={{\n form,\n id: formId,\n isReadOnly,\n setReadOnly: setReadOnlyContextState,\n submit: handleSubmit,\n submitButtonRef: submitButtonRef,\n formActionModel: action,\n }}\n >\n <FormViewComponent\n {...formProps}\n ref={ref}\n id={formId}\n onSubmit={handleSubmit}\n >\n {children}\n </FormViewComponent>\n </FormContextProvider>\n </RhfFormContextProvider>\n );\n}\n\nexport default Form;\n"],"names":["RhfFormContextProvider"],"mappings":";;;;;;AAwCA,MAAM,uBAA0C,CAAC,CAAA,qBAAM,GAAA,CAAC,MAAA,EAAA,EAAM,GAAG,CAAA,EAAG,CAAA;AAE7D,SAAS,KAA4B,KAAA,EAAqB;AAC/D,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AA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AK,CAAA;AAAA,IAC/B,CAAC,CAAA;AAAA,EACH,CAAA;AAEA,EAAA,uBACE,GAAA,CAACA,YAAA,EAAA,EAAwB,GAAG,IAAA,EAC1B,QAAA,kBAAA,GAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO;AAAA,QACL,IAAA;AAAA,QACA,EAAA,EAAI,MAAA;AAAA,QACJ,UAAA;AAAA,QACA,WAAA,EAAa,uBAAA;AAAA,QACb,MAAA,EAAQ,YAAA;AAAA,QACR,eAAA;AAAA,QACA,eAAA,EAAiB;AAAA,OACnB;AAAA,MAEA,QAAA,kBAAA,GAAA;AAAA,QAAC,iBAAA;AAAA,QAAA;AAAA,UACE,GAAG,SAAA;AAAA,UACJ,GAAA;AAAA,UACA,EAAA,EAAI,MAAA;AAAA,UACJ,QAAA,EAAU,YAAA;AAAA,UAET;AAAA;AAAA;AACH;AAAA,GACF,EACF,CAAA;AAEJ;;;;"}
|
package/dist/js/components/src/integrations/react-hook-form/components/ResetButton/ResetButton.mjs
CHANGED
|
@@ -8,10 +8,9 @@ import '../../../../lib/propsContext/propsContext.mjs';
|
|
|
8
8
|
import '../../../../lib/propsContext/components/PropsContextProvider.mjs';
|
|
9
9
|
import { useMemo } from 'react';
|
|
10
10
|
import 'react-hook-form';
|
|
11
|
+
import 'react-hotkeys-hook';
|
|
11
12
|
import 'react-aria';
|
|
12
13
|
import '../../../../views/FieldErrorView.mjs';
|
|
13
|
-
import 'react-hotkeys-hook';
|
|
14
|
-
import 'use-callback-ref';
|
|
15
14
|
import '@react-aria/utils';
|
|
16
15
|
import 'mobx';
|
|
17
16
|
import '../../../../lib/controller/overlay/context.mjs';
|
|
@@ -39,7 +38,6 @@ const ResetButton = flowComponent("ResetButton", (props) => {
|
|
|
39
38
|
...rest,
|
|
40
39
|
ref,
|
|
41
40
|
isReadOnly: actionState === "isExecuting" || actionState === "isPending",
|
|
42
|
-
type: "reset",
|
|
43
41
|
onPress: () => form.reset(),
|
|
44
42
|
form: formId,
|
|
45
43
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResetButton.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/ResetButton/ResetButton.tsx"],"sourcesContent":["import { Button, type ButtonProps } from \"@/components/Button\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useFormContext } from \"@/integrations/react-hook-form\";\nimport { type FC, useMemo } from \"react\";\n\nexport type ResetButtonProps = Omit<\n ButtonProps,\n \"isFailed\" | \"isSucceeded\" | \"isPending\" | \"isReadOnly\" | \"type\"\n> & {\n buttonComponent?: FC<Omit<ButtonProps, \"ref\">>;\n};\n\nexport const ResetButton = flowComponent(\"ResetButton\", (props) => {\n const {\n children,\n ref,\n buttonComponent: ButtonComponent = Button,\n ...rest\n } = props;\n\n const { id: formId = props.form, form, formActionModel } = useFormContext();\n\n const ButtonViewComponent = useMemo(() => ButtonComponent, [formId]);\n const actionState = formActionModel.state.useValue();\n\n return (\n <ButtonViewComponent\n color=\"secondary\"\n variant=\"soft\"\n {...rest}\n ref={ref}\n isReadOnly={actionState === \"isExecuting\" || actionState === \"isPending\"}\n
|
|
1
|
+
{"version":3,"file":"ResetButton.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/ResetButton/ResetButton.tsx"],"sourcesContent":["import { Button, type ButtonProps } from \"@/components/Button\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useFormContext } from \"@/integrations/react-hook-form\";\nimport { type FC, useMemo } from \"react\";\n\nexport type ResetButtonProps = Omit<\n ButtonProps,\n \"isFailed\" | \"isSucceeded\" | \"isPending\" | \"isReadOnly\" | \"type\"\n> & {\n buttonComponent?: FC<Omit<ButtonProps, \"ref\">>;\n};\n\nexport const ResetButton = flowComponent(\"ResetButton\", (props) => {\n const {\n children,\n ref,\n buttonComponent: ButtonComponent = Button,\n ...rest\n } = props;\n\n const { id: formId = props.form, form, formActionModel } = useFormContext();\n\n const ButtonViewComponent = useMemo(() => ButtonComponent, [formId]);\n const actionState = formActionModel.state.useValue();\n\n return (\n <ButtonViewComponent\n color=\"secondary\"\n variant=\"soft\"\n {...rest}\n ref={ref}\n isReadOnly={actionState === \"isExecuting\" || actionState === \"isPending\"}\n onPress={() => form.reset()}\n form={formId}\n >\n {children}\n </ButtonViewComponent>\n );\n});\n\nexport default ResetButton;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAYO,MAAM,WAAA,GAAc,aAAA,CAAc,aAAA,EAAe,CAAC,KAAA,KAAU;AACjE,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,GAAA;AAAA,IACA,iBAAiB,eAAA,GAAkB,MAAA;AAAA,IACnC,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,EAAE,IAAI,MAAA,GAAS,KAAA,CAAM,MAAM,IAAA,EAAM,eAAA,KAAoB,cAAA,EAAe;AAE1E,EAAA,MAAM,sBAAsB,OAAA,CAAQ,MAAM,eAAA,EAAiB,CAAC,MAAM,CAAC,CAAA;AACnE,EAAA,MAAM,WAAA,GAAc,eAAA,CAAgB,KAAA,CAAM,QAAA,EAAS;AAEnD,EAAA,uBACE,GAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAM,WAAA;AAAA,MACN,OAAA,EAAQ,MAAA;AAAA,MACP,GAAG,IAAA;AAAA,MACJ,GAAA;AAAA,MACA,UAAA,EAAY,WAAA,KAAgB,aAAA,IAAiB,WAAA,KAAgB,WAAA;AAAA,MAC7D,OAAA,EAAS,MAAM,IAAA,CAAK,KAAA,EAAM;AAAA,MAC1B,IAAA,EAAM,MAAA;AAAA,MAEL;AAAA;AAAA,GACH;AAEJ,CAAC;;;;"}
|
package/dist/js/components/src/integrations/react-hook-form/components/SubmitButton/SubmitButton.mjs
CHANGED
|
@@ -8,10 +8,9 @@ import '../../../../lib/propsContext/propsContext.mjs';
|
|
|
8
8
|
import '../../../../lib/propsContext/components/PropsContextProvider.mjs';
|
|
9
9
|
import { useMemo } from 'react';
|
|
10
10
|
import 'react-hook-form';
|
|
11
|
+
import 'react-hotkeys-hook';
|
|
11
12
|
import 'react-aria';
|
|
12
13
|
import '../../../../views/FieldErrorView.mjs';
|
|
13
|
-
import 'react-hotkeys-hook';
|
|
14
|
-
import { useMergeRefs } from 'use-callback-ref';
|
|
15
14
|
import { useObjectRef } from '@react-aria/utils';
|
|
16
15
|
import 'mobx';
|
|
17
16
|
import '../../../../lib/controller/overlay/context.mjs';
|
|
@@ -22,6 +21,7 @@ import 'remeda';
|
|
|
22
21
|
import '../ResetButton/ResetButton.mjs';
|
|
23
22
|
import { Action } from '../../../../components/Action/Action.mjs';
|
|
24
23
|
import '@react-aria/live-announcer';
|
|
24
|
+
import { useMergeRefs } from 'use-callback-ref';
|
|
25
25
|
|
|
26
26
|
const SubmitButton = flowComponent(
|
|
27
27
|
"SubmitButton",
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
import { memo,
|
|
4
|
+
import { memo, cloneElement } from 'react';
|
|
5
5
|
import { TunnelEntry } from '@mittwald/react-tunnel';
|
|
6
6
|
import { SlotContextProvider } from '../slotContext/SlotContextProvider.mjs';
|
|
7
7
|
import { useProps } from '../hooks/useProps.mjs';
|
|
8
8
|
import { useComponentPropsContext } from '../propsContext/propsContext.mjs';
|
|
9
|
-
import { increaseNestingLevel } from '../propsContext/nestedPropsContext/lib.mjs';
|
|
10
9
|
import { ComponentPropsContextProvider } from '../propsContext/components/ComponentPropsContextProvider.mjs';
|
|
11
10
|
import ComponentPropsContextProviderView from '../../views/ComponentPropsContextProviderView.mjs';
|
|
11
|
+
import { ClearPropsContext } from '../propsContext/components/ClearPropsContext.mjs';
|
|
12
12
|
|
|
13
13
|
function flowComponent(componentName, ImplementationComponentType, options = {}) {
|
|
14
14
|
const { type = "ui", isRemoteComponent = false } = options;
|
|
15
|
-
const propsContextLevelMode = type === "ui" ? "increment" : "keep";
|
|
16
15
|
const MemoizedImplementationComponentType = memo(ImplementationComponentType);
|
|
17
16
|
function Component(props) {
|
|
18
17
|
const { tunnelId, wrapWith, ...propsWithContext } = useProps(
|
|
@@ -21,30 +20,15 @@ function flowComponent(componentName, ImplementationComponentType, options = {})
|
|
|
21
20
|
);
|
|
22
21
|
const implementationTypeProps = propsWithContext;
|
|
23
22
|
const componentProps = useComponentPropsContext(componentName);
|
|
24
|
-
const componentPropsToUse = useMemo(
|
|
25
|
-
() => increaseNestingLevel(componentProps ?? {}),
|
|
26
|
-
[componentProps]
|
|
27
|
-
);
|
|
28
23
|
ImplementationComponentType.displayName = `FlowComponentImpl(${componentName})`;
|
|
29
24
|
let element = /* @__PURE__ */ jsx(MemoizedImplementationComponentType, { ...implementationTypeProps });
|
|
30
25
|
if (isRemoteComponent) {
|
|
31
|
-
element = /* @__PURE__ */ jsx(
|
|
32
|
-
ComponentPropsContextProvider,
|
|
33
|
-
{
|
|
34
|
-
componentProps: componentPropsToUse,
|
|
35
|
-
levelModel: propsContextLevelMode,
|
|
36
|
-
children: element
|
|
37
|
-
}
|
|
38
|
-
);
|
|
26
|
+
element = /* @__PURE__ */ jsx(ComponentPropsContextProvider, { componentProps, children: element });
|
|
39
27
|
} else {
|
|
40
|
-
element = /* @__PURE__ */ jsx(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
levelModel: propsContextLevelMode,
|
|
45
|
-
children: element
|
|
46
|
-
}
|
|
47
|
-
);
|
|
28
|
+
element = /* @__PURE__ */ jsx(ComponentPropsContextProviderView, { componentProps, children: element });
|
|
29
|
+
}
|
|
30
|
+
if (type === "ui") {
|
|
31
|
+
element = /* @__PURE__ */ jsx(ClearPropsContext, { children: element });
|
|
48
32
|
}
|
|
49
33
|
if ("slot" in props && !!props.slot && typeof props.slot === "string") {
|
|
50
34
|
element = /* @__PURE__ */ jsx(SlotContextProvider, { slot: props.slot, component: componentName, children: element });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowComponent.mjs","sources":["../../../../../../src/lib/componentFactory/flowComponent.tsx"],"sourcesContent":["import type {\n FlowComponentName,\n FlowComponentProps as FlowComponentPropsOfName,\n} from \"@/components/propTypes\";\nimport type {\n ComponentProps,\n ComponentType,\n ReactElement,\n ReactNode,\n RefAttributes,\n FunctionComponent,\n} from \"react\";\nimport { cloneElement, memo
|
|
1
|
+
{"version":3,"file":"flowComponent.mjs","sources":["../../../../../../src/lib/componentFactory/flowComponent.tsx"],"sourcesContent":["import type {\n FlowComponentName,\n FlowComponentProps as FlowComponentPropsOfName,\n} from \"@/components/propTypes\";\nimport type {\n ComponentProps,\n ComponentType,\n ReactElement,\n ReactNode,\n RefAttributes,\n FunctionComponent,\n} from \"react\";\nimport { cloneElement, memo } from \"react\";\nimport type { PropsWithTunnel } from \"@/lib/types/props\";\nimport { TunnelEntry } from \"@mittwald/react-tunnel\";\nimport SlotContextProvider from \"@/lib/slotContext/SlotContextProvider\";\nimport { useProps } from \"@/lib/hooks/useProps\";\nimport { useComponentPropsContext } from \"@/lib/propsContext/propsContext\";\nimport { ComponentPropsContextProvider } from \"@/components/ComponentPropsContextProvider\";\nimport ComponentPropsContextProviderView from \"@/views/ComponentPropsContextProviderView\";\nimport { ClearPropsContext } from \"@/components/ClearPropsContext\";\n\ntype RefType<T> = T extends RefAttributes<infer R> ? R : undefined;\n\nexport interface FlowComponentProps<R = HTMLDivElement>\n extends PropsWithTunnel,\n RefAttributes<R> {\n wrapWith?: ReactElement;\n}\n\ntype FlowComponentImplementationProps<C extends FlowComponentName> = Omit<\n FlowComponentPropsOfName<C>,\n keyof FlowComponentProps\n> &\n RefAttributes<RefType<FlowComponentPropsOfName<C>>>;\n\ntype FlowComponentImplementationType<C extends FlowComponentName> =\n ComponentType<FlowComponentImplementationProps<C>>;\n\ntype FlowComponentType<C extends FlowComponentName> = FunctionComponent<\n FlowComponentPropsOfName<C> &\n RefAttributes<RefType<FlowComponentPropsOfName<C>>>\n>;\n\nexport type FlowComponentProvisionType = \"provider\" | \"ui\" | \"layout\";\n\ninterface Options {\n type?: FlowComponentProvisionType;\n isRemoteComponent?: boolean;\n}\n\nexport function flowComponent<C extends FlowComponentName>(\n componentName: C,\n ImplementationComponentType: FlowComponentImplementationType<C>,\n options: Options = {},\n): FlowComponentType<C> {\n type Props = FlowComponentPropsOfName<C> &\n RefAttributes<RefType<FlowComponentPropsOfName<C>>>;\n\n const { type = \"ui\", isRemoteComponent = false } = options;\n\n const MemoizedImplementationComponentType = memo(ImplementationComponentType);\n\n function Component(props: Props) {\n const { tunnelId, wrapWith, ...propsWithContext } = useProps(\n componentName,\n props as FlowComponentPropsOfName<C>,\n ) as FlowComponentProps<RefType<FlowComponentPropsOfName<C>>>;\n\n const implementationTypeProps = propsWithContext as ComponentProps<\n typeof ImplementationComponentType\n >;\n\n const componentProps = useComponentPropsContext(componentName);\n\n ImplementationComponentType.displayName = `FlowComponentImpl(${componentName})`;\n\n let element: ReactNode = (\n <MemoizedImplementationComponentType {...implementationTypeProps} />\n );\n\n if (isRemoteComponent) {\n element = (\n <ComponentPropsContextProvider componentProps={componentProps}>\n {element}\n </ComponentPropsContextProvider>\n );\n } else {\n /**\n * In case of a Flow component that does not have a remote counterpart\n * (like the List component), the ComponentPropsContext must be applied on\n * the host side, so that nesting and inheritance is working correctly.\n */\n element = (\n <ComponentPropsContextProviderView componentProps={componentProps}>\n {element}\n </ComponentPropsContextProviderView>\n );\n }\n\n if (type === \"ui\") {\n element = <ClearPropsContext>{element}</ClearPropsContext>;\n }\n\n if (\"slot\" in props && !!props.slot && typeof props.slot === \"string\") {\n element = (\n <SlotContextProvider slot={props.slot} component={componentName}>\n {element}\n </SlotContextProvider>\n );\n }\n\n if (wrapWith) {\n element = cloneElement(wrapWith, undefined, element);\n }\n\n if (tunnelId) {\n element = <TunnelEntry id={tunnelId}>{element}</TunnelEntry>;\n }\n return element;\n }\n\n Component.displayName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M,MAAM,IAAA,EAAM,SAAA,EAAW,eAC/C,QAAA,EAAA,OAAA,EACH,CAAA;AAAA,IAEJ;AAEA,IAAA,IAAI,QAAA,EAAU;AACZ,MAAA,OAAA,GAAU,YAAA,CAAa,QAAA,EAAU,MAAA,EAAW,OAAO,CAAA;AAAA,IACrD;AAEA,IAAA,IAAI,QAAA,EAAU;AACZ,MAAA,OAAA,mBAAU,GAAA,CAAC,WAAA,EAAA,EAAY,EAAA,EAAI,QAAA,EAAW,QAAA,EAAA,OAAA,EAAQ,CAAA;AAAA,IAChD;AACA,IAAA,OAAO,OAAA;AAAA,EACT;AAEA,EAAA,SAAA,CAAU,WAAA,GAAc,iBAAiB,aAAa,CAAA,CAAA,CAAA;AACtD,EAAA,OAAO,KAAK,SAAS,CAAA;AACvB;;;;"}
|
|
@@ -46,10 +46,16 @@ class OverlayController {
|
|
|
46
46
|
this.onOpenHandlers.forEach((handler) => handler());
|
|
47
47
|
}
|
|
48
48
|
open() {
|
|
49
|
+
if (this.isOpen) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
49
52
|
this.isOpen = true;
|
|
50
53
|
this.executeOnOpen();
|
|
51
54
|
}
|
|
52
55
|
close() {
|
|
56
|
+
if (!this.isOpen) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
53
59
|
this.isOpen = false;
|
|
54
60
|
this.executeOnClose();
|
|
55
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayController.mjs","sources":["../../../../../../../src/lib/controller/overlay/OverlayController.ts"],"sourcesContent":["import { action, makeObservable, observable } from \"mobx\";\nimport useSelector from \"@/lib/mobx/useSelector\";\nimport { useStatic } from \"@/lib/hooks/useStatic\";\n\ntype OpenStateHandler = () => void;\ntype DisposerFn = () => void;\n\nexport interface OverlayControllerOptions {\n isDefaultOpen?: boolean;\n onOpen?: OpenStateHandler;\n onClose?: OpenStateHandler;\n}\n\nexport class OverlayController {\n public isOpen = false;\n private onOpenHandlers = new Set<OpenStateHandler>();\n private onCloseHandlers = new Set<OpenStateHandler>();\n\n public constructor(options?: OverlayControllerOptions) {\n makeObservable(this, {\n isOpen: observable,\n open: action.bound,\n close: action.bound,\n toggle: action.bound,\n setOpen: action.bound,\n });\n this.isOpen = options?.isDefaultOpen ?? false;\n\n if (options?.onOpen) {\n this.onOpenHandlers.add(options.onOpen);\n }\n if (options?.onClose) {\n this.onCloseHandlers.add(options.onClose);\n }\n }\n\n public static useNew(options?: OverlayControllerOptions): OverlayController {\n return useStatic(() => new OverlayController(options));\n }\n\n public addOnOpen(handler: OpenStateHandler): DisposerFn {\n this.onOpenHandlers.add(handler);\n return () => {\n this.onOpenHandlers.delete(handler);\n };\n }\n\n public addOnClose(handler: OpenStateHandler): DisposerFn {\n this.onCloseHandlers.add(handler);\n return () => {\n this.onCloseHandlers.delete(handler);\n };\n }\n\n private executeOnClose(): void {\n this.onCloseHandlers.forEach((handler) => handler());\n }\n\n private executeOnOpen(): void {\n this.onOpenHandlers.forEach((handler) => handler());\n }\n\n public open(): void {\n this.isOpen = true;\n this.executeOnOpen();\n }\n\n public close(): void {\n this.isOpen = false;\n this.executeOnClose();\n }\n\n public toggle(): void {\n this.isOpen = !this.isOpen;\n\n if (this.isOpen) {\n this.executeOnOpen();\n } else {\n this.executeOnClose();\n }\n }\n\n public setOpen(to: boolean): void {\n this.isOpen = to;\n\n if (to) {\n this.executeOnOpen();\n } else {\n this.executeOnClose();\n }\n }\n\n public useIsOpen(): boolean {\n return useSelector(() => this.isOpen);\n }\n}\n"],"names":[],"mappings":";;;;AAaO,MAAM,iBAAA,CAAkB;AAAA,EACtB,MAAA,GAAS,KAAA;AAAA,EACR,cAAA,uBAAqB,GAAA,EAAsB;AAAA,EAC3C,eAAA,uBAAsB,GAAA,EAAsB;AAAA,EAE7C,YAAY,OAAA,EAAoC;AACrD,IAAA,cAAA,CAAe,IAAA,EAAM;AAAA,MACnB,MAAA,EAAQ,UAAA;AAAA,MACR,MAAM,MAAA,CAAO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A,CAAK,MAAA,GAAS,IAAA;AACd,IAAA,IAAA,CAAK,aAAA,EAAc;AAAA,EACrB;AAAA,EAEO,KAAA,GAAc;AACnB,IAAA,IAAA,CAAK,MAAA,GAAS,KAAA;AACd,IAAA,IAAA,CAAK,cAAA,EAAe;AAAA,EACtB;AAAA,EAEO,MAAA,GAAe;AACpB,IAAA,IAAA,CAAK,MAAA,GAAS,CAAC,IAAA,CAAK,MAAA;AAEpB,IAAA,IAAI,KAAK,MAAA,EAAQ;AACf,MAAA,IAAA,CAAK,aAAA,EAAc;AAAA,IACrB,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,cAAA,EAAe;AAAA,IACtB;AAAA,EACF;AAAA,EAEO,QAAQ,EAAA,EAAmB;AAChC,IAAA,IAAA,CAAK,MAAA,GAAS,EAAA;AAEd,IAAA,IAAI,EAAA,EAAI;AACN,MAAA,IAAA,CAAK,aAAA,EAAc;AAAA,IACrB,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,cAAA,EAAe;AAAA,IACtB;AAAA,EACF;AAAA,EAEO,SAAA,GAAqB;AAC1B,IAAA,OAAO,WAAA,CAAY,MAAM,IAAA,CAAK,MAAM,CAAA;AAAA,EACtC;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"OverlayController.mjs","sources":["../../../../../../../src/lib/controller/overlay/OverlayController.ts"],"sourcesContent":["import { action, makeObservable, observable } from \"mobx\";\nimport useSelector from \"@/lib/mobx/useSelector\";\nimport { useStatic } from \"@/lib/hooks/useStatic\";\n\ntype OpenStateHandler = () => void;\ntype DisposerFn = () => void;\n\nexport interface OverlayControllerOptions {\n isDefaultOpen?: boolean;\n onOpen?: OpenStateHandler;\n onClose?: OpenStateHandler;\n}\n\nexport class OverlayController {\n public isOpen = false;\n private onOpenHandlers = new Set<OpenStateHandler>();\n private onCloseHandlers = new Set<OpenStateHandler>();\n\n public constructor(options?: OverlayControllerOptions) {\n makeObservable(this, {\n isOpen: observable,\n open: action.bound,\n close: action.bound,\n toggle: action.bound,\n setOpen: action.bound,\n });\n this.isOpen = options?.isDefaultOpen ?? false;\n\n if (options?.onOpen) {\n this.onOpenHandlers.add(options.onOpen);\n }\n if (options?.onClose) {\n this.onCloseHandlers.add(options.onClose);\n }\n }\n\n public static useNew(options?: OverlayControllerOptions): OverlayController {\n return useStatic(() => new OverlayController(options));\n }\n\n public addOnOpen(handler: OpenStateHandler): DisposerFn {\n this.onOpenHandlers.add(handler);\n return () => {\n this.onOpenHandlers.delete(handler);\n };\n }\n\n public addOnClose(handler: OpenStateHandler): DisposerFn {\n this.onCloseHandlers.add(handler);\n return () => {\n this.onCloseHandlers.delete(handler);\n };\n }\n\n private executeOnClose(): void {\n this.onCloseHandlers.forEach((handler) => handler());\n }\n\n private executeOnOpen(): void {\n this.onOpenHandlers.forEach((handler) => handler());\n }\n\n public open(): void {\n if (this.isOpen) {\n return;\n }\n this.isOpen = true;\n this.executeOnOpen();\n }\n\n public close(): void {\n if (!this.isOpen) {\n return;\n }\n this.isOpen = false;\n this.executeOnClose();\n }\n\n public toggle(): void {\n this.isOpen = !this.isOpen;\n\n if (this.isOpen) {\n this.executeOnOpen();\n } else {\n this.executeOnClose();\n }\n }\n\n public setOpen(to: boolean): void {\n this.isOpen = to;\n\n if (to) {\n this.executeOnOpen();\n } else {\n this.executeOnClose();\n }\n }\n\n public useIsOpen(): boolean {\n return useSelector(() => this.isOpen);\n }\n}\n"],"names":[],"mappings":";;;;AAaO,MAAM,iBAAA,CAAkB;AAAA,EACtB,MAAA,GAAS,KAAA;AAAA,EACR,cAAA,uBAAqB,GAAA,EAAsB;AAAA,EAC3C,eAAA,uBAAsB,GAAA,EAAsB;AAAA,EAE7C,YAAY,OAAA,EAAoC;AACrD,IAAA,cAAA,CAAe,IAAA,EAAM;AAAA,MACnB,MAAA,EAAQ,UAAA;AAAA,MACR,MAAM,MAAA,CAAO,KAAA;AAAA,MACb,OAAO,MAAA,CAAO,KAAA;AAAA,MACd,QAAQ,MAAA,CAAO,KAAA;A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AAA;AACd,IAAA,IAAA,CAAK,aAAA,EAAc;AAAA,EACrB;AAAA,EAEO,KAAA,GAAc;AACnB,IAAA,IAAI,CAAC,KAAK,MAAA,EAAQ;AAChB,MAAA;AAAA,IACF;AACA,IAAA,IAAA,CAAK,MAAA,GAAS,KAAA;AACd,IAAA,IAAA,CAAK,cAAA,EAAe;AAAA,EACtB;AAAA,EAEO,MAAA,GAAe;AACpB,IAAA,IAAA,CAAK,MAAA,GAAS,CAAC,IAAA,CAAK,MAAA;AAEpB,IAAA,IAAI,KAAK,MAAA,EAAQ;AACf,MAAA,IAAA,CAAK,aAAA,EAAc;AAAA,IACrB,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,cAAA,EAAe;AAAA,IACtB;AAAA,EACF;AAAA,EAEO,QAAQ,EAAA,EAAmB;AAChC,IAAA,IAAA,CAAK,MAAA,GAAS,EAAA;AAEd,IAAA,IAAI,EAAA,EAAI;AACN,MAAA,IAAA,CAAK,aAAA,EAAc;AAAA,IACrB,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,cAAA,EAAe;AAAA,IACtB;AAAA,EACF;AAAA,EAEO,SAAA,GAAqB;AAC1B,IAAA,OAAO,WAAA,CAAY,MAAM,IAAA,CAAK,MAAM,CAAA;AAAA,EACtC;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isFocused.mjs","sources":["../../../../../../src/lib/form/isFocused.ts"],"sourcesContent":["export const isFocused = (element: HTMLElement | null) => {\n return element?.getAttribute(\"data-focused\") === \"true\";\n};\n"],"names":[],"mappings":"AAAO,MAAM,SAAA,GAAY,CAAC,OAAA,KAAgC;AACxD,EAAA,OAAO,OAAA,EAAS,YAAA,CAAa,cAAc,CAAA,KAAM,MAAA;AACnD;;;;"}
|
|
@@ -108,6 +108,7 @@ import '../../components/TextArea/TextArea.mjs';
|
|
|
108
108
|
import '../../components/TextField/TextField.mjs';
|
|
109
109
|
import '../../components/TimeField/TimeField.mjs';
|
|
110
110
|
import '../../components/TranslationProvider/TranslationProvider.mjs';
|
|
111
|
+
import '../remote/eventHandlerContext.mjs';
|
|
111
112
|
|
|
112
113
|
const useFieldError = (tunnelIdFromProps) => {
|
|
113
114
|
const id = useId();
|
|
@@ -115,7 +116,6 @@ const useFieldError = (tunnelIdFromProps) => {
|
|
|
115
116
|
const tunnelId = currentTunnelId ?? `${id}.fieldError`;
|
|
116
117
|
const fieldErrorCapturePropsContext = {
|
|
117
118
|
FieldError: {
|
|
118
|
-
___inherit: "preserve",
|
|
119
119
|
tunnelId,
|
|
120
120
|
className: formFieldStyles.fieldError
|
|
121
121
|
}
|
|
@@ -125,7 +125,6 @@ const useFieldError = (tunnelIdFromProps) => {
|
|
|
125
125
|
return /* @__PURE__ */ jsx(
|
|
126
126
|
PropsContextProvider,
|
|
127
127
|
{
|
|
128
|
-
levelMode: "keep",
|
|
129
128
|
props: fieldErrorCapturePropsContext,
|
|
130
129
|
dependencies: [tunnelId],
|
|
131
130
|
children: props.children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFieldError.mjs","sources":["../../../../../../src/lib/hooks/useFieldError.tsx"],"sourcesContent":["import React, { type FC, type PropsWithChildren, useId, useMemo } from \"react\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { TunnelExit } from \"@mittwald/react-tunnel\";\nimport ClearPropsContext from \"@/lib/propsContext/components/ClearPropsContext\";\nimport { useProps } from \"@/index/default\";\n\nexport const useFieldError = (tunnelIdFromProps?: string) => {\n const id = useId();\n const currentTunnelId = useProps(\"FieldError\", {}).tunnelId;\n const tunnelId = tunnelIdFromProps ?? currentTunnelId ?? `${id}.fieldError`;\n\n const fieldErrorCapturePropsContext: PropsContext = {\n FieldError: {\n
|
|
1
|
+
{"version":3,"file":"useFieldError.mjs","sources":["../../../../../../src/lib/hooks/useFieldError.tsx"],"sourcesContent":["import React, { type FC, type PropsWithChildren, useId, useMemo } from \"react\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { TunnelExit } from \"@mittwald/react-tunnel\";\nimport ClearPropsContext from \"@/lib/propsContext/components/ClearPropsContext\";\nimport { useProps } from \"@/index/default\";\n\nexport const useFieldError = (tunnelIdFromProps?: string) => {\n const id = useId();\n const currentTunnelId = useProps(\"FieldError\", {}).tunnelId;\n const tunnelId = tunnelIdFromProps ?? currentTunnelId ?? `${id}.fieldError`;\n\n const fieldErrorCapturePropsContext: PropsContext = {\n FieldError: {\n tunnelId,\n className: formFieldStyles.fieldError,\n },\n };\n\n const FieldErrorCaptureContext: FC<PropsWithChildren> = useMemo(\n () => (props) => {\n return (\n <PropsContextProvider\n props={fieldErrorCapturePropsContext}\n dependencies={[tunnelId]}\n >\n {props.children}\n </PropsContextProvider>\n );\n },\n [tunnelId],\n );\n\n const FieldErrorView = () => {\n if (currentTunnelId) {\n return null;\n }\n\n return (\n <TunnelExit id={tunnelId}>\n {(children) => {\n const childrenArray = React.Children.toArray(children);\n return <ClearPropsContext>{childrenArray[0]}</ClearPropsContext>;\n }}\n </TunnelExit>\n );\n };\n\n return {\n FieldErrorCaptureContext,\n FieldErrorView,\n } as const;\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,MAAM,aAAA,GAAgB,CAAC,iBAAA,KAA+B;AAC3D,EAAA,MAAM,KAAK,KAAA,EAAM;AACjB,EAAA,MAAM,eAAA,GAAkB,QAAA,CAAS,YAAA,EAAc,EAAE,CAAA,CAAE,QAAA;AACnD,EAAA,MAAM,QAAA,GAAgC,eAAA,IAAmB,CAAA,EAAG,EAAE,CAAA,WAAA,CAAA;AAE9D,EAAA,MAAM,6BAAA,GAA8C;AAAA,IAClD,UAAA,EAAY;AAAA,MACV,QAAA;AAAA,MACA,WAAW,eAAA,CAAgB;AAAA;AAC7B,GACF;AAEA,EAAA,MAAM,wBAAA,GAAkD,OAAA;AAAA,IACtD,MAAM,CAAC,KAAA,KAAU;AACf,MAAA,uBACE,GAAA;AAAA,QAAC,oBAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO,6BAAA;AAAA,UACP,YAAA,EAAc,CAAC,QAAQ,CAAA;AAAA,UAEtB,QAAA,EAAA,KAAA,CAAM;AAAA;AAAA,OACT;AAAA,IAEJ,CAAA;AAAA,IACA,CAAC,QAAQ;AAAA,GACX;AAEA,EAAA,MAAM,iBAAiB,MAAM;AAC3B,IAAA,IAAI,eAAA,EAAiB;AACnB,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,uBACE,GAAA,CAAC,UAAA,EAAA,EAAW,EAAA,EAAI,QAAA,EACb,WAAC,QAAA,KAAa;AACb,MAAA,MAAM,aAAA,GAAgB,KAAA,CAAM,QAAA,CAAS,OAAA,CAAQ,QAAQ,CAAA;AACrD,MAAA,uBAAO,GAAA,CAAC,iBAAA,EAAA,EAAmB,QAAA,EAAA,aAAA,CAAc,CAAC,CAAA,EAAE,CAAA;AAAA,IAC9C,CAAA,EACF,CAAA;AAAA,EAEJ,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,wBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -5,7 +5,6 @@ import { useComponentPropsContext } from '../propsContext/propsContext.mjs';
|
|
|
5
5
|
import { omitBy } from 'remeda';
|
|
6
6
|
import { isDynamicProp } from '../propsContext/dynamicProps/lib.mjs';
|
|
7
7
|
import { isFlowComponentName } from '../propsContext/isFlowComponentName.mjs';
|
|
8
|
-
import { isInheritedPropsContextKey } from '../propsContext/inherit/lib.mjs';
|
|
9
8
|
import { areChildrenEmpty } from '../react/areChildrenEmpty.mjs';
|
|
10
9
|
import { isNestingLevelKey } from '../propsContext/nestedPropsContext/lib.mjs';
|
|
11
10
|
import { getPropsMerger } from '../react/getPropsMerger.mjs';
|
|
@@ -28,7 +27,7 @@ const useProps = (component, localProps) => {
|
|
|
28
27
|
const withResolvedDynamicProps = componentPropsContext ? resolveDynamicProps(componentPropsContext, localProps) : void 0;
|
|
29
28
|
const withoutInternalProps = componentPropsContext ? omitBy(
|
|
30
29
|
componentPropsContext,
|
|
31
|
-
(value, key) => isFlowComponentName(key) ||
|
|
30
|
+
(value, key) => isFlowComponentName(key) || isNestingLevelKey(key) || isDynamicProp(value)
|
|
32
31
|
) : void 0;
|
|
33
32
|
return merger(
|
|
34
33
|
withoutInternalProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProps.mjs","sources":["../../../../../../src/lib/hooks/useProps.ts"],"sourcesContent":["import {\n type FlowComponentName,\n type FlowComponentProps,\n} from \"@/components/propTypes\";\nimport { resolveDynamicProps } from \"@/lib/propsContext/dynamicProps/resolveDynamicProps\";\nimport { useComponentPropsContext } from \"@/lib/propsContext/propsContext\";\nimport { omitBy } from \"remeda\";\nimport isDynamicProp from \"@/lib/propsContext/dynamicProps/lib\";\nimport { isFlowComponentName } from \"@/lib/propsContext/isFlowComponentName\";\nimport {
|
|
1
|
+
{"version":3,"file":"useProps.mjs","sources":["../../../../../../src/lib/hooks/useProps.ts"],"sourcesContent":["import {\n type FlowComponentName,\n type FlowComponentProps,\n} from \"@/components/propTypes\";\nimport { resolveDynamicProps } from \"@/lib/propsContext/dynamicProps/resolveDynamicProps\";\nimport { useComponentPropsContext } from \"@/lib/propsContext/propsContext\";\nimport { omitBy } from \"remeda\";\nimport isDynamicProp from \"@/lib/propsContext/dynamicProps/lib\";\nimport { isFlowComponentName } from \"@/lib/propsContext/isFlowComponentName\";\nimport { areChildrenEmpty } from \"@/lib/react/areChildrenEmpty\";\nimport { isNestingLevelKey } from \"@/lib/propsContext/nestedPropsContext/lib\";\nimport { getPropsMerger } from \"@/lib/react/getPropsMerger\";\n\nconst withoutChildren = <C extends FlowComponentName>(\n props: FlowComponentProps<C>,\n) => {\n if (\"children\" in props) {\n if (areChildrenEmpty(props.children)) {\n const { children: ignored, ...rest } = props;\n return rest as FlowComponentProps<C>;\n }\n }\n return props;\n};\n\nconst merger = getPropsMerger({\n mergeRefs: true,\n});\n\nexport const useProps = <C extends FlowComponentName>(\n component: C,\n localProps: FlowComponentProps<C>,\n): FlowComponentProps<C> => {\n localProps = withoutChildren(localProps);\n\n const componentPropsContext = useComponentPropsContext(component);\n\n const withResolvedDynamicProps = componentPropsContext\n ? resolveDynamicProps(componentPropsContext, localProps)\n : undefined;\n\n const withoutInternalProps = componentPropsContext\n ? omitBy(\n componentPropsContext,\n (value, key) =>\n isFlowComponentName(key) ||\n isNestingLevelKey(key) ||\n isDynamicProp(value),\n )\n : undefined;\n\n return merger(\n withoutInternalProps,\n localProps,\n withResolvedDynamicProps,\n ) as FlowComponentProps<C>;\n};\n\nexport default useProps;\n"],"names":[],"mappings":";;;;;;;;;AAaA,MAAM,eAAA,GAAkB,CACtB,KAAA,KACG;AACH,EAAA,IAAI,cAAc,KAAA,EAAO;AACvB,IAAA,IAAI,gBAAA,CAAiB,KAAA,CAAM,QAAQ,CAAA,EAAG;AACpC,MAAA,MAAM,EAAE,QAAA,EAAU,OAAA,EAAS,GAAG,MAAK,GAAI,KAAA;AACvC,MAAA,OAAO,IAAA;AAAA,IACT;AAAA,EACF;AACA,EAAA,OAAO,KAAA;AACT,CAAA;AAEA,MAAM,SAAS,cAAA,CAAe;AAAA,EAC5B,SAAA,EAAW;AACb,CAAC,CAAA;AAEM,MAAM,QAAA,GAAW,CACtB,SAAA,EACA,UAAA,KAC0B;AAC1B,EAAA,UAAA,GAAa,gBAAgB,UAAU,CAAA;AAEvC,EAAA,MAAM,qBAAA,GAAwB,yBAAyB,SAAS,CAAA;AAEhE,EAAA,MAAM,wBAAA,GAA2B,qBAAA,GAC7B,mBAAA,CAAoB,qBAAA,EAAuB,UAAU,CAAA,GACrD,MAAA;AAEJ,EAAA,MAAM,uBAAuB,qBAAA,GACzB,MAAA;AAAA,IACE,qBAAA;AAAA,IACA,CAAC,KAAA,EAAO,GAAA,KACN,mBAAA,CAAoB,GAAG,KACvB,iBAAA,CAAkB,GAAG,CAAA,IACrB,aAAA,CAAc,KAAK;AAAA,GACvB,GACA,MAAA;AAEJ,EAAA,OAAO,MAAA;AAAA,IACL,oBAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { useMemo } from 'react';
|
|
4
|
+
import { PropsContextProvider } from '../propsContext.mjs';
|
|
5
|
+
import 'react';
|
|
7
6
|
|
|
8
7
|
const ClearPropsContext = (props) => {
|
|
9
|
-
const { children
|
|
10
|
-
|
|
11
|
-
const withKeptComponentProps = useMemo(
|
|
12
|
-
() => (keep ? parentPropsContext[keep] : void 0) ?? {},
|
|
13
|
-
[keep, parentPropsContext]
|
|
14
|
-
);
|
|
15
|
-
return /* @__PURE__ */ jsx(PropsContextLevelProvider, { mode: "reset", children: /* @__PURE__ */ jsx(PropsContextProvider, { value: withKeptComponentProps, children }) });
|
|
8
|
+
const { children } = props;
|
|
9
|
+
return /* @__PURE__ */ jsx(PropsContextProvider, { value: {}, children });
|
|
16
10
|
};
|
|
17
11
|
|
|
18
12
|
export { ClearPropsContext, ClearPropsContext as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClearPropsContext.mjs","sources":["../../../../../../../src/lib/propsContext/components/ClearPropsContext.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"ClearPropsContext.mjs","sources":["../../../../../../../src/lib/propsContext/components/ClearPropsContext.tsx"],"sourcesContent":["import { PropsContextProvider } from \"@/lib/propsContext/propsContext\";\nimport { type FC, type PropsWithChildren } from \"react\";\n\nexport const ClearPropsContext: FC<PropsWithChildren> = (props) => {\n const { children } = props;\n return <PropsContextProvider value={{}}>{children}</PropsContextProvider>;\n};\n\nexport default ClearPropsContext;\n"],"names":[],"mappings":";;;;AAGO,MAAM,iBAAA,GAA2C,CAAC,KAAA,KAAU;AACjE,EAAA,MAAM,EAAE,UAAS,GAAI,KAAA;AACrB,EAAA,uBAAO,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,IAAK,QAAA,EAAS,CAAA;AACpD;;;;"}
|
package/dist/js/components/src/lib/propsContext/components/ComponentPropsContextProvider.mjs
CHANGED
|
@@ -5,8 +5,8 @@ import { PropsContextProvider } from './PropsContextProvider.mjs';
|
|
|
5
5
|
import { memo } from 'react';
|
|
6
6
|
|
|
7
7
|
const ComponentPropsContextProvider = memo((props) => {
|
|
8
|
-
const { children, componentProps = {}
|
|
9
|
-
return /* @__PURE__ */ jsx(PropsContextProvider, { props: componentProps,
|
|
8
|
+
const { children, componentProps = {} } = props;
|
|
9
|
+
return /* @__PURE__ */ jsx(PropsContextProvider, { props: componentProps, children });
|
|
10
10
|
});
|
|
11
11
|
ComponentPropsContextProvider.displayName = "ComponentPropsContextProvider";
|
|
12
12
|
|