cozy-ui 140.5.2 → 141.0.0
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 +20 -0
- package/dist/cozy-ui.min.css +1 -1
- package/dist/cozy-ui.utils.min.css +1 -1
- package/package.json +1 -1
- package/react/providers/Breakpoints/index.jsx +2 -2
- package/react/providers/Breakpoints/index.spec.jsx +27 -0
- package/react/providers/Breakpoints/useIframeConnection.jsx +3 -3
- package/react/providers/Breakpoints/useIframeToSendWidth.jsx +7 -15
- package/stylus/cozy-ui/build.styl +71 -28
- package/stylus/utilities/spaces.styl +67 -0
- package/transpiled/react/providers/Breakpoints/index.js +2 -2
- package/transpiled/react/providers/Breakpoints/index.spec.d.ts +1 -0
- package/transpiled/react/providers/Breakpoints/useIframeConnection.d.ts +1 -1
- package/transpiled/react/providers/Breakpoints/useIframeConnection.js +5 -5
- package/transpiled/react/providers/Breakpoints/useIframeToSendWidth.d.ts +2 -2
- package/transpiled/react/providers/Breakpoints/useIframeToSendWidth.js +7 -15
|
@@ -882,56 +882,56 @@ Display an chip that represents complex identity
|
|
|
882
882
|
.u-m-1 - Margins on all sides with 1 line (16px)
|
|
883
883
|
.u-m-1-half - Margins on all sides with 1 line an a half (24px)
|
|
884
884
|
.u-m-2 - Margins on all sides with 2 lines (32px)
|
|
885
|
-
.u-m-2-half - Margins on all sides with
|
|
886
|
-
.u-m-3 - Margins on all sides with
|
|
885
|
+
.u-m-2-half - Margins on all sides with 2 lines an a half (40px)
|
|
886
|
+
.u-m-3 - Margins on all sides with 3 lines (48px)
|
|
887
887
|
.u-mv-auto - Auto vertically margins
|
|
888
888
|
.u-mv-0 - No vertically margins
|
|
889
889
|
.u-mv-half - Vertically margins with half a line (8px)
|
|
890
890
|
.u-mv-1 - Vertically margins with 1 line (16px)
|
|
891
891
|
.u-mv-1-half - Vertically margins with 1 line an a half (24px)
|
|
892
892
|
.u-mv-2 - Vertically margins with 2 lines (32px)
|
|
893
|
-
.u-mv-2-half - Vertically margins with
|
|
894
|
-
.u-mv-3 - Vertically margins with
|
|
893
|
+
.u-mv-2-half - Vertically margins with 2 lines an a half (40px)
|
|
894
|
+
.u-mv-3 - Vertically margins with 3 lines (48px)
|
|
895
895
|
.u-mh-auto - Auto horizontally margins
|
|
896
896
|
.u-mh-0 - No horizontally margins
|
|
897
897
|
.u-mh-half - Horizontally margins with half a line (8px)
|
|
898
898
|
.u-mh-1 - Horizontally margins with 1 line (16px)
|
|
899
899
|
.u-mh-1-half - Horizontally margins with 1 line an a half (24px)
|
|
900
900
|
.u-mh-2 - Horizontally margins with 2 lines (32px)
|
|
901
|
-
.u-mh-2-half - Horizontally margins with
|
|
902
|
-
.u-mh-3 - Horizontally margins with
|
|
901
|
+
.u-mh-2-half - Horizontally margins with 2 lines an a half (40px)
|
|
902
|
+
.u-mh-3 - Horizontally margins with 3 lines (48px)
|
|
903
903
|
.u-mt-auto - Margin Top auto
|
|
904
904
|
.u-mt-0 - No margin Top
|
|
905
905
|
.u-mt-half - Margin Top with half a line (8px)
|
|
906
906
|
.u-mt-1 - Margin Top with 1 line (16px)
|
|
907
907
|
.u-mt-1-half - Margin Top with 1 line an a half (24px)
|
|
908
908
|
.u-mt-2 - Margin Top with 2 lines (32px)
|
|
909
|
-
.u-mt-2-half - Margin Top with
|
|
910
|
-
.u-mt-3 - Margin Top with
|
|
909
|
+
.u-mt-2-half - Margin Top with 2 lines an a half (40px)
|
|
910
|
+
.u-mt-3 - Margin Top with 3 lines (48px)
|
|
911
911
|
.u-mb-auto - Margin Bottom auto
|
|
912
912
|
.u-mb-0 - No margin Bottom
|
|
913
913
|
.u-mb-half - Margin Bottom with half a line (8px)
|
|
914
914
|
.u-mb-1 - Margin Bottom with 1 line (16px)
|
|
915
915
|
.u-mb-1-half - Margin Bottom with 1 line an a half (24px)
|
|
916
916
|
.u-mb-2 - Margin Bottom with 2 lines (32px)
|
|
917
|
-
.u-mb-2-half - Margin Bottom with
|
|
918
|
-
.u-mb-3 - Margin Bottom with
|
|
917
|
+
.u-mb-2-half - Margin Bottom with 2 lines an a half (40px)
|
|
918
|
+
.u-mb-3 - Margin Bottom with 3 lines (48px)
|
|
919
919
|
.u-ml-auto - Margin Left auto
|
|
920
920
|
.u-ml-0 - No margin Left
|
|
921
921
|
.u-ml-half - Margin Left with half a line (8px)
|
|
922
922
|
.u-ml-1 - Margin Left with 1 line (16px)
|
|
923
923
|
.u-ml-1-half - Margin Left with 1 line an a half (24px)
|
|
924
924
|
.u-ml-2 - Margin Left with 2 lines (32px)
|
|
925
|
-
.u-ml-2-half - Margin Left with
|
|
926
|
-
.u-ml-3 - Margin Left with
|
|
925
|
+
.u-ml-2-half - Margin Left with 2 lines an a half (40px)
|
|
926
|
+
.u-ml-3 - Margin Left with 3 lines (48px)
|
|
927
927
|
.u-mr-auto - Margin Right auto
|
|
928
928
|
.u-mr-0 - No margin Right
|
|
929
929
|
.u-mr-half - Margin Right with half a line (8px)
|
|
930
930
|
.u-mr-1 - Margin Right with 1 line (16px)
|
|
931
931
|
.u-mr-1-half - Margin Right with 1 line an a half (24px)
|
|
932
932
|
.u-mr-2 - Margin Right with 2 lines (32px)
|
|
933
|
-
.u-mr-2-half - Margin Right with
|
|
934
|
-
.u-mr-3 - Margin Right with
|
|
933
|
+
.u-mr-2-half - Margin Right with 2 lines an a half (40px)
|
|
934
|
+
.u-mr-3 - Margin Right with 3 lines (48px)
|
|
935
935
|
|
|
936
936
|
Markup:
|
|
937
937
|
<div style="background-color:dimgrey; border: 1px solid black;"><div style="padding:.5rem; background-color:gainsboro;" class="{{modifier_class}}">🎶 Gimme some margin 🎵 </div></div>
|
|
@@ -952,56 +952,56 @@ Display an chip that represents complex identity
|
|
|
952
952
|
.u-p-1 - Paddings on all sides with 1 line (16px)
|
|
953
953
|
.u-p-1-half - Paddings on all sides with 1 line an a half (24px)
|
|
954
954
|
.u-p-2 - Paddings on all sides with 2 lines (32px)
|
|
955
|
-
.u-p-2-half - Paddings on all sides with
|
|
956
|
-
.u-p-3 - Paddings on all sides with
|
|
955
|
+
.u-p-2-half - Paddings on all sides with 2 lines an a half (40px)
|
|
956
|
+
.u-p-3 - Paddings on all sides with 3 lines (48px)
|
|
957
957
|
.u-pv-auto - Auto vertically paddings
|
|
958
958
|
.u-pv-0 - No vertically paddings
|
|
959
959
|
.u-pv-half - Vertically paddings with half a line (8px)
|
|
960
960
|
.u-pv-1 - Vertically paddings with 1 line (16px)
|
|
961
961
|
.u-pv-1-half - Vertically paddings with 1 line an a half (24px)
|
|
962
962
|
.u-pv-2 - Vertically paddings with 2 lines (32px)
|
|
963
|
-
.u-pv-2-half - Vertically paddings with
|
|
964
|
-
.u-pv-3 - Vertically paddings with
|
|
963
|
+
.u-pv-2-half - Vertically paddings with 2 lines an a half (40px)
|
|
964
|
+
.u-pv-3 - Vertically paddings with 3 lines (48px)
|
|
965
965
|
.u-ph-auto - Auto horizontally paddings
|
|
966
966
|
.u-ph-0 - No horizontally paddings
|
|
967
967
|
.u-ph-half - Horizontally paddings with half a line (8px)
|
|
968
968
|
.u-ph-1 - Horizontally paddings with 1 line (16px)
|
|
969
969
|
.u-ph-1-half - Horizontally paddings with 1 line an a half (24px)
|
|
970
970
|
.u-ph-2 - Horizontally paddings with 2 lines (32px)
|
|
971
|
-
.u-ph-2-half - Horizontally paddings with
|
|
972
|
-
.u-ph-3 - Horizontally paddings with
|
|
971
|
+
.u-ph-2-half - Horizontally paddings with 2 lines an a half (40px)
|
|
972
|
+
.u-ph-3 - Horizontally paddings with 3 lines (48px)
|
|
973
973
|
.u-pt-auto - Padding Top auto
|
|
974
974
|
.u-pt-0 - No padding Top
|
|
975
975
|
.u-pt-half - Padding Top with half a line (8px)
|
|
976
976
|
.u-pt-1 - Padding Top with 1 line (16px)
|
|
977
977
|
.u-pt-1-half - Padding Top with 1 line an a half (24px)
|
|
978
978
|
.u-pt-2 - Padding Top with 2 lines (32px)
|
|
979
|
-
.u-pt-2-half - Padding Top with
|
|
980
|
-
.u-pt-3 - Padding Top with
|
|
979
|
+
.u-pt-2-half - Padding Top with 2 lines an a half (40px)
|
|
980
|
+
.u-pt-3 - Padding Top with 3 lines (48px)
|
|
981
981
|
.u-pb-auto - Padding Bottom auto
|
|
982
982
|
.u-pb-0 - No padding Bottom
|
|
983
983
|
.u-pb-half - Padding Bottom with half a line (8px)
|
|
984
984
|
.u-pb-1 - Padding Bottom with 1 line (16px)
|
|
985
985
|
.u-pb-1-half - Padding Bottom with 1 line an a half (24px)
|
|
986
986
|
.u-pb-2 - Padding Bottom with 2 lines (32px)
|
|
987
|
-
.u-pb-2-half - Padding Bottom with
|
|
988
|
-
.u-pb-3 - Padding Bottom with
|
|
987
|
+
.u-pb-2-half - Padding Bottom with 2 lines an a half (40px)
|
|
988
|
+
.u-pb-3 - Padding Bottom with 3 lines (48px)
|
|
989
989
|
.u-pl-auto - Padding Left auto
|
|
990
990
|
.u-pl-0 - No padding Left
|
|
991
991
|
.u-pl-half - Padding Left with half a line (8px)
|
|
992
992
|
.u-pl-1 - Padding Left with 1 line (16px)
|
|
993
993
|
.u-pl-1-half - Padding Left with 1 line an a half (24px)
|
|
994
994
|
.u-pl-2 - Padding Left with 2 lines (32px)
|
|
995
|
-
.u-pl-2-half - Padding Left with
|
|
996
|
-
.u-pl-3 - Padding Left with
|
|
995
|
+
.u-pl-2-half - Padding Left with 2 lines an a half (40px)
|
|
996
|
+
.u-pl-3 - Padding Left with 3 lines (48px)
|
|
997
997
|
.u-pr-auto - Padding Right auto
|
|
998
998
|
.u-pr-0 - No padding Right
|
|
999
999
|
.u-pr-half - Padding Right with half a line (8px)
|
|
1000
1000
|
.u-pr-1 - Padding Right with 1 line (16px)
|
|
1001
1001
|
.u-pr-1-half - Padding Right with 1 line an a half (24px)
|
|
1002
1002
|
.u-pr-2 - Padding Right with 2 lines (32px)
|
|
1003
|
-
.u-pr-2-half - Padding Right with
|
|
1004
|
-
.u-pr-3 - Padding Right with
|
|
1003
|
+
.u-pr-2-half - Padding Right with 2 lines an a half (40px)
|
|
1004
|
+
.u-pr-3 - Padding Right with 3 lines (48px)
|
|
1005
1005
|
|
|
1006
1006
|
Markup:
|
|
1007
1007
|
<div style="background-color:gainsboro; display: inline-block;" class="{{modifier_class}}"><span style="background-color:bisque;">🎼 Gimme some padding 💃</span></div>
|
|
@@ -1009,6 +1009,49 @@ Display an chip that represents complex identity
|
|
|
1009
1009
|
Styleguide utilities.paddings
|
|
1010
1010
|
*/
|
|
1011
1011
|
|
|
1012
|
+
/*
|
|
1013
|
+
Gaps
|
|
1014
|
+
|
|
1015
|
+
Classes to add gaps between children nodes, vertically, horizontally or in both directions based on default font-size (16px)<br>
|
|
1016
|
+
[Can be used with breakpoints modifier suffixes (`-t`,`-s`,`-m`)](section-settings.html#kssref-settings-breakpoints)
|
|
1017
|
+
|
|
1018
|
+
.u-g-normal - Normal gaps in both directions
|
|
1019
|
+
.u-g-0 - No gaps in both directions
|
|
1020
|
+
.u-g-half - Gaps in both directions with half a line (8px)
|
|
1021
|
+
.u-g-1 - Gaps in both directions with 1 line (16px)
|
|
1022
|
+
.u-g-1-half - Gaps in both directions with 1 line an a half (24px)
|
|
1023
|
+
.u-g-2 - Gaps in both directions with 2 lines (32px)
|
|
1024
|
+
.u-g-2-half - Gaps in both directions with 2 lines an a half (40px)
|
|
1025
|
+
.u-g-3 - Gaps in both directions with 3 lines (48px)
|
|
1026
|
+
.u-gv-normal - Normal vertically gaps
|
|
1027
|
+
.u-gv-0 - No vertically gaps
|
|
1028
|
+
.u-gv-half - Vertically gaps with half a line (8px)
|
|
1029
|
+
.u-gv-1 - Vertically gaps with 1 line (16px)
|
|
1030
|
+
.u-gv-1-half - Vertically gaps with 1 line an a half (24px)
|
|
1031
|
+
.u-gv-2 - Vertically gaps with 2 lines (32px)
|
|
1032
|
+
.u-gv-2-half - Vertically gaps with 2 lines an a half (40px)
|
|
1033
|
+
.u-gv-3 - Vertically gaps with 3 lines (48px)
|
|
1034
|
+
.u-gh-normal - Normal horizontally gaps
|
|
1035
|
+
.u-gh-0 - No horizontally gaps
|
|
1036
|
+
.u-gh-half - Horizontally gaps with half a line (8px)
|
|
1037
|
+
.u-gh-1 - Horizontally gaps with 1 line (16px)
|
|
1038
|
+
.u-gh-1-half - Horizontally gaps with 1 line an a half (24px)
|
|
1039
|
+
.u-gh-2 - Horizontally gaps with 2 lines (32px)
|
|
1040
|
+
.u-gh-2-half - Horizontally gaps with 2 lines an a half (40px)
|
|
1041
|
+
.u-gh-3 - Horizontally gaps with 3 lines (48px)
|
|
1042
|
+
|
|
1043
|
+
Markup:
|
|
1044
|
+
<div style="background-color: dimgrey; border: 1px solid black; line-height: 2.5rem;" class="u-flex u-flex-wrap u-w-4 u-ta-center {{modifier_class}}">
|
|
1045
|
+
<div style="background-color: gainsboro;" class="u-w-2-half u-h-2-half">🎶</div>
|
|
1046
|
+
<div style="background-color: gainsboro;" class="u-w-2-half u-h-2-half">🎵</div>
|
|
1047
|
+
<div style="background-color: gainsboro;" class="u-w-2-half u-h-2-half">🎼</div>
|
|
1048
|
+
<div style="background-color: gainsboro;" class="u-w-2-half u-h-2-half">💃</div>
|
|
1049
|
+
</div>
|
|
1050
|
+
|
|
1051
|
+
Styleguide utilities.gaps
|
|
1052
|
+
*/
|
|
1053
|
+
|
|
1054
|
+
|
|
1012
1055
|
/*
|
|
1013
1056
|
Spacing
|
|
1014
1057
|
|
|
@@ -21,6 +21,27 @@ directions = {
|
|
|
21
21
|
h: horizontal
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
gapTypes = {
|
|
25
|
+
g: gap
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
gapSizes = {
|
|
29
|
+
'normal': normal,
|
|
30
|
+
'0': 0,
|
|
31
|
+
'half': rem(8),
|
|
32
|
+
'1': rem(16),
|
|
33
|
+
'1-half': rem(24),
|
|
34
|
+
'2': rem(32),
|
|
35
|
+
'2-half': rem(40),
|
|
36
|
+
'3': rem(48)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
gapDirections = {
|
|
40
|
+
'': all,
|
|
41
|
+
v: row,
|
|
42
|
+
h: column
|
|
43
|
+
}
|
|
44
|
+
|
|
24
45
|
// Placeholders generation
|
|
25
46
|
for kType, vType in types
|
|
26
47
|
for kSize, vSize in sizes
|
|
@@ -39,6 +60,15 @@ for kType, vType in types
|
|
|
39
60
|
else
|
|
40
61
|
${kType}{kDir}-{kSize}
|
|
41
62
|
{vType}-{vDir}: vSize !important
|
|
63
|
+
for kType, vType in gapTypes
|
|
64
|
+
for kSize, vSize in gapSizes
|
|
65
|
+
for kDir, vDir in gapDirections
|
|
66
|
+
if vDir == all
|
|
67
|
+
${kType}-{kSize}
|
|
68
|
+
{vType}: vSize !important
|
|
69
|
+
else
|
|
70
|
+
${kType}{kDir}-{kSize}
|
|
71
|
+
{vDir}-{vType}: vSize !important
|
|
42
72
|
|
|
43
73
|
// Classes generation
|
|
44
74
|
cssModulesSpacingUtils()
|
|
@@ -77,6 +107,24 @@ cssModulesSpacingUtils()
|
|
|
77
107
|
else
|
|
78
108
|
:global(.u-{kType}{kDir}-{kSize}-{vBp})
|
|
79
109
|
{vType}-{vDir}: vSize !important
|
|
110
|
+
for kType, vType in gapTypes
|
|
111
|
+
for kSize, vSize in gapSizes
|
|
112
|
+
for kDir, vDir in gapDirections
|
|
113
|
+
if vBp == ''
|
|
114
|
+
if vDir == all
|
|
115
|
+
:global(.u-{kType}-{kSize})
|
|
116
|
+
{vType}: vSize !important
|
|
117
|
+
else
|
|
118
|
+
:global(.u-{kType}{kDir}-{kSize})
|
|
119
|
+
{vDir}-{vType}: vSize !important
|
|
120
|
+
else
|
|
121
|
+
@media (max-width: rem(lookup('BP-'+kBp)))
|
|
122
|
+
if vDir == all
|
|
123
|
+
:global(.u-{kType}-{kSize}-{vBp})
|
|
124
|
+
{vType}: vSize !important
|
|
125
|
+
else
|
|
126
|
+
:global(.u-{kType}{kDir}-{kSize}-{vBp})
|
|
127
|
+
{vDir}-{vType}: vSize !important
|
|
80
128
|
|
|
81
129
|
nativeSpacingUtils()
|
|
82
130
|
for kBp, vBp in breakpoints
|
|
@@ -114,6 +162,25 @@ nativeSpacingUtils()
|
|
|
114
162
|
else
|
|
115
163
|
.u-{kType}{kDir}-{kSize}-{vBp}
|
|
116
164
|
{vType}-{vDir}: vSize !important
|
|
165
|
+
for kType, vType in gapTypes
|
|
166
|
+
for kSize, vSize in gapSizes
|
|
167
|
+
for kDir, vDir in gapDirections
|
|
168
|
+
if vBp == ''
|
|
169
|
+
if vDir == all
|
|
170
|
+
.u-{kType}-{kSize}
|
|
171
|
+
{vType}: vSize !important
|
|
172
|
+
else
|
|
173
|
+
.u-{kType}{kDir}-{kSize}
|
|
174
|
+
{vDir}-{vType}: vSize !important
|
|
175
|
+
else
|
|
176
|
+
@media (max-width: rem(lookup('BP-'+kBp)))
|
|
177
|
+
if vDir == all
|
|
178
|
+
.u-{kType}-{kSize}-{vBp}
|
|
179
|
+
{vType}: vSize !important
|
|
180
|
+
else
|
|
181
|
+
.u-{kType}{kDir}-{kSize}-{vBp}
|
|
182
|
+
{vDir}-{vType}: vSize !important
|
|
183
|
+
|
|
117
184
|
if cssmodules == true
|
|
118
185
|
cssModulesSpacingUtils()
|
|
119
186
|
else
|
|
@@ -19,10 +19,10 @@ export var BreakpointsProvider = function BreakpointsProvider(_ref) {
|
|
|
19
19
|
var _useIframeConnection = useIframeConnection({
|
|
20
20
|
parentBasedIframe: parentBasedIframe
|
|
21
21
|
}),
|
|
22
|
-
|
|
22
|
+
iframeWindow = _useIframeConnection.iframeWindow;
|
|
23
23
|
|
|
24
24
|
useIframeToSendWidth({
|
|
25
|
-
|
|
25
|
+
iframeWindow: iframeWindow
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
var _useParentBreakpoints = useParentBreakpoints({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,17 +4,17 @@ import { isInsideIframe } from "cozy-ui/transpiled/react/helpers/breakpoints";
|
|
|
4
4
|
export var useIframeConnection = function useIframeConnection(_ref) {
|
|
5
5
|
var parentBasedIframe = _ref.parentBasedIframe;
|
|
6
6
|
|
|
7
|
-
var _useState = useState(
|
|
7
|
+
var _useState = useState(null),
|
|
8
8
|
_useState2 = _slicedToArray(_useState, 2),
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
iframeWindow = _useState2[0],
|
|
10
|
+
setIframeWindow = _useState2[1];
|
|
11
11
|
|
|
12
12
|
var isIframe = parentBasedIframe && isInsideIframe(); // parent window receives from iframe to give breakpoints
|
|
13
13
|
|
|
14
14
|
useEffect(function () {
|
|
15
15
|
var handleMessage = function handleMessage(ev) {
|
|
16
16
|
if (ev.data === 'UI-breakpoints-needParentBreakpoints') {
|
|
17
|
-
|
|
17
|
+
setIframeWindow(ev.source);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -30,6 +30,6 @@ export var useIframeConnection = function useIframeConnection(_ref) {
|
|
|
30
30
|
}
|
|
31
31
|
}, [isIframe]);
|
|
32
32
|
return {
|
|
33
|
-
|
|
33
|
+
iframeWindow: iframeWindow
|
|
34
34
|
};
|
|
35
35
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export function useIframeToSendWidth({
|
|
2
|
-
|
|
1
|
+
export function useIframeToSendWidth({ iframeWindow }: {
|
|
2
|
+
iframeWindow: any;
|
|
3
3
|
}): void;
|
|
@@ -1,32 +1,24 @@
|
|
|
1
1
|
import throttle from 'lodash/throttle';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
/**
|
|
4
|
-
* To send window innerWidth to first iframe
|
|
5
|
-
* @returns
|
|
6
|
-
*/
|
|
7
3
|
|
|
8
|
-
var sendWidthToIframe = function sendWidthToIframe() {
|
|
9
|
-
return
|
|
4
|
+
var sendWidthToIframe = function sendWidthToIframe(iframeWindow) {
|
|
5
|
+
return iframeWindow === null || iframeWindow === void 0 ? void 0 : iframeWindow.postMessage("UI-breakpoints-value:".concat(window.innerWidth), '*');
|
|
10
6
|
};
|
|
11
7
|
|
|
12
8
|
export var useIframeToSendWidth = function useIframeToSendWidth(_ref) {
|
|
13
|
-
var
|
|
9
|
+
var iframeWindow = _ref.iframeWindow;
|
|
14
10
|
// parent window send its innerWidth
|
|
15
11
|
useEffect(function () {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}, [hasIframe]); // parent window send its innerWidth on resize
|
|
12
|
+
sendWidthToIframe(iframeWindow);
|
|
13
|
+
}, [iframeWindow]); // parent window send its innerWidth on resize
|
|
20
14
|
|
|
21
15
|
useEffect(function () {
|
|
22
16
|
var handleResize = throttle(function () {
|
|
23
|
-
|
|
24
|
-
sendWidthToIframe();
|
|
25
|
-
}
|
|
17
|
+
sendWidthToIframe(iframeWindow);
|
|
26
18
|
}, 100);
|
|
27
19
|
window.addEventListener('resize', handleResize);
|
|
28
20
|
return function () {
|
|
29
21
|
window.removeEventListener('resize', handleResize);
|
|
30
22
|
};
|
|
31
|
-
}, [
|
|
23
|
+
}, [iframeWindow]);
|
|
32
24
|
};
|