@robert-stackflow/oneui 0.6.53 → 0.6.55
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/CHANGELOG.md +9 -0
- package/README.md +6 -4
- package/components/ContributionCalendar.d.ts +30 -1
- package/components/ContributionCalendar.js +9 -4
- package/components/Control.module.css +6 -4
- package/components/Lightbox.js +110 -41
- package/components/Lightbox.module.css +41 -8
- package/components/MenuItem.module.css +0 -5
- package/components/SearchField.module.css +4 -0
- package/components/index.d.ts +1 -1
- package/components/index.js +3 -1
- package/package.json +1 -1
- package/styles/base.css +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 0.6.55
|
|
2
|
+
|
|
3
|
+
- ContributionCalendar 新增 `labels`,应用可传入日历名称、空状态、图例与贡献计数格式。月份、星期和日期继续按 `locale` 格式化。
|
|
4
|
+
|
|
5
|
+
## 0.6.54
|
|
6
|
+
|
|
7
|
+
- 触屏按主题密度显示控件,24px 点击尺寸作为下限。可编辑字段继续使用至少 16px 的字号,搜索清除按钮保留紧凑图标并提供 24px 点击区域。
|
|
8
|
+
- 图片查看器打开时将焦点置于标题区。触屏支持跟手滑动和缩略图换图,横屏缩减周边空间,桌面保留前后箭头与键盘操作。
|
|
9
|
+
|
|
1
10
|
## 0.6.53
|
|
2
11
|
|
|
3
12
|
- ContributionCalendar 的月份、星期、提示与图例随 locale 显示,保留中文默认文案并支持英文日历。
|
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
React 组件、应用外壳和两套可互换的主题。无 Electron、React Router、账户 API 或持久化存储依赖。
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 触屏密度(0.6.54)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
控件沿用主题和密度定义的尺寸。粗指针设备下,共用控件的最小点击尺寸为 24 CSS px。按钮、分段控件、标签页、选择器、菜单和分页各自保留主题高度。仅可编辑字段在触屏下保持至少 16px 字号,避免 iOS 聚焦时缩放。空间充足的独立操作可用公开变量 `--touch-target-min: 44px` 提供更大的目标。字号可通过 `--touch-field-font-size` 配置。
|
|
8
8
|
|
|
9
9
|
`Pagination getPageHref(page)` 为可用的页码和翻页控件输出真实链接,普通点击仍调用 `onPageChange`,修饰键/中键交给浏览器。禁用翻页按钮不生成链接。后台不传该属性时保留原有按钮行为。
|
|
10
10
|
|
|
@@ -20,6 +20,8 @@ ghost 图标按钮及分栏按钮的展开 / 选中态使用主题轻背景;
|
|
|
20
20
|
|
|
21
21
|
`ContributionCalendar fill` 在可用版心中放大网格;`source` 替换左下角默认日期范围,`footer` 在分隔线下提供统计等组合内容。调用方复用原生日历的主题、边框、提示和交互,不在外层再套 Card。
|
|
22
22
|
|
|
23
|
+
应用通过 `locale` 指定月份、星期和日期格式,并通过 `labels` 传入日历名称、无数据和未来日期提示、图例、分隔符与 `formatCount(count, formattedCount)`。未传入的文案使用组件默认值,已有的 `label` 和 `unit` 属性继续可用。
|
|
24
|
+
|
|
23
25
|
## 菜单滚动边界(0.6.37)
|
|
24
26
|
|
|
25
27
|
ContextMenu 打开期间会接管滚轮:长菜单仍可在内部滚动,短菜单及边界滚动不会传递到正文或嵌套工作区;关闭后恢复。
|
|
@@ -336,7 +338,7 @@ Menu 支持 iconOnly:`<Menu iconOnly label="更多操作" items={items} />`
|
|
|
336
338
|
|
|
337
339
|
`Lightbox` is a controlled image viewer: pass `open`, `items`, `index`, `onIndexChange` and `onClose`. Each item has a stable `id`, `src`, `alt` and optional `caption`, `thumbnailSrc`, `width` and `height`. The optional `sourceElement(item)` resolves the original image for Hero motion; `onLocate(item)` runs after exit and scroll unlocking. Supply `labels` for localization. Provide valid `width` and `height` for an aspect-correct loading skeleton fitted to the canvas; images without known dimensions use a compact loading indicator.
|
|
338
340
|
|
|
339
|
-
The viewer uses an opaque black canvas with light controls
|
|
341
|
+
The viewer uses an opaque black canvas with light controls in both color modes. Opening focuses the header so keyboard navigation starts inside the dialog. Mouse users have previous and next buttons. On touch, the image follows horizontal swipes and the thumbnail strip provides direct navigation. Arrow keys, Escape, zoom, pinch, pan, captions and image retry work across layouts. A single image hides navigation. Only adjacent full images are preloaded. Native modal isolation and the shared focus lifecycle restore focus to the opener. Keep the component mounted through exit and retain the selected index.
|
|
340
342
|
|
|
341
343
|
Image changes retain the existing outgoing image for a directional fade/slide, without remounting it for the animation. Thumbnail selection uses a moving outline and a separate keyboard focus ring. Shared modal scroll locking preserves classic scrollbar space, nested lock ownership and original document styles.
|
|
342
344
|
|
|
@@ -356,4 +358,4 @@ Closing returns a visible source image with Hero motion. Missing/offscreen sourc
|
|
|
356
358
|
|
|
357
359
|
### 窄屏分页(0.6.52)
|
|
358
360
|
|
|
359
|
-
650px
|
|
361
|
+
650px 及以下保留上一页、下一页、首页页码、末页页码和当前页,使用省略号标明页码间隔。分页使用主题的控件尺寸,320px 下保持一行。页码可使用按钮或原生链接。
|
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type ContributionDay } from "./contribution";
|
|
3
|
-
|
|
3
|
+
declare const calendarCopy: {
|
|
4
|
+
zh: {
|
|
5
|
+
label: string;
|
|
6
|
+
unit: string;
|
|
7
|
+
invalidRange: string;
|
|
8
|
+
future: string;
|
|
9
|
+
missing: string;
|
|
10
|
+
legend: string;
|
|
11
|
+
less: string;
|
|
12
|
+
more: string;
|
|
13
|
+
separator: string;
|
|
14
|
+
};
|
|
15
|
+
en: {
|
|
16
|
+
label: string;
|
|
17
|
+
unit: string;
|
|
18
|
+
invalidRange: string;
|
|
19
|
+
future: string;
|
|
20
|
+
missing: string;
|
|
21
|
+
legend: string;
|
|
22
|
+
less: string;
|
|
23
|
+
more: string;
|
|
24
|
+
separator: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export type ContributionCalendarLabels = typeof calendarCopy.en & {
|
|
28
|
+
formatCount?: (count: number, formattedCount: string) => string;
|
|
29
|
+
};
|
|
30
|
+
export declare function ContributionCalendar({ data, year, startDate, endDate, weekStartsOn, value, onChange, label, unit, labels, locale, color, emptyMode, allowFuture, today, thresholds, footer, source, fill, }: {
|
|
4
31
|
data: ContributionDay[];
|
|
5
32
|
year?: number;
|
|
6
33
|
startDate?: string;
|
|
@@ -10,6 +37,7 @@ export declare function ContributionCalendar({ data, year, startDate, endDate, w
|
|
|
10
37
|
onChange?(date: string): void;
|
|
11
38
|
label?: string;
|
|
12
39
|
unit?: string;
|
|
40
|
+
labels?: Partial<ContributionCalendarLabels>;
|
|
13
41
|
locale?: string;
|
|
14
42
|
color?: string;
|
|
15
43
|
emptyMode?: "zero" | "missing";
|
|
@@ -20,3 +48,4 @@ export declare function ContributionCalendar({ data, year, startDate, endDate, w
|
|
|
20
48
|
source?: ReactNode;
|
|
21
49
|
fill?: boolean;
|
|
22
50
|
}): import("react").JSX.Element;
|
|
51
|
+
export {};
|
|
@@ -46,6 +46,7 @@ function ContributionCalendar({
|
|
|
46
46
|
onChange,
|
|
47
47
|
label,
|
|
48
48
|
unit,
|
|
49
|
+
labels,
|
|
49
50
|
locale = "zh-CN",
|
|
50
51
|
color = "var(--success)",
|
|
51
52
|
emptyMode = "zero",
|
|
@@ -57,7 +58,7 @@ function ContributionCalendar({
|
|
|
57
58
|
fill = false
|
|
58
59
|
}) {
|
|
59
60
|
const chinese = new Intl.Locale(locale).language === "zh";
|
|
60
|
-
const copy = calendarCopy[chinese ? "zh" : "en"];
|
|
61
|
+
const copy = { ...calendarCopy[chinese ? "zh" : "en"], ...labels };
|
|
61
62
|
const calendarLabel = label ?? copy.label;
|
|
62
63
|
const calendarUnit = unit ?? copy.unit;
|
|
63
64
|
const current = /* @__PURE__ */ new Date(), todayKey = today || [
|
|
@@ -147,7 +148,8 @@ function ContributionCalendar({
|
|
|
147
148
|
},
|
|
148
149
|
[model]
|
|
149
150
|
);
|
|
150
|
-
if (!model.valid)
|
|
151
|
+
if (!model.valid)
|
|
152
|
+
return /* @__PURE__ */ jsx("p", { role: "alert", lang: locale, children: copy.invalidRange });
|
|
151
153
|
return /* @__PURE__ */ jsxs(
|
|
152
154
|
"div",
|
|
153
155
|
{
|
|
@@ -180,7 +182,9 @@ function ContributionCalendar({
|
|
|
180
182
|
/* @__PURE__ */ jsx("span", {}),
|
|
181
183
|
model.months.filter(
|
|
182
184
|
(month, index, headings) => !headings[index + 1] || headings[index + 1].column - month.column >= 2
|
|
183
|
-
).map((month) => /* @__PURE__ */ jsx("span", { style: { gridColumn: month.column + 2 }, children: months.format(
|
|
185
|
+
).map((month) => /* @__PURE__ */ jsx("span", { style: { gridColumn: month.column + 2 }, children: months.format(
|
|
186
|
+
new Date(Date.UTC(month.year, month.month - 1, 1))
|
|
187
|
+
) }, month.key))
|
|
184
188
|
]
|
|
185
189
|
}
|
|
186
190
|
),
|
|
@@ -203,7 +207,8 @@ function ContributionCalendar({
|
|
|
203
207
|
/* @__PURE__ */ jsx("span", { className: s.weekday, role: "rowheader", children: weekdays[(row + weekStartsOn) % 7] }),
|
|
204
208
|
Array.from({ length: model.weeks }, (_2, column) => {
|
|
205
209
|
const day = model.cells[column * 7 + row];
|
|
206
|
-
const
|
|
210
|
+
const count = numbers.format(day.count);
|
|
211
|
+
const text = formatter.format(parseCalendarDay(day.date)) + copy.separator + (day.future ? copy.future : emptyMode === "missing" && day.missing ? copy.missing : copy.formatCount?.(day.count, count) ?? count + " " + calendarUnit);
|
|
207
212
|
return /* @__PURE__ */ jsx(
|
|
208
213
|
ContributionCell,
|
|
209
214
|
{
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
border-radius: var(--field-radius);
|
|
6
6
|
background: var(--field);
|
|
7
7
|
color: var(--fg);
|
|
8
|
-
font-size:
|
|
8
|
+
font-size: var(--field-font-size);
|
|
9
9
|
line-height: var(--field-line-height);
|
|
10
10
|
outline: none;
|
|
11
11
|
transition:
|
|
@@ -82,9 +82,11 @@
|
|
|
82
82
|
.surface:has(input[readonly]) {
|
|
83
83
|
background: var(--field-readonly);
|
|
84
84
|
}
|
|
85
|
+
.surface:where(input, textarea, :has(input:not([type="hidden"]))) {
|
|
86
|
+
font-size: max(var(--field-font-size), var(--touch-field-font-size, 0px));
|
|
87
|
+
}
|
|
85
88
|
@media (max-width: 600px) {
|
|
86
|
-
.surface:has(input)
|
|
87
|
-
|
|
88
|
-
font-size: 16px;
|
|
89
|
+
.surface:where(input, textarea, :has(input:not([type="hidden"]))) {
|
|
90
|
+
font-size: max(var(--field-font-size), var(--touch-field-font-size, 16px));
|
|
89
91
|
}
|
|
90
92
|
}
|
package/components/Lightbox.js
CHANGED
|
@@ -56,7 +56,8 @@ function Lightbox(props) {
|
|
|
56
56
|
const outgoingRef = useRef(null), thumbnailsRef = useRef(null);
|
|
57
57
|
const [indicator, setIndicator] = useState(null);
|
|
58
58
|
const slideAnimations = useRef([]);
|
|
59
|
-
const imageRef = useRef(null), stageRef = useRef(null),
|
|
59
|
+
const imageRef = useRef(null), stageRef = useRef(null), headerRef = useRef(null);
|
|
60
|
+
const swipeOffset = useRef(0), swipeSettle = useRef(null);
|
|
60
61
|
const titleId = useId(), captionId = useId();
|
|
61
62
|
const live = useRef(props);
|
|
62
63
|
live.current = props;
|
|
@@ -111,6 +112,7 @@ function Lightbox(props) {
|
|
|
111
112
|
const slideState = useRef(slide);
|
|
112
113
|
slideState.current = slide;
|
|
113
114
|
const blankGesture = useRef(null);
|
|
115
|
+
const touchButton = useRef(null);
|
|
114
116
|
const isBlank = (target) => target === ref.current || target === stageRef.current || target instanceof HTMLElement && target.hasAttribute("data-lightbox-blank");
|
|
115
117
|
const pointers = useRef(/* @__PURE__ */ new Map());
|
|
116
118
|
const gesture = useRef({
|
|
@@ -267,6 +269,9 @@ function Lightbox(props) {
|
|
|
267
269
|
setZoom(1);
|
|
268
270
|
setPan({ x: 0, y: 0 });
|
|
269
271
|
pointers.current.clear();
|
|
272
|
+
swipeSettle.current?.cancel();
|
|
273
|
+
swipeOffset.current = 0;
|
|
274
|
+
stageRef.current?.style.removeProperty("--lightbox-swipe-x");
|
|
270
275
|
const img = imageRef.current;
|
|
271
276
|
if (img?.complete && img.naturalWidth) onLoaded();
|
|
272
277
|
}, [open, item?.id, item?.src]);
|
|
@@ -293,6 +298,10 @@ function Lightbox(props) {
|
|
|
293
298
|
useEffect(() => {
|
|
294
299
|
const element = ref.current;
|
|
295
300
|
const resize = () => {
|
|
301
|
+
pointers.current.clear();
|
|
302
|
+
swipeSettle.current?.cancel();
|
|
303
|
+
swipeOffset.current = 0;
|
|
304
|
+
stageRef.current?.style.removeProperty("--lightbox-swipe-x");
|
|
296
305
|
setZoom(1);
|
|
297
306
|
setPan({ x: 0, y: 0 });
|
|
298
307
|
};
|
|
@@ -301,6 +310,7 @@ function Lightbox(props) {
|
|
|
301
310
|
window.removeEventListener("resize", resize);
|
|
302
311
|
if (element) cancelMotion(element);
|
|
303
312
|
hero.current?.cancel();
|
|
313
|
+
swipeSettle.current?.cancel();
|
|
304
314
|
slideAnimations.current.forEach((animation) => animation.cancel());
|
|
305
315
|
};
|
|
306
316
|
}, [portal]);
|
|
@@ -314,7 +324,7 @@ function Lightbox(props) {
|
|
|
314
324
|
if (!dialog.open) {
|
|
315
325
|
rememberFocus();
|
|
316
326
|
dialog.showModal();
|
|
317
|
-
|
|
327
|
+
headerRef.current?.focus({ preventScroll: true });
|
|
318
328
|
heroPending.current = true;
|
|
319
329
|
if (imageRef.current?.complete && imageRef.current.naturalWidth) {
|
|
320
330
|
heroPending.current = false;
|
|
@@ -357,7 +367,11 @@ function Lightbox(props) {
|
|
|
357
367
|
setPan({ x: 0, y: 0 });
|
|
358
368
|
};
|
|
359
369
|
const pointerDown = (event) => {
|
|
360
|
-
if (event.button !== 0 ||
|
|
370
|
+
if (event.button !== 0 || event.target instanceof Element && event.target.closest("button"))
|
|
371
|
+
return;
|
|
372
|
+
swipeSettle.current?.cancel();
|
|
373
|
+
swipeOffset.current = 0;
|
|
374
|
+
event.currentTarget.style.removeProperty("--lightbox-swipe-x");
|
|
361
375
|
event.currentTarget.setPointerCapture(event.pointerId);
|
|
362
376
|
pointers.current.set(event.pointerId, {
|
|
363
377
|
x: event.clientX,
|
|
@@ -381,7 +395,7 @@ function Lightbox(props) {
|
|
|
381
395
|
y: event.clientY
|
|
382
396
|
});
|
|
383
397
|
const points = [...pointers.current.values()], start = gesture.current;
|
|
384
|
-
if (points.length === 2 && start.distance) {
|
|
398
|
+
if (points.length === 2 && start.distance && status === "loaded") {
|
|
385
399
|
const scale = clamp(
|
|
386
400
|
start.scale * Math.hypot(points[0].x - points[1].x, points[0].y - points[1].y) / start.distance,
|
|
387
401
|
1,
|
|
@@ -389,7 +403,7 @@ function Lightbox(props) {
|
|
|
389
403
|
);
|
|
390
404
|
setZoom(scale);
|
|
391
405
|
setPan(bounds(pan.x, pan.y, scale));
|
|
392
|
-
} else if (zoom > 1 &&
|
|
406
|
+
} else if (zoom > 1 && points.length === 1) {
|
|
393
407
|
setPan(
|
|
394
408
|
bounds(
|
|
395
409
|
start.panX + event.clientX - start.x,
|
|
@@ -397,13 +411,47 @@ function Lightbox(props) {
|
|
|
397
411
|
zoom
|
|
398
412
|
)
|
|
399
413
|
);
|
|
414
|
+
} else if (event.pointerType === "touch" && !start.multi && items.length > 1) {
|
|
415
|
+
const dx = event.clientX - start.x;
|
|
416
|
+
const dy = event.clientY - start.y;
|
|
417
|
+
const atEnd = dx > 0 ? index === 0 : index === items.length - 1;
|
|
418
|
+
const offset = Math.abs(dx) > Math.abs(dy) * 1.2 ? dx * (atEnd ? 0.16 : 0.65) : 0;
|
|
419
|
+
swipeOffset.current = offset;
|
|
420
|
+
event.currentTarget.style.setProperty(
|
|
421
|
+
"--lightbox-swipe-x",
|
|
422
|
+
`${offset}px`
|
|
423
|
+
);
|
|
424
|
+
}
|
|
400
425
|
};
|
|
401
426
|
const pointerEnd = (event) => {
|
|
402
427
|
if (!pointers.current.has(event.pointerId)) return;
|
|
403
428
|
const start = gesture.current, dx = event.clientX - start.x, dy = event.clientY - start.y;
|
|
404
429
|
pointers.current.delete(event.pointerId);
|
|
405
|
-
|
|
406
|
-
|
|
430
|
+
const remaining = [...pointers.current.values()];
|
|
431
|
+
if (remaining.length === 1 && start.multi)
|
|
432
|
+
gesture.current = {
|
|
433
|
+
...start,
|
|
434
|
+
...remaining[0],
|
|
435
|
+
panX: pan.x,
|
|
436
|
+
panY: pan.y,
|
|
437
|
+
distance: 0
|
|
438
|
+
};
|
|
439
|
+
const offset = swipeOffset.current;
|
|
440
|
+
swipeOffset.current = 0;
|
|
441
|
+
event.currentTarget.style.removeProperty("--lightbox-swipe-x");
|
|
442
|
+
const threshold = event.pointerType === "touch" ? clamp(event.currentTarget.clientWidth * 0.16, 36, 64) : 64;
|
|
443
|
+
const next = index + (dx < 0 ? 1 : -1);
|
|
444
|
+
if (event.type !== "pointercancel" && !start.multi && zoom === 1 && Math.abs(dx) > threshold && Math.abs(dx) > Math.abs(dy) * 1.2 && next >= 0 && next < items.length) {
|
|
445
|
+
move(next);
|
|
446
|
+
} else if (offset && !reducedMotion()) {
|
|
447
|
+
swipeSettle.current = imageRef.current?.animate(
|
|
448
|
+
[{ translate: `${offset}px` }, { translate: "0px" }],
|
|
449
|
+
{
|
|
450
|
+
duration: motionDuration("--motion-hover", 140),
|
|
451
|
+
easing: "ease-out"
|
|
452
|
+
}
|
|
453
|
+
) ?? null;
|
|
454
|
+
}
|
|
407
455
|
};
|
|
408
456
|
return createPortal(
|
|
409
457
|
/* @__PURE__ */ jsx(SurfacePortalContext, { value: { host, active: open }, children: /* @__PURE__ */ jsxs(
|
|
@@ -415,12 +463,14 @@ function Lightbox(props) {
|
|
|
415
463
|
"aria-describedby": item.caption ? captionId : void 0,
|
|
416
464
|
"aria-modal": "true",
|
|
417
465
|
onPointerDownCapture: (event) => {
|
|
466
|
+
touchButton.current = null;
|
|
418
467
|
blankGesture.current = event.isPrimary && event.button === 0 ? {
|
|
419
468
|
id: event.pointerId,
|
|
420
469
|
x: event.clientX,
|
|
421
470
|
y: event.clientY,
|
|
422
471
|
moved: false,
|
|
423
|
-
blank: isBlank(event.target)
|
|
472
|
+
blank: isBlank(event.target),
|
|
473
|
+
button: event.pointerType === "touch" && event.target instanceof Element ? event.target.closest("button") : null
|
|
424
474
|
} : null;
|
|
425
475
|
},
|
|
426
476
|
onPointerMoveCapture: (event) => {
|
|
@@ -431,11 +481,21 @@ function Lightbox(props) {
|
|
|
431
481
|
onPointerUpCapture: (event) => {
|
|
432
482
|
const start = blankGesture.current;
|
|
433
483
|
blankGesture.current = null;
|
|
434
|
-
if (start?.id
|
|
435
|
-
|
|
484
|
+
if (start?.id !== event.pointerId || start.moved) return;
|
|
485
|
+
if (start.blank && isBlank(event.target)) props.onClose();
|
|
486
|
+
if (start.button && event.target instanceof Node && start.button.contains(event.target))
|
|
487
|
+
touchButton.current = start.button;
|
|
488
|
+
},
|
|
489
|
+
onTouchEnd: (event) => {
|
|
490
|
+
const button = touchButton.current;
|
|
491
|
+
touchButton.current = null;
|
|
492
|
+
if (!button || event.touches.length || !event.cancelable) return;
|
|
493
|
+
event.preventDefault();
|
|
494
|
+
button.click();
|
|
436
495
|
},
|
|
437
496
|
onPointerCancelCapture: () => {
|
|
438
497
|
blankGesture.current = null;
|
|
498
|
+
touchButton.current = null;
|
|
439
499
|
},
|
|
440
500
|
onCancel: (event) => {
|
|
441
501
|
event.preventDefault();
|
|
@@ -449,36 +509,45 @@ function Lightbox(props) {
|
|
|
449
509
|
},
|
|
450
510
|
children: [
|
|
451
511
|
/* @__PURE__ */ jsx("h2", { id: titleId, className: s.srOnly, children: t.title }),
|
|
452
|
-
/* @__PURE__ */ jsxs(
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
512
|
+
/* @__PURE__ */ jsxs(
|
|
513
|
+
"header",
|
|
514
|
+
{
|
|
515
|
+
ref: headerRef,
|
|
516
|
+
tabIndex: -1,
|
|
517
|
+
className: s.header,
|
|
518
|
+
"data-lightbox-blank": "",
|
|
519
|
+
children: [
|
|
520
|
+
/* @__PURE__ */ jsxs("span", { className: s.counter, role: "status", "aria-live": "polite", children: [
|
|
521
|
+
index + 1,
|
|
522
|
+
" / ",
|
|
523
|
+
items.length
|
|
524
|
+
] }),
|
|
525
|
+
/* @__PURE__ */ jsxs("div", { className: s.actions, children: [
|
|
526
|
+
/* @__PURE__ */ jsx(
|
|
527
|
+
IconButton,
|
|
528
|
+
{
|
|
529
|
+
label: zoom > 1 ? t.zoomOut : t.zoomIn,
|
|
530
|
+
disabled: status !== "loaded",
|
|
531
|
+
onClick: toggleZoom,
|
|
532
|
+
children: zoom > 1 ? /* @__PURE__ */ jsx(ZoomOut, { size: 19 }) : /* @__PURE__ */ jsx(ZoomIn, { size: 19 })
|
|
533
|
+
}
|
|
534
|
+
),
|
|
535
|
+
props.onLocate && /* @__PURE__ */ jsx(
|
|
536
|
+
IconButton,
|
|
537
|
+
{
|
|
538
|
+
label: t.locate,
|
|
539
|
+
onClick: () => {
|
|
540
|
+
locate.current = item;
|
|
541
|
+
props.onClose();
|
|
542
|
+
},
|
|
543
|
+
children: /* @__PURE__ */ jsx(LocateFixed, { size: 19 })
|
|
544
|
+
}
|
|
545
|
+
),
|
|
546
|
+
/* @__PURE__ */ jsx(IconButton, { label: t.close, onClick: props.onClose, children: /* @__PURE__ */ jsx(X, { size: 20 }) })
|
|
547
|
+
] })
|
|
548
|
+
]
|
|
549
|
+
}
|
|
550
|
+
),
|
|
482
551
|
/* @__PURE__ */ jsxs("div", { className: s.canvas, "data-lightbox-blank": "", children: [
|
|
483
552
|
items.length > 1 && /* @__PURE__ */ jsx(
|
|
484
553
|
IconButton,
|
|
@@ -549,7 +618,7 @@ function Lightbox(props) {
|
|
|
549
618
|
{
|
|
550
619
|
label: t.retry,
|
|
551
620
|
onClick: () => {
|
|
552
|
-
|
|
621
|
+
headerRef.current?.focus({ preventScroll: true });
|
|
553
622
|
setStatus("loading");
|
|
554
623
|
const img = imageRef.current;
|
|
555
624
|
if (img) {
|
|
@@ -25,19 +25,23 @@
|
|
|
25
25
|
overflow: hidden;
|
|
26
26
|
}
|
|
27
27
|
.lightbox[open] {
|
|
28
|
-
display:
|
|
29
|
-
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
30
|
gap: 12px;
|
|
31
31
|
}
|
|
32
32
|
.lightbox::backdrop {
|
|
33
33
|
background: transparent;
|
|
34
34
|
}
|
|
35
35
|
.header {
|
|
36
|
+
flex-shrink: 0;
|
|
36
37
|
display: flex;
|
|
37
38
|
align-items: center;
|
|
38
39
|
justify-content: space-between;
|
|
39
40
|
min-height: 40px;
|
|
40
41
|
}
|
|
42
|
+
.header:focus {
|
|
43
|
+
outline: none;
|
|
44
|
+
}
|
|
41
45
|
.counter {
|
|
42
46
|
color: var(--muted);
|
|
43
47
|
font-size: 13px;
|
|
@@ -50,6 +54,7 @@
|
|
|
50
54
|
align-items: center;
|
|
51
55
|
}
|
|
52
56
|
.canvas {
|
|
57
|
+
flex: 1;
|
|
53
58
|
position: relative;
|
|
54
59
|
min-height: 0;
|
|
55
60
|
display: flex;
|
|
@@ -85,6 +90,9 @@
|
|
|
85
90
|
border-radius: 2px;
|
|
86
91
|
flex-shrink: 0;
|
|
87
92
|
}
|
|
93
|
+
.image[data-image-phase="current"] {
|
|
94
|
+
translate: var(--lightbox-swipe-x, 0px);
|
|
95
|
+
}
|
|
88
96
|
.previous,
|
|
89
97
|
.next {
|
|
90
98
|
position: absolute;
|
|
@@ -110,7 +118,7 @@
|
|
|
110
118
|
font-size: 13px;
|
|
111
119
|
}
|
|
112
120
|
.caption {
|
|
113
|
-
|
|
121
|
+
align-self: center;
|
|
114
122
|
max-width: min(760px, 90vw);
|
|
115
123
|
max-height: 15dvh;
|
|
116
124
|
overflow: auto;
|
|
@@ -125,12 +133,15 @@
|
|
|
125
133
|
max-height: 100%;
|
|
126
134
|
}
|
|
127
135
|
.thumbnails {
|
|
136
|
+
align-self: center;
|
|
137
|
+
flex-shrink: 0;
|
|
128
138
|
position: relative;
|
|
129
139
|
display: flex;
|
|
130
140
|
gap: 8px;
|
|
131
141
|
max-width: 100%;
|
|
132
142
|
margin-inline: auto;
|
|
133
143
|
overflow-x: auto;
|
|
144
|
+
overscroll-behavior-x: contain;
|
|
134
145
|
padding: 4px;
|
|
135
146
|
}
|
|
136
147
|
.thumbnails button {
|
|
@@ -192,8 +203,8 @@
|
|
|
192
203
|
clip-path: inset(50%);
|
|
193
204
|
white-space: nowrap;
|
|
194
205
|
}
|
|
195
|
-
@media (min-width:
|
|
196
|
-
.stage {
|
|
206
|
+
@media (min-width: 640px) and (pointer: fine) {
|
|
207
|
+
.canvas:has(.next) .stage {
|
|
197
208
|
margin-inline: 48px;
|
|
198
209
|
}
|
|
199
210
|
}
|
|
@@ -204,16 +215,38 @@
|
|
|
204
215
|
}
|
|
205
216
|
|
|
206
217
|
.actions button,
|
|
207
|
-
.canvas
|
|
218
|
+
.canvas :is(.previous, .next) {
|
|
208
219
|
width: 40px;
|
|
209
220
|
height: 40px;
|
|
210
221
|
}
|
|
211
222
|
@media (pointer: coarse) {
|
|
212
|
-
.
|
|
213
|
-
|
|
223
|
+
.lightbox {
|
|
224
|
+
padding-inline: max(10px, env(safe-area-inset-left))
|
|
225
|
+
max(10px, env(safe-area-inset-right));
|
|
226
|
+
}
|
|
227
|
+
.lightbox[open] {
|
|
228
|
+
gap: 8px;
|
|
229
|
+
}
|
|
230
|
+
.actions button {
|
|
214
231
|
width: 44px;
|
|
215
232
|
height: 44px;
|
|
216
233
|
}
|
|
234
|
+
.canvas :is(.previous, .next) {
|
|
235
|
+
display: none;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
@media (max-height: 440px) {
|
|
239
|
+
.lightbox[open] {
|
|
240
|
+
gap: 6px;
|
|
241
|
+
}
|
|
242
|
+
.caption {
|
|
243
|
+
max-height: 12dvh;
|
|
244
|
+
}
|
|
245
|
+
.thumbnails button {
|
|
246
|
+
flex-basis: 48px;
|
|
247
|
+
width: 48px;
|
|
248
|
+
height: 34px;
|
|
249
|
+
}
|
|
217
250
|
}
|
|
218
251
|
|
|
219
252
|
.outgoing {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
height: 15px;
|
|
14
14
|
}
|
|
15
15
|
.search input {
|
|
16
|
+
align-self: stretch;
|
|
16
17
|
width: 100%;
|
|
17
18
|
min-width: 0;
|
|
18
19
|
background: transparent;
|
|
@@ -24,6 +25,9 @@
|
|
|
24
25
|
display: none;
|
|
25
26
|
}
|
|
26
27
|
.search button {
|
|
28
|
+
flex: none;
|
|
29
|
+
min-inline-size: 24px;
|
|
30
|
+
min-block-size: 24px;
|
|
27
31
|
border: 0;
|
|
28
32
|
background: transparent;
|
|
29
33
|
color: var(--muted);
|
package/components/index.d.ts
CHANGED
|
@@ -98,7 +98,7 @@ export { FormErrorSummary } from "./FormErrorSummary";
|
|
|
98
98
|
export { useFormState } from "./useFormState";
|
|
99
99
|
export type { FormController, FormRules, FieldRule } from "./useFormState";
|
|
100
100
|
export { PinInput } from "./PinInput";
|
|
101
|
-
export { ContributionCalendar } from "./ContributionCalendar";
|
|
101
|
+
export { ContributionCalendar, type ContributionCalendarLabels, } from "./ContributionCalendar";
|
|
102
102
|
export type { ContributionDay } from "./contribution";
|
|
103
103
|
export { Combobox, type ComboboxProps } from "./Combobox";
|
|
104
104
|
export { TagInput } from "./TagInput";
|
package/components/index.js
CHANGED
|
@@ -89,7 +89,9 @@ import { FormGroup } from "./FormGroup.js";
|
|
|
89
89
|
import { FormErrorSummary } from "./FormErrorSummary.js";
|
|
90
90
|
import { useFormState } from "./useFormState.js";
|
|
91
91
|
import { PinInput } from "./PinInput.js";
|
|
92
|
-
import {
|
|
92
|
+
import {
|
|
93
|
+
ContributionCalendar
|
|
94
|
+
} from "./ContributionCalendar.js";
|
|
93
95
|
import { Combobox } from "./Combobox.js";
|
|
94
96
|
import { TagInput } from "./TagInput.js";
|
|
95
97
|
import { PasswordField } from "./PasswordField.js";
|
package/package.json
CHANGED
package/styles/base.css
CHANGED
|
@@ -214,10 +214,10 @@
|
|
|
214
214
|
--on-danger: #141414;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
/*
|
|
217
|
+
/* Touch increases the hit-target floor and editable type, not control density. */
|
|
218
218
|
@media (pointer: coarse) {
|
|
219
219
|
:root[data-ui-theme] {
|
|
220
|
-
--touch-target-min:
|
|
220
|
+
--touch-target-min: 24px;
|
|
221
221
|
--touch-field-font-size: 16px;
|
|
222
222
|
}
|
|
223
223
|
}
|