@almanaclabs/blaze-ui 0.10.0 → 0.12.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 (106) hide show
  1. package/dist/components/app-shell/app-shell.d.ts +90 -0
  2. package/dist/components/app-shell/app-shell.d.ts.map +1 -0
  3. package/dist/components/app-shell/app-shell.js +149 -0
  4. package/dist/components/app-shell/index.d.ts +2 -0
  5. package/dist/components/app-shell/index.d.ts.map +1 -0
  6. package/dist/components/approval-card/approval-card.d.ts +19 -0
  7. package/dist/components/approval-card/approval-card.d.ts.map +1 -0
  8. package/dist/components/approval-card/approval-card.js +42 -0
  9. package/dist/components/approval-card/index.d.ts +2 -0
  10. package/dist/components/approval-card/index.d.ts.map +1 -0
  11. package/dist/components/badge/badge.d.ts +1 -1
  12. package/dist/components/chat-bar/chat-bar.d.ts +26 -0
  13. package/dist/components/chat-bar/chat-bar.d.ts.map +1 -0
  14. package/dist/components/chat-bar/chat-bar.js +58 -0
  15. package/dist/components/chat-bar/index.d.ts +2 -0
  16. package/dist/components/chat-bar/index.d.ts.map +1 -0
  17. package/dist/components/dense-table/dense-table.d.ts +36 -0
  18. package/dist/components/dense-table/dense-table.d.ts.map +1 -0
  19. package/dist/components/dense-table/dense-table.js +41 -0
  20. package/dist/components/dense-table/index.d.ts +2 -0
  21. package/dist/components/dense-table/index.d.ts.map +1 -0
  22. package/dist/components/editable-text/editable-text.d.ts +26 -0
  23. package/dist/components/editable-text/editable-text.d.ts.map +1 -0
  24. package/dist/components/editable-text/editable-text.js +82 -0
  25. package/dist/components/editable-text/index.d.ts +2 -0
  26. package/dist/components/editable-text/index.d.ts.map +1 -0
  27. package/dist/components/face-stack-button/face-stack-button.d.ts +31 -0
  28. package/dist/components/face-stack-button/face-stack-button.d.ts.map +1 -0
  29. package/dist/components/face-stack-button/face-stack-button.js +47 -0
  30. package/dist/components/face-stack-button/index.d.ts +2 -0
  31. package/dist/components/face-stack-button/index.d.ts.map +1 -0
  32. package/dist/components/filter-chips/filter-chips.d.ts +23 -0
  33. package/dist/components/filter-chips/filter-chips.d.ts.map +1 -0
  34. package/dist/components/filter-chips/filter-chips.js +34 -0
  35. package/dist/components/filter-chips/index.d.ts +2 -0
  36. package/dist/components/filter-chips/index.d.ts.map +1 -0
  37. package/dist/components/goal-card/goal-card.d.ts +51 -0
  38. package/dist/components/goal-card/goal-card.d.ts.map +1 -0
  39. package/dist/components/goal-card/goal-card.js +109 -0
  40. package/dist/components/goal-card/index.d.ts +2 -0
  41. package/dist/components/goal-card/index.d.ts.map +1 -0
  42. package/dist/components/input-group/input-group.d.ts +1 -1
  43. package/dist/components/item/item.d.ts +1 -1
  44. package/dist/components/item/item.d.ts.map +1 -1
  45. package/dist/components/item/item.js +3 -2
  46. package/dist/components/media-thumbnail/index.d.ts +2 -0
  47. package/dist/components/media-thumbnail/index.d.ts.map +1 -0
  48. package/dist/components/media-thumbnail/media-thumbnail.d.ts +21 -0
  49. package/dist/components/media-thumbnail/media-thumbnail.d.ts.map +1 -0
  50. package/dist/components/media-thumbnail/media-thumbnail.js +50 -0
  51. package/dist/components/metric-tile/index.d.ts +2 -0
  52. package/dist/components/metric-tile/index.d.ts.map +1 -0
  53. package/dist/components/metric-tile/metric-tile.d.ts +34 -0
  54. package/dist/components/metric-tile/metric-tile.d.ts.map +1 -0
  55. package/dist/components/metric-tile/metric-tile.js +75 -0
  56. package/dist/components/page-header/index.d.ts +2 -0
  57. package/dist/components/page-header/index.d.ts.map +1 -0
  58. package/dist/components/page-header/page-header.d.ts +16 -0
  59. package/dist/components/page-header/page-header.d.ts.map +1 -0
  60. package/dist/components/page-header/page-header.js +38 -0
  61. package/dist/components/platform-avatar/index.d.ts +2 -0
  62. package/dist/components/platform-avatar/index.d.ts.map +1 -0
  63. package/dist/components/platform-avatar/platform-avatar.d.ts +23 -0
  64. package/dist/components/platform-avatar/platform-avatar.d.ts.map +1 -0
  65. package/dist/components/platform-avatar/platform-avatar.js +54 -0
  66. package/dist/components/platform-icon/index.d.ts +2 -0
  67. package/dist/components/platform-icon/index.d.ts.map +1 -0
  68. package/dist/components/platform-icon/platform-icon.d.ts +38 -0
  69. package/dist/components/platform-icon/platform-icon.d.ts.map +1 -0
  70. package/dist/components/platform-icon/platform-icon.js +272 -0
  71. package/dist/components/sidebar/sidebar.js +19 -19
  72. package/dist/components/signal-strip/index.d.ts +2 -0
  73. package/dist/components/signal-strip/index.d.ts.map +1 -0
  74. package/dist/components/signal-strip/signal-strip.d.ts +34 -0
  75. package/dist/components/signal-strip/signal-strip.d.ts.map +1 -0
  76. package/dist/components/signal-strip/signal-strip.js +84 -0
  77. package/dist/components/source-avatar/index.d.ts +2 -0
  78. package/dist/components/source-avatar/index.d.ts.map +1 -0
  79. package/dist/components/source-avatar/source-avatar.d.ts +16 -0
  80. package/dist/components/source-avatar/source-avatar.d.ts.map +1 -0
  81. package/dist/components/source-avatar/source-avatar.js +15 -0
  82. package/dist/components/stacked-bar-chart/index.d.ts +2 -0
  83. package/dist/components/stacked-bar-chart/index.d.ts.map +1 -0
  84. package/dist/components/stacked-bar-chart/stacked-bar-chart.d.ts +80 -0
  85. package/dist/components/stacked-bar-chart/stacked-bar-chart.d.ts.map +1 -0
  86. package/dist/components/stacked-bar-chart/stacked-bar-chart.js +240 -0
  87. package/dist/components/state-banner/index.d.ts +2 -0
  88. package/dist/components/state-banner/index.d.ts.map +1 -0
  89. package/dist/components/state-banner/state-banner.d.ts +32 -0
  90. package/dist/components/state-banner/state-banner.d.ts.map +1 -0
  91. package/dist/components/state-banner/state-banner.js +70 -0
  92. package/dist/components/status-indicator/index.d.ts +2 -0
  93. package/dist/components/status-indicator/index.d.ts.map +1 -0
  94. package/dist/components/status-indicator/status-indicator.d.ts +21 -0
  95. package/dist/components/status-indicator/status-indicator.d.ts.map +1 -0
  96. package/dist/components/status-indicator/status-indicator.js +30 -0
  97. package/dist/components/suggest-chips/index.d.ts +2 -0
  98. package/dist/components/suggest-chips/index.d.ts.map +1 -0
  99. package/dist/components/suggest-chips/suggest-chips.d.ts +13 -0
  100. package/dist/components/suggest-chips/suggest-chips.d.ts.map +1 -0
  101. package/dist/components/suggest-chips/suggest-chips.js +24 -0
  102. package/dist/index.d.ts +20 -1
  103. package/dist/index.d.ts.map +1 -1
  104. package/dist/index.js +68 -49
  105. package/package.json +1 -1
  106. package/src/styles/globals.css +40 -0
