@refraction-ui/react 0.20.1 → 0.22.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/dist/{chunk-ZF3OHCGV.js → chunk-2Q6HHFAN.js} +1 -1
- package/dist/chunk-2Q6HHFAN.js.map +7 -0
- package/dist/{chunk-533MCMSU.js → chunk-3I3DYDHR.js} +2 -2
- package/dist/{chunk-F7B64KT3.js → chunk-3Y2T26QD.js} +13 -7
- package/dist/chunk-3Y2T26QD.js.map +7 -0
- package/dist/{chunk-H54FLNAF.js → chunk-63N4PZUJ.js} +2 -2
- package/dist/{chunk-Y2FNNAIL.js → chunk-EGVPAMQU.js} +2 -2
- package/dist/chunk-EGVPAMQU.js.map +1 -0
- package/dist/{chunk-WK2IIUFO.js → chunk-QDMLIDYN.js} +2 -2
- package/dist/{chunk-BOLFYVI6.js → chunk-QPCKJ2YR.js} +2 -2
- package/dist/{chunk-TOZBR4GL.js → chunk-RSWOLRIC.js} +4 -4
- package/dist/{chunk-TOZBR4GL.js.map → chunk-RSWOLRIC.js.map} +1 -1
- package/dist/{chunk-UNEM2TRI.js → chunk-SDAJVXD4.js} +2 -2
- package/dist/{chunk-VK3EQ34F.js → chunk-V24GDHUX.js} +2 -2
- package/dist/{chunk-AMK4VCBG.js → chunk-WYKPPK3W.js} +2 -2
- package/dist/{chunk-ONACRMG4.js → chunk-XMFNBOPO.js} +2 -2
- package/dist/form.cjs.map +1 -1
- package/dist/form.js +1 -1
- package/dist/index.cjs +632 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/internal/action-list/index.d.ts +39 -0
- package/dist/internal/badge/index.d.cts +2 -2
- package/dist/internal/badge/index.d.ts +2 -2
- package/dist/internal/button/index.d.cts +4 -4
- package/dist/internal/button/index.d.ts +4 -4
- package/dist/internal/card/index.d.cts +14 -2
- package/dist/internal/card/index.d.ts +14 -2
- package/dist/internal/funnel-chart/index.d.ts +60 -0
- package/dist/internal/line-chart/index.d.ts +110 -0
- package/dist/internal/page-header/index.d.ts +35 -0
- package/dist/internal/react-action-list/index.d.ts +28 -0
- package/dist/internal/react-card/index.d.cts +12 -3
- package/dist/internal/react-card/index.d.ts +12 -3
- package/dist/internal/react-funnel-chart/index.d.ts +28 -0
- package/dist/internal/react-line-chart/index.d.ts +33 -0
- package/dist/internal/react-page-header/index.d.ts +23 -0
- package/dist/internal/react-select/index.d.cts +21 -3
- package/dist/internal/react-select/index.d.ts +21 -3
- package/dist/internal/react-separator/index.d.cts +6 -1
- package/dist/internal/react-separator/index.d.ts +6 -1
- package/dist/internal/select/index.d.cts +14 -1
- package/dist/internal/select/index.d.ts +14 -1
- package/dist/internal/separator/index.d.cts +6 -1
- package/dist/internal/separator/index.d.ts +6 -1
- package/dist/internal/shared/index.d.cts +6 -3
- package/dist/internal/shared/index.d.ts +6 -3
- package/dist/internal/tabs/index.d.cts +8 -1
- package/dist/internal/tabs/index.d.ts +8 -1
- package/dist/react-accordion.js +1 -1
- package/dist/react-action-list.js +74 -0
- package/dist/react-action-list.js.map +7 -0
- package/dist/react-ai.js +1 -1
- package/dist/react-analytics.js +1 -1
- package/dist/react-animated-text.js +1 -1
- package/dist/react-app-shell.js +1 -1
- package/dist/react-audience-feature-card.js +1 -1
- package/dist/react-audio-room.js +1 -1
- package/dist/react-auth.js +1 -1
- package/dist/react-avatar-group.js +1 -1
- package/dist/react-avatar.js +1 -1
- package/dist/react-badge.js +16 -4
- package/dist/react-badge.js.map +2 -2
- package/dist/react-bottom-nav.js +1 -1
- package/dist/react-brand-network-cell.js +1 -1
- package/dist/react-breadcrumbs.js +1 -1
- package/dist/react-browser-chrome-mock.js +1 -1
- package/dist/react-browser-chrome-mock.js.map +2 -2
- package/dist/react-button.js +3 -3
- package/dist/react-calendar.js +1 -1
- package/dist/react-call-controls.js +1 -1
- package/dist/react-callout.js +8 -3
- package/dist/react-callout.js.map +2 -2
- package/dist/react-card-grid.js +1 -1
- package/dist/react-card.js +15 -6
- package/dist/react-card.js.map +2 -2
- package/dist/react-carousel.js +1 -1
- package/dist/react-charts.js +1 -1
- package/dist/react-checkbox.js +1 -1
- package/dist/react-checklist.js +1 -1
- package/dist/react-code-block.js +1 -1
- package/dist/react-code-editor.js +1 -1
- package/dist/react-collapsible.js +1 -1
- package/dist/react-combobox.js +1 -1
- package/dist/react-command-input.js +1 -1
- package/dist/react-command.js +1 -1
- package/dist/react-composer.js +3 -3
- package/dist/react-content-protection.js +1 -1
- package/dist/react-conversation.js +5 -5
- package/dist/react-cookie-consent.js +1 -1
- package/dist/react-data-table.js +1 -1
- package/dist/react-date-picker.js +1 -1
- package/dist/react-device-frame.js +1 -1
- package/dist/react-dialog.js +2 -2
- package/dist/react-diff-viewer.js +4 -1
- package/dist/react-diff-viewer.js.map +2 -2
- package/dist/react-dropdown-menu.js +1 -1
- package/dist/react-editor-status-bar.js +1 -1
- package/dist/react-editor-tabs.js +1 -1
- package/dist/react-emoji-picker.js +2 -2
- package/dist/react-empty-state.js +1 -1
- package/dist/react-feedback-dialog.js +2 -2
- package/dist/react-file-tree.js +1 -1
- package/dist/react-file-upload.js +1 -1
- package/dist/react-floating-reactions.js +1 -1
- package/dist/react-flow-editor.js +2 -2
- package/dist/react-footer.js +1 -1
- package/dist/react-funnel-chart.js +105 -0
- package/dist/react-funnel-chart.js.map +7 -0
- package/dist/react-graph-view.js +2 -2
- package/dist/react-infinite-canvas.js +2 -2
- package/dist/react-inline-editor.js +1 -1
- package/dist/react-input-group.js +1 -1
- package/dist/react-input.js +2 -2
- package/dist/react-install-prompt.js +1 -1
- package/dist/react-kanban-board.js +1 -1
- package/dist/react-keyboard-shortcut.js +2 -2
- package/dist/react-language-selector.js +1 -1
- package/dist/react-line-chart.js +242 -0
- package/dist/react-line-chart.js.map +7 -0
- package/dist/react-link-card.js +1 -1
- package/dist/react-live-captions.js +1 -1
- package/dist/react-live-cursors.js +1 -1
- package/dist/react-live-transcript.js +1 -1
- package/dist/react-location-selector.js +1 -1
- package/dist/react-logger.js +1 -1
- package/dist/react-markdown-renderer.js +2 -2
- package/dist/react-marquee-strip.js +1 -1
- package/dist/react-mascot.js +1 -1
- package/dist/react-mastery-bar.js +1 -1
- package/dist/react-mini-map.js +1 -1
- package/dist/react-mobile-nav.js +1 -1
- package/dist/react-navbar.js +1 -1
- package/dist/react-numbered-steps.js +1 -1
- package/dist/react-otp-input.js +1 -1
- package/dist/react-page-header.js +40 -0
- package/dist/react-page-header.js.map +7 -0
- package/dist/react-pagination.js +1 -1
- package/dist/react-password-input.js +2 -2
- package/dist/react-payment.js +1 -1
- package/dist/react-popover.js +1 -1
- package/dist/react-pre-call-lobby.js +1 -1
- package/dist/react-presence-indicator.js +1 -1
- package/dist/react-pricing-card.js +1 -1
- package/dist/react-progress-display.js +2 -2
- package/dist/react-progress-display.js.map +1 -1
- package/dist/react-radial-gauge.js +1 -1
- package/dist/react-radio.js +1 -1
- package/dist/react-rating-scale.js +1 -1
- package/dist/react-reaction-bar.js +1 -1
- package/dist/react-resizable-layout.js +1 -1
- package/dist/react-search-bar.js +1 -1
- package/dist/react-section-head.js +1 -1
- package/dist/react-segmented-control.js +1 -1
- package/dist/react-select.js +94 -20
- package/dist/react-select.js.map +3 -3
- package/dist/react-separator.js +19 -7
- package/dist/react-separator.js.map +2 -2
- package/dist/react-sheet.js +1 -1
- package/dist/react-sidebar.js +1 -1
- package/dist/react-skeleton.js +1 -1
- package/dist/react-skip-to-content.js +1 -1
- package/dist/react-slide-viewer.js +3 -1
- package/dist/react-slide-viewer.js.map +2 -2
- package/dist/react-slider.js +1 -1
- package/dist/react-slot-picker.js +1 -1
- package/dist/react-social-auth-button.js +3 -3
- package/dist/react-sortable-list.js +1 -1
- package/dist/react-stat-grid.js +1 -1
- package/dist/react-status-indicator.js +1 -1
- package/dist/react-steps.js +1 -1
- package/dist/react-sticky-note.js +3 -1
- package/dist/react-sticky-note.js.map +2 -2
- package/dist/react-switch.js +1 -1
- package/dist/react-table-of-contents.js +1 -1
- package/dist/react-tabs.js +50 -2
- package/dist/react-tabs.js.map +2 -2
- package/dist/react-terminal.js +1 -1
- package/dist/react-test-results.js +1 -1
- package/dist/react-textarea.js +3 -3
- package/dist/react-textarea.js.map +1 -1
- package/dist/react-thread-view.js +2 -2
- package/dist/react-timeline.js +1 -1
- package/dist/react-toast.js +1 -1
- package/dist/react-tooltip.js +1 -1
- package/dist/react-version-selector.js +1 -1
- package/dist/react-video-grid.js +2 -2
- package/dist/react-video-player.js +1 -1
- package/dist/react-video-tile.js +2 -2
- package/dist/react-voice-pill.js +1 -1
- package/dist/react-waveform.js +1 -1
- package/dist/react-wizard.js +1 -1
- package/dist/styles.css +48 -0
- package/dist/theme.js +1 -1
- package/package.json +5 -1
- package/dist/chunk-F7B64KT3.js.map +0 -7
- package/dist/chunk-Y2FNNAIL.js.map +0 -1
- package/dist/chunk-ZF3OHCGV.js.map +0 -7
- /package/dist/{chunk-533MCMSU.js.map → chunk-3I3DYDHR.js.map} +0 -0
- /package/dist/{chunk-H54FLNAF.js.map → chunk-63N4PZUJ.js.map} +0 -0
- /package/dist/{chunk-WK2IIUFO.js.map → chunk-QDMLIDYN.js.map} +0 -0
- /package/dist/{chunk-BOLFYVI6.js.map → chunk-QPCKJ2YR.js.map} +0 -0
- /package/dist/{chunk-UNEM2TRI.js.map → chunk-SDAJVXD4.js.map} +0 -0
- /package/dist/{chunk-VK3EQ34F.js.map → chunk-V24GDHUX.js.map} +0 -0
- /package/dist/{chunk-AMK4VCBG.js.map → chunk-WYKPPK3W.js.map} +0 -0
- /package/dist/{chunk-ONACRMG4.js.map → chunk-XMFNBOPO.js.map} +0 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-2Q6HHFAN.js";
|
|
4
|
+
|
|
5
|
+
// ../react-line-chart/dist/index.js
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
|
|
8
|
+
// ../line-chart/dist/index.js
|
|
9
|
+
var DEFAULT_LINE_CHART_PADDING = {
|
|
10
|
+
top: 14,
|
|
11
|
+
right: 14,
|
|
12
|
+
bottom: 24,
|
|
13
|
+
left: 40
|
|
14
|
+
};
|
|
15
|
+
var DEFAULT_LINE_CHART_WIDTH = 760;
|
|
16
|
+
var DEFAULT_LINE_CHART_HEIGHT = 230;
|
|
17
|
+
var DEFAULT_TICK_COUNT = 4;
|
|
18
|
+
var DEFAULT_HEADROOM = 1.08;
|
|
19
|
+
var DEFAULT_LABEL_EVERY = 2;
|
|
20
|
+
var CHART_TOKEN_COUNT = 5;
|
|
21
|
+
function lineChartColor(index) {
|
|
22
|
+
return `hsl(var(--chart-${index % CHART_TOKEN_COUNT + 1}))`;
|
|
23
|
+
}
|
|
24
|
+
function pathFrom(points) {
|
|
25
|
+
return points.map(([px, py], i) => (i ? "L" : "M") + px.toFixed(1) + " " + py.toFixed(1)).join(" ");
|
|
26
|
+
}
|
|
27
|
+
function computeLineChart(options) {
|
|
28
|
+
const {
|
|
29
|
+
series,
|
|
30
|
+
labels,
|
|
31
|
+
width,
|
|
32
|
+
height,
|
|
33
|
+
tickCount = DEFAULT_TICK_COUNT,
|
|
34
|
+
headroom = DEFAULT_HEADROOM,
|
|
35
|
+
labelEvery = DEFAULT_LABEL_EVERY
|
|
36
|
+
} = options;
|
|
37
|
+
const padding = { ...DEFAULT_LINE_CHART_PADDING, ...options.padding };
|
|
38
|
+
const n = labels.length;
|
|
39
|
+
const values = series.flatMap((s) => s.data);
|
|
40
|
+
const peak = values.length ? Math.max(...values) : 0;
|
|
41
|
+
const max = peak > 0 ? peak * headroom : 1;
|
|
42
|
+
const plotW = width - padding.left - padding.right;
|
|
43
|
+
const plotTop = padding.top;
|
|
44
|
+
const plotBottom = height - padding.bottom;
|
|
45
|
+
const plotH = plotBottom - plotTop;
|
|
46
|
+
const x = (index) => padding.left + (n > 1 ? index / (n - 1) * plotW : plotW / 2);
|
|
47
|
+
const y = (value) => plotTop + (1 - value / max) * plotH;
|
|
48
|
+
const ticks = Array.from({ length: tickCount + 1 }, (_, t) => {
|
|
49
|
+
const value = max / tickCount * t;
|
|
50
|
+
return { value, y: y(value) };
|
|
51
|
+
});
|
|
52
|
+
const xLabels = labels.map((label, index) => ({ index, label, x: x(index) })).filter(({ index }) => index % labelEvery === 0 || index === n - 1);
|
|
53
|
+
const paths = series.map((s, si) => {
|
|
54
|
+
const points = s.data.map((v, i) => [x(i), y(v)]);
|
|
55
|
+
const line = pathFrom(points);
|
|
56
|
+
const first = points.length ? points[0][0] : x(0);
|
|
57
|
+
const last = points.length ? points[points.length - 1][0] : x(0);
|
|
58
|
+
const base = y(0).toFixed(1);
|
|
59
|
+
const area = `${line} L ${last.toFixed(1)} ${base} L ${first.toFixed(1)} ${base} Z`;
|
|
60
|
+
return { id: s.id, color: s.color ?? lineChartColor(si), line, area };
|
|
61
|
+
});
|
|
62
|
+
const colW = n > 1 ? plotW / (n - 1) : plotW;
|
|
63
|
+
const columns = labels.map((_, index) => ({
|
|
64
|
+
index,
|
|
65
|
+
x: x(index) - colW / 2,
|
|
66
|
+
width: colW
|
|
67
|
+
}));
|
|
68
|
+
return { width, height, padding, max, ticks, xLabels, paths, columns, x, y, plotTop, plotBottom };
|
|
69
|
+
}
|
|
70
|
+
function tooltipLeftPercent(geometry, index) {
|
|
71
|
+
return geometry.x(index) / geometry.width * 100;
|
|
72
|
+
}
|
|
73
|
+
function nextLineChartIndex(current, key, count) {
|
|
74
|
+
if (count === 0) return null;
|
|
75
|
+
const last = count - 1;
|
|
76
|
+
switch (key) {
|
|
77
|
+
case "ArrowRight":
|
|
78
|
+
return current == null ? 0 : Math.min(current + 1, last);
|
|
79
|
+
case "ArrowLeft":
|
|
80
|
+
return current == null ? last : Math.max(current - 1, 0);
|
|
81
|
+
case "Home":
|
|
82
|
+
return 0;
|
|
83
|
+
case "End":
|
|
84
|
+
return last;
|
|
85
|
+
default:
|
|
86
|
+
return current;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
var lineChartClasses = {
|
|
90
|
+
root: "relative",
|
|
91
|
+
svg: "block w-full rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
92
|
+
gridline: "stroke-border",
|
|
93
|
+
axis: "fill-muted-foreground text-[9px]",
|
|
94
|
+
crosshair: "stroke-border",
|
|
95
|
+
marker: "stroke-card",
|
|
96
|
+
tooltip: "pointer-events-none absolute z-10 -translate-x-1/2 whitespace-nowrap rounded-md bg-tertiary px-2.5 py-2 text-[11px] text-tertiary-foreground shadow-lg",
|
|
97
|
+
tooltipLabel: "mb-1 opacity-60",
|
|
98
|
+
tooltipRow: "flex justify-between gap-2",
|
|
99
|
+
legend: "mt-2.5 flex flex-wrap gap-3.5",
|
|
100
|
+
legendItem: "inline-flex items-center gap-1.5 text-[11px] text-muted-foreground",
|
|
101
|
+
legendSwatch: "h-[3px] w-2.5 rounded-sm"
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// ../react-line-chart/dist/index.js
|
|
105
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
106
|
+
var defaultFormat = (value) => String(Math.round(value));
|
|
107
|
+
var MARKER_RADIUS = 3.5;
|
|
108
|
+
var STROKE_WIDTH = 2.2;
|
|
109
|
+
var TOOLTIP_TOP_PX = 8;
|
|
110
|
+
var LineChart = React.forwardRef(function LineChart2({
|
|
111
|
+
series,
|
|
112
|
+
labels,
|
|
113
|
+
ariaLabel,
|
|
114
|
+
height = DEFAULT_LINE_CHART_HEIGHT,
|
|
115
|
+
width = DEFAULT_LINE_CHART_WIDTH,
|
|
116
|
+
formatValue = defaultFormat,
|
|
117
|
+
formatTick,
|
|
118
|
+
area,
|
|
119
|
+
showLegend = true,
|
|
120
|
+
className,
|
|
121
|
+
...rest
|
|
122
|
+
}, ref) {
|
|
123
|
+
const [active, setActive] = React.useState(null);
|
|
124
|
+
const gradientBase = React.useId().replace(/:/g, "");
|
|
125
|
+
const geo = React.useMemo(
|
|
126
|
+
() => computeLineChart({ series, labels, width, height }),
|
|
127
|
+
[series, labels, width, height]
|
|
128
|
+
);
|
|
129
|
+
const fillArea = area ?? series.length === 1;
|
|
130
|
+
const tick = formatTick ?? formatValue;
|
|
131
|
+
const handleKeyDown = (event) => {
|
|
132
|
+
const next = nextLineChartIndex(active, event.key, labels.length);
|
|
133
|
+
if (next === active) return;
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
setActive(next);
|
|
136
|
+
};
|
|
137
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: cn(lineChartClasses.root, className), "data-slot": "line-chart", ...rest, children: [
|
|
138
|
+
/* @__PURE__ */ jsxs(
|
|
139
|
+
"svg",
|
|
140
|
+
{
|
|
141
|
+
className: lineChartClasses.svg,
|
|
142
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
143
|
+
style: { height },
|
|
144
|
+
role: "img",
|
|
145
|
+
"aria-label": ariaLabel,
|
|
146
|
+
tabIndex: 0,
|
|
147
|
+
onKeyDown: handleKeyDown,
|
|
148
|
+
onBlur: () => setActive(null),
|
|
149
|
+
onMouseLeave: () => setActive(null),
|
|
150
|
+
children: [
|
|
151
|
+
geo.ticks.map((t, i) => /* @__PURE__ */ jsxs("g", { children: [
|
|
152
|
+
/* @__PURE__ */ jsx("line", { className: lineChartClasses.gridline, x1: geo.padding.left, y1: t.y, x2: width - geo.padding.right, y2: t.y }),
|
|
153
|
+
/* @__PURE__ */ jsx("text", { className: lineChartClasses.axis, x: geo.padding.left - 8, y: t.y + 3, textAnchor: "end", children: tick(t.value) })
|
|
154
|
+
] }, i)),
|
|
155
|
+
geo.xLabels.map((l) => /* @__PURE__ */ jsx("text", { className: lineChartClasses.axis, x: l.x, y: height - 6, textAnchor: "middle", children: l.label }, l.index)),
|
|
156
|
+
geo.paths.map((p, si) => {
|
|
157
|
+
const gid = `${gradientBase}-${si}`;
|
|
158
|
+
const value = active != null ? series[si].data[active] : void 0;
|
|
159
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
160
|
+
fillArea && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
161
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gid, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
162
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: p.color, stopOpacity: "0.22" }),
|
|
163
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: p.color, stopOpacity: "0" })
|
|
164
|
+
] }) }),
|
|
165
|
+
/* @__PURE__ */ jsx("path", { d: p.area, fill: `url(#${gid})` })
|
|
166
|
+
] }),
|
|
167
|
+
/* @__PURE__ */ jsx(
|
|
168
|
+
"path",
|
|
169
|
+
{
|
|
170
|
+
d: p.line,
|
|
171
|
+
fill: "none",
|
|
172
|
+
stroke: p.color,
|
|
173
|
+
strokeWidth: STROKE_WIDTH,
|
|
174
|
+
strokeLinecap: "round",
|
|
175
|
+
strokeLinejoin: "round"
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
active != null && value != null && /* @__PURE__ */ jsx(
|
|
179
|
+
"circle",
|
|
180
|
+
{
|
|
181
|
+
className: lineChartClasses.marker,
|
|
182
|
+
cx: geo.x(active),
|
|
183
|
+
cy: geo.y(value),
|
|
184
|
+
r: MARKER_RADIUS,
|
|
185
|
+
fill: p.color,
|
|
186
|
+
strokeWidth: "1.5"
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
] }, p.id);
|
|
190
|
+
}),
|
|
191
|
+
active != null && /* @__PURE__ */ jsx(
|
|
192
|
+
"line",
|
|
193
|
+
{
|
|
194
|
+
className: lineChartClasses.crosshair,
|
|
195
|
+
x1: geo.x(active),
|
|
196
|
+
y1: geo.plotTop,
|
|
197
|
+
x2: geo.x(active),
|
|
198
|
+
y2: geo.plotBottom,
|
|
199
|
+
strokeDasharray: "3 3"
|
|
200
|
+
}
|
|
201
|
+
),
|
|
202
|
+
geo.columns.map((col) => /* @__PURE__ */ jsx(
|
|
203
|
+
"rect",
|
|
204
|
+
{
|
|
205
|
+
"data-index": col.index,
|
|
206
|
+
x: col.x,
|
|
207
|
+
y: 0,
|
|
208
|
+
width: col.width,
|
|
209
|
+
height,
|
|
210
|
+
fill: "transparent",
|
|
211
|
+
onMouseEnter: () => setActive(col.index)
|
|
212
|
+
},
|
|
213
|
+
col.index
|
|
214
|
+
))
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
active != null && /* @__PURE__ */ jsxs(
|
|
219
|
+
"div",
|
|
220
|
+
{
|
|
221
|
+
className: lineChartClasses.tooltip,
|
|
222
|
+
role: "status",
|
|
223
|
+
style: { left: `${tooltipLeftPercent(geo, active)}%`, top: TOOLTIP_TOP_PX },
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ jsx("div", { className: lineChartClasses.tooltipLabel, children: labels[active] }),
|
|
226
|
+
series.map((s, si) => /* @__PURE__ */ jsxs("div", { className: lineChartClasses.tooltipRow, children: [
|
|
227
|
+
/* @__PURE__ */ jsx("span", { style: { color: geo.paths[si].color }, children: s.name }),
|
|
228
|
+
/* @__PURE__ */ jsx("b", { children: s.data[active] != null ? formatValue(s.data[active]) : "\u2014" })
|
|
229
|
+
] }, s.id))
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
),
|
|
233
|
+
showLegend && /* @__PURE__ */ jsx("div", { className: lineChartClasses.legend, children: series.map((s, si) => /* @__PURE__ */ jsxs("span", { className: lineChartClasses.legendItem, children: [
|
|
234
|
+
/* @__PURE__ */ jsx("i", { className: lineChartClasses.legendSwatch, style: { background: geo.paths[si].color }, "aria-hidden": "true" }),
|
|
235
|
+
s.name
|
|
236
|
+
] }, s.id)) })
|
|
237
|
+
] });
|
|
238
|
+
});
|
|
239
|
+
export {
|
|
240
|
+
LineChart
|
|
241
|
+
};
|
|
242
|
+
//# sourceMappingURL=react-line-chart.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../line-chart/src/line-chart.ts", "../../line-chart/src/line-chart.styles.ts", "../../react-line-chart/src/line-chart.tsx"],
|
|
4
|
+
"sourcesContent": ["export interface LineChartSeries {\n /** Stable key for the series. */\n id: string\n /** Legend / tooltip name. */\n name: string\n /**\n * Any CSS colour (a token `hsl(var(--…))` or a data colour). Defaults to the\n * theme's chart palette (`--chart-1` … `--chart-5`) by series position.\n */\n color?: string\n /** One value per label, in label order. */\n data: number[]\n}\n\nexport interface LineChartPadding {\n top: number\n right: number\n bottom: number\n left: number\n}\n\nexport interface LineChartOptions {\n series: LineChartSeries[]\n labels: string[]\n /** viewBox width — the SVG scales to its container's width. */\n width: number\n /** viewBox height. */\n height: number\n padding?: Partial<LineChartPadding>\n /** Number of gridline intervals on the y-axis. */\n tickCount?: number\n /** Headroom multiplier above the largest value. */\n headroom?: number\n /** Show every n-th x label (the last label is always shown). */\n labelEvery?: number\n}\n\nexport interface LineChartTick {\n value: number\n y: number\n}\n\nexport interface LineChartXLabel {\n index: number\n label: string\n x: number\n}\n\nexport interface LineChartPath {\n id: string\n /** Resolved stroke colour. */\n color: string\n /** The stroke path. */\n line: string\n /** The line closed down to the zero baseline, for an area fill. */\n area: string\n}\n\nexport interface LineChartColumn {\n index: number\n x: number\n width: number\n}\n\nexport interface LineChartGeometry {\n width: number\n height: number\n padding: LineChartPadding\n /** Top of the shared y-scale. */\n max: number\n ticks: LineChartTick[]\n xLabels: LineChartXLabel[]\n paths: LineChartPath[]\n /** One hover/focus column per category. */\n columns: LineChartColumn[]\n x: (index: number) => number\n y: (value: number) => number\n /** Top and bottom of the plot area, for a crosshair. */\n plotTop: number\n plotBottom: number\n}\n\nexport const DEFAULT_LINE_CHART_PADDING: LineChartPadding = {\n top: 14,\n right: 14,\n bottom: 24,\n left: 40,\n}\n\nexport const DEFAULT_LINE_CHART_WIDTH = 760\nexport const DEFAULT_LINE_CHART_HEIGHT = 230\nconst DEFAULT_TICK_COUNT = 4\nconst DEFAULT_HEADROOM = 1.08\nconst DEFAULT_LABEL_EVERY = 2\n/** Number of `--chart-N` tokens the theme defines. */\nconst CHART_TOKEN_COUNT = 5\n\n/** The theme chart colour for the series at `index` (wraps around). */\nexport function lineChartColor(index: number): string {\n return `hsl(var(--chart-${(index % CHART_TOKEN_COUNT) + 1}))`\n}\n\nfunction pathFrom(points: Array<[number, number]>): string {\n return points.map(([px, py], i) => (i ? 'L' : 'M') + px.toFixed(1) + ' ' + py.toFixed(1)).join(' ')\n}\n\n/**\n * Pure geometry for a responsive multi-series line chart. Every series shares\n * ONE y-scale (zero baseline to the largest value plus headroom), so series are\n * comparable. Coordinates are in viewBox units; the SVG scales to its container.\n */\nexport function computeLineChart(options: LineChartOptions): LineChartGeometry {\n const {\n series,\n labels,\n width,\n height,\n tickCount = DEFAULT_TICK_COUNT,\n headroom = DEFAULT_HEADROOM,\n labelEvery = DEFAULT_LABEL_EVERY,\n } = options\n const padding = { ...DEFAULT_LINE_CHART_PADDING, ...options.padding }\n const n = labels.length\n const values = series.flatMap((s) => s.data)\n const peak = values.length ? Math.max(...values) : 0\n const max = peak > 0 ? peak * headroom : 1\n const plotW = width - padding.left - padding.right\n const plotTop = padding.top\n const plotBottom = height - padding.bottom\n const plotH = plotBottom - plotTop\n\n const x = (index: number) => padding.left + (n > 1 ? (index / (n - 1)) * plotW : plotW / 2)\n const y = (value: number) => plotTop + (1 - value / max) * plotH\n\n const ticks: LineChartTick[] = Array.from({ length: tickCount + 1 }, (_, t) => {\n const value = (max / tickCount) * t\n return { value, y: y(value) }\n })\n\n const xLabels: LineChartXLabel[] = labels\n .map((label, index) => ({ index, label, x: x(index) }))\n .filter(({ index }) => index % labelEvery === 0 || index === n - 1)\n\n const paths: LineChartPath[] = series.map((s, si) => {\n const points = s.data.map((v, i): [number, number] => [x(i), y(v)])\n const line = pathFrom(points)\n const first = points.length ? points[0][0] : x(0)\n const last = points.length ? points[points.length - 1][0] : x(0)\n const base = y(0).toFixed(1)\n const area = `${line} L ${last.toFixed(1)} ${base} L ${first.toFixed(1)} ${base} Z`\n return { id: s.id, color: s.color ?? lineChartColor(si), line, area }\n })\n\n const colW = n > 1 ? plotW / (n - 1) : plotW\n const columns: LineChartColumn[] = labels.map((_, index) => ({\n index,\n x: x(index) - colW / 2,\n width: colW,\n }))\n\n return { width, height, padding, max, ticks, xLabels, paths, columns, x, y, plotTop, plotBottom }\n}\n\n/** Where a tooltip for `index` sits horizontally, as a percent of the chart width. */\nexport function tooltipLeftPercent(geometry: LineChartGeometry, index: number): number {\n return (geometry.x(index) / geometry.width) * 100\n}\n\n/**\n * The category index a keyboard key moves to from `current` (null = nothing\n * active yet). Returns `current` unchanged for keys the chart doesn't handle.\n */\nexport function nextLineChartIndex(current: number | null, key: string, count: number): number | null {\n if (count === 0) return null\n const last = count - 1\n switch (key) {\n case 'ArrowRight':\n return current == null ? 0 : Math.min(current + 1, last)\n case 'ArrowLeft':\n return current == null ? last : Math.max(current - 1, 0)\n case 'Home':\n return 0\n case 'End':\n return last\n default:\n return current\n }\n}\n", "/** Token-class styles for LineChart; no colour literals. */\nexport const lineChartClasses = {\n root: 'relative',\n svg: 'block w-full rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n gridline: 'stroke-border',\n axis: 'fill-muted-foreground text-[9px]',\n crosshair: 'stroke-border',\n marker: 'stroke-card',\n tooltip:\n 'pointer-events-none absolute z-10 -translate-x-1/2 whitespace-nowrap rounded-md bg-tertiary px-2.5 py-2 text-[11px] text-tertiary-foreground shadow-lg',\n tooltipLabel: 'mb-1 opacity-60',\n tooltipRow: 'flex justify-between gap-2',\n legend: 'mt-2.5 flex flex-wrap gap-3.5',\n legendItem: 'inline-flex items-center gap-1.5 text-[11px] text-muted-foreground',\n legendSwatch: 'h-[3px] w-2.5 rounded-sm',\n} as const\n", "import * as React from 'react'\nimport {\n computeLineChart,\n lineChartClasses as c,\n nextLineChartIndex,\n tooltipLeftPercent,\n DEFAULT_LINE_CHART_WIDTH,\n DEFAULT_LINE_CHART_HEIGHT,\n type LineChartSeries,\n} from '@refraction-ui/line-chart'\nimport { cn } from '@refraction-ui/shared'\n\nexport type { LineChartSeries }\n\nexport interface LineChartProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {\n /** The series to plot, all on one shared y-scale. */\n series: LineChartSeries[]\n /** One category label per data point. */\n labels: string[]\n /** Accessible name of the chart image (required). */\n ariaLabel: string\n /** Rendered height in px (also the viewBox height). Defaults to 230. */\n height?: number\n /** viewBox width; the chart always stretches to its container. Defaults to 760. */\n width?: number\n /** Formats a value in the tooltip. */\n formatValue?: (value: number) => string\n /** Formats a y-axis tick. Defaults to `formatValue`. */\n formatTick?: (value: number) => string\n /** Fill the area under each line. Defaults to on for a single series only. */\n area?: boolean\n /** Show the series legend under the chart. Defaults to true. */\n showLegend?: boolean\n}\n\nconst defaultFormat = (value: number) => String(Math.round(value))\nconst MARKER_RADIUS = 3.5\nconst STROKE_WIDTH = 2.2\nconst TOOLTIP_TOP_PX = 8\n\n/**\n * LineChart — a responsive multi-series line chart on one shared y-scale, with\n * gridlines, category x-labels, a hover/keyboard crosshair + tooltip and a\n * legend. The SVG uses a viewBox, so it stretches to its container's width.\n * Keyboard: focus the chart, then ←/→/Home/End move between categories.\n */\nexport const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>(function LineChart(\n {\n series,\n labels,\n ariaLabel,\n height = DEFAULT_LINE_CHART_HEIGHT,\n width = DEFAULT_LINE_CHART_WIDTH,\n formatValue = defaultFormat,\n formatTick,\n area,\n showLegend = true,\n className,\n ...rest\n },\n ref,\n) {\n const [active, setActive] = React.useState<number | null>(null)\n const gradientBase = React.useId().replace(/:/g, '')\n const geo = React.useMemo(\n () => computeLineChart({ series, labels, width, height }),\n [series, labels, width, height],\n )\n const fillArea = area ?? series.length === 1\n const tick = formatTick ?? formatValue\n\n const handleKeyDown = (event: React.KeyboardEvent<SVGSVGElement>) => {\n const next = nextLineChartIndex(active, event.key, labels.length)\n if (next === active) return\n event.preventDefault()\n setActive(next)\n }\n\n return (\n <div ref={ref} className={cn(c.root, className)} data-slot=\"line-chart\" {...rest}>\n <svg\n className={c.svg}\n viewBox={`0 0 ${width} ${height}`}\n style={{ height }}\n role=\"img\"\n aria-label={ariaLabel}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n onBlur={() => setActive(null)}\n onMouseLeave={() => setActive(null)}\n >\n {geo.ticks.map((t, i) => (\n <g key={i}>\n <line className={c.gridline} x1={geo.padding.left} y1={t.y} x2={width - geo.padding.right} y2={t.y} />\n <text className={c.axis} x={geo.padding.left - 8} y={t.y + 3} textAnchor=\"end\">\n {tick(t.value)}\n </text>\n </g>\n ))}\n {geo.xLabels.map((l) => (\n <text key={l.index} className={c.axis} x={l.x} y={height - 6} textAnchor=\"middle\">\n {l.label}\n </text>\n ))}\n {geo.paths.map((p, si) => {\n const gid = `${gradientBase}-${si}`\n const value = active != null ? series[si].data[active] : undefined\n return (\n <g key={p.id}>\n {fillArea && (\n <>\n <defs>\n <linearGradient id={gid} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={p.color} stopOpacity=\"0.22\" />\n <stop offset=\"100%\" stopColor={p.color} stopOpacity=\"0\" />\n </linearGradient>\n </defs>\n <path d={p.area} fill={`url(#${gid})`} />\n </>\n )}\n <path\n d={p.line}\n fill=\"none\"\n stroke={p.color}\n strokeWidth={STROKE_WIDTH}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n {active != null && value != null && (\n <circle\n className={c.marker}\n cx={geo.x(active)}\n cy={geo.y(value)}\n r={MARKER_RADIUS}\n fill={p.color}\n strokeWidth=\"1.5\"\n />\n )}\n </g>\n )\n })}\n {active != null && (\n <line\n className={c.crosshair}\n x1={geo.x(active)}\n y1={geo.plotTop}\n x2={geo.x(active)}\n y2={geo.plotBottom}\n strokeDasharray=\"3 3\"\n />\n )}\n {geo.columns.map((col) => (\n <rect\n key={col.index}\n data-index={col.index}\n x={col.x}\n y={0}\n width={col.width}\n height={height}\n fill=\"transparent\"\n onMouseEnter={() => setActive(col.index)}\n />\n ))}\n </svg>\n {active != null && (\n <div\n className={c.tooltip}\n role=\"status\"\n style={{ left: `${tooltipLeftPercent(geo, active)}%`, top: TOOLTIP_TOP_PX }}\n >\n <div className={c.tooltipLabel}>{labels[active]}</div>\n {series.map((s, si) => (\n <div key={s.id} className={c.tooltipRow}>\n <span style={{ color: geo.paths[si].color }}>{s.name}</span>\n <b>{s.data[active] != null ? formatValue(s.data[active]) : '—'}</b>\n </div>\n ))}\n </div>\n )}\n {showLegend && (\n <div className={c.legend}>\n {series.map((s, si) => (\n <span key={s.id} className={c.legendItem}>\n <i className={c.legendSwatch} style={{ background: geo.paths[si].color }} aria-hidden=\"true\" />\n {s.name}\n </span>\n ))}\n </div>\n )}\n </div>\n )\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAkFO,IAAM,6BAA+C;EAC1D,KAAK;EACL,OAAO;EACP,QAAQ;EACR,MAAM;AACR;AAEO,IAAM,2BAA2B;AACjC,IAAM,4BAA4B;AACzC,IAAM,qBAAqB;AAC3B,IAAM,mBAAmB;AACzB,IAAM,sBAAsB;AAE5B,IAAM,oBAAoB;AAGnB,SAAS,eAAe,OAAuB;AACpD,SAAO,mBAAoB,QAAQ,oBAAqB,CAAC;AAC3D;AAEA,SAAS,SAAS,QAAyC;AACzD,SAAO,OAAO,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,OAAO,IAAI,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,MAAM,GAAG,QAAQ,CAAC,CAAC,EAAE,KAAK,GAAG;AACpG;AAOO,SAAS,iBAAiB,SAA8C;AAC7E,QAAM;IACJ;IACA;IACA;IACA;IACA,YAAY;IACZ,WAAW;IACX,aAAa;EAAA,IACX;AACJ,QAAM,UAAU,EAAE,GAAG,4BAA4B,GAAG,QAAQ,QAAA;AAC5D,Q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card.js
CHANGED
package/dist/react-logger.js
CHANGED
package/dist/react-mascot.js
CHANGED
package/dist/react-mini-map.js
CHANGED
package/dist/react-mobile-nav.js
CHANGED
package/dist/react-navbar.js
CHANGED
package/dist/react-otp-input.js
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-2Q6HHFAN.js";
|
|
4
|
+
|
|
5
|
+
// ../react-page-header/dist/index.js
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
|
|
8
|
+
// ../page-header/dist/index.js
|
|
9
|
+
function createPageHeader(props = {}) {
|
|
10
|
+
return {
|
|
11
|
+
dataAttributes: {
|
|
12
|
+
"data-slot": "page-header",
|
|
13
|
+
"data-has-actions": props.hasActions ? "true" : "false"
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
var pageHeaderClass = "flex flex-wrap items-start justify-between gap-4";
|
|
18
|
+
var pageHeaderTextClass = "flex min-w-0 flex-1 flex-col gap-1";
|
|
19
|
+
var pageHeaderKickerClass = "break-words text-[11px] uppercase tracking-wider text-muted-foreground";
|
|
20
|
+
var pageHeaderTitleClass = "break-words text-xl font-semibold text-foreground";
|
|
21
|
+
var pageHeaderDescriptionClass = "max-w-prose text-sm text-muted-foreground";
|
|
22
|
+
var pageHeaderActionsClass = "flex flex-none flex-wrap items-center gap-2";
|
|
23
|
+
|
|
24
|
+
// ../react-page-header/dist/index.js
|
|
25
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
26
|
+
var PageHeader = React.forwardRef(function PageHeader2({ kicker, title, description, actions, as: Title = "h1", className, ...props }, ref) {
|
|
27
|
+
const { dataAttributes } = createPageHeader({ hasActions: actions != null });
|
|
28
|
+
return /* @__PURE__ */ jsxs("header", { ref, className: cn(pageHeaderClass, className), ...dataAttributes, ...props, children: [
|
|
29
|
+
/* @__PURE__ */ jsxs("div", { className: pageHeaderTextClass, children: [
|
|
30
|
+
kicker != null && /* @__PURE__ */ jsx("p", { className: pageHeaderKickerClass, children: kicker }),
|
|
31
|
+
/* @__PURE__ */ jsx(Title, { className: pageHeaderTitleClass, children: title }),
|
|
32
|
+
description != null && /* @__PURE__ */ jsx("div", { className: pageHeaderDescriptionClass, children: description })
|
|
33
|
+
] }),
|
|
34
|
+
actions != null && /* @__PURE__ */ jsx("div", { className: pageHeaderActionsClass, children: actions })
|
|
35
|
+
] });
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
PageHeader
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=react-page-header.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../page-header/src/page-header.ts", "../../page-header/src/page-header.styles.ts", "../../react-page-header/src/page-header.tsx"],
|
|
4
|
+
"sourcesContent": ["/** Heading element used for the page title. */\nexport type PageHeaderTitleLevel = 'h1' | 'h2' | 'h3'\n\nexport interface PageHeaderProps {\n /** Whether an actions slot will be rendered. */\n hasActions?: boolean\n}\n\nexport interface PageHeaderAPI {\n /** Data attributes for styling hooks. */\n dataAttributes: Record<string, string>\n}\n\n/**\n * Build the framework-agnostic data attributes for a PageHeader — the heading\n * cluster at the top of an application page (kicker, title, description and a\n * trailing actions row). Unlike SectionHead (a centred marketing heading) it is\n * sized for dense app chrome and never centres.\n */\nexport function createPageHeader(props: PageHeaderProps = {}): PageHeaderAPI {\n return {\n dataAttributes: {\n 'data-slot': 'page-header',\n 'data-has-actions': props.hasActions ? 'true' : 'false',\n },\n }\n}\n", "/**\n * Root: text cluster on the leading edge, actions on the trailing edge; wraps\n * on narrow screens. Carries no outer margin — the page layout spaces it.\n */\nexport const pageHeaderClass = 'flex flex-wrap items-start justify-between gap-4'\n\n/** Text cluster (kicker, title, description). */\nexport const pageHeaderTextClass = 'flex min-w-0 flex-1 flex-col gap-1'\n\n/** Small uppercase eyebrow above the title. */\nexport const pageHeaderKickerClass =\n 'break-words text-[11px] uppercase tracking-wider text-muted-foreground'\n\n/** Title — app-sized, not a marketing display size. */\nexport const pageHeaderTitleClass = 'break-words text-xl font-semibold text-foreground'\n\n/** Supporting copy under the title, capped at a readable measure. */\nexport const pageHeaderDescriptionClass = 'max-w-prose text-sm text-muted-foreground'\n\n/** Trailing actions row. */\nexport const pageHeaderActionsClass = 'flex flex-none flex-wrap items-center gap-2'\n", "import * as React from 'react'\nimport {\n createPageHeader,\n pageHeaderClass,\n pageHeaderTextClass,\n pageHeaderKickerClass,\n pageHeaderTitleClass,\n pageHeaderDescriptionClass,\n pageHeaderActionsClass,\n type PageHeaderTitleLevel,\n} from '@refraction-ui/page-header'\nimport { cn } from '@refraction-ui/shared'\n\nexport type { PageHeaderTitleLevel }\n\nexport interface PageHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {\n /** Optional eyebrow rendered above the title. */\n kicker?: React.ReactNode\n /** The page title (required). */\n title: React.ReactNode\n /** Optional supporting copy under the title. */\n description?: React.ReactNode\n /** Optional actions (buttons, menus) on the trailing edge. */\n actions?: React.ReactNode\n /** Heading element for the title. Defaults to `h1`. */\n as?: PageHeaderTitleLevel\n}\n\n/**\n * PageHeader — the heading cluster at the top of an application page: kicker,\n * title, description and a trailing actions row. Renders a `<header>`.\n */\nexport const PageHeader = React.forwardRef<HTMLElement, PageHeaderProps>(function PageHeader(\n { kicker, title, description, actions, as: Title = 'h1', className, ...props },\n ref,\n) {\n const { dataAttributes } = createPageHeader({ hasActions: actions != null })\n return (\n <header ref={ref} className={cn(pageHeaderClass, className)} {...dataAttributes} {...props}>\n <div className={pageHeaderTextClass}>\n {kicker != null && <p className={pageHeaderKickerClass}>{kicker}</p>}\n <Title className={pageHeaderTitleClass}>{title}</Title>\n {description != null && <div className={pageHeaderDescriptionClass}>{description}</div>}\n </div>\n {actions != null && <div className={pageHeaderActionsClass}>{actions}</div>}\n </header>\n )\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAmBO,SAAS,iBAAiB,QAAyB,CAAA,GAAmB;AAC3E,SAAO;IACL,gBAAgB;MACd,aAAa;MACb,oBAAoB,MAAM,aAAa,SAAS;IAAA;EAClD;AAEJ;ACtBO,IAAM,kBAAkB;AAGxB,IAAM,sBAAsB;AAG5B,IAAM,wBACX;AAGK,IAAM,uBAAuB;AAG7B,IAAM,6BAA6B;AAGnC,IAAM,yBAAyB;;;;ACY/B,IAAM,aAAmB,iBAAyC,SAASA,YAChF,EAAE,QAAQ,OAAO,aAAa,SAAS,IAAI,QAAQ,MAAM,WAAW,GAAG,MAAA,GACvE,KACA;AACA,QAAM,EAAE,eAAA,IAAmB,iBAAiB,EAAE,YAAY,WAAW,KAAA,CAAM;AAC3E,SACE,qBAAC,UAAA,EAAO,KAAU,WAAW,GAAG,iBAAiB,SAAS,GAAI,GAAG,gBAAiB,GAAG,OACnF,UAAA;IAAA,qBAAC,OAAA,EAAI,WAAW,qBACb,UAAA;MAAA,UAAU,QAAQ,oBAAC,KAAA,EAAE,WAAW,uBAAwB,UAAA,OAAA,CAAO;MAChE,oBAAC,OAAA,EAAM,WAAW,sBAAuB,UAAA,MAAA,CAAM;MAC9C,eAAe,QAAQ,oBAAC,OAAA,EAAI,WAAW,4BAA6B,UAAA,YAAA,CAAY;IAAA,EAAA,CACnF;IACC,WAAW,QAAQ,oBAAC,OAAA,EAAI,WAAW,wBAAyB,UAAA,QAAA,CAAQ;EAAA,EAAA,CACvE;AAEJ,CAAC;",
|
|
6
|
+
"names": ["PageHeader"]
|
|
7
|
+
}
|
package/dist/react-pagination.js
CHANGED
package/dist/react-payment.js
CHANGED
package/dist/react-popover.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
cn,
|
|
3
3
|
cva
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2Q6HHFAN.js";
|
|
5
5
|
|
|
6
6
|
// ../react-progress-display/dist/index.js
|
|
7
7
|
import * as React from "react";
|
|
@@ -80,7 +80,7 @@ var badgeItemVariants = cva({
|
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
var progressBarVariants = cva({
|
|
83
|
-
base: "
|
|
83
|
+
base: "w-full overflow-hidden rounded-full bg-secondary",
|
|
84
84
|
variants: {
|
|
85
85
|
size: {
|
|
86
86
|
sm: "h-1",
|