@kjun-ui/react 0.5.1 → 0.6.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/index.cjs +87 -80
- package/dist/index.js +87 -80
- package/dist/styles.css +0 -2579
- package/dist/types/packages/react/src/controls.d.cts +3 -2
- package/dist/types/packages/react/src/controls.d.ts +3 -2
- package/dist/types/shared/package-runtime/group-keyboard.d.cts +7 -0
- package/dist/types/shared/package-runtime/group-keyboard.d.ts +7 -0
- package/dist/types/shared/package-runtime/selection-indicator.d.cts +4 -0
- package/dist/types/shared/package-runtime/selection-indicator.d.ts +4 -0
- package/dist/types/shared/package-runtime/table-presentation.d.cts +1 -1
- package/dist/types/shared/package-runtime/table-presentation.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -2045,89 +2045,111 @@ var import_react22 = require("react");
|
|
|
2045
2045
|
var import_react_aria_components2 = require("react-aria-components");
|
|
2046
2046
|
|
|
2047
2047
|
// packages/react/src/use-selection-indicator.ts
|
|
2048
|
-
var import_tokens15 = require("@kjun-ui/tokens");
|
|
2049
2048
|
var import_react21 = require("react");
|
|
2049
|
+
|
|
2050
|
+
// shared/package-runtime/selection-indicator.ts
|
|
2051
|
+
var import_tokens15 = require("@kjun-ui/tokens");
|
|
2052
|
+
function selectionIndicator(root, marker, tabs = false) {
|
|
2053
|
+
var _a;
|
|
2054
|
+
let selected = null, bounds = "", disposed = false;
|
|
2055
|
+
const observed = /* @__PURE__ */ new Set();
|
|
2056
|
+
const observer = new ResizeObserver(() => update());
|
|
2057
|
+
const visibility = new MutationObserver(() => update());
|
|
2058
|
+
for (let ancestor = root; ancestor; ancestor = ancestor.parentElement) {
|
|
2059
|
+
visibility.observe(ancestor, { attributes: true, attributeFilter: ["style", "class", "hidden", "data-variant", "data-density"] });
|
|
2060
|
+
}
|
|
2061
|
+
function edges() {
|
|
2062
|
+
const start = root.scrollLeft > 1, end = root.scrollLeft + root.clientWidth < root.scrollWidth - 1;
|
|
2063
|
+
const next = start && end ? "both" : start ? "start" : end ? "end" : "";
|
|
2064
|
+
if (next) root.dataset.overflow = next;
|
|
2065
|
+
else root.removeAttribute("data-overflow");
|
|
2066
|
+
}
|
|
2067
|
+
function update() {
|
|
2068
|
+
if (disposed) return;
|
|
2069
|
+
if (!tabs) edges();
|
|
2070
|
+
const buttons = [...root.querySelectorAll(tabs ? '[role="tab"]' : "button")];
|
|
2071
|
+
for (const node of observed) if (!buttons.includes(node) && node !== root) {
|
|
2072
|
+
observer.unobserve(node);
|
|
2073
|
+
observed.delete(node);
|
|
2074
|
+
}
|
|
2075
|
+
for (const node of [root, ...buttons]) if (!observed.has(node)) {
|
|
2076
|
+
observer.observe(node, { box: "border-box" });
|
|
2077
|
+
observed.add(node);
|
|
2078
|
+
}
|
|
2079
|
+
const next = buttons.find((button) => button.getAttribute(tabs ? "aria-selected" : "aria-pressed") === "true") || null;
|
|
2080
|
+
if (!next || !next.offsetWidth || !next.offsetHeight) {
|
|
2081
|
+
root.removeAttribute("data-indicator");
|
|
2082
|
+
marker.hidden = true;
|
|
2083
|
+
selected = null;
|
|
2084
|
+
bounds = "";
|
|
2085
|
+
return;
|
|
2086
|
+
}
|
|
2087
|
+
const underline = tabs && root.closest('[data-variant="underline"]');
|
|
2088
|
+
const style = getComputedStyle(next);
|
|
2089
|
+
const left = underline ? parseFloat(style.paddingLeft) : 0;
|
|
2090
|
+
const right = underline ? parseFloat(style.paddingRight) : 0;
|
|
2091
|
+
const height = underline ? import_tokens15.tokens.extensions.tabs.indicatorHeight : next.offsetHeight;
|
|
2092
|
+
const key = [!!underline, left, right, next.offsetLeft, next.offsetTop, next.offsetWidth, next.offsetHeight].join(",");
|
|
2093
|
+
if (key !== bounds) {
|
|
2094
|
+
marker.dataset.animate = String(!!selected && selected !== next);
|
|
2095
|
+
marker.style.transform = `translateX(${next.offsetLeft + left}px)`;
|
|
2096
|
+
marker.style.top = (underline ? next.offsetTop + next.offsetHeight - height : next.offsetTop) + "px";
|
|
2097
|
+
marker.style.width = Math.max(0, next.offsetWidth - left - right) + "px";
|
|
2098
|
+
marker.style.height = height + "px";
|
|
2099
|
+
}
|
|
2100
|
+
marker.hidden = false;
|
|
2101
|
+
root.dataset.indicator = "true";
|
|
2102
|
+
selected = next;
|
|
2103
|
+
bounds = key;
|
|
2104
|
+
}
|
|
2105
|
+
update();
|
|
2106
|
+
if (!tabs) root.addEventListener("scroll", edges, { passive: true });
|
|
2107
|
+
(_a = document.fonts) == null ? void 0 : _a.addEventListener("loadingdone", update);
|
|
2108
|
+
return { update, destroy() {
|
|
2109
|
+
var _a2;
|
|
2110
|
+
disposed = true;
|
|
2111
|
+
observer.disconnect();
|
|
2112
|
+
visibility.disconnect();
|
|
2113
|
+
root.removeEventListener("scroll", edges);
|
|
2114
|
+
(_a2 = document.fonts) == null ? void 0 : _a2.removeEventListener("loadingdone", update);
|
|
2115
|
+
} };
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
// packages/react/src/use-selection-indicator.ts
|
|
2050
2119
|
function useSelectionIndicator(tabs = false) {
|
|
2051
2120
|
const group = (0, import_react21.useRef)(null);
|
|
2052
2121
|
const indicator = (0, import_react21.useRef)(null);
|
|
2053
2122
|
const sync = (0, import_react21.useRef)(() => {
|
|
2054
2123
|
});
|
|
2055
2124
|
(0, import_react21.useLayoutEffect)(() => {
|
|
2056
|
-
var _a;
|
|
2057
2125
|
const root = group.current, marker = indicator.current;
|
|
2058
2126
|
if (!root || !marker) return;
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
let disposed = false;
|
|
2062
|
-
const observer = new ResizeObserver(() => update());
|
|
2063
|
-
const visibility = new MutationObserver(() => update());
|
|
2064
|
-
for (let ancestor = root; ancestor; ancestor = ancestor.parentElement) {
|
|
2065
|
-
visibility.observe(ancestor, { attributes: true, attributeFilter: ["style", "class", "hidden", "data-variant", "data-density"] });
|
|
2066
|
-
}
|
|
2067
|
-
const observed = /* @__PURE__ */ new Set();
|
|
2068
|
-
function edges() {
|
|
2069
|
-
const start = root.scrollLeft > 1, end = root.scrollLeft + root.clientWidth < root.scrollWidth - 1;
|
|
2070
|
-
const next = start && end ? "both" : start ? "start" : end ? "end" : "";
|
|
2071
|
-
if (next) root.dataset.overflow = next;
|
|
2072
|
-
else root.removeAttribute("data-overflow");
|
|
2073
|
-
}
|
|
2074
|
-
function update() {
|
|
2075
|
-
if (disposed) return;
|
|
2076
|
-
if (!tabs) edges();
|
|
2077
|
-
const buttons = [...root.querySelectorAll(tabs ? '[role="tab"]' : "button")];
|
|
2078
|
-
for (const node of observed) if (!buttons.includes(node) && node !== root) {
|
|
2079
|
-
observer.unobserve(node);
|
|
2080
|
-
observed.delete(node);
|
|
2081
|
-
}
|
|
2082
|
-
for (const node of [root, ...buttons]) if (!observed.has(node)) {
|
|
2083
|
-
observer.observe(node, { box: "border-box" });
|
|
2084
|
-
observed.add(node);
|
|
2085
|
-
}
|
|
2086
|
-
const next = buttons.find((button) => button.getAttribute(tabs ? "aria-selected" : "aria-pressed") === "true") || null;
|
|
2087
|
-
if (!next || !next.offsetWidth || !next.offsetHeight) {
|
|
2088
|
-
root.removeAttribute("data-indicator");
|
|
2089
|
-
marker.hidden = true;
|
|
2090
|
-
selected = null;
|
|
2091
|
-
bounds = "";
|
|
2092
|
-
return;
|
|
2093
|
-
}
|
|
2094
|
-
const underline = tabs && root.closest('[data-variant="underline"]');
|
|
2095
|
-
const style = getComputedStyle(next);
|
|
2096
|
-
const left = underline ? parseFloat(style.paddingLeft) : 0;
|
|
2097
|
-
const right = underline ? parseFloat(style.paddingRight) : 0;
|
|
2098
|
-
const height = underline ? import_tokens15.tokens.extensions.tabs.indicatorHeight : next.offsetHeight;
|
|
2099
|
-
const key = [!!underline, left, right, next.offsetLeft, next.offsetTop, next.offsetWidth, next.offsetHeight].join(",");
|
|
2100
|
-
if (key !== bounds) {
|
|
2101
|
-
marker.dataset.animate = String(!!selected && selected !== next);
|
|
2102
|
-
marker.style.transform = `translateX(${next.offsetLeft + left}px)`;
|
|
2103
|
-
marker.style.top = (underline ? next.offsetTop + next.offsetHeight - height : next.offsetTop) + "px";
|
|
2104
|
-
marker.style.width = Math.max(0, next.offsetWidth - left - right) + "px";
|
|
2105
|
-
marker.style.height = height + "px";
|
|
2106
|
-
}
|
|
2107
|
-
marker.hidden = false;
|
|
2108
|
-
root.dataset.indicator = "true";
|
|
2109
|
-
selected = next;
|
|
2110
|
-
bounds = key;
|
|
2111
|
-
}
|
|
2112
|
-
sync.current = update;
|
|
2113
|
-
update();
|
|
2114
|
-
if (!tabs) root.addEventListener("scroll", edges, { passive: true });
|
|
2115
|
-
(_a = document.fonts) == null ? void 0 : _a.addEventListener("loadingdone", update);
|
|
2127
|
+
const handle = selectionIndicator(root, marker, tabs);
|
|
2128
|
+
sync.current = handle.update;
|
|
2116
2129
|
return () => {
|
|
2117
|
-
|
|
2118
|
-
disposed = true;
|
|
2119
|
-
observer.disconnect();
|
|
2120
|
-
visibility.disconnect();
|
|
2130
|
+
handle.destroy();
|
|
2121
2131
|
sync.current = () => {
|
|
2122
2132
|
};
|
|
2123
|
-
root.removeEventListener("scroll", edges);
|
|
2124
|
-
(_a2 = document.fonts) == null ? void 0 : _a2.removeEventListener("loadingdone", update);
|
|
2125
2133
|
};
|
|
2126
2134
|
}, [tabs]);
|
|
2127
2135
|
(0, import_react21.useLayoutEffect)(() => sync.current());
|
|
2128
2136
|
return { group, indicator };
|
|
2129
2137
|
}
|
|
2130
2138
|
|
|
2139
|
+
// shared/package-runtime/group-keyboard.ts
|
|
2140
|
+
function groupKeydown(event) {
|
|
2141
|
+
var _a;
|
|
2142
|
+
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
|
|
2143
|
+
const group = event.currentTarget;
|
|
2144
|
+
const buttons = Array.from(group.querySelectorAll("button:not(:disabled)"));
|
|
2145
|
+
const current = buttons.indexOf(event.target);
|
|
2146
|
+
if (current < 0) return;
|
|
2147
|
+
event.preventDefault();
|
|
2148
|
+
const direction = getComputedStyle(group).direction === "rtl" ? -1 : 1;
|
|
2149
|
+
const next = event.key === "Home" ? 0 : event.key === "End" ? buttons.length - 1 : (current + (event.key === "ArrowRight" ? direction : -direction) + buttons.length) % buttons.length;
|
|
2150
|
+
(_a = buttons[next]) == null ? void 0 : _a.focus();
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2131
2153
|
// packages/react/src/controls.tsx
|
|
2132
2154
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2133
2155
|
function KjunCheckbox({
|
|
@@ -2337,21 +2359,6 @@ var KjunTextarea = (0, import_react22.forwardRef)(
|
|
|
2337
2359
|
);
|
|
2338
2360
|
}
|
|
2339
2361
|
);
|
|
2340
|
-
function groupKeydown(event) {
|
|
2341
|
-
var _a;
|
|
2342
|
-
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
|
|
2343
|
-
const buttons = Array.from(
|
|
2344
|
-
event.currentTarget.querySelectorAll(
|
|
2345
|
-
"button:not(:disabled)"
|
|
2346
|
-
)
|
|
2347
|
-
);
|
|
2348
|
-
const current = buttons.indexOf(event.target);
|
|
2349
|
-
if (current < 0) return;
|
|
2350
|
-
event.preventDefault();
|
|
2351
|
-
const direction = getComputedStyle(event.currentTarget).direction === "rtl" ? -1 : 1;
|
|
2352
|
-
const next = event.key === "Home" ? 0 : event.key === "End" ? buttons.length - 1 : (current + (event.key === "ArrowRight" ? direction : -direction) + buttons.length) % buttons.length;
|
|
2353
|
-
(_a = buttons[next]) == null ? void 0 : _a.focus();
|
|
2354
|
-
}
|
|
2355
2362
|
function KjunButtonGroup({
|
|
2356
2363
|
value,
|
|
2357
2364
|
options,
|
package/dist/index.js
CHANGED
|
@@ -1976,89 +1976,111 @@ import {
|
|
|
1976
1976
|
} from "react-aria-components";
|
|
1977
1977
|
|
|
1978
1978
|
// packages/react/src/use-selection-indicator.ts
|
|
1979
|
-
import { tokens as tokens11 } from "@kjun-ui/tokens";
|
|
1980
1979
|
import { useLayoutEffect as useLayoutEffect9, useRef as useRef12 } from "react";
|
|
1980
|
+
|
|
1981
|
+
// shared/package-runtime/selection-indicator.ts
|
|
1982
|
+
import { tokens as tokens11 } from "@kjun-ui/tokens";
|
|
1983
|
+
function selectionIndicator(root, marker, tabs = false) {
|
|
1984
|
+
var _a;
|
|
1985
|
+
let selected = null, bounds = "", disposed = false;
|
|
1986
|
+
const observed = /* @__PURE__ */ new Set();
|
|
1987
|
+
const observer = new ResizeObserver(() => update());
|
|
1988
|
+
const visibility = new MutationObserver(() => update());
|
|
1989
|
+
for (let ancestor = root; ancestor; ancestor = ancestor.parentElement) {
|
|
1990
|
+
visibility.observe(ancestor, { attributes: true, attributeFilter: ["style", "class", "hidden", "data-variant", "data-density"] });
|
|
1991
|
+
}
|
|
1992
|
+
function edges() {
|
|
1993
|
+
const start = root.scrollLeft > 1, end = root.scrollLeft + root.clientWidth < root.scrollWidth - 1;
|
|
1994
|
+
const next = start && end ? "both" : start ? "start" : end ? "end" : "";
|
|
1995
|
+
if (next) root.dataset.overflow = next;
|
|
1996
|
+
else root.removeAttribute("data-overflow");
|
|
1997
|
+
}
|
|
1998
|
+
function update() {
|
|
1999
|
+
if (disposed) return;
|
|
2000
|
+
if (!tabs) edges();
|
|
2001
|
+
const buttons = [...root.querySelectorAll(tabs ? '[role="tab"]' : "button")];
|
|
2002
|
+
for (const node of observed) if (!buttons.includes(node) && node !== root) {
|
|
2003
|
+
observer.unobserve(node);
|
|
2004
|
+
observed.delete(node);
|
|
2005
|
+
}
|
|
2006
|
+
for (const node of [root, ...buttons]) if (!observed.has(node)) {
|
|
2007
|
+
observer.observe(node, { box: "border-box" });
|
|
2008
|
+
observed.add(node);
|
|
2009
|
+
}
|
|
2010
|
+
const next = buttons.find((button) => button.getAttribute(tabs ? "aria-selected" : "aria-pressed") === "true") || null;
|
|
2011
|
+
if (!next || !next.offsetWidth || !next.offsetHeight) {
|
|
2012
|
+
root.removeAttribute("data-indicator");
|
|
2013
|
+
marker.hidden = true;
|
|
2014
|
+
selected = null;
|
|
2015
|
+
bounds = "";
|
|
2016
|
+
return;
|
|
2017
|
+
}
|
|
2018
|
+
const underline = tabs && root.closest('[data-variant="underline"]');
|
|
2019
|
+
const style = getComputedStyle(next);
|
|
2020
|
+
const left = underline ? parseFloat(style.paddingLeft) : 0;
|
|
2021
|
+
const right = underline ? parseFloat(style.paddingRight) : 0;
|
|
2022
|
+
const height = underline ? tokens11.extensions.tabs.indicatorHeight : next.offsetHeight;
|
|
2023
|
+
const key = [!!underline, left, right, next.offsetLeft, next.offsetTop, next.offsetWidth, next.offsetHeight].join(",");
|
|
2024
|
+
if (key !== bounds) {
|
|
2025
|
+
marker.dataset.animate = String(!!selected && selected !== next);
|
|
2026
|
+
marker.style.transform = `translateX(${next.offsetLeft + left}px)`;
|
|
2027
|
+
marker.style.top = (underline ? next.offsetTop + next.offsetHeight - height : next.offsetTop) + "px";
|
|
2028
|
+
marker.style.width = Math.max(0, next.offsetWidth - left - right) + "px";
|
|
2029
|
+
marker.style.height = height + "px";
|
|
2030
|
+
}
|
|
2031
|
+
marker.hidden = false;
|
|
2032
|
+
root.dataset.indicator = "true";
|
|
2033
|
+
selected = next;
|
|
2034
|
+
bounds = key;
|
|
2035
|
+
}
|
|
2036
|
+
update();
|
|
2037
|
+
if (!tabs) root.addEventListener("scroll", edges, { passive: true });
|
|
2038
|
+
(_a = document.fonts) == null ? void 0 : _a.addEventListener("loadingdone", update);
|
|
2039
|
+
return { update, destroy() {
|
|
2040
|
+
var _a2;
|
|
2041
|
+
disposed = true;
|
|
2042
|
+
observer.disconnect();
|
|
2043
|
+
visibility.disconnect();
|
|
2044
|
+
root.removeEventListener("scroll", edges);
|
|
2045
|
+
(_a2 = document.fonts) == null ? void 0 : _a2.removeEventListener("loadingdone", update);
|
|
2046
|
+
} };
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
// packages/react/src/use-selection-indicator.ts
|
|
1981
2050
|
function useSelectionIndicator(tabs = false) {
|
|
1982
2051
|
const group = useRef12(null);
|
|
1983
2052
|
const indicator = useRef12(null);
|
|
1984
2053
|
const sync = useRef12(() => {
|
|
1985
2054
|
});
|
|
1986
2055
|
useLayoutEffect9(() => {
|
|
1987
|
-
var _a;
|
|
1988
2056
|
const root = group.current, marker = indicator.current;
|
|
1989
2057
|
if (!root || !marker) return;
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
let disposed = false;
|
|
1993
|
-
const observer = new ResizeObserver(() => update());
|
|
1994
|
-
const visibility = new MutationObserver(() => update());
|
|
1995
|
-
for (let ancestor = root; ancestor; ancestor = ancestor.parentElement) {
|
|
1996
|
-
visibility.observe(ancestor, { attributes: true, attributeFilter: ["style", "class", "hidden", "data-variant", "data-density"] });
|
|
1997
|
-
}
|
|
1998
|
-
const observed = /* @__PURE__ */ new Set();
|
|
1999
|
-
function edges() {
|
|
2000
|
-
const start = root.scrollLeft > 1, end = root.scrollLeft + root.clientWidth < root.scrollWidth - 1;
|
|
2001
|
-
const next = start && end ? "both" : start ? "start" : end ? "end" : "";
|
|
2002
|
-
if (next) root.dataset.overflow = next;
|
|
2003
|
-
else root.removeAttribute("data-overflow");
|
|
2004
|
-
}
|
|
2005
|
-
function update() {
|
|
2006
|
-
if (disposed) return;
|
|
2007
|
-
if (!tabs) edges();
|
|
2008
|
-
const buttons = [...root.querySelectorAll(tabs ? '[role="tab"]' : "button")];
|
|
2009
|
-
for (const node of observed) if (!buttons.includes(node) && node !== root) {
|
|
2010
|
-
observer.unobserve(node);
|
|
2011
|
-
observed.delete(node);
|
|
2012
|
-
}
|
|
2013
|
-
for (const node of [root, ...buttons]) if (!observed.has(node)) {
|
|
2014
|
-
observer.observe(node, { box: "border-box" });
|
|
2015
|
-
observed.add(node);
|
|
2016
|
-
}
|
|
2017
|
-
const next = buttons.find((button) => button.getAttribute(tabs ? "aria-selected" : "aria-pressed") === "true") || null;
|
|
2018
|
-
if (!next || !next.offsetWidth || !next.offsetHeight) {
|
|
2019
|
-
root.removeAttribute("data-indicator");
|
|
2020
|
-
marker.hidden = true;
|
|
2021
|
-
selected = null;
|
|
2022
|
-
bounds = "";
|
|
2023
|
-
return;
|
|
2024
|
-
}
|
|
2025
|
-
const underline = tabs && root.closest('[data-variant="underline"]');
|
|
2026
|
-
const style = getComputedStyle(next);
|
|
2027
|
-
const left = underline ? parseFloat(style.paddingLeft) : 0;
|
|
2028
|
-
const right = underline ? parseFloat(style.paddingRight) : 0;
|
|
2029
|
-
const height = underline ? tokens11.extensions.tabs.indicatorHeight : next.offsetHeight;
|
|
2030
|
-
const key = [!!underline, left, right, next.offsetLeft, next.offsetTop, next.offsetWidth, next.offsetHeight].join(",");
|
|
2031
|
-
if (key !== bounds) {
|
|
2032
|
-
marker.dataset.animate = String(!!selected && selected !== next);
|
|
2033
|
-
marker.style.transform = `translateX(${next.offsetLeft + left}px)`;
|
|
2034
|
-
marker.style.top = (underline ? next.offsetTop + next.offsetHeight - height : next.offsetTop) + "px";
|
|
2035
|
-
marker.style.width = Math.max(0, next.offsetWidth - left - right) + "px";
|
|
2036
|
-
marker.style.height = height + "px";
|
|
2037
|
-
}
|
|
2038
|
-
marker.hidden = false;
|
|
2039
|
-
root.dataset.indicator = "true";
|
|
2040
|
-
selected = next;
|
|
2041
|
-
bounds = key;
|
|
2042
|
-
}
|
|
2043
|
-
sync.current = update;
|
|
2044
|
-
update();
|
|
2045
|
-
if (!tabs) root.addEventListener("scroll", edges, { passive: true });
|
|
2046
|
-
(_a = document.fonts) == null ? void 0 : _a.addEventListener("loadingdone", update);
|
|
2058
|
+
const handle = selectionIndicator(root, marker, tabs);
|
|
2059
|
+
sync.current = handle.update;
|
|
2047
2060
|
return () => {
|
|
2048
|
-
|
|
2049
|
-
disposed = true;
|
|
2050
|
-
observer.disconnect();
|
|
2051
|
-
visibility.disconnect();
|
|
2061
|
+
handle.destroy();
|
|
2052
2062
|
sync.current = () => {
|
|
2053
2063
|
};
|
|
2054
|
-
root.removeEventListener("scroll", edges);
|
|
2055
|
-
(_a2 = document.fonts) == null ? void 0 : _a2.removeEventListener("loadingdone", update);
|
|
2056
2064
|
};
|
|
2057
2065
|
}, [tabs]);
|
|
2058
2066
|
useLayoutEffect9(() => sync.current());
|
|
2059
2067
|
return { group, indicator };
|
|
2060
2068
|
}
|
|
2061
2069
|
|
|
2070
|
+
// shared/package-runtime/group-keyboard.ts
|
|
2071
|
+
function groupKeydown(event) {
|
|
2072
|
+
var _a;
|
|
2073
|
+
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
|
|
2074
|
+
const group = event.currentTarget;
|
|
2075
|
+
const buttons = Array.from(group.querySelectorAll("button:not(:disabled)"));
|
|
2076
|
+
const current = buttons.indexOf(event.target);
|
|
2077
|
+
if (current < 0) return;
|
|
2078
|
+
event.preventDefault();
|
|
2079
|
+
const direction = getComputedStyle(group).direction === "rtl" ? -1 : 1;
|
|
2080
|
+
const next = event.key === "Home" ? 0 : event.key === "End" ? buttons.length - 1 : (current + (event.key === "ArrowRight" ? direction : -direction) + buttons.length) % buttons.length;
|
|
2081
|
+
(_a = buttons[next]) == null ? void 0 : _a.focus();
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2062
2084
|
// packages/react/src/controls.tsx
|
|
2063
2085
|
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2064
2086
|
function KjunCheckbox({
|
|
@@ -2268,21 +2290,6 @@ var KjunTextarea = forwardRef3(
|
|
|
2268
2290
|
);
|
|
2269
2291
|
}
|
|
2270
2292
|
);
|
|
2271
|
-
function groupKeydown(event) {
|
|
2272
|
-
var _a;
|
|
2273
|
-
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
|
|
2274
|
-
const buttons = Array.from(
|
|
2275
|
-
event.currentTarget.querySelectorAll(
|
|
2276
|
-
"button:not(:disabled)"
|
|
2277
|
-
)
|
|
2278
|
-
);
|
|
2279
|
-
const current = buttons.indexOf(event.target);
|
|
2280
|
-
if (current < 0) return;
|
|
2281
|
-
event.preventDefault();
|
|
2282
|
-
const direction = getComputedStyle(event.currentTarget).direction === "rtl" ? -1 : 1;
|
|
2283
|
-
const next = event.key === "Home" ? 0 : event.key === "End" ? buttons.length - 1 : (current + (event.key === "ArrowRight" ? direction : -direction) + buttons.length) % buttons.length;
|
|
2284
|
-
(_a = buttons[next]) == null ? void 0 : _a.focus();
|
|
2285
|
-
}
|
|
2286
2293
|
function KjunButtonGroup({
|
|
2287
2294
|
value,
|
|
2288
2295
|
options,
|