@psnext/design-system 1.0.0 → 1.1.0
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/README.md +30 -124
- package/dist/Stack.cjs +64 -0
- package/dist/Stack.cjs.map +1 -0
- package/dist/Stack.js +54 -0
- package/dist/Stack.js.map +1 -0
- package/dist/ThemeProvider.cjs +1886 -0
- package/dist/ThemeProvider.cjs.map +1 -0
- package/dist/ThemeProvider.d.cts +85 -0
- package/dist/ThemeProvider.d.cts.map +1 -0
- package/dist/ThemeProvider.d.ts +85 -0
- package/dist/ThemeProvider.d.ts.map +1 -0
- package/dist/ThemeProvider.js +1508 -0
- package/dist/ThemeProvider.js.map +1 -0
- package/dist/contexts/index.cjs +0 -60
- package/dist/contexts/index.d.cts +1 -23
- package/dist/contexts/index.d.ts +1 -23
- package/dist/contexts/index.js +1 -58
- package/dist/index.cjs +147 -72
- package/dist/index.d.cts +1009 -432
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1014 -437
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -7
- package/dist/index2.d.cts +4 -16
- package/dist/index2.d.ts +4 -16
- package/dist/layouts/index.cjs +100 -12
- package/dist/layouts/index.cjs.map +1 -0
- package/dist/layouts/index.d.cts +70 -127
- package/dist/layouts/index.d.cts.map +1 -1
- package/dist/layouts/index.d.ts +70 -127
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +92 -2
- package/dist/layouts/index.js.map +1 -0
- package/dist/patterns/index.cjs +1004 -7254
- package/dist/patterns/index.cjs.map +1 -1
- package/dist/patterns/index.d.cts +381 -389
- package/dist/patterns/index.d.cts.map +1 -1
- package/dist/patterns/index.d.ts +378 -386
- package/dist/patterns/index.d.ts.map +1 -1
- package/dist/patterns/index.js +970 -7225
- package/dist/patterns/index.js.map +1 -1
- package/dist/primitives/index.cjs +135 -55
- package/dist/primitives/index.d.cts +3 -2
- package/dist/primitives/index.d.ts +3 -2
- package/dist/primitives/index.js +3 -5
- package/dist/primitives.cjs +3961 -1274
- package/dist/primitives.cjs.map +1 -1
- package/dist/primitives.js +3551 -1001
- package/dist/primitives.js.map +1 -1
- package/dist/styles/base.css +43 -0
- package/dist/styles/glass.css +75 -0
- package/dist/styles/index.css +43 -23
- package/dist/styles/semantic.css +107 -0
- package/dist/styles/theme.css +42 -24
- package/dist/styles/tokens/alpha.css +39 -0
- package/dist/styles/tokens/border-radius.css +17 -0
- package/dist/styles/tokens/chart-colors-dark.css +18 -0
- package/dist/styles/tokens/chart-colors-light.css +18 -0
- package/dist/styles/tokens/colors.css +251 -0
- package/dist/styles/tokens/mode-dark.css +101 -0
- package/dist/styles/tokens/mode-light.css +101 -0
- package/dist/styles/tokens/shadows.css +14 -0
- package/dist/styles/tokens/spacing.css +44 -0
- package/dist/styles/tokens/theme-bodhi.css +35 -0
- package/dist/styles/tokens/theme-slingshot.css +35 -0
- package/dist/styles/tokens/theme-sustain.css +35 -0
- package/dist/styles/tokens/typography.css +83 -0
- package/dist/utils.cjs +67 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.js +27 -0
- package/dist/utils.js.map +1 -0
- package/package.json +15 -41
- package/dist/AiChatPanel.cjs +0 -1603
- package/dist/AiChatPanel.cjs.map +0 -1
- package/dist/AiChatPanel.js +0 -1526
- package/dist/AiChatPanel.js.map +0 -1
- package/dist/BodhiLogo.cjs +0 -240
- package/dist/BodhiLogo.cjs.map +0 -1
- package/dist/BodhiLogo.js +0 -194
- package/dist/BodhiLogo.js.map +0 -1
- package/dist/Skeleton.cjs +0 -19
- package/dist/Skeleton.cjs.map +0 -1
- package/dist/Skeleton.js +0 -14
- package/dist/Skeleton.js.map +0 -1
- package/dist/SustainLogo.cjs +0 -415
- package/dist/SustainLogo.cjs.map +0 -1
- package/dist/SustainLogo.js +0 -378
- package/dist/SustainLogo.js.map +0 -1
- package/dist/contexts/index.cjs.map +0 -1
- package/dist/contexts/index.d.cts.map +0 -1
- package/dist/contexts/index.d.ts.map +0 -1
- package/dist/contexts/index.js.map +0 -1
- package/dist/index2.d.cts.map +0 -1
- package/dist/index2.d.ts.map +0 -1
- package/dist/layouts.cjs +0 -3245
- package/dist/layouts.cjs.map +0 -1
- package/dist/layouts.js +0 -3180
- package/dist/layouts.js.map +0 -1
- package/dist/styles/base/colors.css +0 -300
- package/dist/styles/base/component-tokens.css +0 -240
- package/dist/styles/base/elevation.css +0 -7
- package/dist/styles/base/fonts.css +0 -14
- package/dist/styles/base/global.css +0 -305
- package/dist/styles/base/radius.css +0 -22
- package/dist/styles/base/semantic-aliases.css +0 -53
- package/dist/styles/base/spacing.css +0 -33
- package/dist/styles/base/typography.css +0 -48
- package/dist/styles/generated/bodhi-vars.css +0 -34
- package/dist/styles/generated/dark.css +0 -87
- package/dist/styles/generated/light.css +0 -87
- package/dist/styles/generated/slingshot-vars.css +0 -34
- package/dist/styles/generated/sustain-vars.css +0 -34
- package/dist/styles/themes/bodhi.css +0 -166
- package/dist/styles/themes/slingshot.css +0 -144
- package/dist/styles/themes/sustain.css +0 -130
package/README.md
CHANGED
|
@@ -1,126 +1,32 @@
|
|
|
1
1
|
# @psnext/design-system
|
|
2
2
|
|
|
3
|
-
The
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
> **Note:** Patterns are **not** re-exported from the root barrel (the
|
|
36
|
-
> `AlertDialog` pattern would clash with the `AlertDialog` primitive). Always
|
|
37
|
-
> import patterns via `@psnext/design-system/patterns`.
|
|
38
|
-
|
|
39
|
-
## Styling & theming
|
|
40
|
-
|
|
41
|
-
Components are authored with Tailwind v4 utility classes that resolve to the
|
|
42
|
-
design-system's CSS-variable tokens via a `@theme` bridge. A consuming app must:
|
|
43
|
-
|
|
44
|
-
1. **Run Tailwind v4** and include the design system as a `@source` so its
|
|
45
|
-
utility classes are generated.
|
|
46
|
-
2. **Import the token CSS + the `@theme` bridge**, then a brand theme.
|
|
47
|
-
3. **Load the brand fonts** (Outfit / Inter / Geist Mono) via a `<link>` in your
|
|
48
|
-
HTML `<head>` — see below.
|
|
49
|
-
|
|
50
|
-
```css
|
|
51
|
-
/* app.css */
|
|
52
|
-
@import "tailwindcss";
|
|
53
|
-
@import "@psnext/design-system/styles"; /* tokens: base + light/dark */
|
|
54
|
-
@import "@psnext/design-system/styles/theme"; /* @theme bridge (tokens → utilities) */
|
|
55
|
-
@import "@psnext/design-system/styles/themes/slingshot"; /* brand theme */
|
|
56
|
-
|
|
57
|
-
@source "../node_modules/@psnext/design-system"; /* scan compiled component classes */
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Fonts (required)
|
|
61
|
-
|
|
62
|
-
The font *tokens* (`--font-heading: "Outfit"`, `--font-body: "Inter"`,
|
|
63
|
-
`--font-mono: "Geist Mono"`) ship in the CSS, but the actual font files must be
|
|
64
|
-
loaded by **your app's HTML** — a CSS `@import` for them is dropped once bundled
|
|
65
|
-
after Tailwind, so the components would silently fall back to the system font.
|
|
66
|
-
Add to your `<head>`:
|
|
67
|
-
|
|
68
|
-
```html
|
|
69
|
-
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
70
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
71
|
-
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&family=Inter:wght@100..900&display=swap" />
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
> Only **Outfit** and **Inter** are loaded — matching the source design. The
|
|
75
|
-
> `--font-mono` token names Geist Mono but it is not loaded by default, so
|
|
76
|
-
> monospace text falls back to the system monospace font. To use Geist Mono,
|
|
77
|
-
> add `&family=Geist+Mono:wght@100..900` to the link above.
|
|
78
|
-
|
|
79
|
-
### Available style entry points
|
|
80
|
-
|
|
81
|
-
| Import | Contents |
|
|
82
|
-
|---|---|
|
|
83
|
-
| `…/styles` | Token vars (base + light/dark), the main entry |
|
|
84
|
-
| `…/styles/theme` | Tailwind `@theme inline` bridge (maps tokens → `bg-primary`, etc.) |
|
|
85
|
-
| `…/styles/themes/slingshot` | Slingshot brand theme |
|
|
86
|
-
| `…/styles/themes/bodhi` | Bodhi brand theme |
|
|
87
|
-
| `…/styles/themes/sustain` | Sustain brand theme |
|
|
88
|
-
| `…/styles/generated/light` · `…/dark` | Raw generated token blocks |
|
|
89
|
-
|
|
90
|
-
Light/dark is driven by an `html.dark` class; brand themes apply a
|
|
91
|
-
`.theme-*` class — see [docs/architecture.md](../../docs/architecture.md).
|
|
92
|
-
|
|
93
|
-
## Components
|
|
94
|
-
|
|
95
|
-
**Primitives** (atoms/molecules — Radix/shadcn): Accordion, Alert, AlertDialog,
|
|
96
|
-
AspectRatio, Avatar, Badge, Breadcrumb, Button, Calendar, Card, Carousel, Chart,
|
|
97
|
-
Checkbox, Collapsible, Command, ContextMenu, Dialog, Drawer, DropdownMenu, Form,
|
|
98
|
-
HoverCard, Input, InputOtp, Label, Menubar, NavigationMenu, Pagination, Popover,
|
|
99
|
-
Progress, RadioGroup, Resizable, ScrollArea, Select, Separator, Sheet, Sidebar,
|
|
100
|
-
Skeleton, Slider, Sonner, Switch, Table, Tabs, Textarea, Toggle, ToggleGroup,
|
|
101
|
-
Tooltip — plus the brand **logos** (BodhiLogo, PsaiLogo, SlingshotLogo,
|
|
102
|
-
SustainLogo) and **icons** (BodhiIcon, SlingshotIcon, SustainIcon), which are
|
|
103
|
-
also primitives.
|
|
104
|
-
|
|
105
|
-
**Patterns** (organisms): AccountProjectSwitcher, AddContextDrawer,
|
|
106
|
-
AddNewRoleDrawer, AiChatPanel, AlertDialog, CategorySection, IconButton,
|
|
107
|
-
InfoBanner, InviteUsersDrawer, ProductSwitcher, ProjectBulkUploadDrawer,
|
|
108
|
-
ResourceTile, RichCheckboxGroup, TabGroup, ViewEditUserDrawer.
|
|
109
|
-
|
|
110
|
-
**Layouts** (page chrome): AnimatedBackground, BodhiHeader, Header,
|
|
111
|
-
LeftNavigation, Logo, MobileGate, PsaiHeader, RightSidebar, SlingshotHeader,
|
|
112
|
-
SustainHeader.
|
|
113
|
-
|
|
114
|
-
Browse them interactively in Storybook (`pnpm storybook:dev` from the repo root).
|
|
115
|
-
|
|
116
|
-
## Local development
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
pnpm --filter @psnext/design-system dev # tsdown watch build
|
|
120
|
-
pnpm --filter @psnext/design-system tokens:build # regenerate token CSS
|
|
121
|
-
pnpm --filter @psnext/design-system test # vitest
|
|
122
|
-
pnpm --filter @psnext/design-system build # tokens + bundle
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
See [CONTRIBUTING.md](../../CONTRIBUTING.md) for the component-authoring
|
|
126
|
-
convention.
|
|
3
|
+
The design system, **rebuilt from scratch**. This package keeps the original
|
|
4
|
+
build/test/token infrastructure but starts with an empty `src/` — components are
|
|
5
|
+
being re-authored one at a time.
|
|
6
|
+
|
|
7
|
+
The previous implementation lives in `packages/design-system-old` (package
|
|
8
|
+
`@psnext/design-system-old`). It is **not** built, published, or consumed — it is
|
|
9
|
+
kept only as a reference catalog: its source and the committed VR baselines in
|
|
10
|
+
`apps/storybook/vr/__screenshots__/` are the checklist of what to rebuild.
|
|
11
|
+
|
|
12
|
+
## Status / known gaps
|
|
13
|
+
|
|
14
|
+
- `src/` contains only empty barrels (`primitives`, `patterns`, `layouts`,
|
|
15
|
+
`contexts`) plus the Vitest setup. No components yet.
|
|
16
|
+
- **Styles are a minimal Tailwind v4 starting point.** `src/styles/index.css`
|
|
17
|
+
is just `@import "tailwindcss";` and `src/styles/theme.css` is an empty
|
|
18
|
+
`@theme {}` block, shipped to `dist/styles` by `styles:copy` and exported as
|
|
19
|
+
`@psnext/design-system/styles` and `/styles/theme`. The token plan is TBD.
|
|
20
|
+
Brand themes are not defined yet, so the consuming apps (`storybook`,
|
|
21
|
+
`prototype`) will not fully render until that layer is built.
|
|
22
|
+
|
|
23
|
+
## Rebuild workflow
|
|
24
|
+
|
|
25
|
+
1. Add a component folder under the appropriate layer
|
|
26
|
+
(`src/primitives/Button/Button.tsx` + `.stories.tsx` + `.test.tsx` +
|
|
27
|
+
`index.ts`) and re-export it from that layer's barrel.
|
|
28
|
+
2. **Reuse the original Storybook story titles/ids** so VR baselines map 1:1.
|
|
29
|
+
3. `pnpm vr:coverage` — lists which baseline stories still have no story in the
|
|
30
|
+
new build (your "what's left to rebuild" list).
|
|
31
|
+
4. `pnpm vr` to diff against baselines; `pnpm vr:update` to bless a component
|
|
32
|
+
once it's intentionally final.
|
package/dist/Stack.cjs
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const require_utils = require("./utils.cjs");
|
|
2
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
3
|
+
//#region src/layouts/Stack/Stack.tsx
|
|
4
|
+
const stackVariants = (0, require("class-variance-authority").cva)("flex", {
|
|
5
|
+
variants: {
|
|
6
|
+
direction: {
|
|
7
|
+
vertical: "flex-col",
|
|
8
|
+
horizontal: "flex-row"
|
|
9
|
+
},
|
|
10
|
+
gap: {
|
|
11
|
+
none: "gap-0",
|
|
12
|
+
xs: "gap-2",
|
|
13
|
+
sm: "gap-3",
|
|
14
|
+
md: "gap-4",
|
|
15
|
+
lg: "gap-6",
|
|
16
|
+
xl: "gap-8",
|
|
17
|
+
"2xl": "gap-12"
|
|
18
|
+
},
|
|
19
|
+
align: {
|
|
20
|
+
start: "items-start",
|
|
21
|
+
center: "items-center",
|
|
22
|
+
end: "items-end",
|
|
23
|
+
stretch: "items-stretch"
|
|
24
|
+
},
|
|
25
|
+
justify: {
|
|
26
|
+
start: "justify-start",
|
|
27
|
+
center: "justify-center",
|
|
28
|
+
between: "justify-between",
|
|
29
|
+
end: "justify-end"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
direction: "vertical",
|
|
34
|
+
gap: "md",
|
|
35
|
+
align: "stretch"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
function Stack({ as, className, direction, gap, align, justify, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(as ?? "div", {
|
|
40
|
+
"data-slot": "stack",
|
|
41
|
+
className: require_utils.cn(stackVariants({
|
|
42
|
+
direction,
|
|
43
|
+
gap,
|
|
44
|
+
align,
|
|
45
|
+
justify
|
|
46
|
+
}), className),
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
Object.defineProperty(exports, "Stack", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function() {
|
|
54
|
+
return Stack;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(exports, "stackVariants", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function() {
|
|
60
|
+
return stackVariants;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=Stack.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stack.cjs","names":["cn"],"sources":["../src/layouts/Stack/Stack.tsx"],"sourcesContent":["import { type VariantProps, cva } from \"class-variance-authority\";\nimport type * as React from \"react\";\n\nimport { cn } from \"@/utils\";\n\n// Stack — flex layout with token-spaced gaps. Vertical by default (single\n// column); set `direction=\"horizontal\"` for a row.\nconst stackVariants = cva(\"flex\", {\n variants: {\n direction: {\n vertical: \"flex-col\",\n horizontal: \"flex-row\",\n },\n gap: {\n none: \"gap-0\",\n xs: \"gap-2\",\n sm: \"gap-3\",\n md: \"gap-4\",\n lg: \"gap-6\",\n xl: \"gap-8\",\n \"2xl\": \"gap-12\",\n },\n align: {\n start: \"items-start\",\n center: \"items-center\",\n end: \"items-end\",\n stretch: \"items-stretch\",\n },\n justify: {\n start: \"justify-start\",\n center: \"justify-center\",\n between: \"justify-between\",\n end: \"justify-end\",\n },\n },\n defaultVariants: {\n direction: \"vertical\",\n gap: \"md\",\n align: \"stretch\",\n },\n});\n\ntype StackProps = React.ComponentProps<\"div\"> &\n VariantProps<typeof stackVariants> & {\n as?: React.ElementType;\n };\n\nfunction Stack({ as, className, direction, gap, align, justify, ...props }: StackProps) {\n const Comp = as ?? \"div\";\n return (\n <Comp\n data-slot=\"stack\"\n className={cn(stackVariants({ direction, gap, align, justify }), className)}\n {...props}\n />\n );\n}\n\nexport { Stack, stackVariants, type StackProps };\n"],"mappings":";;;AAOA,MAAM,iBAAA,qCAAA,EAAA,KAAoB,QAAQ;CAChC,UAAU;EACR,WAAW;GACT,UAAU;GACV,YAAY;EACd;EACA,KAAK;GACH,MAAM;GACN,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,OAAO;EACT;EACA,OAAO;GACL,OAAO;GACP,QAAQ;GACR,KAAK;GACL,SAAS;EACX;EACA,SAAS;GACP,OAAO;GACP,QAAQ;GACR,SAAS;GACT,KAAK;EACP;CACF;CACA,iBAAiB;EACf,WAAW;EACX,KAAK;EACL,OAAO;CACT;AACF,CAAC;AAOD,SAAS,MAAM,EAAE,IAAI,WAAW,WAAW,KAAK,OAAO,SAAS,GAAG,SAAqB;CAEtF,OACE,iBAAA,GAAA,kBAAA,KAFW,MAAM,OAEjB;EACE,aAAU;EACV,WAAWA,cAAAA,GAAG,cAAc;GAAE;GAAW;GAAK;GAAO;EAAQ,CAAC,GAAG,SAAS;EAC1E,GAAI;CACL,CAAA;AAEL"}
|
package/dist/Stack.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { n as cn } from "./utils.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
//#region src/layouts/Stack/Stack.tsx
|
|
5
|
+
const stackVariants = cva("flex", {
|
|
6
|
+
variants: {
|
|
7
|
+
direction: {
|
|
8
|
+
vertical: "flex-col",
|
|
9
|
+
horizontal: "flex-row"
|
|
10
|
+
},
|
|
11
|
+
gap: {
|
|
12
|
+
none: "gap-0",
|
|
13
|
+
xs: "gap-2",
|
|
14
|
+
sm: "gap-3",
|
|
15
|
+
md: "gap-4",
|
|
16
|
+
lg: "gap-6",
|
|
17
|
+
xl: "gap-8",
|
|
18
|
+
"2xl": "gap-12"
|
|
19
|
+
},
|
|
20
|
+
align: {
|
|
21
|
+
start: "items-start",
|
|
22
|
+
center: "items-center",
|
|
23
|
+
end: "items-end",
|
|
24
|
+
stretch: "items-stretch"
|
|
25
|
+
},
|
|
26
|
+
justify: {
|
|
27
|
+
start: "justify-start",
|
|
28
|
+
center: "justify-center",
|
|
29
|
+
between: "justify-between",
|
|
30
|
+
end: "justify-end"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
defaultVariants: {
|
|
34
|
+
direction: "vertical",
|
|
35
|
+
gap: "md",
|
|
36
|
+
align: "stretch"
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
function Stack({ as, className, direction, gap, align, justify, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx(as ?? "div", {
|
|
41
|
+
"data-slot": "stack",
|
|
42
|
+
className: cn(stackVariants({
|
|
43
|
+
direction,
|
|
44
|
+
gap,
|
|
45
|
+
align,
|
|
46
|
+
justify
|
|
47
|
+
}), className),
|
|
48
|
+
...props
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { stackVariants as n, Stack as t };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=Stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stack.js","names":[],"sources":["../src/layouts/Stack/Stack.tsx"],"sourcesContent":["import { type VariantProps, cva } from \"class-variance-authority\";\nimport type * as React from \"react\";\n\nimport { cn } from \"@/utils\";\n\n// Stack — flex layout with token-spaced gaps. Vertical by default (single\n// column); set `direction=\"horizontal\"` for a row.\nconst stackVariants = cva(\"flex\", {\n variants: {\n direction: {\n vertical: \"flex-col\",\n horizontal: \"flex-row\",\n },\n gap: {\n none: \"gap-0\",\n xs: \"gap-2\",\n sm: \"gap-3\",\n md: \"gap-4\",\n lg: \"gap-6\",\n xl: \"gap-8\",\n \"2xl\": \"gap-12\",\n },\n align: {\n start: \"items-start\",\n center: \"items-center\",\n end: \"items-end\",\n stretch: \"items-stretch\",\n },\n justify: {\n start: \"justify-start\",\n center: \"justify-center\",\n between: \"justify-between\",\n end: \"justify-end\",\n },\n },\n defaultVariants: {\n direction: \"vertical\",\n gap: \"md\",\n align: \"stretch\",\n },\n});\n\ntype StackProps = React.ComponentProps<\"div\"> &\n VariantProps<typeof stackVariants> & {\n as?: React.ElementType;\n };\n\nfunction Stack({ as, className, direction, gap, align, justify, ...props }: StackProps) {\n const Comp = as ?? \"div\";\n return (\n <Comp\n data-slot=\"stack\"\n className={cn(stackVariants({ direction, gap, align, justify }), className)}\n {...props}\n />\n );\n}\n\nexport { Stack, stackVariants, type StackProps };\n"],"mappings":";;;;AAOA,MAAM,gBAAgB,IAAI,QAAQ;CAChC,UAAU;EACR,WAAW;GACT,UAAU;GACV,YAAY;EACd;EACA,KAAK;GACH,MAAM;GACN,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,OAAO;EACT;EACA,OAAO;GACL,OAAO;GACP,QAAQ;GACR,KAAK;GACL,SAAS;EACX;EACA,SAAS;GACP,OAAO;GACP,QAAQ;GACR,SAAS;GACT,KAAK;EACP;CACF;CACA,iBAAiB;EACf,WAAW;EACX,KAAK;EACL,OAAO;CACT;AACF,CAAC;AAOD,SAAS,MAAM,EAAE,IAAI,WAAW,WAAW,KAAK,OAAO,SAAS,GAAG,SAAqB;CAEtF,OACE,oBAFW,MAAM,OAEjB;EACE,aAAU;EACV,WAAW,GAAG,cAAc;GAAE;GAAW;GAAK;GAAO;EAAQ,CAAC,GAAG,SAAS;EAC1E,GAAI;CACL,CAAA;AAEL"}
|