@six-vallees/ui-react 0.1.0 → 0.1.1

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.
Files changed (70) hide show
  1. package/README.md +54 -0
  2. package/dist/button/button.d.ts +23 -0
  3. package/dist/button/button.js +10 -0
  4. package/dist/button/button.js.map +1 -0
  5. package/dist/charts/area-chart.d.ts +27 -0
  6. package/dist/charts/area-chart.js +9 -0
  7. package/dist/charts/area-chart.js.map +1 -0
  8. package/dist/charts/bar-chart.d.ts +29 -0
  9. package/dist/charts/bar-chart.js +10 -0
  10. package/dist/charts/bar-chart.js.map +1 -0
  11. package/dist/charts/lib/path.d.ts +4 -0
  12. package/dist/charts/lib/path.js +7 -0
  13. package/dist/charts/lib/path.js.map +1 -0
  14. package/dist/charts/lib/series.d.ts +31 -0
  15. package/dist/charts/lib/series.js +17 -0
  16. package/dist/charts/lib/series.js.map +1 -0
  17. package/dist/charts/ring.d.ts +43 -0
  18. package/dist/charts/ring.js +10 -0
  19. package/dist/charts/ring.js.map +1 -0
  20. package/dist/charts/segmented-bar.d.ts +34 -0
  21. package/dist/charts/segmented-bar.js +9 -0
  22. package/dist/charts/segmented-bar.js.map +1 -0
  23. package/dist/charts/sparkline.d.ts +19 -0
  24. package/dist/charts/sparkline.js +9 -0
  25. package/dist/charts/sparkline.js.map +1 -0
  26. package/dist/charts/stat.d.ts +22 -0
  27. package/dist/charts/stat.js +8 -0
  28. package/dist/charts/stat.js.map +1 -0
  29. package/dist/chunk-35UH66I7.js +28 -0
  30. package/dist/chunk-35UH66I7.js.map +1 -0
  31. package/dist/chunk-DXRY7AS4.js +11 -0
  32. package/dist/chunk-DXRY7AS4.js.map +1 -0
  33. package/dist/chunk-GD6IYLWY.js +30 -0
  34. package/dist/chunk-GD6IYLWY.js.map +1 -0
  35. package/dist/chunk-I2PXLL75.js +41 -0
  36. package/dist/chunk-I2PXLL75.js.map +1 -0
  37. package/dist/chunk-LKIXZUNS.js +38 -0
  38. package/dist/chunk-LKIXZUNS.js.map +1 -0
  39. package/dist/chunk-N5ZJZ7I3.js +18 -0
  40. package/dist/chunk-N5ZJZ7I3.js.map +1 -0
  41. package/dist/chunk-NYHHTSX4.js +69 -0
  42. package/dist/chunk-NYHHTSX4.js.map +1 -0
  43. package/dist/chunk-RV75OH74.js +81 -0
  44. package/dist/chunk-RV75OH74.js.map +1 -0
  45. package/dist/chunk-SC5A4Q7G.js +89 -0
  46. package/dist/chunk-SC5A4Q7G.js.map +1 -0
  47. package/dist/chunk-T7ESUAJU.js +14 -0
  48. package/dist/chunk-T7ESUAJU.js.map +1 -0
  49. package/dist/chunk-UM6DTEFE.js +50 -0
  50. package/dist/chunk-UM6DTEFE.js.map +1 -0
  51. package/dist/chunk-YE4P3T6M.js +97 -0
  52. package/dist/chunk-YE4P3T6M.js.map +1 -0
  53. package/dist/chunk-YSUYAW4O.js +26 -0
  54. package/dist/chunk-YSUYAW4O.js.map +1 -0
  55. package/dist/icon/icon.d.ts +30 -0
  56. package/dist/icon/icon.js +8 -0
  57. package/dist/icon/icon.js.map +1 -0
  58. package/dist/index.d.ts +15 -257
  59. package/dist/index.js +59 -437
  60. package/dist/index.js.map +1 -1
  61. package/dist/lib/utils.d.ts +6 -0
  62. package/dist/lib/utils.js +7 -0
  63. package/dist/lib/utils.js.map +1 -0
  64. package/dist/logo/logo-mark.d.ts +15 -0
  65. package/dist/logo/logo-mark.js +7 -0
  66. package/dist/logo/logo-mark.js.map +1 -0
  67. package/dist/logo/logo.d.ts +16 -0
  68. package/dist/logo/logo.js +7 -0
  69. package/dist/logo/logo.js.map +1 -0
  70. package/package.json +10 -5
