@santi020k/lumen-react 0.3.0 → 1.0.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
@@ -17,6 +17,10 @@ Load the shared stylesheet once from your app entry or global CSS.
17
17
  import '@santi020k/lumen-react/styles.css'
18
18
  ```
19
19
 
20
+ The stylesheet defaults `--ui-font` to `"Montserrat", "Avenir Next", "Segoe UI", sans-serif`.
21
+ It declares the family stack but does not bundle or load font files. Load Montserrat once through
22
+ your preferred delivery path, or override `--ui-font` in application CSS.
23
+
20
24
  ## Usage
21
25
 
22
26
  ```tsx
@@ -33,6 +37,63 @@ export function SubscribeForm() {
33
37
  }
34
38
  ```
35
39
 
40
+ ## Forms
41
+
42
+ `Form`, `Field`, `Label`, `FieldError`, and `ErrorSummary` provide the presentation and
43
+ accessibility contract without replacing form state. Native-backed controls forward refs to their
44
+ submitted DOM controls and work directly with React Hook Form's `register()`.
45
+
46
+ For controlled composites, install the optional adapter:
47
+
48
+ ```bash
49
+ pnpm add @santi020k/lumen-react-hook-form react-hook-form
50
+ ```
51
+
52
+ It exports adapters for `Select`, `DatePicker`, `InputOTP`, and `ListBox`. React Hook Form owns
53
+ validation, dirty/touched state, and submission state in this mode; do not also mount
54
+ `useFormValidation` unless two validation sources are intentional.
55
+
56
+ See the [forms guide](https://lumen.santi020k.com/docs/forms/react-hook-form) for typed examples.
57
+
58
+ For long articles, `Anchor` accepts optional `depth`, `index`, and `description` metadata plus an
59
+ `activationOffset`. It synchronizes the current link on click and scroll. `ScrollProgress` tracks
60
+ the document without requiring a separate hook.
61
+
62
+ ```tsx
63
+ import { Anchor, ScrollProgress } from '@santi020k/lumen-react'
64
+
65
+ <ScrollProgress aria-label="Article reading progress" />
66
+ <Anchor items={[
67
+ { depth: 2, href: '#install', label: 'Install' },
68
+ { depth: 3, href: '#react', label: 'React' }
69
+ ]} />
70
+ ```
71
+
72
+ Use `CopyButton` for clipboard actions on generated names, descriptions, messages, and links. Pass
73
+ either a `value` or a `target` selector; `toast` opts into Lumen Toast feedback.
74
+
75
+ ```tsx
76
+ <CopyButton value="https://lumen.santi020k.com" toast>Copy link</CopyButton>
77
+ ```
78
+
79
+ ## Data visualization
80
+
81
+ `Sparkline`, `BarChart`, `LineChart`, and `PieChart` use the shared `LumenChartSeries` contract and
82
+ render without an external charting dependency. Data charts expose a revealable semantic table by
83
+ default. `PieChart` accepts one series and defaults to a donut presentation.
84
+
85
+ ```tsx
86
+ import { LineChart } from '@santi020k/lumen-react'
87
+
88
+ const series = [{
89
+ id: 'views',
90
+ label: 'Views',
91
+ data: [{ x: 'Mon', y: 42 }, { x: 'Tue', y: 68 }]
92
+ }]
93
+
94
+ <LineChart aria-label="Views by day" heading="Website traffic" series={series} />
95
+ ```
96
+
36
97
  ## Next.js and server components
37
98
 
38
99
  The package entry is marked as a client module because the full catalog includes stateful
@@ -60,23 +121,29 @@ Other React applications continue to consume the same package and exports normal
60
121
  ## Compatibility wrappers
61
122
 
62
123
  The common wrapper primitives preserve their underlying DOM handles with React 19's ref-as-prop
63
- contract. `Button`, `Link`, `ButtonLink`, and `Input` accept `ref` directly. Use `Button asChild`
64
- to apply the button contract to one existing React element without adding another DOM node:
124
+ contract. `Button`, `ButtonLink`, `Link`, `Input`, `Textarea`, `Label`, `Badge`, `Card`, and
125
+ `Skeleton` accept `ref` directly. Use `Button asChild` or `ButtonLink asChild` to apply the
126
+ corresponding contract to one existing React element without adding another DOM node:
65
127
 
66
128
  ```tsx
67
- import { Button } from '@santi020k/lumen-react'
129
+ import { Button, ButtonLink, NativeSelect } from '@santi020k/lumen-react'
68
130
  import NextLink from 'next/link'
69
131
 
70
132
  <Button asChild variant="secondary">
71
133
  <NextLink href="/projects">Projects</NextLink>
72
134
  </Button>
135
+
136
+ <ButtonLink asChild variant="ghost">
137
+ <NextLink href="/docs">Docs</NextLink>
138
+ </ButtonLink>
73
139
  ```
74
140
 
75
- `Input` keeps the native numeric `size` attribute. Use `visualSize="sm"` or `visualSize="lg"` for
76
- Lumen's visual size modifiers:
141
+ `Input` and `NativeSelect` keep the native numeric `size` attribute. Use `visualSize="sm"` or
142
+ `visualSize="lg"` for Lumen's visual size modifiers:
77
143
 
78
144
  ```tsx
79
145
  <Input size={32} visualSize="sm" />
146
+ <NativeSelect size={8} visualSize="lg" />
80
147
  ```
81
148
 
82
149
  Use `Icon` for Lucide icons by name across framework adapters.
@@ -176,3 +243,17 @@ Load `@santi020k/lumen-react/styles.css` once in your app, then use the shared g
176
243
  <DatePicker glass="subtle" />
177
244
  <Select glass="strong" options={['Astro', 'React']} />
178
245
  ```
246
+
247
+ ## Semantic stat roots
248
+
249
+ `Stat` renders a `div` by default. Use `as="article"` when the metric and its supporting content
250
+ form a standalone item, or `as="section"` when it is a labeled region in a larger view.
251
+
252
+ ```tsx
253
+ <Stat as="article" label="Active workspaces" value="1,234" variant="accent">
254
+ <p>Across all production organizations.</p>
255
+ </Stat>
256
+ ```
257
+
258
+ Use `variant="default"` for the original neutral surface, `variant="accent"` for a featured metric,
259
+ or `variant="glass"` for selective translucency.