@pokela/components 2.4.1 → 2.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @pokela/components
2
2
 
3
- React-komponentit: **Pokela Design System**, versio 2.4.1.
3
+ React-komponentit: **Pokela Design System**, versio 2.5.0.
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
@@ -21,6 +21,7 @@ tarvita.
21
21
  - `Icon`
22
22
  - `ListRow`
23
23
  - `Accordion`
24
+ - `Timeline`
24
25
  - `Grid`
25
26
  - `Reveal`
26
27
  - `ThemeScript`
@@ -43,6 +44,7 @@ import Link from 'next/link';
43
44
  - **Nav, Footer** — tarvitsevat sivuston sanakirjan ja reitityksen
44
45
  - **BeforeAfter, Video** — rakentuvat Median varaan, ja Media lukee kuvamanifestia
45
46
  - **HeroName** — piirtää sivuston omaa nimeä fontin ääriviivoista (`@/content/nimi.generated.json`)
47
+ - **HeroIntro, HeroIntroLiike** — ovat etusivun intro: sivuston ominaisuus, ei design systemin osa
46
48
  - **ComponentView, PrintCv** — ovat riippumattomia mutta sivuston ominaisuuksia — lähdekoodinäkymä ja CV:n tulostusasu — eivät design systemin osia
47
49
 
48
50
  ## Tyylit
@@ -51,6 +53,7 @@ import Link from 'next/link';
51
53
  - `styles/icon.css`
52
54
  - `styles/list-row.css`
53
55
  - `styles/accordion.css`
56
+ - `styles/timeline.css`
54
57
 
55
58
  Luokat ovat globaaleja, eivät CSS-moduuleja. Se on tarkoituksellista: sama
56
59
  luokka on myös Figmassa komponentin nimenä, ja hajautettu nimi katkaisisi
package/Timeline.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * Aikajana.
4
+ * ---------------------------------------------------------------
5
+ * Pystysuora jana: vasemmalla merkintä (aika, päivä, numero), keskellä
6
+ * kisko ja piste, oikealla otsikko, sivutieto ja kuvaus. Merkintä,
7
+ * kisko ja sisältö ovat listan ruudukon sarakkeita, jotta merkinnät
8
+ * asettuvat samaan linjaan; siksi `TimelineItem` piirretään aina
9
+ * `Timeline`-listan sisällä.
10
+ *
11
+ * `variant`:
12
+ * default ohut kisko, ontto piste
13
+ * emphasis paksu kisko ja täytetty piste: nostettu kohta
14
+ * end kisko päättyy pisteeseen: viimeinen kohta
15
+ *
16
+ * `weight` (0–1) venyttää kohdan kiskoa. Sillä pitkä vaihe näkyy jo
17
+ * pituudestaan, esimerkiksi keston osuutena koko ajasta.
18
+ */
19
+ export default function Timeline({ children, className }: {
20
+ children: ReactNode;
21
+ className?: string;
22
+ }): import("react/jsx-runtime").JSX.Element;
23
+ export type TimelineVariant = 'default' | 'emphasis' | 'end';
24
+ export declare function TimelineItem({ label, title, meta, description, group, variant, weight, }: {
25
+ label: string;
26
+ title: string;
27
+ meta?: string | null;
28
+ description?: string | null;
29
+ group?: string | null;
30
+ variant?: TimelineVariant;
31
+ weight?: number;
32
+ }): import("react/jsx-runtime").JSX.Element;
package/Timeline.js ADDED
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Aikajana.
4
+ * ---------------------------------------------------------------
5
+ * Pystysuora jana: vasemmalla merkintä (aika, päivä, numero), keskellä
6
+ * kisko ja piste, oikealla otsikko, sivutieto ja kuvaus. Merkintä,
7
+ * kisko ja sisältö ovat listan ruudukon sarakkeita, jotta merkinnät
8
+ * asettuvat samaan linjaan; siksi `TimelineItem` piirretään aina
9
+ * `Timeline`-listan sisällä.
10
+ *
11
+ * `variant`:
12
+ * default ohut kisko, ontto piste
13
+ * emphasis paksu kisko ja täytetty piste: nostettu kohta
14
+ * end kisko päättyy pisteeseen: viimeinen kohta
15
+ *
16
+ * `weight` (0–1) venyttää kohdan kiskoa. Sillä pitkä vaihe näkyy jo
17
+ * pituudestaan, esimerkiksi keston osuutena koko ajasta.
18
+ */
19
+ export default function Timeline({ children, className }) {
20
+ return _jsx("ol", { className: ['timeline', className].filter(Boolean).join(' '), children: children });
21
+ }
22
+ export function TimelineItem({ label, title, meta, description, group, variant = 'default', weight = 0, }) {
23
+ return (_jsxs("li", { className: ['timeline__item', variant === 'default' ? '' : `timeline__item--${variant}`].join(' '), style: { '--weight': weight.toFixed(3) }, children: [_jsx("span", { className: "meta faint timeline__label", children: label }), _jsx("span", { className: "timeline__rail", "aria-hidden": "true" }), _jsxs("span", { className: "timeline__body", children: [group ? _jsx("span", { className: "meta faint", children: group }) : null, _jsxs("span", { className: "timeline__head", children: [_jsx("span", { className: "body-l", children: title }), meta ? _jsx("span", { className: "meta faint", children: meta }) : null] }), description ? _jsx("span", { className: "body-s muted", children: description }) : null] })] }));
24
+ }
package/index.d.ts CHANGED
@@ -4,6 +4,8 @@ export { default as ListRow } from './ListRow.js';
4
4
  export type { ListRowProps } from './ListRow.js';
