@wealth-os/design-system 0.0.0-stage → 0.2.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/LICENSE +201 -0
  3. package/README.md +89 -2
  4. package/dist/button-yvMc7CT-.js +47 -0
  5. package/dist/charts.d.ts +138 -0
  6. package/dist/charts.js +712 -0
  7. package/dist/command-menu.d.ts +3 -0
  8. package/dist/command-menu.js +53 -0
  9. package/dist/components/advanced-controls.d.ts +145 -0
  10. package/dist/components/badge.d.ts +9 -0
  11. package/dist/components/button-group.d.ts +15 -0
  12. package/dist/components/button.d.ts +14 -0
  13. package/dist/components/command-menu.d.ts +42 -0
  14. package/dist/components/data-display.d.ts +100 -0
  15. package/dist/components/data-table.d.ts +113 -0
  16. package/dist/components/date-input.d.ts +36 -0
  17. package/dist/components/date-range-picker.d.ts +23 -0
  18. package/dist/components/field.d.ts +18 -0
  19. package/dist/components/financial.d.ts +83 -0
  20. package/dist/components/form.d.ts +8 -0
  21. package/dist/components/icon-button.d.ts +11 -0
  22. package/dist/components/icons.d.ts +9 -0
  23. package/dist/components/navigation.d.ts +53 -0
  24. package/dist/components/notice.d.ts +11 -0
  25. package/dist/components/number-input.d.ts +44 -0
  26. package/dist/components/overlays.d.ts +91 -0
  27. package/dist/components/select-menu.d.ts +27 -0
  28. package/dist/components/select.d.ts +23 -0
  29. package/dist/components/status-badge.d.ts +9 -0
  30. package/dist/components/surface.d.ts +16 -0
  31. package/dist/components/text-input.d.ts +8 -0
  32. package/dist/components/textarea.d.ts +7 -0
  33. package/dist/components/validation-message.d.ts +8 -0
  34. package/dist/data-display-BA7t1E4G.js +278 -0
  35. package/dist/data-table.d.ts +2 -0
  36. package/dist/data-table.js +346 -0
  37. package/dist/financial.d.ts +1 -0
  38. package/dist/financial.js +178 -0
  39. package/dist/form-Csxly6Es.js +74 -0
  40. package/dist/forms.d.ts +39 -0
  41. package/dist/forms.js +32 -0
  42. package/dist/index.d.ts +23 -0
  43. package/dist/index.js +1411 -0
  44. package/dist/lib/control-density.d.ts +3 -0
  45. package/dist/lib/utils.d.ts +3 -0
  46. package/dist/navigation.d.ts +3 -0
  47. package/dist/navigation.js +224 -0
  48. package/dist/notice-jbY9FQu_.js +49 -0
  49. package/dist/overlays-BleXRtz6.js +219 -0
  50. package/dist/overlays.d.ts +7 -0
  51. package/dist/overlays.js +2 -0
  52. package/dist/reset.css +16 -0
  53. package/dist/styles.css +3 -0
  54. package/dist/tokens.css +157 -0
  55. package/dist/utils-CX-Pz5p6.js +8 -0
  56. package/docs/accessibility.md +154 -0
  57. package/docs/charts.md +47 -0
  58. package/docs/components.md +296 -0
  59. package/docs/data-table.md +87 -0
  60. package/docs/layout-composition.md +224 -0
  61. package/docs/migration.md +91 -0
  62. package/docs/tokens.md +170 -0
  63. package/package.json +118 -4
