@usevyre/react 1.2.0 → 1.3.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/dist/components/Layout/Layout.d.ts +184 -0
- package/dist/components/Sidebar/Sidebar.d.ts +10 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1660 -1462
- package/dist/styles/components.css +316 -59
- package/package.json +1 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @usevyre/react — Layout primitives (Stack, Grid, GridItem, Box)
|
|
3
|
+
*
|
|
4
|
+
* AI CONTEXT:
|
|
5
|
+
* ┌──────────────────────────────────────────────────────────────────┐
|
|
6
|
+
* │ Components: Stack, Grid, GridItem, Box │
|
|
7
|
+
* │ Import: import { Stack, Grid, GridItem, Box } from "@usevyre/react"│
|
|
8
|
+
* │ │
|
|
9
|
+
* │ USE THESE INSTEAD OF <div style={{ display: "flex" }}>. │
|
|
10
|
+
* │ Every spacing value is a design token — never a raw px/rem number.│
|
|
11
|
+
* │ │
|
|
12
|
+
* │ Stack/Grid/Box share width/height (avoids inline width style): │
|
|
13
|
+
* │ width|height = "auto"|"full"|"fit"|"screen" │
|
|
14
|
+
* │ | xs|sm|md|lg|xl|2xl (fixed rem sizes) │
|
|
15
|
+
* │ │
|
|
16
|
+
* │ <Stack> full one-dimensional flex layout │
|
|
17
|
+
* │ direction = "row"(default)|"column"|"row-reverse" │
|
|
18
|
+
* │ |"column-reverse" │
|
|
19
|
+
* │ inline = boolean (display:inline-flex) │
|
|
20
|
+
* │ gap = token; rowGap / columnGap = token (per-axis) │
|
|
21
|
+
* │ align = items: start|center|end|stretch|baseline │
|
|
22
|
+
* │ justify = content: start|center|end|between|around|evenly │
|
|
23
|
+
* │ alignContent= multi-line: start|center|end|stretch|between │
|
|
24
|
+
* │ |around|evenly │
|
|
25
|
+
* │ alignSelf = auto|start|center|end|stretch|baseline │
|
|
26
|
+
* │ wrap = "nowrap"(default)|"wrap"|"wrap-reverse" │
|
|
27
|
+
* │ grow shrink = number basis = token|"auto"|"content"|"0" │
|
|
28
|
+
* │ as = any HTML tag (default: "div") │
|
|
29
|
+
* │ │
|
|
30
|
+
* │ <Grid> two-dimensional CSS grid │
|
|
31
|
+
* │ columns = number (1-12) | "auto-fit" (default: 1) │
|
|
32
|
+
* │ rows = number | "auto" │
|
|
33
|
+
* │ flow = "row"|"column"|"dense"|"row-dense"|"column-dense" │
|
|
34
|
+
* │ gap / rowGap / columnGap = token │
|
|
35
|
+
* │ align = align-items justify = justify-items │
|
|
36
|
+
* │ as = any HTML tag (default: "div") │
|
|
37
|
+
* │ <GridItem> child placement │
|
|
38
|
+
* │ colSpan rowSpan colStart rowStart = number │
|
|
39
|
+
* │ │
|
|
40
|
+
* │ <Box> spacing-only container + controlled escape hatch │
|
|
41
|
+
* │ padding paddingX paddingY │
|
|
42
|
+
* │ paddingTop paddingRight paddingBottom paddingLeft = token │
|
|
43
|
+
* │ margin marginX marginY │
|
|
44
|
+
* │ marginTop marginRight marginBottom marginLeft = token │
|
|
45
|
+
* │ (per-side overrides the X/Y/shorthand it belongs to) │
|
|
46
|
+
* │ as = any HTML tag (default: "div") │
|
|
47
|
+
* │ style = ANTI-PATTERN escape hatch — prefer tokens. │
|
|
48
|
+
* │ │
|
|
49
|
+
* │ All render a plain <div> (or `as`) in the browser. │
|
|
50
|
+
* └──────────────────────────────────────────────────────────────────┘
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* <Stack direction="column" gap="md" align="center">
|
|
54
|
+
* <Avatar src={user.avatar} />
|
|
55
|
+
* <Text>{user.name}</Text>
|
|
56
|
+
* </Stack>
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* <Grid columns={3} gap="lg">
|
|
60
|
+
* <GridItem colSpan={2}><Card>Wide</Card></GridItem>
|
|
61
|
+
* <Card>…</Card>
|
|
62
|
+
* </Grid>
|
|
63
|
+
*/
|
|
64
|
+
import React from "react";
|
|
65
|
+
/** Semantic spacing scale — maps to --vyre-spacing-* tokens. */
|
|
66
|
+
export type SpaceToken = "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
67
|
+
export type StackDirection = "row" | "column" | "row-reverse" | "column-reverse";
|
|
68
|
+
export type StackWrap = "nowrap" | "wrap" | "wrap-reverse";
|
|
69
|
+
export type StackAlign = "start" | "center" | "end" | "stretch" | "baseline";
|
|
70
|
+
export type StackJustify = "start" | "center" | "end" | "between" | "around" | "evenly";
|
|
71
|
+
export type StackAlignContent = "start" | "center" | "end" | "stretch" | "between" | "around" | "evenly";
|
|
72
|
+
export type StackAlignSelf = "auto" | "start" | "center" | "end" | "stretch" | "baseline";
|
|
73
|
+
export type StackBasis = SpaceToken | "auto" | "content" | "0";
|
|
74
|
+
export type GridAlign = "start" | "center" | "end" | "stretch";
|
|
75
|
+
export type GridFlow = "row" | "column" | "dense" | "row-dense" | "column-dense";
|
|
76
|
+
export type GridColumns = number | "auto-fit";
|
|
77
|
+
/**
|
|
78
|
+
* Sizing scale for width / height.
|
|
79
|
+
* - Keywords: "auto" | "full" (100%) | "fit" (fit-content) | "screen"
|
|
80
|
+
* (100vw for width, 100vh for height)
|
|
81
|
+
* - Token sizes (fixed rem): xs 8 · sm 12 · md 16 · lg 24 · xl 32 · 2xl 42
|
|
82
|
+
*/
|
|
83
|
+
export type SizeToken = "auto" | "full" | "fit" | "screen" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
84
|
+
interface SizingProps {
|
|
85
|
+
/** Width — keyword or token size. Avoids an inline width style. */
|
|
86
|
+
width?: SizeToken;
|
|
87
|
+
/** Height — keyword or token size. Avoids an inline height style. */
|
|
88
|
+
height?: SizeToken;
|
|
89
|
+
}
|
|
90
|
+
type PolymorphicProps<P> = P & {
|
|
91
|
+
/** HTML element to render. Always a real DOM element in the browser. */
|
|
92
|
+
as?: keyof JSX.IntrinsicElements;
|
|
93
|
+
className?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Inline styles. Prefer the token props above; use this only for values
|
|
96
|
+
* the design system genuinely cannot express. Flagged as an anti-pattern
|
|
97
|
+
* by @usevyre/eslint-plugin (no-inline-layout-styles).
|
|
98
|
+
*/
|
|
99
|
+
style?: React.CSSProperties;
|
|
100
|
+
children?: React.ReactNode;
|
|
101
|
+
};
|
|
102
|
+
export interface StackProps extends PolymorphicProps<React.HTMLAttributes<HTMLElement>>, SizingProps {
|
|
103
|
+
/** Main axis direction (flex-direction) */
|
|
104
|
+
direction?: StackDirection;
|
|
105
|
+
/** Render as inline-flex instead of flex */
|
|
106
|
+
inline?: boolean;
|
|
107
|
+
/** Space between children — design token */
|
|
108
|
+
gap?: SpaceToken;
|
|
109
|
+
/** Row gap override — design token */
|
|
110
|
+
rowGap?: SpaceToken;
|
|
111
|
+
/** Column gap override — design token */
|
|
112
|
+
columnGap?: SpaceToken;
|
|
113
|
+
/** Cross-axis alignment of items (align-items) */
|
|
114
|
+
align?: StackAlign;
|
|
115
|
+
/** Main-axis distribution (justify-content) */
|
|
116
|
+
justify?: StackJustify;
|
|
117
|
+
/** Multi-line cross-axis distribution (align-content) */
|
|
118
|
+
alignContent?: StackAlignContent;
|
|
119
|
+
/** This element's own cross-axis alignment (align-self) */
|
|
120
|
+
alignSelf?: StackAlignSelf;
|
|
121
|
+
/** Wrapping behaviour (flex-wrap). `true` is treated as "wrap". */
|
|
122
|
+
wrap?: StackWrap | boolean;
|
|
123
|
+
/** flex-grow */
|
|
124
|
+
grow?: number;
|
|
125
|
+
/** flex-shrink */
|
|
126
|
+
shrink?: number;
|
|
127
|
+
/** flex-basis — token, "auto", "content", or "0" */
|
|
128
|
+
basis?: StackBasis;
|
|
129
|
+
}
|
|
130
|
+
export declare const Stack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<HTMLElement>>;
|
|
131
|
+
export interface GridProps extends PolymorphicProps<React.HTMLAttributes<HTMLElement>>, SizingProps {
|
|
132
|
+
/** Number of equal columns (1–12) or responsive "auto-fit" */
|
|
133
|
+
columns?: GridColumns;
|
|
134
|
+
/** Explicit row count, or "auto" */
|
|
135
|
+
rows?: number | "auto";
|
|
136
|
+
/** Auto-placement flow (grid-auto-flow) */
|
|
137
|
+
flow?: GridFlow;
|
|
138
|
+
/** Space between cells — design token */
|
|
139
|
+
gap?: SpaceToken;
|
|
140
|
+
/** Row gap override — design token */
|
|
141
|
+
rowGap?: SpaceToken;
|
|
142
|
+
/** Column gap override — design token */
|
|
143
|
+
columnGap?: SpaceToken;
|
|
144
|
+
/** Cross-axis alignment of cells (align-items) */
|
|
145
|
+
align?: GridAlign;
|
|
146
|
+
/** Inline-axis alignment of cells (justify-items) */
|
|
147
|
+
justify?: GridAlign;
|
|
148
|
+
}
|
|
149
|
+
export declare const Grid: React.ForwardRefExoticComponent<GridProps & React.RefAttributes<HTMLElement>>;
|
|
150
|
+
export interface GridItemProps extends PolymorphicProps<React.HTMLAttributes<HTMLElement>> {
|
|
151
|
+
/** Number of columns this item spans */
|
|
152
|
+
colSpan?: number;
|
|
153
|
+
/** Number of rows this item spans */
|
|
154
|
+
rowSpan?: number;
|
|
155
|
+
/** 1-based column line this item starts at */
|
|
156
|
+
colStart?: number;
|
|
157
|
+
/** 1-based row line this item starts at */
|
|
158
|
+
rowStart?: number;
|
|
159
|
+
}
|
|
160
|
+
export declare const GridItem: React.ForwardRefExoticComponent<GridItemProps & React.RefAttributes<HTMLElement>>;
|
|
161
|
+
export interface BoxProps extends PolymorphicProps<React.HTMLAttributes<HTMLElement>>, SizingProps {
|
|
162
|
+
/** Inner spacing (all sides) — design token */
|
|
163
|
+
padding?: SpaceToken;
|
|
164
|
+
/** Inner spacing left+right — design token */
|
|
165
|
+
paddingX?: SpaceToken;
|
|
166
|
+
/** Inner spacing top+bottom — design token */
|
|
167
|
+
paddingY?: SpaceToken;
|
|
168
|
+
paddingTop?: SpaceToken;
|
|
169
|
+
paddingRight?: SpaceToken;
|
|
170
|
+
paddingBottom?: SpaceToken;
|
|
171
|
+
paddingLeft?: SpaceToken;
|
|
172
|
+
/** Outer spacing (all sides) — design token */
|
|
173
|
+
margin?: SpaceToken;
|
|
174
|
+
/** Outer spacing left+right — design token */
|
|
175
|
+
marginX?: SpaceToken;
|
|
176
|
+
/** Outer spacing top+bottom — design token */
|
|
177
|
+
marginY?: SpaceToken;
|
|
178
|
+
marginTop?: SpaceToken;
|
|
179
|
+
marginRight?: SpaceToken;
|
|
180
|
+
marginBottom?: SpaceToken;
|
|
181
|
+
marginLeft?: SpaceToken;
|
|
182
|
+
}
|
|
183
|
+
export declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<HTMLElement>>;
|
|
184
|
+
export {};
|
|
@@ -38,6 +38,12 @@
|
|
|
38
38
|
* │ badge = string | number │
|
|
39
39
|
* │ href = string │
|
|
40
40
|
* │ onClick = () => void │
|
|
41
|
+
* │ │
|
|
42
|
+
* │ SidebarTrigger props (all optional): │
|
|
43
|
+
* │ icon = ReactNode (shown when expanded; │
|
|
44
|
+
* │ default = built-in menu icon) │
|
|
45
|
+
* │ collapsedIcon = ReactNode (shown when collapsed; │
|
|
46
|
+
* │ falls back to icon) │
|
|
41
47
|
* └──────────────────────────────────────────────────────────────┘
|
|
42
48
|
*
|
|
43
49
|
* @example
|
|
@@ -130,6 +136,10 @@ export interface AppBarProps {
|
|
|
130
136
|
export declare const AppBar: React.ForwardRefExoticComponent<AppBarProps & React.RefAttributes<HTMLElement>>;
|
|
131
137
|
export interface SidebarTriggerProps {
|
|
132
138
|
className?: string;
|
|
139
|
+
/** Icon shown when the sidebar is expanded. Defaults to the built-in menu icon. */
|
|
140
|
+
icon?: React.ReactNode;
|
|
141
|
+
/** Icon shown when the sidebar is collapsed. Falls back to `icon`, then the built-in icon. */
|
|
142
|
+
collapsedIcon?: React.ReactNode;
|
|
133
143
|
}
|
|
134
144
|
export declare const SidebarTrigger: React.FC<SidebarTriggerProps>;
|
|
135
145
|
export interface PageContentProps {
|