ai-design-system 0.1.30 → 0.1.31
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/components/composites/LoadingShimmer/LoadingShimmer.tsx +24 -0
- package/components/composites/LoadingShimmer/index.ts +2 -0
- package/components/composites/LoadingShimmer/interfaces.ts +4 -0
- package/components/composites/index.ts +4 -0
- package/components/features/PageLayout/PageLayout.tsx +3 -22
- package/dist/index.cjs +50 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +50 -49
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Shimmer } from "@/components/ai-elements/shimmer"
|
|
3
|
+
import { cn } from "@/lib/utils"
|
|
4
|
+
import type { LoadingShimmerProps } from "./interfaces"
|
|
5
|
+
|
|
6
|
+
export const LoadingShimmer = React.memo<LoadingShimmerProps>(({ message = "Loading...", className }) => {
|
|
7
|
+
return (
|
|
8
|
+
<div className={cn("flex h-full min-h-0 flex-1 items-center justify-center px-6 py-10", className)}>
|
|
9
|
+
<div className="w-full max-w-3xl space-y-5">
|
|
10
|
+
<Shimmer className="text-sm text-muted-foreground">{message}</Shimmer>
|
|
11
|
+
<div className="space-y-3">
|
|
12
|
+
<div className="h-10 w-1/3 animate-pulse rounded-md bg-muted/70" />
|
|
13
|
+
<div className="h-24 w-full animate-pulse rounded-xl bg-muted/60" />
|
|
14
|
+
<div className="grid gap-3 md:grid-cols-2">
|
|
15
|
+
<div className="h-36 animate-pulse rounded-xl bg-muted/55" />
|
|
16
|
+
<div className="h-36 animate-pulse rounded-xl bg-muted/55" />
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
LoadingShimmer.displayName = "LoadingShimmer"
|
|
@@ -118,6 +118,10 @@ export * from './AdjustableLayout'
|
|
|
118
118
|
export * from './PageContainer'
|
|
119
119
|
export type { PageContainerProps } from './PageContainer'
|
|
120
120
|
|
|
121
|
+
// LoadingShimmer Composite
|
|
122
|
+
export { LoadingShimmer } from './LoadingShimmer'
|
|
123
|
+
export type { LoadingShimmerProps } from './LoadingShimmer'
|
|
124
|
+
|
|
121
125
|
// StateNode Composite
|
|
122
126
|
export { StateNode } from './StateNode'
|
|
123
127
|
export type { StateNodeData } from './StateNode'
|
|
@@ -4,26 +4,11 @@ import { LayoutProvider } from "@/components/blocks/LayoutProvider"
|
|
|
4
4
|
import { SectionLayout } from "@/components/blocks/SectionLayout/SectionLayout"
|
|
5
5
|
import type { SectionLayoutSection } from "@/components/blocks/SectionLayout/interfaces"
|
|
6
6
|
import { AppHeader, type AppHeaderProps } from "@/components/composites/AppHeader"
|
|
7
|
+
import { LoadingShimmer } from "@/components/composites/LoadingShimmer"
|
|
7
8
|
import { PageContainer } from "@/components/composites/PageContainer"
|
|
8
9
|
|
|
9
10
|
function PageLayoutLoadingState({ message }: { message: string }) {
|
|
10
|
-
return
|
|
11
|
-
<div className="flex h-full min-h-0 flex-1 items-center justify-center px-6 py-10">
|
|
12
|
-
<div className="w-full max-w-3xl space-y-5">
|
|
13
|
-
<div className="inline-flex w-fit animate-pulse rounded-md bg-muted px-3 py-1 text-sm text-muted-foreground">
|
|
14
|
-
{message}
|
|
15
|
-
</div>
|
|
16
|
-
<div className="space-y-3">
|
|
17
|
-
<div className="h-10 w-1/3 animate-pulse rounded-md bg-muted/70" />
|
|
18
|
-
<div className="h-24 w-full animate-pulse rounded-xl bg-muted/60" />
|
|
19
|
-
<div className="grid gap-3 md:grid-cols-2">
|
|
20
|
-
<div className="h-36 animate-pulse rounded-xl bg-muted/55" />
|
|
21
|
-
<div className="h-36 animate-pulse rounded-xl bg-muted/55" />
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
)
|
|
11
|
+
return <LoadingShimmer message={message} />
|
|
27
12
|
}
|
|
28
13
|
|
|
29
14
|
/**
|
|
@@ -181,17 +166,13 @@ export const PageLayout = React.memo<PageLayoutProps>(
|
|
|
181
166
|
</PageContainer>
|
|
182
167
|
)
|
|
183
168
|
|
|
184
|
-
if (!sidebar) {
|
|
185
|
-
return pageContainer
|
|
186
|
-
}
|
|
187
|
-
|
|
188
169
|
return (
|
|
189
170
|
<LayoutProvider
|
|
190
171
|
defaultOpen={defaultSidebarOpen}
|
|
191
172
|
sidebarWidth={sidebarWidth}
|
|
192
173
|
sidebarWidthIcon={sidebarWidthIcon}
|
|
193
174
|
>
|
|
194
|
-
<AppSidebar {...sidebar} />
|
|
175
|
+
{sidebar ? <AppSidebar {...sidebar} /> : null}
|
|
195
176
|
{pageContainer}
|
|
196
177
|
</LayoutProvider>
|
|
197
178
|
)
|
package/dist/index.cjs
CHANGED
|
@@ -12,9 +12,9 @@ var AvatarPrimitive = require('@radix-ui/react-avatar');
|
|
|
12
12
|
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
13
13
|
var lucideReact = require('lucide-react');
|
|
14
14
|
var TabsPrimitive = require('@radix-ui/react-tabs');
|
|
15
|
+
var react$1 = require('motion/react');
|
|
15
16
|
var useStickToBottom = require('use-stick-to-bottom');
|
|
16
17
|
var CollapsiblePrimitive = require('@radix-ui/react-collapsible');
|
|
17
|
-
var react$1 = require('motion/react');
|
|
18
18
|
var shiki = require('shiki');
|
|
19
19
|
var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
20
20
|
var cmdk = require('cmdk');
|
|
@@ -1667,13 +1667,46 @@ var SectionLayout = React3__namespace.memo(
|
|
|
1667
1667
|
}
|
|
1668
1668
|
);
|
|
1669
1669
|
SectionLayout.displayName = "SectionLayout";
|
|
1670
|
-
var
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1670
|
+
var ShimmerComponent = ({
|
|
1671
|
+
children,
|
|
1672
|
+
className,
|
|
1673
|
+
duration = 2,
|
|
1674
|
+
spread = 2
|
|
1675
|
+
}) => {
|
|
1676
|
+
const dynamicSpread = React3.useMemo(
|
|
1677
|
+
() => {
|
|
1678
|
+
var _a;
|
|
1679
|
+
return ((_a = children == null ? void 0 : children.length) != null ? _a : 0) * spread;
|
|
1680
|
+
},
|
|
1681
|
+
[children, spread]
|
|
1682
|
+
);
|
|
1683
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1684
|
+
react$1.motion.p,
|
|
1685
|
+
{
|
|
1686
|
+
animate: { backgroundPosition: "0% center" },
|
|
1687
|
+
className: cn(
|
|
1688
|
+
"relative inline-block bg-size-[250%_100%,auto] bg-clip-text text-transparent",
|
|
1689
|
+
"[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",
|
|
1690
|
+
className
|
|
1691
|
+
),
|
|
1692
|
+
initial: { backgroundPosition: "100% center" },
|
|
1693
|
+
style: {
|
|
1694
|
+
"--spread": `${dynamicSpread}px`,
|
|
1695
|
+
backgroundImage: "var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"
|
|
1696
|
+
},
|
|
1697
|
+
transition: {
|
|
1698
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
1699
|
+
duration,
|
|
1700
|
+
ease: "linear"
|
|
1701
|
+
},
|
|
1702
|
+
children
|
|
1703
|
+
}
|
|
1704
|
+
);
|
|
1705
|
+
};
|
|
1706
|
+
var Shimmer = React3.memo(ShimmerComponent);
|
|
1707
|
+
var LoadingShimmer = React3__namespace.memo(({ message = "Loading...", className }) => {
|
|
1708
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex h-full min-h-0 flex-1 items-center justify-center px-6 py-10", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-3xl space-y-5", children: [
|
|
1709
|
+
/* @__PURE__ */ jsxRuntime.jsx(Shimmer, { className: "text-sm text-muted-foreground", children: message }),
|
|
1677
1710
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
1678
1711
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 w-1/3 animate-pulse rounded-md bg-muted/70" }),
|
|
1679
1712
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-24 w-full animate-pulse rounded-xl bg-muted/60" }),
|
|
@@ -1683,6 +1716,14 @@ function PageLayoutLoadingState({ message }) {
|
|
|
1683
1716
|
] })
|
|
1684
1717
|
] })
|
|
1685
1718
|
] }) });
|
|
1719
|
+
});
|
|
1720
|
+
LoadingShimmer.displayName = "LoadingShimmer";
|
|
1721
|
+
var PageContainer = React3__namespace.memo(({ children, className }) => {
|
|
1722
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SidebarInset2, { className, children });
|
|
1723
|
+
});
|
|
1724
|
+
PageContainer.displayName = "PageContainer";
|
|
1725
|
+
function PageLayoutLoadingState({ message }) {
|
|
1726
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LoadingShimmer, { message });
|
|
1686
1727
|
}
|
|
1687
1728
|
var PageLayout = React3__namespace.memo(
|
|
1688
1729
|
({
|
|
@@ -1717,9 +1758,6 @@ var PageLayout = React3__namespace.memo(
|
|
|
1717
1758
|
/* @__PURE__ */ jsxRuntime.jsx(AppHeader, __spreadValues({}, header)),
|
|
1718
1759
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `min-h-0 flex-1 overflow-x-hidden ${layoutSections ? "overflow-hidden" : "overflow-y-auto"}`, children: contentArea })
|
|
1719
1760
|
] });
|
|
1720
|
-
if (!sidebar) {
|
|
1721
|
-
return pageContainer;
|
|
1722
|
-
}
|
|
1723
1761
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1724
1762
|
LayoutProvider,
|
|
1725
1763
|
{
|
|
@@ -1727,7 +1765,7 @@ var PageLayout = React3__namespace.memo(
|
|
|
1727
1765
|
sidebarWidth,
|
|
1728
1766
|
sidebarWidthIcon,
|
|
1729
1767
|
children: [
|
|
1730
|
-
/* @__PURE__ */ jsxRuntime.jsx(AppSidebar, __spreadValues({}, sidebar)),
|
|
1768
|
+
sidebar ? /* @__PURE__ */ jsxRuntime.jsx(AppSidebar, __spreadValues({}, sidebar)) : null,
|
|
1731
1769
|
pageContainer
|
|
1732
1770
|
]
|
|
1733
1771
|
}
|
|
@@ -2015,43 +2053,6 @@ function CollapsibleContent2(_a) {
|
|
|
2015
2053
|
}, props)
|
|
2016
2054
|
);
|
|
2017
2055
|
}
|
|
2018
|
-
var ShimmerComponent = ({
|
|
2019
|
-
children,
|
|
2020
|
-
className,
|
|
2021
|
-
duration = 2,
|
|
2022
|
-
spread = 2
|
|
2023
|
-
}) => {
|
|
2024
|
-
const dynamicSpread = React3.useMemo(
|
|
2025
|
-
() => {
|
|
2026
|
-
var _a;
|
|
2027
|
-
return ((_a = children == null ? void 0 : children.length) != null ? _a : 0) * spread;
|
|
2028
|
-
},
|
|
2029
|
-
[children, spread]
|
|
2030
|
-
);
|
|
2031
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2032
|
-
react$1.motion.p,
|
|
2033
|
-
{
|
|
2034
|
-
animate: { backgroundPosition: "0% center" },
|
|
2035
|
-
className: cn(
|
|
2036
|
-
"relative inline-block bg-size-[250%_100%,auto] bg-clip-text text-transparent",
|
|
2037
|
-
"[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",
|
|
2038
|
-
className
|
|
2039
|
-
),
|
|
2040
|
-
initial: { backgroundPosition: "100% center" },
|
|
2041
|
-
style: {
|
|
2042
|
-
"--spread": `${dynamicSpread}px`,
|
|
2043
|
-
backgroundImage: "var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"
|
|
2044
|
-
},
|
|
2045
|
-
transition: {
|
|
2046
|
-
repeat: Number.POSITIVE_INFINITY,
|
|
2047
|
-
duration,
|
|
2048
|
-
ease: "linear"
|
|
2049
|
-
},
|
|
2050
|
-
children
|
|
2051
|
-
}
|
|
2052
|
-
);
|
|
2053
|
-
};
|
|
2054
|
-
var Shimmer = React3.memo(ShimmerComponent);
|
|
2055
2056
|
var PlanContext = React3.createContext(null);
|
|
2056
2057
|
var usePlan = () => {
|
|
2057
2058
|
const context = React3.useContext(PlanContext);
|