@lmy54321/design-system 1.1.1 → 1.1.2
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.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +27 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
- package/rules/design-system.mdc +585 -0
- package/styles/globals.css +9 -0
package/dist/index.mjs
CHANGED
|
@@ -101,7 +101,7 @@ function Btn({
|
|
|
101
101
|
type: "button",
|
|
102
102
|
onClick,
|
|
103
103
|
className: cn(
|
|
104
|
-
"group relative flex items-center justify-center max-w-[300px] transition-all outline-none",
|
|
104
|
+
"group relative flex items-center justify-center max-w-[300px] mx-auto transition-all outline-none",
|
|
105
105
|
config.height,
|
|
106
106
|
config.radius,
|
|
107
107
|
paddingClass,
|
|
@@ -379,7 +379,8 @@ function StatGrid({ items, className }) {
|
|
|
379
379
|
accent: "text-accent",
|
|
380
380
|
default: "text-foreground"
|
|
381
381
|
};
|
|
382
|
-
|
|
382
|
+
const colsClass = items.length <= 2 ? "grid-cols-2" : items.length === 3 ? "grid-cols-3" : "grid-cols-4";
|
|
383
|
+
return /* @__PURE__ */ jsx("div", { className: cn("grid gap-[var(--spacing-sm)]", colsClass, className), children: items.map((item, idx) => /* @__PURE__ */ jsxs("div", { className: "bg-card-muted rounded-[16px] p-[var(--spacing-sm)] text-center", children: [
|
|
383
384
|
/* @__PURE__ */ jsx("div", { className: cn("mb-1 font-medium text-lg", variantStyles[item.variant || "default"]), children: item.value }),
|
|
384
385
|
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: item.label })
|
|
385
386
|
] }, idx)) });
|
|
@@ -1588,7 +1589,7 @@ function BottomSheet({
|
|
|
1588
1589
|
animate: { opacity: 1 },
|
|
1589
1590
|
exit: { opacity: 0 },
|
|
1590
1591
|
transition: { duration: 0.3 },
|
|
1591
|
-
className: `${positionClass} inset-0 bg-black/60 z-
|
|
1592
|
+
className: `${positionClass} inset-0 bg-black/60 z-[1100]`,
|
|
1592
1593
|
onClick: () => onOpenChange(false)
|
|
1593
1594
|
}
|
|
1594
1595
|
),
|
|
@@ -1600,7 +1601,7 @@ function BottomSheet({
|
|
|
1600
1601
|
exit: { y: "100%" },
|
|
1601
1602
|
transition: { type: "spring", damping: 25, stiffness: 300 },
|
|
1602
1603
|
className: cn(
|
|
1603
|
-
`${positionClass} bottom-0 left-0 right-0 z-
|
|
1604
|
+
`${positionClass} bottom-0 left-0 right-0 z-[1100] bg-white rounded-t-[32px] overflow-hidden shadow-xl max-h-[90vh] flex flex-col`,
|
|
1604
1605
|
className
|
|
1605
1606
|
),
|
|
1606
1607
|
children: [
|
|
@@ -1740,7 +1741,10 @@ function DraggablePanel({
|
|
|
1740
1741
|
fullScreenTrigger,
|
|
1741
1742
|
topToolbar,
|
|
1742
1743
|
showTopToolbarInStates,
|
|
1743
|
-
bottomBar
|
|
1744
|
+
bottomBar,
|
|
1745
|
+
customSmallHeight,
|
|
1746
|
+
customMediumHeight,
|
|
1747
|
+
bottomOffset = 8
|
|
1744
1748
|
}) {
|
|
1745
1749
|
const [internalState, setInternalState] = useState(DRAWER_STATES.SMALL);
|
|
1746
1750
|
const [previousState, setPreviousState] = useState(DRAWER_STATES.MEDIUM);
|
|
@@ -1755,8 +1759,8 @@ function DraggablePanel({
|
|
|
1755
1759
|
setPreviousState(state);
|
|
1756
1760
|
setState(DRAWER_STATES.FULL);
|
|
1757
1761
|
};
|
|
1758
|
-
const smallHeight = 160;
|
|
1759
|
-
const mediumHeight = 400;
|
|
1762
|
+
const smallHeight = customSmallHeight ?? 160;
|
|
1763
|
+
const mediumHeight = customMediumHeight ?? 400;
|
|
1760
1764
|
const onDragEnd = (event, info) => {
|
|
1761
1765
|
if (state === DRAWER_STATES.FULL) return;
|
|
1762
1766
|
const offset = info.offset.y;
|
|
@@ -1790,19 +1794,20 @@ function DraggablePanel({
|
|
|
1790
1794
|
case DRAWER_STATES.MEDIUM:
|
|
1791
1795
|
return mediumHeight;
|
|
1792
1796
|
case DRAWER_STATES.LARGE:
|
|
1793
|
-
return "calc(100% -
|
|
1797
|
+
return "calc(100% - 8px)";
|
|
1794
1798
|
case DRAWER_STATES.FULL:
|
|
1795
1799
|
return "100%";
|
|
1796
1800
|
}
|
|
1797
1801
|
};
|
|
1798
1802
|
const getMargins = () => {
|
|
1799
|
-
if (state === DRAWER_STATES.FULL) return 0;
|
|
1800
|
-
|
|
1803
|
+
if (state === DRAWER_STATES.FULL) return { side: 0, bottom: 0 };
|
|
1804
|
+
if (state === DRAWER_STATES.LARGE) return { side: 0, bottom: 0 };
|
|
1805
|
+
return { side: 8, bottom: bottomOffset };
|
|
1801
1806
|
};
|
|
1802
1807
|
const isFullScreen = state === DRAWER_STATES.FULL;
|
|
1803
1808
|
const shouldShowTopToolbar = topToolbar && (!showTopToolbarInStates || showTopToolbarInStates.includes(state));
|
|
1804
1809
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1805
|
-
shouldShowTopToolbar && !isFullScreen && /* @__PURE__ */ jsx("div", { className: "absolute top-[
|
|
1810
|
+
shouldShowTopToolbar && !isFullScreen && /* @__PURE__ */ jsx("div", { className: "absolute top-[20px] left-0 w-full z-[1000] pointer-events-none", children: /* @__PURE__ */ jsx("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx(
|
|
1806
1811
|
TopToolbar,
|
|
1807
1812
|
{
|
|
1808
1813
|
...topToolbar,
|
|
@@ -1833,7 +1838,7 @@ function DraggablePanel({
|
|
|
1833
1838
|
height: smallHeight,
|
|
1834
1839
|
left: 8,
|
|
1835
1840
|
right: 8,
|
|
1836
|
-
bottom:
|
|
1841
|
+
bottom: bottomOffset,
|
|
1837
1842
|
borderTopLeftRadius: 32,
|
|
1838
1843
|
borderTopRightRadius: 32,
|
|
1839
1844
|
borderBottomLeftRadius: 44,
|
|
@@ -1845,9 +1850,9 @@ function DraggablePanel({
|
|
|
1845
1850
|
onTouchStart: (e) => e.stopPropagation(),
|
|
1846
1851
|
animate: {
|
|
1847
1852
|
height: getHeight(),
|
|
1848
|
-
left: getMargins(),
|
|
1849
|
-
right: getMargins(),
|
|
1850
|
-
bottom: getMargins(),
|
|
1853
|
+
left: getMargins().side,
|
|
1854
|
+
right: getMargins().side,
|
|
1855
|
+
bottom: getMargins().bottom,
|
|
1851
1856
|
top: isFullScreen ? 0 : "auto",
|
|
1852
1857
|
borderTopLeftRadius: isFullScreen ? 0 : 32,
|
|
1853
1858
|
borderTopRightRadius: isFullScreen ? 0 : 32,
|
|
@@ -1875,14 +1880,14 @@ function DraggablePanel({
|
|
|
1875
1880
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center size-full h-full relative", children: [
|
|
1876
1881
|
/* @__PURE__ */ jsx("div", { className: "w-full flex flex-col items-center pt-[12px] pb-[8px] cursor-grab active:cursor-grabbing touch-none shrink-0 z-10", children: /* @__PURE__ */ jsx("div", { className: "bg-input h-[4px] rounded-[2px] w-[36px]" }) }),
|
|
1877
1882
|
/* @__PURE__ */ jsxs("div", { className: cn(
|
|
1878
|
-
"w-full flex-1 overflow-auto relative",
|
|
1883
|
+
"w-full flex-1 min-h-0 overflow-auto relative",
|
|
1879
1884
|
// If Large state and Toolbar is visible, we need to push content down so it clears the fixed toolbar
|
|
1880
1885
|
state === DRAWER_STATES.LARGE && shouldShowTopToolbar ? "pt-12" : ""
|
|
1881
1886
|
), children: [
|
|
1882
1887
|
children,
|
|
1883
1888
|
fullScreenTrigger && /* @__PURE__ */ jsx("div", { className: "mt-4", children: fullScreenTrigger(goToFullScreen) })
|
|
1884
1889
|
] }),
|
|
1885
|
-
bottomBar && /* @__PURE__ */ jsx("div", { className: "w-full shrink-0 z-20
|
|
1890
|
+
bottomBar && /* @__PURE__ */ jsx("div", { className: "w-full shrink-0 z-20", children: bottomBar })
|
|
1886
1891
|
] })
|
|
1887
1892
|
)
|
|
1888
1893
|
]
|
|
@@ -2808,6 +2813,7 @@ function TencentMap({
|
|
|
2808
2813
|
pitch,
|
|
2809
2814
|
rotation,
|
|
2810
2815
|
viewMode: "3D",
|
|
2816
|
+
mapStyleId: "style1",
|
|
2811
2817
|
baseMap: {
|
|
2812
2818
|
type: "vector",
|
|
2813
2819
|
features
|
|
@@ -2842,6 +2848,10 @@ function TencentMap({
|
|
|
2842
2848
|
initMap();
|
|
2843
2849
|
}
|
|
2844
2850
|
return () => {
|
|
2851
|
+
if (mapInstance.current) {
|
|
2852
|
+
mapInstance.current.destroy();
|
|
2853
|
+
mapInstance.current = null;
|
|
2854
|
+
}
|
|
2845
2855
|
};
|
|
2846
2856
|
}, []);
|
|
2847
2857
|
const clearSelection = () => {
|