@blaze-cms/react-page-builder 0.146.0-node18-tooltips.23 → 0.146.0-node18-core-styles-tooltips.22
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 +56 -34
- package/lib/components/Menu/Menu.js +4 -1
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/MenuContext.js +2 -1
- package/lib/components/Menu/MenuContext.js.map +1 -1
- package/lib/components/MenuItem/MenuItemRender.js +27 -12
- package/lib/components/MenuItem/MenuItemRender.js.map +1 -1
- package/lib/components/MenuItem/helpers/has-active-child.js +19 -0
- package/lib/components/MenuItem/helpers/has-active-child.js.map +1 -0
- package/lib/components/MenuItem/helpers/index.js +14 -0
- package/lib/components/MenuItem/helpers/index.js.map +1 -1
- package/lib/components/MenuItem/helpers/isUrlPathMatch.js +18 -0
- package/lib/components/MenuItem/helpers/isUrlPathMatch.js.map +1 -0
- package/lib-es/components/Menu/Menu.js +4 -1
- package/lib-es/components/Menu/Menu.js.map +1 -1
- package/lib-es/components/Menu/MenuContext.js +2 -1
- package/lib-es/components/Menu/MenuContext.js.map +1 -1
- package/lib-es/components/MenuItem/MenuItemRender.js +25 -11
- package/lib-es/components/MenuItem/MenuItemRender.js.map +1 -1
- package/lib-es/components/MenuItem/helpers/has-active-child.js +5 -0
- package/lib-es/components/MenuItem/helpers/has-active-child.js.map +1 -0
- package/lib-es/components/MenuItem/helpers/index.js +3 -1
- package/lib-es/components/MenuItem/helpers/index.js.map +1 -1
- package/lib-es/components/MenuItem/helpers/isUrlPathMatch.js +8 -0
- package/lib-es/components/MenuItem/helpers/isUrlPathMatch.js.map +1 -0
- package/package.json +10 -10
- package/src/components/Menu/Menu.js +3 -1
- package/src/components/Menu/MenuContext.js +1 -1
- package/src/components/MenuItem/MenuItemRender.js +40 -12
- package/src/components/MenuItem/helpers/has-active-child.js +10 -0
- package/src/components/MenuItem/helpers/index.js +3 -1
- package/src/components/MenuItem/helpers/isUrlPathMatch.js +10 -0
- package/tests/unit/src/components/MenuItem/MenuItem.test.js +5 -0
- package/tests/unit/src/components/MenuItem/MenuItemRender.test.js +11 -3
- package/tests/unit/src/components/MenuItem/helpers/constants.js +73 -0
- package/tests/unit/src/components/MenuItem/helpers/has-active-child.test.js +35 -0
- package/tests/unit/src/components/MenuItem/helpers/is-url-path-match.test.js +53 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,102 +3,107 @@
|
|
|
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.146.0-node18-tooltips.
|
|
6
|
+
# [0.146.0-node18-core-styles-tooltips.22](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles-tooltips.21...v0.146.0-node18-core-styles-tooltips.22) (2025-10-20)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
10
10
|
|
|
11
11
|
* content group variant should render passed props ([#4960](https://github.com/thebyte9/blaze/issues/4960)) ([6c947bb](https://github.com/thebyte9/blaze/commit/6c947bba61283b03185fb6a8865a96b55b8246a6))
|
|
12
|
+
* editor mode icon flicker improvements ([#4949](https://github.com/thebyte9/blaze/issues/4949)) ([211c72d](https://github.com/thebyte9/blaze/commit/211c72d83dc1da87e9bdef8e2a816af9ae3e321c))
|
|
13
|
+
* prevent search input from interfering with other inputs ([#4955](https://github.com/thebyte9/blaze/issues/4955)) ([78c6036](https://github.com/thebyte9/blaze/commit/78c6036c0040f07acfa71493bbbd73cdc4ad03b1))
|
|
14
|
+
* remove anchor links when search filters are applied ([#4957](https://github.com/thebyte9/blaze/issues/4957)) ([a5d4148](https://github.com/thebyte9/blaze/commit/a5d4148d1c122db654fe015f4892359ab0f9963c))
|
|
15
|
+
* reset input and results on click away ([#4930](https://github.com/thebyte9/blaze/issues/4930)) ([cebd271](https://github.com/thebyte9/blaze/commit/cebd271c09d0b32db5db52943888a342acd484d3))
|
|
12
16
|
|
|
13
17
|
|
|
18
|
+
### Features
|
|
14
19
|
|
|
20
|
+
* add accordion content group variant ([#4906](https://github.com/thebyte9/blaze/issues/4906)) ([879f4e4](https://github.com/thebyte9/blaze/commit/879f4e45e3d35de6ab8e739adb0739a94a5bbfb4))
|
|
21
|
+
* enable accordion component to be marked up with FAQPage schema ([#4913](https://github.com/thebyte9/blaze/issues/4913)) ([6bf92fe](https://github.com/thebyte9/blaze/commit/6bf92fe870f47dc6069b12ce0d8b29abc9fee3d5))
|
|
22
|
+
* update @blaze-react/checkboxes to 0.8.0-alpha.106 ([#4874](https://github.com/thebyte9/blaze/issues/4874)) ([0877a34](https://github.com/thebyte9/blaze/commit/0877a341086ff50d9243e2e2fda05ab2716d949c))
|
|
15
23
|
|
|
16
24
|
|
|
17
|
-
# [0.146.0-node18-tooltips.22](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-tooltips.21...v0.146.0-node18-tooltips.22) (2025-10-17)
|
|
18
25
|
|
|
19
26
|
|
|
20
|
-
### Bug Fixes
|
|
21
27
|
|
|
22
|
-
|
|
28
|
+
# [0.146.0-node18-core-styles-tooltips.20](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles-tooltips.19...v0.146.0-node18-core-styles-tooltips.20) (2025-10-03)
|
|
23
29
|
|
|
24
30
|
|
|
25
|
-
###
|
|
31
|
+
### Bug Fixes
|
|
26
32
|
|
|
27
|
-
*
|
|
33
|
+
* remove card wrapper that is not required ([#4938](https://github.com/thebyte9/blaze/issues/4938)) ([52a449c](https://github.com/thebyte9/blaze/commit/52a449c4de5d8d806112ff4159b4d5556030e5c3))
|
|
28
34
|
|
|
29
35
|
|
|
30
36
|
|
|
31
37
|
|
|
32
38
|
|
|
33
|
-
# [0.146.0-node18-tooltips.
|
|
39
|
+
# [0.146.0-node18-core-styles-tooltips.19](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles-tooltips.18...v0.146.0-node18-core-styles-tooltips.19) (2025-10-01)
|
|
34
40
|
|
|
35
41
|
|
|
36
42
|
### Bug Fixes
|
|
37
43
|
|
|
38
|
-
*
|
|
44
|
+
* render all group sections ([#4903](https://github.com/thebyte9/blaze/issues/4903)) ([fb79560](https://github.com/thebyte9/blaze/commit/fb7956017d8486ed345cfee889882d8c756c117f))
|
|
45
|
+
* updated chart icon ([#4925](https://github.com/thebyte9/blaze/issues/4925)) ([0cc8721](https://github.com/thebyte9/blaze/commit/0cc87217889e3c5ab93adb4ba8d7506fc78d9316))
|
|
39
46
|
|
|
40
47
|
|
|
41
48
|
|
|
42
49
|
|
|
43
50
|
|
|
44
|
-
# [0.146.0-node18-tooltips.
|
|
51
|
+
# [0.146.0-node18-core-styles-tooltips.18](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles-tooltips.17...v0.146.0-node18-core-styles-tooltips.18) (2025-09-29)
|
|
45
52
|
|
|
46
53
|
|
|
47
54
|
### Bug Fixes
|
|
48
55
|
|
|
49
|
-
*
|
|
50
|
-
* reset input and results on click away ([#4930](https://github.com/thebyte9/blaze/issues/4930)) ([cebd271](https://github.com/thebyte9/blaze/commit/cebd271c09d0b32db5db52943888a342acd484d3))
|
|
56
|
+
* update range when changing unit ([#4893](https://github.com/thebyte9/blaze/issues/4893)) ([817789a](https://github.com/thebyte9/blaze/commit/817789a1b5fac364ff004981855e04d25c6d8544))
|
|
51
57
|
|
|
52
58
|
|
|
53
59
|
### Features
|
|
54
60
|
|
|
55
|
-
*
|
|
56
|
-
* enable accordion component to be marked up with FAQPage schema ([#4913](https://github.com/thebyte9/blaze/issues/4913)) ([6bf92fe](https://github.com/thebyte9/blaze/commit/6bf92fe870f47dc6069b12ce0d8b29abc9fee3d5))
|
|
61
|
+
* navigate on SearchFilter submit even without changes ([#4904](https://github.com/thebyte9/blaze/issues/4904)) ([082e72e](https://github.com/thebyte9/blaze/commit/082e72ee8fec81f93a6664d7375e947fa0972c32))
|
|
57
62
|
|
|
58
63
|
|
|
59
64
|
|
|
60
65
|
|
|
61
66
|
|
|
62
|
-
# [0.146.0-node18-tooltips.
|
|
67
|
+
# [0.146.0-node18-core-styles-tooltips.15](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles-tooltips.14...v0.146.0-node18-core-styles-tooltips.15) (2025-09-23)
|
|
63
68
|
|
|
69
|
+
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
|
64
70
|
|
|
65
|
-
### Bug Fixes
|
|
66
71
|
|
|
67
|
-
* remove card wrapper that is not required ([#4938](https://github.com/thebyte9/blaze/issues/4938)) ([52a449c](https://github.com/thebyte9/blaze/commit/52a449c4de5d8d806112ff4159b4d5556030e5c3))
|
|
68
72
|
|
|
69
73
|
|
|
70
74
|
|
|
75
|
+
# [0.146.0-node18-core-styles-tooltips.13](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles-tooltips.12...v0.146.0-node18-core-styles-tooltips.13) (2025-09-15)
|
|
71
76
|
|
|
77
|
+
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
|
72
78
|
|
|
73
|
-
# [0.146.0-node18-tooltips.11](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-tooltips.10...v0.146.0-node18-tooltips.11) (2025-10-01)
|
|
74
79
|
|
|
75
80
|
|
|
76
|
-
### Bug Fixes
|
|
77
81
|
|
|
78
|
-
* render all group sections ([#4903](https://github.com/thebyte9/blaze/issues/4903)) ([fb79560](https://github.com/thebyte9/blaze/commit/fb7956017d8486ed345cfee889882d8c756c117f))
|
|
79
|
-
* updated chart icon ([#4925](https://github.com/thebyte9/blaze/issues/4925)) ([0cc8721](https://github.com/thebyte9/blaze/commit/0cc87217889e3c5ab93adb4ba8d7506fc78d9316))
|
|
80
82
|
|
|
83
|
+
# [0.146.0-node18-core-styles-tooltips.12](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles-tooltips.11...v0.146.0-node18-core-styles-tooltips.12) (2025-08-27)
|
|
81
84
|
|
|
82
85
|
|
|
86
|
+
### Bug Fixes
|
|
83
87
|
|
|
88
|
+
* add react import missing from editor mode components ([#4885](https://github.com/thebyte9/blaze/issues/4885)) ([bb6e3eb](https://github.com/thebyte9/blaze/commit/bb6e3eb238a0f0263ed13a32e5121f49d21b2add))
|
|
84
89
|
|
|
85
|
-
# [0.146.0-node18-tooltips.8](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-tooltips.7...v0.146.0-node18-tooltips.8) (2025-09-24)
|
|
86
90
|
|
|
87
91
|
|
|
88
|
-
### Bug Fixes
|
|
89
92
|
|
|
90
|
-
|
|
93
|
+
|
|
94
|
+
# [0.146.0-node18-core-styles-tooltips.11](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles-tooltips.10...v0.146.0-node18-core-styles-tooltips.11) (2025-08-27)
|
|
91
95
|
|
|
92
96
|
|
|
93
97
|
### Features
|
|
94
98
|
|
|
95
|
-
*
|
|
99
|
+
* add hook for search content component ([#4866](https://github.com/thebyte9/blaze/issues/4866)) ([2fe2fb9](https://github.com/thebyte9/blaze/commit/2fe2fb91a13199b2c7cabbd734c3b79f9c962cad))
|
|
100
|
+
* add unit support to range filters ([fabc125](https://github.com/thebyte9/blaze/commit/fabc125355a4097c0fbe71e8419f207f93929926))
|
|
96
101
|
|
|
97
102
|
|
|
98
103
|
|
|
99
104
|
|
|
100
105
|
|
|
101
|
-
# [0.146.0-node18-tooltips.
|
|
106
|
+
# [0.146.0-node18-core-styles-tooltips.5](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles-tooltips.4...v0.146.0-node18-core-styles-tooltips.5) (2025-07-18)
|
|
102
107
|
|
|
103
108
|
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
|
104
109
|
|
|
@@ -106,33 +111,50 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
106
111
|
|
|
107
112
|
|
|
108
113
|
|
|
109
|
-
# [0.146.0-node18-tooltips.
|
|
114
|
+
# [0.146.0-node18-core-styles-tooltips.4](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles-tooltips.3...v0.146.0-node18-core-styles-tooltips.4) (2025-07-10)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### Bug Fixes
|
|
118
|
+
|
|
119
|
+
* add constant to avoid duplication ([07d6742](https://github.com/thebyte9/blaze/commit/07d6742f894ee8e063c17847fbb89559c23c5766))
|
|
120
|
+
* respond to live blog item size changes for laze loaded image, live blog title and global light box fix ([#4730](https://github.com/thebyte9/blaze/issues/4730)) ([5dd38d8](https://github.com/thebyte9/blaze/commit/5dd38d8d9e5983c55d3053d440eb7ab618688920))
|
|
110
121
|
|
|
111
|
-
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
|
112
122
|
|
|
113
123
|
|
|
114
124
|
|
|
115
125
|
|
|
126
|
+
# [0.146.0-node18-core-styles-tooltips.1](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles-tooltips.0...v0.146.0-node18-core-styles-tooltips.1) (2025-06-20)
|
|
116
127
|
|
|
117
|
-
|
|
128
|
+
|
|
129
|
+
### Features
|
|
130
|
+
|
|
131
|
+
* added frontend links for editor mode ([#4801](https://github.com/thebyte9/blaze/issues/4801)) ([d5de370](https://github.com/thebyte9/blaze/commit/d5de370203abf467fcc3819d06c7375f4a6c1eb9))
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
# [0.146.0-node18-core-styles-tooltips.0](https://github.com/thebyte9/blaze/compare/v0.145.0...v0.146.0-node18-core-styles-tooltips.0) (2025-06-18)
|
|
118
138
|
|
|
119
139
|
|
|
120
140
|
### Bug Fixes
|
|
121
141
|
|
|
122
|
-
*
|
|
123
|
-
* add react import missing from editor mode components ([#4885](https://github.com/thebyte9/blaze/issues/4885)) ([bb6e3eb](https://github.com/thebyte9/blaze/commit/bb6e3eb238a0f0263ed13a32e5121f49d21b2add))
|
|
142
|
+
* menu setdisplaychildren logic ([#4629](https://github.com/thebyte9/blaze/issues/4629)) ([16c5c67](https://github.com/thebyte9/blaze/commit/16c5c674f4db1505131a8557d34f5349cf33fc42))
|
|
124
143
|
* added space between image counter ([fe23887](https://github.com/thebyte9/blaze/commit/fe23887db201c8f8c4d3c2df6b0f84adac84df9f))
|
|
125
144
|
* apply search filters even when shouldAddFilters is false ([ac82708](https://github.com/thebyte9/blaze/commit/ac827080df3001f4643a2d7a69b8f5502646cf77))
|
|
126
145
|
* changed image lightbox counter ([3e22b68](https://github.com/thebyte9/blaze/commit/3e22b6817d60d2b4fd4beac713f864fdb5b6826e))
|
|
127
146
|
* close menu item on url change ([#4669](https://github.com/thebyte9/blaze/issues/4669)) ([697750a](https://github.com/thebyte9/blaze/commit/697750ac771a5ea89702e990e23d6e78b1c45a67))
|
|
128
147
|
* encode dynamic menu urls ([#4497](https://github.com/thebyte9/blaze/issues/4497)) ([43695a0](https://github.com/thebyte9/blaze/commit/43695a01408a85a5cd94704d9b78f36fd3fb509f))
|
|
129
148
|
* exported necessary helpers from blaze react page builder ([#4466](https://github.com/thebyte9/blaze/issues/4466)) ([9a8d0db](https://github.com/thebyte9/blaze/commit/9a8d0db28dc0fbf7a2c93733fa1c7d61f293ac1b))
|
|
149
|
+
* extended regex for #s in urls ([#4648](https://github.com/thebyte9/blaze/issues/4648)) ([089b19a](https://github.com/thebyte9/blaze/commit/089b19afaf503477429df3415fcd382e8b55745a))
|
|
130
150
|
* fixed breaking tests, updated next to 14 ([fecb0e1](https://github.com/thebyte9/blaze/commit/fecb0e1d822bd69ebbaa084072a219f0fddd23f1))
|
|
131
151
|
* fixed code smells ([95d874e](https://github.com/thebyte9/blaze/commit/95d874e7e392e8e39921c146c86987d515d090e5))
|
|
132
152
|
* fixed more tests ([46a2fb9](https://github.com/thebyte9/blaze/commit/46a2fb9467f9f3c9cf320c9caf36c66503cc1f49))
|
|
133
153
|
* fixed nan values on ranges ([#4582](https://github.com/thebyte9/blaze/issues/4582)) ([963ceec](https://github.com/thebyte9/blaze/commit/963ceec6b1eea027cb36b9358f7dee5e91e852ce))
|
|
134
154
|
* fixed url change not reflecting on filters ([#4488](https://github.com/thebyte9/blaze/issues/4488)) ([0d6574f](https://github.com/thebyte9/blaze/commit/0d6574f5d5e698633c6032668cb8e1d914cf0342))
|
|
135
155
|
* fixed url not being decoded when set on useEffect in SearchFilterContainer ([#4492](https://github.com/thebyte9/blaze/issues/4492)) ([64ba7a0](https://github.com/thebyte9/blaze/commit/64ba7a0260ee657561df5273fac3e537d6845db0))
|
|
156
|
+
* fixed variable placing ([cbd733b](https://github.com/thebyte9/blaze/commit/cbd733b15bf9094bec7f2349267042fe22a54dac))
|
|
157
|
+
* handle active url ([58be170](https://github.com/thebyte9/blaze/commit/58be170c8641abeb89e6b51dca9c5a75179c3dd7))
|
|
136
158
|
* handle reseting filters and pagination with correct client scroll ([#4804](https://github.com/thebyte9/blaze/issues/4804)) ([8f098d9](https://github.com/thebyte9/blaze/commit/8f098d9240fe260911f399a54d91e235aa109b76))
|
|
137
159
|
* improve filter and pagination scroll client side ([#4803](https://github.com/thebyte9/blaze/issues/4803)) ([b438755](https://github.com/thebyte9/blaze/commit/b4387551cb9fea3197c83db6b245ecd11a2dd64a))
|
|
138
160
|
* lint errors in node 18 dev ([#4784](https://github.com/thebyte9/blaze/issues/4784)) ([5b102df](https://github.com/thebyte9/blaze/commit/5b102df10a77abc62aa94ffa476f1c2156c17947))
|
|
@@ -142,15 +164,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
142
164
|
* permission should be returned when returnPermission=true ([#4775](https://github.com/thebyte9/blaze/issues/4775)) ([5f9f903](https://github.com/thebyte9/blaze/commit/5f9f90341c871d9dc76b035b7511e71cb7f964fe))
|
|
143
165
|
* persist last selected filter ([#4526](https://github.com/thebyte9/blaze/issues/4526)) ([5b15b57](https://github.com/thebyte9/blaze/commit/5b15b57f5b008a6a9b71a0ea4d5a7bc75b1779a3))
|
|
144
166
|
* remove limit from dynamic menu item check ([535e557](https://github.com/thebyte9/blaze/commit/535e5574817c3d4248419cf42961fdc27c28dd34))
|
|
167
|
+
* remove limit from dynamic menu item check ([#4533](https://github.com/thebyte9/blaze/issues/4533)) ([2f9cba8](https://github.com/thebyte9/blaze/commit/2f9cba859223e0d2a81ce8bb816cfacbe7b474b6))
|
|
145
168
|
* remove youtube origin api param as it breaks SSR ([#4538](https://github.com/thebyte9/blaze/issues/4538)) ([98f71c5](https://github.com/thebyte9/blaze/commit/98f71c501fa8f01f9187d3ab7807c8fc4eada3e6))
|
|
146
169
|
* removed commented code ([5e93306](https://github.com/thebyte9/blaze/commit/5e933063ff0896dc67da0b33506231bc57427a40))
|
|
147
170
|
* removed empty sapce ([461f486](https://github.com/thebyte9/blaze/commit/461f4868cf7a49208825851ff4dbc22a2c65974e))
|
|
148
171
|
* resolving eslint warnings ([d4d1568](https://github.com/thebyte9/blaze/commit/d4d1568751c3f63a630bf396ff002c7fdc2532e8))
|
|
149
172
|
* resolving eslint warnings ([a0fc18a](https://github.com/thebyte9/blaze/commit/a0fc18a4b4ef4f2f50edf2ae9fd24ab8fb4ef2bb))
|
|
150
|
-
* respond to live blog item size changes for laze loaded image, live blog title and global light box fix ([#4730](https://github.com/thebyte9/blaze/issues/4730)) ([5dd38d8](https://github.com/thebyte9/blaze/commit/5dd38d8d9e5983c55d3053d440eb7ab618688920))
|
|
151
173
|
* set correct list limit ([#4714](https://github.com/thebyte9/blaze/issues/4714)) ([4b981a2](https://github.com/thebyte9/blaze/commit/4b981a29a19e78d1cbd72fa2ab1d867958e0bdee))
|
|
174
|
+
* typo ([88018f9](https://github.com/thebyte9/blaze/commit/88018f96fe2559a981826acb67a60f5b02c94f04))
|
|
152
175
|
* udpated yarn lock ([0cd4fa4](https://github.com/thebyte9/blaze/commit/0cd4fa4a185fca4b80b57e472badb771dd649ec2))
|
|
153
176
|
* update content tab state using url instead of url and button click ([#4759](https://github.com/thebyte9/blaze/issues/4759)) ([f5beff6](https://github.com/thebyte9/blaze/commit/f5beff686c059fb4523e87b274da5d630285478e))
|
|
177
|
+
* update snapshot ([f3e1029](https://github.com/thebyte9/blaze/commit/f3e1029d9eb713a3126f396966ad01516a6a6add))
|
|
154
178
|
* updated jest dependences/setup ([6d6cba8](https://github.com/thebyte9/blaze/commit/6d6cba84b3c4ce4d4da7463098de19815a9fb7a6))
|
|
155
179
|
* updated react-testing-library ([ec9a955](https://github.com/thebyte9/blaze/commit/ec9a955d8991989a8daf6910d084b2853f557647))
|
|
156
180
|
* updated with dev ([90f545f](https://github.com/thebyte9/blaze/commit/90f545f1beabb35e26ba6fb2b45a7a0dfd072927))
|
|
@@ -164,13 +188,10 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
164
188
|
### Features
|
|
165
189
|
|
|
166
190
|
* add Floating Side Button variant with MVP styling ([#4594](https://github.com/thebyte9/blaze/issues/4594)) ([effb843](https://github.com/thebyte9/blaze/commit/effb843fa9c226fbf07b3ad3dac359d81e164590))
|
|
167
|
-
* add hook for search content component ([#4866](https://github.com/thebyte9/blaze/issues/4866)) ([2fe2fb9](https://github.com/thebyte9/blaze/commit/2fe2fb91a13199b2c7cabbd734c3b79f9c962cad))
|
|
168
191
|
* add list live variant ([#4727](https://github.com/thebyte9/blaze/issues/4727)) ([f482abf](https://github.com/thebyte9/blaze/commit/f482abfe03bf6db2d2d7eb462f8141ff80c1cc79))
|
|
169
192
|
* add live property to content entities ([#4729](https://github.com/thebyte9/blaze/issues/4729)) ([8cdc5d6](https://github.com/thebyte9/blaze/commit/8cdc5d6b57945590ac97bd2da82c7ad74583c51d))
|
|
170
193
|
* add tooltip support to parent select in DynamicRelation component ([#4603](https://github.com/thebyte9/blaze/issues/4603)) ([7767b5d](https://github.com/thebyte9/blaze/commit/7767b5dd7641d4b0c2477cffe6c0be8f9e8aa9dd))
|
|
171
|
-
* add unit support to range filters ([fabc125](https://github.com/thebyte9/blaze/commit/fabc125355a4097c0fbe71e8419f207f93929926))
|
|
172
194
|
* add video component events for youtube and jwplayer ([7b4aa78](https://github.com/thebyte9/blaze/commit/7b4aa78dea3798d736b32aed13760cc67445780c))
|
|
173
|
-
* added frontend links for editor mode ([#4801](https://github.com/thebyte9/blaze/issues/4801)) ([d5de370](https://github.com/thebyte9/blaze/commit/d5de370203abf467fcc3819d06c7375f4a6c1eb9))
|
|
174
195
|
* added Loading component ([#4469](https://github.com/thebyte9/blaze/issues/4469)) ([957f09b](https://github.com/thebyte9/blaze/commit/957f09bab84e2e08df879abf4eec17293d167e00))
|
|
175
196
|
* allow customisation of refine search text ([#4489](https://github.com/thebyte9/blaze/issues/4489)) ([2082c4b](https://github.com/thebyte9/blaze/commit/2082c4b9322882cf779c9619d32ff44793324723))
|
|
176
197
|
* dynamic menu items ([#4099](https://github.com/thebyte9/blaze/issues/4099)) ([c1e052b](https://github.com/thebyte9/blaze/commit/c1e052ba93218d4f603c697cf8b533d2d0befbf1))
|
|
@@ -178,6 +199,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
178
199
|
* improve card click wrapper feature flag to make valid html ([#4495](https://github.com/thebyte9/blaze/issues/4495)) ([cc01f4d](https://github.com/thebyte9/blaze/commit/cc01f4dae15158c0896d48ed05cb32a64c8caa1b))
|
|
179
200
|
* make editorview card placeholders dynamic ([#4722](https://github.com/thebyte9/blaze/issues/4722)) ([872be4a](https://github.com/thebyte9/blaze/commit/872be4ac9537fa8d52c705c4b120eec23a35afae))
|
|
180
201
|
* move error message component to react page builder ([#4680](https://github.com/thebyte9/blaze/issues/4680)) ([5585514](https://github.com/thebyte9/blaze/commit/55855146a43300c702d7a8284828f592854950c7))
|
|
202
|
+
* new preOpenMenu menu setting ([db23d0d](https://github.com/thebyte9/blaze/commit/db23d0d46a3bfe9db848ce5b52532c13e8ed5aa0))
|
|
181
203
|
* update image-cdn-react package with fetchpolicy update ([#4564](https://github.com/thebyte9/blaze/issues/4564)) ([1b6b719](https://github.com/thebyte9/blaze/commit/1b6b71952dc63f90fdecde1c4214e59a3207d615))
|
|
182
204
|
* updated react to 18 ([9335f84](https://github.com/thebyte9/blaze/commit/9335f8432b376494501abb9c3deef1ddaa9b35a8))
|
|
183
205
|
|
|
@@ -30,6 +30,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
30
30
|
var Menu = function Menu(_ref) {
|
|
31
31
|
var children = _ref.children,
|
|
32
32
|
collapse = _ref.collapse,
|
|
33
|
+
openActiveSubmenus = _ref.openActiveSubmenus,
|
|
33
34
|
modifier = _ref.modifier,
|
|
34
35
|
mobileMenuModifier = _ref.mobileMenuModifier,
|
|
35
36
|
mobileMenuChildrenModifier = _ref.mobileMenuChildrenModifier,
|
|
@@ -66,7 +67,8 @@ var Menu = function Menu(_ref) {
|
|
|
66
67
|
});
|
|
67
68
|
return /*#__PURE__*/_react["default"].createElement(_MenuContext["default"].Provider, {
|
|
68
69
|
value: {
|
|
69
|
-
showMobileMenu: showMobileMenu
|
|
70
|
+
showMobileMenu: showMobileMenu,
|
|
71
|
+
openActiveSubmenus: openActiveSubmenus
|
|
70
72
|
}
|
|
71
73
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
72
74
|
className: menuWrapperClasses
|
|
@@ -106,6 +108,7 @@ var Menu = function Menu(_ref) {
|
|
|
106
108
|
};
|
|
107
109
|
Menu.propTypes = {
|
|
108
110
|
collapse: _propTypes["default"].bool.isRequired,
|
|
111
|
+
openActiveSubmenus: _propTypes["default"].bool.isRequired,
|
|
109
112
|
logoOnMobile: _propTypes["default"].bool.isRequired,
|
|
110
113
|
logoOnDesktop: _propTypes["default"].bool,
|
|
111
114
|
logoOnMobileUrl: _propTypes["default"].string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_button","_classnames2","_router","_md","_nextjsComponents","_MenuContext","_BlazeLink","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Menu","_ref","children","collapse","modifier","mobileMenuModifier","mobileMenuChildrenModifier","mobileIconAlignment","mobileButtonModifier","hamburgerIconModifier","logoOnMobile","logoOnDesktop","logoOnMobileUrl","logoOnMobileAlt","logoOnMobileModifier","logoOnDesktopModifier","closeIconModifier","router","useRouter","_useState","useState","_useState2","_slicedToArray2","showMobileMenu","setShowMobileMenu","useEffect","handleRouteChange","events","on","off","shouldDisplayChildren","childModifiers","classnames","_defineProperty2","isMobileMenuExpanded","concat","menuWrapperClasses","createElement","Provider","value","className","onClick","label","MdClose","MdMenu","Link","href","name","src","alt","propTypes","PropTypes","bool","isRequired","string","oneOfType","arrayOf","node","defaultProps","_default","exports"],"sources":["../../../src/components/Menu/Menu.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport BlazeButton from '@blaze-react/button';\nimport classnames from 'classnames';\nimport { useRouter } from 'next/router';\nimport { MdMenu, MdClose } from 'react-icons/md';\nimport { Link } from '@blaze-cms/nextjs-components';\nimport MenuContext from './MenuContext';\nimport BlazeLink from '../BlazeLink';\n\nconst Menu = ({\n children,\n collapse,\n modifier,\n mobileMenuModifier,\n mobileMenuChildrenModifier,\n mobileIconAlignment,\n mobileButtonModifier,\n hamburgerIconModifier,\n logoOnMobile,\n logoOnDesktop,\n logoOnMobileUrl,\n logoOnMobileAlt,\n logoOnMobileModifier,\n logoOnDesktopModifier,\n closeIconModifier\n}) => {\n const router = useRouter();\n const [showMobileMenu, setShowMobileMenu] = useState(false);\n\n useEffect(() => {\n const handleRouteChange = () => setShowMobileMenu(false);\n router.events.on('routeChangeStart', handleRouteChange);\n\n return () => {\n router.events.off('routeChangeStart', handleRouteChange);\n };\n }, [router.events]);\n\n const shouldDisplayChildren = collapse ? showMobileMenu : true;\n\n const childModifiers = classnames({\n [mobileMenuChildrenModifier]: shouldDisplayChildren,\n [modifier]: !showMobileMenu\n });\n\n const isMobileMenuExpanded = showMobileMenu ? `${mobileMenuModifier}` : '';\n const menuWrapperClasses = classnames('menu--wrapper', {\n 'menu--wrapper--mobile-open': showMobileMenu,\n 'menu--wrapper--mobile-closed': collapse && !showMobileMenu\n });\n\n return (\n <MenuContext.Provider value={{ showMobileMenu }}>\n <div className={menuWrapperClasses}>\n {collapse && (\n <div className=\"menu--mobile-wrapper\">\n <div\n className={`flex w-screen z-50 justify-${mobileIconAlignment} ${isMobileMenuExpanded}`}>\n <BlazeButton\n className={`menu--mobile-button ${mobileButtonModifier}`}\n onClick={() => setShowMobileMenu(!showMobileMenu)}\n label={showMobileMenu ? 'Close mobile menu' : 'Open mobile menu'}>\n <i>\n {showMobileMenu ? (\n <MdClose className={closeIconModifier} />\n ) : (\n <MdMenu className={hamburgerIconModifier} />\n )}\n </i>\n </BlazeButton>\n </div>\n </div>\n )}\n {logoOnMobile && !showMobileMenu && (\n <Link href=\"/\" name=\"mobile menu\">\n <img src={logoOnMobileUrl} alt={logoOnMobileAlt} className={logoOnMobileModifier} />\n </Link>\n )}\n\n <div className=\"menu--desktop-wrapper\">\n <ul className={childModifiers}>\n {logoOnDesktop && (\n <BlazeLink href=\"/\" className=\"\">\n <img\n src={logoOnMobileUrl}\n alt={logoOnMobileAlt}\n className={logoOnDesktopModifier}\n />\n </BlazeLink>\n )}\n {children}\n </ul>\n </div>\n </div>\n </MenuContext.Provider>\n );\n};\n\nMenu.propTypes = {\n collapse: PropTypes.bool.isRequired,\n logoOnMobile: PropTypes.bool.isRequired,\n logoOnDesktop: PropTypes.bool,\n logoOnMobileUrl: PropTypes.string,\n logoOnMobileAlt: PropTypes.string,\n logoOnMobileModifier: PropTypes.string,\n logoOnDesktopModifier: PropTypes.string,\n hamburgerIconModifier: PropTypes.string,\n closeIconModifier: PropTypes.string,\n mobileButtonModifier: PropTypes.string,\n mobileMenuModifier: PropTypes.string,\n mobileMenuChildrenModifier: PropTypes.string,\n modifier: PropTypes.string,\n mobileIconAlignment: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nMenu.defaultProps = {\n logoOnDesktop: false,\n logoOnMobileUrl: '',\n logoOnMobileAlt: '',\n logoOnMobileModifier: '',\n logoOnDesktopModifier: '',\n hamburgerIconModifier: '',\n closeIconModifier: '',\n mobileButtonModifier: '',\n mobileIconAlignment: '',\n mobileMenuModifier: '',\n mobileMenuChildrenModifier: '',\n modifier: '',\n children: []\n};\n\nexport default Menu;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,YAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,GAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,UAAA,GAAAP,sBAAA,CAAAF,OAAA;AAAqC,SAAAU,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,M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E;EAC9BF,QAAQ,EAAE,EAAE;EACZF,QAAQ,EAAE;AACZ,CAAC;AAAC,IAAAyD,QAAA,GAAAC,OAAA,cAEa5D,IAAI","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Menu.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_button","_classnames2","_router","_md","_nextjsComponents","_MenuContext","_BlazeLink","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Menu","_ref","children","collapse","openActiveSubmenus","modifier","mobileMenuModifier","mobileMenuChildrenModifier","mobileIconAlignment","mobileButtonModifier","hamburgerIconModifier","logoOnMobile","logoOnDesktop","logoOnMobileUrl","logoOnMobileAlt","logoOnMobileModifier","logoOnDesktopModifier","closeIconModifier","router","useRouter","_useState","useState","_useState2","_slicedToArray2","showMobileMenu","setShowMobileMenu","useEffect","handleRouteChange","events","on","off","shouldDisplayChildren","childModifiers","classnames","_defineProperty2","isMobileMenuExpanded","concat","menuWrapperClasses","createElement","Provider","value","className","onClick","label","MdClose","MdMenu","Link","href","name","src","alt","propTypes","PropTypes","bool","isRequired","string","oneOfType","arrayOf","node","defaultProps","_default","exports"],"sources":["../../../src/components/Menu/Menu.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport BlazeButton from '@blaze-react/button';\nimport classnames from 'classnames';\nimport { useRouter } from 'next/router';\nimport { MdMenu, MdClose } from 'react-icons/md';\nimport { Link } from '@blaze-cms/nextjs-components';\nimport MenuContext from './MenuContext';\nimport BlazeLink from '../BlazeLink';\n\nconst Menu = ({\n children,\n collapse,\n openActiveSubmenus,\n modifier,\n mobileMenuModifier,\n mobileMenuChildrenModifier,\n mobileIconAlignment,\n mobileButtonModifier,\n hamburgerIconModifier,\n logoOnMobile,\n logoOnDesktop,\n logoOnMobileUrl,\n logoOnMobileAlt,\n logoOnMobileModifier,\n logoOnDesktopModifier,\n closeIconModifier\n}) => {\n const router = useRouter();\n const [showMobileMenu, setShowMobileMenu] = useState(false);\n\n useEffect(() => {\n const handleRouteChange = () => setShowMobileMenu(false);\n router.events.on('routeChangeStart', handleRouteChange);\n\n return () => {\n router.events.off('routeChangeStart', handleRouteChange);\n };\n }, [router.events]);\n\n const shouldDisplayChildren = collapse ? showMobileMenu : true;\n\n const childModifiers = classnames({\n [mobileMenuChildrenModifier]: shouldDisplayChildren,\n [modifier]: !showMobileMenu\n });\n\n const isMobileMenuExpanded = showMobileMenu ? `${mobileMenuModifier}` : '';\n const menuWrapperClasses = classnames('menu--wrapper', {\n 'menu--wrapper--mobile-open': showMobileMenu,\n 'menu--wrapper--mobile-closed': collapse && !showMobileMenu\n });\n\n return (\n <MenuContext.Provider value={{ showMobileMenu, openActiveSubmenus }}>\n <div className={menuWrapperClasses}>\n {collapse && (\n <div className=\"menu--mobile-wrapper\">\n <div\n className={`flex w-screen z-50 justify-${mobileIconAlignment} ${isMobileMenuExpanded}`}>\n <BlazeButton\n className={`menu--mobile-button ${mobileButtonModifier}`}\n onClick={() => setShowMobileMenu(!showMobileMenu)}\n label={showMobileMenu ? 'Close mobile menu' : 'Open mobile menu'}>\n <i>\n {showMobileMenu ? (\n <MdClose className={closeIconModifier} />\n ) : (\n <MdMenu className={hamburgerIconModifier} />\n )}\n </i>\n </BlazeButton>\n </div>\n </div>\n )}\n {logoOnMobile && !showMobileMenu && (\n <Link href=\"/\" name=\"mobile menu\">\n <img src={logoOnMobileUrl} alt={logoOnMobileAlt} className={logoOnMobileModifier} />\n </Link>\n )}\n\n <div className=\"menu--desktop-wrapper\">\n <ul className={childModifiers}>\n {logoOnDesktop && (\n <BlazeLink href=\"/\" className=\"\">\n <img\n src={logoOnMobileUrl}\n alt={logoOnMobileAlt}\n className={logoOnDesktopModifier}\n />\n </BlazeLink>\n )}\n {children}\n </ul>\n </div>\n </div>\n </MenuContext.Provider>\n );\n};\n\nMenu.propTypes = {\n collapse: PropTypes.bool.isRequired,\n openActiveSubmenus: PropTypes.bool.isRequired,\n logoOnMobile: PropTypes.bool.isRequired,\n logoOnDesktop: PropTypes.bool,\n logoOnMobileUrl: PropTypes.string,\n logoOnMobileAlt: PropTypes.string,\n logoOnMobileModifier: PropTypes.string,\n logoOnDesktopModifier: PropTypes.string,\n hamburgerIconModifier: PropTypes.string,\n closeIconModifier: PropTypes.string,\n mobileButtonModifier: PropTypes.string,\n mobileMenuModifier: PropTypes.string,\n mobileMenuChildrenModifier: PropTypes.string,\n modifier: PropTypes.string,\n mobileIconAlignment: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nMenu.defaultProps = {\n logoOnDesktop: false,\n logoOnMobileUrl: '',\n logoOnMobileAlt: '',\n logoOnMobileModifier: '',\n logoOnDesktopModifier: '',\n hamburgerIconModifier: '',\n closeIconModifier: '',\n mobileButtonModifier: '',\n mobileIconAlignment: '',\n mobileMenuModifier: '',\n mobileMenuChildrenModifier: '',\n modifier: '',\n children: []\n};\n\nexport default Menu;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,YAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,GAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,UAAA,GAAAP,sBAAA,CAAAF,OAAA;AAAqC,SAAAU,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAA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E+C,qBAAS,CAACG,MAAM;EAC1B/C,mBAAmB,EAAE4C,qBAAS,CAACG,MAAM;EACrCrD,QAAQ,EAAEkD,qBAAS,CAACI,SAAS,CAAC,CAACJ,qBAAS,CAACK,OAAO,CAACL,qBAAS,CAACM,IAAI,CAAC,EAAEN,qBAAS,CAACM,IAAI,CAAC;AACnF,CAAC;AAED1D,IAAI,CAAC2D,YAAY,GAAG;EAClB/C,aAAa,EAAE,KAAK;EACpBC,eAAe,EAAE,EAAE;EACnBC,eAAe,EAAE,EAAE;EACnBC,oBAAoB,EAAE,EAAE;EACxBC,qBAAqB,EAAE,EAAE;EACzBN,qBAAqB,EAAE,EAAE;EACzBO,iBAAiB,EAAE,EAAE;EACrBR,oBAAoB,EAAE,EAAE;EACxBD,mBAAmB,EAAE,EAAE;EACvBF,kBAAkB,EAAE,EAAE;EACtBC,0BAA0B,EAAE,EAAE;EAC9BF,QAAQ,EAAE,EAAE;EACZH,QAAQ,EAAE;AACZ,CAAC;AAAC,IAAA0D,QAAA,GAAAC,OAAA,cAEa7D,IAAI","ignoreList":[]}
|
|
@@ -8,7 +8,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var MenuContext = /*#__PURE__*/_react["default"].createContext({
|
|
11
|
-
showMobileMenu: false
|
|
11
|
+
showMobileMenu: false,
|
|
12
|
+
openActiveSubmenus: false
|
|
12
13
|
});
|
|
13
14
|
var _default = exports["default"] = MenuContext;
|
|
14
15
|
//# sourceMappingURL=MenuContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuContext.js","names":["_react","_interopRequireDefault","require","MenuContext","React","createContext","showMobileMenu","_default","exports"],"sources":["../../../src/components/Menu/MenuContext.js"],"sourcesContent":["import React from 'react';\n\nconst MenuContext = React.createContext({ showMobileMenu: false });\n\nexport default MenuContext;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAMC,WAAW,gBAAGC,iBAAK,CAACC,aAAa,CAAC;EAAEC,cAAc,EAAE;AAAM,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,
|
|
1
|
+
{"version":3,"file":"MenuContext.js","names":["_react","_interopRequireDefault","require","MenuContext","React","createContext","showMobileMenu","openActiveSubmenus","_default","exports"],"sources":["../../../src/components/Menu/MenuContext.js"],"sourcesContent":["import React from 'react';\n\nconst MenuContext = React.createContext({ showMobileMenu: false, openActiveSubmenus: false });\n\nexport default MenuContext;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAMC,WAAW,gBAAGC,iBAAK,CAACC,aAAa,CAAC;EAAEC,cAAc,EAAE,KAAK;EAAEC,kBAAkB,EAAE;AAAM,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAE/EN,WAAW","ignoreList":[]}
|
|
@@ -17,6 +17,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
17
17
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
18
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
19
|
var _fa = require("react-icons/fa");
|
|
20
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
20
21
|
var _router = require("next/router");
|
|
21
22
|
var _utilsHandlebars = require("@blaze-cms/utils-handlebars");
|
|
22
23
|
var _constants = require("../../constants");
|
|
@@ -26,6 +27,8 @@ var _MenuContext = _interopRequireDefault(require("../Menu/MenuContext"));
|
|
|
26
27
|
var _helpers2 = require("./helpers");
|
|
27
28
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
28
29
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
30
|
+
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
31
|
+
|
|
29
32
|
var MenuItemRender = function MenuItemRender(_ref) {
|
|
30
33
|
var children = _ref.children,
|
|
31
34
|
eventType = _ref.eventType,
|
|
@@ -33,12 +36,12 @@ var MenuItemRender = function MenuItemRender(_ref) {
|
|
|
33
36
|
modifier = _ref.modifier,
|
|
34
37
|
url = _ref.url,
|
|
35
38
|
parent = _ref.parent;
|
|
36
|
-
var
|
|
37
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
38
|
-
displayChildren = _useState2[0],
|
|
39
|
-
setDisplayChildren = _useState2[1];
|
|
39
|
+
var router = (0, _router.useRouter)();
|
|
40
40
|
var _useContext = (0, _react.useContext)(_MenuContext["default"]),
|
|
41
|
-
showMobileMenu = _useContext.showMobileMenu
|
|
41
|
+
showMobileMenu = _useContext.showMobileMenu,
|
|
42
|
+
openActiveSubmenus = _useContext.openActiveSubmenus;
|
|
43
|
+
var isHoverEvent = eventType === _constants.HOVER;
|
|
44
|
+
var isClickEvent = eventType === _constants.CLICK;
|
|
42
45
|
var _useStringTemplate = (0, _utilsHandlebars.useStringTemplate)(parent, [text]),
|
|
43
46
|
loadingText = _useStringTemplate.loading,
|
|
44
47
|
_useStringTemplate$da = (0, _slicedToArray2["default"])(_useStringTemplate.data, 1),
|
|
@@ -47,19 +50,24 @@ var MenuItemRender = function MenuItemRender(_ref) {
|
|
|
47
50
|
loadingUrl = _useStringTemplate2.loading,
|
|
48
51
|
_useStringTemplate2$d = (0, _slicedToArray2["default"])(_useStringTemplate2.data, 1),
|
|
49
52
|
urlToUse = _useStringTemplate2$d[0];
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
+
var isActive = router ? (0, _helpers2.isUrlPathMatch)(router.asPath, urlToUse) : false;
|
|
54
|
+
var isActiveParent = router ? (0, _helpers2.hasActiveChild)(router.asPath, children) : false;
|
|
55
|
+
var shouldPreOpen = openActiveSubmenus && isActiveParent && isClickEvent;
|
|
53
56
|
var hasValidChildren = (0, _helpers.hasChildren)(children);
|
|
57
|
+
var _useState = (0, _react.useState)(shouldPreOpen),
|
|
58
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
59
|
+
displayChildren = _useState2[0],
|
|
60
|
+
setDisplayChildren = _useState2[1];
|
|
54
61
|
(0, _react.useEffect)(function () {
|
|
55
|
-
if (!showMobileMenu) setDisplayChildren(false);
|
|
56
|
-
}, [showMobileMenu]);
|
|
62
|
+
if (!showMobileMenu && !shouldPreOpen) setDisplayChildren(false);
|
|
63
|
+
}, [children, isClickEvent, loadingUrl, openActiveSubmenus, router, shouldPreOpen, showMobileMenu]);
|
|
57
64
|
(0, _react.useEffect)(function () {
|
|
58
65
|
if (isHoverEvent) {
|
|
59
66
|
setDisplayChildren(false);
|
|
60
67
|
}
|
|
61
68
|
}, [router.asPath, isHoverEvent]);
|
|
62
69
|
if (loadingUrl || loadingText) return '';
|
|
70
|
+
var childrenDisplayClass = displayChildren ? '' : _constants.HIDDEN;
|
|
63
71
|
var handleItemEvent = function handleItemEvent(_ref2) {
|
|
64
72
|
var type = _ref2.type;
|
|
65
73
|
if (isHoverEvent) {
|
|
@@ -76,18 +84,25 @@ var MenuItemRender = function MenuItemRender(_ref) {
|
|
|
76
84
|
setDisplayChildren(!displayChildren);
|
|
77
85
|
}
|
|
78
86
|
};
|
|
87
|
+
var menuItemLinkClassname = (0, _classnames["default"])('menu--item--link', {
|
|
88
|
+
'menu--item--link--active': isActive,
|
|
89
|
+
'menu--item--link--active-parent': isActiveParent
|
|
90
|
+
});
|
|
79
91
|
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
80
92
|
className: modifier,
|
|
81
93
|
onMouseEnter: handleItemEvent,
|
|
82
94
|
onMouseLeave: handleItemEvent
|
|
83
95
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
84
|
-
className:
|
|
96
|
+
className: menuItemLinkClassname,
|
|
85
97
|
onClick: handleMobileClick,
|
|
86
98
|
role: !urlToUse && hasValidChildren ? 'button' : undefined,
|
|
87
99
|
tabIndex: !urlToUse && hasValidChildren ? 0 : undefined
|
|
88
100
|
}, urlToUse ? /*#__PURE__*/_react["default"].createElement(_BlazeLink["default"], {
|
|
89
101
|
href: urlToUse
|
|
90
|
-
}, textToUse) : /*#__PURE__*/_react["default"].createElement("span",
|
|
102
|
+
}, textToUse) : /*#__PURE__*/_react["default"].createElement("span", {
|
|
103
|
+
role: "button",
|
|
104
|
+
onClick: handleItemEvent
|
|
105
|
+
}, textToUse), hasValidChildren && /*#__PURE__*/_react["default"].createElement("i", {
|
|
91
106
|
role: "button",
|
|
92
107
|
className: "menu--item--link--icon",
|
|
93
108
|
onClick: function onClick(e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItemRender.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_fa","_router","_utilsHandlebars","_constants","_helpers","_BlazeLink","_MenuContext","_helpers2","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","MenuItemRender","_ref","children","eventType","text","modifier","url","parent","_useState","useState","_useState2","_slicedToArray2","displayChildren","setDisplayChildren","_useContext","useContext","MenuContext","showMobileMenu","_useStringTemplate","useStringTemplate","loadingText","loading","_useStringTemplate$da","data","textToUse","_useStringTemplate2","injectHelperIntoTemplate","loadingUrl","_useStringTemplate2$d","urlToUse","router","useRouter","isHoverEvent","HOVER","childrenDisplayClass","HIDDEN","hasValidChildren","hasChildren","useEffect","asPath","handleItemEvent","_ref2","type","MOUSE_ENTER","MOUSE_LEAVE","handleMobileClick","createElement","className","onMouseEnter","onMouseLeave","onClick","role","undefined","tabIndex","href","stopPropagation","FaChevronUp","FaChevronDown","concat","propTypes","PropTypes","string","isRequired","object","oneOfType","arrayOf","node","defaultProps","_default","exports"],"sources":["../../../src/components/MenuItem/MenuItemRender.js"],"sourcesContent":["import React, { useState, useContext, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { FaChevronDown, FaChevronUp } from 'react-icons/fa';\nimport { useRouter } from 'next/router';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport { HOVER, MOUSE_ENTER, MOUSE_LEAVE, HIDDEN } from '../../constants';\nimport { hasChildren } from '../../helpers';\nimport BlazeLink from '../BlazeLink';\nimport MenuContext from '../Menu/MenuContext';\nimport { injectHelperIntoTemplate } from './helpers';\n\nconst MenuItemRender = ({ children, eventType, text, modifier, url, parent }) => {\n const [displayChildren, setDisplayChildren] = useState(false);\n const { showMobileMenu } = useContext(MenuContext);\n const {\n loading: loadingText,\n data: [textToUse]\n } = useStringTemplate(parent, [text]);\n const {\n loading: loadingUrl,\n data: [urlToUse]\n } = useStringTemplate(parent, [injectHelperIntoTemplate(url, 'url_encode')]);\n\n const router = useRouter();\n const isHoverEvent = eventType === HOVER;\n const childrenDisplayClass = displayChildren ? '' : HIDDEN;\n const hasValidChildren = hasChildren(children);\n\n useEffect(() => {\n if (!showMobileMenu) setDisplayChildren(false);\n }, [showMobileMenu]);\n\n useEffect(() => {\n if (isHoverEvent) {\n setDisplayChildren(false);\n }\n }, [router.asPath, isHoverEvent]);\n\n if (loadingUrl || loadingText) return '';\n\n const handleItemEvent = ({ type }) => {\n if (isHoverEvent) {\n if (type === MOUSE_ENTER) {\n setDisplayChildren(true);\n }\n if (type === MOUSE_LEAVE) {\n setDisplayChildren(false);\n }\n }\n };\n\n const handleMobileClick = () => {\n if (!urlToUse && hasValidChildren) {\n setDisplayChildren(!displayChildren);\n }\n };\n\n return (\n <li className={modifier} onMouseEnter={handleItemEvent} onMouseLeave={handleItemEvent}>\n <div\n className=\"menu--item--link\"\n onClick={handleMobileClick}\n role={!urlToUse && hasValidChildren ? 'button' : undefined}\n tabIndex={!urlToUse && hasValidChildren ? 0 : undefined}>\n {urlToUse ? <BlazeLink href={urlToUse}>{textToUse}</BlazeLink> : <span>{textToUse}</span>}\n\n {hasValidChildren && (\n <i\n role=\"button\"\n className=\"menu--item--link--icon\"\n onClick={e => {\n e.stopPropagation();\n setDisplayChildren(!displayChildren);\n }}\n tabIndex={0}>\n {displayChildren ? <FaChevronUp /> : <FaChevronDown />}\n </i>\n )}\n </div>\n\n {hasValidChildren && (\n <div className={`menu--item-children ${childrenDisplayClass}`}>{children}</div>\n )}\n </li>\n );\n};\n\nMenuItemRender.propTypes = {\n modifier: PropTypes.string,\n text: PropTypes.string,\n url: PropTypes.string,\n eventType: PropTypes.string.isRequired,\n parent: PropTypes.object,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nMenuItemRender.defaultProps = {\n url: '',\n modifier: '',\n text: '',\n children: null,\n parent: {}\n};\n\nexport default MenuItemRender;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,GAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,YAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AAAqD,SAAAW,yBAAAC,CA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_propTypes","_interopRequireDefault","_fa","_classnames","_router","_utilsHandlebars","_constants","_helpers","_BlazeLink","_MenuContext","_helpers2","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","MenuItemRender","_ref","children","eventType","text","modifier","url","parent","router","useRouter","_useContext","useContext","MenuContext","showMobileMenu","openActiveSubmenus","isHoverEvent","HOVER","isClickEvent","CLICK","_useStringTemplate","useStringTemplate","loadingText","loading","_useStringTemplate$da","_slicedToArray2","data","textToUse","_useStringTemplate2","injectHelperIntoTemplate","loadingUrl","_useStringTemplate2$d","urlToUse","isActive","isUrlPathMatch","asPath","isActiveParent","hasActiveChild","shouldPreOpen","hasValidChildren","hasChildren","_useState","useState","_useState2","displayChildren","setDisplayChildren","useEffect","childrenDisplayClass","HIDDEN","handleItemEvent","_ref2","type","MOUSE_ENTER","MOUSE_LEAVE","handleMobileClick","menuItemLinkClassname","classnames","createElement","className","onMouseEnter","onMouseLeave","onClick","role","undefined","tabIndex","href","stopPropagation","FaChevronUp","FaChevronDown","concat","propTypes","PropTypes","string","isRequired","object","oneOfType","arrayOf","node","defaultProps","_default","exports"],"sources":["../../../src/components/MenuItem/MenuItemRender.js"],"sourcesContent":["/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport React, { useState, useContext, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { FaChevronDown, FaChevronUp } from 'react-icons/fa';\nimport classnames from 'classnames';\nimport { useRouter } from 'next/router';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport { HOVER, MOUSE_ENTER, MOUSE_LEAVE, HIDDEN, CLICK } from '../../constants';\nimport { hasChildren } from '../../helpers';\nimport BlazeLink from '../BlazeLink';\nimport MenuContext from '../Menu/MenuContext';\nimport { injectHelperIntoTemplate, isUrlPathMatch, hasActiveChild } from './helpers';\n\nconst MenuItemRender = ({ children, eventType, text, modifier, url, parent }) => {\n const router = useRouter();\n const { showMobileMenu, openActiveSubmenus } = useContext(MenuContext);\n\n const isHoverEvent = eventType === HOVER;\n const isClickEvent = eventType === CLICK;\n\n const {\n loading: loadingText,\n data: [textToUse]\n } = useStringTemplate(parent, [text]);\n const {\n loading: loadingUrl,\n data: [urlToUse]\n } = useStringTemplate(parent, [injectHelperIntoTemplate(url, 'url_encode')]);\n\n const isActive = router ? isUrlPathMatch(router.asPath, urlToUse) : false;\n const isActiveParent = router ? hasActiveChild(router.asPath, children) : false;\n const shouldPreOpen = openActiveSubmenus && isActiveParent && isClickEvent;\n const hasValidChildren = hasChildren(children);\n\n const [displayChildren, setDisplayChildren] = useState(shouldPreOpen);\n\n useEffect(() => {\n if (!showMobileMenu && !shouldPreOpen) setDisplayChildren(false);\n }, [\n children,\n isClickEvent,\n loadingUrl,\n openActiveSubmenus,\n router,\n shouldPreOpen,\n showMobileMenu\n ]);\n\n useEffect(() => {\n if (isHoverEvent) {\n setDisplayChildren(false);\n }\n }, [router.asPath, isHoverEvent]);\n\n if (loadingUrl || loadingText) return '';\n\n const childrenDisplayClass = displayChildren ? '' : HIDDEN;\n\n const handleItemEvent = ({ type }) => {\n if (isHoverEvent) {\n if (type === MOUSE_ENTER) {\n setDisplayChildren(true);\n }\n if (type === MOUSE_LEAVE) {\n setDisplayChildren(false);\n }\n }\n };\n\n const handleMobileClick = () => {\n if (!urlToUse && hasValidChildren) {\n setDisplayChildren(!displayChildren);\n }\n };\n\n const menuItemLinkClassname = classnames('menu--item--link', {\n 'menu--item--link--active': isActive,\n 'menu--item--link--active-parent': isActiveParent\n });\n\n return (\n <li className={modifier} onMouseEnter={handleItemEvent} onMouseLeave={handleItemEvent}>\n <div\n className={menuItemLinkClassname}\n onClick={handleMobileClick}\n role={!urlToUse && hasValidChildren ? 'button' : undefined}\n tabIndex={!urlToUse && hasValidChildren ? 0 : undefined}>\n {urlToUse ? (\n <BlazeLink href={urlToUse}>{textToUse}</BlazeLink>\n ) : (\n <span role=\"button\" onClick={handleItemEvent}>\n {textToUse}\n </span>\n )}\n {hasValidChildren && (\n <i\n role=\"button\"\n className=\"menu--item--link--icon\"\n onClick={e => {\n e.stopPropagation();\n setDisplayChildren(!displayChildren);\n }}\n tabIndex={0}>\n {displayChildren ? <FaChevronUp /> : <FaChevronDown />}\n </i>\n )}\n </div>\n\n {hasValidChildren && (\n <div className={`menu--item-children ${childrenDisplayClass}`}>{children}</div>\n )}\n </li>\n );\n};\n\nMenuItemRender.propTypes = {\n modifier: PropTypes.string,\n text: PropTypes.string,\n url: PropTypes.string,\n eventType: PropTypes.string.isRequired,\n parent: PropTypes.object,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nMenuItemRender.defaultProps = {\n url: '',\n modifier: '',\n text: '',\n children: null,\n parent: {}\n};\n\nexport default MenuItemRender;\n"],"mappings":";;;;;;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,GAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,YAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,SAAA,GAAAX,OAAA;AAAqF,SAAAY,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAd,wBAAAc,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,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MAAM;EACxBvE,QAAQ,EAAEoE,qBAAS,CAACI,SAAS,CAAC,CAACJ,qBAAS,CAACK,OAAO,CAACL,qBAAS,CAACM,IAAI,CAAC,EAAEN,qBAAS,CAACM,IAAI,CAAC;AACnF,CAAC;AAED5E,cAAc,CAAC6E,YAAY,GAAG;EAC5BvE,GAAG,EAAE,EAAE;EACPD,QAAQ,EAAE,EAAE;EACZD,IAAI,EAAE,EAAE;EACRF,QAAQ,EAAE,IAAI;EACdK,MAAM,EAAE,CAAC;AACX,CAAC;AAAC,IAAAuE,QAAA,GAAAC,OAAA,cAEa/E,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
require("core-js/modules/es.array.find.js");
|
|
10
|
+
require("core-js/modules/es.object.to-string.js");
|
|
11
|
+
var _isUrlPathMatch = _interopRequireDefault(require("./isUrlPathMatch"));
|
|
12
|
+
var _helpers = require("../../../helpers");
|
|
13
|
+
var hasActiveChild = function hasActiveChild(path, children) {
|
|
14
|
+
return (0, _helpers.hasChildren)(children) && children.props.children[1][0].props.component.items.find(function (menuItem) {
|
|
15
|
+
return (0, _isUrlPathMatch["default"])(path, menuItem.settings.url);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
var _default = exports["default"] = hasActiveChild;
|
|
19
|
+
//# sourceMappingURL=has-active-child.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-active-child.js","names":["_isUrlPathMatch","_interopRequireDefault","require","_helpers","hasActiveChild","path","children","hasChildren","props","component","items","find","menuItem","isUrlPathMatch","settings","url","_default","exports"],"sources":["../../../../src/components/MenuItem/helpers/has-active-child.js"],"sourcesContent":["import isUrlPathMatch from './isUrlPathMatch';\nimport { hasChildren } from '../../../helpers';\n\nconst hasActiveChild = (path, children) =>\n hasChildren(children) &&\n children.props.children[1][0].props.component.items.find(menuItem =>\n isUrlPathMatch(path, menuItem.settings.url)\n );\n\nexport default hasActiveChild;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAME,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,IAAI,EAAEC,QAAQ;EAAA,OACpC,IAAAC,oBAAW,EAACD,QAAQ,CAAC,IACrBA,QAAQ,CAACE,KAAK,CAACF,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAACE,KAAK,CAACC,SAAS,CAACC,KAAK,CAACC,IAAI,CAAC,UAAAC,QAAQ;IAAA,OAC/D,IAAAC,0BAAc,EAACR,IAAI,EAAEO,QAAQ,CAACE,QAAQ,CAACC,GAAG,CAAC;EAAA,CAC7C,CAAC;AAAA;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEWb,cAAc","ignoreList":[]}
|
|
@@ -5,11 +5,25 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
Object.defineProperty(exports, "hasActiveChild", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _hasActiveChild["default"];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
8
14
|
Object.defineProperty(exports, "injectHelperIntoTemplate", {
|
|
9
15
|
enumerable: true,
|
|
10
16
|
get: function get() {
|
|
11
17
|
return _injectHelperIntoTemplate["default"];
|
|
12
18
|
}
|
|
13
19
|
});
|
|
20
|
+
Object.defineProperty(exports, "isUrlPathMatch", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _isUrlPathMatch["default"];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
14
26
|
var _injectHelperIntoTemplate = _interopRequireDefault(require("./inject-helper-into-template"));
|
|
27
|
+
var _isUrlPathMatch = _interopRequireDefault(require("./isUrlPathMatch"));
|
|
28
|
+
var _hasActiveChild = _interopRequireDefault(require("./has-active-child"));
|
|
15
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_injectHelperIntoTemplate","_interopRequireDefault","require"],"sources":["../../../../src/components/MenuItem/helpers/index.js"],"sourcesContent":["import injectHelperIntoTemplate from './inject-helper-into-template';\n\nexport { injectHelperIntoTemplate };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_injectHelperIntoTemplate","_interopRequireDefault","require","_isUrlPathMatch","_hasActiveChild"],"sources":["../../../../src/components/MenuItem/helpers/index.js"],"sourcesContent":["import injectHelperIntoTemplate from './inject-helper-into-template';\nimport isUrlPathMatch from './isUrlPathMatch';\nimport hasActiveChild from './has-active-child';\n\nexport { injectHelperIntoTemplate, isUrlPathMatch, hasActiveChild };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,yBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
require("core-js/modules/es.regexp.constructor.js");
|
|
9
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
10
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
11
|
+
var isUrlPathMatch = function isUrlPathMatch(path, itemUrl) {
|
|
12
|
+
if (!itemUrl || !path) return false;
|
|
13
|
+
var reg = new RegExp(/^[^#?]+/);
|
|
14
|
+
var _path = reg.exec(path)[0];
|
|
15
|
+
return _path === itemUrl || _path === "/".concat(itemUrl);
|
|
16
|
+
};
|
|
17
|
+
var _default = exports["default"] = isUrlPathMatch;
|
|
18
|
+
//# sourceMappingURL=isUrlPathMatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isUrlPathMatch.js","names":["isUrlPathMatch","path","itemUrl","reg","RegExp","_path","exec","concat","_default","exports"],"sources":["../../../../src/components/MenuItem/helpers/isUrlPathMatch.js"],"sourcesContent":["const isUrlPathMatch = (path, itemUrl) => {\n if (!itemUrl || !path) return false;\n\n const reg = new RegExp(/^[^#?]+/);\n const _path = reg.exec(path)[0];\n\n return _path === itemUrl || _path === `/${itemUrl}`;\n};\n\nexport default isUrlPathMatch;\n"],"mappings":";;;;;;;;;;AAAA,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,IAAI,EAAEC,OAAO,EAAK;EACxC,IAAI,CAACA,OAAO,IAAI,CAACD,IAAI,EAAE,OAAO,KAAK;EAEnC,IAAME,GAAG,GAAG,IAAIC,MAAM,CAAC,SAAS,CAAC;EACjC,IAAMC,KAAK,GAAGF,GAAG,CAACG,IAAI,CAACL,IAAI,CAAC,CAAC,CAAC,CAAC;EAE/B,OAAOI,KAAK,KAAKH,OAAO,IAAIG,KAAK,SAAAE,MAAA,CAASL,OAAO,CAAE;AACrD,CAAC;AAAC,IAAAM,QAAA,GAAAC,OAAA,cAEaT,cAAc","ignoreList":[]}
|
|
@@ -10,6 +10,7 @@ import BlazeLink from '../BlazeLink';
|
|
|
10
10
|
const Menu = ({
|
|
11
11
|
children,
|
|
12
12
|
collapse,
|
|
13
|
+
openActiveSubmenus,
|
|
13
14
|
modifier,
|
|
14
15
|
mobileMenuModifier,
|
|
15
16
|
mobileMenuChildrenModifier,
|
|
@@ -45,7 +46,8 @@ const Menu = ({
|
|
|
45
46
|
});
|
|
46
47
|
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
47
48
|
value: {
|
|
48
|
-
showMobileMenu
|
|
49
|
+
showMobileMenu,
|
|
50
|
+
openActiveSubmenus
|
|
49
51
|
}
|
|
50
52
|
}, /*#__PURE__*/React.createElement("div", {
|
|
51
53
|
className: menuWrapperClasses
|
|
@@ -83,6 +85,7 @@ const Menu = ({
|
|
|
83
85
|
};
|
|
84
86
|
Menu.propTypes = {
|
|
85
87
|
collapse: PropTypes.bool.isRequired,
|
|
88
|
+
openActiveSubmenus: PropTypes.bool.isRequired,
|
|
86
89
|
logoOnMobile: PropTypes.bool.isRequired,
|
|
87
90
|
logoOnDesktop: PropTypes.bool,
|
|
88
91
|
logoOnMobileUrl: PropTypes.string,
|