@stoa-dev/kit 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/i18n/locales/at.json.js +7 -3
- package/dist/i18n/locales/at.json.js.map +1 -1
- package/dist/i18n/locales/de.json.js +10 -6
- package/dist/i18n/locales/de.json.js.map +1 -1
- package/dist/i18n/locales/en.json.js +14 -10
- package/dist/i18n/locales/en.json.js.map +1 -1
- package/dist/i18n/locales/it.json.js +7 -3
- package/dist/i18n/locales/it.json.js.map +1 -1
- package/dist/kit.css +1 -1
- package/dist/shell/ScrollToTop/index.js +80 -0
- package/dist/shell/ScrollToTop/index.js.map +1 -0
- package/dist/shell/index.js +34 -32
- package/dist/shell/index.js.map +1 -1
- package/dist/types/i18n/index.d.ts +116 -0
- package/dist/types/i18n/index.d.ts.map +1 -1
- package/dist/types/shell/ScrollToTop/index.d.ts +17 -0
- package/dist/types/shell/ScrollToTop/index.d.ts.map +1 -0
- package/dist/types/shell/index.d.ts +1 -0
- package/dist/types/shell/index.d.ts.map +1 -1
- package/dist/types/ui/audio-player/index.d.ts +30 -0
- package/dist/types/ui/audio-player/index.d.ts.map +1 -0
- package/dist/types/ui/file-viewer/index.d.ts +31 -0
- package/dist/types/ui/file-viewer/index.d.ts.map +1 -0
- package/dist/types/ui/index.d.ts +2 -0
- package/dist/types/ui/index.d.ts.map +1 -1
- package/dist/types/ui/input/index.d.ts.map +1 -1
- package/dist/ui/audio-player/AudioPlayer.module.scss.js +60 -0
- package/dist/ui/audio-player/AudioPlayer.module.scss.js.map +1 -0
- package/dist/ui/audio-player/index.js +323 -0
- package/dist/ui/audio-player/index.js.map +1 -0
- package/dist/ui/file-viewer/FileViewer.module.scss.js +56 -0
- package/dist/ui/file-viewer/FileViewer.module.scss.js.map +1 -0
- package/dist/ui/file-viewer/index.js +251 -0
- package/dist/ui/file-viewer/index.js.map +1 -0
- package/dist/ui/index.js +119 -114
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/input/index.js +22 -21
- package/dist/ui/input/index.js.map +1 -1
- package/dist/ui/textarea/index.js +1 -1
- package/dist/ui/textarea/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/instrument.css +3 -2
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e, Fragment as X } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeft as q, ChevronRight as G, Minus as J, Plus as Q } from "lucide-react";
|
|
3
|
+
import { useId as U, useRef as Y, useState as N, useEffect as ee } from "react";
|
|
4
|
+
import { useTranslation as ie } from "react-i18next";
|
|
5
|
+
import { STOA_NS as te } from "../../i18n/namespace.js";
|
|
6
|
+
import { cn as ae } from "../../utils/cn.js";
|
|
7
|
+
import i from "./FileViewer.module.scss.js";
|
|
8
|
+
const re = [
|
|
9
|
+
0.25,
|
|
10
|
+
0.5,
|
|
11
|
+
0.75,
|
|
12
|
+
1,
|
|
13
|
+
1.5,
|
|
14
|
+
2,
|
|
15
|
+
3,
|
|
16
|
+
4
|
|
17
|
+
], o = re, le = 12;
|
|
18
|
+
function ne(r) {
|
|
19
|
+
let c = 0;
|
|
20
|
+
for (let u = 1; u < o.length; u += 1)
|
|
21
|
+
Math.abs(o[u] - r) < Math.abs(o[c] - r) && (c = u);
|
|
22
|
+
return c;
|
|
23
|
+
}
|
|
24
|
+
const S = (r) => String(r).padStart(2, "0");
|
|
25
|
+
function he({
|
|
26
|
+
src: r,
|
|
27
|
+
name: c,
|
|
28
|
+
kind: u,
|
|
29
|
+
description: E,
|
|
30
|
+
index: m = 0,
|
|
31
|
+
count: d = 1,
|
|
32
|
+
onIndexChange: O,
|
|
33
|
+
errorMessage: R,
|
|
34
|
+
footer: T,
|
|
35
|
+
onError: D,
|
|
36
|
+
className: L
|
|
37
|
+
}) {
|
|
38
|
+
const { t: a } = ie(te), $ = U(), A = Y(null), [M, W] = N(!1), [s, h] = N(null), [p, _] = N(0), [P, F] = N(1), [j, B] = N(r);
|
|
39
|
+
r !== j && (B(r), W(!1), h(null), _(0), F(1));
|
|
40
|
+
const I = u ?? (/\.pdf$/i.test(c) ? "pdf" : "image"), v = I === "pdf", f = r !== null && !M, w = d > 1 && !!O;
|
|
41
|
+
function y(t) {
|
|
42
|
+
w && O?.((m + t + d) % d);
|
|
43
|
+
}
|
|
44
|
+
ee(() => {
|
|
45
|
+
const t = A.current;
|
|
46
|
+
if (s !== null || !t || !p) return;
|
|
47
|
+
const n = () => F(t.clientWidth / p);
|
|
48
|
+
n();
|
|
49
|
+
const b = new ResizeObserver(n);
|
|
50
|
+
return b.observe(t), () => b.disconnect();
|
|
51
|
+
}, [s, p]);
|
|
52
|
+
const k = () => s ?? P;
|
|
53
|
+
function V(t) {
|
|
54
|
+
const n = k(), b = t > 0 ? o.find((C) => C > n + 1e-3) : [...o].reverse().find((C) => C < n - 1e-3);
|
|
55
|
+
b !== void 0 && h(b);
|
|
56
|
+
}
|
|
57
|
+
function Z() {
|
|
58
|
+
W(!0), D?.();
|
|
59
|
+
}
|
|
60
|
+
function H(t) {
|
|
61
|
+
if (!t.target.closest("input, textarea, select"))
|
|
62
|
+
if (t.key === "ArrowLeft" && w)
|
|
63
|
+
t.preventDefault(), y(-1);
|
|
64
|
+
else if (t.key === "ArrowRight" && w)
|
|
65
|
+
t.preventDefault(), y(1);
|
|
66
|
+
else {
|
|
67
|
+
if (v || !f) return;
|
|
68
|
+
t.key === "+" || t.key === "=" ? V(1) : t.key === "-" ? V(-1) : t.key === "0" && h(null);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const g = ne(f ? k() : 1), x = `${Math.round((s ?? k()) * 100)} %`, K = [a(v ? "fileViewer.pdf" : "fileViewer.image")], z = a("fileViewer.position", { current: m + 1, count: d });
|
|
72
|
+
return /* @__PURE__ */ l(
|
|
73
|
+
"section",
|
|
74
|
+
{
|
|
75
|
+
className: ae(i.viewer, L),
|
|
76
|
+
"data-slot": "file-viewer",
|
|
77
|
+
"data-kind": I,
|
|
78
|
+
"data-zoomed": s !== null || void 0,
|
|
79
|
+
"aria-labelledby": `${$}-title`,
|
|
80
|
+
onKeyDown: H,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ l("header", { className: i.header, children: [
|
|
83
|
+
/* @__PURE__ */ l("div", { className: i.heading, children: [
|
|
84
|
+
/* @__PURE__ */ e(
|
|
85
|
+
"h2",
|
|
86
|
+
{
|
|
87
|
+
id: `${$}-title`,
|
|
88
|
+
className: "truncate font-heading text-2xl leading-snug font-semibold tracking-tight",
|
|
89
|
+
children: c || a("fileViewer.title")
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ l("p", { className: i.caption, children: [
|
|
93
|
+
K,
|
|
94
|
+
E && /* @__PURE__ */ l(X, { children: [
|
|
95
|
+
" · ",
|
|
96
|
+
E
|
|
97
|
+
] })
|
|
98
|
+
] })
|
|
99
|
+
] }),
|
|
100
|
+
d > 1 && /* @__PURE__ */ l("span", { className: i.index, title: z, children: [
|
|
101
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: z }),
|
|
102
|
+
/* @__PURE__ */ l("span", { "aria-hidden": "true", children: [
|
|
103
|
+
S(m + 1),
|
|
104
|
+
" / ",
|
|
105
|
+
S(d)
|
|
106
|
+
] })
|
|
107
|
+
] })
|
|
108
|
+
] }),
|
|
109
|
+
/* @__PURE__ */ l("div", { className: i.stage, children: [
|
|
110
|
+
/* @__PURE__ */ l("div", { className: i.marks, "aria-hidden": "true", children: [
|
|
111
|
+
/* @__PURE__ */ e("i", { "data-corner": "tl" }),
|
|
112
|
+
/* @__PURE__ */ e("i", { "data-corner": "tr" }),
|
|
113
|
+
/* @__PURE__ */ e("i", { "data-corner": "bl" }),
|
|
114
|
+
/* @__PURE__ */ e("i", { "data-corner": "br" }),
|
|
115
|
+
/* @__PURE__ */ e("i", { "data-edge": "top" }),
|
|
116
|
+
/* @__PURE__ */ e("i", { "data-edge": "bottom" }),
|
|
117
|
+
/* @__PURE__ */ e("i", { "data-edge": "left" }),
|
|
118
|
+
/* @__PURE__ */ e("i", { "data-edge": "right" }),
|
|
119
|
+
/* @__PURE__ */ e("i", { "data-center": "" })
|
|
120
|
+
] }),
|
|
121
|
+
/* @__PURE__ */ e("div", { className: i.viewport, children: M ? /* @__PURE__ */ e("p", { className: i.error, role: "alert", children: R ?? a("fileViewer.error") }) : r === null ? /* @__PURE__ */ e("p", { className: i.loading, role: "status", children: a("fileViewer.loading") }) : v ? /* @__PURE__ */ e("iframe", { src: r, title: c, className: i.pdf }, r) : /* @__PURE__ */ e("div", { className: i.canvas, children: /* @__PURE__ */ e(
|
|
122
|
+
"img",
|
|
123
|
+
{
|
|
124
|
+
ref: A,
|
|
125
|
+
src: r,
|
|
126
|
+
alt: c,
|
|
127
|
+
className: i.image,
|
|
128
|
+
style: s === null || !p ? void 0 : {
|
|
129
|
+
width: p * s,
|
|
130
|
+
maxWidth: "none",
|
|
131
|
+
maxHeight: "none"
|
|
132
|
+
},
|
|
133
|
+
onLoad: (t) => _(t.currentTarget.naturalWidth),
|
|
134
|
+
onError: Z
|
|
135
|
+
},
|
|
136
|
+
r
|
|
137
|
+
) }) })
|
|
138
|
+
] }),
|
|
139
|
+
/* @__PURE__ */ l("div", { className: i.controls, children: [
|
|
140
|
+
w && /* @__PURE__ */ l("div", { className: i.paging, children: [
|
|
141
|
+
/* @__PURE__ */ e(
|
|
142
|
+
"button",
|
|
143
|
+
{
|
|
144
|
+
type: "button",
|
|
145
|
+
className: i.round,
|
|
146
|
+
"aria-label": a("fileViewer.previous"),
|
|
147
|
+
title: a("fileViewer.previous"),
|
|
148
|
+
onClick: () => y(-1),
|
|
149
|
+
children: /* @__PURE__ */ e(q, {})
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
d <= le ? /* @__PURE__ */ e("ol", { className: i.dots, "aria-label": z, children: Array.from({ length: d }, (t, n) => /* @__PURE__ */ e(
|
|
153
|
+
"li",
|
|
154
|
+
{
|
|
155
|
+
"aria-current": n === m ? "true" : void 0
|
|
156
|
+
},
|
|
157
|
+
n
|
|
158
|
+
)) }) : /* @__PURE__ */ l("span", { className: i.counter, "aria-hidden": "true", children: [
|
|
159
|
+
S(m + 1),
|
|
160
|
+
" / ",
|
|
161
|
+
S(d)
|
|
162
|
+
] }),
|
|
163
|
+
/* @__PURE__ */ e(
|
|
164
|
+
"button",
|
|
165
|
+
{
|
|
166
|
+
type: "button",
|
|
167
|
+
className: i.round,
|
|
168
|
+
"aria-label": a("fileViewer.next"),
|
|
169
|
+
title: a("fileViewer.next"),
|
|
170
|
+
onClick: () => y(1),
|
|
171
|
+
children: /* @__PURE__ */ e(G, {})
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
] }),
|
|
175
|
+
!v && /* @__PURE__ */ l("div", { className: i.zoom, children: [
|
|
176
|
+
/* @__PURE__ */ e(
|
|
177
|
+
"button",
|
|
178
|
+
{
|
|
179
|
+
type: "button",
|
|
180
|
+
className: i.round,
|
|
181
|
+
disabled: !f || g === 0,
|
|
182
|
+
"aria-label": a("fileViewer.zoomOut"),
|
|
183
|
+
title: a("fileViewer.zoomOut"),
|
|
184
|
+
onClick: () => V(-1),
|
|
185
|
+
children: /* @__PURE__ */ e(J, {})
|
|
186
|
+
}
|
|
187
|
+
),
|
|
188
|
+
/* @__PURE__ */ l("div", { className: i.scale, children: [
|
|
189
|
+
/* @__PURE__ */ e(
|
|
190
|
+
"input",
|
|
191
|
+
{
|
|
192
|
+
className: i.slider,
|
|
193
|
+
type: "range",
|
|
194
|
+
min: 0,
|
|
195
|
+
max: o.length - 1,
|
|
196
|
+
step: 1,
|
|
197
|
+
value: g,
|
|
198
|
+
disabled: !f,
|
|
199
|
+
"aria-label": a("fileViewer.zoom"),
|
|
200
|
+
"aria-valuetext": s === null ? `${a("fileViewer.fit")} (${x})` : x,
|
|
201
|
+
style: {
|
|
202
|
+
"--progress": `${g / (o.length - 1) * 100}%`
|
|
203
|
+
},
|
|
204
|
+
onChange: (t) => h(o[t.currentTarget.valueAsNumber])
|
|
205
|
+
}
|
|
206
|
+
),
|
|
207
|
+
/* @__PURE__ */ e("div", { className: i.ruler, "aria-hidden": "true", children: o.map((t, n) => /* @__PURE__ */ e(
|
|
208
|
+
"i",
|
|
209
|
+
{
|
|
210
|
+
"data-major": t === 1 || void 0,
|
|
211
|
+
"data-passed": n <= g || void 0
|
|
212
|
+
},
|
|
213
|
+
t
|
|
214
|
+
)) })
|
|
215
|
+
] }),
|
|
216
|
+
/* @__PURE__ */ e(
|
|
217
|
+
"button",
|
|
218
|
+
{
|
|
219
|
+
type: "button",
|
|
220
|
+
className: i.round,
|
|
221
|
+
disabled: !f || g === o.length - 1,
|
|
222
|
+
"aria-label": a("fileViewer.zoomIn"),
|
|
223
|
+
title: a("fileViewer.zoomIn"),
|
|
224
|
+
onClick: () => V(1),
|
|
225
|
+
children: /* @__PURE__ */ e(Q, {})
|
|
226
|
+
}
|
|
227
|
+
),
|
|
228
|
+
/* @__PURE__ */ e("span", { className: i.readout, "aria-hidden": "true", children: x }),
|
|
229
|
+
/* @__PURE__ */ e(
|
|
230
|
+
"button",
|
|
231
|
+
{
|
|
232
|
+
type: "button",
|
|
233
|
+
className: i.fit,
|
|
234
|
+
disabled: !f,
|
|
235
|
+
"aria-pressed": s === null,
|
|
236
|
+
onClick: () => h(s === null ? 1 : null),
|
|
237
|
+
children: a("fileViewer.fit")
|
|
238
|
+
}
|
|
239
|
+
)
|
|
240
|
+
] })
|
|
241
|
+
] }),
|
|
242
|
+
T && /* @__PURE__ */ e("footer", { className: i.footer, children: T })
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
export {
|
|
248
|
+
re as FILE_VIEWER_ZOOM_STEPS,
|
|
249
|
+
he as FileViewer
|
|
250
|
+
};
|
|
251
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/ui/file-viewer/index.tsx"],"sourcesContent":["'use client'\n\nimport { ChevronLeft, ChevronRight, Minus, Plus } from 'lucide-react'\nimport {\n\ttype CSSProperties,\n\ttype KeyboardEvent,\n\ttype ReactNode,\n\tuseEffect,\n\tuseId,\n\tuseRef,\n\tuseState,\n} from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { STOA_NS } from '../../i18n/namespace'\nimport { cn } from '../../utils/cn'\nimport styles from './FileViewer.module.scss'\n\nexport type FileViewerKind = 'image' | 'pdf'\n\nexport interface FileViewerProps {\n\t/** File URL; `null` while the app is still resolving it. */\n\tsrc: string | null\n\t/** File name: heading, alt text and the source of the default `kind`. */\n\tname: string\n\t/** Defaults to `pdf` for `*.pdf` names, otherwise `image`. */\n\tkind?: FileViewerKind\n\t/** Extra caption next to the kind, e.g. the file size. */\n\tdescription?: ReactNode\n\t/** Position in a collection (0-based) for paging. */\n\tindex?: number\n\tcount?: number\n\tonIndexChange?: (index: number) => void\n\t/** Shown instead of the default message when the file cannot be displayed. */\n\terrorMessage?: ReactNode\n\t/** Extra actions below the controls, e.g. \"open in default app\". */\n\tfooter?: ReactNode\n\tonError?: () => void\n\tclassName?: string\n}\n\n/** Zoom stops of the scale; `null` (fit) sits outside the scale. */\nexport const FILE_VIEWER_ZOOM_STEPS = [\n\t0.25, 0.5, 0.75, 1, 1.5, 2, 3, 4,\n] as const\nconst STEPS = FILE_VIEWER_ZOOM_STEPS\nconst DOTS_MAX = 12\n\nfunction nearestStep(scale: number) {\n\tlet best = 0\n\tfor (let index = 1; index < STEPS.length; index += 1)\n\t\tif (Math.abs(STEPS[index] - scale) < Math.abs(STEPS[best] - scale))\n\t\t\tbest = index\n\treturn best\n}\n\nconst pad = (value: number) => String(value).padStart(2, '0')\n\n/**\n * In-app viewer for images and PDFs in the instrument style: a stage with\n * viewfinder marks, a straight zoom scale, and paging through a collection.\n * PDFs use the webview's own PDF viewer (pages, scrolling, zoom).\n */\nexport function FileViewer({\n\tsrc,\n\tname,\n\tkind,\n\tdescription,\n\tindex = 0,\n\tcount = 1,\n\tonIndexChange,\n\terrorMessage,\n\tfooter,\n\tonError,\n\tclassName,\n}: FileViewerProps) {\n\tconst { t } = useTranslation(STOA_NS)\n\tconst id = useId()\n\tconst image = useRef<HTMLImageElement>(null)\n\tconst [failed, setFailed] = useState(false)\n\t// `null` fits the image into the stage.\n\tconst [zoom, setZoom] = useState<number | null>(null)\n\tconst [naturalWidth, setNaturalWidth] = useState(0)\n\t// The scale the fitted image is shown at, measured from the layout.\n\tconst [fitScale, setFitScale] = useState(1)\n\n\t// A new file starts fitted (reset during render, no extra effect).\n\tconst [previousSrc, setPreviousSrc] = useState(src)\n\tif (src !== previousSrc) {\n\t\tsetPreviousSrc(src)\n\t\tsetFailed(false)\n\t\tsetZoom(null)\n\t\tsetNaturalWidth(0)\n\t\tsetFitScale(1)\n\t}\n\n\tconst type: FileViewerKind = kind ?? (/\\.pdf$/i.test(name) ? 'pdf' : 'image')\n\tconst pdf = type === 'pdf'\n\tconst ready = src !== null && !failed\n\tconst paging = count > 1 && Boolean(onIndexChange)\n\n\tfunction go(step: number) {\n\t\tif (!paging) return\n\t\tonIndexChange?.((index + step + count) % count)\n\t}\n\n\tuseEffect(() => {\n\t\tconst element = image.current\n\t\tif (zoom !== null || !element || !naturalWidth) return\n\t\tconst measure = () => setFitScale(element.clientWidth / naturalWidth)\n\t\tmeasure()\n\t\tconst observer = new ResizeObserver(measure)\n\t\tobserver.observe(element)\n\t\treturn () => observer.disconnect()\n\t}, [zoom, naturalWidth])\n\n\t/** The scale the image is shown at right now, also while fitted. */\n\tconst shownScale = () => zoom ?? fitScale\n\n\tfunction zoomBy(direction: 1 | -1) {\n\t\tconst from = shownScale()\n\t\tconst next =\n\t\t\tdirection > 0\n\t\t\t\t? STEPS.find((step) => step > from + 0.001)\n\t\t\t\t: [...STEPS].reverse().find((step) => step < from - 0.001)\n\t\tif (next !== undefined) setZoom(next)\n\t}\n\n\tfunction fail() {\n\t\tsetFailed(true)\n\t\tonError?.()\n\t}\n\n\tfunction onKeyDown(event: KeyboardEvent) {\n\t\tconst target = event.target as HTMLElement\n\t\tif (target.closest('input, textarea, select')) return\n\t\tif (event.key === 'ArrowLeft' && paging) {\n\t\t\tevent.preventDefault()\n\t\t\tgo(-1)\n\t\t} else if (event.key === 'ArrowRight' && paging) {\n\t\t\tevent.preventDefault()\n\t\t\tgo(1)\n\t\t} else if (pdf || !ready) return\n\t\telse if (event.key === '+' || event.key === '=') zoomBy(1)\n\t\telse if (event.key === '-') zoomBy(-1)\n\t\telse if (event.key === '0') setZoom(null)\n\t}\n\n\tconst stepIndex = nearestStep(ready ? shownScale() : 1)\n\tconst percent = `${Math.round((zoom ?? shownScale()) * 100)} %`\n\tconst caption = [t(pdf ? 'fileViewer.pdf' : 'fileViewer.image')]\n\tconst position = t('fileViewer.position', { current: index + 1, count })\n\n\treturn (\n\t\t<section\n\t\t\tclassName={cn(styles.viewer, className)}\n\t\t\tdata-slot='file-viewer'\n\t\t\tdata-kind={type}\n\t\t\tdata-zoomed={zoom !== null || undefined}\n\t\t\taria-labelledby={`${id}-title`}\n\t\t\tonKeyDown={onKeyDown}\n\t\t>\n\t\t\t<header className={styles.header}>\n\t\t\t\t<div className={styles.heading}>\n\t\t\t\t\t<h2\n\t\t\t\t\t\tid={`${id}-title`}\n\t\t\t\t\t\tclassName='truncate font-heading text-2xl leading-snug font-semibold tracking-tight'\n\t\t\t\t\t>\n\t\t\t\t\t\t{name || t('fileViewer.title')}\n\t\t\t\t\t</h2>\n\t\t\t\t\t<p className={styles.caption}>\n\t\t\t\t\t\t{caption}\n\t\t\t\t\t\t{description && <> · {description}</>}\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t{count > 1 && (\n\t\t\t\t\t<span className={styles.index} title={position}>\n\t\t\t\t\t\t<span className='sr-only'>{position}</span>\n\t\t\t\t\t\t<span aria-hidden='true'>\n\t\t\t\t\t\t\t{pad(index + 1)} / {pad(count)}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</header>\n\n\t\t\t<div className={styles.stage}>\n\t\t\t\t{/* Viewfinder marks behind the content: decoration only. */}\n\t\t\t\t<div className={styles.marks} aria-hidden='true'>\n\t\t\t\t\t<i data-corner='tl' />\n\t\t\t\t\t<i data-corner='tr' />\n\t\t\t\t\t<i data-corner='bl' />\n\t\t\t\t\t<i data-corner='br' />\n\t\t\t\t\t<i data-edge='top' />\n\t\t\t\t\t<i data-edge='bottom' />\n\t\t\t\t\t<i data-edge='left' />\n\t\t\t\t\t<i data-edge='right' />\n\t\t\t\t\t<i data-center='' />\n\t\t\t\t</div>\n\t\t\t\t<div className={styles.viewport}>\n\t\t\t\t\t{failed ? (\n\t\t\t\t\t\t<p className={styles.error} role='alert'>\n\t\t\t\t\t\t\t{errorMessage ?? t('fileViewer.error')}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) : src === null ? (\n\t\t\t\t\t\t<p className={styles.loading} role='status'>\n\t\t\t\t\t\t\t{t('fileViewer.loading')}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) : pdf ? (\n\t\t\t\t\t\t<iframe key={src} src={src} title={name} className={styles.pdf} />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div className={styles.canvas}>\n\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\tref={image}\n\t\t\t\t\t\t\t\tkey={src}\n\t\t\t\t\t\t\t\tsrc={src}\n\t\t\t\t\t\t\t\talt={name}\n\t\t\t\t\t\t\t\tclassName={styles.image}\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tzoom === null || !naturalWidth\n\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t\t\twidth: naturalWidth * zoom,\n\t\t\t\t\t\t\t\t\t\t\t\tmaxWidth: 'none',\n\t\t\t\t\t\t\t\t\t\t\t\tmaxHeight: 'none',\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonLoad={(event) =>\n\t\t\t\t\t\t\t\t\tsetNaturalWidth(event.currentTarget.naturalWidth)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonError={fail}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div className={styles.controls}>\n\t\t\t\t{paging && (\n\t\t\t\t\t<div className={styles.paging}>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t\tclassName={styles.round}\n\t\t\t\t\t\t\taria-label={t('fileViewer.previous')}\n\t\t\t\t\t\t\ttitle={t('fileViewer.previous')}\n\t\t\t\t\t\t\tonClick={() => go(-1)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ChevronLeft />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t{count <= DOTS_MAX ? (\n\t\t\t\t\t\t\t<ol className={styles.dots} aria-label={position}>\n\t\t\t\t\t\t\t\t{Array.from({ length: count }, (_, dot) => (\n\t\t\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: one dot per position\n\t\t\t\t\t\t\t\t\t\tkey={dot}\n\t\t\t\t\t\t\t\t\t\taria-current={dot === index ? 'true' : undefined}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</ol>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<span className={styles.counter} aria-hidden='true'>\n\t\t\t\t\t\t\t\t{pad(index + 1)} / {pad(count)}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t\tclassName={styles.round}\n\t\t\t\t\t\t\taria-label={t('fileViewer.next')}\n\t\t\t\t\t\t\ttitle={t('fileViewer.next')}\n\t\t\t\t\t\t\tonClick={() => go(1)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ChevronRight />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\n\t\t\t\t{!pdf && (\n\t\t\t\t\t<div className={styles.zoom}>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t\tclassName={styles.round}\n\t\t\t\t\t\t\tdisabled={!ready || stepIndex === 0}\n\t\t\t\t\t\t\taria-label={t('fileViewer.zoomOut')}\n\t\t\t\t\t\t\ttitle={t('fileViewer.zoomOut')}\n\t\t\t\t\t\t\tonClick={() => zoomBy(-1)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Minus />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<div className={styles.scale}>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tclassName={styles.slider}\n\t\t\t\t\t\t\t\ttype='range'\n\t\t\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\t\t\tmax={STEPS.length - 1}\n\t\t\t\t\t\t\t\tstep={1}\n\t\t\t\t\t\t\t\tvalue={stepIndex}\n\t\t\t\t\t\t\t\tdisabled={!ready}\n\t\t\t\t\t\t\t\taria-label={t('fileViewer.zoom')}\n\t\t\t\t\t\t\t\taria-valuetext={\n\t\t\t\t\t\t\t\t\tzoom === null\n\t\t\t\t\t\t\t\t\t\t? `${t('fileViewer.fit')} (${percent})`\n\t\t\t\t\t\t\t\t\t\t: percent\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'--progress': `${(stepIndex / (STEPS.length - 1)) * 100}%`,\n\t\t\t\t\t\t\t\t\t} as CSSProperties\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={(event) =>\n\t\t\t\t\t\t\t\t\tsetZoom(STEPS[event.currentTarget.valueAsNumber])\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<div className={styles.ruler} aria-hidden='true'>\n\t\t\t\t\t\t\t\t{STEPS.map((step, tick) => (\n\t\t\t\t\t\t\t\t\t<i\n\t\t\t\t\t\t\t\t\t\tkey={step}\n\t\t\t\t\t\t\t\t\t\tdata-major={step === 1 || undefined}\n\t\t\t\t\t\t\t\t\t\tdata-passed={tick <= stepIndex || undefined}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t\tclassName={styles.round}\n\t\t\t\t\t\t\tdisabled={!ready || stepIndex === STEPS.length - 1}\n\t\t\t\t\t\t\taria-label={t('fileViewer.zoomIn')}\n\t\t\t\t\t\t\ttitle={t('fileViewer.zoomIn')}\n\t\t\t\t\t\t\tonClick={() => zoomBy(1)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Plus />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t<span className={styles.readout} aria-hidden='true'>\n\t\t\t\t\t\t\t{percent}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t\tclassName={styles.fit}\n\t\t\t\t\t\t\tdisabled={!ready}\n\t\t\t\t\t\t\taria-pressed={zoom === null}\n\t\t\t\t\t\t\tonClick={() => setZoom(zoom === null ? 1 : null)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{t('fileViewer.fit')}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\n\t\t\t{footer && <footer className={styles.footer}>{footer}</footer>}\n\t\t</section>\n\t)\n}\n"],"names":["FILE_VIEWER_ZOOM_STEPS","STEPS","DOTS_MAX","nearestStep","scale","best","index","pad","value","FileViewer","src","name","kind","description","count","onIndexChange","errorMessage","footer","onError","className","t","useTranslation","STOA_NS","id","useId","image","useRef","failed","setFailed","useState","zoom","setZoom","naturalWidth","setNaturalWidth","fitScale","setFitScale","previousSrc","setPreviousSrc","type","pdf","ready","paging","go","step","useEffect","element","measure","observer","shownScale","zoomBy","direction","from","next","fail","onKeyDown","event","stepIndex","percent","caption","position","jsxs","cn","styles","jsx","Fragment","ChevronLeft","_","dot","ChevronRight","Minus","tick","Plus"],"mappings":";;;;;;;AAyCO,MAAMA,KAAyB;AAAA,EACrC;AAAA,EAAM;AAAA,EAAK;AAAA,EAAM;AAAA,EAAG;AAAA,EAAK;AAAA,EAAG;AAAA,EAAG;AAChC,GACMC,IAAQD,IACRE,KAAW;AAEjB,SAASC,GAAYC,GAAe;AACnC,MAAIC,IAAO;AACX,WAASC,IAAQ,GAAGA,IAAQL,EAAM,QAAQK,KAAS;AAClD,IAAI,KAAK,IAAIL,EAAMK,CAAK,IAAIF,CAAK,IAAI,KAAK,IAAIH,EAAMI,CAAI,IAAID,CAAK,MAChEC,IAAOC;AACT,SAAOD;AACR;AAEA,MAAME,IAAM,CAACC,MAAkB,OAAOA,CAAK,EAAE,SAAS,GAAG,GAAG;AAOrD,SAASC,GAAW;AAAA,EAC1B,KAAAC;AAAA,EACA,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAP,IAAQ;AAAA,EACR,OAAAQ,IAAQ;AAAA,EACR,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AACD,GAAoB;AACnB,QAAM,EAAE,GAAAC,EAAA,IAAMC,GAAeC,EAAO,GAC9BC,IAAKC,EAAA,GACLC,IAAQC,EAAyB,IAAI,GACrC,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GAEpC,CAACC,GAAMC,CAAO,IAAIF,EAAwB,IAAI,GAC9C,CAACG,GAAcC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gBAE9C,YAAE,gBAAgB;AAAA,cAAA;AAAA,YAAA;AAAA,UACpB,EAAA,CACD;AAAA,QAAA,GAEF;AAAA,QAECb,KAAU,gBAAA8C,EAAC,UAAA,EAAO,WAAWD,EAAO,QAAS,UAAA7C,EAAA,CAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGxD;"}
|
package/dist/ui/index.js
CHANGED
|
@@ -1,124 +1,129 @@
|
|
|
1
1
|
import { Accordion as e, AccordionContent as t, AccordionItem as p, AccordionTrigger as n } from "./accordion/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
2
|
+
import { AudioPlayer as i } from "./audio-player/index.js";
|
|
3
|
+
import { Button as d, buttonVariants as u } from "./button/index.js";
|
|
4
|
+
import { Calendar as c, CalendarDayButton as g } from "./calendar/index.js";
|
|
5
|
+
import { Card as D, CardAction as f, CardContent as S, CardDescription as T, CardFooter as C, CardHeader as w, CardTitle as M } from "./card/index.js";
|
|
6
|
+
import { ColorPicker as P } from "./color-picker/index.js";
|
|
7
|
+
import { ColorPickerToggle as G } from "./color-picker-toggle/index.js";
|
|
8
|
+
import { Dialog as v, DialogClose as A, DialogContent as s, DialogDescription as h, DialogFooter as B, DialogHeader as L, DialogOverlay as E, DialogPortal as R, DialogTitle as V, DialogTrigger as k } from "./dialog/index.js";
|
|
9
|
+
import { DropdownMenu as H, DropdownMenuCheckboxItem as O, DropdownMenuContent as _, DropdownMenuGroup as U, DropdownMenuItem as W, DropdownMenuLabel as Z, DropdownMenuPortal as j, DropdownMenuRadioGroup as q, DropdownMenuRadioItem as z, DropdownMenuSeparator as J, DropdownMenuShortcut as K, DropdownMenuSub as N, DropdownMenuSubContent as Q, DropdownMenuSubTrigger as X, DropdownMenuTrigger as Y } from "./dropdown-menu/index.js";
|
|
10
|
+
import { Field as oo, FieldContent as ro, FieldDescription as eo, FieldError as to, FieldGroup as po, FieldLabel as no, FieldLegend as lo, FieldSeparator as io, FieldSet as ao, FieldTitle as uo } from "./field/index.js";
|
|
11
|
+
import { FILE_VIEWER_ZOOM_STEPS as co, FileViewer as go } from "./file-viewer/index.js";
|
|
12
|
+
import { Input as Do } from "./input/index.js";
|
|
13
|
+
import { InputGroup as So, InputGroupAddon as To, InputGroupButton as Co, InputGroupInput as wo, InputGroupText as Mo, InputGroupTextarea as Io } from "./input-group/index.js";
|
|
14
|
+
import { Label as Fo } from "./label/index.js";
|
|
15
|
+
import { MarkedText as bo } from "./marked-text/index.js";
|
|
16
|
+
import { Pill as Ao } from "./pill/index.js";
|
|
17
|
+
import { Popover as ho, PopoverAnchor as Bo, PopoverContent as Lo, PopoverDescription as Eo, PopoverHeader as Ro, PopoverTitle as Vo, PopoverTrigger as ko } from "./popover/index.js";
|
|
18
|
+
import { RadioGroup as Ho, RadioGroupItem as Oo } from "./radio-group/index.js";
|
|
19
|
+
import { ScrollArea as Uo, ScrollBar as Wo } from "./scroll-area/index.js";
|
|
20
|
+
import { Select as jo, SelectContent as qo, SelectGroup as zo, SelectItem as Jo, SelectLabel as Ko, SelectScrollDownButton as No, SelectScrollUpButton as Qo, SelectSeparator as Xo, SelectTrigger as Yo, SelectValue as $o } from "./select/index.js";
|
|
21
|
+
import { Separator as rr } from "./separator/index.js";
|
|
22
|
+
import { Toaster as tr } from "./sonner/index.js";
|
|
23
|
+
import { Switch as nr } from "./switch/index.js";
|
|
24
|
+
import { Textarea as ir } from "./textarea/index.js";
|
|
25
|
+
import { ThemeSwitch as dr } from "./theme-switch/index.js";
|
|
26
|
+
import { ThemeToggle as mr } from "./theme-toggle/index.js";
|
|
27
|
+
import { Toggle as gr, toggleVariants as xr } from "./toggle/index.js";
|
|
28
|
+
import { Tooltip as fr, TooltipContent as Sr, TooltipProvider as Tr, TooltipTrigger as Cr } from "./tooltip/index.js";
|
|
27
29
|
export {
|
|
28
30
|
e as Accordion,
|
|
29
31
|
t as AccordionContent,
|
|
30
32
|
p as AccordionItem,
|
|
31
33
|
n as AccordionTrigger,
|
|
32
|
-
i as
|
|
33
|
-
|
|
34
|
-
c as
|
|
35
|
-
g as
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
M as
|
|
43
|
-
P as
|
|
44
|
-
G as
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
s as
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
U as
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
34
|
+
i as AudioPlayer,
|
|
35
|
+
d as Button,
|
|
36
|
+
c as Calendar,
|
|
37
|
+
g as CalendarDayButton,
|
|
38
|
+
D as Card,
|
|
39
|
+
f as CardAction,
|
|
40
|
+
S as CardContent,
|
|
41
|
+
T as CardDescription,
|
|
42
|
+
C as CardFooter,
|
|
43
|
+
w as CardHeader,
|
|
44
|
+
M as CardTitle,
|
|
45
|
+
P as ColorPicker,
|
|
46
|
+
G as ColorPickerToggle,
|
|
47
|
+
v as Dialog,
|
|
48
|
+
A as DialogClose,
|
|
49
|
+
s as DialogContent,
|
|
50
|
+
h as DialogDescription,
|
|
51
|
+
B as DialogFooter,
|
|
52
|
+
L as DialogHeader,
|
|
53
|
+
E as DialogOverlay,
|
|
54
|
+
R as DialogPortal,
|
|
55
|
+
V as DialogTitle,
|
|
56
|
+
k as DialogTrigger,
|
|
57
|
+
H as DropdownMenu,
|
|
58
|
+
O as DropdownMenuCheckboxItem,
|
|
59
|
+
_ as DropdownMenuContent,
|
|
60
|
+
U as DropdownMenuGroup,
|
|
61
|
+
W as DropdownMenuItem,
|
|
62
|
+
Z as DropdownMenuLabel,
|
|
63
|
+
j as DropdownMenuPortal,
|
|
64
|
+
q as DropdownMenuRadioGroup,
|
|
65
|
+
z as DropdownMenuRadioItem,
|
|
66
|
+
J as DropdownMenuSeparator,
|
|
67
|
+
K as DropdownMenuShortcut,
|
|
68
|
+
N as DropdownMenuSub,
|
|
69
|
+
Q as DropdownMenuSubContent,
|
|
67
70
|
X as DropdownMenuSubTrigger,
|
|
68
71
|
Y as DropdownMenuTrigger,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
uo as
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
jo as
|
|
103
|
-
qo as
|
|
104
|
-
zo as
|
|
105
|
-
Jo as
|
|
106
|
-
Ko as
|
|
107
|
-
No as
|
|
108
|
-
Qo as
|
|
109
|
-
|
|
110
|
-
Yo as
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
72
|
+
co as FILE_VIEWER_ZOOM_STEPS,
|
|
73
|
+
oo as Field,
|
|
74
|
+
ro as FieldContent,
|
|
75
|
+
eo as FieldDescription,
|
|
76
|
+
to as FieldError,
|
|
77
|
+
po as FieldGroup,
|
|
78
|
+
no as FieldLabel,
|
|
79
|
+
lo as FieldLegend,
|
|
80
|
+
io as FieldSeparator,
|
|
81
|
+
ao as FieldSet,
|
|
82
|
+
uo as FieldTitle,
|
|
83
|
+
go as FileViewer,
|
|
84
|
+
Do as Input,
|
|
85
|
+
So as InputGroup,
|
|
86
|
+
To as InputGroupAddon,
|
|
87
|
+
Co as InputGroupButton,
|
|
88
|
+
wo as InputGroupInput,
|
|
89
|
+
Mo as InputGroupText,
|
|
90
|
+
Io as InputGroupTextarea,
|
|
91
|
+
Fo as Label,
|
|
92
|
+
bo as MarkedText,
|
|
93
|
+
Ao as Pill,
|
|
94
|
+
ho as Popover,
|
|
95
|
+
Bo as PopoverAnchor,
|
|
96
|
+
Lo as PopoverContent,
|
|
97
|
+
Eo as PopoverDescription,
|
|
98
|
+
Ro as PopoverHeader,
|
|
99
|
+
Vo as PopoverTitle,
|
|
100
|
+
ko as PopoverTrigger,
|
|
101
|
+
Ho as RadioGroup,
|
|
102
|
+
Oo as RadioGroupItem,
|
|
103
|
+
Uo as ScrollArea,
|
|
104
|
+
Wo as ScrollBar,
|
|
105
|
+
jo as Select,
|
|
106
|
+
qo as SelectContent,
|
|
107
|
+
zo as SelectGroup,
|
|
108
|
+
Jo as SelectItem,
|
|
109
|
+
Ko as SelectLabel,
|
|
110
|
+
No as SelectScrollDownButton,
|
|
111
|
+
Qo as SelectScrollUpButton,
|
|
112
|
+
Xo as SelectSeparator,
|
|
113
|
+
Yo as SelectTrigger,
|
|
114
|
+
$o as SelectValue,
|
|
115
|
+
rr as Separator,
|
|
116
|
+
nr as Switch,
|
|
117
|
+
ir as Textarea,
|
|
118
|
+
dr as ThemeSwitch,
|
|
119
|
+
mr as ThemeToggle,
|
|
120
|
+
tr as Toaster,
|
|
121
|
+
gr as Toggle,
|
|
122
|
+
fr as Tooltip,
|
|
123
|
+
Sr as TooltipContent,
|
|
124
|
+
Tr as TooltipProvider,
|
|
125
|
+
Cr as TooltipTrigger,
|
|
126
|
+
u as buttonVariants,
|
|
127
|
+
xr as toggleVariants
|
|
123
128
|
};
|
|
124
129
|
//# sourceMappingURL=index.js.map
|
package/dist/ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/ui/input/index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { jsx as o, jsxs as g, Fragment as
|
|
2
|
-
import { useId as
|
|
3
|
-
import { cn as
|
|
1
|
+
import { jsx as o, jsxs as g, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { useId as k, useState as N, useRef as S, useEffect as B } from "react";
|
|
3
|
+
import { cn as F } from "../../utils/cn.js";
|
|
4
4
|
function M({
|
|
5
5
|
className: p,
|
|
6
6
|
type: w,
|
|
7
7
|
label: i,
|
|
8
8
|
icon: t,
|
|
9
9
|
transitionStyle: v = "default",
|
|
10
|
-
suggestions:
|
|
10
|
+
suggestions: s,
|
|
11
11
|
list: l,
|
|
12
12
|
placeholder: n,
|
|
13
13
|
"aria-label": x,
|
|
14
14
|
onFocus: b,
|
|
15
15
|
onBlur: T,
|
|
16
|
-
...
|
|
16
|
+
...P
|
|
17
17
|
}) {
|
|
18
|
-
const c =
|
|
18
|
+
const c = k(), u = l === void 0 && !!s?.length, [r, a] = N({
|
|
19
19
|
focused: !1,
|
|
20
20
|
showingPlaceholder: !1
|
|
21
|
-
}),
|
|
22
|
-
|
|
21
|
+
}), d = S(void 0);
|
|
22
|
+
B(() => () => window.clearTimeout(d.current), []);
|
|
23
23
|
function f(e) {
|
|
24
|
-
window.clearTimeout(
|
|
25
|
-
const { showingPlaceholder:
|
|
26
|
-
if (!i || !n || e ===
|
|
24
|
+
window.clearTimeout(d.current);
|
|
25
|
+
const { showingPlaceholder: m } = r;
|
|
26
|
+
if (!i || !n || e === m || window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
27
27
|
a({ focused: e, showingPlaceholder: e });
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
a({ focused: e, showingPlaceholder:
|
|
30
|
+
a({ focused: e, showingPlaceholder: m }), d.current = window.setTimeout(() => {
|
|
31
31
|
a({ focused: e, showingPlaceholder: e });
|
|
32
32
|
}, 90);
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const y = i && (n ? r.focused !== r.showingPlaceholder : r.focused), I = !i || r.showingPlaceholder && n, h = /* @__PURE__ */ o(
|
|
35
35
|
"input",
|
|
36
36
|
{
|
|
37
37
|
type: w,
|
|
@@ -39,9 +39,10 @@ function M({
|
|
|
39
39
|
"data-slot": "input",
|
|
40
40
|
"data-transition-style": v,
|
|
41
41
|
"data-has-icon": t ? "" : void 0,
|
|
42
|
-
"data-inline-label": i ?
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
"data-inline-label": i ? y ? "hidden" : "visible" : void 0,
|
|
43
|
+
"data-placeholder-role": I ? "hint" : "label",
|
|
44
|
+
className: F(
|
|
45
|
+
"h-12 w-full min-w-0 rounded-lg border-[1.5px] border-foreground/35 bg-transparent px-3 py-1 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:font-semibold placeholder:text-muted-foreground data-[placeholder-role=label]:placeholder:text-foreground/75 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
45
46
|
t && "peer pr-10",
|
|
46
47
|
p
|
|
47
48
|
),
|
|
@@ -53,12 +54,12 @@ function M({
|
|
|
53
54
|
onBlur: (e) => {
|
|
54
55
|
f(!1), T?.(e);
|
|
55
56
|
},
|
|
56
|
-
...
|
|
57
|
+
...P
|
|
57
58
|
}
|
|
58
59
|
);
|
|
59
|
-
return /* @__PURE__ */ g(
|
|
60
|
+
return /* @__PURE__ */ g(j, { children: [
|
|
60
61
|
t ? /* @__PURE__ */ g("div", { className: "flex min-w-0 items-center", children: [
|
|
61
|
-
|
|
62
|
+
h,
|
|
62
63
|
/* @__PURE__ */ o(
|
|
63
64
|
"span",
|
|
64
65
|
{
|
|
@@ -68,8 +69,8 @@ function M({
|
|
|
68
69
|
children: t
|
|
69
70
|
}
|
|
70
71
|
)
|
|
71
|
-
] }) :
|
|
72
|
-
u && /* @__PURE__ */ o("datalist", { id: c, children: Array.from(new Set(
|
|
72
|
+
] }) : h,
|
|
73
|
+
u && /* @__PURE__ */ o("datalist", { id: c, children: Array.from(new Set(s), (e) => /* @__PURE__ */ o("option", { value: e }, e)) })
|
|
73
74
|
] });
|
|
74
75
|
}
|
|
75
76
|
export {
|