@ecohouse/ui 0.1.50 → 0.1.52
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/index.cjs +50 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +50 -15
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
- package/src/components/AutocompleteInput/AutocompleteInput.tsx +8 -5
- package/src/components/Drawer/Drawer.tsx +52 -12
package/dist/index.js
CHANGED
|
@@ -35084,6 +35084,7 @@ var Drawer = forwardRef(function Drawer2({
|
|
|
35084
35084
|
className
|
|
35085
35085
|
}, forwardedRef) {
|
|
35086
35086
|
const panelRef = useRef(null);
|
|
35087
|
+
const shellRef = useRef(null);
|
|
35087
35088
|
const setPanelRef = useMemo(() => mergeRefs(panelRef, forwardedRef), [forwardedRef]);
|
|
35088
35089
|
const resolvedClassName = className?.trim() || void 0;
|
|
35089
35090
|
const closeTimeoutRef = useRef(null);
|
|
@@ -35105,6 +35106,22 @@ var Drawer = forwardRef(function Drawer2({
|
|
|
35105
35106
|
document.removeEventListener("keydown", onKeyDown);
|
|
35106
35107
|
};
|
|
35107
35108
|
}, [mounted, onClose]);
|
|
35109
|
+
const targetWidth = Math.min(width, typeof window !== "undefined" ? window.innerWidth : width);
|
|
35110
|
+
const playWidth = useCallback(
|
|
35111
|
+
(target) => {
|
|
35112
|
+
const shell = shellRef.current;
|
|
35113
|
+
if (!shell) return;
|
|
35114
|
+
const reduced = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
35115
|
+
const duration = reduced ? 0 : animationDuration;
|
|
35116
|
+
const from = shell.getBoundingClientRect().width;
|
|
35117
|
+
shell.style.transition = "none";
|
|
35118
|
+
shell.style.width = `${from}px`;
|
|
35119
|
+
void shell.offsetWidth;
|
|
35120
|
+
shell.style.transition = `width ${duration}ms cubic-bezier(0.32, 0.72, 0, 1)`;
|
|
35121
|
+
shell.style.width = `${target}px`;
|
|
35122
|
+
},
|
|
35123
|
+
[animationDuration]
|
|
35124
|
+
);
|
|
35108
35125
|
useEffect(() => {
|
|
35109
35126
|
if (Platform.OS !== "web") return void 0;
|
|
35110
35127
|
if (closeTimeoutRef.current) {
|
|
@@ -35113,12 +35130,10 @@ var Drawer = forwardRef(function Drawer2({
|
|
|
35113
35130
|
}
|
|
35114
35131
|
if (open) {
|
|
35115
35132
|
setMounted(true);
|
|
35116
|
-
|
|
35117
|
-
requestAnimationFrame(() => setEntered(true));
|
|
35118
|
-
});
|
|
35119
|
-
return () => cancelAnimationFrame(frame);
|
|
35133
|
+
return void 0;
|
|
35120
35134
|
}
|
|
35121
35135
|
setEntered(false);
|
|
35136
|
+
playWidth(0);
|
|
35122
35137
|
closeTimeoutRef.current = setTimeout(() => {
|
|
35123
35138
|
setMounted(false);
|
|
35124
35139
|
closeTimeoutRef.current = null;
|
|
@@ -35129,7 +35144,22 @@ var Drawer = forwardRef(function Drawer2({
|
|
|
35129
35144
|
closeTimeoutRef.current = null;
|
|
35130
35145
|
}
|
|
35131
35146
|
};
|
|
35132
|
-
}, [open, animationDuration]);
|
|
35147
|
+
}, [open, animationDuration, playWidth]);
|
|
35148
|
+
useEffect(() => {
|
|
35149
|
+
if (Platform.OS !== "web" || !mounted || !open) return void 0;
|
|
35150
|
+
const shell = shellRef.current;
|
|
35151
|
+
if (shell) {
|
|
35152
|
+
shell.style.transition = "none";
|
|
35153
|
+
shell.style.width = "0px";
|
|
35154
|
+
}
|
|
35155
|
+
const frame = requestAnimationFrame(() => {
|
|
35156
|
+
requestAnimationFrame(() => {
|
|
35157
|
+
setEntered(true);
|
|
35158
|
+
playWidth(targetWidth);
|
|
35159
|
+
});
|
|
35160
|
+
});
|
|
35161
|
+
return () => cancelAnimationFrame(frame);
|
|
35162
|
+
}, [mounted, open, targetWidth, playWidth]);
|
|
35133
35163
|
useEffect(() => {
|
|
35134
35164
|
if (Platform.OS === "web") return void 0;
|
|
35135
35165
|
if (open) {
|
|
@@ -35256,16 +35286,16 @@ var Drawer = forwardRef(function Drawer2({
|
|
|
35256
35286
|
/* @__PURE__ */ jsx(
|
|
35257
35287
|
"div",
|
|
35258
35288
|
{
|
|
35289
|
+
ref: shellRef,
|
|
35259
35290
|
onTransitionEnd: handleWebTransitionEnd,
|
|
35260
35291
|
style: {
|
|
35261
35292
|
position: "relative",
|
|
35262
35293
|
zIndex: 1,
|
|
35263
35294
|
height: "100%",
|
|
35264
|
-
|
|
35295
|
+
flex: "0 0 auto",
|
|
35265
35296
|
minWidth: 0,
|
|
35266
35297
|
maxWidth: "100%",
|
|
35267
35298
|
overflow: "hidden",
|
|
35268
|
-
transition: `width ${animationDuration}ms cubic-bezier(0.32, 0.72, 0, 1)`,
|
|
35269
35299
|
willChange: "width",
|
|
35270
35300
|
boxSizing: "border-box"
|
|
35271
35301
|
},
|
|
@@ -35273,10 +35303,12 @@ var Drawer = forwardRef(function Drawer2({
|
|
|
35273
35303
|
"div",
|
|
35274
35304
|
{
|
|
35275
35305
|
style: {
|
|
35276
|
-
|
|
35306
|
+
position: "absolute",
|
|
35307
|
+
top: 0,
|
|
35308
|
+
right: 0,
|
|
35309
|
+
bottom: 0,
|
|
35310
|
+
width: targetWidth,
|
|
35277
35311
|
maxWidth: "100%",
|
|
35278
|
-
height: "100%",
|
|
35279
|
-
marginLeft: "auto",
|
|
35280
35312
|
display: "flex",
|
|
35281
35313
|
flexDirection: "column"
|
|
35282
35314
|
},
|
|
@@ -35854,11 +35886,14 @@ var styles31 = StyleSheet.create({
|
|
|
35854
35886
|
borderColor: colors.grey700,
|
|
35855
35887
|
borderRadius: 16,
|
|
35856
35888
|
backgroundColor: colors.grey700,
|
|
35857
|
-
|
|
35858
|
-
|
|
35859
|
-
|
|
35860
|
-
|
|
35861
|
-
|
|
35889
|
+
...Platform.select({
|
|
35890
|
+
web: {
|
|
35891
|
+
boxShadow: `0 8px 18px ${colors.black}66`
|
|
35892
|
+
},
|
|
35893
|
+
default: {
|
|
35894
|
+
elevation: 12
|
|
35895
|
+
}
|
|
35896
|
+
})
|
|
35862
35897
|
},
|
|
35863
35898
|
list: {
|
|
35864
35899
|
maxHeight: MENU_MAX_HEIGHT
|