@multiplatform.one/components 7.61.1 → 7.62.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/dist/cjs/formLayouts/FormLayouts.cjs +52 -9
- package/dist/cjs/formLayouts/FormLayouts.native.js +52 -9
- package/dist/cjs/formLayouts/FormLayouts.native.js.map +1 -1
- package/dist/cjs/formLayouts/PreferencePanel.cjs +27 -11
- package/dist/cjs/formLayouts/PreferencePanel.native.js +27 -11
- package/dist/cjs/formLayouts/PreferencePanel.native.js.map +1 -1
- package/dist/cjs/formLayouts/index.cjs +2 -1
- package/dist/cjs/formLayouts/index.native.js +2 -1
- package/dist/cjs/formLayouts/index.native.js.map +1 -1
- package/dist/esm/formLayouts/FormLayouts.mjs +54 -12
- package/dist/esm/formLayouts/FormLayouts.mjs.map +1 -1
- package/dist/esm/formLayouts/FormLayouts.native.js +54 -12
- package/dist/esm/formLayouts/FormLayouts.native.js.map +1 -1
- package/dist/esm/formLayouts/PreferencePanel.mjs +27 -11
- package/dist/esm/formLayouts/PreferencePanel.mjs.map +1 -1
- package/dist/esm/formLayouts/PreferencePanel.native.js +27 -11
- package/dist/esm/formLayouts/PreferencePanel.native.js.map +1 -1
- package/dist/esm/formLayouts/index.mjs +2 -2
- package/dist/esm/formLayouts/index.mjs.map +1 -1
- package/dist/esm/formLayouts/index.native.js +2 -2
- package/dist/esm/formLayouts/index.native.js.map +1 -1
- package/dist/jsx/formLayouts/FormLayouts.mjs +54 -12
- package/dist/jsx/formLayouts/FormLayouts.mjs.map +1 -1
- package/dist/jsx/formLayouts/FormLayouts.native.js +52 -9
- package/dist/jsx/formLayouts/FormLayouts.native.js.map +1 -1
- package/dist/jsx/formLayouts/PreferencePanel.mjs +27 -11
- package/dist/jsx/formLayouts/PreferencePanel.mjs.map +1 -1
- package/dist/jsx/formLayouts/PreferencePanel.native.js +27 -11
- package/dist/jsx/formLayouts/PreferencePanel.native.js.map +1 -1
- package/dist/jsx/formLayouts/index.mjs +2 -2
- package/dist/jsx/formLayouts/index.mjs.map +1 -1
- package/dist/jsx/formLayouts/index.native.js +2 -1
- package/dist/jsx/formLayouts/index.native.js.map +1 -1
- package/package.json +9 -9
- package/src/formLayouts/FormLayouts.spec.tsx +58 -3
- package/src/formLayouts/FormLayouts.stories.tsx +34 -1
- package/src/formLayouts/FormLayouts.tsx +78 -22
- package/src/formLayouts/PreferencePanel.spec.tsx +13 -2
- package/src/formLayouts/PreferencePanel.tsx +39 -21
- package/src/formLayouts/formLayouts.designLaw.spec.ts +6 -4
- package/src/formLayouts/index.ts +1 -0
- package/types/formLayouts/FormLayouts.d.ts +12 -1
- package/types/formLayouts/FormLayouts.d.ts.map +1 -1
- package/types/formLayouts/PreferencePanel.d.ts.map +1 -1
- package/types/formLayouts/index.d.ts +1 -1
- package/types/formLayouts/index.d.ts.map +1 -1
|
@@ -3,6 +3,7 @@ import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
|
3
3
|
import { ListItem, Theme, View, YStack } from "tamagui";
|
|
4
4
|
import { Alert } from "../Alert/index.mjs";
|
|
5
5
|
import { Card } from "../Card.mjs";
|
|
6
|
+
import { useStandaloneForm } from "./FormLayouts.mjs";
|
|
6
7
|
import { H3, Heading } from "../Heading.mjs";
|
|
7
8
|
import { Separator } from "../Separator/index.mjs";
|
|
8
9
|
import { Paragraph, Text } from "../Text.mjs";
|
|
@@ -113,20 +114,18 @@ function PreferencePanel({
|
|
|
113
114
|
const {
|
|
114
115
|
knobProps
|
|
115
116
|
} = useResolvedKnobs();
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
paddingVertical: inset,
|
|
120
|
-
paddingHorizontal: 0,
|
|
117
|
+
const standalone = useStandaloneForm();
|
|
118
|
+
const inset = standalone ? knobProps.panelPadding.padding : 0;
|
|
119
|
+
const frame = {
|
|
121
120
|
width: "100%",
|
|
122
121
|
maxWidth: 560,
|
|
123
122
|
alignSelf: "center",
|
|
124
123
|
...knobProps.gap,
|
|
125
124
|
$sm: {
|
|
126
125
|
maxWidth: "100%"
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const body = /* @__PURE__ */jsxs(Fragment, {
|
|
130
129
|
children: [/* @__PURE__ */jsxs(View, {
|
|
131
130
|
flexDirection: "column",
|
|
132
131
|
gap: "$1",
|
|
@@ -142,7 +141,7 @@ function PreferencePanel({
|
|
|
142
141
|
children: subtitle
|
|
143
142
|
})
|
|
144
143
|
})]
|
|
145
|
-
}), /* @__PURE__ */jsx(Separator, {}), sections.map((section, si) => /* @__PURE__ */jsxs(View, {
|
|
144
|
+
}), standalone && /* @__PURE__ */jsx(Separator, {}), sections.map((section, si) => /* @__PURE__ */jsxs(View, {
|
|
146
145
|
flexDirection: "column",
|
|
147
146
|
...knobProps.gap,
|
|
148
147
|
children: [/* @__PURE__ */jsxs(View, {
|
|
@@ -175,9 +174,9 @@ function PreferencePanel({
|
|
|
175
174
|
intent: bannerIntent(section.banner.theme),
|
|
176
175
|
children: section.banner.message
|
|
177
176
|
})]
|
|
178
|
-
}), si < sections.length - 1 && /* @__PURE__ */jsx(Separator, {})]
|
|
177
|
+
}), standalone && si < sections.length - 1 && /* @__PURE__ */jsx(Separator, {})]
|
|
179
178
|
}, section.title)), footer && /* @__PURE__ */jsxs(Fragment, {
|
|
180
|
-
children: [/* @__PURE__ */jsx(Separator, {}), /* @__PURE__ */jsx(View, {
|
|
179
|
+
children: [standalone && /* @__PURE__ */jsx(Separator, {}), /* @__PURE__ */jsx(View, {
|
|
181
180
|
flexDirection: "row",
|
|
182
181
|
...knobProps.gap,
|
|
183
182
|
paddingHorizontal: inset,
|
|
@@ -185,6 +184,23 @@ function PreferencePanel({
|
|
|
185
184
|
})]
|
|
186
185
|
})]
|
|
187
186
|
});
|
|
187
|
+
if (standalone) return /* @__PURE__ */jsx(Card, {
|
|
188
|
+
...knobProps.surface,
|
|
189
|
+
"data-form-frame": "card",
|
|
190
|
+
paddingVertical: inset,
|
|
191
|
+
paddingHorizontal: 0,
|
|
192
|
+
...frame,
|
|
193
|
+
size,
|
|
194
|
+
...props,
|
|
195
|
+
children: body
|
|
196
|
+
});
|
|
197
|
+
return /* @__PURE__ */jsx(View, {
|
|
198
|
+
"data-form-frame": "inline",
|
|
199
|
+
flexDirection: "column",
|
|
200
|
+
...frame,
|
|
201
|
+
...props,
|
|
202
|
+
children: body
|
|
203
|
+
});
|
|
188
204
|
}
|
|
189
205
|
export { PreferencePanel };
|
|
190
206
|
//# sourceMappingURL=PreferencePanel.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RadioGroup","Switch","useResolvedKnobs","ListItem","Theme","View","YStack","Alert","Card","H3","Heading","Separator","Paragraph","Text","Fragment","jsx","jsxs","alertIntents","bannerIntent","theme","find","intent","ToggleRow","item","title","label","subTitle","description","backgroundColor","iconAfter","checked","value","onChange","onValueChange","switchProps","pressStyle","opacity","onPress","RadioRow","size","knobProps","flexDirection","gap","children","body","name","options","CustomRow","content","PreferenceRow","type","SectionGroup","testID","overflow","elevatedSurface","containerRadius","PreferencePanel","subtitle","sections","footer","props","inset","panelPadding","padding","
|
|
1
|
+
{"version":3,"names":["RadioGroup","Switch","useResolvedKnobs","ListItem","Theme","View","YStack","Alert","Card","useStandaloneForm","H3","Heading","Separator","Paragraph","Text","Fragment","jsx","jsxs","alertIntents","bannerIntent","theme","find","intent","ToggleRow","item","title","label","subTitle","description","backgroundColor","iconAfter","checked","value","onChange","onValueChange","switchProps","pressStyle","opacity","onPress","RadioRow","size","knobProps","flexDirection","gap","children","body","name","options","CustomRow","content","PreferenceRow","type","SectionGroup","testID","overflow","elevatedSurface","containerRadius","PreferencePanel","subtitle","sections","footer","props","standalone","inset","panelPadding","padding","frame","width","maxWidth","alignSelf","$sm","paddingHorizontal","fontWeight","color","map","section","si","alignItems","icon","margin","sizeToken","items","key","banner","message","length","surface","paddingVertical"],"sources":["../../../src/formL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D,OAAA,CAAQlD,KA4BnB,CACD,GAGAmC,MAAA,IACC,eAAA3C,IAAA,CAAAF,QAAA;MACG6B,QAAA,GAAAkB,UAAA,IAAc,eAAA9C,GAAA,CAACJ,SAAA,IAAU,GAC1B,eAAAI,GAAA,CAACX,IAAA;QAAKqC,aAAA,EAAc;QAAO,GAAGD,SAAA,CAAUE,GAAA;QAAK4B,iBAAA,EAAmBR,KAAA;QAC7DnB,QAAA,EAAAgB;MAAA,CACH;IAAA,CACF;EAAA,CAEJ;EAGF,IAAIE,UAAA,EACF,OACE,eAAA9C,GAAA,CAACR,IAAA;IACE,GAAGiC,SAAA,CAAU6C,OAAA;IACd,mBAAgB;IAChBC,eAAA,EAAiBxB,KAAA;IACjBQ,iBAAA,EAAmB;IAClB,GAAGL,KAAA;IACJ1B,IAAA;IACC,GAAGqB,KAAA;IAEHjB,QAAA,EAAAC;EAAA,CACH;EAEJ,OACE,eAAA7B,GAAA,CAACX,IAAA;IAAK,mBAAgB;IAASqC,aAAA,EAAc;IAAU,GAAGwB,KAAA;IAAQ,GAAGL,KAAA;IAClEjB,QAAA,EAAAC;EAAA,CACH;AAEJ","ignoreList":[]}
|
|
@@ -33,6 +33,7 @@ var import_theme = require("@multiplatform.one/theme");
|
|
|
33
33
|
var import_tamagui = require("tamagui");
|
|
34
34
|
var import_Alert = require("../Alert/index.native.js");
|
|
35
35
|
var import_Card = require("../Card.native.js");
|
|
36
|
+
var import_FormLayouts = require("./FormLayouts.native.js");
|
|
36
37
|
var import_Heading = require("../Heading.native.js");
|
|
37
38
|
var import_Separator = require("../Separator/index.native.js");
|
|
38
39
|
var import_Text = require("../Text.native.js");
|
|
@@ -154,20 +155,18 @@ function PreferencePanel(param) {
|
|
|
154
155
|
var {
|
|
155
156
|
knobProps
|
|
156
157
|
} = (0, import_theme.useResolvedKnobs)();
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
paddingVertical: inset,
|
|
161
|
-
paddingHorizontal: 0,
|
|
158
|
+
var standalone = (0, import_FormLayouts.useStandaloneForm)();
|
|
159
|
+
var inset = standalone ? knobProps.panelPadding.padding : 0;
|
|
160
|
+
var frame = {
|
|
162
161
|
width: "100%",
|
|
163
162
|
maxWidth: 560,
|
|
164
163
|
alignSelf: "center",
|
|
165
164
|
...knobProps.gap,
|
|
166
165
|
$sm: {
|
|
167
166
|
maxWidth: "100%"
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
var body = /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
171
170
|
children: [/* Header */
|
|
172
171
|
/* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_tamagui.View, {
|
|
173
172
|
flexDirection: "column",
|
|
@@ -184,7 +183,7 @@ function PreferencePanel(param) {
|
|
|
184
183
|
children: subtitle
|
|
185
184
|
})
|
|
186
185
|
})]
|
|
187
|
-
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Separator.Separator, {}), /* Sections */
|
|
186
|
+
}), standalone && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Separator.Separator, {}), /* Sections */
|
|
188
187
|
sections.map(function (section, si) {
|
|
189
188
|
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_tamagui.View, {
|
|
190
189
|
flexDirection: "column",
|
|
@@ -221,11 +220,11 @@ function PreferencePanel(param) {
|
|
|
221
220
|
intent: bannerIntent(section.banner.theme),
|
|
222
221
|
children: section.banner.message
|
|
223
222
|
})]
|
|
224
|
-
}), si < sections.length - 1 && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Separator.Separator, {})]
|
|
223
|
+
}), standalone && si < sections.length - 1 && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Separator.Separator, {})]
|
|
225
224
|
}, section.title);
|
|
226
225
|
}), /* Footer */
|
|
227
226
|
footer && /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
228
|
-
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Separator.Separator, {}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.View, {
|
|
227
|
+
children: [standalone && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Separator.Separator, {}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.View, {
|
|
229
228
|
flexDirection: "row",
|
|
230
229
|
...knobProps.gap,
|
|
231
230
|
paddingHorizontal: inset,
|
|
@@ -233,5 +232,22 @@ function PreferencePanel(param) {
|
|
|
233
232
|
})]
|
|
234
233
|
})]
|
|
235
234
|
});
|
|
235
|
+
if (standalone) return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Card.Card, {
|
|
236
|
+
...knobProps.surface,
|
|
237
|
+
"data-form-frame": "card",
|
|
238
|
+
paddingVertical: inset,
|
|
239
|
+
paddingHorizontal: 0,
|
|
240
|
+
...frame,
|
|
241
|
+
size,
|
|
242
|
+
...props,
|
|
243
|
+
children: body
|
|
244
|
+
});
|
|
245
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.View, {
|
|
246
|
+
"data-form-frame": "inline",
|
|
247
|
+
flexDirection: "column",
|
|
248
|
+
...frame,
|
|
249
|
+
...props,
|
|
250
|
+
children: body
|
|
251
|
+
});
|
|
236
252
|
}
|
|
237
253
|
//# sourceMappingURL=PreferencePanel.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","PreferencePanel_exports","PreferencePanel","module","exports","import_jsx_runtime","require","import_forms","import_theme","import_tamagui","import_Alert","import_Card","import_Heading","import_Separator","import_Text","alertIntents","bannerIntent","theme","arguments","length","_alertIntents_find","find","intent","ToggleRow","param","item","jsx","ListItem","title","label","subTitle","description","backgroundColor","iconAfter","Switch","checked","onChange","onValueChange","switchProps","pressStyle","opacity","onPress","RadioRow","size","knobProps","useResolvedKnobs","jsxs","View","flexDirection","gap","children","Text","body","Theme","Paragraph","RadioGroup","options","CustomRow","content","PreferenceRow","type","SectionGroup","YStack","testID","overflow","elevatedSurface","containerRadius"],"sources":["../../../src/formLayouts/PreferencePanel.tsx"],"sourcesContent":[null],"mappings":"AACA,YAAS;;AACT,IAAAA,SAAS,GAAAC,MAAA,CAAAC,cAAwB;AACjC,IAAAC,gBAAA,GAAAF,MAAA,CAAAG,wBAAA;AAAA,IACEC,iBAAA,GAAAJ,MAAA,CAAAK,mBAAA;AAAA,IACAC,YAAA,GAAAN,MAAA,CAAAO,SAAA,CAAAC,cAAA;AAAA,IACAC,QAAA,GAAAA,CAAAC,MAAA,EAAAC,GAAA;EACA,SAAAC,IAAA,IAAAD,GAAA,EAAAZ,SAIK,CAAAW,MAAA,EAAAE,IAAA;IAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;IAAAE,UAAA;EAAA;AACP;AACA,IAAAC,WAAS,GAAAA,CAAAC,EAAY,EAAAC,IAAA,EAAAC,MAAA,EAAAC,IAAA;EACrB,IAAAF,IAAS,
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","PreferencePanel_exports","PreferencePanel","module","exports","import_jsx_runtime","require","import_forms","import_theme","import_tamagui","import_Alert","import_Card","import_FormLayouts","import_Heading","import_Separator","import_Text","alertIntents","bannerIntent","theme","arguments","length","_alertIntents_find","find","intent","ToggleRow","param","item","jsx","ListItem","title","label","subTitle","description","backgroundColor","iconAfter","Switch","checked","onChange","onValueChange","switchProps","pressStyle","opacity","onPress","RadioRow","size","knobProps","useResolvedKnobs","jsxs","View","flexDirection","gap","children","Text","body","Theme","Paragraph","RadioGroup","options","CustomRow","content","PreferenceRow","type","SectionGroup","YStack","testID","overflow","elevatedSurface","containerRadius","subtitle","sections","footer","props","standalone","useStandaloneForm","inset","panelPadding","padding","frame"],"sources":["../../../src/formLayouts/PreferencePanel.tsx"],"sourcesContent":[null],"mappings":"AACA,YAAS;;AACT,IAAAA,SAAS,GAAAC,MAAA,CAAAC,cAAwB;AACjC,IAAAC,gBAAA,GAAAF,MAAA,CAAAG,wBAAA;AAAA,IACEC,iBAAA,GAAAJ,MAAA,CAAAK,mBAAA;AAAA,IACAC,YAAA,GAAAN,MAAA,CAAAO,SAAA,CAAAC,cAAA;AAAA,IACAC,QAAA,GAAAA,CAAAC,MAAA,EAAAC,GAAA;EACA,SAAAC,IAAA,IAAAD,GAAA,EAAAZ,SAIK,CAAAW,MAAA,EAAAE,IAAA;IAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;IAAAE,UAAA;EAAA;AACP;AACA,IAAAC,WAAS,GAAAA,CAAAC,EAAY,EAAAC,IAAA,EAAAC,MAAA,EAAAC,IAAA;EACrB,IAAAF,IAAS,WAAAA,IAAA,aAAyB,WAAAA,IAAA;IAClC,KAAS,IAAIG,GAAA,IAAAhB,iBAAe,CAAAa,IAAA,GAC5B,IAAS,CAAAX,YAAA,CAAAe,IAAiB,CAAAL,EAAA,EAAAI,GAAA,KAAAA,GAAA,KAAAF,MAAA,EAC1BnB,SAAS,CAAAiB,EAAW,EAAAI,GAAA;MAAAP,GAAY,EAAAA,CAAA,KAAAI,IAAA,CAAAG,GAAA;MAAAN,UAAA,IAAAK,IAAA,GAAAjB,gBAAA,CAAAe,IAAA,EAAAG,GAAA,MAAAD,IAAA,CAAAL;IAAA;EA6FxB;EAjBR,OAAME,EAAA;AAEN;AACE,IAAAM,YAAO,GAAAC,GAAa,IAAMR,WAAW,CAAAhB,SAAA,CAAW,gBAAU;EAAAyB,KAAA;AAAA,IAAAD,GAAA;A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ton, GithubButton, Hide } from "./FormLayouts.mjs";
|
|
1
|
+
import { FormCard, LoginLayout, SignUpLayout, SettingsFormLayout, SocialButton, GithubButton, Hide, useStandaloneForm } from "./FormLayouts.mjs";
|
|
2
2
|
import { PreferencePanel } from "./PreferencePanel.mjs";
|
|
3
|
-
export { FormCard, GithubButton, Hide, LoginLayout, PreferencePanel, SettingsFormLayout, SignUpLayout, SocialButton };
|
|
3
|
+
export { FormCard, GithubButton, Hide, LoginLayout, PreferencePanel, SettingsFormLayout, SignUpLayout, SocialButton, useStandaloneForm };
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FormCard","LoginLayout","SignUpLayout","SettingsFormLayout","SocialButton","GithubButton","Hide","PreferencePanel"],"sources":["../../../src/formLayouts/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SACEA,QAAA,EACAC,WAAA,EACAC,YAAA,EACAC,kBAAA,EACAC,YAAA,EACAC,YAAA,EACAC,IAAA,QACK;AASP,SAASC,eAAA,QAAuB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["FormCard","LoginLayout","SignUpLayout","SettingsFormLayout","SocialButton","GithubButton","Hide","useStandaloneForm","PreferencePanel"],"sources":["../../../src/formLayouts/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SACEA,QAAA,EACAC,WAAA,EACAC,YAAA,EACAC,kBAAA,EACAC,YAAA,EACAC,YAAA,EACAC,IAAA,EACAC,iBAAA,QACK;AASP,SAASC,eAAA,QAAuB","ignoreList":[]}
|
|
@@ -31,7 +31,8 @@ __export(formLayouts_exports, {
|
|
|
31
31
|
PreferencePanel: () => import_PreferencePanel.PreferencePanel,
|
|
32
32
|
SettingsFormLayout: () => import_FormLayouts.SettingsFormLayout,
|
|
33
33
|
SignUpLayout: () => import_FormLayouts.SignUpLayout,
|
|
34
|
-
SocialButton: () => import_FormLayouts.SocialButton
|
|
34
|
+
SocialButton: () => import_FormLayouts.SocialButton,
|
|
35
|
+
useStandaloneForm: () => import_FormLayouts.useStandaloneForm
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(formLayouts_exports);
|
|
37
38
|
var import_FormLayouts = require("./FormLayouts.native.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc"],"sources":["../../../src/formLayouts/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;AAAA,IACEA,SAAA,GAAAC,MAAA,CAAAC,cAAA;AAAA,IACAC,gBAAA,GAAAF,MAAA,CAAAG,wBAAA;AAAA,IACAC,iBAAA,GAAAJ,MAAA,CAAAK,mBAAA;AAAA,IACAC,YAAA,GAAAN,MAAA,CAAAO,SAAA,CAAAC,cAAA;AAAA,IACAC,QAAA,GAAAA,CAAAC,MAAA,EAAAC,GAAA;EACA,SAAAC,IAAA,IAAAD,GAAA,EACAZ,SAAA,CAAAW,MAAA,EAAAE,IAAA;IAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;IAAAE,UAAA;EAAA;AAAA;
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc"],"sources":["../../../src/formLayouts/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;AAAA,IACEA,SAAA,GAAAC,MAAA,CAAAC,cAAA;AAAA,IACAC,gBAAA,GAAAF,MAAA,CAAAG,wBAAA;AAAA,IACAC,iBAAA,GAAAJ,MAAA,CAAAK,mBAAA;AAAA,IACAC,YAAA,GAAAN,MAAA,CAAAO,SAAA,CAAAC,cAAA;AAAA,IACAC,QAAA,GAAAA,CAAAC,MAAA,EAAAC,GAAA;EACA,SAAAC,IAAA,IAAAD,GAAA,EACAZ,SAAA,CAAAW,MAAA,EAAAE,IAAA;IAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;IAAAE,UAAA;EAAA;AAAA;AACA,IAAAC,WACK,GAAAA,CAAAC,EAAA,EAAAC,IAAA,EAAAC,MAAA,EAAAC,IAAA;EASP,IAAAF,IAAS,WAAAA,IAAA,aAAuB,WAAAA,IAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/components",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.62.0",
|
|
4
4
|
"description": "multiplatform.one ui components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@floating-ui/react": "^0.27.20",
|
|
61
|
-
"@multiplatform.one/forms": "^7.
|
|
62
|
-
"@multiplatform.one/i18n": "^7.
|
|
63
|
-
"@multiplatform.one/platform": "^7.
|
|
64
|
-
"@multiplatform.one/router": "^7.
|
|
65
|
-
"@multiplatform.one/theme": "^7.
|
|
61
|
+
"@multiplatform.one/forms": "^7.62.0",
|
|
62
|
+
"@multiplatform.one/i18n": "^7.62.0",
|
|
63
|
+
"@multiplatform.one/platform": "^7.62.0",
|
|
64
|
+
"@multiplatform.one/router": "^7.62.0",
|
|
65
|
+
"@multiplatform.one/theme": "^7.62.0",
|
|
66
66
|
"@phosphor-icons/react": "^2.1.10",
|
|
67
67
|
"@shopify/flash-list": "^2.3.1",
|
|
68
68
|
"@tamagui/colors": "2.7.6",
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
"tamagui": "2.7.6"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@multiplatform.one/config": "7.
|
|
93
|
-
"@multiplatform.one/storybook": "7.
|
|
94
|
-
"@multiplatform.one/test-utils": "7.
|
|
92
|
+
"@multiplatform.one/config": "7.62.0",
|
|
93
|
+
"@multiplatform.one/storybook": "7.62.0",
|
|
94
|
+
"@multiplatform.one/test-utils": "7.62.0",
|
|
95
95
|
"@tamagui/build": "2.7.6",
|
|
96
96
|
"@testing-library/jest-dom": "^7.0.1",
|
|
97
97
|
"@testing-library/react": "^16.3.3",
|
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
2
2
|
import { cleanup, screen } from "@testing-library/react";
|
|
3
|
-
import {
|
|
3
|
+
import { OverlayStackProvider } from "@multiplatform.one/forms";
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
+
import { Card } from "../Card";
|
|
4
6
|
import * as components from "../index";
|
|
5
7
|
import { FormCard, LoginLayout, SettingsFormLayout, SignUpLayout } from "./FormLayouts";
|
|
6
8
|
import { PreferencePanel } from "./PreferencePanel";
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
// Tamagui's web useWindowDimensions reads documentElement.clientWidth, which
|
|
11
|
+
// jsdom leaves at 0.
|
|
12
|
+
function setViewportWidth(width: number) {
|
|
13
|
+
Object.defineProperty(document.documentElement, "clientWidth", {
|
|
14
|
+
configurable: true,
|
|
15
|
+
value: width,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
beforeEach(() => setViewportWidth(1280));
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
cleanup();
|
|
22
|
+
Reflect.deleteProperty(document.documentElement, "clientWidth");
|
|
23
|
+
});
|
|
9
24
|
|
|
10
|
-
describe("form layouts ride the MPO Card (FZ-8001, LC-175)", () => {
|
|
25
|
+
describe("standalone on a wide page, form layouts ride the MPO Card (FZ-8001, LC-175)", () => {
|
|
11
26
|
it("the components barrel exports every former @package/ui form layout", () => {
|
|
12
27
|
for (const name of [
|
|
13
28
|
"FormCard",
|
|
@@ -18,6 +33,7 @@ describe("form layouts ride the MPO Card (FZ-8001, LC-175)", () => {
|
|
|
18
33
|
"GithubButton",
|
|
19
34
|
"Hide",
|
|
20
35
|
"PreferencePanel",
|
|
36
|
+
"useStandaloneForm",
|
|
21
37
|
])
|
|
22
38
|
expect((components as Record<string, unknown>)[name], name).toBeDefined();
|
|
23
39
|
});
|
|
@@ -83,3 +99,42 @@ describe("form layouts ride the MPO Card (FZ-8001, LC-175)", () => {
|
|
|
83
99
|
expect(warning, "warning banner renders Alert").not.toBeNull();
|
|
84
100
|
});
|
|
85
101
|
});
|
|
102
|
+
|
|
103
|
+
describe("a form is never a card inside a card (FZ-8001 r2, LC-169)", () => {
|
|
104
|
+
it("standalone on a wide page, the form raises the Card", () => {
|
|
105
|
+
renderWithProviders(<LoginLayout title="Sign in" />);
|
|
106
|
+
expect(document.querySelectorAll('[data-form-frame="card"]')).toHaveLength(1);
|
|
107
|
+
expect(document.querySelectorAll('[data-form-frame="inline"]')).toHaveLength(0);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it("inside a Card, every layout sits on the Card's surface with no card of its own", () => {
|
|
111
|
+
renderWithProviders(
|
|
112
|
+
<Card>
|
|
113
|
+
<LoginLayout title="Sign in" />
|
|
114
|
+
<SignUpLayout title="Create an account" />
|
|
115
|
+
<SettingsFormLayout title="Account" sections={[{ title: "Profile", content: null }]} />
|
|
116
|
+
<PreferencePanel sections={[{ title: "Sync", items: [] }]} />
|
|
117
|
+
</Card>,
|
|
118
|
+
);
|
|
119
|
+
expect(document.querySelectorAll('[data-tier="content"]')).toHaveLength(1);
|
|
120
|
+
expect(document.querySelectorAll('[data-form-frame="card"]')).toHaveLength(0);
|
|
121
|
+
expect(document.querySelectorAll('[data-form-frame="inline"]')).toHaveLength(4);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it("inside an overlay (Sheet, Dialog, Popover), the form stays inline", () => {
|
|
125
|
+
renderWithProviders(
|
|
126
|
+
<OverlayStackProvider zIndex={100}>
|
|
127
|
+
<SettingsFormLayout title="Account" sections={[{ title: "Profile", content: null }]} />
|
|
128
|
+
</OverlayStackProvider>,
|
|
129
|
+
);
|
|
130
|
+
expect(document.querySelectorAll('[data-form-frame="card"]')).toHaveLength(0);
|
|
131
|
+
expect(document.querySelector('[data-form-frame="inline"]')?.tagName).toBe("FORM");
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it("on a phone-width page, the form stays inline", () => {
|
|
135
|
+
setViewportWidth(390);
|
|
136
|
+
renderWithProviders(<PreferencePanel sections={[{ title: "Sync", items: [] }]} />);
|
|
137
|
+
expect(document.querySelectorAll('[data-form-frame="card"]')).toHaveLength(0);
|
|
138
|
+
expect(document.querySelectorAll('[data-form-frame="inline"]')).toHaveLength(1);
|
|
139
|
+
});
|
|
140
|
+
});
|
|
@@ -2,6 +2,8 @@ import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
|
2
2
|
import { Input, Switch } from "@multiplatform.one/forms";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { YStack } from "tamagui";
|
|
5
|
+
import { Card as MpoCard } from "../Card";
|
|
6
|
+
import { SheetModal } from "../SheetModal";
|
|
5
7
|
import {
|
|
6
8
|
FormCard,
|
|
7
9
|
GithubButton,
|
|
@@ -19,7 +21,7 @@ const meta: Meta<typeof FormCard> = {
|
|
|
19
21
|
docs: {
|
|
20
22
|
description: {
|
|
21
23
|
component:
|
|
22
|
-
"Sign-in, sign-up, settings and preference panels for every MPO app
|
|
24
|
+
"Sign-in, sign-up, settings and preference panels for every MPO app (LC-175). A form never sits in a card inside a card (LC-169): standalone on a page at least `md` wide it raises the MPO Card, and anywhere else (a phone, a Card, Sheet, Dialog or Popover) it sits on the surface it was placed on. The app template re-exports them from @package/ui.",
|
|
23
25
|
},
|
|
24
26
|
},
|
|
25
27
|
},
|
|
@@ -126,3 +128,34 @@ function PreferencesDemo() {
|
|
|
126
128
|
export const Preferences: Story = {
|
|
127
129
|
render: () => <PreferencesDemo />,
|
|
128
130
|
};
|
|
131
|
+
|
|
132
|
+
function SignInSheetDemo() {
|
|
133
|
+
const [open, setOpen] = useState(true);
|
|
134
|
+
return (
|
|
135
|
+
<SheetModal open={open} onOpenChange={setOpen}>
|
|
136
|
+
<LoginLayout title="Sign in" onSubmit={() => {}} onForgotPassword={() => {}} />
|
|
137
|
+
</SheetModal>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export const SignInInSheet: Story = {
|
|
142
|
+
name: "Sign in, inside a Sheet",
|
|
143
|
+
render: () => <SignInSheetDemo />,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const SettingsInCard: Story = {
|
|
147
|
+
name: "Settings, inside a Card",
|
|
148
|
+
render: () => (
|
|
149
|
+
<MpoCard>
|
|
150
|
+
<SettingsFormLayout
|
|
151
|
+
title="Account Settings"
|
|
152
|
+
sections={[
|
|
153
|
+
{
|
|
154
|
+
title: "Personal Information",
|
|
155
|
+
content: <Input label="Display Name" defaultValue="John Doe" />,
|
|
156
|
+
},
|
|
157
|
+
]}
|
|
158
|
+
/>
|
|
159
|
+
</MpoCard>
|
|
160
|
+
),
|
|
161
|
+
};
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { useId, useState } from "react";
|
|
3
|
-
import { Input, Spinner } from "@multiplatform.one/forms";
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { Input, Spinner, useOverlayParentZIndex } from "@multiplatform.one/forms";
|
|
4
|
+
import {
|
|
5
|
+
SurfaceContext,
|
|
6
|
+
layoutBreakpoints,
|
|
7
|
+
useResolvedKnobs,
|
|
8
|
+
type MediaQueryKey,
|
|
9
|
+
} from "@multiplatform.one/theme";
|
|
10
|
+
import {
|
|
11
|
+
AnimatePresence,
|
|
12
|
+
Theme,
|
|
13
|
+
View,
|
|
14
|
+
useMedia,
|
|
15
|
+
useWindowDimensions,
|
|
16
|
+
type FontSizeTokens,
|
|
17
|
+
} from "tamagui";
|
|
6
18
|
import { Button } from "../Button";
|
|
7
19
|
import { Card, type CardProps } from "../Card";
|
|
8
20
|
import { H1, Heading } from "../Heading";
|
|
@@ -20,6 +32,24 @@ export function Hide({ children, when = "sm" }: { children: ReactNode; when: Med
|
|
|
20
32
|
return children;
|
|
21
33
|
}
|
|
22
34
|
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
// Standalone detection: a form is never a card inside a card (LC-169)
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* True when a form layout stands alone on a wide page: the viewport reaches
|
|
41
|
+
* the `md` breakpoint and no Card, Panel, bar, Sheet, Dialog or Popover
|
|
42
|
+
* holds it. Only then does it raise its own Card; everywhere else it sits on
|
|
43
|
+
* the surface it was placed on (LC-169 CARD-HIERARCHY).
|
|
44
|
+
*/
|
|
45
|
+
export function useStandaloneForm(): boolean {
|
|
46
|
+
const surface = SurfaceContext.useStyledContext();
|
|
47
|
+
const insideOverlay = useOverlayParentZIndex() !== undefined;
|
|
48
|
+
const { width } = useWindowDimensions();
|
|
49
|
+
if (insideOverlay || surface.painted || surface.elevated || surface.bar) return false;
|
|
50
|
+
return width >= layoutBreakpoints.md;
|
|
51
|
+
}
|
|
52
|
+
|
|
23
53
|
// ---------------------------------------------------------------------------
|
|
24
54
|
// FormCard — shared wrapper for form layouts
|
|
25
55
|
// ---------------------------------------------------------------------------
|
|
@@ -28,11 +58,30 @@ export interface FormCardProps extends CardProps {
|
|
|
28
58
|
children: ReactNode;
|
|
29
59
|
}
|
|
30
60
|
|
|
31
|
-
|
|
61
|
+
/**
|
|
62
|
+
* The form's frame. Standalone on a wide page it is the MPO Card; anywhere
|
|
63
|
+
* else it is a bare form that sits on its parent's surface.
|
|
64
|
+
*/
|
|
65
|
+
export function FormCard({ children, tier, size, ...props }: FormCardProps) {
|
|
66
|
+
const { knobProps } = useResolvedKnobs();
|
|
67
|
+
const standalone = useStandaloneForm();
|
|
68
|
+
if (standalone)
|
|
69
|
+
return (
|
|
70
|
+
<Card render="form" data-form-frame="card" tier={tier} size={size} {...props}>
|
|
71
|
+
{children}
|
|
72
|
+
</Card>
|
|
73
|
+
);
|
|
32
74
|
return (
|
|
33
|
-
<
|
|
75
|
+
<View
|
|
76
|
+
render="form"
|
|
77
|
+
data-form-frame="inline"
|
|
78
|
+
flexDirection="column"
|
|
79
|
+
width="100%"
|
|
80
|
+
{...knobProps.gap}
|
|
81
|
+
{...props}
|
|
82
|
+
>
|
|
34
83
|
{children}
|
|
35
|
-
</
|
|
84
|
+
</View>
|
|
36
85
|
);
|
|
37
86
|
}
|
|
38
87
|
|
|
@@ -74,7 +123,7 @@ export function LoginLayout({
|
|
|
74
123
|
};
|
|
75
124
|
|
|
76
125
|
return (
|
|
77
|
-
<FormCard>
|
|
126
|
+
<FormCard width="100%" maxWidth={layoutBreakpoints.xs} alignSelf="center">
|
|
78
127
|
<View
|
|
79
128
|
flexDirection="column"
|
|
80
129
|
alignItems="stretch"
|
|
@@ -83,7 +132,7 @@ export function LoginLayout({
|
|
|
83
132
|
{...knobProps.gapLg}
|
|
84
133
|
$sm={{ paddingVertical: "$4", width: 400 }}
|
|
85
134
|
>
|
|
86
|
-
<H1 alignSelf="center" size="$8" $xs={{ size: "$7" }}>
|
|
135
|
+
<H1 alignSelf="center" size="$8" color="$color12" $xs={{ size: "$7" }}>
|
|
87
136
|
{title}
|
|
88
137
|
</H1>
|
|
89
138
|
|
|
@@ -286,7 +335,7 @@ export function SignUpLayout({
|
|
|
286
335
|
};
|
|
287
336
|
|
|
288
337
|
return (
|
|
289
|
-
<FormCard>
|
|
338
|
+
<FormCard width="100%" maxWidth={layoutBreakpoints.xs} alignSelf="center">
|
|
290
339
|
<View
|
|
291
340
|
flexDirection="column"
|
|
292
341
|
alignItems="stretch"
|
|
@@ -295,7 +344,7 @@ export function SignUpLayout({
|
|
|
295
344
|
{...knobProps.gapLg}
|
|
296
345
|
$xs={{ paddingVertical: "$4" }}
|
|
297
346
|
>
|
|
298
|
-
<H1 size="$9" fontWeight="bold">
|
|
347
|
+
<H1 size="$9" fontWeight="bold" color="$color12">
|
|
299
348
|
{title}
|
|
300
349
|
</H1>
|
|
301
350
|
|
|
@@ -474,30 +523,37 @@ export function SettingsFormLayout({
|
|
|
474
523
|
...props
|
|
475
524
|
}: SettingsFormLayoutProps) {
|
|
476
525
|
const { knobProps } = useResolvedKnobs();
|
|
477
|
-
const
|
|
526
|
+
const standalone = useStandaloneForm();
|
|
527
|
+
const inset = standalone ? knobProps.panelPadding.padding : 0;
|
|
528
|
+
const frame = standalone
|
|
529
|
+
? { paddingVertical: inset, paddingHorizontal: 0, ...knobProps.gapLg }
|
|
530
|
+
: { ...knobProps.gapLg };
|
|
478
531
|
|
|
479
532
|
return (
|
|
480
|
-
<
|
|
481
|
-
render="form"
|
|
482
|
-
paddingVertical={inset}
|
|
483
|
-
paddingHorizontal={0}
|
|
533
|
+
<FormCard
|
|
484
534
|
width="100%"
|
|
485
535
|
maxWidth={layoutBreakpoints.medium}
|
|
486
536
|
alignSelf="center"
|
|
487
|
-
{...
|
|
537
|
+
{...frame}
|
|
488
538
|
$sm={{ maxWidth: "100%" }}
|
|
489
539
|
{...props}
|
|
490
540
|
>
|
|
491
|
-
<H1
|
|
541
|
+
<H1
|
|
542
|
+
{...knobProps.heading}
|
|
543
|
+
size="$8"
|
|
544
|
+
fontWeight="700"
|
|
545
|
+
color="$color12"
|
|
546
|
+
paddingHorizontal={inset}
|
|
547
|
+
>
|
|
492
548
|
{title}
|
|
493
549
|
</H1>
|
|
494
|
-
<Separator />
|
|
550
|
+
{standalone && <Separator />}
|
|
495
551
|
|
|
496
552
|
{sections.map((section, i) => (
|
|
497
553
|
<View key={section.title} flexDirection="column" {...knobProps.gap}>
|
|
498
554
|
<View flexDirection="column" {...knobProps.gap} paddingHorizontal={inset}>
|
|
499
555
|
<View flexDirection="column" gap="$1">
|
|
500
|
-
<Heading margin={0} size={knobProps.sizeToken as FontSizeTokens}>
|
|
556
|
+
<Heading margin={0} size={knobProps.sizeToken as FontSizeTokens} color="$color12">
|
|
501
557
|
{section.title}
|
|
502
558
|
</Heading>
|
|
503
559
|
{section.description && (
|
|
@@ -508,13 +564,13 @@ export function SettingsFormLayout({
|
|
|
508
564
|
</View>
|
|
509
565
|
{section.content}
|
|
510
566
|
</View>
|
|
511
|
-
{i < sections.length - 1 && <Separator />}
|
|
567
|
+
{standalone && i < sections.length - 1 && <Separator />}
|
|
512
568
|
</View>
|
|
513
569
|
))}
|
|
514
570
|
|
|
515
571
|
{footer && (
|
|
516
572
|
<>
|
|
517
|
-
<Separator />
|
|
573
|
+
{standalone && <Separator />}
|
|
518
574
|
<View
|
|
519
575
|
flexDirection="row"
|
|
520
576
|
{...knobProps.gap}
|
|
@@ -525,6 +581,6 @@ export function SettingsFormLayout({
|
|
|
525
581
|
</View>
|
|
526
582
|
</>
|
|
527
583
|
)}
|
|
528
|
-
</
|
|
584
|
+
</FormCard>
|
|
529
585
|
);
|
|
530
586
|
}
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import { Preset } from "@multiplatform.one/theme";
|
|
2
2
|
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
3
3
|
import { cleanup } from "@testing-library/react";
|
|
4
|
-
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
5
|
import { PreferencePanel } from "./PreferencePanel";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// Standalone on a wide page the panel raises its own Card (FZ-8001 r2), so the
|
|
8
|
+
// section groups sit inside it. jsdom leaves documentElement.clientWidth at 0.
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
Object.defineProperty(document.documentElement, "clientWidth", {
|
|
11
|
+
configurable: true,
|
|
12
|
+
value: 1280,
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
cleanup();
|
|
17
|
+
Reflect.deleteProperty(document.documentElement, "clientWidth");
|
|
18
|
+
});
|
|
8
19
|
|
|
9
20
|
function renderPanel() {
|
|
10
21
|
renderWithProviders(
|