@giddaa-housing/ui 1.1.0 → 2.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/css/generated/shared.css +1 -1
- package/css/giddaa.css +12 -2
- package/dist/badge.js +1 -1
- package/dist/bullet-chart.d.ts +8 -4
- package/dist/bullet-chart.js +10 -6
- package/dist/button.js +1 -1
- package/dist/card.js +1 -1
- package/dist/chart.d.ts +33 -5
- package/dist/chart.js +210 -13
- package/dist/checkbox.js +1 -1
- package/dist/data-table.d.ts +7 -3
- package/dist/data-table.js +8 -5
- package/dist/dialog-nesting.d.ts +9 -0
- package/dist/dialog-nesting.js +27 -0
- package/dist/dialog.js +9 -5
- package/dist/file-upload.d.ts +43 -0
- package/dist/file-upload.js +154 -0
- package/dist/funnel-chart.d.ts +11 -7
- package/dist/funnel-chart.js +11 -8
- package/dist/input-group.js +1 -1
- package/dist/input-otp.d.ts +23 -0
- package/dist/input-otp.js +56 -0
- package/dist/input.js +1 -1
- package/dist/line-chart.d.ts +113 -41
- package/dist/line-chart.js +217 -30
- package/dist/list-item.d.ts +22 -0
- package/dist/list-item.js +84 -0
- package/dist/number-input.js +20 -17
- package/dist/pie-chart.d.ts +83 -52
- package/dist/pie-chart.js +85 -43
- package/dist/purchase-option-card.d.ts +79 -0
- package/dist/purchase-option-card.js +176 -0
- package/dist/radio-group.js +1 -1
- package/dist/select.js +1 -1
- package/dist/sheet.d.ts +4 -2
- package/dist/sheet.js +22 -11
- package/dist/sparkline.d.ts +28 -15
- package/dist/sparkline.js +131 -37
- package/dist/styles.css +831 -119
- package/dist/switch.js +1 -1
- package/dist/table.js +6 -2
- package/dist/tabs.d.ts +21 -5
- package/dist/tabs.js +55 -12
- package/dist/textarea.js +1 -1
- package/dist/tree-map.d.ts +14 -14
- package/dist/tree-map.js +14 -15
- package/package.json +17 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as cn } from "./cn-BI_4DMBf.js";
|
|
3
|
+
import { CircularProgress, Progress, ProgressValue } from "./progress.js";
|
|
4
|
+
import { File, X } from "lucide-react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { createContext, useContext } from "react";
|
|
7
|
+
//#region src/file-upload.tsx
|
|
8
|
+
const FileUploadContext = createContext(null);
|
|
9
|
+
function normalizeProgress(value) {
|
|
10
|
+
if (!Number.isFinite(value)) return 0;
|
|
11
|
+
return Math.min(100, Math.max(0, Math.round(value)));
|
|
12
|
+
}
|
|
13
|
+
function useFileUpload() {
|
|
14
|
+
const context = useContext(FileUploadContext);
|
|
15
|
+
if (!context) throw new Error("FileUpload compound components must be rendered inside <FileUpload>.");
|
|
16
|
+
return context;
|
|
17
|
+
}
|
|
18
|
+
function FileUpload({ className, state = "uploading", value, "aria-busy": ariaBusy, ...props }) {
|
|
19
|
+
const progress = normalizeProgress(value);
|
|
20
|
+
return /* @__PURE__ */ jsx(FileUploadContext.Provider, {
|
|
21
|
+
value: {
|
|
22
|
+
state,
|
|
23
|
+
value: progress
|
|
24
|
+
},
|
|
25
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
26
|
+
"data-slot": "file-upload",
|
|
27
|
+
"data-state": state,
|
|
28
|
+
"data-value": progress,
|
|
29
|
+
"aria-busy": ariaBusy ?? (state === "uploading" || void 0),
|
|
30
|
+
className: cn("group/file-upload relative flex min-w-0 items-start gap-3 rounded-xl border border-line bg-surface p-3", "data-[state=error]:border-line-danger data-[state=error]:bg-surface-danger-subtle", className),
|
|
31
|
+
...props
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function FileUploadPreview({ className, ...props }) {
|
|
36
|
+
return /* @__PURE__ */ jsx("div", {
|
|
37
|
+
"data-slot": "file-upload-preview",
|
|
38
|
+
className: cn("relative flex size-20 shrink-0 items-center justify-center rounded-lg bg-surface-raised", className),
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function FileUploadImage({ className, alt = "", ...props }) {
|
|
43
|
+
return /* @__PURE__ */ jsx("img", {
|
|
44
|
+
"data-slot": "file-upload-image",
|
|
45
|
+
className: cn("size-full rounded-[inherit] object-cover", className),
|
|
46
|
+
alt,
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function FileUploadOverlay({ className, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx("div", {
|
|
52
|
+
"data-slot": "file-upload-overlay",
|
|
53
|
+
className: cn("absolute inset-0 flex items-center justify-center rounded-[inherit] bg-black/45", className),
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function FileUploadPreviewAction({ className, ...props }) {
|
|
58
|
+
return /* @__PURE__ */ jsx("div", {
|
|
59
|
+
"data-slot": "file-upload-preview-action",
|
|
60
|
+
className: cn("absolute -top-2 -right-2 z-10", className),
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function FileUploadIcon({ className, children, ...props }) {
|
|
65
|
+
return /* @__PURE__ */ jsx("div", {
|
|
66
|
+
"data-slot": "file-upload-icon",
|
|
67
|
+
className: cn("flex size-11 shrink-0 items-center justify-center rounded-lg bg-surface-brand-subtle text-fg-brand", "group-data-[state=error]/file-upload:bg-surface-danger-subtle group-data-[state=error]/file-upload:text-status-danger", className),
|
|
68
|
+
...props,
|
|
69
|
+
children: children ?? /* @__PURE__ */ jsx(File, {
|
|
70
|
+
"aria-hidden": "true",
|
|
71
|
+
className: "size-5"
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function FileUploadContent({ className, ...props }) {
|
|
76
|
+
return /* @__PURE__ */ jsx("div", {
|
|
77
|
+
"data-slot": "file-upload-content",
|
|
78
|
+
className: cn("min-w-0 flex-1", className),
|
|
79
|
+
...props
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function FileUploadHeader({ className, ...props }) {
|
|
83
|
+
return /* @__PURE__ */ jsx("div", {
|
|
84
|
+
"data-slot": "file-upload-header",
|
|
85
|
+
className: cn("flex min-w-0 items-center gap-2", className),
|
|
86
|
+
...props
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function FileUploadName({ className, ...props }) {
|
|
90
|
+
return /* @__PURE__ */ jsx("p", {
|
|
91
|
+
"data-slot": "file-upload-name",
|
|
92
|
+
className: cn("min-w-0 flex-1 truncate text-gdt-sm font-semibold leading-snug text-fg-primary", className),
|
|
93
|
+
...props
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function FileUploadMeta({ className, ...props }) {
|
|
97
|
+
return /* @__PURE__ */ jsx("p", {
|
|
98
|
+
"data-slot": "file-upload-meta",
|
|
99
|
+
className: cn("mt-0.5 text-gdt-xs leading-snug text-fg-secondary", className),
|
|
100
|
+
...props
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function FileUploadStatus({ className, children, pendingLabel = "Waiting to upload", uploadingLabel, completeLabel = "Upload complete", errorLabel = "Upload failed", ...props }) {
|
|
104
|
+
const context = useFileUpload();
|
|
105
|
+
const defaultLabels = {
|
|
106
|
+
pending: pendingLabel,
|
|
107
|
+
uploading: uploadingLabel ?? `${context.value}% uploaded`,
|
|
108
|
+
complete: completeLabel,
|
|
109
|
+
error: errorLabel
|
|
110
|
+
};
|
|
111
|
+
const content = typeof children === "function" ? children(context) : children ?? defaultLabels[context.state];
|
|
112
|
+
return /* @__PURE__ */ jsx("output", {
|
|
113
|
+
"data-slot": "file-upload-status",
|
|
114
|
+
"aria-live": "polite",
|
|
115
|
+
className: cn("text-gdt-xs leading-snug text-fg-secondary", "group-data-[state=complete]/file-upload:text-status-success group-data-[state=error]/file-upload:text-status-danger", className),
|
|
116
|
+
...props,
|
|
117
|
+
children: content
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function FileUploadProgress({ className, children, showValue = true, "aria-label": ariaLabel = "Upload progress", ...props }) {
|
|
121
|
+
const { state, value } = useFileUpload();
|
|
122
|
+
return /* @__PURE__ */ jsx(Progress, {
|
|
123
|
+
value,
|
|
124
|
+
"aria-label": ariaLabel,
|
|
125
|
+
className: cn("mt-2", state === "complete" && "[&_[data-slot=progress-indicator]]:bg-status-success", state === "error" && "[&_[data-slot=progress-indicator]]:bg-status-danger", className),
|
|
126
|
+
...props,
|
|
127
|
+
children: children ?? (showValue ? /* @__PURE__ */ jsx(ProgressValue, {}) : null)
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function FileUploadCircularProgress({ className, labelOverlay = true, "aria-label": ariaLabel = "Upload progress", ...props }) {
|
|
131
|
+
const { state, value } = useFileUpload();
|
|
132
|
+
return /* @__PURE__ */ jsx(CircularProgress, {
|
|
133
|
+
value,
|
|
134
|
+
labelOverlay,
|
|
135
|
+
"aria-label": ariaLabel,
|
|
136
|
+
className: cn("text-white [&_circle:first-child]:text-white/35 [&_circle:last-child]:text-white", state === "complete" && "[&_circle:last-child]:text-status-success", state === "error" && "[&_circle:last-child]:text-status-danger", className),
|
|
137
|
+
...props
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function FileUploadCancel({ className, type = "button", children, variant = "ghost", "aria-label": ariaLabel = "Cancel upload", ...props }) {
|
|
141
|
+
return /* @__PURE__ */ jsx("button", {
|
|
142
|
+
"data-slot": "file-upload-cancel",
|
|
143
|
+
type,
|
|
144
|
+
"aria-label": ariaLabel,
|
|
145
|
+
className: cn("inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full border border-transparent bg-transparent p-0 text-fg-secondary", "transition-[background-color,border-color,color,box-shadow] hover:bg-surface-raised hover:text-fg-primary focus-visible:border-line-focus focus-visible:outline-none focus-visible:shadow-[0_0_0_2px_var(--color-line-focus)] disabled:pointer-events-none disabled:opacity-50", variant === "surface" && "border-line bg-surface-overlay shadow-sm hover:bg-surface-raised", className),
|
|
146
|
+
...props,
|
|
147
|
+
children: children ?? /* @__PURE__ */ jsx(X, {
|
|
148
|
+
"aria-hidden": "true",
|
|
149
|
+
className: "size-4"
|
|
150
|
+
})
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
export { FileUpload, FileUploadCancel, FileUploadCircularProgress, FileUploadContent, FileUploadHeader, FileUploadIcon, FileUploadImage, FileUploadMeta, FileUploadName, FileUploadOverlay, FileUploadPreview, FileUploadPreviewAction, FileUploadProgress, FileUploadStatus, useFileUpload };
|
package/dist/funnel-chart.d.ts
CHANGED
|
@@ -9,9 +9,10 @@ import * as React from "react";
|
|
|
9
9
|
* (recharts `BarChart`, vertical layout) over a faint 100 % reference, using
|
|
10
10
|
* recharts' built-in `Bar` `background`. Both read top-down as the audience
|
|
11
11
|
* drops off, and both reuse the same stage data, palette, value-label column,
|
|
12
|
-
* legend, frame, and tooltip — only the inner plot differs (the same
|
|
13
|
-
* `Sparkline
|
|
14
|
-
* directly here, never
|
|
12
|
+
* legend, frame, and tooltip — only the inner plot differs (the same
|
|
13
|
+
* split-by-render-style approach as the `Sparkline*` components). Per the chart
|
|
14
|
+
* architecture the recharts primitives are rendered directly here, never
|
|
15
|
+
* wrapped.
|
|
15
16
|
*
|
|
16
17
|
* @example
|
|
17
18
|
* <FunnelChart
|
|
@@ -40,11 +41,14 @@ type FunnelStage = {
|
|
|
40
41
|
fill?: string;
|
|
41
42
|
};
|
|
42
43
|
/**
|
|
43
|
-
* Stage palette, ordered top-of-funnel → bottom
|
|
44
|
-
*
|
|
45
|
-
*
|
|
44
|
+
* Stage palette, ordered top-of-funnel → bottom. A funnel encodes *magnitude*
|
|
45
|
+
* (each stage is a share of the one above), not identity, so — like
|
|
46
|
+
* `heatmap-chart` — stages take one theme-aware hue (`surface-brand`) at a
|
|
47
|
+
* descending opacity ramp rather than distinct categorical hues. The ramp is
|
|
48
|
+
* floored (down to 20%, not the heatmap's 8%) so the faintest stage's legend dot
|
|
49
|
+
* stays legible. Assign by order, or override per stage with `fill`.
|
|
46
50
|
*/
|
|
47
|
-
declare const FUNNEL_CHART_PALETTE: readonly ["var(--color-
|
|
51
|
+
declare const FUNNEL_CHART_PALETTE: readonly ["rgb(from var(--color-surface-brand) r g b / 1)", "rgb(from var(--color-surface-brand) r g b / 0.78)", "rgb(from var(--color-surface-brand) r g b / 0.56)", "rgb(from var(--color-surface-brand) r g b / 0.36)", "rgb(from var(--color-surface-brand) r g b / 0.2)"];
|
|
48
52
|
type FunnelChartLayout = {
|
|
49
53
|
/** Plot box height in px. */
|
|
50
54
|
height: number;
|
package/dist/funnel-chart.js
CHANGED
|
@@ -7,16 +7,19 @@ import { cva } from "class-variance-authority";
|
|
|
7
7
|
import { Bar, BarChart, Funnel, FunnelChart as FunnelChart$1, XAxis, YAxis } from "recharts";
|
|
8
8
|
//#region src/funnel-chart.tsx
|
|
9
9
|
/**
|
|
10
|
-
* Stage palette, ordered top-of-funnel → bottom
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Stage palette, ordered top-of-funnel → bottom. A funnel encodes *magnitude*
|
|
11
|
+
* (each stage is a share of the one above), not identity, so — like
|
|
12
|
+
* `heatmap-chart` — stages take one theme-aware hue (`surface-brand`) at a
|
|
13
|
+
* descending opacity ramp rather than distinct categorical hues. The ramp is
|
|
14
|
+
* floored (down to 20%, not the heatmap's 8%) so the faintest stage's legend dot
|
|
15
|
+
* stays legible. Assign by order, or override per stage with `fill`.
|
|
13
16
|
*/
|
|
14
17
|
const FUNNEL_CHART_PALETTE = [
|
|
15
|
-
"var(--color-
|
|
16
|
-
"var(--color-
|
|
17
|
-
"var(--color-
|
|
18
|
-
"var(--color-
|
|
19
|
-
"var(--color-
|
|
18
|
+
"rgb(from var(--color-surface-brand) r g b / 1)",
|
|
19
|
+
"rgb(from var(--color-surface-brand) r g b / 0.78)",
|
|
20
|
+
"rgb(from var(--color-surface-brand) r g b / 0.56)",
|
|
21
|
+
"rgb(from var(--color-surface-brand) r g b / 0.36)",
|
|
22
|
+
"rgb(from var(--color-surface-brand) r g b / 0.2)"
|
|
20
23
|
];
|
|
21
24
|
const FUNNEL_CHART_LAYOUT = {
|
|
22
25
|
sm: {
|
package/dist/input-group.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Textarea } from "./textarea.js";
|
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
9
9
|
import { cva } from "class-variance-authority";
|
|
10
10
|
//#region src/input-group.tsx
|
|
11
|
-
const inputGroupVariants = cva("group/input-group relative flex w-full min-w-0 items-center rounded-full has-[textarea]:rounded-xl has-data-[align=block-end]:rounded-xl has-data-[align=block-start]:rounded-xl border border-line bg-canvas transition-[background-color,border-color,box-shadow,color] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:border-line-subtle has-disabled:bg-surface has-disabled:text-fg-caption-placeholder focus-within:border-line-focus focus-within:inset-ring-1 inset-ring-line-focus has-[[data-slot][aria-invalid=true]]:border-line-danger has-[[data-slot][aria-invalid=true]]:inset-shadow-none has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:group-data-[size=sm]/input-group:pl-2 has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:group-data-[size=md]/input-group:pl-2.5 has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:group-data-[size=lg]/input-group:pl-3 has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:group-data-[size=xl]/input-group:pl-3 has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:group-data-[size=sm]/input-group:pr-2 has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:group-data-[size=md]/input-group:pr-2.5 has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:group-data-[size=lg]/input-group:pr-3 has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:group-data-[size=xl]/input-group:pr-3", {
|
|
11
|
+
const inputGroupVariants = cva("group/input-group relative flex w-full min-w-0 items-center rounded-full has-[textarea]:rounded-xl has-data-[align=block-end]:rounded-xl has-data-[align=block-start]:rounded-xl border border-line bg-canvas transition-[background-color,border-color,box-shadow,color] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:border-line-subtle has-disabled:bg-surface has-disabled:text-fg-caption-placeholder focus-within:border-line-focus focus-within:inset-ring-1 focus-within:inset-ring-line-focus has-[[data-slot][aria-invalid=true]]:border-line-danger has-[[data-slot][aria-invalid=true]]:inset-shadow-none has-[[data-slot][aria-invalid=true]]:focus-within:border-line-danger has-[[data-slot][aria-invalid=true]]:focus-within:inset-ring-line-danger has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:group-data-[size=sm]/input-group:pl-2 has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:group-data-[size=md]/input-group:pl-2.5 has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:group-data-[size=lg]/input-group:pl-3 has-[>[data-align=inline-start]]:[&>[data-slot=input-group-control]]:group-data-[size=xl]/input-group:pl-3 has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:group-data-[size=sm]/input-group:pr-2 has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:group-data-[size=md]/input-group:pr-2.5 has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:group-data-[size=lg]/input-group:pr-3 has-[>[data-align=inline-end]]:[&>[data-slot=input-group-control]]:group-data-[size=xl]/input-group:pr-3", {
|
|
12
12
|
variants: { size: {
|
|
13
13
|
sm: "h-8",
|
|
14
14
|
md: "h-10",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { n as InputSize } from "./input-CfoEJ8A6.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { OTPField } from "@base-ui/react/otp-field";
|
|
4
|
+
//#region src/input-otp.d.ts
|
|
5
|
+
declare const inputOTPSlotVariants: (props?: ({
|
|
6
|
+
size?: "lg" | "md" | "sm" | "xl" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
type InputOTPProps = Omit<OTPField.Root.Props, "className"> & {
|
|
9
|
+
className?: string;
|
|
10
|
+
size?: InputSize;
|
|
11
|
+
};
|
|
12
|
+
declare function InputOTP({ className, size, ...props }: InputOTPProps): React.JSX.Element;
|
|
13
|
+
declare function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
14
|
+
type InputOTPSlotProps = Omit<OTPField.Input.Props, "className"> & {
|
|
15
|
+
className?: string;
|
|
16
|
+
};
|
|
17
|
+
declare function InputOTPSlot({ className, ...props }: InputOTPSlotProps): React.JSX.Element;
|
|
18
|
+
type InputOTPSeparatorProps = Omit<OTPField.Separator.Props, "className"> & {
|
|
19
|
+
className?: string;
|
|
20
|
+
};
|
|
21
|
+
declare function InputOTPSeparator({ children, className, ...props }: InputOTPSeparatorProps): React.JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { InputOTP, InputOTPGroup, type InputOTPProps, InputOTPSeparator, InputOTPSlot, type InputOTPSlotProps, inputOTPSlotVariants };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as cn } from "./cn-BI_4DMBf.js";
|
|
3
|
+
import { InputSizeProvider, useInputComponentSize } from "./input-size-context.js";
|
|
4
|
+
import { MinusIcon } from "lucide-react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
import { OTPField } from "@base-ui/react/otp-field";
|
|
8
|
+
//#region src/input-otp.tsx
|
|
9
|
+
const inputOTPSlotVariants = cva("relative flex shrink-0 appearance-none items-center justify-center rounded-full border border-line bg-canvas text-center font-normal text-fg-primary caret-fg-primary outline-none transition-[background-color,border-color,box-shadow,color] placeholder:text-fg-caption-placeholder hover:border-line-strong focus:z-10 focus:border-line-focus focus:inset-ring-1 focus:inset-ring-line-focus data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:border-line-subtle data-disabled:bg-surface data-disabled:text-fg-caption-placeholder aria-invalid:border-line-danger aria-invalid:text-fg-danger aria-invalid:focus:border-line-danger aria-invalid:focus:inset-ring-line-danger data-invalid:border-line-danger data-invalid:text-fg-danger data-invalid:focus:border-line-danger data-invalid:focus:inset-ring-line-danger group-aria-invalid/input-otp:border-line-danger group-aria-invalid/input-otp:text-fg-danger group-aria-invalid/input-otp:focus:border-line-danger group-aria-invalid/input-otp:focus:inset-ring-line-danger", {
|
|
10
|
+
variants: { size: {
|
|
11
|
+
sm: "size-8 text-gdt-xs",
|
|
12
|
+
md: "size-10 text-gdt-sm",
|
|
13
|
+
lg: "size-12 text-gdt-md",
|
|
14
|
+
xl: "size-14 text-gdt-lg"
|
|
15
|
+
} },
|
|
16
|
+
defaultVariants: { size: "md" }
|
|
17
|
+
});
|
|
18
|
+
function InputOTP({ className, size, ...props }) {
|
|
19
|
+
const resolvedSize = useInputComponentSize(size);
|
|
20
|
+
return /* @__PURE__ */ jsx(InputSizeProvider, {
|
|
21
|
+
size: resolvedSize,
|
|
22
|
+
children: /* @__PURE__ */ jsx(OTPField.Root, {
|
|
23
|
+
"data-slot": "input-otp",
|
|
24
|
+
"data-size": resolvedSize,
|
|
25
|
+
className: cn("group/input-otp flex items-center gap-2 data-disabled:cursor-not-allowed data-disabled:opacity-50", className),
|
|
26
|
+
...props
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function InputOTPGroup({ className, ...props }) {
|
|
31
|
+
return /* @__PURE__ */ jsx("div", {
|
|
32
|
+
"data-slot": "input-otp-group",
|
|
33
|
+
"data-size": useInputComponentSize(),
|
|
34
|
+
className: cn("flex items-center rounded-full [&>[data-slot=input-otp-slot]:first-child]:rounded-l-full [&>[data-slot=input-otp-slot]:last-child]:rounded-r-full [&>[data-slot=input-otp-slot]:not(:first-child)]:-ml-px [&>[data-slot=input-otp-slot]]:rounded-none", className),
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function InputOTPSlot({ className, ...props }) {
|
|
39
|
+
const resolvedSize = useInputComponentSize();
|
|
40
|
+
return /* @__PURE__ */ jsx(OTPField.Input, {
|
|
41
|
+
"data-slot": "input-otp-slot",
|
|
42
|
+
"data-size": resolvedSize,
|
|
43
|
+
className: cn(inputOTPSlotVariants({ size: resolvedSize }), className),
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function InputOTPSeparator({ children, className, ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx(OTPField.Separator, {
|
|
49
|
+
"data-slot": "input-otp-separator",
|
|
50
|
+
className: cn("flex items-center justify-center px-1 text-fg-secondary [&_svg:not([class*='size-'])]:size-4", className),
|
|
51
|
+
...props,
|
|
52
|
+
children: children ?? /* @__PURE__ */ jsx(MinusIcon, {})
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, inputOTPSlotVariants };
|
package/dist/input.js
CHANGED
|
@@ -4,7 +4,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
import { Input as Input$1 } from "@base-ui/react/input";
|
|
6
6
|
//#region src/input.tsx
|
|
7
|
-
const inputVariants = cva("flex w-full min-w-0 rounded-full border border-line bg-canvas text-fg-primary transition-[background-color,border-color,box-shadow,color] outline-none file:inline-flex file:border-0 file:bg-transparent file:font-normal file:text-fg-primary placeholder:text-fg-caption-placeholder hover:border-line-strong focus-visible:border-line-focus focus-visible:inset-ring-1 inset-ring-line-focus disabled:pointer-events-none disabled:cursor-not-allowed disabled:border-line-subtle disabled:bg-surface disabled:text-fg-caption-placeholder disabled:placeholder:text-fg-caption-placeholder aria-invalid:border-line-danger aria-invalid:text-fg-danger aria-invalid:placeholder:text-fg-danger aria-invalid:shadow-none", {
|
|
7
|
+
const inputVariants = cva("flex w-full min-w-0 rounded-full border border-line bg-canvas text-fg-primary transition-[background-color,border-color,box-shadow,color] outline-none file:inline-flex file:border-0 file:bg-transparent file:font-normal file:text-fg-primary placeholder:text-fg-caption-placeholder hover:border-line-strong focus-visible:border-line-focus focus-visible:inset-ring-1 focus-visible:inset-ring-line-focus disabled:pointer-events-none disabled:cursor-not-allowed disabled:border-line-subtle disabled:bg-surface disabled:text-fg-caption-placeholder disabled:placeholder:text-fg-caption-placeholder aria-invalid:border-line-danger aria-invalid:text-fg-danger aria-invalid:placeholder:text-fg-danger aria-invalid:shadow-none aria-invalid:focus-visible:border-line-danger aria-invalid:focus-visible:inset-ring-line-danger", {
|
|
8
8
|
variants: { size: {
|
|
9
9
|
sm: "h-8 px-3 text-gdt-xs font-normal file:text-gdt-xs",
|
|
10
10
|
md: "h-10 px-3.5 text-gdt-sm font-normal file:text-gdt-sm",
|
package/dist/line-chart.d.ts
CHANGED
|
@@ -1,43 +1,47 @@
|
|
|
1
1
|
import { t as ComponentSize } from "./size-context-D4mYvcg8.js";
|
|
2
|
+
import { ChartConfig } from "./chart.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Area, AreaChart as AreaChart$1, CartesianGrid, Line, LineChart as LineChart$1, XAxis, YAxis } from "recharts";
|
|
2
5
|
//#region src/line-chart.d.ts
|
|
3
6
|
/**
|
|
4
|
-
* Line charts are
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Line and area charts are composable wrappers over the recharts cartesian
|
|
8
|
+
* primitives. recharts 3 registers graphical items through context when they
|
|
9
|
+
* render, so the primitives CAN be wrapped in our own components. Each wrapper
|
|
10
|
+
* bakes in the giddaa defaults (tokens, size-scaled type, mark specs) and
|
|
11
|
+
* forwards every recharts prop, so anything can be overridden in place or
|
|
12
|
+
* replaced with the raw recharts element.
|
|
9
13
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* `
|
|
13
|
-
*
|
|
14
|
-
* Tokens:
|
|
15
|
-
* - Primary series stroke + dots + area fill: `var(--color-surface-brand)`
|
|
16
|
-
* - Comparison series: `var(--color-surface-accent)`
|
|
17
|
-
* - Gridlines: `var(--color-line-subtle)`
|
|
18
|
-
* - Area wash: primary series colour at 15 % opacity (`fillOpacity={0.15}`)
|
|
19
|
-
* - Active-dot ring: `var(--color-surface-raised)` stroke (matches card bg)
|
|
14
|
+
* Anatomy: `LineChart`/`AreaChart` are the plot roots (frame + responsive box +
|
|
15
|
+
* recharts chart); compose the grid, axes, series, and the shared overlays from
|
|
16
|
+
* `./chart` as children. Both roots share the same axis and grid wrappers.
|
|
20
17
|
*
|
|
21
18
|
* @example
|
|
22
|
-
* const chart = useLineChartLayout();
|
|
23
19
|
* <ChartCard size="md">
|
|
24
20
|
* <ChartHeader>
|
|
25
21
|
* <ChartTitle>Revenue Overview</ChartTitle>
|
|
26
22
|
* <ChartDescription>Monthly revenue · Jan–Jul</ChartDescription>
|
|
27
23
|
* </ChartHeader>
|
|
28
|
-
* <
|
|
29
|
-
* <
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* <Area dataKey="revenue" {...chart.area("var(--color-revenue)")} />
|
|
36
|
-
* </AreaChart>
|
|
37
|
-
* </ChartContainer>
|
|
24
|
+
* <AreaChart config={config} data={data}>
|
|
25
|
+
* <LineChartGrid />
|
|
26
|
+
* <LineChartXAxis dataKey="month" />
|
|
27
|
+
* <LineChartYAxis />
|
|
28
|
+
* <ChartTooltip content={<ChartTooltipContent />} />
|
|
29
|
+
* <AreaChartSeries dataKey="revenue" name="Revenue" />
|
|
30
|
+
* </AreaChart>
|
|
38
31
|
* </ChartCard>
|
|
39
32
|
*/
|
|
40
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Categorical series palette — the theme-aware `chart-1`…`chart-3` tokens.
|
|
35
|
+
* Assign colours in this fixed order, never cycled: a fourth series folds into
|
|
36
|
+
* "Other" or becomes a second chart.
|
|
37
|
+
*/
|
|
38
|
+
declare const LINE_CHART_PALETTE: readonly ["var(--color-chart-1)", "var(--color-chart-2)", "var(--color-chart-3)"];
|
|
39
|
+
/**
|
|
40
|
+
* Five sizes for line/area charts — extends the three shared `ComponentSize`
|
|
41
|
+
* values with `xl` and `huge` for hero trend panels. `xl`/`huge` scale the plot
|
|
42
|
+
* height and margins on the *root only*; the child series and axes resolve to
|
|
43
|
+
* `lg` marks (identical from `lg` up), so they never need the extended union.
|
|
44
|
+
*/
|
|
41
45
|
type LineChartSize = "sm" | "md" | "lg" | "xl" | "huge";
|
|
42
46
|
type LineChartLayout = {
|
|
43
47
|
/** Plot height in px. Width stays fluid via ResponsiveContainer. */
|
|
@@ -63,21 +67,89 @@ type LineChartLayout = {
|
|
|
63
67
|
tickMargin: number;
|
|
64
68
|
};
|
|
65
69
|
declare const LINE_CHART_LAYOUT: Record<LineChartSize, LineChartLayout>;
|
|
66
|
-
/**
|
|
70
|
+
/** Clamp the 5 line-chart sizes to the 3 `ComponentSize` values for children. */
|
|
67
71
|
declare function toComponentSize(size: LineChartSize): ComponentSize;
|
|
72
|
+
/** Shared root knobs — series theming, plot scale, and the plot-box className. */
|
|
73
|
+
type LineChartRootExtras = {
|
|
74
|
+
/** Series labels/icons for the shared tooltip and legend (see `ChartConfig`). */
|
|
75
|
+
config?: ChartConfig;
|
|
76
|
+
/** Plot scale; inherited from the nearest `SizeProvider` when omitted. */
|
|
77
|
+
size?: LineChartSize;
|
|
78
|
+
/** Applied to the responsive plot box, e.g. to override its height. */
|
|
79
|
+
className?: string;
|
|
80
|
+
};
|
|
81
|
+
type LineChartProps = Omit<React.ComponentProps<typeof LineChart$1>, "width" | "height"> & LineChartRootExtras;
|
|
82
|
+
type AreaChartProps = Omit<React.ComponentProps<typeof AreaChart$1>, "width" | "height"> & LineChartRootExtras;
|
|
68
83
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
|
|
80
|
-
|
|
84
|
+
* Plot root — wraps the shared `ChartContainer` (tooltip/legend theming,
|
|
85
|
+
* responsive box) around the recharts `LineChart` with a size-scaled height and
|
|
86
|
+
* margin. `size` flows to the child primitives through `SizeProvider` (clamped
|
|
87
|
+
* to `lg` for `xl`/`huge`). Extra props reach the recharts chart (`data`,
|
|
88
|
+
* `syncId`, …).
|
|
89
|
+
*/
|
|
90
|
+
declare function LineChart({ config, size, className, children, ...props }: LineChartProps): React.JSX.Element;
|
|
91
|
+
/**
|
|
92
|
+
* Plot root for filled trends — identical to `LineChart` but wraps the recharts
|
|
93
|
+
* `AreaChart`, so it hosts `AreaChartSeries` (and the same grid/axes/overlays).
|
|
94
|
+
*/
|
|
95
|
+
declare function AreaChart({ config, size, className, children, ...props }: AreaChartProps): React.JSX.Element;
|
|
96
|
+
type LineChartGridProps = React.ComponentProps<typeof CartesianGrid>;
|
|
97
|
+
/**
|
|
98
|
+
* Value reference lines — recharts `CartesianGrid` with vertical lines hidden
|
|
99
|
+
* and the visible grid painted with the `line` token (`line-subtle` matches the
|
|
100
|
+
* chart card surface in both themes, so it would vanish).
|
|
101
|
+
*/
|
|
102
|
+
declare function LineChartGrid(props: LineChartGridProps): React.JSX.Element;
|
|
103
|
+
type LineChartXAxisProps = React.ComponentProps<typeof XAxis> & {
|
|
104
|
+
/** Explicit axis scale; otherwise inherited from the chart's `size`. */
|
|
105
|
+
size?: LineChartSize;
|
|
106
|
+
};
|
|
107
|
+
type LineChartYAxisProps = React.ComponentProps<typeof YAxis> & {
|
|
108
|
+
/** Explicit axis scale; otherwise inherited from the chart's `size`. */
|
|
109
|
+
size?: LineChartSize;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Category (time) axis — recharts `XAxis` with no axis/tick lines, a size-scaled
|
|
113
|
+
* tick margin, and caption-placeholder tick ink. Passing your own `tick`
|
|
114
|
+
* replaces the default styling entirely.
|
|
115
|
+
*/
|
|
116
|
+
declare function LineChartXAxis({ size, tick, ...props }: LineChartXAxisProps): React.JSX.Element;
|
|
117
|
+
/**
|
|
118
|
+
* Value axis — recharts `YAxis` with no axis/tick lines, size-scaled tick type,
|
|
119
|
+
* and reserved width for value labels. Override `width` for long labels.
|
|
120
|
+
*/
|
|
121
|
+
declare function LineChartYAxis({ size, tick, ...props }: LineChartYAxisProps): React.JSX.Element;
|
|
122
|
+
type LineChartSeriesProps = React.ComponentProps<typeof Line> & {
|
|
123
|
+
/** Series colour for the stroke and dots. Defaults to the first chart token. */
|
|
124
|
+
color?: string;
|
|
125
|
+
/** Explicit mark scale; otherwise inherited from the chart's `size`. */
|
|
126
|
+
size?: LineChartSize;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* One line series — recharts `Line` with the giddaa mark spec: a 2px rounded
|
|
130
|
+
* stroke in `color`, solid resting dots, and a hover dot ringed in
|
|
131
|
+
* `surface-raised` so overlapping series stay separable. `color` drives all of
|
|
132
|
+
* them at once; `stroke`/`dot`/`activeDot` still win when passed directly.
|
|
133
|
+
*/
|
|
134
|
+
declare function LineChartSeries({ color, size, dot, activeDot, ...props }: LineChartSeriesProps): React.JSX.Element;
|
|
135
|
+
type AreaChartSeriesProps = React.ComponentProps<typeof Area> & {
|
|
136
|
+
/** Series colour for the stroke, wash, and dots. Defaults to the first chart token. */
|
|
137
|
+
color?: string;
|
|
138
|
+
/** Explicit mark scale; otherwise inherited from the chart's `size`. */
|
|
139
|
+
size?: LineChartSize;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* One area series — recharts `Area` with the giddaa mark spec: the same rounded
|
|
143
|
+
* 2px stroke and dots as `LineChartSeries`, plus the series colour washed to 15%
|
|
144
|
+
* beneath the stroke. `color` drives stroke + fill + dots at once;
|
|
145
|
+
* `stroke`/`fill`/`dot` still win when passed directly.
|
|
146
|
+
*/
|
|
147
|
+
declare function AreaChartSeries({ color, size, dot, activeDot, ...props }: AreaChartSeriesProps): React.JSX.Element;
|
|
148
|
+
/**
|
|
149
|
+
* @deprecated Compose the `<LineChart>`/`<AreaChart>` primitives instead — see
|
|
150
|
+
* the module example. This layout hook predates recharts 3 wrapping support and
|
|
151
|
+
* will be removed in the next major. It returns prop bags to spread onto raw
|
|
152
|
+
* recharts elements.
|
|
81
153
|
*/
|
|
82
154
|
declare function useLineChartLayout(size?: LineChartSize): {
|
|
83
155
|
container: {
|
|
@@ -151,4 +223,4 @@ declare function useLineChartLayout(size?: LineChartSize): {
|
|
|
151
223
|
};
|
|
152
224
|
};
|
|
153
225
|
//#endregion
|
|
154
|
-
export { LINE_CHART_LAYOUT, type LineChartLayout, type LineChartSize, toComponentSize, useLineChartLayout };
|
|
226
|
+
export { AreaChart, type AreaChartProps, AreaChartSeries, type AreaChartSeriesProps, LINE_CHART_LAYOUT, LINE_CHART_PALETTE, LineChart, LineChartGrid, type LineChartGridProps, type LineChartLayout, type LineChartProps, LineChartSeries, type LineChartSeriesProps, type LineChartSize, LineChartXAxis, type LineChartXAxisProps, LineChartYAxis, type LineChartYAxisProps, toComponentSize, useLineChartLayout };
|