@@ -0,0 +1,178 @@
1
+ import { t as e } from "./utils-CX-Pz5p6.js";
2
+ import { n as t, t as n } from "./notice-jbY9FQu_.js";
3
+ import { S as r, b as i, g as a, h as o, v as s, x as c } from "./data-display-BA7t1E4G.js";
4
+ import "react";
5
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
6
+ //#region src/components/financial.tsx
7
+ function d({ value: t, formatted: n, currency: r = "USD", locale: i = "en-US", precision: a = "auto", unavailableText: o = "—", className: s, ...c }) {
8
+ let u = n;
9
+ if (u === void 0) {
10
+ if (t == null || !Number.isFinite(t)) u = o;
11
+ else {
12
+ let e = Number.isInteger(Math.round(t * 100) / 100), n = a === "whole" ? 0 : a === "cents" ? 2 : e ? 0 : 2;
13
+ u = new Intl.NumberFormat(i, {
14
+ style: "currency",
15
+ currency: r,
16
+ minimumFractionDigits: n,
17
+ maximumFractionDigits: n
18
+ }).format(t);
19
+ }
20
+ }
21
+ return /* @__PURE__ */ l("span", {
22
+ className: e("tabular-nums whitespace-nowrap", s),
23
+ ...c,
24
+ children: u
25
+ });
26
+ }
27
+ function f({ value: t, formatted: n, mode: r = "rate", locale: i = "en-US", minimumFractionDigits: a = 0, maximumFractionDigits: o = 2, unavailableText: s = "—", className: c, ...u }) {
28
+ let d = n;
29
+ return d === void 0 && (d = t == null || !Number.isFinite(t) ? s : r === "rate" ? new Intl.NumberFormat(i, {
30
+ style: "percent",
31
+ minimumFractionDigits: a,
32
+ maximumFractionDigits: o
33
+ }).format(t) : `${new Intl.NumberFormat(i, {
34
+ minimumFractionDigits: a,
35
+ maximumFractionDigits: o
36
+ }).format(t)} pp`), /* @__PURE__ */ l("span", {
37
+ className: e("tabular-nums whitespace-nowrap", c),
38
+ ...u,
39
+ children: d
40
+ });
41
+ }
42
+ function p({ value: t, formatted: n, locale: r = "en-US", maximumFractionDigits: i = 20, unit: a, unavailableText: o = "—", className: s, ...c }) {
43
+ let u = n;
44
+ return u === void 0 && (u = t == null || !Number.isFinite(t) ? o : `${new Intl.NumberFormat(r, { maximumFractionDigits: i }).format(t)} ${a ?? (t === 1 ? "share" : "shares")}`), /* @__PURE__ */ l("span", {
45
+ className: e("tabular-nums whitespace-nowrap", s),
46
+ ...c,
47
+ children: u
48
+ });
49
+ }
50
+ var m = {
51
+ estimated: "Estimate",
52
+ stale: "Needs update",
53
+ illustrative: "Illustrative",
54
+ unavailable: "Unavailable"
55
+ };
56
+ function h({ state: e, labels: n, className: r, ...i }) {
57
+ return /* @__PURE__ */ l("span", {
58
+ className: r,
59
+ ...i,
60
+ children: /* @__PURE__ */ l(t, {
61
+ status: e === "estimated" ? "estimated" : e === "stale" ? "stale" : e === "unavailable" ? "warning" : "neutral",
62
+ children: n?.[e] ?? m[e]
63
+ })
64
+ });
65
+ }
66
+ function g({ label: t, value: n, detail: r, state: i, stateLabel: a, className: o, ...s }) {
67
+ return /* @__PURE__ */ u("section", {
68
+ className: e("wos-financial-metric", o),
69
+ ...s,
70
+ children: [
71
+ /* @__PURE__ */ u("div", {
72
+ className: "wos-financial-metric-heading",
73
+ children: [/* @__PURE__ */ l("h3", {
74
+ className: "type-caption text-muted-foreground",
75
+ children: t
76
+ }), i && /* @__PURE__ */ l(h, {
77
+ state: i,
78
+ labels: a ? { [i]: a } : void 0
79
+ })]
80
+ }),
81
+ /* @__PURE__ */ l("div", {
82
+ className: "wos-financial-metric-value",
83
+ children: n
84
+ }),
85
+ r != null && /* @__PURE__ */ l("p", {
86
+ className: "wos-financial-metric-detail",
87
+ children: r
88
+ })
89
+ ]
90
+ });
91
+ }
92
+ var _ = {
93
+ primary: "var(--chart-1)",
94
+ "chart-2": "var(--chart-2)",
95
+ "chart-3": "var(--chart-3)",
96
+ "chart-4": "var(--chart-4)",
97
+ "chart-5": "var(--chart-5)"
98
+ };
99
+ function v({ label: t, segments: n, showPercentages: r = !0, className: i, ...a }) {
100
+ let o = n.find((e) => !Number.isFinite(e.percentage) || e.percentage < 0 || e.percentage > 100);
101
+ if (o) throw RangeError(`AllocationBar percentage for "${o.label}" must be between 0 and 100.`);
102
+ return /* @__PURE__ */ u("figure", {
103
+ className: e("wos-allocation", i),
104
+ ...a,
105
+ children: [
106
+ /* @__PURE__ */ l("figcaption", {
107
+ className: "type-label",
108
+ children: t
109
+ }),
110
+ /* @__PURE__ */ l("div", {
111
+ className: "wos-allocation-bar",
112
+ "aria-hidden": "true",
113
+ children: n.map((e, t) => /* @__PURE__ */ l("span", { style: {
114
+ width: `${e.percentage}%`,
115
+ backgroundColor: _[e.color ?? [
116
+ "primary",
117
+ "chart-2",
118
+ "chart-3",
119
+ "chart-4",
120
+ "chart-5"
121
+ ][t % 5]]
122
+ } }, e.id ?? `${e.label}-${t}`))
123
+ }),
124
+ /* @__PURE__ */ l("ul", {
125
+ className: "wos-allocation-legend",
126
+ children: n.map((e, t) => /* @__PURE__ */ u("li", { children: [
127
+ /* @__PURE__ */ l("span", {
128
+ "aria-hidden": "true",
129
+ className: "wos-allocation-swatch",
130
+ style: { backgroundColor: _[e.color ?? [
131
+ "primary",
132
+ "chart-2",
133
+ "chart-3",
134
+ "chart-4",
135
+ "chart-5"
136
+ ][t % 5]] }
137
+ }),
138
+ /* @__PURE__ */ l("span", { children: e.label }),
139
+ r && /* @__PURE__ */ u("span", {
140
+ className: "tabular-nums",
141
+ children: [new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 }).format(e.percentage), "%"]
142
+ })
143
+ ] }, e.id ?? `${e.label}-${t}`))
144
+ })
145
+ ]
146
+ });
147
+ }
148
+ function y({ caption: t, rows: n, columns: d, getRowKey: f, className: p, ...m }) {
149
+ return /* @__PURE__ */ u(o, {
150
+ className: e("wos-financial-table", p),
151
+ ...m,
152
+ children: [
153
+ /* @__PURE__ */ l("caption", {
154
+ className: "wos-table-caption",
155
+ children: t
156
+ }),
157
+ /* @__PURE__ */ l(c, { children: /* @__PURE__ */ l(r, { children: d.map((e) => /* @__PURE__ */ l(i, {
158
+ scope: "col",
159
+ className: e.align === "end" ? "text-right" : void 0,
160
+ children: e.header
161
+ }, e.id)) }) }),
162
+ /* @__PURE__ */ l(a, { children: n.map((e, t) => /* @__PURE__ */ l(r, { children: d.map((t) => /* @__PURE__ */ l(s, {
163
+ className: t.align === "end" ? "text-right tabular-nums" : void 0,
164
+ children: t.cell(e)
165
+ }, t.id)) }, f(e, t))) })
166
+ ]
167
+ });
168
+ }
169
+ function b({ variant: t = "warning", title: r = "Planning assumption", className: i, ...a }) {
170
+ return /* @__PURE__ */ l(n, {
171
+ variant: t,
172
+ title: r,
173
+ className: e("wos-assumption-notice", i),
174
+ ...a
175
+ });
176
+ }
177
+ //#endregion
178
+ export { v as AllocationBar, b as AssumptionNotice, d as CurrencyValue, h as EstimateIndicator, y as FinancialDataTable, g as FinancialMetric, f as PercentageValue, p as ShareQuantity };
@@ -0,0 +1,74 @@
1
+ import { t as e } from "./utils-CX-Pz5p6.js";
2
+ import * as t from "react";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import * as i from "@radix-ui/react-label";
5
+ //#region src/components/validation-message.tsx
6
+ var a = t.forwardRef(({ variant: t = "error", className: r, children: i, ...a }, o) => /* @__PURE__ */ n("p", {
7
+ ...a,
8
+ ref: o,
9
+ "data-variant": t,
10
+ className: e("text-[length:var(--type-size-metadata)] leading-[1.35]", t === "error" ? "text-destructive" : t === "warning" ? "text-warning" : "text-info", r),
11
+ children: i
12
+ }));
13
+ a.displayName = "ValidationMessage";
14
+ //#endregion
15
+ //#region src/components/field.tsx
16
+ function o({ label: o, help: s, error: c, htmlFor: l, className: u, labelClassName: d, required: f, optional: p, orientation: m = "vertical", children: h }) {
17
+ let g = t.useId();
18
+ if (f && p) throw Error("Field cannot be both required and optional.");
19
+ let _ = t.isValidElement(h) && !!h.props["data-field-container"], v = t.isValidElement(h) && !_ ? h : null;
20
+ if (l && v?.props.id && l !== v.props.id) throw Error(`Field htmlFor ("${l}") must match its child control id ("${v.props.id}").`);
21
+ let y = l ?? v?.props.id ?? g, b = s ? `${y}-help` : void 0, x = c ? `${y}-error` : void 0, S = [
22
+ v?.props["aria-describedby"],
23
+ b,
24
+ x
25
+ ].filter(Boolean).join(" ") || void 0, C = v && t.cloneElement(v, {
26
+ id: y,
27
+ "aria-describedby": S,
28
+ "aria-invalid": c ? !0 : v.props["aria-invalid"],
29
+ required: f ?? v.props.required
30
+ });
31
+ return /* @__PURE__ */ r("div", {
32
+ className: e(m === "horizontal" ? "wos-field-horizontal max-[639px]:space-y-1.5" : "space-y-1.5", u),
33
+ children: [/* @__PURE__ */ r(i.Root, {
34
+ htmlFor: y,
35
+ className: e("block type-label text-secondary-foreground", d),
36
+ children: [
37
+ o,
38
+ f && /* @__PURE__ */ n("span", {
39
+ className: "ml-1 font-normal text-muted-foreground",
40
+ children: "Required"
41
+ }),
42
+ p && /* @__PURE__ */ n("span", {
43
+ className: "ml-1 font-normal text-muted-foreground",
44
+ children: "Optional"
45
+ })
46
+ ]
47
+ }), /* @__PURE__ */ r("div", {
48
+ className: "min-w-0 space-y-1.5",
49
+ children: [
50
+ C ?? h,
51
+ s && /* @__PURE__ */ n("p", {
52
+ id: b,
53
+ className: "text-[length:var(--type-size-metadata)] leading-[1.35] text-muted-foreground",
54
+ children: s
55
+ }),
56
+ c && /* @__PURE__ */ n(a, {
57
+ id: x,
58
+ children: c
59
+ })
60
+ ]
61
+ })]
62
+ });
63
+ }
64
+ //#endregion
65
+ //#region src/components/form.tsx
66
+ var s = t.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ n("form", {
67
+ ref: i,
68
+ className: e("space-y-4", t),
69
+ ...r
70
+ }));
71
+ s.displayName = "Form";
72
+ var c = o;
73
+ //#endregion
74
+ export { a as i, c as n, o as r, s as t };
@@ -0,0 +1,39 @@
1
+ import * as React from "react";
2
+ import { type FieldProps } from "./components/field";
3
+ import { Form } from "./components/form";
4
+ export { Form };
5
+ /** Structural subset of React Hook Form's register result; no RHF runtime enters the package. */
6
+ export type RegisteredFieldProps = {
7
+ name?: string;
8
+ onChange?: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>;
9
+ onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>;
10
+ ref?: React.Ref<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>;
11
+ };
12
+ export type RegisterField = (name: any, options?: any) => RegisteredFieldProps;
13
+ export interface RHFFieldProps extends Omit<FieldProps, "children"> {
14
+ name: string;
15
+ register: RegisterField;
16
+ rules?: Record<string, unknown>;
17
+ children: React.ReactElement;
18
+ }
19
+ /**
20
+ * Bridges React Hook Form's register(name) result into the existing WealthOS Field.
21
+ * Pass the register function from useForm; this adapter has no runtime RHF import.
22
+ */
23
+ export declare function RHFField({ name, register, rules, children, ...fieldProps }: RHFFieldProps): React.JSX.Element;
24
+ /** Structural Controller field shape; compatible with React Hook Form's useController field. */
25
+ export interface RHFControllerField {
26
+ name: string;
27
+ value: unknown;
28
+ onChange: (...args: any[]) => void;
29
+ onBlur?: React.FocusEventHandler<HTMLElement>;
30
+ ref?: React.Ref<HTMLElement>;
31
+ disabled?: boolean;
32
+ }
33
+ /**
34
+ * Maps a React Hook Form Controller field to controlled WealthOS components.
35
+ * Checkbox and Switch use `rhfControllerProps(field, { valueProp: "checked" })`.
36
+ */
37
+ export declare function rhfControllerProps(field: RHFControllerField, options?: {
38
+ valueProp?: string;
39
+ }): Record<string, unknown>;
package/dist/forms.js ADDED
@@ -0,0 +1,32 @@
1
+ import { r as e, t } from "./form-Csxly6Es.js";
2
+ import * as n from "react";
3
+ import { jsx as r } from "react/jsx-runtime";
4
+ //#region src/forms.tsx
5
+ function i({ name: t, register: i, rules: a, children: o, ...s }) {
6
+ let c = i(t, a), l = n.cloneElement(o, {
7
+ ...c,
8
+ name: t
9
+ });
10
+ return /* @__PURE__ */ r(e, {
11
+ ...s,
12
+ children: l
13
+ });
14
+ }
15
+ function a(e, t = {}) {
16
+ return {
17
+ [t.valueProp ?? "value"]: e.value,
18
+ name: e.name,
19
+ onChange: (...t) => {
20
+ let n = t[0];
21
+ if (n && typeof n == "object" && "target" in n) {
22
+ let t = n.target;
23
+ e.onChange(t.type === "checkbox" ? t.checked : t.value);
24
+ } else e.onChange(n);
25
+ },
26
+ onBlur: e.onBlur,
27
+ ref: e.ref,
28
+ disabled: e.disabled
29
+ };
30
+ }
31
+ //#endregion
32
+ export { t as Form, i as RHFField, a as rhfControllerProps };
@@ -0,0 +1,23 @@
1
+ import "./styles.css";
2
+ export type { ControlDensity } from "./lib/control-density";
3
+ export { Button, buttonVariants, type ButtonProps } from "./components/button";
4
+ export { IconButton, type IconButtonProps } from "./components/icon-button";
5
+ export { ButtonGroup, type ButtonGroupProps } from "./components/button-group";
6
+ export { WealthIcon, type WealthIconName } from "./components/icons";
7
+ export { TextInput, type TextInputProps } from "./components/text-input";
8
+ export { NumberInput, MoneyInput, QuantityInput, type NumberInputProps, type MoneyInputProps, type QuantityInputProps, type NumberInputFormat } from "./components/number-input";
9
+ export { Select, type SelectProps } from "./components/select";
10
+ export { SelectMenu, type SelectMenuProps, type SelectOption } from "./components/select-menu";
11
+ export { DateInput, UsDateInput, type DateInputProps, type UsDateInputProps } from "./components/date-input";
12
+ export { DateRangePicker, isDateRangeValid, type DateRangePickerProps, type DateRange } from "./components/date-range-picker";
13
+ export { Combobox, Autocomplete, MultiSelect, Checkbox, RadioGroup, Switch, Slider, InputOTP, FileUpload, Toggle, ToggleGroup, SegmentedControl, SearchInput, type ChoiceOption, type ComboboxProps, type AutocompleteProps, type MultiSelectProps, type CheckboxProps, type RadioOption, type RadioGroupProps, type SwitchProps, type SliderProps, type InputOTPProps, type FileUploadProps, type ToggleProps, type ToggleGroupProps, type SearchInputProps, } from "./components/advanced-controls";
14
+ export { Form, FormField, type FormProps, type FormFieldProps } from "./components/form";
15
+ export { Textarea, type TextareaProps } from "./components/textarea";
16
+ export { Field, type FieldProps } from "./components/field";
17
+ export { ValidationMessage, type ValidationMessageProps } from "./components/validation-message";
18
+ export { Surface, Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, surfaceVariants, type SurfaceProps, } from "./components/surface";
19
+ export { Badge, badgeVariants, type BadgeProps } from "./components/badge";
20
+ export { StatusBadge, type StatusBadgeProps, type Status } from "./components/status-badge";
21
+ export { Notice, type NoticeProps } from "./components/notice";
22
+ export { cn } from "./lib/utils";
23
+ export { Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption, Avatar, AvatarGroup, DescriptionList, EmptyState, Skeleton, Progress, CircularProgress, Separator, ScrollArea, AspectRatio, Stat, MetricCard, Timeline, DataList, KeyValue, type AvatarProps, type AvatarGroupProps, type DescriptionListProps, type EmptyStateProps, type SkeletonProps, type ProgressProps, type CircularProgressProps, type SeparatorProps, type ScrollAreaProps, type AspectRatioProps, type StatProps, type MetricCardProps, type TimelineItem, type TimelineProps, type DataListProps, type KeyValueProps, } from "./components/data-display";