@pokela/components 2.5.0 → 2.5.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 +4 -4
- package/guidelines/components.md +49 -0
- package/guidelines/setup.md +10 -0
- package/guidelines/styles.md +34 -0
- package/guidelines/tokens.md +18 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +5 -3
- package/styles.css +1 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @pokela/components
|
|
2
2
|
|
|
3
|
-
React-komponentit: **Pokela Design System**, versio 2.5.
|
|
3
|
+
React-komponentit: **Pokela Design System**, versio 2.5.2.
|
|
4
4
|
|
|
5
5
|
> Generoitu hakemistosta `components/` — samoista tiedostoista joita sivusto
|
|
6
6
|
> ajaa. Älä muokkaa käsin: muutokset tehdään lähteeseen ja paketti
|
|
@@ -10,11 +10,11 @@ React-komponentit: **Pokela Design System**, versio 2.5.0.
|
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
12
|
import { ListRow, Icon, Accordion, Grid, Col, Reveal } from '@pokela/components';
|
|
13
|
-
import '@pokela/components/styles.css';
|
|
14
13
|
```
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
tarvita.
|
|
15
|
+
Tyylit, `@pokela/tokens`:n muuttujat ja fontit (Google Fonts) latautuvat
|
|
16
|
+
komponenttien mukana. Erillistä tuontia ei tarvita. Ilman bundleria
|
|
17
|
+
tyylit saa myös suoraan: `@pokela/components/styles.css`.
|
|
18
18
|
|
|
19
19
|
## Komponentit
|
|
20
20
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Components
|
|
2
|
+
|
|
3
|
+
Use these instead of building an equivalent.
|
|
4
|
+
|
|
5
|
+
<!-- generated:make-komponentit -->
|
|
6
|
+
- `Icon`, `ICON_NAMES`
|
|
7
|
+
- `ListRow`
|
|
8
|
+
- `Accordion`, `useAccordionGroup`
|
|
9
|
+
- `Timeline`, `TimelineItem`
|
|
10
|
+
- `Grid`, `Col`
|
|
11
|
+
- `Reveal`
|
|
12
|
+
- `ThemeScript`, `THEME_STORAGE_KEY`
|
|
13
|
+
- `ThemeToggle`
|
|
14
|
+
<!-- /generated -->
|
|
15
|
+
|
|
16
|
+
`ListRow` is the signature component. Use it for any list of items — a work
|
|
17
|
+
list, an index, a menu. Its three visual variants are modifiers on one row,
|
|
18
|
+
not separate components.
|
|
19
|
+
|
|
20
|
+
`ListRow` renders a plain `<a>`. In a router-based app, pass the router's link
|
|
21
|
+
component instead:
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
<ListRow as={Link} title="Work title" href="/work/example" />
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
To show a row as selected, use `className="invert"` — not a new colour.
|
|
28
|
+
|
|
29
|
+
`ListRow` already applies `bleed` itself. Do not pass it again in `className`.
|
|
30
|
+
|
|
31
|
+
`Accordion` is the same row as a `<button>`. Use it when the row expands
|
|
32
|
+
rather than navigates. Only one may be open at a time; `useAccordionGroup`
|
|
33
|
+
handles that.
|
|
34
|
+
|
|
35
|
+
`Timeline` is a vertical list of dated or timed items. Put `TimelineItem`s
|
|
36
|
+
inside it; the labels line up because they share the list's grid. Use
|
|
37
|
+
`variant="emphasis"` for the one item that matters most and `variant="end"`
|
|
38
|
+
for the last. `weight` (0–1) stretches an item's rail, e.g. by its share of
|
|
39
|
+
the total duration.
|
|
40
|
+
|
|
41
|
+
```jsx
|
|
42
|
+
<Timeline>
|
|
43
|
+
<TimelineItem label="0.00" title="Tokens" meta="under a second" />
|
|
44
|
+
<TimelineItem label="0.03" title="Images" meta="5 min 32 s" variant="emphasis" weight={0.9} />
|
|
45
|
+
<TimelineItem label="5.35" title="Site built" variant="end" />
|
|
46
|
+
</Timeline>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`Reveal` fades its children in on scroll. Wrap sections, not single elements.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Setup
|
|
2
|
+
|
|
3
|
+
Install **both** packages as direct dependencies, at the same, latest
|
|
4
|
+
version. `@pokela/components` uses the tokens of the same release.
|
|
5
|
+
|
|
6
|
+
Styles, tokens and typefaces load with the components. Do not import any stylesheet or add font
|
|
7
|
+
links yourself.
|
|
8
|
+
|
|
9
|
+
Component props are typed. Read them from the package — they are not repeated
|
|
10
|
+
in these guidelines, because a copy would go stale.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Styles
|
|
2
|
+
|
|
3
|
+
**Do not use Tailwind utility classes for design system values.** This system
|
|
4
|
+
is plain CSS: global classes that come with the components, and CSS variables
|
|
5
|
+
for values. Writing `bg-blue-500` or `rounded-lg` bypasses the system and
|
|
6
|
+
produces the wrong result.
|
|
7
|
+
|
|
8
|
+
## Headings
|
|
9
|
+
|
|
10
|
+
Typography classes set the look, not the meaning. A page heading is an `<h1>`,
|
|
11
|
+
a section heading an `<h2>`, and so on — never a `<p>` carrying a display
|
|
12
|
+
class. The class and the element are two separate decisions, and a screen
|
|
13
|
+
reader only hears the element.
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
<h1 className="display-xl">Selected work</h1>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Typography
|
|
20
|
+
|
|
21
|
+
Two families. `--font-display` (Bodoni Moda, a serif) is for display sizes
|
|
22
|
+
only — headings and the wordmark. `--font-ui` (Archivo) is for everything
|
|
23
|
+
else. Never set body text in the display face.
|
|
24
|
+
|
|
25
|
+
<!-- generated:make-painot -->**No font weight other than 400, 500 or 600.**<!-- /generated --> Only those are loaded, and
|
|
26
|
+
`font-synthesis-weight` is `none`, so any other weight silently renders wrong.
|
|
27
|
+
|
|
28
|
+
## Layout
|
|
29
|
+
|
|
30
|
+
<!-- generated:make-sarakkeet -->`Grid` is 12 columns: 4 on mobile, 8 from 600px, 12 from 900px.<!-- /generated --> Place
|
|
31
|
+
things in columns, never in pixels. `Col` takes the span per breakpoint.
|
|
32
|
+
|
|
33
|
+
**No icon libraries and no emoji.** Use `Icon`. <!-- generated:make-ikonit -->It draws its own 6 marks<!-- /generated --> on
|
|
34
|
+
a 16×16 grid with the same hairline as every border.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Tokens
|
|
2
|
+
|
|
3
|
+
Use CSS variables for every value: `var(--ink)`, `var(--space-24)`,
|
|
4
|
+
`var(--hairline)`. Never write a raw colour, length or font weight.
|
|
5
|
+
|
|
6
|
+
**No accent colour.** This system has none. Emphasis is a black and white
|
|
7
|
+
inversion — `--invert-surface` with `--invert-ink` — or the quiet
|
|
8
|
+
`--badge-surface`. Do not introduce a brand blue, a primary green, or any
|
|
9
|
+
coloured button. Colour on the page comes only from photographs.
|
|
10
|
+
|
|
11
|
+
**No shadows.** There are no shadow tokens. Separation is a 1px line
|
|
12
|
+
(`--hairline`), never elevation.
|
|
13
|
+
|
|
14
|
+
**No rounded corners.** `--radius` is `0`. Everything is square.
|
|
15
|
+
|
|
16
|
+
<!-- generated:make-valit -->**No spacing outside the scale.** 16 steps, each named by its value:<!-- /generated -->
|
|
17
|
+
`--space-24` is 24px. If a value is missing, use the nearest step rather than
|
|
18
|
+
inventing one.
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* @pokela/components — kokooma. Generoitu, ks. scripts/paketti-komponentit.mjs. */
|
|
2
|
+
import './styles.css';
|
|
2
3
|
export { default as Icon, ICON_NAMES } from './Icon.js';
|
|
3
4
|
export { default as ListRow } from './ListRow.js';
|
|
4
5
|
export { Accordion, useAccordionGroup } from './Accordion.js';
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pokela/components",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"description": "React-komponentit: Pokela Design System. Generoitu tiedostoista components/, ei käsin ylläpidetty.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Veli-Matti Pokela",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"sideEffects": [
|
|
9
|
-
"*.css"
|
|
9
|
+
"*.css",
|
|
10
|
+
"./index.js"
|
|
10
11
|
],
|
|
11
12
|
"exports": {
|
|
12
13
|
".": {
|
|
@@ -21,11 +22,12 @@
|
|
|
21
22
|
"*.d.ts",
|
|
22
23
|
"styles.css",
|
|
23
24
|
"styles/",
|
|
25
|
+
"guidelines/",
|
|
24
26
|
"README.md",
|
|
25
27
|
"LICENSE"
|
|
26
28
|
],
|
|
27
29
|
"dependencies": {
|
|
28
|
-
"@pokela/tokens": "^2.5.
|
|
30
|
+
"@pokela/tokens": "^2.5.2"
|
|
29
31
|
},
|
|
30
32
|
"peerDependencies": {
|
|
31
33
|
"react": ">=18"
|
package/styles.css
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* @pokela/components — kaikki tyylit. Järjestys on merkitsevä. */
|
|
2
|
+
@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600&family=Bodoni+Moda:wght@400;500&display=swap');
|
|
2
3
|
@import '@pokela/tokens/tokens.css';
|
|
3
4
|
@import './styles/base.css';
|
|
4
5
|
@import './styles/icon.css';
|