@crisp-ui-kit/crisp 0.31.0 → 0.31.1
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/cjs/components/radiogroup/radiogroup-keyboard.js +6 -1
- package/dist/cjs/components/tabs/tabs-keyboard.js +9 -2
- package/dist/cjs/product/board/board.js +7 -5
- package/dist/cjs/product/recordpage/recordpage.js +9 -4
- package/dist/cjs/product/recordstable/recordstable.js +9 -4
- package/dist/esm/components/radiogroup/radiogroup-keyboard.js +6 -1
- package/dist/esm/components/tabs/tabs-keyboard.js +9 -2
- package/dist/esm/product/board/board.js +7 -5
- package/dist/esm/product/recordpage/recordpage.js +9 -4
- package/dist/esm/product/recordstable/recordstable.js +9 -4
- package/package.json +1 -1
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.useRadioGroupKeyboard = useRadioGroupKeyboard;
|
|
37
37
|
const React = __importStar(require("react"));
|
|
38
|
+
const core_1 = require("../../core");
|
|
38
39
|
/**
|
|
39
40
|
* The WAI-ARIA radio group keyboard model: ←/→/↑/↓ move focus to the next or
|
|
40
41
|
* previous enabled radio, wrapping, and check it on arrival. Home/End jump to
|
|
@@ -113,7 +114,11 @@ function useRadioGroupKeyboard({ select, groupRef: externalRef, }) {
|
|
|
113
114
|
else if (e.key === "End")
|
|
114
115
|
next = radios[radios.length - 1];
|
|
115
116
|
else {
|
|
116
|
-
|
|
117
|
+
// Down always means forward; the horizontal pair follows the direction
|
|
118
|
+
// the radios are drawn in, which for Segmented's pill row is the whole
|
|
119
|
+
// point (#255).
|
|
120
|
+
const rtl = (0, core_1.isRtlElement)(e.currentTarget);
|
|
121
|
+
const fwd = e.key === "ArrowDown" || e.key === (rtl ? "ArrowLeft" : "ArrowRight");
|
|
117
122
|
// focus outside the group: enter at the near end rather than stepping
|
|
118
123
|
// off an index of -1, which would land two from the back going backwards
|
|
119
124
|
if (idx < 0)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useTablistKeyboard = useTablistKeyboard;
|
|
4
|
+
const core_1 = require("../../core");
|
|
4
5
|
/**
|
|
5
6
|
* The WAI-ARIA tablist keyboard model: ←/→ to move (wrapping), Home/End to
|
|
6
7
|
* jump, disabled tabs skipped, focus following selection.
|
|
@@ -20,9 +21,15 @@ function useTablistKeyboard({ tabs, active, select, listRef, }) {
|
|
|
20
21
|
return;
|
|
21
22
|
const idx = enabled.findIndex((t) => t.value === active);
|
|
22
23
|
let next = -1;
|
|
23
|
-
|
|
24
|
+
// The arrows follow the strip as it is drawn: under RTL the next tab is to
|
|
25
|
+
// the LEFT, so the keys swap. Everything else about the model is unchanged
|
|
26
|
+
// (#255).
|
|
27
|
+
const rtl = (0, core_1.isRtlElement)(e.currentTarget);
|
|
28
|
+
const forwardKey = rtl ? "ArrowLeft" : "ArrowRight";
|
|
29
|
+
const backKey = rtl ? "ArrowRight" : "ArrowLeft";
|
|
30
|
+
if (e.key === forwardKey)
|
|
24
31
|
next = (idx + 1) % enabled.length;
|
|
25
|
-
else if (e.key ===
|
|
32
|
+
else if (e.key === backKey)
|
|
26
33
|
next = (idx - 1 + enabled.length) % enabled.length;
|
|
27
34
|
else if (e.key === "Home")
|
|
28
35
|
next = 0;
|
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.Board = Board;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const React = __importStar(require("react"));
|
|
39
|
+
const core_1 = require("../../core");
|
|
39
40
|
const board_recipe_1 = require("./board.recipe");
|
|
40
41
|
/**
|
|
41
42
|
* A kanban board with native drag-and-drop between columns. Cards are
|
|
@@ -108,11 +109,12 @@ function Board({ columns, cards, onCardsChange, renderCard, onNewCard, newCardLa
|
|
|
108
109
|
}, onKeyDown: (e) => {
|
|
109
110
|
if (!(e.ctrlKey || e.metaKey))
|
|
110
111
|
return;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
// the columns are a flex row, so under RTL the next one
|
|
113
|
+
// is to the LEFT and the keys swap (#255)
|
|
114
|
+
const rtl = (0, core_1.isRtlElement)(e.currentTarget);
|
|
115
|
+
const forwardKey = rtl ? "ArrowLeft" : "ArrowRight";
|
|
116
|
+
const backKey = rtl ? "ArrowRight" : "ArrowLeft";
|
|
117
|
+
const delta = e.key === backKey ? -1 : e.key === forwardKey ? 1 : 0;
|
|
116
118
|
// only swallow the key when the move actually happens, so
|
|
117
119
|
// Ctrl+Right at the last column still reaches the browser
|
|
118
120
|
if (delta && moveByKey(card, delta))
|
|
@@ -414,10 +414,15 @@ function RecordPage({ record, columns, collection = "Records", labels, onBack, o
|
|
|
414
414
|
if (!next)
|
|
415
415
|
setFieldQuery("");
|
|
416
416
|
}, children: showAllValues ? t.viewLess : t.viewAllValues }))] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "recordpage-noresults", children: ["No fields match \u201C", fieldQuery, "\u201D."] })))] }), (0, jsx_runtime_1.jsxs)("div", { className: "recordpage-section", children: [(0, jsx_runtime_1.jsx)(SectionHead, { title: t.tabs.lists, action: (0, jsx_runtime_1.jsxs)("button", { type: "button", className: "recordpage-addbtn", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { size: 14, strokeWidth: 2 }), t.addToList] }) }), (0, jsx_runtime_1.jsx)("div", { className: "recordpage-emptystate", children: t.noLists })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "recordpage-resizer", "data-active": resizing ? "" : undefined, role: "separator", "aria-orientation": "vertical", "aria-label": t.resizeDetails, "aria-valuenow": Math.round(detailsW), "aria-valuemin": 300, "aria-valuemax": 560, tabIndex: 0, onPointerDown: onResizeDown, onPointerMove: onResizeMove, onPointerUp: onResizeUp, onKeyDown: (e) => {
|
|
417
|
-
if (e.key
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
417
|
+
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight")
|
|
418
|
+
return;
|
|
419
|
+
// The pointer drag learned its direction in #212; this did not.
|
|
420
|
+
// The details column is the flex row's first child, so it sits on
|
|
421
|
+
// the RIGHT under RTL and ArrowLeft has to grow it — the same
|
|
422
|
+
// half-conversion the drag had, one handler away (#255).
|
|
423
|
+
const rtl = (0, core_1.isRtlElement)(e.currentTarget);
|
|
424
|
+
const grow = e.key === (rtl ? "ArrowLeft" : "ArrowRight");
|
|
425
|
+
setDetailsW((w) => grow ? Math.min(560, w + 16) : Math.max(300, w - 16));
|
|
421
426
|
} }), (0, jsx_runtime_1.jsx)("main", { className: "recordpage-main", children: (0, jsx_runtime_1.jsx)(tabs_1.Tabs, { tabs: tabs, defaultValue: "overview", "aria-label": `${name} record`, children: panel }) })] })] }));
|
|
422
427
|
}
|
|
423
428
|
RecordPage.displayName = "RecordPage";
|
|
@@ -640,10 +640,15 @@ function RecordsTable({ labels, columns: columnsProp = exports.defaultColumns, r
|
|
|
640
640
|
nr = Math.max(0, r - 1);
|
|
641
641
|
else if (e.key === "ArrowDown")
|
|
642
642
|
nr = Math.min(visibleRows.length - 1, r + 1);
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
643
|
+
// The arrows follow what the user SEES. Under RTL the first column renders
|
|
644
|
+
// rightmost, so ArrowLeft moves to the next column and ArrowRight to the
|
|
645
|
+
// previous — the grid's own half-conversion, of the same kind the resize
|
|
646
|
+
// grips had (#255).
|
|
647
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
648
|
+
const rtl = (0, core_1.isRtlElement)(e.currentTarget);
|
|
649
|
+
const forward = e.key === (rtl ? "ArrowLeft" : "ArrowRight");
|
|
650
|
+
nc = forward ? Math.min(cols.length - 1, c + 1) : Math.max(0, c - 1);
|
|
651
|
+
}
|
|
647
652
|
else if (e.key === "Escape") {
|
|
648
653
|
setSelCell(null);
|
|
649
654
|
return;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { isRtlElement } from "../../core/index.js";
|
|
2
3
|
/**
|
|
3
4
|
* The WAI-ARIA radio group keyboard model: ←/→/↑/↓ move focus to the next or
|
|
4
5
|
* previous enabled radio, wrapping, and check it on arrival. Home/End jump to
|
|
@@ -77,7 +78,11 @@ export function useRadioGroupKeyboard({ select, groupRef: externalRef, }) {
|
|
|
77
78
|
else if (e.key === "End")
|
|
78
79
|
next = radios[radios.length - 1];
|
|
79
80
|
else {
|
|
80
|
-
|
|
81
|
+
// Down always means forward; the horizontal pair follows the direction
|
|
82
|
+
// the radios are drawn in, which for Segmented's pill row is the whole
|
|
83
|
+
// point (#255).
|
|
84
|
+
const rtl = isRtlElement(e.currentTarget);
|
|
85
|
+
const fwd = e.key === "ArrowDown" || e.key === (rtl ? "ArrowLeft" : "ArrowRight");
|
|
81
86
|
// focus outside the group: enter at the near end rather than stepping
|
|
82
87
|
// off an index of -1, which would land two from the back going backwards
|
|
83
88
|
if (idx < 0)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRtlElement } from "../../core/index.js";
|
|
1
2
|
/**
|
|
2
3
|
* The WAI-ARIA tablist keyboard model: ←/→ to move (wrapping), Home/End to
|
|
3
4
|
* jump, disabled tabs skipped, focus following selection.
|
|
@@ -17,9 +18,15 @@ export function useTablistKeyboard({ tabs, active, select, listRef, }) {
|
|
|
17
18
|
return;
|
|
18
19
|
const idx = enabled.findIndex((t) => t.value === active);
|
|
19
20
|
let next = -1;
|
|
20
|
-
|
|
21
|
+
// The arrows follow the strip as it is drawn: under RTL the next tab is to
|
|
22
|
+
// the LEFT, so the keys swap. Everything else about the model is unchanged
|
|
23
|
+
// (#255).
|
|
24
|
+
const rtl = isRtlElement(e.currentTarget);
|
|
25
|
+
const forwardKey = rtl ? "ArrowLeft" : "ArrowRight";
|
|
26
|
+
const backKey = rtl ? "ArrowRight" : "ArrowLeft";
|
|
27
|
+
if (e.key === forwardKey)
|
|
21
28
|
next = (idx + 1) % enabled.length;
|
|
22
|
-
else if (e.key ===
|
|
29
|
+
else if (e.key === backKey)
|
|
23
30
|
next = (idx - 1 + enabled.length) % enabled.length;
|
|
24
31
|
else if (e.key === "Home")
|
|
25
32
|
next = 0;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { isRtlElement } from "../../core/index.js";
|
|
3
4
|
import { boardRecipe } from "./board.recipe.js";
|
|
4
5
|
/**
|
|
5
6
|
* A kanban board with native drag-and-drop between columns. Cards are
|
|
@@ -72,11 +73,12 @@ export function Board({ columns, cards, onCardsChange, renderCard, onNewCard, ne
|
|
|
72
73
|
}, onKeyDown: (e) => {
|
|
73
74
|
if (!(e.ctrlKey || e.metaKey))
|
|
74
75
|
return;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
// the columns are a flex row, so under RTL the next one
|
|
77
|
+
// is to the LEFT and the keys swap (#255)
|
|
78
|
+
const rtl = isRtlElement(e.currentTarget);
|
|
79
|
+
const forwardKey = rtl ? "ArrowLeft" : "ArrowRight";
|
|
80
|
+
const backKey = rtl ? "ArrowRight" : "ArrowLeft";
|
|
81
|
+
const delta = e.key === backKey ? -1 : e.key === forwardKey ? 1 : 0;
|
|
80
82
|
// only swallow the key when the move actually happens, so
|
|
81
83
|
// Ctrl+Right at the last column still reaches the browser
|
|
82
84
|
if (delta && moveByKey(card, delta))
|
|
@@ -377,10 +377,15 @@ export function RecordPage({ record, columns, collection = "Records", labels, on
|
|
|
377
377
|
if (!next)
|
|
378
378
|
setFieldQuery("");
|
|
379
379
|
}, children: showAllValues ? t.viewLess : t.viewAllValues }))] })) : (_jsxs("div", { className: "recordpage-noresults", children: ["No fields match \u201C", fieldQuery, "\u201D."] })))] }), _jsxs("div", { className: "recordpage-section", children: [_jsx(SectionHead, { title: t.tabs.lists, action: _jsxs("button", { type: "button", className: "recordpage-addbtn", children: [_jsx(Plus, { size: 14, strokeWidth: 2 }), t.addToList] }) }), _jsx("div", { className: "recordpage-emptystate", children: t.noLists })] })] }), _jsx("div", { className: "recordpage-resizer", "data-active": resizing ? "" : undefined, role: "separator", "aria-orientation": "vertical", "aria-label": t.resizeDetails, "aria-valuenow": Math.round(detailsW), "aria-valuemin": 300, "aria-valuemax": 560, tabIndex: 0, onPointerDown: onResizeDown, onPointerMove: onResizeMove, onPointerUp: onResizeUp, onKeyDown: (e) => {
|
|
380
|
-
if (e.key
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
380
|
+
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight")
|
|
381
|
+
return;
|
|
382
|
+
// The pointer drag learned its direction in #212; this did not.
|
|
383
|
+
// The details column is the flex row's first child, so it sits on
|
|
384
|
+
// the RIGHT under RTL and ArrowLeft has to grow it — the same
|
|
385
|
+
// half-conversion the drag had, one handler away (#255).
|
|
386
|
+
const rtl = isRtlElement(e.currentTarget);
|
|
387
|
+
const grow = e.key === (rtl ? "ArrowLeft" : "ArrowRight");
|
|
388
|
+
setDetailsW((w) => grow ? Math.min(560, w + 16) : Math.max(300, w - 16));
|
|
384
389
|
} }), _jsx("main", { className: "recordpage-main", children: _jsx(Tabs, { tabs: tabs, defaultValue: "overview", "aria-label": `${name} record`, children: panel }) })] })] }));
|
|
385
390
|
}
|
|
386
391
|
RecordPage.displayName = "RecordPage";
|
|
@@ -600,10 +600,15 @@ export function RecordsTable({ labels, columns: columnsProp = defaultColumns, ro
|
|
|
600
600
|
nr = Math.max(0, r - 1);
|
|
601
601
|
else if (e.key === "ArrowDown")
|
|
602
602
|
nr = Math.min(visibleRows.length - 1, r + 1);
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
603
|
+
// The arrows follow what the user SEES. Under RTL the first column renders
|
|
604
|
+
// rightmost, so ArrowLeft moves to the next column and ArrowRight to the
|
|
605
|
+
// previous — the grid's own half-conversion, of the same kind the resize
|
|
606
|
+
// grips had (#255).
|
|
607
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
608
|
+
const rtl = isRtlElement(e.currentTarget);
|
|
609
|
+
const forward = e.key === (rtl ? "ArrowLeft" : "ArrowRight");
|
|
610
|
+
nc = forward ? Math.min(cols.length - 1, c + 1) : Math.max(0, c - 1);
|
|
611
|
+
}
|
|
607
612
|
else if (e.key === "Escape") {
|
|
608
613
|
setSelCell(null);
|
|
609
614
|
return;
|