plass-ui 1.0.1 → 1.0.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/README.md +165 -0
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Plass UI for React
|
|
2
|
+
|
|
3
|
+
[](https://github.com/jooy2/plass-ui/blob/main/LICENSE) [](https://www.npmjs.com/package/plass-ui) [](https://www.npmjs.com/package/plass-ui)
|
|
4
|
+
|
|
5
|
+
### 📘 [**plass.cdget.com**](https://plass.cdget.com)
|
|
6
|
+
|
|
7
|
+
Live previews and full props for every component — pick **React** in the sidebar. This README is just the quick start.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
**Plass UI is a component library with a material rather than a theme.** Every surface answers one question — is this pressed, or does it hold something? — and the answer decides everything else.
|
|
12
|
+
|
|
13
|
+
A thing that is pressed is **tinted glass**: a gradient that sweeps between two ends of its colour family at 135°, a drop shadow tinted with that family, and a bloom of light that follows the pointer across it. A thing that holds something is **clear glass**: translucent, heavily blurred, a white hairline round it, and never dyed. There is no third answer.
|
|
14
|
+
|
|
15
|
+
This is the React half of that language. The [Flutter package](https://pub.dev/packages/plass_ui) is the other one, and the two are the same numbers.
|
|
16
|
+
|
|
17
|
+
- **Two materials, one language** — `solid`, `glass`, `ghost`. Not `filled`, `outlined`, `text`.
|
|
18
|
+
- **Light instead of relief** — no bevels and no highlights. The gradient carries the form, and a soft glow follows your pointer across the control.
|
|
19
|
+
- **One shared vocabulary** — `size`, `color`, `variant`, `density`, `elevation`. An `md` is 40px on every control; `primary` is the same family everywhere, and the same family it is in Flutter.
|
|
20
|
+
- **Accessible by construction** — real roles, labels, focus management and keyboard support, not `div`s with click handlers.
|
|
21
|
+
- **Contrast that was checked** — every gradient stop clears 4.5:1 against its own label, the lightest corner included.
|
|
22
|
+
- **Dark mode with no work** — follows `prefers-color-scheme`, and can be forced either way per subtree.
|
|
23
|
+
- **ESM only**, TypeScript declarations included, tree-shakeable, with an entry point per component.
|
|
24
|
+
- **One runtime dependency**, [Base UI](https://base-ui.com), which is where the interaction and accessibility behaviour comes from.
|
|
25
|
+
|
|
26
|
+
> **Both packages ship the same library.** Every component listed below exists in each, under the same prop vocabulary and the same tokens. They version independently, so this package's number and the Flutter one's will not always agree.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install plass-ui
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`react` and `react-dom` are peer dependencies — React 18 or 19. Node.js 20.19 or later.
|
|
35
|
+
|
|
36
|
+
### Setup
|
|
37
|
+
|
|
38
|
+
Add one line to your app's CSS entry point:
|
|
39
|
+
|
|
40
|
+
```css
|
|
41
|
+
@import 'plass-ui/styles.css';
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`plass-ui/styles.css` is finished CSS — the design tokens, the compiled rules for every utility class the components use, and a small reset whose every rule is specificity 0 so your own styles always win. [Tailwind CSS](https://tailwindcss.com) v4 builds this package; it does not have to be installed in yours.
|
|
45
|
+
|
|
46
|
+
If your project already runs Tailwind v4, import the token sheet instead:
|
|
47
|
+
|
|
48
|
+
```css
|
|
49
|
+
@import 'tailwindcss';
|
|
50
|
+
@import 'plass-ui/tailwind.css';
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`plass-ui/tailwind.css` registers all 74 components with Tailwind, because Tailwind scans files rather than imports — nothing in a build connects `import { PlButton }` to the classes `PlSelect.js` spells out. A project that uses a handful of components can register the handful instead:
|
|
54
|
+
|
|
55
|
+
```css
|
|
56
|
+
@import 'tailwindcss';
|
|
57
|
+
@import 'plass-ui/css/base.css'; /* tokens + what every component shares */
|
|
58
|
+
@import 'plass-ui/css/button.css';
|
|
59
|
+
@import 'plass-ui/css/text-field.css';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Still one Tailwind pass, so the utilities keep Tailwind's own order — and about 5 kB gzipped smaller for a small set of components. There is one manifest per component, named after its folder in `dist/components`.
|
|
63
|
+
|
|
64
|
+
### The page under the components
|
|
65
|
+
|
|
66
|
+
Plass draws controls and sheets. It does not paint your `<body>` — but a sheet of glass over a flat white page has nothing to be in front of, and every translucent surface in the library will read as opaque. Two tokens exist for exactly this:
|
|
67
|
+
|
|
68
|
+
```css
|
|
69
|
+
body {
|
|
70
|
+
background: linear-gradient(160deg, var(--plass-bg-from) 0%, var(--plass-bg-to) 100%);
|
|
71
|
+
background-attachment: fixed;
|
|
72
|
+
color: var(--plass-fg);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Any backdrop with structure in it works. What does not work is nothing at all.
|
|
77
|
+
|
|
78
|
+
## Use
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import { PlButton, PlTextField } from 'plass-ui';
|
|
82
|
+
|
|
83
|
+
export default function SignIn() {
|
|
84
|
+
return (
|
|
85
|
+
<form onSubmit={submit}>
|
|
86
|
+
<PlTextField label="Email" type="email" fullWidth />
|
|
87
|
+
<PlButton type="submit">Sign in</PlButton>
|
|
88
|
+
<PlButton variant="glass" color="secondary">
|
|
89
|
+
Cancel
|
|
90
|
+
</PlButton>
|
|
91
|
+
</form>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### One entry point per component
|
|
97
|
+
|
|
98
|
+
Every component also has an entry point of its own, for a build that cannot tree-shake a barrel — or for a server render, where the barrel loads all 74 components and their dependencies before the first one is used:
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
import { PlButton } from 'plass-ui/button';
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Same component, same types. The barrel is the one to reach for by default; this is the escape hatch when a bundler, a test runner or Node's own loader is the thing paying for it.
|
|
105
|
+
|
|
106
|
+
### Next.js and server components
|
|
107
|
+
|
|
108
|
+
Every component carries `'use client'`, so a Server Component can import one directly and there is nothing to configure — no `transpilePackages`, no `next.config` entry, no provider. What the directive cannot do is carry a function across the server boundary: a file that passes `onClick`, `onValueChange` or `render` needs its own `'use client'`, which is React's rule for every client component rather than this library's. Outside a server-component graph the directive is inert.
|
|
109
|
+
|
|
110
|
+
### Dark mode
|
|
111
|
+
|
|
112
|
+
Follows `prefers-color-scheme` with no configuration. To force it either way, put `.dark` / `.light` — or `[data-theme='dark']` / `[data-theme='light']` — on any ancestor, `<html>` included.
|
|
113
|
+
|
|
114
|
+
One thing does **not** change with the theme, and it is deliberate: the colour of a key. What changes is the sheet it rests on.
|
|
115
|
+
|
|
116
|
+
## Components
|
|
117
|
+
|
|
118
|
+
Every component is exported under a `Pl` prefix — `Button`, `Card` and `Table` are the most-taken identifiers in the ecosystem, and a consumer should not have to alias ours on import.
|
|
119
|
+
|
|
120
|
+
### Display
|
|
121
|
+
|
|
122
|
+
`PlAvatar` · `PlBadge` · `PlBlockquote` · `PlBreadcrumb` · `PlChip` · `PlDivider` · `PlHighlight` · `PlHotKeys` · `PlIcon` · `PlList` · `PlTable` · `PlTextLink` · `PlTimeline` · `PlTypography`
|
|
123
|
+
|
|
124
|
+
### Feedback
|
|
125
|
+
|
|
126
|
+
`PlAlert` · `PlDrawer` · `PlModal` · `PlOverlay` · `PlPopover` · `PlProgressBox` · `PlProgressCircular` · `PlProgressLinear` · `PlSkeleton` · `PlToast` · `PlTooltip`
|
|
127
|
+
|
|
128
|
+
### Inputs
|
|
129
|
+
|
|
130
|
+
`PlButton` · `PlButtonGroup` · `PlCheckbox` · `PlCombobox` · `PlDatePicker` · `PlDateRangePicker` · `PlDateTimePicker` · `PlFilePicker` · `PlIconButton` · `PlNumberField` · `PlOtpField` · `PlPagination` · `PlRadioGroup` · `PlRating` · `PlSegmentedButton` · `PlSelect` · `PlSlider` · `PlSwitch` · `PlTextField` · `PlTimePicker`
|
|
131
|
+
|
|
132
|
+
### Layout
|
|
133
|
+
|
|
134
|
+
`PlAspectRatio` · `PlContainer` · `PlGrid` · `PlPanes` · `PlScrollZone`
|
|
135
|
+
|
|
136
|
+
### Navigation
|
|
137
|
+
|
|
138
|
+
`PlBottomNavigation` · `PlContextMenu` · `PlFloatingBottomNavigation` · `PlMenu`
|
|
139
|
+
|
|
140
|
+
### Surfaces
|
|
141
|
+
|
|
142
|
+
`PlAccordion` · `PlBox` · `PlCard` · `PlCarousel` · `PlChatBubble` · `PlCollapsible` · `PlPill` · `PlSpoiler` · `PlTabs` · `PlToolbar`
|
|
143
|
+
|
|
144
|
+
### Transitions
|
|
145
|
+
|
|
146
|
+
`PlAnimateAppear` · `PlAnimateBlink` · `PlAnimateFade` · `PlAnimateGrow` · `PlAnimateHeadline` · `PlAnimateLighting` · `PlAnimateMarquee` · `PlAnimateRotate` · `PlAnimateSlide` · `PlAnimateTyping` · `PlAnimateZoom`
|
|
147
|
+
|
|
148
|
+
## Development
|
|
149
|
+
|
|
150
|
+
This package is installed and run from its own folder; there is no install at the repository root.
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npm install
|
|
154
|
+
npm test # Vitest, single run (headless Chromium)
|
|
155
|
+
npm run typecheck # tsc --noEmit over both TS projects
|
|
156
|
+
npm run build # tsc + terser + build-styles → dist/
|
|
157
|
+
npm run lint # ESLint
|
|
158
|
+
npm run size # what the package costs, packed and installed
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
The documentation site lives at the repository root, in [`docs/`](https://github.com/jooy2/plass-ui/tree/main/docs), and renders these components from `src/` through a Vite alias — so `cd docs && npm run dev` is the develop-and-eyeball loop and there is no separate demo app. [CONTRIBUTING.md](https://github.com/jooy2/plass-ui/blob/main/CONTRIBUTING.md) has the rest.
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
MIT © [CDGet](https://cdget.com)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plass-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A React UI component library made of glass and gradients — smooth tinted surfaces, shadows in their own colour, and light that follows the pointer. Accessible and themeable, ESM only, types included, dark mode built in.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"homepage": "https://plass.cdget.com",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "https://github.com/jooy2/plass-ui"
|
|
15
|
+
"url": "https://github.com/jooy2/plass-ui",
|
|
16
|
+
"directory": "packages/react"
|
|
16
17
|
},
|
|
17
18
|
"bugs": {
|
|
18
19
|
"url": "https://github.com/jooy2/plass-ui/issues"
|