@@ -0,0 +1,84 @@
1
+ import { cn as e } from "../../lib/utils.js";
2
+ import "react";
3
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
4
+ //#region src/components/signal-strip/signal-strip.tsx
5
+ function r({ value: n, max: r = 5, className: i, "aria-label": a, ...o }) {
6
+ let s = Math.max(0, Math.min(r, Math.round(n)));
7
+ return /* @__PURE__ */ t("span", {
8
+ "data-slot": "signal-dots",
9
+ role: "img",
10
+ "aria-label": a ?? `${s} of ${r}`,
11
+ className: e("flex items-center gap-[3px]", i),
12
+ ...o,
13
+ children: Array.from({ length: r }, (n, r) => /* @__PURE__ */ t("span", {
14
+ "data-slot": "signal-dot",
15
+ "data-filled": r < s ? "" : void 0,
16
+ className: e("size-1.5 rounded-full", r < s ? "bg-primary" : "bg-surface-muted")
17
+ }, r))
18
+ });
19
+ }
20
+ function i({ items: i, layout: a = "inline", className: o, ...s }) {
21
+ let c = (e) => e.value == null ? null : /* @__PURE__ */ t(r, {
22
+ value: e.value,
23
+ max: e.max,
24
+ "aria-label": e.dotsLabel
25
+ });
26
+ return a === "detail" ? /* @__PURE__ */ t("dl", {
27
+ "data-slot": "signal-strip",
28
+ "data-layout": a,
29
+ className: e("flex flex-col gap-3", o),
30
+ ...s,
31
+ children: i.map((e, r) => /* @__PURE__ */ n("div", {
32
+ "data-slot": "signal-strip-item",
33
+ className: "grid grid-cols-[96px_minmax(0,1fr)] gap-x-3",
34
+ children: [/* @__PURE__ */ t("dt", {
35
+ className: "type-meta pt-0.5 text-muted-foreground",
36
+ children: e.label
37
+ }), /* @__PURE__ */ n("dd", {
38
+ className: "min-w-0",
39
+ children: [/* @__PURE__ */ n("p", {
40
+ className: "type-body flex items-center gap-2",
41
+ children: [c(e), e.note]
42
+ }), e.description ? /* @__PURE__ */ t("p", {
43
+ className: "type-meta mt-0.5 text-muted-foreground",
44
+ children: e.description
45
+ }) : null]
46
+ })]
47
+ }, r))
48
+ }) : a === "stacked" ? /* @__PURE__ */ t("dl", {
49
+ "data-slot": "signal-strip",
50
+ "data-layout": a,
51
+ className: e("type-meta grid grid-cols-[max-content_max-content_minmax(0,1fr)] items-center gap-x-2 gap-y-1 text-muted-foreground", o),
52
+ ...s,
53
+ children: i.map((e, r) => /* @__PURE__ */ n("div", {
54
+ "data-slot": "signal-strip-item",
55
+ className: "contents",
56
+ children: [
57
+ /* @__PURE__ */ t("dt", { children: e.label }),
58
+ /* @__PURE__ */ t("dd", { children: c(e) }),
59
+ /* @__PURE__ */ t("dd", {
60
+ className: "truncate text-foreground",
61
+ children: e.note
62
+ })
63
+ ]
64
+ }, r))
65
+ }) : /* @__PURE__ */ t("dl", {
66
+ "data-slot": "signal-strip",
67
+ "data-layout": a,
68
+ className: e("type-meta flex flex-wrap gap-x-5 gap-y-1.5 text-muted-foreground", o),
69
+ ...s,
70
+ children: i.map((e, r) => /* @__PURE__ */ n("div", {
71
+ "data-slot": "signal-strip-item",
72
+ className: "flex items-center gap-1.5",
73
+ children: [/* @__PURE__ */ t("dt", { children: e.label }), /* @__PURE__ */ n("dd", {
74
+ className: "flex items-center gap-1.5 text-foreground",
75
+ children: [c(e), e.note ? /* @__PURE__ */ t("span", {
76
+ className: "font-normal",
77
+ children: e.note
78
+ }) : null]
79
+ })]
80
+ }, r))
81
+ });
82
+ }
83
+ //#endregion
84
+ export { r as SignalDots, i as SignalStrip };
@@ -0,0 +1,2 @@
1
+ export * from './source-avatar';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/source-avatar/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { PlatformAvatarProps } from '../platform-avatar/platform-avatar';
2
+ type SourceAvatarProps = Omit<PlatformAvatarProps, 'fit'> & {
3
+ /**
4
+ * `photo` for a person or account (a round photo, or their initial); `logo` for a
5
+ * company or site mark, inset on the card surface with a hairline ring.
6
+ */
7
+ variant?: 'photo' | 'logo';
8
+ };
9
+ /**
10
+ * Who an item came from, as a small face beside its meta line: an account's photo,
11
+ * a company's logo, or an initial when there is neither. Built on PlatformAvatar,
12
+ * so it can also carry the platform it came from.
13
+ */
14
+ declare function SourceAvatar({ variant, size, className, ...props }: SourceAvatarProps): import("react").JSX.Element;
15
+ export { SourceAvatar, type SourceAvatarProps };
16
+ //# sourceMappingURL=source-avatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-avatar.d.ts","sourceRoot":"","sources":["../../../src/components/source-avatar/source-avatar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,oCAAoC,CAAA;AAE3C,KAAK,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,EAAE,KAAK,CAAC,GAAG;IAC1D;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAC3B,CAAA;AAED;;;;GAIG;AACH,iBAAS,YAAY,CAAC,EACpB,OAAiB,EACjB,IAAS,EACT,SAAS,EACT,GAAG,KAAK,EACT,EAAE,iBAAiB,+BAUnB;AAED,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { cn as e } from "../../lib/utils.js";
2
+ import { PlatformAvatar as t } from "../platform-avatar/platform-avatar.js";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/components/source-avatar/source-avatar.tsx
5
+ function r({ variant: r = "photo", size: i = 20, className: a, ...o }) {
6
+ return /* @__PURE__ */ n(t, {
7
+ "data-source-variant": r,
8
+ size: i,
9
+ fit: r === "logo" ? "contain" : "cover",
10
+ className: e(a),
11
+ ...o
12
+ });
13
+ }
14
+ //#endregion
15
+ export { r as SourceAvatar };
@@ -0,0 +1,2 @@
1
+ export * from './stacked-bar-chart';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/stacked-bar-chart/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,80 @@
1
+ import * as React from 'react';
2
+ export interface StackedBarChartSeries {
3
+ /** The key of this series in each datum's `values`. */
4
+ key: string;
5
+ /** The series' name, on its toggle and in the tooltip. */
6
+ label: string;
7
+ /** Any CSS color, such as `var(--area-social)`. Its 12% tint fills the pressed toggle. */
8
+ color: string;
9
+ /**
10
+ * The pressed toggle's text color, for a `color` under 4.5:1 on its own
11
+ * tint, such as `var(--area-social-foreground)`. Defaults to `color`.
12
+ */
13
+ foreground?: string;
14
+ /**
15
+ * The pressed toggle's background, such as `var(--area-social-soft)`.
16
+ * Defaults to a 12% tint of `color`.
17
+ */
18
+ tint?: string;
19
+ /** A small mark on the series' toggle. */
20
+ icon?: React.ReactNode;
21
+ }
22
+ export interface StackedBarChartDatum {
23
+ /** The axis label, such as "Nov 3". */
24
+ label: string;
25
+ /** The tooltip's heading. Defaults to `label`. */
26
+ tooltipLabel?: React.ReactNode;
27
+ /** Draws the day's bars faded, for a count still coming in. */
28
+ partial?: boolean;
29
+ /** One number per series key. Null, or a missing key, means no count that day. */
30
+ values: Readonly<Partial<Record<string, number | null>>>;
31
+ }
32
+ export interface StackedBarChartMetric {
33
+ /** The metric's id, used by `metric` and `onMetricChange`. */
34
+ value: string;
35
+ /** The metric's name on the switch, such as "Followers". */
36
+ label: React.ReactNode;
37
+ /** The chart's title while this metric shows. Falls back to the chart's `title`. */
38
+ title?: React.ReactNode;
39
+ /** The chart's accessible name while this metric shows. */
40
+ ariaLabel?: string;
41
+ data: readonly StackedBarChartDatum[];
42
+ /** Formats a value in the tooltip. */
43
+ formatValue?: (value: number) => string;
44
+ /** Formats a y-axis tick. */
45
+ formatTick?: (value: number) => string;
46
+ }
47
+ export interface StackedBarChartProps extends Omit<React.ComponentProps<'div'>, 'children' | 'title'> {
48
+ series: readonly StackedBarChartSeries[];
49
+ /** One or more metrics on the same days. Two or more show a switch. */
50
+ metrics: readonly StackedBarChartMetric[];
51
+ title?: React.ReactNode;
52
+ metric?: string;
53
+ defaultMetric?: string;
54
+ onMetricChange?: (metric: string) => void;
55
+ /** Keys of the series switched off. */
56
+ hiddenSeries?: readonly string[];
57
+ defaultHiddenSeries?: readonly string[];
58
+ onHiddenSeriesChange?: (keys: string[]) => void;
59
+ /**
60
+ * `section` is a page section: a section title, the switches, then a tall
61
+ * chart. `card` is a bordered card with a small title, a shorter chart with
62
+ * thin bars, and the switches under it.
63
+ */
64
+ variant?: 'section' | 'card';
65
+ /** The plot's height in pixels. Defaults to 300 for a section, 220 for a card. */
66
+ height?: number;
67
+ /**
68
+ * Label every nth day, counted back from the last. Defaults to every day for
69
+ * ten days or fewer, otherwise every seventh.
70
+ */
71
+ labelEvery?: number;
72
+ }
73
+ /**
74
+ * Bars per day, stacked by series, on Blaze UI's Chart. Gains stack up from
75
+ * zero and losses down from it. Series switch on and off from their toggles,
76
+ * and a metric switch changes what the bars count.
77
+ */
78
+ declare function StackedBarChart({ series, metrics, title, metric: metricProp, defaultMetric, onMetricChange, hiddenSeries: hiddenProp, defaultHiddenSeries, onHiddenSeriesChange, variant, height, labelEvery, className, ...props }: StackedBarChartProps): React.JSX.Element;
79
+ export { StackedBarChart };
80
+ //# sourceMappingURL=stacked-bar-chart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stacked-bar-chart.d.ts","sourceRoot":"","sources":["../../../src/components/stacked-bar-chart/stacked-bar-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAoB9B,MAAM,WAAW,qBAAqB;IACpC,uDAAuD;IACvD,GAAG,EAAE,MAAM,CAAA;IACX,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAA;IACb,0FAA0F;IAC1F,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0CAA0C;IAC1C,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAA;IACb,kDAAkD;IAClD,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kFAAkF;IAClF,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;CACzD;AAED,MAAM,WAAW,qBAAqB;IACpC,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAA;IACb,4DAA4D;IAC5D,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,oFAAoF;IACpF,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,SAAS,oBAAoB,EAAE,CAAA;IACrC,sCAAsC;IACtC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACvC,6BAA6B;IAC7B,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CACvC;AAED,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAChD,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAC3B,UAAU,GAAG,OAAO,CACrB;IACC,MAAM,EAAE,SAAS,qBAAqB,EAAE,CAAA;IACxC,uEAAuE;IACvE,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAA;IACzC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,uCAAuC;IACvC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACvC,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IAC/C;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;IAC5B,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AA4CD;;;;GAIG;AACH,iBAAS,eAAe,CAAC,EACvB,MAAM,EACN,OAAO,EACP,KAAK,EACL,MAAM,EAAE,UAAU,EAClB,aAAa,EACb,cAAc,EACd,YAAY,EAAE,UAAU,EACxB,mBAAwB,EACxB,oBAAoB,EACpB,OAAmB,EACnB,MAAM,EACN,UAAU,EACV,SAAS,EACT,GAAG,KAAK,EACT,EAAE,oBAAoB,qBAqRtB;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
@@ -0,0 +1,240 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { ChartContainer as t, ChartTooltip as n } from "../chart/chart.js";
4
+ import { Tabs as r, TabsList as i, TabsTrigger as a } from "../tabs/tabs.js";
5
+ import { Toggle as o } from "../toggle/toggle.js";
6
+ import * as s from "react";
7
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
+ import { Bar as u, BarChart as d, CartesianGrid as f, Cell as p, ReferenceLine as ee, XAxis as m, YAxis as h } from "recharts";
9
+ //#region src/components/stacked-bar-chart/stacked-bar-chart.tsx
10
+ var g = new Intl.NumberFormat("en-US", {
11
+ notation: "compact",
12
+ maximumFractionDigits: 1
13
+ }), _ = (e) => g.format(e), v = (e) => e.toLocaleString("en-US");
14
+ function y(e, t, n = 4) {
15
+ let r = (t - e) / n || 1, i = 10 ** Math.floor(Math.log10(r)), a = ([
16
+ 1,
17
+ 2,
18
+ 2.5,
19
+ 5,
20
+ 10
21
+ ].find((e) => e * i >= r) ?? 10) * i, o = [];
22
+ for (let n = Math.floor(e / a) * a; n <= Math.ceil(t / a) * a + a / 2; n += a) o.push(+n.toFixed(6));
23
+ return o;
24
+ }
25
+ var b = "__index", x = {
26
+ section: 52,
27
+ card: 44
28
+ };
29
+ function S(e, t, n) {
30
+ let [r, i] = s.useState(t);
31
+ return [e === void 0 ? r : e, (t) => {
32
+ e === void 0 && i(t), n?.(t);
33
+ }];
34
+ }
35
+ function C({ series: s, metrics: g, title: C, metric: w, defaultMetric: T, onMetricChange: E, hiddenSeries: te, defaultHiddenSeries: ne = [], onHiddenSeriesChange: re, variant: D = "section", height: ie, labelEvery: O, className: k, ...A }) {
36
+ let [j, M] = S(w, T ?? g[0]?.value ?? "", E), [N, P] = S(te, ne, re), F = g.find((e) => e.value === j) ?? g[0], I = F?.data ?? [], L = F?.formatValue ?? v, R = F?.formatTick ?? _, z = F?.title ?? C, B = F?.ariaLabel ?? (typeof z == "string" ? z : "Stacked bar chart"), V = s.filter((e) => I.some((t) => t.values[e.key] != null)), H = V.filter((e) => !N.includes(e.key)), U = (e) => P(N.includes(e) ? N.filter((t) => t !== e) : [...N, e]), W = I.map((e, t) => {
37
+ let n = { [b]: t };
38
+ for (let t of H) n[t.key] = e.values[t.key] ?? null;
39
+ return n;
40
+ }), G = 0, K = 0;
41
+ for (let e of I) {
42
+ let t = 0, n = 0;
43
+ for (let r of H) {
44
+ let i = e.values[r.key] ?? 0;
45
+ i > 0 ? t += i : n += i;
46
+ }
47
+ G = Math.max(G, t), K = Math.min(K, n);
48
+ }
49
+ let q = y(K, Math.max(G, 1)), J = [q[0] ?? 0, q[q.length - 1] ?? 1], ae = O ?? (I.length <= 10 ? 1 : 7), Y = ie ?? (D === "card" ? 220 : 300), X = D === "card", Z = g.length > 1 ? /* @__PURE__ */ c(r, {
50
+ value: F?.value,
51
+ onValueChange: (e) => M(e),
52
+ children: /* @__PURE__ */ c(i, {
53
+ "aria-label": "Metric",
54
+ children: g.map((e) => /* @__PURE__ */ c(a, {
55
+ value: e.value,
56
+ children: e.label
57
+ }, e.value))
58
+ })
59
+ }) : null, Q = V.map((e) => {
60
+ let t = !N.includes(e.key);
61
+ return /* @__PURE__ */ l(o, {
62
+ "data-slot": "stacked-bar-chart-series-toggle",
63
+ variant: "outline",
64
+ size: X ? "sm" : "default",
65
+ pressed: t,
66
+ onPressedChange: () => U(e.key),
67
+ className: "type-meta rounded-full px-3 font-medium aria-pressed:bg-transparent",
68
+ style: !X && t ? {
69
+ background: e.tint ?? `color-mix(in srgb, ${e.color} 12%, transparent)`,
70
+ borderColor: e.color,
71
+ color: e.foreground ?? e.color
72
+ } : void 0,
73
+ children: [
74
+ X ? /* @__PURE__ */ c("span", {
75
+ "aria-hidden": "true",
76
+ className: "size-2.5 rounded-full",
77
+ style: { background: t ? e.color : "var(--border)" }
78
+ }) : null,
79
+ e.icon,
80
+ e.label
81
+ ]
82
+ }, e.key);
83
+ }), oe = Object.fromEntries(s.map((e) => [e.key, {
84
+ label: e.label,
85
+ color: e.color
86
+ }])), $ = /* @__PURE__ */ c("div", {
87
+ "data-slot": "stacked-bar-chart-plot",
88
+ role: "img",
89
+ "aria-label": B,
90
+ className: X ? "mt-3" : "mt-4",
91
+ children: /* @__PURE__ */ c(t, {
92
+ config: oe,
93
+ className: "type-meta aspect-auto w-full [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-surface-subtle",
94
+ style: { height: Y },
95
+ initialDimension: {
96
+ width: 640,
97
+ height: Y
98
+ },
99
+ children: /* @__PURE__ */ l(d, {
100
+ data: W,
101
+ stackOffset: "sign",
102
+ barCategoryGap: X ? 1.5 : "18%",
103
+ margin: {
104
+ top: X ? 10 : 8,
105
+ right: X ? 8 : 0,
106
+ bottom: 0,
107
+ left: 0
108
+ },
109
+ accessibilityLayer: !1,
110
+ children: [
111
+ /* @__PURE__ */ c(f, {
112
+ vertical: !1,
113
+ stroke: "var(--border-subtle)"
114
+ }),
115
+ /* @__PURE__ */ c(m, {
116
+ dataKey: b,
117
+ interval: 0,
118
+ tickLine: !1,
119
+ axisLine: !1,
120
+ tickMargin: X ? 4 : 8,
121
+ height: X ? 22 : 28,
122
+ tickFormatter: (e) => (I.length - 1 - e) % ae == 0 ? I[e]?.label ?? "" : ""
123
+ }),
124
+ /* @__PURE__ */ c(h, {
125
+ domain: J,
126
+ ticks: q,
127
+ interval: 0,
128
+ tickLine: !1,
129
+ axisLine: !1,
130
+ width: x[D],
131
+ tickMargin: X ? 6 : 8,
132
+ tickFormatter: R
133
+ }),
134
+ /* @__PURE__ */ c(ee, {
135
+ y: 0,
136
+ stroke: "var(--border)"
137
+ }),
138
+ /* @__PURE__ */ c(n, {
139
+ cursor: { fill: "var(--surface-subtle)" },
140
+ isAnimationActive: !1,
141
+ position: { y: 0 },
142
+ content: ({ active: e, label: t }) => {
143
+ let n = typeof t == "number" ? t : Number(t), r = I[n];
144
+ if (!e || !r || H.length === 0) return null;
145
+ let i = H.reduce((e, t) => e + (r.values[t.key] ?? 0), 0);
146
+ return /* @__PURE__ */ l("div", {
147
+ "data-slot": "stacked-bar-chart-tooltip",
148
+ className: "min-w-[180px] rounded-lg border border-border bg-card p-3 shadow-sm",
149
+ children: [/* @__PURE__ */ c("p", {
150
+ className: "type-meta text-muted-foreground",
151
+ children: r.tooltipLabel ?? r.label
152
+ }), /* @__PURE__ */ l("ul", {
153
+ className: "mt-1.5 flex flex-col gap-1",
154
+ children: [H.map((e) => {
155
+ let t = r.values[e.key];
156
+ return /* @__PURE__ */ l("li", {
157
+ className: "type-body flex items-center gap-2 text-foreground",
158
+ children: [
159
+ /* @__PURE__ */ c("span", {
160
+ className: "size-2.5 rounded-full",
161
+ style: { background: e.color }
162
+ }),
163
+ /* @__PURE__ */ c("span", {
164
+ className: "flex-1",
165
+ children: e.label
166
+ }),
167
+ /* @__PURE__ */ c("span", {
168
+ className: "font-medium tabular-nums",
169
+ children: t == null ? "–" : L(t)
170
+ })
171
+ ]
172
+ }, e.key);
173
+ }), H.length > 1 ? /* @__PURE__ */ l("li", {
174
+ className: "type-body mt-1 flex items-center gap-2 border-t border-border-subtle pt-1.5 font-medium text-foreground",
175
+ children: [/* @__PURE__ */ c("span", {
176
+ className: "flex-1",
177
+ children: "Total"
178
+ }), /* @__PURE__ */ c("span", {
179
+ className: "tabular-nums",
180
+ children: L(i)
181
+ })]
182
+ }) : null]
183
+ })]
184
+ });
185
+ }
186
+ }),
187
+ H.map((e) => /* @__PURE__ */ c(u, {
188
+ dataKey: e.key,
189
+ stackId: "stack",
190
+ fill: e.color,
191
+ maxBarSize: 56,
192
+ isAnimationActive: !1,
193
+ children: I.map((e, t) => /* @__PURE__ */ c(p, { fillOpacity: e.partial ? .45 : 1 }, t))
194
+ }, e.key))
195
+ ]
196
+ })
197
+ })
198
+ });
199
+ return X ? /* @__PURE__ */ l("div", {
200
+ "data-slot": "stacked-bar-chart",
201
+ "data-variant": D,
202
+ className: e("rounded-xl border border-border bg-card p-5", k),
203
+ ...A,
204
+ children: [
205
+ /* @__PURE__ */ l("div", {
206
+ className: "flex flex-wrap items-center justify-between gap-3",
207
+ children: [z ? /* @__PURE__ */ c("p", {
208
+ className: "type-meta font-medium text-muted-foreground",
209
+ children: z
210
+ }) : null, Z]
211
+ }),
212
+ $,
213
+ Q.length ? /* @__PURE__ */ c("div", {
214
+ className: "mt-3 flex flex-wrap gap-2",
215
+ children: Q
216
+ }) : null
217
+ ]
218
+ }) : /* @__PURE__ */ l("div", {
219
+ "data-slot": "stacked-bar-chart",
220
+ "data-variant": D,
221
+ className: k,
222
+ ...A,
223
+ children: [
224
+ z ? /* @__PURE__ */ c("h2", {
225
+ className: "type-section-title font-medium",
226
+ children: z
227
+ }) : null,
228
+ /* @__PURE__ */ l("div", {
229
+ className: "mt-4 flex flex-wrap items-center gap-3",
230
+ children: [Z, Q.length ? /* @__PURE__ */ c("div", {
231
+ className: "flex flex-wrap items-center gap-2",
232
+ children: Q
233
+ }) : null]
234
+ }),
235
+ $
236
+ ]
237
+ });
238
+ }
239
+ //#endregion
240
+ export { C as StackedBarChart };
@@ -0,0 +1,2 @@
1
+ export * from './state-banner';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/state-banner/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,32 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * - `stale`: the page's data changed while it was open.
4
+ * - `connect`: a source to connect.
5
+ * - `waiting`: something is on its way.
6
+ * - `warning`: something failed or needs the owner.
7
+ */
8
+ type StateBannerTone = 'stale' | 'connect' | 'waiting' | 'warning';
9
+ declare const stateBannerVariants: (props?: ({
10
+ tone?: "waiting" | "warning" | "stale" | "connect" | null | undefined;
11
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
12
+ type StateBannerProps = React.ComponentProps<'div'> & {
13
+ tone: StateBannerTone;
14
+ /** The action's label. The action shows only when this is set. */
15
+ action?: React.ReactNode;
16
+ onAction?: () => void;
17
+ };
18
+ /** A page-state banner: a notice, an icon for its tone, and at most one action. */
19
+ declare function StateBanner({ tone, action, onAction, className, children, ...props }: StateBannerProps): React.JSX.Element;
20
+ type StaleBannerProps = Omit<StateBannerProps, 'tone' | 'action' | 'onAction' | 'children'> & {
21
+ /** Whether the page's data changed while it was open. */
22
+ stale: boolean;
23
+ /** What changed, e.g. "Your plan". The banner reads "<what> changed while you were here." */
24
+ what: React.ReactNode;
25
+ /** Reloads the page's data. The banner hides itself after it runs. */
26
+ onRefresh?: () => void;
27
+ refreshLabel?: React.ReactNode;
28
+ };
29
+ /** The realtime notice: the page's data changed while it was open. Refresh reloads it. */
30
+ declare function StaleBanner({ stale, what, onRefresh, refreshLabel, ...props }: StaleBannerProps): React.JSX.Element | null;
31
+ export { StaleBanner, StateBanner, stateBannerVariants, type StaleBannerProps, type StateBannerProps, type StateBannerTone, };
32
+ //# sourceMappingURL=state-banner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-banner.d.ts","sourceRoot":"","sources":["../../../src/components/state-banner/state-banner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAY9B;;;;;GAKG;AACH,KAAK,eAAe,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAA;AAElE,QAAA,MAAM,mBAAmB;;8EAaxB,CAAA;AA+BD,KAAK,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IACpD,IAAI,EAAE,eAAe,CAAA;IACrB,kEAAkE;IAClE,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB,CAAA;AAED,mFAAmF;AACnF,iBAAS,WAAW,CAAC,EACnB,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,gBAAgB,qBAwBlB;AAED,KAAK,gBAAgB,GAAG,IAAI,CAC1B,gBAAgB,EAChB,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAC5C,GAAG;IACF,yDAAyD;IACzD,KAAK,EAAE,OAAO,CAAA;IACd,6FAA6F;IAC7F,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IACrB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC/B,CAAA;AAED,0FAA0F;AAC1F,iBAAS,WAAW,CAAC,EACnB,KAAK,EACL,IAAI,EACJ,SAAS,EACT,YAAwB,EACxB,GAAG,KAAK,EACT,EAAE,gBAAgB,4BAyBlB;AAED,OAAO,EACL,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,CAAA"}
@@ -0,0 +1,70 @@
1
+ import { cn as e } from "../../lib/utils.js";
2
+ import { Button as t } from "../button/button.js";
3
+ import * as n from "react";
4
+ import { cva as r } from "class-variance-authority";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import { IconAlertTriangle as o, IconClock as s, IconPlus as c, IconRefresh as l } from "@tabler/icons-react";
7
+ //#region src/components/state-banner/state-banner.tsx
8
+ var u = r("flex items-center gap-3 rounded-lg px-4 py-3", {
9
+ variants: { tone: {
10
+ stale: "bg-surface-subtle",
11
+ connect: "bg-surface-subtle",
12
+ waiting: "bg-surface-subtle",
13
+ warning: "bg-warning-soft"
14
+ } },
15
+ defaultVariants: { tone: "stale" }
16
+ }), d = "icon-optical-16 flex-none", f = {
17
+ stale: /* @__PURE__ */ i(l, {
18
+ "aria-hidden": "true",
19
+ className: e(d, "text-info")
20
+ }),
21
+ connect: /* @__PURE__ */ i(c, {
22
+ "aria-hidden": "true",
23
+ className: e(d, "text-muted-foreground")
24
+ }),
25
+ waiting: /* @__PURE__ */ i(s, {
26
+ "aria-hidden": "true",
27
+ className: e(d, "text-muted-foreground")
28
+ }),
29
+ warning: /* @__PURE__ */ i(o, {
30
+ "aria-hidden": "true",
31
+ className: e(d, "text-warning")
32
+ })
33
+ };
34
+ function p({ tone: n, action: r, onAction: o, className: s, children: c, ...l }) {
35
+ return /* @__PURE__ */ a("div", {
36
+ "data-slot": "state-banner",
37
+ "data-tone": n,
38
+ role: n === "warning" ? "alert" : "status",
39
+ className: e(u({ tone: n }), s),
40
+ ...l,
41
+ children: [
42
+ f[n],
43
+ /* @__PURE__ */ i("p", {
44
+ "data-slot": "state-banner-message",
45
+ className: "type-body flex-1",
46
+ children: c
47
+ }),
48
+ r ? /* @__PURE__ */ i(t, {
49
+ size: "sm",
50
+ variant: n === "stale" ? "secondary" : "primary",
51
+ onClick: o,
52
+ children: r
53
+ }) : null
54
+ ]
55
+ });
56
+ }
57
+ function m({ stale: e, what: t, onRefresh: r, refreshLabel: i = "Refresh", ...o }) {
58
+ let [s, c] = n.useState(!1), [l, u] = n.useState(e);
59
+ return e !== l && (u(e), e && c(!1)), !e || s ? null : /* @__PURE__ */ a(p, {
60
+ tone: "stale",
61
+ action: i,
62
+ onAction: () => {
63
+ c(!0), r?.();
64
+ },
65
+ ...o,
66
+ children: [t, " changed while you were here."]
67
+ });
68
+ }
69
+ //#endregion
70
+ export { m as StaleBanner, p as StateBanner, u as stateBannerVariants };
@@ -0,0 +1,2 @@
1
+ export * from './status-indicator';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/status-indicator/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,21 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as React from 'react';
3
+ /**
4
+ * - `success`: working, such as a connected account.
5
+ * - `warning`: working but needs the owner.
6
+ * - `danger`: broken or failed.
7
+ * - `neutral`: off or not started.
8
+ * - `none`: no dot, for a plain state such as "Not set up".
9
+ */
10
+ type StatusTone = 'success' | 'warning' | 'danger' | 'neutral' | 'none';
11
+ declare const statusDotVariants: (props?: ({
12
+ tone?: "none" | "success" | "warning" | "neutral" | "danger" | null | undefined;
13
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
14
+ type StatusIndicatorProps = React.ComponentProps<'span'> & VariantProps<typeof statusDotVariants>;
15
+ /**
16
+ * A state in words with a small colored dot before it, such as "Connected" or
17
+ * "Needs attention". The label carries the meaning; the dot is decorative.
18
+ */
19
+ declare function StatusIndicator({ tone, className, children, ...props }: StatusIndicatorProps): React.JSX.Element;
20
+ export { StatusIndicator, statusDotVariants, type StatusIndicatorProps, type StatusTone, };
21
+ //# sourceMappingURL=status-indicator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-indicator.d.ts","sourceRoot":"","sources":["../../../src/components/status-indicator/status-indicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE;;;;;;GAMG;AACH,KAAK,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAA;AAEvE,QAAA,MAAM,iBAAiB;;8EAWrB,CAAA;AAEF,KAAK,oBAAoB,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,GACtD,YAAY,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAExC;;;GAGG;AACH,iBAAS,eAAe,CAAC,EACvB,IAAgB,EAChB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,qBAmBtB;AAED,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,UAAU,GAChB,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { cn as e } from "../../lib/utils.js";
2
+ import "react";
3
+ import { cva as t } from "class-variance-authority";
4
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
+ //#region src/components/status-indicator/status-indicator.tsx
6
+ var i = t("size-1.5 flex-none rounded-full", {
7
+ variants: { tone: {
8
+ success: "bg-success",
9
+ warning: "bg-warning",
10
+ danger: "bg-destructive",
11
+ neutral: "bg-muted-foreground/50",
12
+ none: "hidden"
13
+ } },
14
+ defaultVariants: { tone: "neutral" }
15
+ });
16
+ function a({ tone: t = "neutral", className: a, children: o, ...s }) {
17
+ return /* @__PURE__ */ r("span", {
18
+ "data-slot": "status-indicator",
19
+ "data-tone": t,
20
+ className: e("type-body inline-flex flex-none items-center gap-1.5 whitespace-nowrap text-muted-foreground", a),
21
+ ...s,
22
+ children: [/* @__PURE__ */ n("span", {
23
+ "aria-hidden": "true",
24
+ "data-slot": "status-indicator-dot",
25
+ className: i({ tone: t })
26
+ }), o]
27
+ });
28
+ }
29
+ //#endregion
30
+ export { a as StatusIndicator, i as statusDotVariants };
@@ -0,0 +1,2 @@
1
+ export * from './suggest-chips';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/suggest-chips/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}