package/dist/index.d.ts CHANGED
@@ -1,257 +1,15 @@
1
- import * as class_variance_authority_types from 'class-variance-authority/types';
2
- import * as React from 'react';
3
- import { VariantProps } from 'class-variance-authority';
4
- import { Icon as Icon$1, IconWeight } from '@phosphor-icons/react';
5
-
6
- /**
7
- * Cairn Button. Consumes the design tokens through the Tailwind bridge
8
- * (bg-primary, rounded-control, …), install the Cairn theme in the target project.
9
- */
10
- declare const buttonVariants: (props?: ({
11
- variant?: "primary" | "secondary" | "ghost" | "danger" | null | undefined;
12
- size?: "sm" | "md" | "lg" | null | undefined;
13
- } & class_variance_authority_types.ClassProp) | undefined) => string;
14
- interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
15
- /** Visual style of the button. */
16
- variant?: 'primary' | 'secondary' | 'ghost' | 'danger';
17
- /** Control height and padding. */
18
- size?: 'sm' | 'md' | 'lg';
19
- /** Render as the child element (e.g. an `<a>`) instead of a `<button>`. */
20
- asChild?: boolean;
21
- }
22
- declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
23
-
24
- declare const SIZES: {
25
- readonly sm: 16;
26
- readonly md: 20;
27
- readonly lg: 24;
28
- readonly xl: 32;
29
- };
30
- interface IconProps {
31
- /** The Phosphor icon to render, e.g. `House`. */
32
- icon: Icon$1;
33
- /** Preset size (sm 16 · md 20 · lg 24 · xl 32) or a raw pixel value. */
34
- size?: keyof typeof SIZES | number;
35
- /** Stroke weight. `fill` marks a selected/active state. */
36
- weight?: IconWeight;
37
- /** Accessible label. Omit for decorative icons, they render `aria-hidden`. */
38
- label?: string;
39
- className?: string;
40
- }
41
- /**
42
- * Cairn Icon, a thin wrapper over Phosphor. Standardises size and weight, and makes
43
- * accessibility the default: decorative unless a `label` is given.
44
- */
45
- declare function Icon({ icon: Glyph, size, weight, label, className }: IconProps): React.JSX.Element;
46
- declare namespace Icon {
47
- var displayName: string;
48
- }
49
-
50
- interface LogoProps extends React.SVGProps<SVGSVGElement> {
51
- /** Accessible name. Pass an empty string for a purely decorative logo. */
52
- title?: string;
53
- }
54
- /**
55
- * Six Vallées wordmark. Colour follows `currentColor`, set it via `text-*` / CSS `color`.
56
- * Size it with `className` (e.g. `h-6 w-auto`).
57
- */
58
- declare function Logo({ title, className, ...props }: LogoProps): React.JSX.Element;
59
- declare namespace Logo {
60
- var displayName: string;
61
- }
62
-
63
- interface LogoMarkProps extends React.SVGProps<SVGSVGElement> {
64
- /** Accessible name. Pass an empty string for a purely decorative mark. */
65
- title?: string;
66
- }
67
- /**
68
- * Six Vallées symbol (compact mark). Colour follows `currentColor`; size with `className`.
69
- */
70
- declare function LogoMark({ title, className, ...props }: LogoMarkProps): React.JSX.Element;
71
- declare namespace LogoMark {
72
- var displayName: string;
73
- }
74
-
75
- interface SparklineProps {
76
- /** The series of values. */
77
- data: number[];
78
- width?: number;
79
- height?: number;
80
- /** `line` or filled `area`. */
81
- type?: 'line' | 'area';
82
- strokeWidth?: number;
83
- className?: string;
84
- }
85
- /** Cairn Sparkline, a compact, axis-less trend line. Colour follows currentColor. */
86
- declare function Sparkline({ data, width, height, type, strokeWidth, className }: SparklineProps): React.JSX.Element | null;
87
- declare namespace Sparkline {
88
- var displayName: string;
89
- }
90
-
91
- interface AreaChartProps {
92
- /** Values, or `{ label, value }` points. */
93
- data: (number | {
94
- label?: string;
95
- value: number;
96
- })[];
97
- height?: number;
98
- /** Index of the point to mark with a guideline + callout. */
99
- markerIndex?: number;
100
- markerLabel?: string;
101
- className?: string;
102
- }
103
- /**
104
- * Cairn AreaChart, a smooth line with a flat fill. Colour follows `currentColor`.
105
- * Zero-dependency SVG: renders server-side (Astro-safe), no client JS. The horizontal
106
- * axis stretches to the container (non-scaling strokes keep the line crisp); the marker
107
- * dot + callout are HTML overlays so they never distort. An interactive tier (hover
108
- * tooltips) belongs to the visx layer, this is the static SSR tier.
109
- */
110
- declare function AreaChart({ data, height, markerIndex, markerLabel, className }: AreaChartProps): React.JSX.Element | null;
111
- declare namespace AreaChart {
112
- var displayName: string;
113
- }
114
-
115
- interface BarDatum {
116
- label: string;
117
- value: number;
118
- /** Highlight this bar (ink) and show its value by default. */
119
- active?: boolean;
120
- }
121
- interface BarChartProps {
122
- data: BarDatum[];
123
- height?: number;
124
- showValue?: boolean;
125
- /** Colour of the promoted bar. Defaults to ink; `accent` uses the categorical blue. */
126
- tone?: 'ink' | 'accent';
127
- className?: string;
128
- }
129
- /**
130
- * Cairn BarChart, grayscale-first: muted neutral bars, the active bar promoted to ink
131
- * (or the categorical blue via `tone="accent"`) with a value pill. Interactive: hover any
132
- * bar to promote it and reveal its value. Colours resolve from `sys.chart.*` tokens, so a
133
- * theme swap recolours the chart for free.
134
- */
135
- declare function BarChart({ data, height, showValue, tone, className }: BarChartProps): React.JSX.Element;
136
- declare namespace BarChart {
137
- var displayName: string;
138
- }
139
-
140
- interface StatProps {
141
- /** The metric, pre-formatted (e.g. "3,484" or "118 lbs"). */
142
- value: string;
143
- label?: string;
144
- /** Change indicator. `tone` colours it (success / error / neutral). */
145
- delta?: {
146
- value: string;
147
- tone?: 'success' | 'error' | 'neutral';
148
- };
149
- /** Trailing visual, e.g. a `<Sparkline />`. */
150
- children?: React.ReactNode;
151
- className?: string;
152
- }
153
- /** Cairn Stat, a metric with an optional coloured delta and a trailing sparkline. */
154
- declare function Stat({ value, label, delta, children, className }: StatProps): React.JSX.Element;
155
- declare namespace Stat {
156
- var displayName: string;
157
- }
158
-
159
- interface RingProps {
160
- /** Progress, 0-100. */
161
- value: number;
162
- /** Outer diameter in px. */
163
- size?: number;
164
- /** Ring thickness in px. */
165
- thickness?: number;
166
- /** Colour of the filled arc. Defaults to ink; `accent` uses categorical blue. */
167
- tone?: 'ink' | 'accent';
168
- /**
169
- * Explicit arc colour (a token / CSS colour), overrides `tone`. Pass only colours that
170
- * clear 3:1 against the surface as a thin stroke, ink, blue, or a dark graphite. Acid
171
- * and mid-gray are fill-only (they fail as a line); see AGENTS.md rule 9.
172
- */
173
- color?: string;
174
- /**
175
- * Draw a darker keyline under the arc so a light, low-contrast colour (acid) stays
176
- * perceptible, the rim carries the 3:1 shape contrast the fill can't (AGENTS.md rule 9).
177
- * `true` uses ink; pass a colour (e.g. `sys.color.accent-edge`) for a tonal, in-family rim.
178
- */
179
- casing?: boolean | string;
180
- /** Fill the arc from empty on mount. Honours `prefers-reduced-motion`. */
181
- animate?: boolean;
182
- /** Centre content, e.g. the value. Omit for a bare ring. */
183
- children?: React.ReactNode;
184
- /** Accessible label; falls back to "<value>%". */
185
- 'aria-label'?: string;
186
- className?: string;
187
- }
188
- /**
189
- * Cairn Ring, single-value radial progress. Grayscale by default (ink arc on a
190
- * neutral track); `tone="accent"` opts into the categorical blue, or pass an explicit
191
- * `color`. The arc fills from empty on mount (rounded cap, 12 o'clock, clockwise).
192
- * Zero-dependency SVG, renders server-side (Astro-safe).
193
- */
194
- declare function Ring({ value, size, thickness, tone, color, casing, animate, children, className, 'aria-label': ariaLabel, }: RingProps): React.JSX.Element;
195
- declare namespace Ring {
196
- var displayName: string;
197
- }
198
-
199
- interface Segment {
200
- label: string;
201
- value: number;
202
- /** Pull this segment forward (ink) and others recede. */
203
- active?: boolean;
204
- }
205
- interface SegmentedBarProps {
206
- data: Segment[];
207
- /** Bar thickness in px. */
208
- height?: number;
209
- /**
210
- * How segments get colour:
211
- * - `mono` (default): grayscale, active segment is ink, the rest are muted tints.
212
- * - `categorical`: the capped unordered palette (≤4 meaningful categories).
213
- * - `sequential`: single-hue magnitude ramp, in data order.
214
- */
215
- scale?: 'mono' | 'categorical' | 'sequential';
216
- /** Show the label + value row beneath the bar. */
217
- showLegend?: boolean;
218
- className?: string;
219
- }
220
- /**
221
- * Cairn SegmentedBar, a single horizontal bar split into labelled parts (a share-of-total
222
- * / stacked bar). Grayscale by default; hue is opt-in via `scale`. Every segment carries a
223
- * text label + value, so meaning never rests on colour alone (WCAG-safe). Zero-dependency.
224
- */
225
- declare function SegmentedBar({ data, height, scale, showLegend, className }: SegmentedBarProps): React.JSX.Element;
226
- declare namespace SegmentedBar {
227
- var displayName: string;
228
- }
229
-
230
- /**
231
- * Cairn data-viz colour, the single place a series gets a colour.
232
- *
233
- * Rule: grayscale first. A single series is `ink`; a comparison series is `muted`.
234
- * Reach for hue only when categories are genuinely unordered (`categorical`, capped
235
- * at 4) or encode magnitude (`sequential`, single-hue). Never hand-pick a hex, every
236
- * value here is a `sys.chart.*` token resolved at runtime via its CSS variable, so a
237
- * theme swap (light↔dark) recolours the charts for free.
238
- */
239
- /** Semantic chart roles → their CSS variable. */
240
- declare const chartToken: {
241
- readonly ink: "var(--sv-sys-chart-ink)";
242
- readonly muted: "var(--sv-sys-chart-muted)";
243
- readonly grid: "var(--sv-sys-chart-grid)";
244
- readonly axis: "var(--sv-sys-chart-axis)";
245
- readonly track: "var(--sv-sys-chart-track)";
246
- };
247
- declare const CATEGORICAL_MAX: 4;
248
- /** Colour for category `i` (0-based). Wraps past the cap, pair with a label/pattern. */
249
- declare function categorical(i: number): string;
250
- /** WCAG-AA foreground for text drawn on `categorical(i)`. */
251
- declare function categoricalOn(i: number): string;
252
- /** Colour for the `i`-th of `n` steps on the single-hue magnitude ramp. */
253
- declare function sequential(i: number, n: number): string;
254
- /** WCAG-AA foreground for text drawn on `sequential(i, n)`. */
255
- declare function sequentialOn(i: number, n: number): string;
256
-
257
- export { AreaChart, type AreaChartProps, BarChart, type BarChartProps, type BarDatum, Button, type ButtonProps, CATEGORICAL_MAX, Icon, type IconProps, Logo, LogoMark, type LogoMarkProps, type LogoProps, Ring, type RingProps, type Segment, SegmentedBar, type SegmentedBarProps, Sparkline, type SparklineProps, Stat, type StatProps, buttonVariants, categorical, categoricalOn, chartToken, sequential, sequentialOn };
1
+ export { Button, ButtonProps, buttonVariants } from './button/button.js';
2
+ export { Icon, IconProps } from './icon/icon.js';
3
+ export { Logo, LogoProps } from './logo/logo.js';
4
+ export { LogoMark, LogoMarkProps } from './logo/logo-mark.js';
5
+ export { Sparkline, SparklineProps } from './charts/sparkline.js';
6
+ export { AreaChart, AreaChartProps } from './charts/area-chart.js';
7
+ export { BarChart, BarChartProps, BarDatum } from './charts/bar-chart.js';
8
+ export { Stat, StatProps } from './charts/stat.js';
9
+ export { Ring, RingProps } from './charts/ring.js';
10
+ export { Segment, SegmentedBar, SegmentedBarProps } from './charts/segmented-bar.js';
11
+ export { CATEGORICAL_MAX, categorical, categoricalOn, chartToken, sequential, sequentialOn } from './charts/lib/series.js';
12
+ import 'class-variance-authority/types';
13
+ import 'react';
14
+ import 'class-variance-authority';
15
+ import '@phosphor-icons/react';