5
5
  export { Accordion, useAccordionGroup } from './Accordion.js';
6
6
  export type { AccordionProps } from './Accordion.js';
7
+ export { default as Timeline, TimelineItem } from './Timeline.js';
8
+ export type { TimelineVariant } from './Timeline.js';
7
9
  export { Grid, Col } from './Grid.js';
8
10
  export { default as Reveal } from './Reveal.js';
9
11
  export { default as ThemeScript, THEME_STORAGE_KEY } from './ThemeScript.js';
package/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  export { default as Icon, ICON_NAMES } from './Icon.js';
3
3
  export { default as ListRow } from './ListRow.js';
4
4
  export { Accordion, useAccordionGroup } from './Accordion.js';
5
+ export { default as Timeline, TimelineItem } from './Timeline.js';
5
6
  export { Grid, Col } from './Grid.js';
6
7
  export { default as Reveal } from './Reveal.js';
7
8
  export { default as ThemeScript, THEME_STORAGE_KEY } from './ThemeScript.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pokela/components",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
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",
@@ -25,7 +25,7 @@
25
25
  "LICENSE"
26
26
  ],
27
27
  "dependencies": {
28
- "@pokela/tokens": "^2.4.1"
28
+ "@pokela/tokens": "^2.5.0"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": ">=18"
@@ -0,0 +1,39 @@
1
+ /* Aikajana (components/Timeline.tsx). Merkintä, kisko ja sisältö ovat
2
+ listan ruudukon sarakkeita, jotta merkinnät asettuvat samaan
3
+ linjaan; kohta itse on display: contents. Kisko venyy kohdan
4
+ painon mukaan (--weight): pitkä vaihe näkyy jo pituudestaan. */
5
+ .timeline {
6
+ display: grid;
7
+ grid-template-columns: max-content var(--space-16) minmax(0, 1fr);
8
+ column-gap: var(--space-16);
9
+ margin: 0; padding: 0; list-style: none;
10
+ }
11
+ .timeline__item { display: contents; }
12
+ .timeline__label { text-align: right; font-variant-numeric: tabular-nums; }
13
+ .timeline__rail { position: relative; }
14
+ .timeline__rail::before {
15
+ content: ''; position: absolute; top: 0; bottom: 0;
16
+ left: calc(50% - var(--hairline) / 2);
17
+ border-left: var(--hairline) solid var(--line);
18
+ }
19
+ .timeline__rail::after {
20
+ content: ''; position: absolute; top: var(--space-4);
21
+ left: calc(50% - var(--space-4));
22
+ width: var(--space-8); height: var(--space-8);
23
+ border-radius: 50%;
24
+ border: var(--hairline) solid var(--ink);
25
+ background: var(--paper);
26
+ }
27
+ .timeline__body {
28
+ display: flex; flex-direction: column; gap: var(--space-4);
29
+ padding-bottom: calc(var(--space-24) + var(--space-56) * 4 * var(--weight, 0));
30
+ }
31
+ .timeline__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-16); }
32
+ .timeline__item--emphasis .timeline__rail::before {
33
+ left: calc(50% - var(--hairline-strong) / 2);
34
+ border-left: var(--hairline-strong) solid var(--ink);
35
+ }
36
+ .timeline__item--emphasis .timeline__rail::after { background: var(--ink); }
37
+ .timeline__item--end .timeline__rail::before { bottom: auto; height: var(--space-4); }
38
+ .timeline__item--end .timeline__rail::after { background: var(--ink); }
39
+ .timeline__item--end .timeline__body { padding-bottom: 0; }
package/styles.css CHANGED
@@ -4,3 +4,4 @@
4
4
  @import './styles/icon.css';
5
5
  @import './styles/list-row.css';
6
6
  @import './styles/accordion.css';
7
+ @import './styles/timeline.css';