@mittwald/flow-react-components 0.2.0-alpha.677 → 0.2.0-alpha.678
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 +6 -0
- package/dist/assets/doc-properties.json +272 -44
- package/dist/js/components/src/components/Action/models/ActionModel.mjs +15 -3
- package/dist/js/components/src/components/Action/models/ActionModel.mjs.map +1 -1
- package/dist/js/components/src/components/Action/models/getExecutionFunction.mjs +15 -8
- package/dist/js/components/src/components/Action/models/getExecutionFunction.mjs.map +1 -1
- package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs +3 -0
- package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs.map +1 -1
- package/dist/js/components/src/components/ComboBox/ComboBox.mjs +3 -0
- package/dist/js/components/src/components/ComboBox/ComboBox.mjs.map +1 -1
- package/dist/js/components/src/components/ContextMenu/ContextMenu.mjs +4 -1
- package/dist/js/components/src/components/ContextMenu/ContextMenu.mjs.map +1 -1
- package/dist/js/components/src/components/ContextualHelp/ContextualHelp.mjs +3 -0
- package/dist/js/components/src/components/ContextualHelp/ContextualHelp.mjs.map +1 -1
- package/dist/js/components/src/components/DatePicker/DatePicker.mjs +3 -0
- package/dist/js/components/src/components/DatePicker/DatePicker.mjs.map +1 -1
- package/dist/js/components/src/components/DateRangePicker/DateRangePicker.mjs +3 -0
- package/dist/js/components/src/components/DateRangePicker/DateRangePicker.mjs.map +1 -1
- package/dist/js/components/src/components/LightBox/LightBox.mjs +3 -0
- package/dist/js/components/src/components/LightBox/LightBox.mjs.map +1 -1
- package/dist/js/components/src/components/List/components/Header/components/AllFiltersModal/AllFiltersModal.mjs +3 -0
- package/dist/js/components/src/components/List/components/Header/components/AllFiltersModal/AllFiltersModal.mjs.map +1 -1
- package/dist/js/components/src/components/Modal/Modal.mjs +1 -9
- package/dist/js/components/src/components/Modal/Modal.mjs.map +1 -1
- package/dist/js/components/src/components/Overlay/Overlay.mjs +14 -2
- package/dist/js/components/src/components/Overlay/Overlay.mjs.map +1 -1
- package/dist/js/components/src/components/OverlayTrigger/OverlayTrigger.mjs +3 -0
- package/dist/js/components/src/components/OverlayTrigger/OverlayTrigger.mjs.map +1 -1
- package/dist/js/components/src/components/Popover/Popover.mjs +4 -0
- package/dist/js/components/src/components/Popover/Popover.mjs.map +1 -1
- package/dist/js/components/src/components/Select/Select.mjs +3 -0
- package/dist/js/components/src/components/Select/Select.mjs.map +1 -1
- package/dist/js/components/src/lib/controller/overlay/OverlayController.mjs +57 -29
- package/dist/js/components/src/lib/controller/overlay/OverlayController.mjs.map +1 -1
- package/dist/js/components/src/lib/controller/overlay/useModalController.mjs +14 -0
- package/dist/js/components/src/lib/controller/overlay/useModalController.mjs.map +1 -0
- package/dist/js/components/src/lib/controller/overlay/useOverlayController.mjs +7 -15
- package/dist/js/components/src/lib/controller/overlay/useOverlayController.mjs.map +1 -1
- package/dist/js/default.mjs +1 -0
- package/dist/js/default.mjs.map +1 -1
- package/dist/js/flr-universal.mjs +1 -0
- package/dist/js/flr-universal.mjs.map +1 -1
- package/dist/types/components/Action/models/ActionModel.d.ts +1 -1
- package/dist/types/components/Action/models/ActionModel.d.ts.map +1 -1
- package/dist/types/components/Action/models/getExecutionFunction.d.ts.map +1 -1
- package/dist/types/components/Action/types.d.ts +3 -0
- package/dist/types/components/Action/types.d.ts.map +1 -1
- package/dist/types/components/Modal/Modal.browser.test.d.ts +2 -0
- package/dist/types/components/Modal/Modal.browser.test.d.ts.map +1 -0
- package/dist/types/components/Modal/Modal.d.ts +3 -1
- package/dist/types/components/Modal/Modal.d.ts.map +1 -1
- package/dist/types/components/Modal/stories/Default.stories.d.ts.map +1 -1
- package/dist/types/components/Modal/stories/EdgeCases.stories.d.ts.map +1 -1
- package/dist/types/components/Overlay/Overlay.d.ts +5 -0
- package/dist/types/components/Overlay/Overlay.d.ts.map +1 -1
- package/dist/types/lib/controller/overlay/OverlayController.d.ts +17 -5
- package/dist/types/lib/controller/overlay/OverlayController.d.ts.map +1 -1
- package/dist/types/lib/controller/overlay/index.d.ts +2 -1
- package/dist/types/lib/controller/overlay/index.d.ts.map +1 -1
- package/dist/types/lib/controller/overlay/useModalController.d.ts +5 -0
- package/dist/types/lib/controller/overlay/useModalController.d.ts.map +1 -0
- package/dist/types/lib/controller/overlay/useOverlayController.d.ts +2 -3
- package/dist/types/lib/controller/overlay/useOverlayController.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.2.0-alpha.678](https://github.com/mittwald/flow/compare/0.2.0-alpha.677...0.2.0-alpha.678) (2026-02-11)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add various features to handle Overlays and Modals ([ea3ef25](https://github.com/mittwald/flow/commit/ea3ef256ed1eeb96d4a05a8c3f0def6d2eb936e4))
|
|
11
|
+
|
|
6
12
|
# [0.2.0-alpha.677](https://github.com/mittwald/flow/compare/0.2.0-alpha.676...0.2.0-alpha.677) (2026-02-11)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
@@ -56140,6 +56140,82 @@
|
|
|
56140
56140
|
"name": "boolean"
|
|
56141
56141
|
}
|
|
56142
56142
|
},
|
|
56143
|
+
"isDefaultOpen": {
|
|
56144
|
+
"defaultValue": null,
|
|
56145
|
+
"description": "",
|
|
56146
|
+
"name": "isDefaultOpen",
|
|
56147
|
+
"parent": {
|
|
56148
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
56149
|
+
"name": "OverlayProps"
|
|
56150
|
+
},
|
|
56151
|
+
"declarations": [
|
|
56152
|
+
{
|
|
56153
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
56154
|
+
"name": "OverlayProps"
|
|
56155
|
+
}
|
|
56156
|
+
],
|
|
56157
|
+
"required": false,
|
|
56158
|
+
"type": {
|
|
56159
|
+
"name": "boolean"
|
|
56160
|
+
}
|
|
56161
|
+
},
|
|
56162
|
+
"onOpen": {
|
|
56163
|
+
"defaultValue": null,
|
|
56164
|
+
"description": "",
|
|
56165
|
+
"name": "onOpen",
|
|
56166
|
+
"parent": {
|
|
56167
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
56168
|
+
"name": "OverlayProps"
|
|
56169
|
+
},
|
|
56170
|
+
"declarations": [
|
|
56171
|
+
{
|
|
56172
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
56173
|
+
"name": "OverlayProps"
|
|
56174
|
+
}
|
|
56175
|
+
],
|
|
56176
|
+
"required": false,
|
|
56177
|
+
"type": {
|
|
56178
|
+
"name": "OverlayOpenHandler"
|
|
56179
|
+
}
|
|
56180
|
+
},
|
|
56181
|
+
"onClose": {
|
|
56182
|
+
"defaultValue": null,
|
|
56183
|
+
"description": "",
|
|
56184
|
+
"name": "onClose",
|
|
56185
|
+
"parent": {
|
|
56186
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
56187
|
+
"name": "OverlayProps"
|
|
56188
|
+
},
|
|
56189
|
+
"declarations": [
|
|
56190
|
+
{
|
|
56191
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
56192
|
+
"name": "OverlayProps"
|
|
56193
|
+
}
|
|
56194
|
+
],
|
|
56195
|
+
"required": false,
|
|
56196
|
+
"type": {
|
|
56197
|
+
"name": "OverlayCloseHandler"
|
|
56198
|
+
}
|
|
56199
|
+
},
|
|
56200
|
+
"onOpenChange": {
|
|
56201
|
+
"defaultValue": null,
|
|
56202
|
+
"description": "",
|
|
56203
|
+
"name": "onOpenChange",
|
|
56204
|
+
"parent": {
|
|
56205
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
56206
|
+
"name": "OverlayProps"
|
|
56207
|
+
},
|
|
56208
|
+
"declarations": [
|
|
56209
|
+
{
|
|
56210
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
56211
|
+
"name": "OverlayProps"
|
|
56212
|
+
}
|
|
56213
|
+
],
|
|
56214
|
+
"required": false,
|
|
56215
|
+
"type": {
|
|
56216
|
+
"name": "OverlayOpenStateHandler"
|
|
56217
|
+
}
|
|
56218
|
+
},
|
|
56143
56219
|
"children": {
|
|
56144
56220
|
"defaultValue": null,
|
|
56145
56221
|
"description": "",
|
|
@@ -78763,6 +78839,101 @@
|
|
|
78763
78839
|
"type": {
|
|
78764
78840
|
"name": "string"
|
|
78765
78841
|
}
|
|
78842
|
+
},
|
|
78843
|
+
"isOpen": {
|
|
78844
|
+
"defaultValue": null,
|
|
78845
|
+
"description": "",
|
|
78846
|
+
"name": "isOpen",
|
|
78847
|
+
"parent": {
|
|
78848
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
78849
|
+
"name": "OverlayProps"
|
|
78850
|
+
},
|
|
78851
|
+
"declarations": [
|
|
78852
|
+
{
|
|
78853
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
78854
|
+
"name": "OverlayProps"
|
|
78855
|
+
}
|
|
78856
|
+
],
|
|
78857
|
+
"required": false,
|
|
78858
|
+
"type": {
|
|
78859
|
+
"name": "boolean"
|
|
78860
|
+
}
|
|
78861
|
+
},
|
|
78862
|
+
"onOpenChange": {
|
|
78863
|
+
"defaultValue": null,
|
|
78864
|
+
"description": "",
|
|
78865
|
+
"name": "onOpenChange",
|
|
78866
|
+
"parent": {
|
|
78867
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
78868
|
+
"name": "OverlayProps"
|
|
78869
|
+
},
|
|
78870
|
+
"declarations": [
|
|
78871
|
+
{
|
|
78872
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
78873
|
+
"name": "OverlayProps"
|
|
78874
|
+
}
|
|
78875
|
+
],
|
|
78876
|
+
"required": false,
|
|
78877
|
+
"type": {
|
|
78878
|
+
"name": "OverlayOpenStateHandler"
|
|
78879
|
+
}
|
|
78880
|
+
},
|
|
78881
|
+
"onClose": {
|
|
78882
|
+
"defaultValue": null,
|
|
78883
|
+
"description": "",
|
|
78884
|
+
"name": "onClose",
|
|
78885
|
+
"parent": {
|
|
78886
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
78887
|
+
"name": "OverlayProps"
|
|
78888
|
+
},
|
|
78889
|
+
"declarations": [
|
|
78890
|
+
{
|
|
78891
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
78892
|
+
"name": "OverlayProps"
|
|
78893
|
+
}
|
|
78894
|
+
],
|
|
78895
|
+
"required": false,
|
|
78896
|
+
"type": {
|
|
78897
|
+
"name": "OverlayCloseHandler"
|
|
78898
|
+
}
|
|
78899
|
+
},
|
|
78900
|
+
"isDefaultOpen": {
|
|
78901
|
+
"defaultValue": null,
|
|
78902
|
+
"description": "",
|
|
78903
|
+
"name": "isDefaultOpen",
|
|
78904
|
+
"parent": {
|
|
78905
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
78906
|
+
"name": "OverlayProps"
|
|
78907
|
+
},
|
|
78908
|
+
"declarations": [
|
|
78909
|
+
{
|
|
78910
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
78911
|
+
"name": "OverlayProps"
|
|
78912
|
+
}
|
|
78913
|
+
],
|
|
78914
|
+
"required": false,
|
|
78915
|
+
"type": {
|
|
78916
|
+
"name": "boolean"
|
|
78917
|
+
}
|
|
78918
|
+
},
|
|
78919
|
+
"onOpen": {
|
|
78920
|
+
"defaultValue": null,
|
|
78921
|
+
"description": "",
|
|
78922
|
+
"name": "onOpen",
|
|
78923
|
+
"parent": {
|
|
78924
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
78925
|
+
"name": "OverlayProps"
|
|
78926
|
+
},
|
|
78927
|
+
"declarations": [
|
|
78928
|
+
{
|
|
78929
|
+
"fileName": "components/src/components/Overlay/Overlay.tsx",
|
|
78930
|
+
"name": "OverlayProps"
|
|
78931
|
+
}
|
|
78932
|
+
],
|
|
78933
|
+
"required": false,
|
|
78934
|
+
"type": {
|
|
78935
|
+
"name": "OverlayOpenHandler"
|
|
78936
|
+
}
|
|
78766
78937
|
}
|
|
78767
78938
|
}
|
|
78768
78939
|
},
|
|
@@ -239967,6 +240138,63 @@
|
|
|
239967
240138
|
"name": "keyof FlowComponentPropsTypes | OverlayController"
|
|
239968
240139
|
}
|
|
239969
240140
|
},
|
|
240141
|
+
"closeModal": {
|
|
240142
|
+
"defaultValue": null,
|
|
240143
|
+
"description": "",
|
|
240144
|
+
"name": "closeModal",
|
|
240145
|
+
"parent": {
|
|
240146
|
+
"fileName": "components/src/components/Action/types.ts",
|
|
240147
|
+
"name": "ActionProps"
|
|
240148
|
+
},
|
|
240149
|
+
"declarations": [
|
|
240150
|
+
{
|
|
240151
|
+
"fileName": "components/src/components/Action/types.ts",
|
|
240152
|
+
"name": "ActionProps"
|
|
240153
|
+
}
|
|
240154
|
+
],
|
|
240155
|
+
"required": false,
|
|
240156
|
+
"type": {
|
|
240157
|
+
"name": "boolean"
|
|
240158
|
+
}
|
|
240159
|
+
},
|
|
240160
|
+
"openModal": {
|
|
240161
|
+
"defaultValue": null,
|
|
240162
|
+
"description": "",
|
|
240163
|
+
"name": "openModal",
|
|
240164
|
+
"parent": {
|
|
240165
|
+
"fileName": "components/src/components/Action/types.ts",
|
|
240166
|
+
"name": "ActionProps"
|
|
240167
|
+
},
|
|
240168
|
+
"declarations": [
|
|
240169
|
+
{
|
|
240170
|
+
"fileName": "components/src/components/Action/types.ts",
|
|
240171
|
+
"name": "ActionProps"
|
|
240172
|
+
}
|
|
240173
|
+
],
|
|
240174
|
+
"required": false,
|
|
240175
|
+
"type": {
|
|
240176
|
+
"name": "boolean"
|
|
240177
|
+
}
|
|
240178
|
+
},
|
|
240179
|
+
"toggleModal": {
|
|
240180
|
+
"defaultValue": null,
|
|
240181
|
+
"description": "",
|
|
240182
|
+
"name": "toggleModal",
|
|
240183
|
+
"parent": {
|
|
240184
|
+
"fileName": "components/src/components/Action/types.ts",
|
|
240185
|
+
"name": "ActionProps"
|
|
240186
|
+
},
|
|
240187
|
+
"declarations": [
|
|
240188
|
+
{
|
|
240189
|
+
"fileName": "components/src/components/Action/types.ts",
|
|
240190
|
+
"name": "ActionProps"
|
|
240191
|
+
}
|
|
240192
|
+
],
|
|
240193
|
+
"required": false,
|
|
240194
|
+
"type": {
|
|
240195
|
+
"name": "boolean"
|
|
240196
|
+
}
|
|
240197
|
+
},
|
|
239970
240198
|
"break": {
|
|
239971
240199
|
"defaultValue": null,
|
|
239972
240200
|
"description": "",
|
|
@@ -305948,6 +306176,14 @@
|
|
|
305948
306176
|
}
|
|
305949
306177
|
}
|
|
305950
306178
|
},
|
|
306179
|
+
{
|
|
306180
|
+
"tags": {},
|
|
306181
|
+
"filePath": "/home/runner/work/flow/flow/packages/components/src/components/Modal/components/OffCanvasSuspenseFallback/OffCanvasSuspenseFallback.tsx",
|
|
306182
|
+
"description": "",
|
|
306183
|
+
"displayName": "OffCanvasSuspenseFallback",
|
|
306184
|
+
"methods": [],
|
|
306185
|
+
"props": {}
|
|
306186
|
+
},
|
|
305951
306187
|
{
|
|
305952
306188
|
"tags": {},
|
|
305953
306189
|
"filePath": "/home/runner/work/flow/flow/packages/components/src/components/Modal/components/ModalTrigger/ModalTrigger.tsx",
|
|
@@ -306086,14 +306322,6 @@
|
|
|
306086
306322
|
}
|
|
306087
306323
|
}
|
|
306088
306324
|
},
|
|
306089
|
-
{
|
|
306090
|
-
"tags": {},
|
|
306091
|
-
"filePath": "/home/runner/work/flow/flow/packages/components/src/components/Modal/components/OffCanvasSuspenseFallback/OffCanvasSuspenseFallback.tsx",
|
|
306092
|
-
"description": "",
|
|
306093
|
-
"displayName": "OffCanvasSuspenseFallback",
|
|
306094
|
-
"methods": [],
|
|
306095
|
-
"props": {}
|
|
306096
|
-
},
|
|
306097
306325
|
{
|
|
306098
306326
|
"tags": {
|
|
306099
306327
|
"flr-generate": "all"
|
|
@@ -335487,6 +335715,42 @@
|
|
|
335487
335715
|
"methods": [],
|
|
335488
335716
|
"props": {}
|
|
335489
335717
|
},
|
|
335718
|
+
{
|
|
335719
|
+
"tags": {},
|
|
335720
|
+
"filePath": "/home/runner/work/flow/flow/packages/components/src/components/List/components/Header/components/ViewModeContextMenu/ViewModeMenuItem.tsx",
|
|
335721
|
+
"description": "",
|
|
335722
|
+
"displayName": "ViewModeMenuItem",
|
|
335723
|
+
"methods": [],
|
|
335724
|
+
"props": {
|
|
335725
|
+
"viewMode": {
|
|
335726
|
+
"defaultValue": null,
|
|
335727
|
+
"description": "",
|
|
335728
|
+
"name": "viewMode",
|
|
335729
|
+
"parent": {
|
|
335730
|
+
"fileName": "components/src/components/List/components/Header/components/ViewModeContextMenu/ViewModeMenuItem.tsx",
|
|
335731
|
+
"name": "Props"
|
|
335732
|
+
},
|
|
335733
|
+
"declarations": [
|
|
335734
|
+
{
|
|
335735
|
+
"fileName": "components/src/components/List/components/Header/components/ViewModeContextMenu/ViewModeMenuItem.tsx",
|
|
335736
|
+
"name": "Props"
|
|
335737
|
+
}
|
|
335738
|
+
],
|
|
335739
|
+
"required": true,
|
|
335740
|
+
"type": {
|
|
335741
|
+
"name": "ListViewMode"
|
|
335742
|
+
}
|
|
335743
|
+
}
|
|
335744
|
+
}
|
|
335745
|
+
},
|
|
335746
|
+
{
|
|
335747
|
+
"tags": {},
|
|
335748
|
+
"filePath": "/home/runner/work/flow/flow/packages/components/src/components/List/components/Header/components/ViewModeContextMenu/ViewModeContextMenu.tsx",
|
|
335749
|
+
"description": "",
|
|
335750
|
+
"displayName": "ViewModeContextMenu",
|
|
335751
|
+
"methods": [],
|
|
335752
|
+
"props": {}
|
|
335753
|
+
},
|
|
335490
335754
|
{
|
|
335491
335755
|
"tags": {},
|
|
335492
335756
|
"filePath": "/home/runner/work/flow/flow/packages/components/src/components/List/components/Header/components/SortingContextMenu/SortingMenuItem.tsx",
|
|
@@ -335694,42 +335958,6 @@
|
|
|
335694
335958
|
"methods": [],
|
|
335695
335959
|
"props": {}
|
|
335696
335960
|
},
|
|
335697
|
-
{
|
|
335698
|
-
"tags": {},
|
|
335699
|
-
"filePath": "/home/runner/work/flow/flow/packages/components/src/components/List/components/Header/components/ViewModeContextMenu/ViewModeMenuItem.tsx",
|
|
335700
|
-
"description": "",
|
|
335701
|
-
"displayName": "ViewModeMenuItem",
|
|
335702
|
-
"methods": [],
|
|
335703
|
-
"props": {
|
|
335704
|
-
"viewMode": {
|
|
335705
|
-
"defaultValue": null,
|
|
335706
|
-
"description": "",
|
|
335707
|
-
"name": "viewMode",
|
|
335708
|
-
"parent": {
|
|
335709
|
-
"fileName": "components/src/components/List/components/Header/components/ViewModeContextMenu/ViewModeMenuItem.tsx",
|
|
335710
|
-
"name": "Props"
|
|
335711
|
-
},
|
|
335712
|
-
"declarations": [
|
|
335713
|
-
{
|
|
335714
|
-
"fileName": "components/src/components/List/components/Header/components/ViewModeContextMenu/ViewModeMenuItem.tsx",
|
|
335715
|
-
"name": "Props"
|
|
335716
|
-
}
|
|
335717
|
-
],
|
|
335718
|
-
"required": true,
|
|
335719
|
-
"type": {
|
|
335720
|
-
"name": "ListViewMode"
|
|
335721
|
-
}
|
|
335722
|
-
}
|
|
335723
|
-
}
|
|
335724
|
-
},
|
|
335725
|
-
{
|
|
335726
|
-
"tags": {},
|
|
335727
|
-
"filePath": "/home/runner/work/flow/flow/packages/components/src/components/List/components/Header/components/ViewModeContextMenu/ViewModeContextMenu.tsx",
|
|
335728
|
-
"description": "",
|
|
335729
|
-
"displayName": "ViewModeContextMenu",
|
|
335730
|
-
"methods": [],
|
|
335731
|
-
"props": {}
|
|
335732
|
-
},
|
|
335733
335961
|
{
|
|
335734
335962
|
"tags": {},
|
|
335735
335963
|
"filePath": "/home/runner/work/flow/flow/packages/components/src/components/List/components/Footer/components/PaginationInfos/PaginationInfos.tsx",
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
import { useContext } from 'react';
|
|
4
4
|
import { OverlayController } from '../../../lib/controller/overlay/OverlayController.mjs';
|
|
5
5
|
import { useOverlayContext } from '../../../lib/controller/overlay/context.mjs';
|
|
6
|
+
import '../../../lib/propsContext/propsContext.mjs';
|
|
7
|
+
import 'remeda';
|
|
8
|
+
import '@react-aria/utils';
|
|
9
|
+
import 'dot-prop';
|
|
6
10
|
import invariant from 'invariant';
|
|
7
11
|
import { actionContext } from '../context.mjs';
|
|
8
12
|
import { ActionState } from './ActionState.mjs';
|
|
@@ -71,11 +75,19 @@ class ActionModel {
|
|
|
71
75
|
)
|
|
72
76
|
});
|
|
73
77
|
}
|
|
74
|
-
getOverlayController(
|
|
78
|
+
getOverlayController(from) {
|
|
75
79
|
const getController = (controller) => {
|
|
76
|
-
|
|
80
|
+
if (controller === void 0) {
|
|
81
|
+
return void 0;
|
|
82
|
+
}
|
|
83
|
+
if (from instanceof OverlayController) {
|
|
84
|
+
return from;
|
|
85
|
+
}
|
|
86
|
+
if (typeof from === "string") {
|
|
87
|
+
return this.overlayContext[from];
|
|
88
|
+
}
|
|
77
89
|
};
|
|
78
|
-
return getController(this.actionProps.openOverlay) ?? getController(this.actionProps.closeOverlay) ?? getController(this.actionProps.toggleOverlay);
|
|
90
|
+
return getController(this.actionProps.openOverlay) ?? getController(this.actionProps.closeOverlay) ?? getController(this.actionProps.toggleOverlay) ?? getController(this.actionProps.openModal ? "Modal" : void 0) ?? getController(this.actionProps.closeModal ? "Modal" : void 0) ?? getController(this.actionProps.toggleModal ? "Modal" : void 0);
|
|
79
91
|
}
|
|
80
92
|
execute = (...args) => {
|
|
81
93
|
new ActionExecution(this).execute(...args);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionModel.mjs","sources":["../../../../../../../src/components/Action/models/ActionModel.tsx"],"sourcesContent":["import { useContext } from \"react\";\nimport { OverlayController } from \"@/lib/controller\";\nimport invariant from \"invariant\";\nimport type
|
|
1
|
+
{"version":3,"file":"ActionModel.mjs","sources":["../../../../../../../src/components/Action/models/ActionModel.tsx"],"sourcesContent":["import { useContext } from \"react\";\nimport { OverlayController } from \"@/lib/controller\";\nimport invariant from \"invariant\";\nimport { type ActionProps } from \"@/components/Action/types\";\nimport { actionContext } from \"@/components/Action/context\";\nimport { ActionState } from \"@/components/Action/models/ActionState\";\nimport { ActionExecution } from \"@/components/Action/models/ActionExecution\";\nimport { ActionStateContext } from \"@/components/Action/models/ActionStateContext\";\nimport type { OverlayContext } from \"@/lib/controller/overlay/context\";\nimport { useOverlayContext } from \"@/lib/controller/overlay/context\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\n\ninterface InitObject {\n actionProps: ActionProps;\n parentAction?: ActionModel;\n confirmationModalController: OverlayController;\n needsConfirmation: boolean;\n overlayContext: OverlayContext;\n state: ActionState;\n}\n\nexport class ActionModel {\n public state: ActionState;\n public needsConfirmation: boolean;\n public readonly actionProps: ActionProps;\n public readonly parentAction?: ActionModel;\n public readonly confirmationModalController: OverlayController;\n public readonly overlayContext: OverlayContext;\n\n private constructor(init: InitObject) {\n const {\n actionProps,\n needsConfirmation,\n parentAction,\n overlayContext,\n confirmationModalController,\n state,\n } = init;\n\n this.actionProps = actionProps;\n this.parentAction = parentAction;\n this.confirmationModalController = confirmationModalController;\n this.needsConfirmation = needsConfirmation;\n this.overlayContext = overlayContext;\n this.state = state;\n }\n\n public static useNew(\n actionProps: ActionProps,\n init: Partial<InitObject> = {},\n ): ActionModel {\n const parentAction = useContext(actionContext);\n const overlayContext = useOverlayContext();\n const confirmationModalController = OverlayController.useNew();\n const state = ActionState.useNew();\n\n return new ActionModel({\n parentAction,\n overlayContext,\n confirmationModalController,\n needsConfirmation: false,\n actionProps,\n state,\n ...init,\n });\n }\n\n public static use(): ActionModel {\n const c = useContext(actionContext);\n invariant(!!c, \"Action context is not defined\");\n ActionStateContext.useRegisterState(c.state);\n return c;\n }\n\n public static useConfirmationAction(): ActionModel {\n const action = ActionModel.use();\n\n return new ActionModel({\n actionProps: action.actionProps,\n confirmationModalController: action.confirmationModalController,\n overlayContext: action.overlayContext,\n state: action.state,\n needsConfirmation: false,\n parentAction: ActionModel.useNew(\n {\n closeOverlay: action.confirmationModalController,\n },\n {\n parentAction: action.parentAction,\n },\n ),\n });\n }\n\n public getOverlayController(\n from: FlowComponentName | OverlayController,\n ): OverlayController | undefined {\n const getController = (\n controller?: OverlayController | FlowComponentName,\n ): OverlayController | undefined => {\n if (controller === undefined) {\n return undefined;\n }\n if (from instanceof OverlayController) {\n return from;\n }\n if (typeof from === \"string\") {\n return this.overlayContext[from];\n }\n };\n\n return (\n getController(this.actionProps.openOverlay) ??\n getController(this.actionProps.closeOverlay) ??\n getController(this.actionProps.toggleOverlay) ??\n getController(this.actionProps.openModal ? \"Modal\" : undefined) ??\n getController(this.actionProps.closeModal ? \"Modal\" : undefined) ??\n getController(this.actionProps.toggleModal ? \"Modal\" : undefined)\n );\n }\n\n public execute = (...args: unknown[]): void => {\n new ActionExecution(this).execute(...args);\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAqBO,MAAM,WAAA,CAAY;AAAA,EAChB,KAAA;AAAA,EACA,iBAAA;AAAA,EACS,WAAA;AAAA,EACA,YAAA;AAAA,EACA,2BAAA;AAAA,EACA,cAAA;AAAA,EAER,YAAY,IAAA,EAAkB;AACpC,IAAA,MAAM;AAAA,MACJ,WAAA;AAAA,MACA,iBAAA;AAAA,MACA,YAAA;AAAA,MACA,cAAA;AAAA,MACA,2BAAA;AAAA,MACA;AAAA,KACF,GAAI,IAAA;AAEJ,IAAA,IAAA,CAAK,WAAA,GAAc,WAAA;AACnB,IAAA,IAAA,CAAK,YAAA,GAAe,YAAA;AACpB,IAAA,IAAA,CAAK,2BAAA,GAA8B,2BAAA;AACnC,IAAA,IAAA,CAAK,iBAAA,GAAoB,iBAAA;AACzB,IAAA,IAAA,CAAK,cAAA,GAAiB,cAAA;AACtB,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AAAA,EACf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CACpB,UAAA,KACkC;AAClC,MAAA,IAAI,eAAe,MAAA,EAAW;AAC5B,QAAA,OAAO,MAAA;AAAA,MACT;AACA,MAAA,IAAI,gBAAgB,iBAAA,EAAmB;AACrC,QAAA,OAAO,IAAA;AAAA,MACT;AACA,MAAA,IAAI,OAAO,SAAS,QAAA,EAAU;AAC5B,QAAA,OAAO,IAAA,CAAK,eAAe,IAAI,CAAA;AAAA,MACjC;AAAA,IACF,CAAA;AAEA,IAAA,OACE,aAAA,CAAc,IAAA,CAAK,WAAA,CAAY,WAAW,KAC1C,aAAA,CAAc,IAAA,CAAK,WAAA,CAAY,YAAY,KAC3C,aAAA,CAAc,IAAA,CAAK,WAAA,CAAY,aAAa,KAC5C,aAAA,CAAc,IAAA,CAAK,WAAA,CAAY,SAAA,GAAY,OAAA,GAAU,MAAS,CAAA,IAC9D,aAAA,CAAc,KAAK,WAAA,CAAY,UAAA,GAAa,OAAA,GAAU,MAAS,KAC/D,aAAA,CAAc,IAAA,CAAK,WAAA,CAAY,WAAA,GAAc,UAAU,MAAS,CAAA;AAAA,EAEpE;AAAA,EAEO,OAAA,GAAU,IAAI,IAAA,KAA0B;AAC7C,IAAA,IAAI,eAAA,CAAgB,IAAI,CAAA,CAAE,OAAA,CAAQ,GAAG,IAAI,CAAA;AAAA,EAC3C,CAAA;AACF;;;;"}
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
+
import '../Action.mjs';
|
|
4
|
+
import 'react-aria';
|
|
5
|
+
import 'react';
|
|
6
|
+
import '@react-aria/live-announcer';
|
|
7
|
+
|
|
3
8
|
const voidAction = () => {
|
|
4
9
|
};
|
|
5
10
|
function getExecutionFunction(action) {
|
|
6
11
|
if (action.needsConfirmation) {
|
|
7
12
|
return action.confirmationModalController.open;
|
|
8
13
|
}
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const {
|
|
15
|
+
onAction,
|
|
16
|
+
toggleOverlay,
|
|
17
|
+
closeOverlay,
|
|
18
|
+
openOverlay,
|
|
19
|
+
openModal,
|
|
20
|
+
closeModal,
|
|
21
|
+
toggleModal
|
|
22
|
+
} = action.actionProps;
|
|
23
|
+
const maybeAction = onAction ? onAction : openOverlay ? () => action.getOverlayController(openOverlay)?.open() : closeOverlay ? () => action.getOverlayController(closeOverlay)?.close() : toggleOverlay ? () => action.getOverlayController(toggleOverlay)?.toggle() : openModal ? () => action.getOverlayController("Modal")?.open() : toggleModal ? () => action.getOverlayController("Modal")?.toggle() : closeModal ? () => action.getOverlayController("Modal")?.close() : voidAction;
|
|
17
24
|
return maybeAction ?? voidAction;
|
|
18
25
|
}
|
|
19
26
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getExecutionFunction.mjs","sources":["../../../../../../../src/components/Action/models/getExecutionFunction.ts"],"sourcesContent":["import type { ActionModel } from \"@/components/Action/models/ActionModel\";\nimport type
|
|
1
|
+
{"version":3,"file":"getExecutionFunction.mjs","sources":["../../../../../../../src/components/Action/models/getExecutionFunction.ts"],"sourcesContent":["import type { ActionModel } from \"@/components/Action/models/ActionModel\";\nimport { type ActionFn } from \"@/components/Action\";\n\nconst voidAction = () => {\n // do nothing\n};\n\nexport function getExecutionFunction(action: ActionModel): ActionFn {\n if (action.needsConfirmation) {\n return action.confirmationModalController.open;\n }\n\n const {\n onAction,\n toggleOverlay,\n closeOverlay,\n openOverlay,\n openModal,\n closeModal,\n toggleModal,\n } = action.actionProps;\n\n const maybeAction = onAction\n ? onAction\n : openOverlay\n ? () => action.getOverlayController(openOverlay)?.open()\n : closeOverlay\n ? () => action.getOverlayController(closeOverlay)?.close()\n : toggleOverlay\n ? () => action.getOverlayController(toggleOverlay)?.toggle()\n : openModal\n ? () => action.getOverlayController(\"Modal\")?.open()\n : toggleModal\n ? () => action.getOverlayController(\"Modal\")?.toggle()\n : closeModal\n ? () => action.getOverlayController(\"Modal\")?.close()\n : voidAction;\n\n return maybeAction ?? voidAction;\n}\n"],"names":[],"mappings":";;;;;AAGA,MAAM,aAAa,MAAM;AAEzB,CAAA;AAEO,SAAS,qBAAqB,MAAA,EAA+B;AAClE,EAAA,IAAI,OAAO,iBAAA,EAAmB;AAC5B,IAAA,OAAO,OAAO,2BAAA,CAA4B,IAAA;AAAA,EAC5C;AAEA,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,aAAA;AAAA,IACA,YAAA;AAAA,IACA,WAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,MACE,MAAA,CAAO,WAAA;AAEX,EAAA,MAAM,WAAA,GAAc,WAChB,QAAA,GACA,WAAA,GACE,MAAM,MAAA,CAAO,oBAAA,CAAqB,WAAW,CAAA,EAAG,IAAA,EAAK,GACrD,eACE,MAAM,MAAA,CAAO,oBAAA,CAAqB,YAAY,CAAA,EAAG,KAAA,KACjD,aAAA,GACE,MAAM,MAAA,CAAO,oBAAA,CAAqB,aAAa,CAAA,EAAG,QAAO,GACzD,SAAA,GACE,MAAM,MAAA,CAAO,oBAAA,CAAqB,OAAO,CAAA,EAAG,IAAA,EAAK,GACjD,WAAA,GACE,MAAM,MAAA,CAAO,qBAAqB,OAAO,CAAA,EAAG,MAAA,EAAO,GACnD,UAAA,GACE,MAAM,OAAO,oBAAA,CAAqB,OAAO,CAAA,EAAG,KAAA,EAAM,GAClD,UAAA;AAEhB,EAAA,OAAO,WAAA,IAAe,UAAA;AACxB;;;;"}
|
|
@@ -7,6 +7,9 @@ import { PropsContextProvider } from '../../lib/propsContext/components/PropsCon
|
|
|
7
7
|
import * as Aria from 'react-aria-components';
|
|
8
8
|
import 'mobx';
|
|
9
9
|
import { useOverlayController } from '../../lib/controller/overlay/useOverlayController.mjs';
|
|
10
|
+
import 'remeda';
|
|
11
|
+
import '@react-aria/utils';
|
|
12
|
+
import 'dot-prop';
|
|
10
13
|
import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
|
|
11
14
|
import { Options } from '../Options/Options.mjs';
|
|
12
15
|
import { TunnelExit } from '@mittwald/react-tunnel';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.mjs","sources":["../../../../../../src/components/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import { useRef, type PropsWithChildren } from \"react\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport * as Aria from \"react-aria-components\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { SearchFieldProps } from \"@/components/SearchField\";\nimport type { TextFieldProps } from \"@/components/TextField\";\nimport Options from \"@/components/Options\";\nimport { TunnelExit } from \"@mittwald/react-tunnel\";\nimport locales from \"./locales/*.locale.json\";\nimport Text from \"@/components/Text\";\nimport styles from \"./Autocomplete.module.scss\";\nimport {\n UNSAFE_PortalProvider,\n useFocusWithin,\n useLocalizedStringFormatter,\n useObjectRef,\n} from \"react-aria\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { isFocused } from \"@/lib/form/isFocused\";\nimport { emitElementValueChange } from \"@/lib/react/emitElementValueChange\";\n\nexport interface AutocompleteProps\n extends\n PropsWithChildren,\n PropsWithClassName,\n FlowComponentProps<HTMLInputElement>,\n Omit<\n Aria.AutocompleteProps,\n \"children\" | \"onInputChange\" | \"inputValue\" | \"defaultInputValue\" | \"ref\"\n > {}\n\n/** @flr-generate all */\nexport const Autocomplete = flowComponent(\"Autocomplete\", (props) => {\n const { children, ref, ...rest } = props;\n\n const inputRef = useObjectRef(ref);\n\n const { contains } = Aria.useFilter({ sensitivity: \"base\" });\n const stringFormatter = useLocalizedStringFormatter(locales);\n const container = useRef(null);\n\n const optionsOverlayController = useOverlayController(\"Popover\", {\n reuseControllerFromContext: false,\n });\n\n const focusWithin = useFocusWithin({\n onBlurWithin: optionsOverlayController.close,\n });\n\n const renderEmptyState = () => (\n <Text className={styles.empty}>\n {stringFormatter.format(\"autocomplete.empty\")}\n </Text>\n );\n\n const handleInputChange = (value: string) => {\n if (value === \"\") {\n optionsOverlayController.close();\n } else if (isFocused(inputRef.current)) {\n optionsOverlayController.open();\n }\n };\n\n const handleOptionAction = (key: Aria.Key) => {\n const value = String(key);\n if (inputRef.current) {\n emitElementValueChange(inputRef.current, value);\n }\n optionsOverlayController.close();\n };\n\n const inputProps: SearchFieldProps & TextFieldProps = {\n onKeyDown: (e) => {\n if (e.key === \"Enter\" && optionsOverlayController.isOpen) {\n e.preventDefault();\n }\n },\n ref: inputRef,\n onChange: handleInputChange,\n };\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props);\n\n const propsContext: PropsContext = {\n SearchField: inputProps,\n TextField: inputProps,\n Option: {\n tunnelId: \"options\",\n },\n Popover: {\n className: styles.popover,\n },\n ...fieldPropsContext,\n };\n\n return (\n <div {...fieldProps}>\n <FieldErrorCaptureContext>\n <PropsContextProvider\n props={propsContext}\n dependencies={[optionsOverlayController]}\n >\n <div {...focusWithin.focusWithinProps} ref={container}>\n <UNSAFE_PortalProvider getContainer={() => container.current}>\n <Aria.Autocomplete\n filter={contains}\n disableAutoFocusFirst\n {...rest}\n >\n {children}\n <Options\n onAction={handleOptionAction}\n triggerRef={inputRef}\n controller={optionsOverlayController}\n renderEmptyState={renderEmptyState}\n isNonModal\n placement=\"bottom start\"\n >\n <TunnelExit id=\"options\" />\n </Options>\n </Aria.Autocomplete>\n </UNSAFE_PortalProvider>\n </div>\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default Autocomplete;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Autocomplete.mjs","sources":["../../../../../../src/components/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import { useRef, type PropsWithChildren } from \"react\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport * as Aria from \"react-aria-components\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { SearchFieldProps } from \"@/components/SearchField\";\nimport type { TextFieldProps } from \"@/components/TextField\";\nimport Options from \"@/components/Options\";\nimport { TunnelExit } from \"@mittwald/react-tunnel\";\nimport locales from \"./locales/*.locale.json\";\nimport Text from \"@/components/Text\";\nimport styles from \"./Autocomplete.module.scss\";\nimport {\n UNSAFE_PortalProvider,\n useFocusWithin,\n useLocalizedStringFormatter,\n useObjectRef,\n} from \"react-aria\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { isFocused } from \"@/lib/form/isFocused\";\nimport { emitElementValueChange } from \"@/lib/react/emitElementValueChange\";\n\nexport interface AutocompleteProps\n extends\n PropsWithChildren,\n PropsWithClassName,\n FlowComponentProps<HTMLInputElement>,\n Omit<\n Aria.AutocompleteProps,\n \"children\" | \"onInputChange\" | \"inputValue\" | \"defaultInputValue\" | \"ref\"\n > {}\n\n/** @flr-generate all */\nexport const Autocomplete = flowComponent(\"Autocomplete\", (props) => {\n const { children, ref, ...rest } = props;\n\n const inputRef = useObjectRef(ref);\n\n const { contains } = Aria.useFilter({ sensitivity: \"base\" });\n const stringFormatter = useLocalizedStringFormatter(locales);\n const container = useRef(null);\n\n const optionsOverlayController = useOverlayController(\"Popover\", {\n reuseControllerFromContext: false,\n });\n\n const focusWithin = useFocusWithin({\n onBlurWithin: optionsOverlayController.close,\n });\n\n const renderEmptyState = () => (\n <Text className={styles.empty}>\n {stringFormatter.format(\"autocomplete.empty\")}\n </Text>\n );\n\n const handleInputChange = (value: string) => {\n if (value === \"\") {\n optionsOverlayController.close();\n } else if (isFocused(inputRef.current)) {\n optionsOverlayController.open();\n }\n };\n\n const handleOptionAction = (key: Aria.Key) => {\n const value = String(key);\n if (inputRef.current) {\n emitElementValueChange(inputRef.current, value);\n }\n optionsOverlayController.close();\n };\n\n const inputProps: SearchFieldProps & TextFieldProps = {\n onKeyDown: (e) => {\n if (e.key === \"Enter\" && optionsOverlayController.isOpen) {\n e.preventDefault();\n }\n },\n ref: inputRef,\n onChange: handleInputChange,\n };\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props);\n\n const propsContext: PropsContext = {\n SearchField: inputProps,\n TextField: inputProps,\n Option: {\n tunnelId: \"options\",\n },\n Popover: {\n className: styles.popover,\n },\n ...fieldPropsContext,\n };\n\n return (\n <div {...fieldProps}>\n <FieldErrorCaptureContext>\n <PropsContextProvider\n props={propsContext}\n dependencies={[optionsOverlayController]}\n >\n <div {...focusWithin.focusWithinProps} ref={container}>\n <UNSAFE_PortalProvider getContainer={() => container.current}>\n <Aria.Autocomplete\n filter={contains}\n disableAutoFocusFirst\n {...rest}\n >\n {children}\n <Options\n onAction={handleOptionAction}\n triggerRef={inputRef}\n controller={optionsOverlayController}\n renderEmptyState={renderEmptyState}\n isNonModal\n placement=\"bottom start\"\n >\n <TunnelExit id=\"options\" />\n </Options>\n </Aria.Autocomplete>\n </UNSAFE_PortalProvider>\n </div>\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default Autocomplete;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqCO,MAAM,YAAA,GAAe,aAAA,CAAc,cAAA,EAAgB,CAAC,KAAA,KAAU;AACnE,EAAA,MAAM,EAAE,QAAA,EAAU,GAAA,EAAK,GAAG,MAAK,GAAI,KAAA;AAEnC,EAAA,MAAM,QAAA,GAAW,aAAa,GAAG,CAAA;AAEjC,EAAA,MAAM,EAAE,UAAS,GAAI,IAAA,CAAK,UAAU,EAAE,WAAA,EAAa,QAAQ,CAAA;AAC3D,EAAA,MAA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,cAAA;AAAA,kBAEV,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,EAAA,EAAG,SAAA,EAAU;AAAA;AAAA;AAC3B;AAAA;AAAA,WAEJ,CAAA,EACF;AAAA;AAAA,KACF,EACF,CAAA;AAAA,wBACC,cAAA,EAAA,EAAe;AAAA,GAAA,EAClB,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -19,6 +19,9 @@ import { useLocalizedStringFormatter } from 'react-aria';
|
|
|
19
19
|
import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
|
|
20
20
|
import 'mobx';
|
|
21
21
|
import { useOverlayController } from '../../lib/controller/overlay/useOverlayController.mjs';
|
|
22
|
+
import 'remeda';
|
|
23
|
+
import '@react-aria/utils';
|
|
24
|
+
import 'dot-prop';
|
|
22
25
|
import { useFieldComponent } from '../../lib/hooks/useFieldComponent.mjs';
|
|
23
26
|
|
|
24
27
|
const ComboBox = flowComponent("ComboBox", (props) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboBox.mjs","sources":["../../../../../../src/components/ComboBox/ComboBox.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport type { Key } from \"react-aria-components\";\nimport * as Aria from \"react-aria-components\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport { Button } from \"@/components/Button\";\nimport { IconChevronDown } from \"@/components/Icon/components/icons\";\nimport { Options } from \"@/components/Options\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport styles from \"./ComboBox.module.scss\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport type { OptionsProps } from \"@/components/Options/Options\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\n\nexport interface ComboBoxProps\n extends\n Omit<Aria.ComboBoxProps<never>, \"children\">,\n Pick<Aria.InputProps, \"placeholder\">,\n Pick<OptionsProps, \"renderEmptyState\">,\n PropsWithChildren,\n FlowComponentProps<HTMLInputElement> {\n onChange?: (value: string) => void;\n}\n\n/** @flr-generate all */\nexport const ComboBox = flowComponent(\"ComboBox\", (props) => {\n const {\n children,\n className,\n menuTrigger = \"focus\",\n onChange,\n onSelectionChange,\n placeholder,\n ref,\n renderEmptyState,\n ...rest\n } = props;\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldProps,\n fieldPropsContext,\n } = useFieldComponent(props);\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const rootClassName = clsx(fieldProps.className, styles.comboBox, className);\n\n const propsContext: PropsContext = {\n Option: {\n tunnelId: \"options\",\n },\n ...fieldPropsContext,\n };\n\n const handleSelectionChange = (key: Key | null) => {\n if (key === null) {\n return;\n }\n onChange?.(String(key));\n onSelectionChange?.(key);\n };\n\n const controller = useOverlayController(\"ComboBox\", {\n reuseControllerFromContext: false,\n });\n\n return (\n <Aria.ComboBox\n {...fieldProps}\n menuTrigger={menuTrigger}\n className={rootClassName}\n {...rest}\n onSelectionChange={handleSelectionChange}\n onOpenChange={(isOpen) => {\n controller.setOpen(isOpen);\n }}\n >\n <PropsContextProvider props={propsContext}>\n <TunnelProvider>\n <FieldErrorCaptureContext>\n <div className={styles.input}>\n <Aria.Input placeholder={placeholder} ref={ref} />\n <Button\n className={styles.toggle}\n aria-label={stringFormatter.format(\"comboBox.showOptions\")}\n variant=\"plain\"\n color=\"secondary\"\n >\n <IconChevronDown />\n </Button>\n </div>\n\n {children}\n\n <Options\n controller={controller}\n onOpenChange={() => {\n // cut-off to avoid double controller state changes\n }}\n renderEmptyState={renderEmptyState}\n >\n <TunnelExit id=\"options\" />\n </Options>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </TunnelProvider>\n </PropsContextProvider>\n </Aria.ComboBox>\n );\n});\n\nexport default ComboBox;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ComboBox.mjs","sources":["../../../../../../src/components/ComboBox/ComboBox.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport type { Key } from \"react-aria-components\";\nimport * as Aria from \"react-aria-components\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport { Button } from \"@/components/Button\";\nimport { IconChevronDown } from \"@/components/Icon/components/icons\";\nimport { Options } from \"@/components/Options\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport styles from \"./ComboBox.module.scss\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport type { OptionsProps } from \"@/components/Options/Options\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\n\nexport interface ComboBoxProps\n extends\n Omit<Aria.ComboBoxProps<never>, \"children\">,\n Pick<Aria.InputProps, \"placeholder\">,\n Pick<OptionsProps, \"renderEmptyState\">,\n PropsWithChildren,\n FlowComponentProps<HTMLInputElement> {\n onChange?: (value: string) => void;\n}\n\n/** @flr-generate all */\nexport const ComboBox = flowComponent(\"ComboBox\", (props) => {\n const {\n children,\n className,\n menuTrigger = \"focus\",\n onChange,\n onSelectionChange,\n placeholder,\n ref,\n renderEmptyState,\n ...rest\n } = props;\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldProps,\n fieldPropsContext,\n } = useFieldComponent(props);\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const rootClassName = clsx(fieldProps.className, styles.comboBox, className);\n\n const propsContext: PropsContext = {\n Option: {\n tunnelId: \"options\",\n },\n ...fieldPropsContext,\n };\n\n const handleSelectionChange = (key: Key | null) => {\n if (key === null) {\n return;\n }\n onChange?.(String(key));\n onSelectionChange?.(key);\n };\n\n const controller = useOverlayController(\"ComboBox\", {\n reuseControllerFromContext: false,\n });\n\n return (\n <Aria.ComboBox\n {...fieldProps}\n menuTrigger={menuTrigger}\n className={rootClassName}\n {...rest}\n onSelectionChange={handleSelectionChange}\n onOpenChange={(isOpen) => {\n controller.setOpen(isOpen);\n }}\n >\n <PropsContextProvider props={propsContext}>\n <TunnelProvider>\n <FieldErrorCaptureContext>\n <div className={styles.input}>\n <Aria.Input placeholder={placeholder} ref={ref} />\n <Button\n className={styles.toggle}\n aria-label={stringFormatter.format(\"comboBox.showOptions\")}\n variant=\"plain\"\n color=\"secondary\"\n >\n <IconChevronDown />\n </Button>\n </div>\n\n {children}\n\n <Options\n controller={controller}\n onOpenChange={() => {\n // cut-off to avoid double controller state changes\n }}\n renderEmptyState={renderEmptyState}\n >\n <TunnelExit id=\"options\" />\n </Options>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </TunnelProvider>\n </PropsContextProvider>\n </Aria.ComboBox>\n );\n});\n\nexport default ComboBox;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8BO,MAAM,QAAA,GAAW,aAAA,CAAc,UAAA,EAAY,CAAC,KAAA,KAAU;AAC3D,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA,GAAc,OAAA;AAAA,IACd,QAAA;AAAA,IACA,iBAAA;AAAA,IACA,WAAA;AAAA,IACA,GAAA;AAAA,IACA,gBAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM;AAAA,IACJ,cAAA;AAAA,IACA,wBAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF,GAAI,kBAAkB,KAAK,CAAA;AAE3B,EAAA,MAAM,eAAA,GAAkB,4BAA4B,OAAO,CAAA;AAE3D,EAAA,MAAM,gBAAgB,IA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AA;AAAA,gBAClB,YAAA,EAAY,eAAA,CAAgB,MAAA,CAAO,sBAAsB,CAAA;AAAA,gBACzD,OAAA,EAAQ,OAAA;AAAA,gBACR,KAAA,EAAM,WAAA;AAAA,gBAEN,8BAAC,eAAA,EAAA,EAAgB;AAAA;AAAA;AACnB,WAAA,EACF,CAAA;AAAA,UAEC,QAAA;AAAA,0BAED,GAAA;AAAA,YAAC,OAAA;AAAA,YAAA;AAAA,cACC,UAAA;AAAA,cACA,cAAc,MAAM;AAAA,cAEpB,CAAA;AAAA,cACA,gBAAA;AAAA,cAEA,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,EAAA,EAAG,SAAA,EAAU;AAAA;AAAA;AAC3B,SAAA,EACF,CAAA;AAAA,4BACC,cAAA,EAAA,EAAe;AAAA,OAAA,EAClB,CAAA,EACF;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
|
|
@@ -10,8 +10,11 @@ import { Popover } from '../Popover/Popover.mjs';
|
|
|
10
10
|
import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
|
|
11
11
|
import 'mobx';
|
|
12
12
|
import { useOverlayController } from '../../lib/controller/overlay/useOverlayController.mjs';
|
|
13
|
-
import { OverlayContextProvider } from '../../lib/controller/overlay/OverlayContextProvider.mjs';
|
|
14
13
|
import '../../lib/propsContext/propsContext.mjs';
|
|
14
|
+
import 'remeda';
|
|
15
|
+
import '@react-aria/utils';
|
|
16
|
+
import 'dot-prop';
|
|
17
|
+
import { OverlayContextProvider } from '../../lib/controller/overlay/OverlayContextProvider.mjs';
|
|
15
18
|
import { PropsContextProvider } from '../../lib/propsContext/components/PropsContextProvider.mjs';
|
|
16
19
|
import ContextMenuContentView from '../../views/ContextMenuContentView.mjs';
|
|
17
20
|
import styles from './ContextMenu.module.scss.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.mjs","sources":["../../../../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["import { Action } from \"@/components/Action\";\nimport type { ContextMenuSelectionMode } from \"@/components/ContextMenu/lib\";\nimport {\n getAriaSelectionMode,\n getCloseOverlayType,\n getMenuItemSelectionVariant,\n} from \"@/components/ContextMenu/lib\";\nimport type { MenuItemProps } from \"@/components/MenuItem\";\nimport { Popover, type PopoverProps } from \"@/components/Popover/Popover\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport { OverlayContextProvider } from \"@/lib/controller/overlay/OverlayContextProvider\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport ContextMenuContentView from \"@/views/ContextMenuContentView\";\nimport type * as Aria from \"react-aria-components\";\nimport styles from \"./ContextMenu.module.scss\";\n\nexport interface ContextMenuProps\n extends\n Omit<PopoverProps, \"withTip\">,\n Pick<\n Aria.MenuProps<MenuItemProps>,\n | \"onAction\"\n | \"selectedKeys\"\n | \"defaultSelectedKeys\"\n | \"onSelectionChange\"\n | \"disabledKeys\"\n | \"renderEmptyState\"\n >,\n FlowComponentProps {\n /** The type of selection that is allowed in the context menu. */\n selectionMode?: ContextMenuSelectionMode;\n /** Sets the context menu to a fixed width. */\n width?: string | number;\n}\n\n/** @flr-generate all */\nexport const ContextMenu = flowComponent(\"ContextMenu\", (props) => {\n const {\n children,\n onAction,\n selectionMode,\n selectedKeys,\n defaultSelectedKeys,\n disabledKeys,\n onSelectionChange,\n renderEmptyState,\n ref,\n controller: overlayControllerFromProps,\n ...rest\n } = props;\n\n const overlayControllerFromContext = useOverlayController(\"ContextMenu\", {\n reuseControllerFromContext: true,\n });\n\n const overlayController =\n overlayControllerFromProps ?? overlayControllerFromContext;\n\n const selectionVariant = getMenuItemSelectionVariant(selectionMode);\n\n const propsContext: PropsContext = {\n MenuItem: {\n selectionVariant,\n Avatar: {\n size: \"l\",\n },\n },\n\n Section: {\n MenuItem: {\n Avatar: {\n size: \"l\",\n },\n },\n renderContextMenuSection: true,\n },\n\n ContextMenuSection: {\n MenuItem: {\n Avatar: {\n size: \"l\",\n },\n },\n },\n };\n\n return (\n <Popover\n {...rest}\n className={styles.popover}\n controller={overlayController}\n isDialogContent={false}\n >\n <OverlayContextProvider type=\"ContextMenu\" controller={overlayController}>\n <ContextMenuContentView\n className={styles.contextMenu}\n onAction={onAction}\n selectionMode={getAriaSelectionMode(selectionMode)}\n selectedKeys={selectedKeys}\n defaultSelectedKeys={defaultSelectedKeys}\n disabledKeys={disabledKeys}\n onSelectionChange={onSelectionChange}\n renderEmptyState={renderEmptyState}\n ref={ref}\n >\n <PropsContextProvider props={propsContext}>\n <Action closeOverlay={getCloseOverlayType(selectionMode)}>\n {children}\n </Action>\n </PropsContextProvider>\n </ContextMenuContentView>\n </OverlayContextProvider>\n </Popover>\n );\n});\n\nexport default ContextMenu;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContextMenu.mjs","sources":["../../../../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["import { Action } from \"@/components/Action\";\nimport type { ContextMenuSelectionMode } from \"@/components/ContextMenu/lib\";\nimport {\n getAriaSelectionMode,\n getCloseOverlayType,\n getMenuItemSelectionVariant,\n} from \"@/components/ContextMenu/lib\";\nimport type { MenuItemProps } from \"@/components/MenuItem\";\nimport { Popover, type PopoverProps } from \"@/components/Popover/Popover\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport { OverlayContextProvider } from \"@/lib/controller/overlay/OverlayContextProvider\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport ContextMenuContentView from \"@/views/ContextMenuContentView\";\nimport type * as Aria from \"react-aria-components\";\nimport styles from \"./ContextMenu.module.scss\";\n\nexport interface ContextMenuProps\n extends\n Omit<PopoverProps, \"withTip\">,\n Pick<\n Aria.MenuProps<MenuItemProps>,\n | \"onAction\"\n | \"selectedKeys\"\n | \"defaultSelectedKeys\"\n | \"onSelectionChange\"\n | \"disabledKeys\"\n | \"renderEmptyState\"\n >,\n FlowComponentProps {\n /** The type of selection that is allowed in the context menu. */\n selectionMode?: ContextMenuSelectionMode;\n /** Sets the context menu to a fixed width. */\n width?: string | number;\n}\n\n/** @flr-generate all */\nexport const ContextMenu = flowComponent(\"ContextMenu\", (props) => {\n const {\n children,\n onAction,\n selectionMode,\n selectedKeys,\n defaultSelectedKeys,\n disabledKeys,\n onSelectionChange,\n renderEmptyState,\n ref,\n controller: overlayControllerFromProps,\n ...rest\n } = props;\n\n const overlayControllerFromContext = useOverlayController(\"ContextMenu\", {\n reuseControllerFromContext: true,\n });\n\n const overlayController =\n overlayControllerFromProps ?? overlayControllerFromContext;\n\n const selectionVariant = getMenuItemSelectionVariant(selectionMode);\n\n const propsContext: PropsContext = {\n MenuItem: {\n selectionVariant,\n Avatar: {\n size: \"l\",\n },\n },\n\n Section: {\n MenuItem: {\n Avatar: {\n size: \"l\",\n },\n },\n renderContextMenuSection: true,\n },\n\n ContextMenuSection: {\n MenuItem: {\n Avatar: {\n size: \"l\",\n },\n },\n },\n };\n\n return (\n <Popover\n {...rest}\n className={styles.popover}\n controller={overlayController}\n isDialogContent={false}\n >\n <OverlayContextProvider type=\"ContextMenu\" controller={overlayController}>\n <ContextMenuContentView\n className={styles.contextMenu}\n onAction={onAction}\n selectionMode={getAriaSelectionMode(selectionMode)}\n selectedKeys={selectedKeys}\n defaultSelectedKeys={defaultSelectedKeys}\n disabledKeys={disabledKeys}\n onSelectionChange={onSelectionChange}\n renderEmptyState={renderEmptyState}\n ref={ref}\n >\n <PropsContextProvider props={propsContext}>\n <Action closeOverlay={getCloseOverlayType(selectionMode)}>\n {children}\n </Action>\n </PropsContextProvider>\n </ContextMenuContentView>\n </OverlayContextProvider>\n </Popover>\n );\n});\n\nexport default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iBAAA,EACrD,QAAA,kBAAA,GAAA;AAAA,QAAC,sBAAA;AAAA,QAAA;AAAA,UACC,WAAW,MAAA,CAAO,WAAA;AAAA,UAClB,QAAA;AAAA,UACA,aAAA,EAAe,qBAAqB,aAAa,CAAA;AAAA,UACjD,YAAA;AAAA,UACA,mBAAA;AAAA,UACA,YAAA;AAAA,UACA,iBAAA;AAAA,UACA,gBAAA;AAAA,UACA,GAAA;AAAA,UAEA,QAAA,kBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,YAAA,EAC3B,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAO,YAAA,EAAc,mBAAA,CAAoB,aAAa,CAAA,EACpD,QAAA,EACH,CAAA,EACF;AAAA;AAAA,OACF,EACF;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
|
|
@@ -9,6 +9,9 @@ import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
|
|
|
9
9
|
import 'mobx';
|
|
10
10
|
import 'react';
|
|
11
11
|
import { useOverlayController } from '../../lib/controller/overlay/useOverlayController.mjs';
|
|
12
|
+
import 'remeda';
|
|
13
|
+
import '@react-aria/utils';
|
|
14
|
+
import 'dot-prop';
|
|
12
15
|
|
|
13
16
|
const ContextualHelp = flowComponent("ContextualHelp", (props) => {
|
|
14
17
|
const {
|