@tapcart/mobile-components 0.7.77 → 0.7.80
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/hooks/use-click-outside.d.ts +6 -0
- package/dist/components/hooks/use-click-outside.d.ts.map +1 -0
- package/dist/components/hooks/use-click-outside.js +15 -0
- package/dist/components/hooks/use-order-details.d.ts.map +1 -1
- package/dist/components/hooks/use-order-details.js +22 -8
- package/dist/components/hooks/use-outside-click.d.ts +7 -0
- package/dist/components/hooks/use-outside-click.d.ts.map +1 -0
- package/dist/components/hooks/use-outside-click.js +16 -0
- package/dist/components/hooks/use-tap.d.ts +8 -0
- package/dist/components/hooks/use-tap.d.ts.map +1 -0
- package/dist/components/hooks/use-tap.js +100 -0
- package/dist/components/ui/selectors.d.ts.map +1 -1
- package/dist/components/ui/selectors.js +2 -2
- package/dist/components/ui/virtual-grid.d.ts.map +1 -1
- package/dist/components/ui/virtual-grid.js +3 -2
- package/package.json +19 -23
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-click-outside.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-click-outside.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,wBAAgB,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAE,IAAI,CAa5F"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import React from "react"
|
|
3
|
+
export function useClickOutside(ref, callback) {
|
|
4
|
+
React.useEffect(() => {
|
|
5
|
+
const handleClickOutside = (event) => {
|
|
6
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
7
|
+
callback()
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
document.addEventListener("mousedown", handleClickOutside)
|
|
11
|
+
return () => {
|
|
12
|
+
document.removeEventListener("mousedown", handleClickOutside)
|
|
13
|
+
}
|
|
14
|
+
}, [ref, callback])
|
|
15
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-order-details.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-order-details.ts"],"names":[],"mappings":"AAKA,KAAK,oBAAoB,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAClC,CAAA;
|
|
1
|
+
{"version":3,"file":"use-order-details.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-order-details.ts"],"names":[],"mappings":"AAKA,KAAK,oBAAoB,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAClC,CAAA;AAuLD,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,IAAY,GACb,EAAE,oBAAoB,GAAG,iBAAiB,CA6C1C"}
|
|
@@ -10,7 +10,7 @@ const calculateCompareAtPrice = (variant) => {
|
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
const createPaymentMethods = () => [
|
|
13
|
-
{ details: { currency: "USD", amount:
|
|
13
|
+
{ details: { currency: "USD", amount: 10 }, type: "giftCard" },
|
|
14
14
|
];
|
|
15
15
|
const createCartLines = (product, variant, compareAtPrice) => {
|
|
16
16
|
var _a, _b;
|
|
@@ -33,14 +33,16 @@ const createCartLines = (product, variant, compareAtPrice) => {
|
|
|
33
33
|
};
|
|
34
34
|
const calculateCartPrice = (lines) => {
|
|
35
35
|
const subtotal = lines[0].price;
|
|
36
|
-
const orderLevelDiscounts = [
|
|
36
|
+
const orderLevelDiscounts = mapOrderDiscounts([
|
|
37
37
|
{
|
|
38
|
+
type: "DISCOUNT_CODE",
|
|
38
39
|
title: "APP15",
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
allocationMethod: "ACROSS",
|
|
41
|
+
targetType: "LINE_ITEM",
|
|
42
|
+
targetSelection: "ALL",
|
|
43
|
+
value: { percentage: 15 },
|
|
42
44
|
},
|
|
43
|
-
];
|
|
45
|
+
], subtotal);
|
|
44
46
|
const shippingLevelDiscounts = [
|
|
45
47
|
{
|
|
46
48
|
title: "FREESHIPPING",
|
|
@@ -55,7 +57,7 @@ const calculateCartPrice = (lines) => {
|
|
|
55
57
|
const total = {
|
|
56
58
|
amount: subtotal.amount -
|
|
57
59
|
orderLevelDiscounts[0].value.amount -
|
|
58
|
-
|
|
60
|
+
10 + // Payment method amount
|
|
59
61
|
taxes.amount,
|
|
60
62
|
currencyCode: "USD",
|
|
61
63
|
};
|
|
@@ -92,11 +94,23 @@ const mapShippingDiscount = (discounts = [], shipping) => {
|
|
|
92
94
|
} }));
|
|
93
95
|
});
|
|
94
96
|
};
|
|
97
|
+
const mapOrderDiscounts = (discounts = [], subtotal) => {
|
|
98
|
+
const mappedDiscounts = mapDiscountsByType(discounts, "LINE_ITEM");
|
|
99
|
+
return mappedDiscounts.map((discount) => {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
return (Object.assign(Object.assign({}, discount), { value: {
|
|
102
|
+
currencyCode: subtotal.currencyCode,
|
|
103
|
+
amount: ((_a = discount.value) === null || _a === void 0 ? void 0 : _a.percentage)
|
|
104
|
+
? (subtotal.amount * ((_b = discount.value) === null || _b === void 0 ? void 0 : _b.percentage)) / 100
|
|
105
|
+
: discount.value.amount,
|
|
106
|
+
} }));
|
|
107
|
+
});
|
|
108
|
+
};
|
|
95
109
|
const updateCartPriceDetails = (orderDetails, checkoutData) => {
|
|
96
110
|
var _a;
|
|
97
111
|
const newCartPrice = {
|
|
98
112
|
subtotal: checkoutData.subtotalPrice,
|
|
99
|
-
orderLevelDiscounts:
|
|
113
|
+
orderLevelDiscounts: mapOrderDiscounts(checkoutData.discountApplications, checkoutData.subtotalPrice),
|
|
100
114
|
shippingLevelDiscounts: mapShippingDiscount(checkoutData.discountApplications, orderDetails.cart.price.shipping),
|
|
101
115
|
total: checkoutData.totalPrice,
|
|
102
116
|
taxes: checkoutData.totalTax,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-outside-click.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-outside-click.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,QAAA,MAAM,eAAe,QAAS,MAAM,SAAS,CAAC,WAAW,CAAC,YAAY,MAAM,IAAI,SAa/E,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import React from "react"
|
|
3
|
+
const useClickOutside = (ref, callback) => {
|
|
4
|
+
React.useEffect(() => {
|
|
5
|
+
const handleClickOutside = (event) => {
|
|
6
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
7
|
+
callback()
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
document.addEventListener("mousedown", handleClickOutside)
|
|
11
|
+
return () => {
|
|
12
|
+
document.removeEventListener("mousedown", handleClickOutside)
|
|
13
|
+
}
|
|
14
|
+
}, [ref, callback])
|
|
15
|
+
}
|
|
16
|
+
export default useClickOutside
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-tap.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-tap.ts"],"names":[],"mappings":"AACA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAuFvE,QAAA,MAAM,MAAM;6BAuBkC,GAAG,KAAK,IAAI,aACvC,GAAG;;;CAerB,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { useState, useEffect, useCallback, useRef } from "react"
|
|
3
|
+
// Shared manager for all instances of the hook
|
|
4
|
+
const tapManager = (() => {
|
|
5
|
+
const elements = new Map()
|
|
6
|
+
let isListening = false
|
|
7
|
+
const startListening = () => {
|
|
8
|
+
if (isListening) return
|
|
9
|
+
const handleTouchStart = (e) => {
|
|
10
|
+
const touch = e.touches[0]
|
|
11
|
+
elements.forEach((data, el) => {
|
|
12
|
+
if (el.contains(touch.target)) {
|
|
13
|
+
data.touchStarted = true
|
|
14
|
+
data.touchMoved = false
|
|
15
|
+
data.startPosition = { x: touch.clientX, y: touch.clientY }
|
|
16
|
+
// Don't set isPressed here, wait to determine if it's a tap or drag
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
const handleTouchMove = (e) => {
|
|
21
|
+
const touch = e.touches[0]
|
|
22
|
+
elements.forEach((data, el) => {
|
|
23
|
+
if (data.touchStarted) {
|
|
24
|
+
const deltaX = Math.abs(touch.clientX - data.startPosition.x)
|
|
25
|
+
const deltaY = Math.abs(touch.clientY - data.startPosition.y)
|
|
26
|
+
if (deltaX > data.tapThreshold || deltaY > data.tapThreshold) {
|
|
27
|
+
data.touchMoved = true
|
|
28
|
+
data.setIsPressed(false)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
const handleTouchEnd = () => {
|
|
34
|
+
elements.forEach((data) => {
|
|
35
|
+
if (data.touchStarted) {
|
|
36
|
+
data.touchStarted = false
|
|
37
|
+
if (!data.touchMoved) {
|
|
38
|
+
// It's a tap, set isPressed briefly
|
|
39
|
+
data.setIsPressed(true)
|
|
40
|
+
setTimeout(() => data.setIsPressed(false), 100)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
document.addEventListener("touchstart", (e) => handleTouchStart(e), {
|
|
46
|
+
passive: true,
|
|
47
|
+
})
|
|
48
|
+
document.addEventListener("touchmove", (e) => handleTouchMove(e), {
|
|
49
|
+
passive: true,
|
|
50
|
+
})
|
|
51
|
+
document.addEventListener("touchend", () => handleTouchEnd(), {
|
|
52
|
+
passive: true,
|
|
53
|
+
})
|
|
54
|
+
isListening = true
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
register: (el, data) => {
|
|
58
|
+
elements.set(el, data)
|
|
59
|
+
startListening()
|
|
60
|
+
},
|
|
61
|
+
unregister: (el) => {
|
|
62
|
+
elements.delete(el)
|
|
63
|
+
},
|
|
64
|
+
elements,
|
|
65
|
+
}
|
|
66
|
+
})()
|
|
67
|
+
const useTap = (tapThreshold = 10) => {
|
|
68
|
+
const [isPressed, setIsPressed] = useState(false)
|
|
69
|
+
const elementRef = useRef(null)
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
const element = elementRef.current
|
|
72
|
+
if (!element) return
|
|
73
|
+
const data = {
|
|
74
|
+
touchStarted: false,
|
|
75
|
+
touchMoved: false,
|
|
76
|
+
startPosition: { x: 0, y: 0 },
|
|
77
|
+
setIsPressed,
|
|
78
|
+
tapThreshold,
|
|
79
|
+
}
|
|
80
|
+
tapManager.register(element, data)
|
|
81
|
+
return () => {
|
|
82
|
+
tapManager.unregister(element)
|
|
83
|
+
}
|
|
84
|
+
}, [tapThreshold])
|
|
85
|
+
const onTap = useCallback((handler) => {
|
|
86
|
+
return (event) => {
|
|
87
|
+
const data = tapManager.elements.get(elementRef.current)
|
|
88
|
+
if (!data) return
|
|
89
|
+
if (event.type === "touchend" && !data.touchMoved) {
|
|
90
|
+
handler(event)
|
|
91
|
+
} else if (event.type === "click" && !data.touchStarted) {
|
|
92
|
+
handler(event)
|
|
93
|
+
setIsPressed(true)
|
|
94
|
+
setTimeout(() => setIsPressed(false), 100)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}, [])
|
|
98
|
+
return { onTap, isPressed, ref: elementRef }
|
|
99
|
+
}
|
|
100
|
+
export { useTap }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../components/ui/selectors.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMjE,QAAA,MAAM,iBAAiB;;;mFAiBtB,CAAA;AACD,KAAK,cAAc,GAAG,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,GAC5D,YAAY,CAAC,OAAO,iBAAiB,CAAC,GAAG;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAA;CAClE,CAAA;AAEH,QAAA,MAAM,SAAS;;;;;;;;;eAHA,MAAM,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,SAAS;2CA6CpE,CAAA;AACD,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,EACJ,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,GACpC,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,CAAA;IACtC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;IAC7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EAAE,iBAAiB,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -42,7 +42,7 @@ const Selectors = React.forwardRef((_a, ref) => {
|
|
|
42
42
|
disabled,
|
|
43
43
|
}), "group", className), ref: mergedRef }, props, { children: children ? (children) : (_jsx(Text, Object.assign({ type: "body-primary", color: "text-textColors-primaryColor" }, { children: label }))) })));
|
|
44
44
|
});
|
|
45
|
-
const SelectorContainer = ({ children, containerRef, className, height
|
|
45
|
+
const SelectorContainer = ({ children, containerRef, className, height, }) => {
|
|
46
46
|
const [showFadeLeft, setShowFadeLeft] = React.useState(false);
|
|
47
47
|
const [showFadeRight, setShowFadeRight] = React.useState(false);
|
|
48
48
|
const checkOverflow = () => {
|
|
@@ -59,7 +59,7 @@ const SelectorContainer = ({ children, containerRef, className, height = "42px",
|
|
|
59
59
|
React.useEffect(() => {
|
|
60
60
|
checkOverflow();
|
|
61
61
|
}, [children]);
|
|
62
|
-
return (_jsx("div", Object.assign({ className: "relative no-scrollbar" }, { children: _jsxs("div", Object.assign({ className: cn(`flex gap-2 px-1 items-center
|
|
62
|
+
return (_jsx("div", Object.assign({ className: "relative no-scrollbar" }, { children: _jsxs("div", Object.assign({ className: cn(`flex gap-2 px-1 items-center no-scrollbar`, className), onScroll: checkOverflow, style: { maxHeight: height }, ref: containerRef }, { children: [children, showFadeLeft && (_jsx("div", { className: "absolute top-0 left-0 w-8 h-full pointer-events-none bg-fade-left" })), showFadeRight && (_jsx("div", { className: "absolute top-0 right-0 w-8 h-full pointer-events-none bg-fade-right" }))] })) })));
|
|
63
63
|
};
|
|
64
64
|
Selectors.displayName = "Selectors";
|
|
65
65
|
export { SelectorContainer, Selectors, selectorsVariants };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-grid.d.ts","sourceRoot":"","sources":["../../../components/ui/virtual-grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,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R,QAAY,EACZ,eAAqB,EACrB,aAAa,EACb,aAAa,EACb,UAAU,GACX,EAAE,gBAAgB,2CA6DlB;AAED,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -43,9 +43,10 @@ function VirtualGrid({ className, columns, children, overscan = 4, estimatedHeig
|
|
|
43
43
|
transform: `translateY(${virtualRow.start}px)`,
|
|
44
44
|
}, ref: virtualRow.measureRef }, { children: Array.from({ length: col }).map((_, colIndex) => {
|
|
45
45
|
const index = rowStartIndex + colIndex;
|
|
46
|
-
if (
|
|
47
|
-
!childrenArray[index])
|
|
46
|
+
if (index >= childrenArray.length && !isReachingEnd)
|
|
48
47
|
return (_jsx("div", { children: _jsx(LoaderItem, {}) }, index));
|
|
48
|
+
if (!childrenArray[index])
|
|
49
|
+
return null;
|
|
49
50
|
return _jsx("div", { children: childrenArray[index] }, index);
|
|
50
51
|
}) }), `row-${virtualRow.index}`));
|
|
51
52
|
}) })));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapcart/mobile-components",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.80",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"style": "dist/styles.css",
|
|
@@ -11,20 +11,6 @@
|
|
|
11
11
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
12
12
|
"author": "Tapcart Inc.",
|
|
13
13
|
"homepage": "https://tapcart.com",
|
|
14
|
-
"scripts": {
|
|
15
|
-
"clean": "rm -rf dist node_modules",
|
|
16
|
-
"lint": "eslint \"**/*.ts*\"",
|
|
17
|
-
"ui:add": "pnpm dlx shadcn-ui@latest add",
|
|
18
|
-
"build:styles": "postcss styles/globals.css -o dist/styles.css",
|
|
19
|
-
"build:ts": "tsc -p tsconfig.json && tsc-alias",
|
|
20
|
-
"build": "pnpm run build:ts && pnpm run build:styles",
|
|
21
|
-
"dev:ts": "tsc -w -p tsconfig.json",
|
|
22
|
-
"dev:styles": "npx tailwindcss -i styles/globals.css -o dist/styles.css --watch",
|
|
23
|
-
"dev": "concurrently \"pnpm run dev:ts\" \"pnpm run dev:styles\"",
|
|
24
|
-
"test": "jest",
|
|
25
|
-
"test:silent": "jest --silent",
|
|
26
|
-
"test:watch": "jest --watch"
|
|
27
|
-
},
|
|
28
14
|
"peerDependencies": {
|
|
29
15
|
"react": "^17.0.2 || ^18.0.0",
|
|
30
16
|
"react-dom": "^17.0.2 || ^18.0.0"
|
|
@@ -37,20 +23,20 @@
|
|
|
37
23
|
"@types/pluralize": "^0.0.33",
|
|
38
24
|
"@types/react": "^18.2.0",
|
|
39
25
|
"@types/react-dom": "^18.2.0",
|
|
40
|
-
"app-studio-types": "workspace:*",
|
|
41
26
|
"autoprefixer": "^10.4.14",
|
|
42
27
|
"chokidar-cli": "^3.0.0",
|
|
43
28
|
"concurrently": "^8.2.2",
|
|
44
29
|
"eslint": "^7.32.0",
|
|
45
|
-
"eslint-config-custom": "workspace:*",
|
|
46
30
|
"jest": "^29.7.0",
|
|
47
31
|
"jest-environment-jsdom": "^29.7.0",
|
|
48
32
|
"postcss": "^8.4.24",
|
|
49
33
|
"tailwindcss": "^3.3.2",
|
|
50
34
|
"ts-jest": "^29.2.5",
|
|
51
35
|
"tsc-alias": "^1.8.10",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
36
|
+
"typescript": "^4.5.2",
|
|
37
|
+
"app-studio-types": "0.0.9",
|
|
38
|
+
"eslint-config-custom": "0.0.0",
|
|
39
|
+
"tsconfig": "0.0.0"
|
|
54
40
|
},
|
|
55
41
|
"dependencies": {
|
|
56
42
|
"@radix-ui/react-accordion": "^1.1.2",
|
|
@@ -91,8 +77,18 @@
|
|
|
91
77
|
"tailwindcss-animate": "^1.0.6",
|
|
92
78
|
"vaul": "0.9.1"
|
|
93
79
|
},
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
80
|
+
"scripts": {
|
|
81
|
+
"clean": "rm -rf dist node_modules",
|
|
82
|
+
"lint": "eslint \"**/*.ts*\"",
|
|
83
|
+
"ui:add": "pnpm dlx shadcn-ui@latest add",
|
|
84
|
+
"build:styles": "postcss styles/globals.css -o dist/styles.css",
|
|
85
|
+
"build:ts": "tsc -p tsconfig.json && tsc-alias",
|
|
86
|
+
"build": "pnpm run build:ts && pnpm run build:styles",
|
|
87
|
+
"dev:ts": "tsc -w -p tsconfig.json",
|
|
88
|
+
"dev:styles": "npx tailwindcss -i styles/globals.css -o dist/styles.css --watch",
|
|
89
|
+
"dev": "concurrently \"pnpm run dev:ts\" \"pnpm run dev:styles\"",
|
|
90
|
+
"test": "jest",
|
|
91
|
+
"test:silent": "jest --silent",
|
|
92
|
+
"test:watch": "jest --watch"
|
|
97
93
|
}
|
|
98
|
-
}
|
|
94
|
+
}
|