@tapcart/mobile-components 0.7.86 → 0.7.88
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/components/ui/animate-container.d.ts +9 -3
- package/dist/components/ui/animate-container.d.ts.map +1 -1
- package/dist/components/ui/animate-container.js +23 -10
- package/dist/components/ui/quantity-picker.d.ts.map +1 -1
- package/dist/components/ui/quantity-picker.js +3 -1
- package/dist/components/ui/radio-group.js +3 -3
- package/dist/styles.css +20 -2
- package/package.json +1 -1
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
type AnimationType = "
|
|
2
|
+
type AnimationType = "slide" | "fade";
|
|
3
|
+
interface AnimationConfig {
|
|
4
|
+
enter: string;
|
|
5
|
+
exit: string;
|
|
6
|
+
isHeight: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const Animations: Record<AnimationType, AnimationConfig>;
|
|
3
9
|
interface AnimateContainerProps {
|
|
4
10
|
children: React.ReactNode;
|
|
5
|
-
|
|
11
|
+
animations: AnimationConfig[];
|
|
6
12
|
duration?: number;
|
|
7
13
|
className?: string;
|
|
8
14
|
isLoading?: boolean;
|
|
9
15
|
hasData?: boolean;
|
|
10
16
|
}
|
|
11
|
-
export declare function AnimateContainer({ children,
|
|
17
|
+
export declare function AnimateContainer({ children, animations, duration, className, isLoading, hasData, }: AnimateContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
12
18
|
export declare function SlideUp(props: Omit<AnimateContainerProps, "type">): import("react/jsx-runtime").JSX.Element;
|
|
13
19
|
export {};
|
|
14
20
|
//# sourceMappingURL=animate-container.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animate-container.d.ts","sourceRoot":"","sources":["../../../components/ui/animate-container.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAG1D,KAAK,aAAa,GAAG,
|
|
1
|
+
{"version":3,"file":"animate-container.d.ts","sourceRoot":"","sources":["../../../components/ui/animate-container.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAG1D,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAA;AAErC,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,aAAa,EAAE,eAAe,CAW7D,CAAA;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,EAAE,eAAe,EAAE,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,UAAU,EACV,QAAc,EACd,SAAS,EACT,SAAS,EACT,OAAO,GACR,EAAE,qBAAqB,2CAyCvB;AAGD,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,2CAEjE"}
|
|
@@ -2,31 +2,44 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useEffect, useRef } from "react";
|
|
4
4
|
import { cn } from "../../lib/utils";
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
export const Animations = {
|
|
6
|
+
slide: {
|
|
7
7
|
enter: "animate-slide-down",
|
|
8
8
|
exit: "animate-slide-up",
|
|
9
9
|
isHeight: true,
|
|
10
10
|
},
|
|
11
|
+
fade: {
|
|
12
|
+
enter: "animate-fadeIn",
|
|
13
|
+
exit: "animate-fadeOut",
|
|
14
|
+
isHeight: false,
|
|
15
|
+
},
|
|
11
16
|
};
|
|
12
|
-
export function AnimateContainer({ children,
|
|
17
|
+
export function AnimateContainer({ children, animations, duration = 300, className, isLoading, hasData, }) {
|
|
13
18
|
const contentRef = useRef(null);
|
|
14
|
-
const
|
|
15
|
-
const [prevData, setPrevData] = useState(hasData);
|
|
19
|
+
const [prevData, setPrevData] = useState(hasData !== null && hasData !== void 0 ? hasData : false);
|
|
16
20
|
const [shouldAnimate, setShouldAnimate] = useState(false);
|
|
17
21
|
useEffect(() => {
|
|
18
|
-
if (contentRef.current &&
|
|
22
|
+
if (contentRef.current &&
|
|
23
|
+
(animations === null || animations === void 0 ? void 0 : animations.some((animation) => animation.isHeight))) {
|
|
19
24
|
contentRef.current.style.setProperty("--content-height", `${contentRef.current.scrollHeight}px`);
|
|
20
25
|
}
|
|
21
26
|
if (isLoading)
|
|
22
27
|
return;
|
|
23
28
|
if (prevData !== hasData) {
|
|
24
29
|
setShouldAnimate(true);
|
|
25
|
-
setPrevData(hasData);
|
|
30
|
+
setPrevData(hasData !== null && hasData !== void 0 ? hasData : false);
|
|
26
31
|
}
|
|
27
|
-
}, [hasData, isLoading,
|
|
28
|
-
|
|
32
|
+
}, [hasData, isLoading, animations, prevData]);
|
|
33
|
+
const getAnimationClasses = () => {
|
|
34
|
+
if (!shouldAnimate)
|
|
35
|
+
return "";
|
|
36
|
+
return animations
|
|
37
|
+
.map((animation) => (hasData ? animation.enter : animation.exit))
|
|
38
|
+
.join(" ");
|
|
39
|
+
};
|
|
40
|
+
return (_jsx("div", Object.assign({ ref: contentRef, className: cn("overflow-hidden", getAnimationClasses(), className), style: { animationDuration: `${duration}ms` } }, { children: children })));
|
|
29
41
|
}
|
|
42
|
+
// TO REMOVE
|
|
30
43
|
export function SlideUp(props) {
|
|
31
|
-
return _jsx(AnimateContainer, Object.assign({}, props, {
|
|
44
|
+
return _jsx(AnimateContainer, Object.assign({}, props, { animations: [Animations.slide] }));
|
|
32
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quantity-picker.d.ts","sourceRoot":"","sources":["../../../components/ui/quantity-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,MAAM,WAAW,mBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5C,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAChC,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAmCD,QAAA,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"quantity-picker.d.ts","sourceRoot":"","sources":["../../../components/ui/quantity-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,MAAM,WAAW,mBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5C,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAChC,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAmCD,QAAA,MAAM,cAAc,4FA4GnB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -43,7 +43,9 @@ const QuantityPicker = React.forwardRef((_a, ref) => {
|
|
|
43
43
|
}, onFocus: (e) => {
|
|
44
44
|
setIsFocused(true);
|
|
45
45
|
setLocalValue(value);
|
|
46
|
-
}, onChange: (e) => setLocalValue(Math.min(parseInt(e.target.value), max)), className: "w-8 h-7 focus-visible:outline-none text-center bg-coreColors-inputBackground text-textColors-primaryColor border-t border-b border-coreColors-dividingLines", style:
|
|
46
|
+
}, onChange: (e) => setLocalValue(Math.min(parseInt(e.target.value), max)), className: "w-8 h-7 focus-visible:outline-none text-center bg-coreColors-inputBackground text-textColors-primaryColor border-t border-b border-coreColors-dividingLines", style: Object.assign(Object.assign({}, inputStyle), { borderRadius: (inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.borderRadius)
|
|
47
|
+
? `${inputStyle.borderRadius}px`
|
|
48
|
+
: 0 }), inputMode: "numeric" }), _jsx(IconButton, { handler: onIncreaseClick, iconUrl: increaseIconUrl, iconColor: iconColor, style: rightButtonStyle, disabled: isIncreaseDisabled || loading })] })), _jsx(LoadingDots, { show: loading, size: 1, iconColor: iconColor })] })));
|
|
47
49
|
});
|
|
48
50
|
QuantityPicker.displayName = "QuantityPicker";
|
|
49
51
|
export { QuantityPicker };
|
|
@@ -24,7 +24,7 @@ const RadioGroup = React.forwardRef((_a, ref) => {
|
|
|
24
24
|
return (_jsx(RadioGroupPrimitive.Root, Object.assign({ className: cn("grid gap-4", className) }, props, { ref: ref })));
|
|
25
25
|
});
|
|
26
26
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
27
|
-
const radiogroupItemVariants = cva("grid grid-cols-[auto,auto,1fr] gap-2 items-
|
|
27
|
+
const radiogroupItemVariants = cva("grid grid-cols-[auto,auto,1fr] gap-2 items-center group", {
|
|
28
28
|
variants: {
|
|
29
29
|
variant: {
|
|
30
30
|
default: "",
|
|
@@ -36,12 +36,12 @@ const radiogroupItemVariants = cva("grid grid-cols-[auto,auto,1fr] gap-2 items-s
|
|
|
36
36
|
variant: "default",
|
|
37
37
|
},
|
|
38
38
|
});
|
|
39
|
-
const RadioGroupItemLabels = ({ key, label, numberAmount, subtext, }) => (_jsxs("div", Object.assign({ className: "col-span-2" }, { children: [_jsxs("div", Object.assign({ className: "flex flex-row items-
|
|
39
|
+
const RadioGroupItemLabels = ({ key, label, numberAmount, subtext, }) => (_jsxs("div", Object.assign({ className: "col-span-2" }, { children: [_jsxs("div", Object.assign({ className: "flex flex-row items-center" }, { children: [_jsx(Text, Object.assign({ type: "body-primary", className: "group-disabled:text-stateColors-disabled mr-2" }, { children: label })), numberAmount ? (_jsx(Text, Object.assign({ type: "body-primary", className: "text-textColors-secondaryColor group-disabled:text-stateColors-disabled" }, { children: `(${numberAmount})` }))) : null] })), subtext ? (_jsx(Text, Object.assign({ type: "body-secondary", className: "group-disabled:text-stateColors-disabled mt-1" }, { children: subtext }))) : null] })));
|
|
40
40
|
const RadioGroupItem = React.forwardRef((_a, ref) => {
|
|
41
41
|
var { value, label = "", subtext, numberAmount = 0, onSelect = () => { }, onClick = () => { }, selected = false, className, variant = "default", key } = _a, props = __rest(_a, ["value", "label", "subtext", "numberAmount", "onSelect", "onClick", "selected", "className", "variant", "key"]);
|
|
42
42
|
const { onTap, ref: tapRef } = useTap();
|
|
43
43
|
const mergedRef = useMergeRefs(ref, tapRef);
|
|
44
|
-
return (_jsx("div", Object.assign({ className: cn(radiogroupItemVariants({ variant }), className) }, { children: variant === "deactivated" ? (_jsxs(_Fragment, { children: [_jsx(Icon, { name: "circle-off", size: "md", className: "text-stateColors-disabled" }), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext }, key)] })) : (_jsx(RadioGroupPrimitive.Item, Object.assign({ ref: mergedRef, value: value, onSelect: onSelect, checked: selected, onClick: onTap(onClick), className: cn("flex items-center justify-center active:opacity-70", className) }, props, { children: selected || variant === "selected" ? (_jsxs("div", Object.assign({ className: "grid grid-cols-[auto,auto,1fr] gap-2 items-
|
|
44
|
+
return (_jsx("div", Object.assign({ className: cn(radiogroupItemVariants({ variant }), className) }, { children: variant === "deactivated" ? (_jsxs(_Fragment, { children: [_jsx(Icon, { name: "circle-off", size: "md", className: "text-stateColors-disabled" }), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext }, key)] })) : (_jsx(RadioGroupPrimitive.Item, Object.assign({ ref: mergedRef, value: value, onSelect: onSelect, checked: selected, onClick: onTap(onClick), className: cn("flex items-center justify-center active:opacity-70", className) }, props, { children: selected || variant === "selected" ? (_jsxs("div", Object.assign({ className: "grid grid-cols-[auto,auto,1fr] gap-2 items-center group" }, { children: [_jsx(Icon, { name: "circle-dot-filled", size: "md", className: "text-coreColors-brandColorPrimary z-10" }), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext }, key)] }))) : (_jsxs("div", Object.assign({ className: "grid grid-cols-[auto,auto,1fr] gap-2 items-center group" }, { children: [_jsxs("div", Object.assign({ className: "grid" }, { children: [_jsx(RadioGroupPrimitive.Indicator, Object.assign({ className: "flex items-center justify-center col-start-1 row-start-1" }, { children: _jsx(Icon, { name: "circle-dot-filled", size: "md", className: "text-coreColors-brandColorPrimary z-10" }) })), _jsx("div", Object.assign({ className: "flex items-center justify-center col-start-1 row-start-1" }, { children: _jsx(Icon, { name: "circle", size: "md", className: "col-start-1 row-start-1 text-coreColors-secondaryIcon items-center z-1" }) }))] })), _jsx(RadioGroupItemLabels, { label: label, numberAmount: numberAmount, subtext: subtext }, key)] }))) }))) })));
|
|
45
45
|
});
|
|
46
46
|
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
47
47
|
export { RadioGroup, RadioGroupItem, radiogroupItemVariants };
|
package/dist/styles.css
CHANGED
|
@@ -902,6 +902,12 @@ video {
|
|
|
902
902
|
-webkit-box-orient: vertical;
|
|
903
903
|
-webkit-line-clamp: 2;
|
|
904
904
|
}
|
|
905
|
+
.line-clamp-3 {
|
|
906
|
+
overflow: hidden;
|
|
907
|
+
display: -webkit-box;
|
|
908
|
+
-webkit-box-orient: vertical;
|
|
909
|
+
-webkit-line-clamp: 3;
|
|
910
|
+
}
|
|
905
911
|
.block {
|
|
906
912
|
display: block;
|
|
907
913
|
}
|
|
@@ -1224,6 +1230,12 @@ video {
|
|
|
1224
1230
|
.animate-bounce {
|
|
1225
1231
|
animation: bounce 1s infinite;
|
|
1226
1232
|
}
|
|
1233
|
+
.animate-fadeIn {
|
|
1234
|
+
animation: fadeIn .3s ease-in-out;
|
|
1235
|
+
}
|
|
1236
|
+
.animate-fadeOut {
|
|
1237
|
+
animation: fadeOut .3s ease-in-out;
|
|
1238
|
+
}
|
|
1227
1239
|
@keyframes pulse {
|
|
1228
1240
|
|
|
1229
1241
|
50% {
|
|
@@ -1244,7 +1256,7 @@ video {
|
|
|
1244
1256
|
}
|
|
1245
1257
|
}
|
|
1246
1258
|
.animate-slide-down {
|
|
1247
|
-
animation: slide-down 0.
|
|
1259
|
+
animation: slide-down 0.3s ease-in-out;
|
|
1248
1260
|
}
|
|
1249
1261
|
@keyframes slide-up {
|
|
1250
1262
|
|
|
@@ -1257,7 +1269,7 @@ video {
|
|
|
1257
1269
|
}
|
|
1258
1270
|
}
|
|
1259
1271
|
.animate-slide-up {
|
|
1260
|
-
animation: slide-up 0.
|
|
1272
|
+
animation: slide-up 0.3s ease-in-out;
|
|
1261
1273
|
}
|
|
1262
1274
|
@keyframes spin {
|
|
1263
1275
|
|
|
@@ -1475,6 +1487,9 @@ video {
|
|
|
1475
1487
|
.rounded-full {
|
|
1476
1488
|
border-radius: 9999px;
|
|
1477
1489
|
}
|
|
1490
|
+
.rounded-lg {
|
|
1491
|
+
border-radius: var(--radius);
|
|
1492
|
+
}
|
|
1478
1493
|
.rounded-md {
|
|
1479
1494
|
border-radius: calc(var(--radius) - 2px);
|
|
1480
1495
|
}
|
|
@@ -2214,6 +2229,9 @@ video {
|
|
|
2214
2229
|
transform: translate3d(var(--tw-exit-translate-x, 0), var(--tw-exit-translate-y, 0), 0) scale3d(var(--tw-exit-scale, 1), var(--tw-exit-scale, 1), var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0));
|
|
2215
2230
|
}
|
|
2216
2231
|
}
|
|
2232
|
+
.fade-in {
|
|
2233
|
+
--tw-enter-opacity: 0;
|
|
2234
|
+
}
|
|
2217
2235
|
.duration-150 {
|
|
2218
2236
|
animation-duration: 150ms;
|
|
2219
2237
|
}
|