trc-ui 0.0.0-stage → 0.5.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/CHANGELOG.md +72 -0
- package/LICENSE +21 -0
- package/README.md +126 -2
- package/dist/index.cjs +2710 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1021 -0
- package/dist/index.d.ts +1021 -0
- package/dist/index.js +2623 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +86 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
Covers releases 0.2 to 0.5 of the roadmap: 33 new components, each with its documentation page in English and French at [ui.theringconcept.com](https://ui.theringconcept.com).
|
|
6
|
+
|
|
7
|
+
### Overlays and feedback
|
|
8
|
+
|
|
9
|
+
- `Dialog`: modal window with title, description and actions; focus kept inside, Escape and overlay to close, focus returned.
|
|
10
|
+
- `Drawer`: side panel from the left or right, on the same modal layer; the `SiteHeader` mobile menu now uses it.
|
|
11
|
+
- `DropdownMenu`: menu of actions with full keyboard support (arrows, Home, End, typeahead), disabled and destructive items, links.
|
|
12
|
+
- `Popover`: non-modal floating panel, focus moved inside, Escape and outside click to close; controlled or not.
|
|
13
|
+
- `Tooltip`: on hover and keyboard focus, tied with `aria-describedby`, hoverable and dismissable with Escape.
|
|
14
|
+
- `toast()` and `Toaster`: global queue, polite announcements and immediate ones for errors, pause on hover and focus, one action.
|
|
15
|
+
- `Alert`: inline message with a thin colored edge.
|
|
16
|
+
- Floating elements are portaled and placed against their trigger, flipping when there is no room.
|
|
17
|
+
|
|
18
|
+
### Navigation
|
|
19
|
+
|
|
20
|
+
- `Tabs`: thin labels underlined with the accent, roving tabindex, automatic or manual activation.
|
|
21
|
+
- `SegmentedControl`: pill switch built on native radio buttons.
|
|
22
|
+
- `Accordion`: single or multiple, animated height, closed content out of the accessibility tree, arrow keys between titles.
|
|
23
|
+
- `Breadcrumbs`: trail to the current page.
|
|
24
|
+
- `Pagination`: constant-width range with ellipses, buttons or links (`href` function or `"/page/{page}"` pattern, usable from server components).
|
|
25
|
+
- `LanguageSwitcher`: the EN | FR pill, as links (with `lang` and `hreflang`) or buttons.
|
|
26
|
+
- `Steps`: vertical timeline with large thin numbers and the current step.
|
|
27
|
+
|
|
28
|
+
### Forms
|
|
29
|
+
|
|
30
|
+
- `RadioGroup`: native radio buttons in a fieldset, hint and error tied to the group, vertical or horizontal.
|
|
31
|
+
- `PasswordInput`: Show / Hide button whose accessible name includes its visible text.
|
|
32
|
+
- `PinInput`: one box per character, paste and text-message autofill, Backspace and arrow keys.
|
|
33
|
+
- `Combobox`: search with suggestions, case and accent insensitive, `aria-activedescendant` keyboard navigation.
|
|
34
|
+
- `FileInput` and `Dropzone`: native file input, drag and drop, validation by type, size and count, announced rejections; `formatBytes`, `acceptsFile` and `validateFiles` helpers.
|
|
35
|
+
- `Slider`: native range input filled with the accent, formatted and announced value.
|
|
36
|
+
- `DatePicker`: calendar dialog with full keyboard support, `Intl` month and day names, min and max dates.
|
|
37
|
+
|
|
38
|
+
### Data display
|
|
39
|
+
|
|
40
|
+
- `Avatar` and `AvatarGroup`: picture or initials, overlapping group with a counter.
|
|
41
|
+
- `Tag`: small label, accent tone, optional remove button.
|
|
42
|
+
- `Stat`: key figure in a large thin number, with its change.
|
|
43
|
+
- `Table`: captioned data table, sortable columns announced with `aria-sort`, keyboard-scrollable region.
|
|
44
|
+
- `Skeleton`, `Spinner` and `Progress`: loading placeholders, status spinner, determinate or indeterminate progress bar.
|
|
45
|
+
- `Kbd` and `Divider`: keyboard keys, hairlines with an optional label.
|
|
46
|
+
- `CodeBlock`: file tab and copy button; bring your own highlighting.
|
|
47
|
+
|
|
48
|
+
### Tooling
|
|
49
|
+
|
|
50
|
+
- Unit and accessibility tests (Vitest, Testing Library, axe) for every component.
|
|
51
|
+
- Label props that took a function (`moreLabel`, `pageLabel`, `charLabel`, `countLabel`, `removeLabel`, `rejectionLabel`) also accept string templates such as `"{count} more"`, usable from server components.
|
|
52
|
+
|
|
53
|
+
### Fixes
|
|
54
|
+
|
|
55
|
+
- Header dropdowns opened by hovering no longer close on the click that follows.
|
|
56
|
+
|
|
57
|
+
### Changes to note
|
|
58
|
+
|
|
59
|
+
- The `SiteHeader` mobile menu is now a `Drawer`: if you styled its panel through the internal `.trc-drawer` classes, use the new `.trc-layer` and `.trc-drawer` structure.
|
|
60
|
+
|
|
61
|
+
## 0.1.0
|
|
62
|
+
|
|
63
|
+
First public release.
|
|
64
|
+
|
|
65
|
+
- Design tokens as CSS variables prefixed with `--trc-`, with a single themable accent color.
|
|
66
|
+
- Typography: `Heading` with an accent word between asterisks, `Text`, `AccentText`, `plainText`, `StepNumber`.
|
|
67
|
+
- Pill buttons: `PillButton` and `PillLink`, with the stretching dot, a compact size, a solid variant and a loading state.
|
|
68
|
+
- Surfaces: `Card` (alt tone, interactive, watermark icon), `Section` (inset card), `Container`.
|
|
69
|
+
- Forms: `Field`, `Input`, `Textarea`, `Select`, `Checkbox`, `Switch`, wired for screen readers.
|
|
70
|
+
- Site chrome: `SiteHeader` (floating, dropdowns, accessible mobile panel) and `SiteFooter`.
|
|
71
|
+
- Heroes: `PageHero`, `HeroVideo` (crossfading videos, soft parallax) and `BackToTop`.
|
|
72
|
+
- ESM and CommonJS builds, TypeScript types, `"use client"` for the Next.js App Router.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aurel Agbado
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,127 @@
|
|
|
1
|
-
#
|
|
1
|
+
# trc ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React components with a deep black design: near-black backgrounds, graphite cards, thin headings, a single accent color and pill buttons whose dot stretches on hover.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/trc-ui)
|
|
6
|
+
[](https://github.com/aa404/trc-ui/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
- **Sober.** Near-black backgrounds, graphite cards, one accent color. Depth comes from shades of grey, not shadows.
|
|
9
|
+
- **Thin.** Light Montserrat headings carry the page, with one accent word per title.
|
|
10
|
+
- **Alive.** Pills that stretch, cards that wake up on hover, a header that blurs as you scroll.
|
|
11
|
+
- **Accessible.** Native form controls, labels and messages wired automatically, keyboard focus everywhere, reduced motion respected.
|
|
12
|
+
- **Light.** No runtime dependency besides React. One stylesheet, themable with CSS variables.
|
|
13
|
+
|
|
14
|
+
**Documentation and live demos: [ui.theringconcept.com](https://ui.theringconcept.com)**
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install trc-ui
|
|
20
|
+
# or
|
|
21
|
+
yarn add trc-ui
|
|
22
|
+
pnpm add trc-ui
|
|
23
|
+
bun add trc-ui
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
React 18 or later is required.
|
|
27
|
+
|
|
28
|
+
## Setup
|
|
29
|
+
|
|
30
|
+
Import the stylesheet once, at the root of your app, and add the `trc` class to `<body>`:
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import "trc-ui/styles.css";
|
|
34
|
+
|
|
35
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
36
|
+
return (
|
|
37
|
+
<html lang="en">
|
|
38
|
+
<body className="trc">{children}</body>
|
|
39
|
+
</html>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The design relies on [Montserrat](https://fonts.google.com/specimen/Montserrat) (weights 300, 400 and 500), which is not bundled. Load it, then point trc ui to it:
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
// Next.js
|
|
48
|
+
import { Montserrat } from "next/font/google";
|
|
49
|
+
|
|
50
|
+
const montserrat = Montserrat({ subsets: ["latin"], weight: ["300", "400", "500"], variable: "--font-montserrat" });
|
|
51
|
+
// <html className={montserrat.variable}>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```css
|
|
55
|
+
:root {
|
|
56
|
+
--trc-font: var(--font-montserrat), ui-sans-serif, system-ui, sans-serif;
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Without Next.js, a Google Fonts `<link>` is enough: trc ui uses `"Montserrat"` by default.
|
|
61
|
+
|
|
62
|
+
## Usage
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import { Heading, PillButton, Text } from "trc-ui";
|
|
66
|
+
|
|
67
|
+
export function Welcome() {
|
|
68
|
+
return (
|
|
69
|
+
<section>
|
|
70
|
+
<Heading as="h1" size="display">
|
|
71
|
+
Welcome to *deep black.*
|
|
72
|
+
</Heading>
|
|
73
|
+
<Text size="lg">The words between asterisks take the accent color.</Text>
|
|
74
|
+
<PillButton solid>Get started</PillButton>
|
|
75
|
+
</section>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Components
|
|
81
|
+
|
|
82
|
+
| Component | What it is |
|
|
83
|
+
| --- | --- |
|
|
84
|
+
| `Heading`, `Text`, `AccentText`, `StepNumber` | Thin headings with an accent word, body text, large thin step numbers. |
|
|
85
|
+
| `PillButton`, `PillLink` | The signature pill: a round accent dot that stretches to fill the pill on hover. |
|
|
86
|
+
| `Card`, `Section`, `Container` | Graphite cards (with an optional watermark icon), inset sections, centered containers. |
|
|
87
|
+
| `Field`, `Input`, `Textarea`, `Select` | Native controls; `Field` wires the label, hint and error for screen readers. |
|
|
88
|
+
| `Checkbox`, `Switch` | Native checkboxes, the switch announced as a switch. |
|
|
89
|
+
| `SiteHeader`, `SiteFooter` | Floating header with dropdowns and a mobile side panel; footer as a graphite card. |
|
|
90
|
+
| `PageHero`, `HeroVideo`, `BackToTop` | Photo and video heroes inset from the screen edges; a floating back-to-top button. |
|
|
91
|
+
|
|
92
|
+
## With a router
|
|
93
|
+
|
|
94
|
+
Links accept your router's link component: `as` on `PillLink` and `Card`, `linkAs` on `SiteHeader` and `SiteFooter`.
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import Link from "next/link";
|
|
98
|
+
import { PillLink, SiteHeader } from "trc-ui";
|
|
99
|
+
|
|
100
|
+
<PillLink as={Link} href="/pricing">See pricing</PillLink>
|
|
101
|
+
<SiteHeader linkAs={Link} logo={<Logo />} logoLabel="Home" nav={nav} />
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Components ship with the `"use client"` directive and work as-is in the Next.js App Router.
|
|
105
|
+
|
|
106
|
+
## Theming
|
|
107
|
+
|
|
108
|
+
Every color, radius and motion setting is a CSS variable prefixed with `--trc-`. Change the accent once:
|
|
109
|
+
|
|
110
|
+
```css
|
|
111
|
+
:root {
|
|
112
|
+
--trc-accent: #d41367;
|
|
113
|
+
--trc-on-accent: #ffffff; /* text on the accent: near black by default */
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Variables cascade, so you can also theme a single area: `<div style={{ "--trc-accent": "#d41367" }}>`.
|
|
118
|
+
|
|
119
|
+
The documentation includes a [colors generator](https://ui.theringconcept.com/docs/colors-generator/) that builds a 10-shade scale from your brand color, checks WCAG contrast on deep black and gives you the code.
|
|
120
|
+
|
|
121
|
+
## Browser support
|
|
122
|
+
|
|
123
|
+
trc ui uses `color-mix()` and `:has()`: Chrome and Edge 111+, Safari 16.2+, Firefox 121+.
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
[MIT](https://github.com/aa404/trc-ui/blob/main/LICENSE), by Aurel Agbado, [The Ring Concept](https://www.theringconcept.com/).
|