@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.d.mts
CHANGED
|
@@ -256,8 +256,11 @@ interface DraggablePanelProps {
|
|
|
256
256
|
topToolbar?: TopToolbarProps;
|
|
257
257
|
showTopToolbarInStates?: number[];
|
|
258
258
|
bottomBar?: React__default.ReactNode;
|
|
259
|
+
customSmallHeight?: number;
|
|
260
|
+
customMediumHeight?: number;
|
|
261
|
+
bottomOffset?: number;
|
|
259
262
|
}
|
|
260
|
-
declare function DraggablePanel({ children, className, state: controlledState, onStateChange, fullScreenContent, fullScreenTrigger, topToolbar, showTopToolbarInStates, bottomBar }: DraggablePanelProps): react_jsx_runtime.JSX.Element;
|
|
263
|
+
declare function DraggablePanel({ children, className, state: controlledState, onStateChange, fullScreenContent, fullScreenTrigger, topToolbar, showTopToolbarInStates, bottomBar, customSmallHeight, customMediumHeight, bottomOffset, }: DraggablePanelProps): react_jsx_runtime.JSX.Element;
|
|
261
264
|
|
|
262
265
|
type SearchBoxVariant = 'card' | 'map';
|
|
263
266
|
type SearchBoxMode = 'default' | 'scenic' | 'scenic-date';
|
package/dist/index.d.ts
CHANGED
|
@@ -256,8 +256,11 @@ interface DraggablePanelProps {
|
|
|
256
256
|
topToolbar?: TopToolbarProps;
|
|
257
257
|
showTopToolbarInStates?: number[];
|
|
258
258
|
bottomBar?: React__default.ReactNode;
|
|
259
|
+
customSmallHeight?: number;
|
|
260
|
+
customMediumHeight?: number;
|
|
261
|
+
bottomOffset?: number;
|
|
259
262
|
}
|
|
260
|
-
declare function DraggablePanel({ children, className, state: controlledState, onStateChange, fullScreenContent, fullScreenTrigger, topToolbar, showTopToolbarInStates, bottomBar }: DraggablePanelProps): react_jsx_runtime.JSX.Element;
|
|
263
|
+
declare function DraggablePanel({ children, className, state: controlledState, onStateChange, fullScreenContent, fullScreenTrigger, topToolbar, showTopToolbarInStates, bottomBar, customSmallHeight, customMediumHeight, bottomOffset, }: DraggablePanelProps): react_jsx_runtime.JSX.Element;
|
|
261
264
|
|
|
262
265
|
type SearchBoxVariant = 'card' | 'map';
|
|
263
266
|
type SearchBoxMode = 'default' | 'scenic' | 'scenic-date';
|
package/dist/index.js
CHANGED
|
@@ -122,7 +122,7 @@ function Btn({
|
|
|
122
122
|
type: "button",
|
|
123
123
|
onClick,
|
|
124
124
|
className: cn(
|
|
125
|
-
"group relative flex items-center justify-center max-w-[300px] transition-all outline-none",
|
|
125
|
+
"group relative flex items-center justify-center max-w-[300px] mx-auto transition-all outline-none",
|
|
126
126
|
config.height,
|
|
127
127
|
config.radius,
|
|
128
128
|
paddingClass,
|
|
@@ -400,7 +400,8 @@ function StatGrid({ items, className }) {
|
|
|
400
400
|
accent: "text-accent",
|
|
401
401
|
default: "text-foreground"
|
|
402
402
|
};
|
|
403
|
-
|
|
403
|
+
const colsClass = items.length <= 2 ? "grid-cols-2" : items.length === 3 ? "grid-cols-3" : "grid-cols-4";
|
|
404
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("grid gap-[var(--spacing-sm)]", colsClass, className), children: items.map((item, idx) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-card-muted rounded-[16px] p-[var(--spacing-sm)] text-center", children: [
|
|
404
405
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("mb-1 font-medium text-lg", variantStyles[item.variant || "default"]), children: item.value }),
|
|
405
406
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground", children: item.label })
|
|
406
407
|
] }, idx)) });
|
|
@@ -1609,7 +1610,7 @@ function BottomSheet({
|
|
|
1609
1610
|
animate: { opacity: 1 },
|
|
1610
1611
|
exit: { opacity: 0 },
|
|
1611
1612
|
transition: { duration: 0.3 },
|
|
1612
|
-
className: `${positionClass} inset-0 bg-black/60 z-
|
|
1613
|
+
className: `${positionClass} inset-0 bg-black/60 z-[1100]`,
|
|
1613
1614
|
onClick: () => onOpenChange(false)
|
|
1614
1615
|
}
|
|
1615
1616
|
),
|
|
@@ -1621,7 +1622,7 @@ function BottomSheet({
|
|
|
1621
1622
|
exit: { y: "100%" },
|
|
1622
1623
|
transition: { type: "spring", damping: 25, stiffness: 300 },
|
|
1623
1624
|
className: cn(
|
|
1624
|
-
`${positionClass} bottom-0 left-0 right-0 z-
|
|
1625
|
+
`${positionClass} bottom-0 left-0 right-0 z-[1100] bg-white rounded-t-[32px] overflow-hidden shadow-xl max-h-[90vh] flex flex-col`,
|
|
1625
1626
|
className
|
|
1626
1627
|
),
|
|
1627
1628
|
children: [
|
|
@@ -1761,7 +1762,10 @@ function DraggablePanel({
|
|
|
1761
1762
|
fullScreenTrigger,
|
|
1762
1763
|
topToolbar,
|
|
1763
1764
|
showTopToolbarInStates,
|
|
1764
|
-
bottomBar
|
|
1765
|
+
bottomBar,
|
|
1766
|
+
customSmallHeight,
|
|
1767
|
+
customMediumHeight,
|
|
1768
|
+
bottomOffset = 8
|
|
1765
1769
|
}) {
|
|
1766
1770
|
const [internalState, setInternalState] = React.useState(DRAWER_STATES.SMALL);
|
|
1767
1771
|
const [previousState, setPreviousState] = React.useState(DRAWER_STATES.MEDIUM);
|
|
@@ -1776,8 +1780,8 @@ function DraggablePanel({
|
|
|
1776
1780
|
setPreviousState(state);
|
|
1777
1781
|
setState(DRAWER_STATES.FULL);
|
|
1778
1782
|
};
|
|
1779
|
-
const smallHeight = 160;
|
|
1780
|
-
const mediumHeight = 400;
|
|
1783
|
+
const smallHeight = customSmallHeight ?? 160;
|
|
1784
|
+
const mediumHeight = customMediumHeight ?? 400;
|
|
1781
1785
|
const onDragEnd = (event, info) => {
|
|
1782
1786
|
if (state === DRAWER_STATES.FULL) return;
|
|
1783
1787
|
const offset = info.offset.y;
|
|
@@ -1811,19 +1815,20 @@ function DraggablePanel({
|
|
|
1811
1815
|
case DRAWER_STATES.MEDIUM:
|
|
1812
1816
|
return mediumHeight;
|
|
1813
1817
|
case DRAWER_STATES.LARGE:
|
|
1814
|
-
return "calc(100% -
|
|
1818
|
+
return "calc(100% - 8px)";
|
|
1815
1819
|
case DRAWER_STATES.FULL:
|
|
1816
1820
|
return "100%";
|
|
1817
1821
|
}
|
|
1818
1822
|
};
|
|
1819
1823
|
const getMargins = () => {
|
|
1820
|
-
if (state === DRAWER_STATES.FULL) return 0;
|
|
1821
|
-
|
|
1824
|
+
if (state === DRAWER_STATES.FULL) return { side: 0, bottom: 0 };
|
|
1825
|
+
if (state === DRAWER_STATES.LARGE) return { side: 0, bottom: 0 };
|
|
1826
|
+
return { side: 8, bottom: bottomOffset };
|
|
1822
1827
|
};
|
|
1823
1828
|
const isFullScreen = state === DRAWER_STATES.FULL;
|
|
1824
1829
|
const shouldShowTopToolbar = topToolbar && (!showTopToolbarInStates || showTopToolbarInStates.includes(state));
|
|
1825
1830
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1826
|
-
shouldShowTopToolbar && !isFullScreen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-[
|
|
1831
|
+
shouldShowTopToolbar && !isFullScreen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-[20px] left-0 w-full z-[1000] pointer-events-none", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1827
1832
|
TopToolbar,
|
|
1828
1833
|
{
|
|
1829
1834
|
...topToolbar,
|
|
@@ -1854,7 +1859,7 @@ function DraggablePanel({
|
|
|
1854
1859
|
height: smallHeight,
|
|
1855
1860
|
left: 8,
|
|
1856
1861
|
right: 8,
|
|
1857
|
-
bottom:
|
|
1862
|
+
bottom: bottomOffset,
|
|
1858
1863
|
borderTopLeftRadius: 32,
|
|
1859
1864
|
borderTopRightRadius: 32,
|
|
1860
1865
|
borderBottomLeftRadius: 44,
|
|
@@ -1866,9 +1871,9 @@ function DraggablePanel({
|
|
|
1866
1871
|
onTouchStart: (e) => e.stopPropagation(),
|
|
1867
1872
|
animate: {
|
|
1868
1873
|
height: getHeight(),
|
|
1869
|
-
left: getMargins(),
|
|
1870
|
-
right: getMargins(),
|
|
1871
|
-
bottom: getMargins(),
|
|
1874
|
+
left: getMargins().side,
|
|
1875
|
+
right: getMargins().side,
|
|
1876
|
+
bottom: getMargins().bottom,
|
|
1872
1877
|
top: isFullScreen ? 0 : "auto",
|
|
1873
1878
|
borderTopLeftRadius: isFullScreen ? 0 : 32,
|
|
1874
1879
|
borderTopRightRadius: isFullScreen ? 0 : 32,
|
|
@@ -1896,14 +1901,14 @@ function DraggablePanel({
|
|
|
1896
1901
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center size-full h-full relative", children: [
|
|
1897
1902
|
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("div", { className: "bg-input h-[4px] rounded-[2px] w-[36px]" }) }),
|
|
1898
1903
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(
|
|
1899
|
-
"w-full flex-1 overflow-auto relative",
|
|
1904
|
+
"w-full flex-1 min-h-0 overflow-auto relative",
|
|
1900
1905
|
// If Large state and Toolbar is visible, we need to push content down so it clears the fixed toolbar
|
|
1901
1906
|
state === DRAWER_STATES.LARGE && shouldShowTopToolbar ? "pt-12" : ""
|
|
1902
1907
|
), children: [
|
|
1903
1908
|
children,
|
|
1904
1909
|
fullScreenTrigger && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: fullScreenTrigger(goToFullScreen) })
|
|
1905
1910
|
] }),
|
|
1906
|
-
bottomBar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full shrink-0 z-20
|
|
1911
|
+
bottomBar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full shrink-0 z-20", children: bottomBar })
|
|
1907
1912
|
] })
|
|
1908
1913
|
)
|
|
1909
1914
|
]
|
|
@@ -2829,6 +2834,7 @@ function TencentMap({
|
|
|
2829
2834
|
pitch,
|
|
2830
2835
|
rotation,
|
|
2831
2836
|
viewMode: "3D",
|
|
2837
|
+
mapStyleId: "style1",
|
|
2832
2838
|
baseMap: {
|
|
2833
2839
|
type: "vector",
|
|
2834
2840
|
features
|
|
@@ -2863,6 +2869,10 @@ function TencentMap({
|
|
|
2863
2869
|
initMap();
|
|
2864
2870
|
}
|
|
2865
2871
|
return () => {
|
|
2872
|
+
if (mapInstance.current) {
|
|
2873
|
+
mapInstance.current.destroy();
|
|
2874
|
+
mapInstance.current = null;
|
|
2875
|
+
}
|
|
2866
2876
|
};
|
|
2867
2877
|
}, []);
|
|
2868
2878
|
const clearSelection = () => {
|