@tanishqkancharla/maui 0.0.25 → 0.0.26
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 +1 -1
- package/dist/components/Utils.d.ts +2 -11
- package/dist/components/Utils.js +5 -10
- package/dist/maui.d.ts +1 -1
- package/dist/maui.js +1 -1
- package/package.json +1 -1
- package/skills/maui/SKILL.md +2 -2
- package/skills/maui/references/apps/ai-chat.md +3 -3
- package/skills/maui/references/apps/calendar.md +2 -2
- package/skills/maui/references/apps/email-client.md +2 -2
- package/skills/maui/references/components/layout-utilities.md +3 -5
- package/skills/maui/references/tokens.md +2 -2
- package/src/apps/JsxEditor/catalog.ts +5 -16
- package/src/apps/JsxEditor/lint.test.ts +20 -0
- package/src/components/Utils.tsx +8 -24
- package/src/maui.ts +0 -1
- package/src/pages/AssistantMessagePage.tsx +1 -1
- package/src/pages/AvatarPage.tsx +1 -1
- package/src/pages/BackgroundColorTokenPage.tsx +1 -1
- package/src/pages/BadgePage.tsx +1 -1
- package/src/pages/BordersTokenPage.tsx +1 -1
- package/src/pages/ColorTokenPage.tsx +1 -1
- package/src/pages/CornerRadiusTokenPage.tsx +1 -1
- package/src/pages/CrossfadePage.tsx +1 -1
- package/src/pages/CrossfadeStudioPage.tsx +1 -1
- package/src/pages/EditorPage.tsx +1 -1
- package/src/pages/FlexTokenPage.tsx +9 -6
- package/src/pages/FocusRingTokenPage.tsx +1 -1
- package/src/pages/FuzzyStringPage.tsx +1 -1
- package/src/pages/IconsPage.tsx +1 -1
- package/src/pages/LayoutTokenPage.tsx +1 -1
- package/src/pages/LayoutUtilitiesPage.tsx +13 -12
- package/src/pages/MessageListPage.tsx +1 -1
- package/src/pages/MotionTokenPage.tsx +1 -1
- package/src/{components → pages}/Panel.tsx +1 -0
- package/src/pages/ProsePage.tsx +1 -1
- package/src/pages/ShadowTokenPage.tsx +1 -1
- package/src/pages/SidebarPage.tsx +1 -1
- package/src/pages/SizingTokenPage.tsx +1 -1
- package/src/pages/SpacingTokenPage.tsx +1 -1
- package/src/pages/TablePage.tsx +1 -1
- package/src/pages/TextPage.tsx +1 -1
- package/src/pages/TextTokenPage.tsx +1 -1
- package/src/pages/ThinkingPage.tsx +1 -1
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ Vite serves the gallery at [http://localhost:5173/](http://localhost:5173/).
|
|
|
60
60
|
|
|
61
61
|
## Package
|
|
62
62
|
|
|
63
|
-
The default package export is compiled `dist/` JavaScript and declarations. TypeScript source remains available through the `source` export condition and `maui/src`. Patterns
|
|
63
|
+
The default package export is compiled `dist/` JavaScript and declarations. TypeScript source remains available through the `source` export condition and `maui/src`. Patterns, demo apps, and the gallery `Panel` preview frame are reference implementations, not package components.
|
|
64
64
|
|
|
65
65
|
Pushes to `main` publish a new patch of `@tanishqkancharla/maui` to npm (tag `vX.Y.Z`, provenance). Add `[skip release]` to the merge commit message to skip. Manual `git tag vX.Y.Z && git push origin vX.Y.Z` still publishes when the tag matches `package.json`. The gallery deploys to [maui.tanishqkancharla.dev](https://maui.tanishqkancharla.dev) through Vercel on `main`.
|
|
66
66
|
|
|
@@ -6,24 +6,15 @@ import { type Space } from "../tokens/spacing";
|
|
|
6
6
|
export type FlexShadow = keyof typeof shadow;
|
|
7
7
|
export type FlexRadius = keyof typeof radius;
|
|
8
8
|
export type FlexBorder = true | BorderColor;
|
|
9
|
-
type PaddingProps = {
|
|
10
|
-
top?: Space;
|
|
11
|
-
left?: Space;
|
|
12
|
-
right?: Space;
|
|
13
|
-
bottom?: Space;
|
|
14
|
-
x?: Space;
|
|
15
|
-
y?: Space;
|
|
16
|
-
xy?: Space;
|
|
17
|
-
children?: React.ReactNode;
|
|
18
|
-
};
|
|
19
|
-
export declare function Padding(props: PaddingProps): React.JSX.Element;
|
|
20
9
|
type FlexProps = {
|
|
21
10
|
gap?: Space;
|
|
22
11
|
p?: Space;
|
|
23
12
|
px?: Space;
|
|
24
13
|
py?: Space;
|
|
25
14
|
pt?: Space;
|
|
15
|
+
pr?: Space;
|
|
26
16
|
pb?: Space;
|
|
17
|
+
pl?: Space;
|
|
27
18
|
padding?: Space;
|
|
28
19
|
children?: React.ReactNode;
|
|
29
20
|
alignItems?: React.CSSProperties["alignItems"];
|
package/dist/components/Utils.js
CHANGED
|
@@ -6,17 +6,8 @@ import { flex } from "../tokens/layout";
|
|
|
6
6
|
import { radius } from "../tokens/radius";
|
|
7
7
|
import { shadow } from "../tokens/shadow";
|
|
8
8
|
import { spacing } from "../tokens/spacing";
|
|
9
|
-
export function Padding(props) {
|
|
10
|
-
const className = useStyles(spacing.padding({
|
|
11
|
-
top: props.top ?? props.y ?? props.xy,
|
|
12
|
-
bottom: props.bottom ?? props.y ?? props.xy,
|
|
13
|
-
left: props.left ?? props.x ?? props.xy,
|
|
14
|
-
right: props.right ?? props.x ?? props.xy,
|
|
15
|
-
}));
|
|
16
|
-
return _jsx("div", { className: className, children: props.children });
|
|
17
|
-
}
|
|
18
9
|
export function Flex(props) {
|
|
19
|
-
const { column, children, style: styleProp, gap, p, px, py, pt, pb, padding, alignItems, border: borderProp, shadow: shadowProp, radius: radiusProp, } = props;
|
|
10
|
+
const { column, children, style: styleProp, gap, p, px, py, pt, pr, pb, pl, padding, alignItems, border: borderProp, shadow: shadowProp, radius: radiusProp, } = props;
|
|
20
11
|
const resolvedBorder = shadowProp || borderProp == null
|
|
21
12
|
? undefined
|
|
22
13
|
: borderProp === true
|
|
@@ -29,7 +20,9 @@ export function Flex(props) {
|
|
|
29
20
|
px === undefined &&
|
|
30
21
|
py === undefined &&
|
|
31
22
|
pt === undefined &&
|
|
23
|
+
pr === undefined &&
|
|
32
24
|
pb === undefined &&
|
|
25
|
+
pl === undefined &&
|
|
33
26
|
padding === undefined
|
|
34
27
|
? undefined
|
|
35
28
|
: spacing.padding({
|
|
@@ -37,7 +30,9 @@ export function Flex(props) {
|
|
|
37
30
|
x: px,
|
|
38
31
|
y: py,
|
|
39
32
|
top: pt,
|
|
33
|
+
right: pr,
|
|
40
34
|
bottom: pb,
|
|
35
|
+
left: pl,
|
|
41
36
|
}), alignItems === undefined ? undefined : style({ alignItems }), shadowProp ? shadow[shadowProp] : undefined, resolvedBorder ? border([], resolvedBorder) : undefined, radiusProp ? radius[radiusProp] : undefined);
|
|
42
37
|
const rawStyle = styleProp;
|
|
43
38
|
const inlineStyle = rawStyle != null && typeof rawStyle === "object" && !Array.isArray(rawStyle)
|
package/dist/maui.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export * from "./icons/root";
|
|
|
39
39
|
export { ListBox, ListBoxItem, type ListBoxProps, type ListBoxItemProps, } from "./components/ListBox";
|
|
40
40
|
export { MenuTrigger, Menu, MenuItem, type MenuTriggerProps, type MenuProps, type MenuItemProps, } from "./components/Menu";
|
|
41
41
|
export { FuzzyString } from "./components/FuzzyString";
|
|
42
|
-
export { Flex,
|
|
42
|
+
export { Flex, Gap, Spacer, Divider, type FlexShadow, type FlexRadius, type FlexBorder, } from "./components/Utils";
|
|
43
43
|
export { Text, type TextProps } from "./components/Text";
|
|
44
44
|
export { H1, H2, H3, H4, P, Label, labelText, Blockquote, Ul, Ol, Li, Link, } from "./components/Typography";
|
|
45
45
|
export { CodeBlock } from "./components/CodeBlock";
|
package/dist/maui.js
CHANGED
|
@@ -42,7 +42,7 @@ export * from "./icons/root";
|
|
|
42
42
|
export { ListBox, ListBoxItem, } from "./components/ListBox";
|
|
43
43
|
export { MenuTrigger, Menu, MenuItem, } from "./components/Menu";
|
|
44
44
|
export { FuzzyString } from "./components/FuzzyString";
|
|
45
|
-
export { Flex,
|
|
45
|
+
export { Flex, Gap, Spacer, Divider, } from "./components/Utils";
|
|
46
46
|
export { Text } from "./components/Text";
|
|
47
47
|
export { H1, H2, H3, H4, P, Label, labelText, Blockquote, Ul, Ol, Li, Link, } from "./components/Typography";
|
|
48
48
|
export { CodeBlock } from "./components/CodeBlock";
|
package/package.json
CHANGED
package/skills/maui/SKILL.md
CHANGED
|
@@ -54,7 +54,7 @@ Before designing or implementing new UI:
|
|
|
54
54
|
| A pattern | [Patterns](#patterns) |
|
|
55
55
|
| An app | [Apps](#apps) |
|
|
56
56
|
|
|
57
|
-
Patterns, demo apps, and the gallery `Panel` preview
|
|
57
|
+
Patterns, demo apps, and the gallery `Panel` preview frame are **not** package components. `Panel` is not on the `"maui"` barrel, not in `src/components`, and not in the JSX editor catalog. Prefer the recipes in those references and rebuild with barrel exports (`Button`, `Flex`, `text(...)`, …).
|
|
58
58
|
|
|
59
59
|
## Design constraints
|
|
60
60
|
|
|
@@ -88,7 +88,7 @@ internal button or segment.
|
|
|
88
88
|
|
|
89
89
|
## Layout utilities
|
|
90
90
|
|
|
91
|
-
`Flex
|
|
91
|
+
`Flex` and `Gap` take spacing scale steps (`1 | 2 | 3 | 4 | 6 | 8 | 12 | 16`), not raw pixels. Example: `<Flex row gap={4} padding={4}>` is 9px gap and 9px inset, not 4px. Put padding on `Flex` (`padding` / `p`, `px`, `py`, `pt`, `pr`, `pb`, `pl`) — there is no `Padding` component. `Spacer` grows to fill leftover flex space. `Divider` is a horizontal rule.
|
|
92
92
|
|
|
93
93
|
## Icons
|
|
94
94
|
|
|
@@ -13,7 +13,7 @@ Column shell: outline border, `radius.lg`, `minHeight` ~560px / `maxHeight` ~720
|
|
|
13
13
|
|
|
14
14
|
**Feed** (`role="log"` `aria-label="Conversation"` `aria-relevant="additions"`)
|
|
15
15
|
|
|
16
|
-
-
|
|
16
|
+
- `Flex column` with `px={8} py={6} gap={6}`, `flex: 1`, `overflowY: auto`. Scroll to bottom when messages change.
|
|
17
17
|
- **User**: `justify: end`, bubble `maxWidth: 80%`, `prose("sm")` paragraph, `radius.md`, `shadow.subtle`, `background.element`, `pre-wrap`.
|
|
18
18
|
- **Assistant**: full-width column.
|
|
19
19
|
1. Optional tool-call lines (lowContrast, ellipsis): `Read path`, `Wrote path`, `$ command` (command in `monospace`).
|
|
@@ -22,8 +22,8 @@ Column shell: outline border, `radius.lg`, `minHeight` ~560px / `maxHeight` ~720
|
|
|
22
22
|
|
|
23
23
|
**Composer**
|
|
24
24
|
|
|
25
|
-
- Outer
|
|
26
|
-
- Inner shell: `radius.lg`, `shadow.subtle`, `background.element`,
|
|
25
|
+
- Outer `Flex` with `px={6} pt={4} pb={6}`.
|
|
26
|
+
- Inner shell: `radius.lg`, `shadow.subtle`, `background.element`, `Flex column` with `px={4} py={3}`.
|
|
27
27
|
- `<Editor size="sm" onSubmit={send} editable={!streaming} placeholder="Message the assistant…" />`
|
|
28
28
|
- Send: circular quiet-ish `Button` (`radius.circle`, no box-shadow, `gray[3]` fill so it reads on `element`), icon `ArrowUp`, `aria-label="Send"`, disabled while streaming or empty. ⌘/Ctrl+Enter also sends (`Editor onSubmit`).
|
|
29
29
|
|
|
@@ -14,7 +14,7 @@ This is a **full-bleed schedule**, not a prose column.
|
|
|
14
14
|
|
|
15
15
|
## Sidebar
|
|
16
16
|
|
|
17
|
-
Raised `background.element` + `shadow.subtle`, column `gap
|
|
17
|
+
Raised `background.element` + `shadow.subtle`, `Flex column` with `gap={6} p={4}`.
|
|
18
18
|
|
|
19
19
|
- Toolbar: quiet icon buttons — hide sidebar (`Sidebar` icon), new event (`Plus`). Wrap in `Tooltip`.
|
|
20
20
|
- **Mini month**: 7-column weekday initials (`2xs`), 24px circular day buttons. Today = `accent[9]` + `onAccent` text. Selected (not today) = `grayAlpha[4]`. Outside-month = `gray[8]`. Hover = `elementHover` (no background transition on the chrome; day buttons may use `motion.standard` on color only). Prev/next month chevrons.
|
|
@@ -34,7 +34,7 @@ Event colors: `accent` | `green` | `orange` | `pink` — fill step 3, text 11, s
|
|
|
34
34
|
|
|
35
35
|
## Details pane
|
|
36
36
|
|
|
37
|
-
Raised column
|
|
37
|
+
Raised `Flex column` with `p={8}`.
|
|
38
38
|
|
|
39
39
|
- `SearchField` “Search events”. Matches render as a list of title (`FuzzyString`) + meta; click jumps to that event and date.
|
|
40
40
|
- Selected event: title `lg`/600, time range or “All day”, duration, calendar swatch + name, `Button` “Add meeting note”.
|
|
@@ -14,13 +14,13 @@ Shell: `radius.lg`, `shadow.subtle`, `minHeight` ~640px, `overflow: hidden`, `ba
|
|
|
14
14
|
|
|
15
15
|
**Inbox pane**
|
|
16
16
|
|
|
17
|
-
-
|
|
17
|
+
- `Flex column` with `p={2}`, `minHeight: 0`, list `overflowY: auto`.
|
|
18
18
|
- Header: `H3` “Inbox” (or mailbox name), padded to match multi-line row text (`pt` 6, `px` 4).
|
|
19
19
|
- Body: InboxMultiLine with `threads`, `selectedId`, `onSelectThread`. Reset the pattern’s default `marginTop` so it sits flush under the header.
|
|
20
20
|
|
|
21
21
|
**Reading pane**
|
|
22
22
|
|
|
23
|
-
-
|
|
23
|
+
- `Flex column` with `px={16} py={8} gap={6}`, `overflowY: auto`.
|
|
24
24
|
- Selected: `H2` subject, then MessageList of that thread’s messages (`sender`, `timestamp`, optional `edited`, `P` children).
|
|
25
25
|
- None selected: lowContrast “Select a thread to read messages.”
|
|
26
26
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Gallery: `/components/layout-utilities`. Import from `"maui"`. Layout tokens: [tokens.md](../tokens.md).
|
|
4
4
|
|
|
5
|
-
Gallery-only: `Panel` is a preview frame in the docs site. It is **not**
|
|
5
|
+
Gallery-only: `Panel` is a dotted preview frame in the docs site (`src/pages/Panel.tsx`). It is **not** a `"maui"` export (barrel or `src/components`). Use `Flex` + `shadow` + `radius` instead.
|
|
6
6
|
|
|
7
7
|
## `Flex`
|
|
8
8
|
|
|
@@ -22,16 +22,14 @@ Row **or** column (exactly one of `row` / `column` is required).
|
|
|
22
22
|
| `row` / `column` | Required, mutually exclusive |
|
|
23
23
|
| `gap` | Spacing step |
|
|
24
24
|
| `p` / `padding` | All-side padding step |
|
|
25
|
-
| `px` `py` `pt` `pb` | Axis / side padding |
|
|
25
|
+
| `px` `py` `pt` `pr` `pb` `pl` | Axis / side padding |
|
|
26
26
|
| `alignItems` | CSS `align-items` |
|
|
27
27
|
| `border` | `true` (outline) or `"border" \| "outline" \| "accent"`. **Skipped when `shadow` is set** |
|
|
28
28
|
| `shadow` | `"subtle" \| "medium" \| "strong"` — includes a ring; do not also set `border` |
|
|
29
29
|
| `radius` | Token key (`sm`, `lg`, `pill`, …) |
|
|
30
30
|
| `style` | React style object |
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
`xy` (all), `x` / `y`, or `top` `right` `bottom` `left`. Spacing steps.
|
|
32
|
+
Do not wrap children in a `Padding` box — that component does not exist. Use `Flex` padding props.
|
|
35
33
|
|
|
36
34
|
## `Gap`
|
|
37
35
|
|
|
@@ -50,7 +50,7 @@ function Row({ children }: { children: React.ReactNode }) {
|
|
|
50
50
|
- `text({...})`, `shadow.subtle`, `background.element`, `radius.md`, `flex({...})`, `spacing.padding({...})` are already style objects — pass them to `useStyles`.
|
|
51
51
|
- `style({ ... })` is for leftover CSS that tokens do not cover (`minWidth`, grid templates, absolute positioning).
|
|
52
52
|
- Compose several objects in one `useStyles` call. Falsy entries are skipped.
|
|
53
|
-
- For one-off layout, prefer
|
|
53
|
+
- For one-off layout, prefer `Flex` (see [layout-utilities.md](components/layout-utilities.md)). For repeated custom chrome, prefer tokens + `useStyles`.
|
|
54
54
|
|
|
55
55
|
## Color
|
|
56
56
|
|
|
@@ -140,7 +140,7 @@ spacing.gap[4] // style { gap: 9px }
|
|
|
140
140
|
spacing.value(4) // "9px" — only when gap/padding tokens cannot apply
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
`Flex` / `
|
|
143
|
+
`Flex` / `Gap` / `flex({ gap })` all take these steps. Put inset on `Flex` with `padding` / `p` / `px` / `py` / `pt` / `pr` / `pb` / `pl`.
|
|
144
144
|
|
|
145
145
|
## Layout tokens
|
|
146
146
|
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
P,
|
|
51
51
|
Ul,
|
|
52
52
|
} from "../../components/Typography"
|
|
53
|
-
import { Divider, Flex, Gap,
|
|
53
|
+
import { Divider, Flex, Gap, Spacer } from "../../components/Utils"
|
|
54
54
|
import { backgroundColor } from "../../tokens/background"
|
|
55
55
|
import { borderColor } from "../../tokens/borders"
|
|
56
56
|
import { colors, colorNames } from "../../tokens/colors"
|
|
@@ -86,16 +86,19 @@ export const iconNames = Object.keys(Icons)
|
|
|
86
86
|
export const catalog: CatalogComponent[] = [
|
|
87
87
|
{
|
|
88
88
|
name: "Flex",
|
|
89
|
-
info: "Row or column flex layout. gap and p/px/py/pt/pb are spacing steps, not pixels.",
|
|
89
|
+
info: "Row or column flex layout. gap and padding/p/px/py/pt/pr/pb/pl are spacing steps, not pixels.",
|
|
90
90
|
attributes: [
|
|
91
91
|
{ name: "row", boolean: true, info: "Horizontal direction" },
|
|
92
92
|
{ name: "column", boolean: true, info: "Vertical direction" },
|
|
93
93
|
{ name: "gap", values: spaceValues, info: "Spacing scale step" },
|
|
94
|
+
{ name: "padding", values: spaceValues, info: "Padding on all sides (alias of p)" },
|
|
94
95
|
{ name: "p", values: spaceValues, info: "Padding on all sides" },
|
|
95
96
|
{ name: "px", values: spaceValues, info: "Horizontal padding" },
|
|
96
97
|
{ name: "py", values: spaceValues, info: "Vertical padding" },
|
|
97
98
|
{ name: "pt", values: spaceValues, info: "Padding top" },
|
|
99
|
+
{ name: "pr", values: spaceValues, info: "Padding right" },
|
|
98
100
|
{ name: "pb", values: spaceValues, info: "Padding bottom" },
|
|
101
|
+
{ name: "pl", values: spaceValues, info: "Padding left" },
|
|
99
102
|
{ name: "alignItems", values: alignItems },
|
|
100
103
|
{
|
|
101
104
|
name: "border",
|
|
@@ -118,19 +121,6 @@ export const catalog: CatalogComponent[] = [
|
|
|
118
121
|
},
|
|
119
122
|
],
|
|
120
123
|
},
|
|
121
|
-
{
|
|
122
|
-
name: "Padding",
|
|
123
|
-
info: "Padding box using the spacing scale.",
|
|
124
|
-
attributes: [
|
|
125
|
-
{ name: "xy", values: spaceValues },
|
|
126
|
-
{ name: "x", values: spaceValues },
|
|
127
|
-
{ name: "y", values: spaceValues },
|
|
128
|
-
{ name: "top", values: spaceValues },
|
|
129
|
-
{ name: "right", values: spaceValues },
|
|
130
|
-
{ name: "bottom", values: spaceValues },
|
|
131
|
-
{ name: "left", values: spaceValues },
|
|
132
|
-
],
|
|
133
|
-
},
|
|
134
124
|
{
|
|
135
125
|
name: "Gap",
|
|
136
126
|
info: "Fixed-size spacer. Pass width or height as a spacing step.",
|
|
@@ -535,7 +525,6 @@ export const previewScope: Record<string, unknown> = {
|
|
|
535
525
|
Divider,
|
|
536
526
|
Flex,
|
|
537
527
|
Gap,
|
|
538
|
-
Padding,
|
|
539
528
|
Spacer,
|
|
540
529
|
colors,
|
|
541
530
|
backgroundColor,
|
|
@@ -95,6 +95,15 @@ describe("collectJsxDiagnosticsFromSource", () => {
|
|
|
95
95
|
])
|
|
96
96
|
})
|
|
97
97
|
|
|
98
|
+
test("accepts Flex padding aliases and side props", () => {
|
|
99
|
+
const diagnostics = collectJsxDiagnosticsFromSource(
|
|
100
|
+
`<Flex column padding={6} px={4} py={3} pt={2} pr={8} pb={2} pl={8}>
|
|
101
|
+
<Text>Inset</Text>
|
|
102
|
+
</Flex>`,
|
|
103
|
+
)
|
|
104
|
+
expect(diagnostics).toEqual([])
|
|
105
|
+
})
|
|
106
|
+
|
|
98
107
|
test("accepts MenuTrigger with a Maui Button", () => {
|
|
99
108
|
const diagnostics = collectJsxDiagnosticsFromSource(
|
|
100
109
|
`<MenuTrigger>
|
|
@@ -109,3 +118,14 @@ describe("collectJsxDiagnosticsFromSource", () => {
|
|
|
109
118
|
expect(diagnostics).toEqual([])
|
|
110
119
|
})
|
|
111
120
|
})
|
|
121
|
+
|
|
122
|
+
describe("JSX editor catalog", () => {
|
|
123
|
+
test("does not expose Padding or Panel", async () => {
|
|
124
|
+
const { catalog, previewScope } = await import("./catalog")
|
|
125
|
+
const names = catalog.map((entry) => entry.name)
|
|
126
|
+
expect(names).not.toContain("Padding")
|
|
127
|
+
expect(names).not.toContain("Panel")
|
|
128
|
+
expect(previewScope).not.toHaveProperty("Padding")
|
|
129
|
+
expect(previewScope).not.toHaveProperty("Panel")
|
|
130
|
+
})
|
|
131
|
+
})
|
package/src/components/Utils.tsx
CHANGED
|
@@ -11,37 +11,15 @@ export type FlexShadow = keyof typeof shadow
|
|
|
11
11
|
export type FlexRadius = keyof typeof radius
|
|
12
12
|
export type FlexBorder = true | BorderColor
|
|
13
13
|
|
|
14
|
-
type PaddingProps = {
|
|
15
|
-
top?: Space
|
|
16
|
-
left?: Space
|
|
17
|
-
right?: Space
|
|
18
|
-
bottom?: Space
|
|
19
|
-
x?: Space
|
|
20
|
-
y?: Space
|
|
21
|
-
xy?: Space
|
|
22
|
-
children?: React.ReactNode
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function Padding(props: PaddingProps) {
|
|
26
|
-
const className = useStyles(
|
|
27
|
-
spacing.padding({
|
|
28
|
-
top: props.top ?? props.y ?? props.xy,
|
|
29
|
-
bottom: props.bottom ?? props.y ?? props.xy,
|
|
30
|
-
left: props.left ?? props.x ?? props.xy,
|
|
31
|
-
right: props.right ?? props.x ?? props.xy,
|
|
32
|
-
}),
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
return <div className={className}>{props.children}</div>
|
|
36
|
-
}
|
|
37
|
-
|
|
38
14
|
type FlexProps = {
|
|
39
15
|
gap?: Space
|
|
40
16
|
p?: Space
|
|
41
17
|
px?: Space
|
|
42
18
|
py?: Space
|
|
43
19
|
pt?: Space
|
|
20
|
+
pr?: Space
|
|
44
21
|
pb?: Space
|
|
22
|
+
pl?: Space
|
|
45
23
|
padding?: Space
|
|
46
24
|
children?: React.ReactNode
|
|
47
25
|
alignItems?: React.CSSProperties["alignItems"]
|
|
@@ -70,7 +48,9 @@ export function Flex(props: FlexProps) {
|
|
|
70
48
|
px,
|
|
71
49
|
py,
|
|
72
50
|
pt,
|
|
51
|
+
pr,
|
|
73
52
|
pb,
|
|
53
|
+
pl,
|
|
74
54
|
padding,
|
|
75
55
|
alignItems,
|
|
76
56
|
border: borderProp,
|
|
@@ -92,7 +72,9 @@ export function Flex(props: FlexProps) {
|
|
|
92
72
|
px === undefined &&
|
|
93
73
|
py === undefined &&
|
|
94
74
|
pt === undefined &&
|
|
75
|
+
pr === undefined &&
|
|
95
76
|
pb === undefined &&
|
|
77
|
+
pl === undefined &&
|
|
96
78
|
padding === undefined
|
|
97
79
|
? undefined
|
|
98
80
|
: spacing.padding({
|
|
@@ -100,7 +82,9 @@ export function Flex(props: FlexProps) {
|
|
|
100
82
|
x: px,
|
|
101
83
|
y: py,
|
|
102
84
|
top: pt,
|
|
85
|
+
right: pr,
|
|
103
86
|
bottom: pb,
|
|
87
|
+
left: pl,
|
|
104
88
|
}),
|
|
105
89
|
alignItems === undefined ? undefined : style({ alignItems }),
|
|
106
90
|
shadowProp ? shadow[shadowProp] : undefined,
|
package/src/maui.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from "react"
|
|
2
2
|
import { style, useStyles } from "purse-styles"
|
|
3
3
|
import { Button } from "../components/Button"
|
|
4
|
-
import { Panel } from "
|
|
4
|
+
import { Panel } from "./Panel"
|
|
5
5
|
import { Prose } from "../components/Prose"
|
|
6
6
|
import { H2, H3, P } from "../components/Typography"
|
|
7
7
|
import {
|
package/src/pages/AvatarPage.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Avatar } from "../components/Avatar"
|
|
2
|
-
import { Panel } from "
|
|
2
|
+
import { Panel } from "./Panel"
|
|
3
3
|
import { Prose } from "../components/Prose"
|
|
4
4
|
import { H2, H3, P } from "../components/Typography"
|
|
5
5
|
import { Flex } from "../components/Utils"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useStyles } from "purse-styles"
|
|
2
2
|
import { CodeBlock } from "../components/CodeBlock"
|
|
3
|
-
import { Panel } from "
|
|
3
|
+
import { Panel } from "./Panel"
|
|
4
4
|
import { Prose } from "../components/Prose"
|
|
5
5
|
import { Table, TableBody, TableCell, TableHead,
|
|
6
6
|
TableHeader, TableRow } from "../components/Table"
|
package/src/pages/BadgePage.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { style, useStyles, type CSSProperties } from "purse-styles"
|
|
|
2
2
|
import { Table, TableBody, TableCell, TableHead,
|
|
3
3
|
TableHeader, TableRow } from "../components/Table"
|
|
4
4
|
import { CodeBlock } from "../components/CodeBlock"
|
|
5
|
-
import { Panel } from "
|
|
5
|
+
import { Panel } from "./Panel"
|
|
6
6
|
import { Prose } from "../components/Prose"
|
|
7
7
|
import { H2, H3, P } from "../components/Typography"
|
|
8
8
|
import { border, type BorderColor, type BorderSide } from "../tokens/borders"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState } from "react"
|
|
2
2
|
import { CodeBlock } from "../components/CodeBlock"
|
|
3
|
-
import { Panel } from "
|
|
3
|
+
import { Panel } from "./Panel"
|
|
4
4
|
import { Prose } from "../components/Prose"
|
|
5
5
|
import { H2, H3, H4, P } from "../components/Typography"
|
|
6
6
|
import { Flex } from "../components/Utils"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CodeBlock } from "../components/CodeBlock"
|
|
2
|
-
import { Panel } from "
|
|
2
|
+
import { Panel } from "./Panel"
|
|
3
3
|
import { Prose } from "../components/Prose"
|
|
4
4
|
import { Table, TableBody, TableCell, TableHead,
|
|
5
5
|
TableHeader, TableRow } from "../components/Table"
|
|
@@ -3,7 +3,7 @@ import { Button } from "../components/Button"
|
|
|
3
3
|
import { Crossfade, type CrossfadeDirection } from "../components/Crossfade"
|
|
4
4
|
import { CodeBlock } from "../components/CodeBlock"
|
|
5
5
|
import { Icons } from "../components/Icons"
|
|
6
|
-
import { Panel } from "
|
|
6
|
+
import { Panel } from "./Panel"
|
|
7
7
|
import { Prose } from "../components/Prose"
|
|
8
8
|
import { RadioOption, RadioOptionGroup } from "../components/Radio"
|
|
9
9
|
import { Text } from "../components/Text"
|
|
@@ -2,7 +2,7 @@ import { useState } from "react"
|
|
|
2
2
|
import { style, useStyles } from "purse-styles"
|
|
3
3
|
import { Button } from "../components/Button"
|
|
4
4
|
import { Crossfade } from "../components/Crossfade"
|
|
5
|
-
import { Panel } from "
|
|
5
|
+
import { Panel } from "./Panel"
|
|
6
6
|
import { Prose } from "../components/Prose"
|
|
7
7
|
import { Text } from "../components/Text"
|
|
8
8
|
import { H2, H3, Link, P } from "../components/Typography"
|
package/src/pages/EditorPage.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { style, useStyles } from "purse-styles"
|
|
2
2
|
import { Editor } from "../components/Editor"
|
|
3
|
-
import { Panel } from "
|
|
3
|
+
import { Panel } from "./Panel"
|
|
4
4
|
import { Prose } from "../components/Prose"
|
|
5
5
|
import { H2, H3, P } from "../components/Typography"
|
|
6
6
|
import { backgroundColor } from "../tokens/background"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CodeBlock } from "../components/CodeBlock"
|
|
2
|
-
import { Panel } from "
|
|
2
|
+
import { Panel } from "./Panel"
|
|
3
3
|
import { Prose } from "../components/Prose"
|
|
4
4
|
import { Table, TableBody, TableCell, TableHead,
|
|
5
5
|
TableHeader, TableRow } from "../components/Table"
|
|
@@ -15,8 +15,9 @@ export function FlexTokenPage() {
|
|
|
15
15
|
<P>
|
|
16
16
|
<code>Flex</code> is a small layout wrapper around the spacing scale.
|
|
17
17
|
Pass <code>row</code> or <code>column</code>, and use scale steps for{" "}
|
|
18
|
-
<code>gap</code> and padding (<code>
|
|
19
|
-
<code>py</code>, <code>pt</code>, <code>
|
|
18
|
+
<code>gap</code> and padding (<code>padding</code> / <code>p</code>,{" "}
|
|
19
|
+
<code>px</code>, <code>py</code>, <code>pt</code>, <code>pr</code>,{" "}
|
|
20
|
+
<code>pb</code>, <code>pl</code>) (not raw pixels).
|
|
20
21
|
Optional{" "}
|
|
21
22
|
<code>border</code>, <code>shadow</code>, and <code>radius</code> turn
|
|
22
23
|
it into a surface. Shadows already include a 1px ring, so{" "}
|
|
@@ -81,8 +82,9 @@ export function FlexTokenPage() {
|
|
|
81
82
|
</TableRow>
|
|
82
83
|
<TableRow>
|
|
83
84
|
<TableCell>
|
|
84
|
-
<code>
|
|
85
|
-
<code>
|
|
85
|
+
<code>padding</code> / <code>p</code>, <code>px</code>,{" "}
|
|
86
|
+
<code>py</code>, <code>pt</code>, <code>pr</code>,{" "}
|
|
87
|
+
<code>pb</code>, <code>pl</code>
|
|
86
88
|
</TableCell>
|
|
87
89
|
<TableCell>
|
|
88
90
|
<code style={unionCodeStyle}>
|
|
@@ -97,7 +99,8 @@ export function FlexTokenPage() {
|
|
|
97
99
|
</code>
|
|
98
100
|
</TableCell>
|
|
99
101
|
<TableCell>
|
|
100
|
-
Padding from the spacing scale.
|
|
102
|
+
Padding from the spacing scale. <code>padding</code> is an alias
|
|
103
|
+
of <code>p</code>. More specific axes win (
|
|
101
104
|
<code>pt</code> over <code>py</code> over <code>p</code>).
|
|
102
105
|
</TableCell>
|
|
103
106
|
</TableRow>
|
|
@@ -2,7 +2,7 @@ import { style, useStyles } from "purse-styles"
|
|
|
2
2
|
import { Table, TableBody, TableCell, TableHead,
|
|
3
3
|
TableHeader, TableRow } from "../components/Table"
|
|
4
4
|
import { CodeBlock } from "../components/CodeBlock"
|
|
5
|
-
import { Panel } from "
|
|
5
|
+
import { Panel } from "./Panel"
|
|
6
6
|
import { Prose } from "../components/Prose"
|
|
7
7
|
import { H2, H3, P } from "../components/Typography"
|
|
8
8
|
import { focusRing } from "../tokens/focusRing"
|
|
@@ -4,7 +4,7 @@ import { Table, TableBody, TableCell, TableHead,
|
|
|
4
4
|
TableHeader, TableRow } from "../components/Table"
|
|
5
5
|
import { FuzzyString } from "../components/FuzzyString"
|
|
6
6
|
import { SearchField } from "../components/Input"
|
|
7
|
-
import { Panel } from "
|
|
7
|
+
import { Panel } from "./Panel"
|
|
8
8
|
import { Prose } from "../components/Prose"
|
|
9
9
|
import { H2, H3, P } from "../components/Typography"
|
|
10
10
|
import { text } from "../tokens/text"
|
package/src/pages/IconsPage.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { useStyles } from "purse-styles"
|
|
|
4
4
|
import { Icons, type IconProps } from "../components/Icons"
|
|
5
5
|
import { CodeBlock } from "../components/CodeBlock"
|
|
6
6
|
import { SearchField } from "../components/Input"
|
|
7
|
-
import { Panel } from "
|
|
7
|
+
import { Panel } from "./Panel"
|
|
8
8
|
import { Prose } from "../components/Prose"
|
|
9
9
|
import { H2, H3, H4, P } from "../components/Typography"
|
|
10
10
|
import { borderColor } from "../tokens/borders"
|
|
@@ -2,7 +2,7 @@ import { style, useStyles } from "purse-styles"
|
|
|
2
2
|
import { Table, TableBody, TableCell, TableHead,
|
|
3
3
|
TableHeader, TableRow } from "../components/Table"
|
|
4
4
|
import { CodeBlock } from "../components/CodeBlock"
|
|
5
|
-
import { Panel } from "
|
|
5
|
+
import { Panel } from "./Panel"
|
|
6
6
|
import { Prose } from "../components/Prose"
|
|
7
7
|
import { H2, H3, H4, P } from "../components/Typography"
|
|
8
8
|
import { flex, flexItem, grid, gridItem } from "../tokens/layout"
|
|
@@ -2,22 +2,23 @@ import { CodeBlock } from "../components/CodeBlock"
|
|
|
2
2
|
import { Prose } from "../components/Prose"
|
|
3
3
|
import { Text } from "../components/Text"
|
|
4
4
|
import { H2, H3, P } from "../components/Typography"
|
|
5
|
-
import { Divider, Flex, Gap,
|
|
5
|
+
import { Divider, Flex, Gap, Spacer } from "../components/Utils"
|
|
6
6
|
|
|
7
7
|
export function LayoutUtilitiesPage() {
|
|
8
8
|
return (
|
|
9
9
|
<Prose style={{ marginBottom: "32px" }}>
|
|
10
10
|
<H2>Layout utilities</H2>
|
|
11
11
|
<P>
|
|
12
|
-
<code>
|
|
13
|
-
|
|
14
|
-
<code>Flex</code>
|
|
15
|
-
<code>
|
|
16
|
-
<code>
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
<code>Flex</code> and <code>Gap</code> take spacing scale steps (
|
|
13
|
+
<code>1</code>–<code>16</code>), not raw pixels. Put inset on{" "}
|
|
14
|
+
<code>Flex</code> with <code>padding</code> / <code>p</code>,{" "}
|
|
15
|
+
<code>px</code>, <code>py</code>, <code>pt</code>, <code>pr</code>,{" "}
|
|
16
|
+
<code>pb</code>, <code>pl</code>. <code>Flex</code> also accepts{" "}
|
|
17
|
+
<code>border</code>, <code>shadow</code>, and <code>radius</code> when
|
|
18
|
+
it should read as a surface. Shadows already include a 1px ring, so do
|
|
19
|
+
not also set <code>border</code>.
|
|
19
20
|
</P>
|
|
20
|
-
<
|
|
21
|
+
<Flex column padding={6}>
|
|
21
22
|
<Flex row alignItems="center" px={4} py={3} border="outline" radius="md">
|
|
22
23
|
<Text size="sm">Flex</Text>
|
|
23
24
|
<Gap width={6} />
|
|
@@ -25,19 +26,19 @@ export function LayoutUtilitiesPage() {
|
|
|
25
26
|
<Spacer />
|
|
26
27
|
<Text size="sm">Spacer</Text>
|
|
27
28
|
</Flex>
|
|
28
|
-
</
|
|
29
|
+
</Flex>
|
|
29
30
|
<H3>Surface</H3>
|
|
30
31
|
<CodeBlock lang="tsx">{`<Flex column gap={4} p={6} shadow="subtle" radius="lg">
|
|
31
32
|
<Text size="sm">Raised group</Text>
|
|
32
33
|
</Flex>`}</CodeBlock>
|
|
33
|
-
<
|
|
34
|
+
<Flex column padding={6}>
|
|
34
35
|
<Flex column gap={4} p={6} shadow="subtle" radius="lg">
|
|
35
36
|
<Text size="sm">Raised group</Text>
|
|
36
37
|
<Text size="sm" color="lowContrast">
|
|
37
38
|
shadow="subtle" includes the ring
|
|
38
39
|
</Text>
|
|
39
40
|
</Flex>
|
|
40
|
-
</
|
|
41
|
+
</Flex>
|
|
41
42
|
<Divider />
|
|
42
43
|
</Prose>
|
|
43
44
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { style, useStyles } from "purse-styles"
|
|
2
|
-
import { Panel } from "
|
|
2
|
+
import { Panel } from "./Panel"
|
|
3
3
|
import { Prose } from "../components/Prose"
|
|
4
4
|
import { H2, H3, P } from "../components/Typography"
|
|
5
5
|
import { EmailMessageThread } from "../patterns/MessageList"
|
|
@@ -4,7 +4,7 @@ import { Table, TableBody, TableCell, TableHead,
|
|
|
4
4
|
import { style, useStyles } from "purse-styles"
|
|
5
5
|
import { Button } from "../components/Button"
|
|
6
6
|
import { CodeBlock } from "../components/CodeBlock"
|
|
7
|
-
import { Panel } from "
|
|
7
|
+
import { Panel } from "./Panel"
|
|
8
8
|
import { Prose } from "../components/Prose"
|
|
9
9
|
import { H2, H3, P } from "../components/Typography"
|
|
10
10
|
import { motion, motionDurationMs, motionEasing } from "../tokens/motion"
|
package/src/pages/ProsePage.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { useState } from "react"
|
|
|
2
2
|
import { style, useStyles } from "purse-styles"
|
|
3
3
|
import { Badge } from "../components/Badge"
|
|
4
4
|
import { Icons } from "../components/Icons"
|
|
5
|
-
import { Panel } from "
|
|
5
|
+
import { Panel } from "./Panel"
|
|
6
6
|
import { Prose } from "../components/Prose"
|
|
7
7
|
import { H2, H3, P } from "../components/Typography"
|
|
8
8
|
import { Sidebar, SidebarItem, SidebarSection } from "../patterns/Sidebar"
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
TableRow,
|
|
9
9
|
} from "../components/Table"
|
|
10
10
|
import { CodeBlock } from "../components/CodeBlock"
|
|
11
|
-
import { Panel } from "
|
|
11
|
+
import { Panel } from "./Panel"
|
|
12
12
|
import { Prose } from "../components/Prose"
|
|
13
13
|
import { H2, H3, H4, P } from "../components/Typography"
|
|
14
14
|
import { borderColor } from "../tokens/borders"
|
|
@@ -2,7 +2,7 @@ import { useStyles } from "purse-styles"
|
|
|
2
2
|
import { Table, TableBody, TableCell, TableHead,
|
|
3
3
|
TableHeader, TableRow } from "../components/Table"
|
|
4
4
|
import { CodeBlock } from "../components/CodeBlock"
|
|
5
|
-
import { Panel } from "
|
|
5
|
+
import { Panel } from "./Panel"
|
|
6
6
|
import { Prose } from "../components/Prose"
|
|
7
7
|
import { H2, H3, H4, P } from "../components/Typography"
|
|
8
8
|
import { spacing } from "../tokens/spacing"
|
package/src/pages/TablePage.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from "react"
|
|
2
2
|
import type { Selection } from "react-aria-components"
|
|
3
3
|
import { Code } from "../components/Code"
|
|
4
|
-
import { Panel } from "
|
|
4
|
+
import { Panel } from "./Panel"
|
|
5
5
|
import { Prose } from "../components/Prose"
|
|
6
6
|
import {
|
|
7
7
|
Table,
|
package/src/pages/TextPage.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { useStyles } from "purse-styles"
|
|
|
2
2
|
import { Table, TableBody, TableCell, TableHead,
|
|
3
3
|
TableHeader, TableRow } from "../components/Table"
|
|
4
4
|
import { CodeBlock } from "../components/CodeBlock"
|
|
5
|
-
import { Panel } from "
|
|
5
|
+
import { Panel } from "./Panel"
|
|
6
6
|
import { Prose } from "../components/Prose"
|
|
7
7
|
import { H2, H3, H4, P } from "../components/Typography"
|
|
8
8
|
import { text, type TextSize } from "../tokens/text"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { style, useStyles } from "purse-styles"
|
|
2
|
-
import { Panel } from "
|
|
2
|
+
import { Panel } from "./Panel"
|
|
3
3
|
import { Prose } from "../components/Prose"
|
|
4
4
|
import { Thinking } from "../components/Thinking"
|
|
5
5
|
import { H2, H3, P } from "../components/Typography"
|